aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorStefan Monnier2005-11-28 20:22:04 +0000
committerStefan Monnier2005-11-28 20:22:04 +0000
commitf7eeab0d229d52a11f10135c2eb4e28e28c34950 (patch)
tree1631a487d43f86be568593aaba19b32c1756ddee /lisp
parent1f57934ca570d71c6052edf0dfa3980ecb9e9b92 (diff)
downloademacs-f7eeab0d229d52a11f10135c2eb4e28e28c34950.tar.gz
emacs-f7eeab0d229d52a11f10135c2eb4e28e28c34950.zip
*** empty log message ***
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/log-edit.el109
2 files changed, 70 insertions, 45 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 6f6e4915519..41b8cdd5470 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -13,6 +13,12 @@
13 13
142005-11-28 Stefan Monnier <monnier@iro.umontreal.ca> 142005-11-28 Stefan Monnier <monnier@iro.umontreal.ca>
15 15
16 * log-edit.el (log-edit-changelog-use-first): New var.
17 (log-edit-changelog-ours-p): Use it.
18 (log-edit-insert-changelog): Set it with new arg `use-first'.
19 (log-edit-insert-cvs-rcstemplate, log-edit-insert-filenames): New funs.
20 (log-edit-hook): Add them to the list of suggested options.
21
16 * textmodes/flyspell.el (flyspell-last-buffer): New var. 22 * textmodes/flyspell.el (flyspell-last-buffer): New var.
17 (flyspell-accept-buffer-local-defs): Use it to avoid doing silly 23 (flyspell-accept-buffer-local-defs): Use it to avoid doing silly
18 redundant work. 24 redundant work.
diff --git a/lisp/log-edit.el b/lisp/log-edit.el
index 54249eb52e3..8ee8e369926 100644
--- a/lisp/log-edit.el
+++ b/lisp/log-edit.el
@@ -120,8 +120,10 @@ If SETUP is 'force, this variable has no effect."
120 log-edit-insert-changelog) 120 log-edit-insert-changelog)
121 "*Hook run at the end of `log-edit'." 121 "*Hook run at the end of `log-edit'."
122 :group 'log-edit 122 :group 'log-edit
123 :type '(hook :options (log-edit-insert-cvs-template 123 :type '(hook :options (log-edit-insert-changelog
124 log-edit-insert-changelog))) 124 log-edit-insert-cvs-rcstemplate
125 log-edit-insert-cvs-template
126 log-edit-insert-filenames)))
125 127
126(defcustom log-edit-mode-hook (if (boundp 'vc-log-mode-hook) vc-log-mode-hook) 128(defcustom log-edit-mode-hook (if (boundp 'vc-log-mode-hook) vc-log-mode-hook)
127 "*Hook run when entering `log-edit-mode'." 129 "*Hook run when entering `log-edit-mode'."
@@ -281,20 +283,13 @@ automatically."
281 (insert "\n")))) 283 (insert "\n"))))
282 284
283;; Compatibility with old names. 285;; Compatibility with old names.
284(defvaralias 'vc-comment-ring 'log-edit-comment-ring) 286(define-obsolete-variable-alias 'vc-comment-ring 'log-edit-comment-ring "22.1")
285(make-obsolete-variable 'vc-comment-ring 'log-edit-comment-ring "22.1") 287(define-obsolete-variable-alias 'vc-comment-ring-index 'log-edit-comment-ring-index "22.1")
286(defvaralias 'vc-comment-ring-index 'log-edit-comment-ring-index) 288(define-obsolete-function-alias 'vc-previous-comment 'log-edit-previous-comment "22.1")
287(make-obsolete-variable 'vc-comment-ring-index 'log-edit-comment-ring-index "22.1") 289(define-obsolete-function-alias 'vc-next-comment 'log-edit-next-comment "22.1")
288(defalias 'vc-previous-comment 'log-edit-previous-comment) 290(define-obsolete-function-alias 'vc-comment-search-reverse 'log-edit-comment-search-backward "22.1")
289(make-obsolete 'vc-previous-comment 'log-edit-previous-comment "22.1") 291(define-obsolete-function-alias 'vc-comment-search-forward 'log-edit-comment-search-forward "22.1")
290(defalias 'vc-next-comment 'log-edit-next-comment) 292(define-obsolete-function-alias 'vc-comment-to-change-log 'log-edit-comment-to-change-log "22.1")
291(make-obsolete 'vc-next-comment 'log-edit-next-comment "22.1")
292(defalias 'vc-comment-search-reverse 'log-edit-comment-search-backward)
293(make-obsolete 'vc-comment-search-reverse 'log-edit-comment-search-backward "22.1")
294(defalias 'vc-comment-search-forward 'log-edit-comment-search-forward)
295(make-obsolete 'vc-comment-search-forward 'log-edit-comment-search-forward "22.1")
296(defalias 'vc-comment-to-change-log 'log-edit-comment-to-change-log)
297(make-obsolete 'vc-comment-to-change-log 'log-edit-comment-to-change-log "22.1")
298 293
299;;; 294;;;
300;;; Actual code 295;;; Actual code
@@ -396,31 +391,6 @@ If you want to abort the commit, simply delete the buffer."
396 "Return the list of files that are about to be committed." 391 "Return the list of files that are about to be committed."
397 (ignore-errors (funcall log-edit-listfun))) 392 (ignore-errors (funcall log-edit-listfun)))
398 393
399
400(defun log-edit-insert-changelog ()
401 "Insert a log message by looking at the ChangeLog.
402The idea is to write your ChangeLog entries first, and then use this
403command to commit your changes.
404
405To select default log text, we:
406- find the ChangeLog entries for the files to be checked in,
407- verify that the top entry in the ChangeLog is on the current date
408 and by the current user; if not, we don't provide any default text,
409- search the ChangeLog entry for paragraphs containing the names of
410 the files we're checking in, and finally
411- use those paragraphs as the log text."
412 (interactive)
413 (log-edit-insert-changelog-entries (log-edit-files))
414 (log-edit-set-common-indentation)
415 (goto-char (point-min))
416 (when (looking-at "\\*\\s-+")
417 (forward-line 1)
418 (when (not (re-search-forward "^\\*\\s-+" nil t))
419 (goto-char (point-min))
420 (skip-chars-forward "^():")
421 (skip-chars-forward ": ")
422 (delete-region (point-min) (point)))))
423
424(defun log-edit-mode-help () 394(defun log-edit-mode-help ()
425 "Provide help for the `log-edit-mode-map'." 395 "Provide help for the `log-edit-mode-map'."
426 (interactive) 396 (interactive)
@@ -465,11 +435,27 @@ To select default log text, we:
465 (selected-window))))) 435 (selected-window)))))
466 436
467(defun log-edit-insert-cvs-template () 437(defun log-edit-insert-cvs-template ()
468 "Insert the template specified by the CVS administrator, if any." 438 "Insert the template specified by the CVS administrator, if any.
439This simply uses the local CVS/Template file."
469 (interactive) 440 (interactive)
470 (when (file-readable-p "CVS/Template") 441 (when (or (interactive-p) (= (point-min) (point-max)))
471 (insert-file-contents "CVS/Template"))) 442 (when (file-readable-p "CVS/Template")
443 (insert-file-contents "CVS/Template"))))
444
445(defun log-edit-insert-cvs-rcstemplate ()
446 "Insert the rcstemplate from the CVS repository.
447This contacts the repository to get the rcstemplate file and
448can thus take some time."
449 (interactive)
450 (when (or (interactive-p) (= (point-min) (point-max)))
451 (when (file-readable-p "CVS/Entries")
452 (call-process "cvs" nil t nil "checkout" "-p" "CVSROOT/rcstemplate"))))
472 453
454(defun log-edit-insert-filenames ()
455 "Insert the list of files that are to be committed."
456 (interactive)
457 (insert "Affected files: \n"
458 (mapconcat 'identity (log-edit-files) " \n")))
473 459
474(defun log-edit-add-to-changelog () 460(defun log-edit-add-to-changelog ()
475 "Insert this log message into the appropriate ChangeLog file." 461 "Insert this log message into the appropriate ChangeLog file."
@@ -482,6 +468,37 @@ To select default log text, we:
482 (save-excursion 468 (save-excursion
483 (log-edit-comment-to-change-log))))) 469 (log-edit-comment-to-change-log)))))
484 470
471(defvar log-edit-changelog-use-first nil)
472(defun log-edit-insert-changelog (&optional use-first)
473 "Insert a log message by looking at the ChangeLog.
474The idea is to write your ChangeLog entries first, and then use this
475command to commit your changes.
476
477To select default log text, we:
478- find the ChangeLog entries for the files to be checked in,
479- verify that the top entry in the ChangeLog is on the current date
480 and by the current user; if not, we don't provide any default text,
481- search the ChangeLog entry for paragraphs containing the names of
482 the files we're checking in, and finally
483- use those paragraphs as the log text.
484
485If the optional prefix arg USE-FIRST is given (via \\[universal-argument]),
486or if the command is repeated a second time in a row, use the first log entry
487regardless of user name or time."
488 (interactive "P")
489 (let ((log-edit-changelog-use-first
490 (or use-first (eq last-command 'log-edit-insert-changelog))))
491 (log-edit-insert-changelog-entries (log-edit-files)))
492 (log-edit-set-common-indentation)
493 (goto-char (point-min))
494 (when (looking-at "\\*\\s-+")
495 (forward-line 1)
496 (when (not (re-search-forward "^\\*\\s-+" nil t))
497 (goto-char (point-min))
498 (skip-chars-forward "^():")
499 (skip-chars-forward ": ")
500 (delete-region (point-min) (point)))))
501
485;;;; 502;;;;
486;;;; functions for getting commit message from ChangeLog a file... 503;;;; functions for getting commit message from ChangeLog a file...
487;;;; Courtesy Jim Blandy 504;;;; Courtesy Jim Blandy
@@ -561,7 +578,9 @@ Return non-nil iff it is."
561 (functionp add-log-time-format) 578 (functionp add-log-time-format)
562 (funcall add-log-time-format)) 579 (funcall add-log-time-format))
563 (format-time-string "%Y-%m-%d")))) 580 (format-time-string "%Y-%m-%d"))))
564 (looking-at (regexp-quote (format "%s %s <%s>" time name mail))))) 581 (looking-at (if log-edit-changelog-use-first
582 "[^ \t]"
583 (regexp-quote (format "%s %s <%s>" time name mail))))))
565 584
566(defun log-edit-changelog-entries (file) 585(defun log-edit-changelog-entries (file)
567 "Return the ChangeLog entries for FILE, and the ChangeLog they came from. 586 "Return the ChangeLog entries for FILE, and the ChangeLog they came from.