aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/add-log.el30
1 files changed, 27 insertions, 3 deletions
diff --git a/lisp/add-log.el b/lisp/add-log.el
index 28461887a1f..46c24585921 100644
--- a/lisp/add-log.el
+++ b/lisp/add-log.el
@@ -41,6 +41,7 @@ instead) with no arguments. It returns a string or nil if it cannot guess.")
41 (or change-log-default-name 41 (or change-log-default-name
42 (if (eq system-type 'vax-vms) "$CHANGE_LOG$.TXT" "ChangeLog"))) 42 (if (eq system-type 'vax-vms) "$CHANGE_LOG$.TXT" "ChangeLog")))
43 43
44;;;###autoload
44(defun prompt-for-change-log-name () 45(defun prompt-for-change-log-name ()
45 "Prompt for a change log name." 46 "Prompt for a change log name."
46 (let ((default (change-log-name))) 47 (let ((default (change-log-name)))
@@ -100,11 +101,13 @@ current buffer to the complete file name."
100 file-name)) 101 file-name))
101 102
102;;;###autoload 103;;;###autoload
103(defun add-change-log-entry (&optional whoami file-name other-window) 104(defun add-change-log-entry (&optional whoami file-name other-window new-entry)
104 "Find change log file and add an entry for today. 105 "Find change log file and add an entry for today.
105Optional arg (interactive prefix) non-nil means prompt for user name and site. 106Optional arg (interactive prefix) non-nil means prompt for user name and site.
106Second arg is file name of change log. If nil, uses `change-log-default-name'. 107Second arg is file name of change log. If nil, uses `change-log-default-name'.
107Third arg OTHER-WINDOW non-nil means visit in other window." 108Third arg OTHER-WINDOW non-nil means visit in other window.
109Fourth arg NEW-ENTRY non-nil means always create a new entry at the front;
110never append to an existing entry."
108 (interactive (list current-prefix-arg 111 (interactive (list current-prefix-arg
109 (prompt-for-change-log-name))) 112 (prompt-for-change-log-name)))
110 (let* ((full-name (if whoami 113 (let* ((full-name (if whoami
@@ -163,7 +166,8 @@ Third arg OTHER-WINDOW non-nil means visit in other window."
163 ;; Put this file name into the existing empty entry. 166 ;; Put this file name into the existing empty entry.
164 (if entry 167 (if entry
165 (insert entry))) 168 (insert entry)))
166 ((and (re-search-forward 169 ((and (not new-entry)
170 (re-search-forward
167 (concat (regexp-quote (concat "* " entry)) 171 (concat (regexp-quote (concat "* " entry))
168 ;; Don't accept `foo.bar' when 172 ;; Don't accept `foo.bar' when
169 ;; looking for `foo': 173 ;; looking for `foo':
@@ -233,6 +237,7 @@ Runs `change-log-mode-hook'."
233 mode-name "Change Log" 237 mode-name "Change Log"
234 left-margin 8 238 left-margin 8
235 fill-column 74) 239 fill-column 74)
240 (use-local-map change-log-mode-map)
236 ;; Let each entry behave as one paragraph: 241 ;; Let each entry behave as one paragraph:
237 (set (make-local-variable 'paragraph-start) "^\\s *$\\|^^L") 242 (set (make-local-variable 'paragraph-start) "^\\s *$\\|^^L")
238 (set (make-local-variable 'paragraph-separate) "^\\s *$\\|^^L\\|^\\sw") 243 (set (make-local-variable 'paragraph-separate) "^\\s *$\\|^^L\\|^\\sw")
@@ -244,6 +249,25 @@ Runs `change-log-mode-hook'."
244 (set (make-local-variable 'adaptive-fill-regexp) "\\s *") 249 (set (make-local-variable 'adaptive-fill-regexp) "\\s *")
245 (run-hooks 'change-log-mode-hook)) 250 (run-hooks 'change-log-mode-hook))
246 251
252(defvar change-log-mode-map nil
253 "Keymap for Change Log major mode.")
254(if change-log-mode-map
255 nil
256 (setq change-log-mode-map (make-sparse-keymap))
257 (define-key change-log-mode-map "\M-q" 'change-log-fill-paragraph))
258
259;; It might be nice to have a general feature to replace this. The idea I
260;; have is a variable giving a regexp matching text which should not be
261;; moved from bol by filling. change-log-mode would set this to "^\\s *\\s(".
262;; But I don't feel up to implementing that today.
263(defun change-log-fill-paragraph (&optional justify)
264 "Fill the paragraph, but preserve open parentheses at beginning of lines.
265Prefix arg means justify as well."
266 (interactive "P")
267 (let ((paragraph-separate (concat paragraph-separate "\\|^\\s *\\s("))
268 (paragraph-start (concat paragraph-start "\\|^\\s *\\s(")))
269 (fill-paragraph justify)))
270
247(defvar add-log-current-defun-header-regexp 271(defvar add-log-current-defun-header-regexp
248 "^\\([A-Z][A-Z_ ]*[A-Z_]\\|[a-z_---A-Z]+\\)[ \t]*[:=]" 272 "^\\([A-Z][A-Z_ ]*[A-Z_]\\|[a-z_---A-Z]+\\)[ \t]*[:=]"
249 "*Heuristic regexp used by `add-log-current-defun' for unknown major modes.") 273 "*Heuristic regexp used by `add-log-current-defun' for unknown major modes.")