can even guess the name of the function or other object that was
changed.
+@c Not worth it.
+@c @vindex change-log-directory-files
+To find the change log file, Emacs searches up the directory tree from
+the file you are editing. By default, it stops if it finds a
+directory that seems to be the root of a version-control repository.
+To change this, customize @code{change-log-directory-files}.
+
@vindex add-log-keep-changes-together
When the variable @code{add-log-keep-changes-together} is
non-@code{nil}, @kbd{C-x 4 a} adds to any existing item for the file
\f
* Changes in Specialized Modes and Packages in Emacs 25.2
++++
+** The commands that add ChangeLog entries now prefer a VCS root directory
+for the ChangeLog file, if none already exists. Customize
+`change-log-directory-files' to nil for the old behavior.
+
---
** Support for non-string values of `time-stamp-format' has been removed.
:type '(repeat regexp)
:group 'change-log)
+(defcustom change-log-directory-files '(".bzr" ".git" ".hg" ".svn")
+ "List of files that cause ChangeLog search to stop in containing directory.
+This applies if no pre-existing ChangeLog is found. If nil, then in such
+a case simply use the directory containing the changed file."
+ :version "25.2"
+ :type '(repeat file)
+ :group 'change-log)
+
(defface change-log-date
'((t (:inherit font-lock-string-face)))
"Face used to highlight dates in date lines."
(setq file-name (expand-file-name file-name))
(let* ((cbase (file-name-nondirectory (change-log-name)))
(root
- ;; TODO stopping at VCS root dir (if present) is appropriate
- ;; for Emacs these days (we used to have per-directory
- ;; ChangeLogs), and probably most others too.
- ;; But it could be optional behavior.
(locate-dominating-file
file-name
(lambda (dir)
- (let ((clog (expand-file-name cbase dir)))
- (or (get-file-buffer clog) (file-exists-p clog)))))))
+ (or
+ (let ((clog (expand-file-name cbase dir)))
+ (or (get-file-buffer clog) (file-exists-p clog)))
+ ;; Stop at VCS root?
+ (and change-log-directory-files
+ (let ((files change-log-directory-files)
+ found)
+ (while
+ (and
+ (not
+ (setq found
+ (file-exists-p
+ (expand-file-name (car files) dir))))
+ (setq files (cdr files))))
+ found)))))))
(if root (setq file-name (expand-file-name cbase root))))))
;; Make a local variable in this buffer so we needn't search again.
(set (make-local-variable 'change-log-default-name) file-name))