diff options
| author | Stefan Monnier | 2009-09-22 15:39:02 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2009-09-22 15:39:02 +0000 |
| commit | 905b7d38170aebf5d0ebc2f401eabf3a3535cfae (patch) | |
| tree | f570e39a151a0d7e1e187f916c049e7fdb34657e | |
| parent | baa7f3de13241c665b8b2a5f6192acf2f15e8932 (diff) | |
| download | emacs-905b7d38170aebf5d0ebc2f401eabf3a3535cfae.tar.gz emacs-905b7d38170aebf5d0ebc2f401eabf3a3535cfae.zip | |
(change-log-fill-forward-paragraph): New function.
(change-log-mode): Use it so fill-region DTRT.
Set fill-indent-according-to-mode here rather than in
change-log-fill-paragraph.
(change-log-fill-paragraph): Remove.
| -rw-r--r-- | lisp/ChangeLog | 8 | ||||
| -rw-r--r-- | lisp/add-log.el | 27 |
2 files changed, 17 insertions, 18 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 551497b17c2..820724277d9 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2009-09-22 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * add-log.el (change-log-fill-forward-paragraph): New function. | ||
| 4 | (change-log-mode): Use it so fill-region DTRT. | ||
| 5 | Set fill-indent-according-to-mode here rather than in | ||
| 6 | change-log-fill-paragraph. | ||
| 7 | (change-log-fill-paragraph): Remove. | ||
| 8 | |||
| 1 | 2009-09-22 Juanma Barranquero <lekktu@gmail.com> | 9 | 2009-09-22 Juanma Barranquero <lekktu@gmail.com> |
| 2 | 10 | ||
| 3 | * info.el (Info-try-follow-nearest-node): Use the URL extracted by | 11 | * info.el (Info-try-follow-nearest-node): Use the URL extracted by |
diff --git a/lisp/add-log.el b/lisp/add-log.el index c8b34a6e081..c3e8364f1f1 100644 --- a/lisp/add-log.el +++ b/lisp/add-log.el | |||
| @@ -1029,8 +1029,10 @@ Runs `change-log-mode-hook'. | |||
| 1029 | indent-tabs-mode t | 1029 | indent-tabs-mode t |
| 1030 | tab-width 8 | 1030 | tab-width 8 |
| 1031 | show-trailing-whitespace t) | 1031 | show-trailing-whitespace t) |
| 1032 | (set (make-local-variable 'fill-paragraph-function) | 1032 | (set (make-local-variable 'fill-forward-paragraph-function) |
| 1033 | 'change-log-fill-paragraph) | 1033 | 'change-log-fill-forward-paragraph) |
| 1034 | ;; Make sure we call `change-log-indent' when filling. | ||
| 1035 | (set (make-local-variable 'fill-indent-according-to-mode) t) | ||
| 1034 | ;; Avoid that filling leaves behind a single "*" on a line. | 1036 | ;; Avoid that filling leaves behind a single "*" on a line. |
| 1035 | (add-hook 'fill-nobreak-predicate | 1037 | (add-hook 'fill-nobreak-predicate |
| 1036 | '(lambda () | 1038 | '(lambda () |
| @@ -1086,23 +1088,12 @@ file were isearch was started." | |||
| 1086 | (cadr (member (file-name-nondirectory (buffer-file-name buffer)) | 1088 | (cadr (member (file-name-nondirectory (buffer-file-name buffer)) |
| 1087 | files)))))) | 1089 | files)))))) |
| 1088 | 1090 | ||
| 1089 | ;; It might be nice to have a general feature to replace this. The idea I | 1091 | (defun change-log-fill-forward-paragraph (n) |
| 1090 | ;; have is a variable giving a regexp matching text which should not be | 1092 | "Cut paragraphs so filling preserves open parentheses at beginning of lines." |
| 1091 | ;; moved from bol by filling. change-log-mode would set this to "^\\s *\\s(". | 1093 | (let (;; Add lines starting with whitespace followed by a left paren or an |
| 1092 | ;; But I don't feel up to implementing that today. | ||
| 1093 | (defun change-log-fill-paragraph (&optional justify) | ||
| 1094 | "Fill the paragraph, but preserve open parentheses at beginning of lines. | ||
| 1095 | Prefix arg means justify as well." | ||
| 1096 | (interactive "P") | ||
| 1097 | (let ((end (progn (forward-paragraph) (point))) | ||
| 1098 | (beg (progn (backward-paragraph) (point))) | ||
| 1099 | ;; Add lines starting with whitespace followed by a left paren or an | ||
| 1100 | ;; asterisk. | 1094 | ;; asterisk. |
| 1101 | (paragraph-start (concat paragraph-start "\\|\\s *\\(?:\\s(\\|\\*\\)")) | 1095 | (paragraph-start (concat paragraph-start "\\|\\s *\\(?:\\s(\\|\\*\\)"))) |
| 1102 | ;; Make sure we call `change-log-indent'. | 1096 | (forward-paragraph n))) |
| 1103 | (fill-indent-according-to-mode t)) | ||
| 1104 | (fill-region beg end justify) | ||
| 1105 | t)) | ||
| 1106 | 1097 | ||
| 1107 | (defcustom add-log-current-defun-header-regexp | 1098 | (defcustom add-log-current-defun-header-regexp |
| 1108 | "^\\([[:upper:]][[:upper:]_ ]*[[:upper:]_]\\|[-_[:alpha:]]+\\)[ \t]*[:=]" | 1099 | "^\\([[:upper:]][[:upper:]_ ]*[[:upper:]_]\\|[-_[:alpha:]]+\\)[ \t]*[:=]" |