aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/vc
diff options
context:
space:
mode:
authorGlenn Morris2016-02-01 21:08:21 -0500
committerGlenn Morris2016-02-01 21:08:56 -0500
commitdc435af152e6df3d85b0c21eaf9ff39dce0091bb (patch)
treeed7ce7ab5c100d7cb6f91ad72c828953ef99e3c4 /lisp/vc
parenta39a03a3bf6c1ec522d7b7d6b7f2bf8271ed1a2f (diff)
downloademacs-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.
Diffstat (limited to 'lisp/vc')
-rw-r--r--lisp/vc/add-log.el29
1 files changed, 23 insertions, 6 deletions
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.
176This applies if no pre-existing ChangeLog is found. If nil, then in such
177a 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))