diff options
| author | Glenn Morris | 2016-01-30 19:37:12 -0800 |
|---|---|---|
| committer | Glenn Morris | 2016-01-30 19:37:12 -0800 |
| commit | 113c9a95aef00f514749b1453ff6117103cc59d8 (patch) | |
| tree | 60842fbd7daa6cac92fe10b2aef25bb4e475c052 | |
| parent | 4699c325be1fa5daa258719a935f40b36664fcf2 (diff) | |
| download | emacs-113c9a95aef00f514749b1453ff6117103cc59d8.tar.gz emacs-113c9a95aef00f514749b1453ff6117103cc59d8.zip | |
* lisp/vc/add-log.el (find-change-log): Use locate-dominating-file.
| -rw-r--r-- | lisp/vc/add-log.el | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/lisp/vc/add-log.el b/lisp/vc/add-log.el index 45e863340a5..d1a1ba057ef 100644 --- a/lisp/vc/add-log.el +++ b/lisp/vc/add-log.el | |||
| @@ -724,24 +724,18 @@ Optional arg BUFFER-FILE overrides `buffer-file-name'." | |||
| 724 | ;; for several related directories. | 724 | ;; for several related directories. |
| 725 | (setq file-name (file-chase-links file-name)) | 725 | (setq file-name (file-chase-links file-name)) |
| 726 | (setq file-name (expand-file-name file-name)) | 726 | (setq file-name (expand-file-name file-name)) |
| 727 | ;; Move up in the dir hierarchy till we find a change log file. | 727 | (let* ((cbase (file-name-nondirectory (change-log-name))) |
| 728 | (let ((file1 file-name) | 728 | (root |
| 729 | parent-dir) | 729 | ;; TODO stopping at VCS root dir (if present) is appropriate |
| 730 | (while (and (not (or (get-file-buffer file1) (file-exists-p file1))) | 730 | ;; for Emacs these days (we used to have per-directory |
| 731 | (progn (setq parent-dir | 731 | ;; ChangeLogs), and probably most others too. |
| 732 | (file-name-directory | 732 | ;; But it could be optional behavior. |
| 733 | (directory-file-name | 733 | (locate-dominating-file |
| 734 | (file-name-directory file1)))) | 734 | file-name |
| 735 | ;; Give up if we are already at the root dir. | 735 | (lambda (dir) |
| 736 | (not (string= (file-name-directory file1) | 736 | (let ((clog (expand-file-name cbase dir))) |
| 737 | parent-dir)))) | 737 | (or (get-file-buffer clog) (file-exists-p clog))))))) |
| 738 | ;; Move up to the parent dir and try again. | 738 | (if root (setq file-name (expand-file-name cbase root)))))) |
| 739 | (setq file1 (expand-file-name | ||
| 740 | (file-name-nondirectory (change-log-name)) | ||
| 741 | parent-dir))) | ||
| 742 | ;; If we found a change log in a parent, use that. | ||
| 743 | (if (or (get-file-buffer file1) (file-exists-p file1)) | ||
| 744 | (setq file-name file1))))) | ||
| 745 | ;; Make a local variable in this buffer so we needn't search again. | 739 | ;; Make a local variable in this buffer so we needn't search again. |
| 746 | (set (make-local-variable 'change-log-default-name) file-name)) | 740 | (set (make-local-variable 'change-log-default-name) file-name)) |
| 747 | file-name) | 741 | file-name) |