aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorRichard M. Stallman <[email protected]>1994-06-24 15:47:09 +0000
committerRichard M. Stallman <[email protected]>1994-06-24 15:47:09 +0000
commita82e2ed577a437030ee8d56a479c37a4ec88ee8c (patch)
tree1c528f1c36c32a9af4fdfff672e88d02f1e57590 /lisp
parent4ced3209486d2182bf06f5fd394a1e9ed7d8b5ce (diff)
(find-change-log): If file name specified, just use it.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/add-log.el86
1 files changed, 42 insertions, 44 deletions
diff --git a/lisp/add-log.el b/lisp/add-log.el
index be22f9e93d..721ef24ccf 100644
--- a/lisp/add-log.el
+++ b/lisp/add-log.el
@@ -67,55 +67,53 @@ an `@' character, followed by the value returned by `system-name'.")
;;;###autoload
(defun find-change-log (&optional file-name)
"Find a change log file for \\[add-change-log-entry] and return the name.
-Optional arg FILE-NAME is a name to try first.
+
+Optional arg FILE-NAME specifies the file to use.
If FILE-NAME is nil, use the value of `change-log-default-name' if non-nil.
-Failing that, use \"ChangeLog\" in the current directory.
-If the file does not exist in the named directory, successive parent
-directories are tried.
+Otherwise, search in the current directory and its successive parents
+for a file named `ChangeLog' (or whatever we use on this operating system).
Once a file is found, `change-log-default-name' is set locally in the
current buffer to the complete file name."
+ ;; If user specified a file name or if this buffer knows which one to use,
+ ;; just use that.
(or file-name
- (setq file-name (or change-log-default-name
- ;; Chase links in the source file
- ;; and use the change log in the dir where it points.
- (and buffer-file-name
- (file-name-directory
- (file-chase-links buffer-file-name)))
- default-directory)))
- (if (and (eq file-name change-log-default-name)
- (assq 'change-log-default-name (buffer-local-variables)))
- ;; Don't do the searching if we already have a buffer-local value.
- file-name
-
- (if (file-directory-p file-name)
- (setq file-name (expand-file-name (change-log-name) file-name)))
- ;; Chase links before visiting the file.
- ;; This makes it easier to use a single change log file
- ;; for several related directories.
- (setq file-name (file-chase-links file-name))
- (setq file-name (expand-file-name file-name))
- ;; Move up in the dir hierarchy till we find a change log file.
- (let ((file1 file-name)
- parent-dir)
- (while (and (not (or (get-file-buffer file1) (file-exists-p file1)))
- (progn (setq parent-dir
- (file-name-directory
- (directory-file-name
- (file-name-directory file1))))
- ;; Give up if we are already at the root dir.
- (not (string= (file-name-directory file1)
- parent-dir))))
- ;; Move up to the parent dir and try again.
- (setq file1 (expand-file-name
- (file-name-nondirectory (change-log-name))
- parent-dir)))
- ;; If we found a change log in a parent, use that.
- (if (or (get-file-buffer file1) (file-exists-p file1))
- (setq file-name file1)))
- ;; Make a local variable in this buffer so we needn't search again.
- (set (make-local-variable 'change-log-default-name) file-name)
- file-name))
+ (setq file-name change-log-default-name)
+ (progn
+ ;; Chase links in the source file
+ ;; and use the change log in the dir where it points.
+ (setq file-name (or (and buffer-file-name
+ (file-name-directory
+ (file-chase-links buffer-file-name)))
+ default-directory))
+ (if (file-directory-p file-name)
+ (setq file-name (expand-file-name (change-log-name) file-name)))
+ ;; Chase links before visiting the file.
+ ;; This makes it easier to use a single change log file
+ ;; for several related directories.
+ (setq file-name (file-chase-links file-name))
+ (setq file-name (expand-file-name file-name))
+ ;; Move up in the dir hierarchy till we find a change log file.
+ (let ((file1 file-name)
+ parent-dir)
+ (while (and (not (or (get-file-buffer file1) (file-exists-p file1)))
+ (progn (setq parent-dir
+ (file-name-directory
+ (directory-file-name
+ (file-name-directory file1))))
+ ;; Give up if we are already at the root dir.
+ (not (string= (file-name-directory file1)
+ parent-dir))))
+ ;; Move up to the parent dir and try again.
+ (setq file1 (expand-file-name
+ (file-name-nondirectory (change-log-name))
+ parent-dir)))
+ ;; If we found a change log in a parent, use that.
+ (if (or (get-file-buffer file1) (file-exists-p file1))
+ (setq file-name file1)))))
+ ;; Make a local variable in this buffer so we needn't search again.
+ (set (make-local-variable 'change-log-default-name) file-name)
+ file-name)
;;;###autoload
(defun add-change-log-entry (&optional whoami file-name other-window new-entry)