diff options
| author | Glenn Morris | 2016-02-01 21:08:21 -0500 |
|---|---|---|
| committer | Glenn Morris | 2016-02-01 21:08:56 -0500 |
| commit | dc435af152e6df3d85b0c21eaf9ff39dce0091bb (patch) | |
| tree | ed7ce7ab5c100d7cb6f91ad72c828953ef99e3c4 | |
| parent | a39a03a3bf6c1ec522d7b7d6b7f2bf8271ed1a2f (diff) | |
| download | emacs-dc435af152e6df3d85b0c21eaf9ff39dce0091bb.tar.gz emacs-dc435af152e6df3d85b0c21eaf9ff39dce0091bb.zip | |
Make find-change-log prefer a VCS root, if no ChangeLog exists.
* lisp/vc/add-log.el (change-log-directory-files): New option.
(find-change-log): Respect change-log-directory-files.
* doc/emacs/maintaining.texi (Change Log Commands):
Mention change-log-directory-files.
; * etc/NEWS: Mention this.
| -rw-r--r-- | doc/emacs/maintaining.texi | 7 | ||||
| -rw-r--r-- | etc/NEWS | 5 | ||||
| -rw-r--r-- | lisp/vc/add-log.el | 29 |
3 files changed, 35 insertions, 6 deletions
diff --git a/doc/emacs/maintaining.texi b/doc/emacs/maintaining.texi index 3f1a9c07e91..72d428af8fb 100644 --- a/doc/emacs/maintaining.texi +++ b/doc/emacs/maintaining.texi | |||
| @@ -1590,6 +1590,13 @@ also creates a new item for the current file. For many languages, it | |||
| 1590 | can even guess the name of the function or other object that was | 1590 | can even guess the name of the function or other object that was |
| 1591 | changed. | 1591 | changed. |
| 1592 | 1592 | ||
| 1593 | @c Not worth it. | ||
| 1594 | @c @vindex change-log-directory-files | ||
| 1595 | To find the change log file, Emacs searches up the directory tree from | ||
| 1596 | the file you are editing. By default, it stops if it finds a | ||
| 1597 | directory that seems to be the root of a version-control repository. | ||
| 1598 | To change this, customize @code{change-log-directory-files}. | ||
| 1599 | |||
| 1593 | @vindex add-log-keep-changes-together | 1600 | @vindex add-log-keep-changes-together |
| 1594 | When the variable @code{add-log-keep-changes-together} is | 1601 | When the variable @code{add-log-keep-changes-together} is |
| 1595 | non-@code{nil}, @kbd{C-x 4 a} adds to any existing item for the file | 1602 | non-@code{nil}, @kbd{C-x 4 a} adds to any existing item for the file |
| @@ -52,6 +52,11 @@ in these situations. | |||
| 52 | 52 | ||
| 53 | * Changes in Specialized Modes and Packages in Emacs 25.2 | 53 | * Changes in Specialized Modes and Packages in Emacs 25.2 |
| 54 | 54 | ||
| 55 | +++ | ||
| 56 | ** The commands that add ChangeLog entries now prefer a VCS root directory | ||
| 57 | for the ChangeLog file, if none already exists. Customize | ||
| 58 | `change-log-directory-files' to nil for the old behavior. | ||
| 59 | |||
| 55 | --- | 60 | --- |
| 56 | ** Support for non-string values of `time-stamp-format' has been removed. | 61 | ** Support for non-string values of `time-stamp-format' has been removed. |
| 57 | 62 | ||
diff --git a/lisp/vc/add-log.el b/lisp/vc/add-log.el index d1a1ba057ef..ceb0d4207c9 100644 --- a/lisp/vc/add-log.el +++ b/lisp/vc/add-log.el | |||
| @@ -171,6 +171,14 @@ Note: The search is conducted only within 10%, at the beginning of the file." | |||
| 171 | :type '(repeat regexp) | 171 | :type '(repeat regexp) |
| 172 | :group 'change-log) | 172 | :group 'change-log) |
| 173 | 173 | ||
| 174 | (defcustom change-log-directory-files '(".bzr" ".git" ".hg" ".svn") | ||
| 175 | "List of files that cause ChangeLog search to stop in containing directory. | ||
| 176 | This applies if no pre-existing ChangeLog is found. If nil, then in such | ||
| 177 | a case simply use the directory containing the changed file." | ||
| 178 | :version "25.2" | ||
| 179 | :type '(repeat file) | ||
| 180 | :group 'change-log) | ||
| 181 | |||
| 174 | (defface change-log-date | 182 | (defface change-log-date |
| 175 | '((t (:inherit font-lock-string-face))) | 183 | '((t (:inherit font-lock-string-face))) |
| 176 | "Face used to highlight dates in date lines." | 184 | "Face used to highlight dates in date lines." |
| @@ -726,15 +734,24 @@ Optional arg BUFFER-FILE overrides `buffer-file-name'." | |||
| 726 | (setq file-name (expand-file-name file-name)) | 734 | (setq file-name (expand-file-name file-name)) |
| 727 | (let* ((cbase (file-name-nondirectory (change-log-name))) | 735 | (let* ((cbase (file-name-nondirectory (change-log-name))) |
| 728 | (root | 736 | (root |
| 729 | ;; TODO stopping at VCS root dir (if present) is appropriate | ||
| 730 | ;; for Emacs these days (we used to have per-directory | ||
| 731 | ;; ChangeLogs), and probably most others too. | ||
| 732 | ;; But it could be optional behavior. | ||
| 733 | (locate-dominating-file | 737 | (locate-dominating-file |
| 734 | file-name | 738 | file-name |
| 735 | (lambda (dir) | 739 | (lambda (dir) |
| 736 | (let ((clog (expand-file-name cbase dir))) | 740 | (or |
| 737 | (or (get-file-buffer clog) (file-exists-p clog))))))) | 741 | (let ((clog (expand-file-name cbase dir))) |
| 742 | (or (get-file-buffer clog) (file-exists-p clog))) | ||
| 743 | ;; Stop at VCS root? | ||
| 744 | (and change-log-directory-files | ||
| 745 | (let ((files change-log-directory-files) | ||
| 746 | found) | ||
| 747 | (while | ||
| 748 | (and | ||
| 749 | (not | ||
| 750 | (setq found | ||
| 751 | (file-exists-p | ||
| 752 | (expand-file-name (car files) dir)))) | ||
| 753 | (setq files (cdr files)))) | ||
| 754 | found))))))) | ||
| 738 | (if root (setq file-name (expand-file-name cbase root)))))) | 755 | (if root (setq file-name (expand-file-name cbase root)))))) |
| 739 | ;; Make a local variable in this buffer so we needn't search again. | 756 | ;; Make a local variable in this buffer so we needn't search again. |
| 740 | (set (make-local-variable 'change-log-default-name) file-name)) | 757 | (set (make-local-variable 'change-log-default-name) file-name)) |