summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Müller <ulm@gentoo.org>2023-09-20 20:38:02 +0200
committerUlrich Müller <ulm@gentoo.org>2023-09-20 20:38:02 +0200
commit918f73e47496fbbdfa7d1e602ea9808c24508c14 (patch)
tree71bd76ed4da2144bfdb037120b1e8081a71068d3
parentUpdate format-time-string test for newer XEmacs versions (diff)
downloadebuild-mode-918f73e47496fbbdfa7d1e602ea9808c24508c14.tar.gz
ebuild-mode-918f73e47496fbbdfa7d1e602ea9808c24508c14.tar.bz2
ebuild-mode-918f73e47496fbbdfa7d1e602ea9808c24508c14.zip
Fix filling of paragraphs when in conf-unix-mode
* ebuild-mode.el (ebuild-mode-tag-line-regexp): New variable. (ebuild-repo-mode): Set paragraph-separate when in conf-unix-mode. Signed-off-by: Ulrich Müller <ulm@gentoo.org>
-rw-r--r--ChangeLog5
-rw-r--r--ebuild-mode.el20
2 files changed, 23 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 7cbdd2a..3f0ff15 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2023-09-20 Ulrich Müller <ulm@gentoo.org>
+
+ * ebuild-mode.el (ebuild-mode-tag-line-regexp): New variable.
+ (ebuild-repo-mode): Set paragraph-separate when in conf-unix-mode.
+
2023-09-16 Ulrich Müller <ulm@gentoo.org>
* ebuild-mode.el (ebuild-mode-time-string): Test if
diff --git a/ebuild-mode.el b/ebuild-mode.el
index 816f181..9e014b4 100644
--- a/ebuild-mode.el
+++ b/ebuild-mode.el
@@ -813,6 +813,12 @@ This will be added to the `write-contents-functions' hook."
(make-sparse-keymap)
"Keymap for `ebuild-repo-mode'.")
+(defvar ebuild-mode-tag-line-regexp
+ ".*[ \t]+<.*>[ \t]+([0-9]\\{4\\}-[01][0-9]-[0-3][0-9])$"
+ "Regexp matching an author/date tag line in a configuration file.
+This excludes `comment-start'. See `ebuild-mode-insert-tag-line'
+for the format of the tag line.")
+
;;;###autoload
(define-minor-mode ebuild-repo-mode
"Minor mode for files in an ebuild repository."
@@ -830,7 +836,17 @@ This will be added to the `write-contents-functions' hook."
(setq fill-column 72))
(unless (local-variable-p 'tab-width (current-buffer))
(setq tab-width 4))
- (when (derived-mode-p 'nxml-mode)
+ (cond
+ ((derived-mode-p 'conf-unix-mode)
+ (unless (local-variable-p 'paragraph-separate (current-buffer))
+ ;; Prevent fill-paragraph from rewrapping the paragraph into
+ ;; a preceding author/date tag line
+ (set (make-local-variable 'paragraph-separate)
+ (concat (default-value 'paragraph-separate)
+ "\\|^"
+ (regexp-quote (concat comment-start))
+ ebuild-mode-tag-line-regexp))))
+ ((derived-mode-p 'nxml-mode)
(eval-when-compile (ignore-errors (require 'nxml-mode)))
(unless (or (local-variable-p 'nxml-child-indent (current-buffer))
(local-variable-p 'nxml-attribute-indent (current-buffer)))
@@ -838,7 +854,7 @@ This will be added to the `write-contents-functions' hook."
(set (make-local-variable 'nxml-child-indent) indent)
(set (make-local-variable 'nxml-attribute-indent) (* 2 indent))))
(unless (local-variable-p 'indent-tabs-mode (current-buffer))
- (setq indent-tabs-mode ebuild-mode-xml-indent-tabs))))
+ (setq indent-tabs-mode ebuild-mode-xml-indent-tabs)))))
;;;###autoload
(defun ebuild-repo-mode-maybe-enable ()