diff options
| author | Juri Linkov | 2013-12-19 01:51:45 +0200 |
|---|---|---|
| committer | Juri Linkov | 2013-12-19 01:51:45 +0200 |
| commit | 0cda6b7b136178f42510c9e4ededcbaa38c4cc19 (patch) | |
| tree | 0a81890cc67ff325a6ae353cecdbb7b1606a02d9 | |
| parent | b216f0a6cf524023eefbedcff3a70c8763e7e3e0 (diff) | |
| download | emacs-0cda6b7b136178f42510c9e4ededcbaa38c4cc19.tar.gz emacs-0cda6b7b136178f42510c9e4ededcbaa38c4cc19.zip | |
* 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.
Fixes: debbugs:16170
| -rw-r--r-- | lisp/ChangeLog | 11 | ||||
| -rw-r--r-- | lisp/vc/log-edit.el | 107 |
2 files changed, 68 insertions, 50 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 31161057cc8..a3e6709a228 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,16 @@ | |||
| 1 | 2013-12-18 Juri Linkov <juri@jurta.org> | 1 | 2013-12-18 Juri Linkov <juri@jurta.org> |
| 2 | 2 | ||
| 3 | * vc/log-edit.el (log-edit-hook): Add `log-edit-insert-message-template' | ||
| 4 | to the default list. Move `log-edit-show-files' to the end. | ||
| 5 | Add more available functions to options. | ||
| 6 | (log-edit): Move default specific settings to | ||
| 7 | `log-edit-insert-message-template'. Don't move point. | ||
| 8 | (log-edit-insert-message-template): New function. | ||
| 9 | (log-edit-insert-changelog): Add `save-excursion' and don't move point. | ||
| 10 | (Bug#16170) | ||
| 11 | |||
| 12 | 2013-12-18 Juri Linkov <juri@jurta.org> | ||
| 13 | |||
| 3 | * help-mode.el (help-mode-map): Bind "l" to help-go-back, | 14 | * help-mode.el (help-mode-map): Bind "l" to help-go-back, |
| 4 | and "r" to help-go-forward for compatibity with Info. (Bug#16178) | 15 | and "r" to help-go-forward for compatibity with Info. (Bug#16178) |
| 5 | 16 | ||
diff --git a/lisp/vc/log-edit.el b/lisp/vc/log-edit.el index 91390fa1123..2ee60a872e4 100644 --- a/lisp/vc/log-edit.el +++ b/lisp/vc/log-edit.el | |||
| @@ -126,15 +126,18 @@ its SETUP argument is non-nil." | |||
| 126 | :type 'boolean | 126 | :type 'boolean |
| 127 | :safe 'booleanp) | 127 | :safe 'booleanp) |
| 128 | 128 | ||
| 129 | (defcustom log-edit-hook '(log-edit-insert-cvs-template | 129 | (defcustom log-edit-hook '(log-edit-insert-message-template |
| 130 | log-edit-show-files | 130 | log-edit-insert-cvs-template |
| 131 | log-edit-insert-changelog) | 131 | log-edit-insert-changelog |
| 132 | log-edit-show-files) | ||
| 132 | "Hook run at the end of `log-edit'." | 133 | "Hook run at the end of `log-edit'." |
| 133 | :group 'log-edit | 134 | :group 'log-edit |
| 134 | :type '(hook :options (log-edit-insert-changelog | 135 | :type '(hook :options (log-edit-insert-message-template |
| 135 | log-edit-insert-cvs-rcstemplate | 136 | log-edit-insert-cvs-rcstemplate |
| 136 | log-edit-insert-cvs-template | 137 | log-edit-insert-cvs-template |
| 137 | log-edit-insert-filenames))) | 138 | log-edit-insert-changelog |
| 139 | log-edit-insert-filenames | ||
| 140 | log-edit-show-files))) | ||
| 138 | 141 | ||
| 139 | (defcustom log-edit-mode-hook (if (boundp 'vc-log-mode-hook) vc-log-mode-hook) | 142 | (defcustom log-edit-mode-hook (if (boundp 'vc-log-mode-hook) vc-log-mode-hook) |
| 140 | "Hook run when entering `log-edit-mode'." | 143 | "Hook run when entering `log-edit-mode'." |
| @@ -440,12 +443,6 @@ done. Otherwise, it uses the current buffer." | |||
| 440 | (if mode | 443 | (if mode |
| 441 | (funcall mode) | 444 | (funcall mode) |
| 442 | (log-edit-mode)) | 445 | (log-edit-mode)) |
| 443 | (when setup | ||
| 444 | (erase-buffer) | ||
| 445 | (insert "Summary: ") | ||
| 446 | (when log-edit-setup-add-author | ||
| 447 | (insert "\nAuthor: ")) | ||
| 448 | (insert "\n\n")) | ||
| 449 | (set (make-local-variable 'log-edit-callback) callback) | 446 | (set (make-local-variable 'log-edit-callback) callback) |
| 450 | (if (listp params) | 447 | (if (listp params) |
| 451 | (dolist (crt params) | 448 | (dolist (crt params) |
| @@ -456,10 +453,9 @@ done. Otherwise, it uses the current buffer." | |||
| 456 | 453 | ||
| 457 | (if buffer (set (make-local-variable 'log-edit-parent-buffer) parent)) | 454 | (if buffer (set (make-local-variable 'log-edit-parent-buffer) parent)) |
| 458 | (set (make-local-variable 'log-edit-initial-files) (log-edit-files)) | 455 | (set (make-local-variable 'log-edit-initial-files) (log-edit-files)) |
| 459 | (when setup (run-hooks 'log-edit-hook)) | 456 | (when setup |
| 460 | (if setup | 457 | (erase-buffer) |
| 461 | (message-position-point) | 458 | (run-hooks 'log-edit-hook)) |
| 462 | (goto-char (point-min))) | ||
| 463 | (push-mark (point-max)) | 459 | (push-mark (point-max)) |
| 464 | (message "%s" (substitute-command-keys | 460 | (message "%s" (substitute-command-keys |
| 465 | "Press \\[log-edit-done] when you are done editing.")))) | 461 | "Press \\[log-edit-done] when you are done editing.")))) |
| @@ -626,6 +622,17 @@ different header separator appropriate for `log-edit-mode'." | |||
| 626 | (zerop (forward-line 1)))) | 622 | (zerop (forward-line 1)))) |
| 627 | (eobp)))) | 623 | (eobp)))) |
| 628 | 624 | ||
| 625 | (defun log-edit-insert-message-template () | ||
| 626 | "Insert the default template with Summary and Author." | ||
| 627 | (interactive) | ||
| 628 | (when (or (called-interactively-p 'interactive) | ||
| 629 | (log-edit-empty-buffer-p)) | ||
| 630 | (insert "Summary: ") | ||
| 631 | (when log-edit-setup-add-author | ||
| 632 | (insert "\nAuthor: ")) | ||
| 633 | (insert "\n\n") | ||
| 634 | (message-position-point))) | ||
| 635 | |||
| 629 | (defun log-edit-insert-cvs-template () | 636 | (defun log-edit-insert-cvs-template () |
| 630 | "Insert the template specified by the CVS administrator, if any. | 637 | "Insert the template specified by the CVS administrator, if any. |
| 631 | This simply uses the local CVS/Template file." | 638 | This simply uses the local CVS/Template file." |
| @@ -701,39 +708,39 @@ If the optional prefix arg USE-FIRST is given (via \\[universal-argument]), | |||
| 701 | or if the command is repeated a second time in a row, use the first log entry | 708 | or if the command is repeated a second time in a row, use the first log entry |
| 702 | regardless of user name or time." | 709 | regardless of user name or time." |
| 703 | (interactive "P") | 710 | (interactive "P") |
| 704 | (let ((eoh (save-excursion (rfc822-goto-eoh) (point)))) | 711 | (save-excursion |
| 705 | (when (<= (point) eoh) | 712 | (let ((eoh (save-excursion (rfc822-goto-eoh) (point)))) |
| 706 | (goto-char eoh) | 713 | (when (<= (point) eoh) |
| 707 | (if (looking-at "\n") (forward-char 1)))) | 714 | (goto-char eoh) |
| 708 | (let ((author | 715 | (if (looking-at "\n") (forward-char 1)))) |
| 709 | (let ((log-edit-changelog-use-first | 716 | (let ((author |
| 710 | (or use-first (eq last-command 'log-edit-insert-changelog)))) | 717 | (let ((log-edit-changelog-use-first |
| 711 | (log-edit-insert-changelog-entries (log-edit-files))))) | 718 | (or use-first (eq last-command 'log-edit-insert-changelog)))) |
| 712 | (log-edit-set-common-indentation) | 719 | (log-edit-insert-changelog-entries (log-edit-files))))) |
| 713 | ;; Add an Author: field if appropriate. | 720 | (log-edit-set-common-indentation) |
| 714 | (when author (log-edit-add-field "Author" author)) | 721 | ;; Add an Author: field if appropriate. |
| 715 | ;; Add a Fixes: field if applicable. | 722 | (when author (log-edit-add-field "Author" author)) |
| 716 | (when (consp log-edit-rewrite-fixes) | 723 | ;; Add a Fixes: field if applicable. |
| 717 | (rfc822-goto-eoh) | 724 | (when (consp log-edit-rewrite-fixes) |
| 718 | (when (re-search-forward (car log-edit-rewrite-fixes) nil t) | 725 | (rfc822-goto-eoh) |
| 719 | (let ((start (match-beginning 0)) | 726 | (when (re-search-forward (car log-edit-rewrite-fixes) nil t) |
| 720 | (end (match-end 0)) | 727 | (let ((start (match-beginning 0)) |
| 721 | (fixes (match-substitute-replacement | 728 | (end (match-end 0)) |
| 722 | (cdr log-edit-rewrite-fixes)))) | 729 | (fixes (match-substitute-replacement |
| 723 | (delete-region start end) | 730 | (cdr log-edit-rewrite-fixes)))) |
| 724 | (log-edit-add-field "Fixes" fixes)))) | 731 | (delete-region start end) |
| 725 | (and log-edit-strip-single-file-name | 732 | (log-edit-add-field "Fixes" fixes)))) |
| 726 | (progn (rfc822-goto-eoh) | 733 | (and log-edit-strip-single-file-name |
| 727 | (if (looking-at "\n") (forward-char 1)) | 734 | (progn (rfc822-goto-eoh) |
| 728 | (looking-at "\\*\\s-+")) | 735 | (if (looking-at "\n") (forward-char 1)) |
| 729 | (let ((start (point))) | 736 | (looking-at "\\*\\s-+")) |
| 730 | (forward-line 1) | 737 | (let ((start (point))) |
| 731 | (when (not (re-search-forward "^\\*\\s-+" nil t)) | 738 | (forward-line 1) |
| 732 | (goto-char start) | 739 | (when (not (re-search-forward "^\\*\\s-+" nil t)) |
| 733 | (skip-chars-forward "^():") | 740 | (goto-char start) |
| 734 | (skip-chars-forward ": ") | 741 | (skip-chars-forward "^():") |
| 735 | (delete-region start (point))))) | 742 | (skip-chars-forward ": ") |
| 736 | (goto-char (point-min)))) | 743 | (delete-region start (point)))))))) |
| 737 | 744 | ||
| 738 | ;;;; | 745 | ;;;; |
| 739 | ;;;; functions for getting commit message from ChangeLog a file... | 746 | ;;;; functions for getting commit message from ChangeLog a file... |