emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r115600: * lisp/vc/log-edit.el (log-edit-hook): Add


From: Juri Linkov
Subject: [Emacs-diffs] trunk r115600: * lisp/vc/log-edit.el (log-edit-hook): Add `log-edit-insert-message-template'
Date: Wed, 18 Dec 2013 23:51:51 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 115600
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/16170
committer: Juri Linkov <address@hidden>
branch nick: trunk
timestamp: Thu 2013-12-19 01:51:45 +0200
message:
  * lisp/vc/log-edit.el (log-edit-hook): Add `log-edit-insert-message-template'
  to the default list.  Move `log-edit-show-files' to the end.
  Add more available functions to options.
  (log-edit): Move default specific settings to
  `log-edit-insert-message-template'.  Don't move point.
  (log-edit-insert-message-template): New function.
  (log-edit-insert-changelog): Add `save-excursion' and don't move point.
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/vc/log-edit.el            logedit.el-20091113204419-o5vbwnq5f7feedwu-1776
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-12-18 23:40:12 +0000
+++ b/lisp/ChangeLog    2013-12-18 23:51:45 +0000
@@ -1,5 +1,16 @@
 2013-12-18  Juri Linkov  <address@hidden>
 
+       * vc/log-edit.el (log-edit-hook): Add `log-edit-insert-message-template'
+       to the default list.  Move `log-edit-show-files' to the end.
+       Add more available functions to options.
+       (log-edit): Move default specific settings to
+       `log-edit-insert-message-template'.  Don't move point.
+       (log-edit-insert-message-template): New function.
+       (log-edit-insert-changelog): Add `save-excursion' and don't move point.
+       (Bug#16170)
+
+2013-12-18  Juri Linkov  <address@hidden>
+
        * help-mode.el (help-mode-map): Bind "l" to help-go-back,
        and "r" to help-go-forward for compatibity with Info.  (Bug#16178)
 

=== modified file 'lisp/vc/log-edit.el'
--- a/lisp/vc/log-edit.el       2013-12-04 00:37:33 +0000
+++ b/lisp/vc/log-edit.el       2013-12-18 23:51:45 +0000
@@ -126,15 +126,18 @@
   :type 'boolean
   :safe 'booleanp)
 
-(defcustom log-edit-hook '(log-edit-insert-cvs-template
-                           log-edit-show-files
-                          log-edit-insert-changelog)
+(defcustom log-edit-hook '(log-edit-insert-message-template
+                          log-edit-insert-cvs-template
+                          log-edit-insert-changelog
+                          log-edit-show-files)
   "Hook run at the end of `log-edit'."
   :group 'log-edit
-  :type '(hook :options (log-edit-insert-changelog
-                         log-edit-insert-cvs-rcstemplate
-                         log-edit-insert-cvs-template
-                        log-edit-insert-filenames)))
+  :type '(hook :options (log-edit-insert-message-template
+                        log-edit-insert-cvs-rcstemplate
+                        log-edit-insert-cvs-template
+                        log-edit-insert-changelog
+                        log-edit-insert-filenames
+                        log-edit-show-files)))
 
 (defcustom log-edit-mode-hook (if (boundp 'vc-log-mode-hook) vc-log-mode-hook)
   "Hook run when entering `log-edit-mode'."
@@ -440,12 +443,6 @@
     (if mode
        (funcall mode)
       (log-edit-mode))
-    (when setup
-      (erase-buffer)
-      (insert "Summary: ")
-      (when log-edit-setup-add-author
-        (insert "\nAuthor: "))
-      (insert "\n\n"))
     (set (make-local-variable 'log-edit-callback) callback)
     (if (listp params)
        (dolist (crt params)
@@ -456,10 +453,9 @@
 
     (if buffer (set (make-local-variable 'log-edit-parent-buffer) parent))
     (set (make-local-variable 'log-edit-initial-files) (log-edit-files))
-    (when setup (run-hooks 'log-edit-hook))
-    (if setup
-        (message-position-point)
-      (goto-char (point-min)))
+    (when setup
+      (erase-buffer)
+      (run-hooks 'log-edit-hook))
     (push-mark (point-max))
     (message "%s" (substitute-command-keys
              "Press \\[log-edit-done] when you are done editing."))))
@@ -626,6 +622,17 @@
                     (zerop (forward-line 1))))
         (eobp))))
 
+(defun log-edit-insert-message-template ()
+  "Insert the default template with Summary and Author."
+  (interactive)
+  (when (or (called-interactively-p 'interactive)
+            (log-edit-empty-buffer-p))
+    (insert "Summary: ")
+    (when log-edit-setup-add-author
+      (insert "\nAuthor: "))
+    (insert "\n\n")
+    (message-position-point)))
+
 (defun log-edit-insert-cvs-template ()
   "Insert the template specified by the CVS administrator, if any.
 This simply uses the local CVS/Template file."
@@ -701,39 +708,39 @@
 or if the command is repeated a second time in a row, use the first log entry
 regardless of user name or time."
   (interactive "P")
-  (let ((eoh (save-excursion (rfc822-goto-eoh) (point))))
-    (when (<= (point) eoh)
-      (goto-char eoh)
-      (if (looking-at "\n") (forward-char 1))))
-  (let ((author
-         (let ((log-edit-changelog-use-first
-                (or use-first (eq last-command 'log-edit-insert-changelog))))
-           (log-edit-insert-changelog-entries (log-edit-files)))))
-    (log-edit-set-common-indentation)
-    ;; Add an Author: field if appropriate.
-    (when author (log-edit-add-field "Author" author))
-    ;; Add a Fixes: field if applicable.
-    (when (consp log-edit-rewrite-fixes)
-      (rfc822-goto-eoh)
-      (when (re-search-forward (car log-edit-rewrite-fixes) nil t)
-        (let ((start (match-beginning 0))
-              (end (match-end 0))
-              (fixes (match-substitute-replacement
-                      (cdr log-edit-rewrite-fixes))))
-          (delete-region start end)
-          (log-edit-add-field "Fixes" fixes))))
-    (and log-edit-strip-single-file-name
-         (progn (rfc822-goto-eoh)
-                (if (looking-at "\n") (forward-char 1))
-                (looking-at "\\*\\s-+"))
-         (let ((start (point)))
-           (forward-line 1)
-           (when (not (re-search-forward "^\\*\\s-+" nil t))
-             (goto-char start)
-             (skip-chars-forward "^():")
-             (skip-chars-forward ": ")
-             (delete-region start (point)))))
-    (goto-char (point-min))))
+  (save-excursion
+    (let ((eoh (save-excursion (rfc822-goto-eoh) (point))))
+      (when (<= (point) eoh)
+       (goto-char eoh)
+       (if (looking-at "\n") (forward-char 1))))
+    (let ((author
+          (let ((log-edit-changelog-use-first
+                 (or use-first (eq last-command 'log-edit-insert-changelog))))
+            (log-edit-insert-changelog-entries (log-edit-files)))))
+      (log-edit-set-common-indentation)
+      ;; Add an Author: field if appropriate.
+      (when author (log-edit-add-field "Author" author))
+      ;; Add a Fixes: field if applicable.
+      (when (consp log-edit-rewrite-fixes)
+       (rfc822-goto-eoh)
+       (when (re-search-forward (car log-edit-rewrite-fixes) nil t)
+         (let ((start (match-beginning 0))
+               (end (match-end 0))
+               (fixes (match-substitute-replacement
+                       (cdr log-edit-rewrite-fixes))))
+           (delete-region start end)
+           (log-edit-add-field "Fixes" fixes))))
+      (and log-edit-strip-single-file-name
+          (progn (rfc822-goto-eoh)
+                 (if (looking-at "\n") (forward-char 1))
+                 (looking-at "\\*\\s-+"))
+          (let ((start (point)))
+            (forward-line 1)
+            (when (not (re-search-forward "^\\*\\s-+" nil t))
+              (goto-char start)
+              (skip-chars-forward "^():")
+              (skip-chars-forward ": ")
+              (delete-region start (point))))))))
 
 ;;;;
 ;;;; functions for getting commit message from ChangeLog a file...


reply via email to

[Prev in Thread] Current Thread [Next in Thread]