From: Dmitry Gutov Date: Sun, 1 Dec 2013 04:13:50 +0000 (+0200) Subject: Apply the initial log-edit tweaks discussed at emacs-devel X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~615 X-Git-Url: https://code.delx.au/gnu-emacs/commitdiff_plain/52789f7fb3f25cfbc6397bed8912a88698c9f8f1 Apply the initial log-edit tweaks discussed at emacs-devel * .dir-locals.el: (log-edit-move): Add the "Author: " header. * lisp/vc/log-edit.el (log-edit-mode-map): Add binding for `log-edit-beginning-of-line'. (log-edit-setup-add-author): New user option. (log-edit-beginning-of-line): New command. (log-edit): Move major mode call above the contents setup so that the local variable values are already applied. (log-edit): Only insert "Author: " when `log-edit-setup-add-author' is non-nil. (log-edit): When SETUP is non-nil, position point after ": " instead of point-min. --- diff --git a/.dir-locals.el b/.dir-locals.el index 5bee88267c..203343f084 100644 --- a/.dir-locals.el +++ b/.dir-locals.el @@ -7,7 +7,8 @@ ;; See admin/notes/bugtracker. (log-edit-mode . ((log-edit-rewrite-fixes "[ \n](bug#\\([0-9]+\\))" . "debbugs:\\1") - (log-edit-font-lock-gnu-style . t))) + (log-edit-font-lock-gnu-style . t) + (log-edit-setup-add-author . t))) (change-log-mode . ((add-log-time-zone-rule . t) (fill-column . 74) (bug-reference-url-format . "http://debbugs.gnu.org/%s") diff --git a/ChangeLog b/ChangeLog index 33f9f6bca1..e231616043 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-12-01 Dmitry Gutov + + * .dir-locals.el: (log-edit-move): Add the "Author: " header. + 2013-11-30 Dani Moncayo * build-aux/msys-to-w32 (w32pathlist): Do not translate paths diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 5c6c40bc51..79b46f0f3f 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,16 @@ +2013-12-01 Dmitry Gutov + + * vc/log-edit.el (log-edit-mode-map): Add binding for + `log-edit-beginning-of-line'. + (log-edit-setup-add-author): New user option. + (log-edit-beginning-of-line): New command. + (log-edit): Move major mode call above the contents setup so that + the local variable values are already applied. + (log-edit): Only insert "Author: " when + `log-edit-setup-add-author' is non-nil. + (log-edit): When SETUP is non-nil, position point after ": " + instead of point-min. + 2013-12-01 Glenn Morris * startup.el (command-line): Warn if ~/emacs.d is in load-path. diff --git a/lisp/vc/log-edit.el b/lisp/vc/log-edit.el index dfc7eee81a..ecec69489d 100644 --- a/lisp/vc/log-edit.el +++ b/lisp/vc/log-edit.el @@ -32,6 +32,7 @@ (require 'add-log) ; for all the ChangeLog goodies (require 'pcvs-util) (require 'ring) +(require 'message) ;;;; ;;;; Global Variables @@ -55,6 +56,7 @@ ("\C-c\C-a" . log-edit-insert-changelog) ("\C-c\C-d" . log-edit-show-diff) ("\C-c\C-f" . log-edit-show-files) + ("\C-a" . log-edit-beginning-of-line) ("\M-n" . log-edit-next-comment) ("\M-p" . log-edit-previous-comment) ("\M-r" . log-edit-comment-search-backward) @@ -116,6 +118,13 @@ If SETUP is 'force, this variable has no effect." :group 'log-edit :type 'boolean) +(defcustom log-edit-setup-add-author nil + "Non-nil means `log-edit' should add the `Author:' header when +its SETUP argument is non-nil." + :group 'log-edit + :type 'boolean + :safe 'booleanp) + (defcustom log-edit-hook '(log-edit-insert-cvs-template log-edit-show-files log-edit-insert-changelog) @@ -427,13 +436,15 @@ done. Otherwise, it uses the current buffer." (if buffer (pop-to-buffer buffer)) (when (and log-edit-setup-invert (not (eq setup 'force))) (setq setup (not setup))) - (when setup - (erase-buffer) - (insert "Summary: \nAuthor: ") - (save-excursion (insert "\n\n"))) (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) @@ -445,7 +456,10 @@ done. Otherwise, it uses the current buffer." (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)) - (goto-char (point-min)) (push-mark (point-max)) + (if setup + (message-position-point) + (goto-char (point-min))) + (push-mark (point-max)) (message "%s" (substitute-command-keys "Press \\[log-edit-done] when you are done editing.")))) @@ -574,6 +588,15 @@ If you want to abort the commit, simply delete the buffer." (shrink-window-if-larger-than-buffer) (selected-window))))) +(defun log-edit-beginning-of-line (&optional n) + "Move point to beginning of header value or to beginning of line. + +It works the same as `message-beginning-of-line', but it uses a +different header separator appropriate for `log-edit-mode'." + (interactive "p") + (let ((mail-header-separator "")) + (message-beginning-of-line n))) + (defun log-edit-empty-buffer-p () "Return non-nil if the buffer is \"empty\"." (or (= (point-min) (point-max))