aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerd Moellmann1999-12-27 12:27:32 +0000
committerGerd Moellmann1999-12-27 12:27:32 +0000
commit776d8e16b1be04fc07176cfc3150d32813ccb206 (patch)
tree286b8baab446160ad7b8735280539cc1164313ec
parentc388b3c2b86d284834a7f2af833337037f58415f (diff)
downloademacs-776d8e16b1be04fc07176cfc3150d32813ccb206.tar.gz
emacs-776d8e16b1be04fc07176cfc3150d32813ccb206.zip
(change-log-version-number-regexp-list)
(change-log-version-info-enabled): Change :version to 21.1. (toplevel): Require CL when compiling. (change-log-version-number-regexp-list): Added tag :version 20.6 (change-log-version-info-enabled): Added tag :version 20.6 More general version number search with user-configurable regexp list. (change-log-version-number-regexp-list): New user variable. (change-log-find-version): Rewritten. Use user-configurable version numbering regexp list change-log-version-number-regexp-list. (change-log-find-version): Renamed to change-log-version-number-search (add-log-file-name-function): New. (change-log-search-vc-number): Added END paramaeter. Added doc string to function. (change-log-version-rcs): Renamed. Was change-log-search-vc-number.
-rw-r--r--lisp/ChangeLog28
-rw-r--r--lisp/add-log.el87
2 files changed, 111 insertions, 4 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 86853c02caa..b88584bb467 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,31 @@
11999-12-27 Gerd Moellmann <gerd@gnu.org>
2
3 * add-log.el (change-log-version-number-regexp-list)
4 (change-log-version-info-enabled): Change :version to 21.1.
5 (toplevel): Require CL when compiling.
6
71999-12-27 Jari Aalto <jari.aalto@poboxes.com>
8
9 * add-log.el (change-log-version-number-regexp-list): Added tag
10 :version 20.6
11 (change-log-version-info-enabled): Added tag :version 20.6
12
131999-12-27 Jari Aalto <jari.aalto@poboxes.com>
14
15 * add-log.el: More general version number search with
16 user-configurable regexp list.
17 (change-log-version-number-regexp-list): New user variable.
18 (change-log-find-version): Rewritten. Use user-configurable
19 version numbering regexp list
20 change-log-version-number-regexp-list.
21 (change-log-find-version): Renamed to
22 change-log-version-number-search
23 (add-log-file-name-function): New.
24 (change-log-search-vc-number): Added END paramaeter. Added doc
25 string to function.
26 (change-log-version-rcs): Renamed. Was
27 change-log-search-vc-number.
28
11999-12-25 Richard M. Stallman <rms@caffeine.ai.mit.edu> 291999-12-25 Richard M. Stallman <rms@caffeine.ai.mit.edu>
2 30
3 * jka-compr.el (jka-compr-info-file-magic-bytes): New function. 31 * jka-compr.el (jka-compr-info-file-magic-bytes): New function.
diff --git a/lisp/add-log.el b/lisp/add-log.el
index cd41f1ac1d8..b0ba9b239c0 100644
--- a/lisp/add-log.el
+++ b/lisp/add-log.el
@@ -27,7 +27,9 @@
27 27
28;;; Code: 28;;; Code:
29 29
30(eval-when-compile (require 'fortran)) 30(eval-when-compile
31 (require 'fortran)
32 (require 'cl))
31 33
32(defgroup change-log nil 34(defgroup change-log nil
33 "Change log maintenance" 35 "Change log maintenance"
@@ -124,6 +126,30 @@ relative to the directory of the change log file."
124 :type 'function 126 :type 'function
125 :group 'change-log) 127 :group 'change-log)
126 128
129
130(defcustom change-log-version-info-enabled nil
131 "*If non-nil, enable recording version numbers with the changes."
132 :version "21.1"
133 :type 'boolean
134 :group 'change-log)
135
136(defcustom change-log-version-number-regexp-list
137 (let ((re "\\([0-9]+\.[0-9.]+\\)"))
138 (list
139 ;; (defconst ad-version "2.15"
140 (concat "^(def[^ \t\n]+[ \t]+[^ \t\n][ \t]\"" re)
141 ;; Revision: pcl-cvs.el,v 1.72 1999/09/05 20:21:54 monnier Exp
142 (concat "^;+ *Revision: +[^ \t\n]+[ \t]+" re)
143 ;; SCCS @(#)igrep.el 2.83
144 (concat "SCCS[ \t]+@(#).*[ \t]+" re)
145 ))
146 "*List of regexps to search for version number.
147Note: The search is conducted only within 10%, at the beginning of the file."
148 :version "21.1"
149 :type '(repeat regexp)
150 :group 'change-log)
151
152
127(defvar change-log-font-lock-keywords 153(defvar change-log-font-lock-keywords
128 '(;; 154 '(;;
129 ;; Date lines, new and old styles. 155 ;; Date lines, new and old styles.
@@ -222,6 +248,52 @@ If nil, use local time.")
222 (file-name-as-directory name)) 248 (file-name-as-directory name))
223 name)))) 249 name))))
224 250
251(defun change-log-version-rcs (rcs-string &optional end)
252 "Search for plain RCS-STRING from whole buffer up till END.
253The surrounding $ characters fro RCS-STRING are added in this function;
254provide argument e.g. as \"Id\"."
255 (let (str)
256 (save-excursion
257 (goto-char (point-min))
258 (when (re-search-forward
259 (concat "[$]" rcs-string ":[^\n$]+[$]")
260 end t)
261 (setq str (match-string 0))
262 (when (string-match "[0-9]+\.[0-9.]+" str)
263 (match-string 0 str))))))
264
265(defun change-log-version-number-search ()
266 "Return version number for the file by searchin version control tags."
267 (let* ((size (buffer-size))
268 (end
269 ;; The version number can be anywhere in the file, but restrict
270 ;; search to the file beginning: 10% should be enough to prevent
271 ;; some mishits.
272 ;;
273 ;; Apply percentage only if buffer size is bigger than approx 100 lines
274 (if (> size (* 100 80))
275 (/ (* (buffer-size) 10) 100)
276 size))
277 version)
278
279 ;; Search RCS, CVS version strings
280
281 (dolist (choice '("Revision" "Id"))
282 (when (setq version (change-log-version-rcs choice end))
283 (return)))
284
285 (unless version
286 (dolist (regexp change-log-version-number-regexp-list)
287 (save-excursion
288 (goto-char (point-min))
289 (when (re-search-forward regexp end t)
290 (setq version (match-string 1))
291 (return)))))
292
293 version
294 ))
295
296
225;;;###autoload 297;;;###autoload
226(defun find-change-log (&optional file-name) 298(defun find-change-log (&optional file-name)
227 "Find a change log file for \\[add-change-log-entry] and return the name. 299 "Find a change log file for \\[add-change-log-entry] and return the name.
@@ -310,7 +382,10 @@ non-nil, otherwise in local time."
310 (read-input "Mailing address: " add-log-mailing-address)))) 382 (read-input "Mailing address: " add-log-mailing-address))))
311 (let ((defun (funcall (or add-log-current-defun-function 383 (let ((defun (funcall (or add-log-current-defun-function
312 'add-log-current-defun))) 384 'add-log-current-defun)))
313 bound entry) 385 (version (and change-log-version-info-enabled
386 (change-log-version-number-search)))
387 bound
388 entry)
314 389
315 (setq file-name (expand-file-name (find-change-log file-name))) 390 (setq file-name (expand-file-name (find-change-log file-name)))
316 391
@@ -385,7 +460,8 @@ non-nil, otherwise in local time."
385 (insert "\n\n\n") 460 (insert "\n\n\n")
386 (forward-line -2) 461 (forward-line -2)
387 (indent-to left-margin) 462 (indent-to left-margin)
388 (insert "* " (or entry "")))) 463 (insert "* " (or entry ""))
464 ))
389 ;; Now insert the function name, if we have one. 465 ;; Now insert the function name, if we have one.
390 ;; Point is at the entry for this file, 466 ;; Point is at the entry for this file,
391 ;; either at the end of the line or at the first blank line. 467 ;; either at the end of the line or at the first blank line.
@@ -398,7 +474,10 @@ non-nil, otherwise in local time."
398 (looking-at "\\s *$")) 474 (looking-at "\\s *$"))
399 "" 475 ""
400 " ") 476 " ")
401 "(" defun "): ")) 477 "(" defun "): "
478 (if version
479 (concat version " ")
480 "")))
402 ;; No function name, so put in a colon unless we have just a star. 481 ;; No function name, so put in a colon unless we have just a star.
403 (if (not (save-excursion 482 (if (not (save-excursion
404 (beginning-of-line 1) 483 (beginning-of-line 1)