diff options
| author | Richard M. Stallman | 1994-06-24 15:47:09 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-06-24 15:47:09 +0000 |
| commit | a82e2ed577a437030ee8d56a479c37a4ec88ee8c (patch) | |
| tree | 1c528f1c36c32a9af4fdfff672e88d02f1e57590 | |
| parent | 4ced3209486d2182bf06f5fd394a1e9ed7d8b5ce (diff) | |
| download | emacs-a82e2ed577a437030ee8d56a479c37a4ec88ee8c.tar.gz emacs-a82e2ed577a437030ee8d56a479c37a4ec88ee8c.zip | |
(find-change-log): If file name specified, just use it.
| -rw-r--r-- | lisp/add-log.el | 86 |
1 files changed, 42 insertions, 44 deletions
diff --git a/lisp/add-log.el b/lisp/add-log.el index be22f9e93d0..721ef24ccfd 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'.") | |||
| 67 | ;;;###autoload | 67 | ;;;###autoload |
| 68 | (defun find-change-log (&optional file-name) | 68 | (defun find-change-log (&optional file-name) |
| 69 | "Find a change log file for \\[add-change-log-entry] and return the name. | 69 | "Find a change log file for \\[add-change-log-entry] and return the name. |
| 70 | Optional arg FILE-NAME is a name to try first. | 70 | |
| 71 | Optional arg FILE-NAME specifies the file to use. | ||
| 71 | If FILE-NAME is nil, use the value of `change-log-default-name' if non-nil. | 72 | If FILE-NAME is nil, use the value of `change-log-default-name' if non-nil. |
| 72 | Failing that, use \"ChangeLog\" in the current directory. | 73 | Otherwise, search in the current directory and its successive parents |
| 73 | If the file does not exist in the named directory, successive parent | 74 | for a file named `ChangeLog' (or whatever we use on this operating system). |
| 74 | directories are tried. | ||
| 75 | 75 | ||
| 76 | Once a file is found, `change-log-default-name' is set locally in the | 76 | Once a file is found, `change-log-default-name' is set locally in the |
| 77 | current buffer to the complete file name." | 77 | current buffer to the complete file name." |
| 78 | ;; If user specified a file name or if this buffer knows which one to use, | ||
| 79 | ;; just use that. | ||
| 78 | (or file-name | 80 | (or file-name |
| 79 | (setq file-name (or change-log-default-name | 81 | (setq file-name change-log-default-name) |
| 80 | ;; Chase links in the source file | 82 | (progn |
| 81 | ;; and use the change log in the dir where it points. | 83 | ;; Chase links in the source file |
| 82 | (and buffer-file-name | 84 | ;; and use the change log in the dir where it points. |
| 83 | (file-name-directory | 85 | (setq file-name (or (and buffer-file-name |
| 84 | (file-chase-links buffer-file-name))) | 86 | (file-name-directory |
| 85 | default-directory))) | 87 | (file-chase-links buffer-file-name))) |
| 86 | (if (and (eq file-name change-log-default-name) | 88 | default-directory)) |
| 87 | (assq 'change-log-default-name (buffer-local-variables))) | 89 | (if (file-directory-p file-name) |
| 88 | ;; Don't do the searching if we already have a buffer-local value. | 90 | (setq file-name (expand-file-name (change-log-name) file-name))) |
| 89 | file-name | 91 | ;; Chase links before visiting the file. |
| 90 | 92 | ;; This makes it easier to use a single change log file | |
| 91 | (if (file-directory-p file-name) | 93 | ;; for several related directories. |
| 92 | (setq file-name (expand-file-name (change-log-name) file-name))) | 94 | (setq file-name (file-chase-links file-name)) |
| 93 | ;; Chase links before visiting the file. | 95 | (setq file-name (expand-file-name file-name)) |
| 94 | ;; This makes it easier to use a single change log file | 96 | ;; Move up in the dir hierarchy till we find a change log file. |
| 95 | ;; for several related directories. | 97 | (let ((file1 file-name) |
| 96 | (setq file-name (file-chase-links file-name)) | 98 | parent-dir) |
| 97 | (setq file-name (expand-file-name file-name)) | 99 | (while (and (not (or (get-file-buffer file1) (file-exists-p file1))) |
| 98 | ;; Move up in the dir hierarchy till we find a change log file. | 100 | (progn (setq parent-dir |
| 99 | (let ((file1 file-name) | 101 | (file-name-directory |
| 100 | parent-dir) | 102 | (directory-file-name |
| 101 | (while (and (not (or (get-file-buffer file1) (file-exists-p file1))) | 103 | (file-name-directory file1)))) |
| 102 | (progn (setq parent-dir | 104 | ;; Give up if we are already at the root dir. |
| 103 | (file-name-directory | 105 | (not (string= (file-name-directory file1) |
| 104 | (directory-file-name | 106 | parent-dir)))) |
| 105 | (file-name-directory file1)))) | 107 | ;; Move up to the parent dir and try again. |
| 106 | ;; Give up if we are already at the root dir. | 108 | (setq file1 (expand-file-name |
| 107 | (not (string= (file-name-directory file1) | 109 | (file-name-nondirectory (change-log-name)) |
| 108 | parent-dir)))) | 110 | parent-dir))) |
| 109 | ;; Move up to the parent dir and try again. | 111 | ;; If we found a change log in a parent, use that. |
| 110 | (setq file1 (expand-file-name | 112 | (if (or (get-file-buffer file1) (file-exists-p file1)) |
| 111 | (file-name-nondirectory (change-log-name)) | 113 | (setq file-name file1))))) |
| 112 | parent-dir))) | 114 | ;; Make a local variable in this buffer so we needn't search again. |
| 113 | ;; If we found a change log in a parent, use that. | 115 | (set (make-local-variable 'change-log-default-name) file-name) |
| 114 | (if (or (get-file-buffer file1) (file-exists-p file1)) | 116 | file-name) |
| 115 | (setq file-name file1))) | ||
| 116 | ;; Make a local variable in this buffer so we needn't search again. | ||
| 117 | (set (make-local-variable 'change-log-default-name) file-name) | ||
| 118 | file-name)) | ||
| 119 | 117 | ||
| 120 | ;;;###autoload | 118 | ;;;###autoload |
| 121 | (defun add-change-log-entry (&optional whoami file-name other-window new-entry) | 119 | (defun add-change-log-entry (&optional whoami file-name other-window new-entry) |