changeset 51368:cc73795bc08a

(log-edit-maximum-comment-ring-size, log-edit-comment-ring) (log-edit-comment-ring-index, log-edit-last-comment-match): Rename vars from vc-maximum-comment-ring-size, vc-comment-ring, vc-comment-ring-index, and vc-last-comment-match. (log-edit-new-comment-index, log-edit-previous-comment) (log-edit-next-comment, log-edit-comment-search-backward) (log-edit-comment-search-forward, log-edit-comment-to-change-log): Rename funs from vc-new-comment-index, vc-previous-comment, vc-next-comment, vc-comment-search-reverse, vc-comment-search-forward, and vc-comment-to-change-log.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Sat, 31 May 2003 16:43:30 +0000
parents f880f27737f4
children 91b1fb194872
files lisp/log-edit.el
diffstat 1 files changed, 61 insertions(+), 47 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/log-edit.el	Sat May 31 16:21:25 2003 +0000
+++ b/lisp/log-edit.el	Sat May 31 16:43:30 2003 +0000
@@ -57,10 +57,10 @@
   `(("\C-c\C-c" . log-edit-done)
     ("\C-c\C-a" . log-edit-insert-changelog)
     ("\C-c\C-f" . log-edit-show-files)
-    ("\M-n"	. vc-next-comment)
-    ("\M-p"	. vc-previous-comment)
-    ("\M-r"	. vc-comment-search-reverse)
-    ("\M-s"	. vc-comment-search-forward)
+    ("\M-n"	. log-edit-next-comment)
+    ("\M-p"	. log-edit-previous-comment)
+    ("\M-r"	. log-edit-comment-search-backward)
+    ("\M-s"	. log-edit-comment-search-forward)
     ("\C-c?"	. log-edit-mode-help))
   "Keymap for the `log-edit-mode' (to edit version control log messages)."
   :group 'log-edit)
@@ -81,10 +81,10 @@
     ["List files" log-edit-show-files
      :help "Show the list of relevant files."]
     "--"
-    ["Previous comment" vc-previous-comment]
-    ["Next comment" vc-next-comment]
-    ["Search comment forward" vc-comment-search-forward]
-    ["Search comment backward" vc-comment-search-reverse]))
+    ["Previous comment"		log-edit-previous-comment]
+    ["Next comment"		log-edit-next-comment]
+    ["Search comment forward"	log-edit-comment-search-forward]
+    ["Search comment backward"	log-edit-comment-search-backward]))
 
 (defcustom log-edit-confirm 'changed
   "*If non-nil, `log-edit-done' will request confirmation.
@@ -170,19 +170,19 @@
 (defvar log-edit-listfun nil)
 (defvar log-edit-parent-buffer nil)
 
-;;; Taken from VC-Log mode
+;;; Originally taken from VC-Log mode
 
-(defconst vc-maximum-comment-ring-size 32
+(defconst log-edit-maximum-comment-ring-size 32
   "Maximum number of saved comments in the comment ring.")
-(defvar vc-comment-ring (make-ring vc-maximum-comment-ring-size))
-(defvar vc-comment-ring-index nil)
-(defvar vc-last-comment-match "")
+(defvar log-edit-comment-ring (make-ring log-edit-maximum-comment-ring-size))
+(defvar log-edit-comment-ring-index nil)
+(defvar log-edit-last-comment-match "")
 
-(defun vc-new-comment-index (stride len)
+(defun log-edit-new-comment-index (stride len)
   "Return the comment index STRIDE elements from the current one.
-LEN is the length of `vc-comment-ring'."
+LEN is the length of `log-edit-comment-ring'."
   (mod (cond
-	(vc-comment-ring-index (+ vc-comment-ring-index stride))
+	(log-edit-comment-ring-index (+ log-edit-comment-ring-index stride))
 	;; Initialize the index on the first use of this command
 	;; so that the first M-p gets index 0, and the first M-n gets
 	;; index -1.
@@ -190,66 +190,64 @@
 	(t stride))
        len))
 
-(defun vc-previous-comment (arg)
+(defun log-edit-previous-comment (arg)
   "Cycle backwards through comment history.
 With a numeric prefix ARG, go back ARG comments."
   (interactive "*p")
-  (let ((len (ring-length vc-comment-ring)))
+  (let ((len (ring-length log-edit-comment-ring)))
     (if (<= len 0)
 	(progn (message "Empty comment ring") (ding))
       ;; Don't use `erase-buffer' because we don't want to `widen'.
       (delete-region (point-min) (point-max))
-      (setq vc-comment-ring-index (vc-new-comment-index arg len))
-      (message "Comment %d" (1+ vc-comment-ring-index))
-      (insert (ring-ref vc-comment-ring vc-comment-ring-index)))))
+      (setq log-edit-comment-ring-index (log-edit-new-comment-index arg len))
+      (message "Comment %d" (1+ log-edit-comment-ring-index))
+      (insert (ring-ref log-edit-comment-ring log-edit-comment-ring-index)))))
 
-(defun vc-next-comment (arg)
+(defun log-edit-next-comment (arg)
   "Cycle forwards through comment history.
 With a numeric prefix ARG, go forward ARG comments."
   (interactive "*p")
-  (vc-previous-comment (- arg)))
+  (log-edit-previous-comment (- arg)))
 
-(defun vc-comment-search-reverse (str &optional stride)
+(defun log-edit-comment-search-backward (str &optional stride)
   "Search backwards through comment history for substring match of STR.
 If the optional argument STRIDE is present, that is a step-width to use
 when going through the comment ring."
   ;; Why substring rather than regexp ?   -sm
   (interactive
-   (list (read-string "Comment substring: " nil nil vc-last-comment-match)))
+   (list (read-string "Comment substring: " nil nil log-edit-last-comment-match)))
   (unless stride (setq stride 1))
   (if (string= str "")
-      (setq str vc-last-comment-match)
-    (setq vc-last-comment-match str))
+      (setq str log-edit-last-comment-match)
+    (setq log-edit-last-comment-match str))
   (let* ((str (regexp-quote str))
-	 (len (ring-length vc-comment-ring))
-	 (n (vc-new-comment-index stride len)))
+	 (len (ring-length log-edit-comment-ring))
+	 (n (log-edit-new-comment-index stride len)))
     (while (progn (when (or (>= n len) (< n 0)) (error "Not found"))
-		  (not (string-match str (ring-ref vc-comment-ring n))))
+		  (not (string-match str (ring-ref log-edit-comment-ring n))))
       (setq n (+ n stride)))
-    (setq vc-comment-ring-index n)
-    (vc-previous-comment 0)))
+    (setq log-edit-comment-ring-index n)
+    (log-edit-previous-comment 0)))
 
-(defun vc-comment-search-forward (str)
+(defun log-edit-comment-search-forward (str)
   "Search forwards through comment history for a substring match of STR."
   (interactive
-   (list (read-string "Comment substring: " nil nil vc-last-comment-match)))
-  (vc-comment-search-reverse str -1))
+   (list (read-string "Comment substring: " nil nil log-edit-last-comment-match)))
+  (log-edit-comment-search-backward str -1))
 
-
-
-(defun vc-comment-to-change-log (&optional whoami file-name)
+(defun log-edit-comment-to-change-log (&optional whoami file-name)
   "Enter last VC comment into the change log for the current file.
 WHOAMI (interactive prefix) non-nil means prompt for user name
 and site.  FILE-NAME is the name of the change log; if nil, use
 `change-log-default-name'.
 
-This may be useful as a `vc-checkin-hook' to update change logs
+This may be useful as a `log-edit-checkin-hook' to update change logs
 automatically."
   (interactive (if current-prefix-arg
 		   (list current-prefix-arg
 			 (prompt-for-change-log-name))))
   (let (;; Extract the comment first so we get any error before doing anything.
-	(comment (ring-ref vc-comment-ring 0))
+	(comment (ring-ref log-edit-comment-ring 0))
 	;; Don't let add-change-log-entry insert a defun name.
 	(add-log-current-defun-function 'ignore)
 	end)
@@ -281,6 +279,22 @@
     (or (eobp) (looking-at "\n\n")
 	(insert "\n"))))
 
+;; Compatibility with old names.
+(defvaralias 'vc-comment-ring 'log-edit-comment-ring)
+(make-obsolete-variable 'vc-comment-ring 'log-edit-comment-ring "21.5")
+(defvaralias 'vc-comment-ring-index 'log-edit-comment-ring-index)
+(make-obsolete-variable 'vc-comment-ring-index 'log-edit-comment-ring-index "21.5")
+(defalias 'vc-previous-comment 'log-edit-previous-comment)
+(make-obsolete 'vc-previous-comment 'log-edit-previous-comment "21.5")
+(defalias 'vc-next-comment 'log-edit-next-comment)
+(make-obsolete 'vc-next-comment 'log-edit-next-comment "21.5")
+(defalias 'vc-comment-search-reverse 'log-edit-comment-search-backward)
+(make-obsolete 'vc-comment-search-reverse 'log-edit-comment-search-backward "21.5")
+(defalias 'vc-comment-search-forward 'log-edit-comment-search-forward)
+(make-obsolete 'vc-comment-search-forward 'log-edit-comment-search-forward "21.5")
+(defalias 'vc-comment-to-change-log 'log-edit-comment-to-change-log)
+(make-obsolete 'vc-comment-to-change-log 'log-edit-comment-to-change-log "21.5")
+
 ;;;
 ;;; Actual code
 ;;;
@@ -323,7 +337,7 @@
 commands (under C-x v for VC, for example).
 
 \\{log-edit-mode-map}"
-  (make-local-variable 'vc-comment-ring-index))
+  (make-local-variable 'log-edit-comment-ring-index))
 
 (defun log-edit-hide-buf (&optional buf where)
   (when (setq buf (get-buffer (or buf log-edit-files-buf)))
@@ -352,9 +366,9 @@
 	(goto-char (point-max))
 	(insert ?\n)))
   (let ((comment (buffer-string)))
-    (when (or (ring-empty-p vc-comment-ring)
-	      (not (equal comment (ring-ref vc-comment-ring 0))))
-      (ring-insert vc-comment-ring comment)))
+    (when (or (ring-empty-p log-edit-comment-ring)
+	      (not (equal comment (ring-ref log-edit-comment-ring 0))))
+      (ring-insert log-edit-comment-ring comment)))
   (let ((win (get-buffer-window log-edit-files-buf)))
     (if (and log-edit-confirm
 	     (not (and (eq log-edit-confirm 'changed)
@@ -453,12 +467,12 @@
   "Insert this log message into the appropriate ChangeLog file."
   (interactive)
   ;; Yuck!
-  (unless (string= (buffer-string) (ring-ref vc-comment-ring 0))
-    (ring-insert vc-comment-ring (buffer-string)))
+  (unless (string= (buffer-string) (ring-ref log-edit-comment-ring 0))
+    (ring-insert log-edit-comment-ring (buffer-string)))
   (dolist (f (log-edit-files))
     (let ((buffer-file-name (expand-file-name f)))
       (save-excursion
-	(vc-comment-to-change-log)))))
+	(log-edit-comment-to-change-log)))))
 
 ;;;;
 ;;;; functions for getting commit message from ChangeLog a file...