diff options
| author | Glenn Morris | 2008-09-06 19:47:14 +0000 |
|---|---|---|
| committer | Glenn Morris | 2008-09-06 19:47:14 +0000 |
| commit | 67a925e55d634d02b71b33d767ca843fc635e31f (patch) | |
| tree | 6979db832ad0cce2ee2ae9caaff82aadc89e8cd8 | |
| parent | 89631590457a0f40306cd1a207a6d8dad3a2c776 (diff) | |
| download | emacs-67a925e55d634d02b71b33d767ca843fc635e31f.tar.gz emacs-67a925e55d634d02b71b33d767ca843fc635e31f.zip | |
Fix previous change.
| -rw-r--r-- | lisp/add-log.el | 85 |
1 files changed, 43 insertions, 42 deletions
diff --git a/lisp/add-log.el b/lisp/add-log.el index 98aa9109528..9241b324968 100644 --- a/lisp/add-log.el +++ b/lisp/add-log.el | |||
| @@ -686,51 +686,52 @@ current buffer to the complete file name. | |||
| 686 | Optional arg BUFFER-FILE overrides `buffer-file-name'." | 686 | Optional arg BUFFER-FILE overrides `buffer-file-name'." |
| 687 | ;; If we are called from a diff, first switch to the source buffer; | 687 | ;; If we are called from a diff, first switch to the source buffer; |
| 688 | ;; in order to respect buffer-local settings of change-log-default-name, etc. | 688 | ;; in order to respect buffer-local settings of change-log-default-name, etc. |
| 689 | (let ((buff (if (eq major-mode 'diff-mode) | 689 | (with-current-buffer (let ((buff (if (eq major-mode 'diff-mode) |
| 690 | (car (ignore-errors (diff-find-source-location)))))) | 690 | (car (ignore-errors |
| 691 | (with-current-buffer (if (buffer-live-p buff) buff | 691 | (diff-find-source-location)))))) |
| 692 | (current-buffer)) | 692 | (if (buffer-live-p buff) buff |
| 693 | (current-buffer))) | ||
| 693 | ;; If user specified a file name or if this buffer knows which one to use, | 694 | ;; If user specified a file name or if this buffer knows which one to use, |
| 694 | ;; just use that. | 695 | ;; just use that. |
| 695 | (or file-name | 696 | (or file-name |
| 696 | (setq file-name (and change-log-default-name | 697 | (setq file-name (and change-log-default-name |
| 697 | (file-name-directory change-log-default-name) | 698 | (file-name-directory change-log-default-name) |
| 698 | change-log-default-name))) | 699 | change-log-default-name)) |
| 699 | (progn | 700 | (progn |
| 700 | ;; Chase links in the source file | 701 | ;; Chase links in the source file |
| 701 | ;; and use the change log in the dir where it points. | 702 | ;; and use the change log in the dir where it points. |
| 702 | (setq file-name (or (and (or buffer-file buffer-file-name) | 703 | (setq file-name (or (and (or buffer-file buffer-file-name) |
| 703 | (file-name-directory | ||
| 704 | (file-chase-links | ||
| 705 | (or buffer-file buffer-file-name)))) | ||
| 706 | default-directory)) | ||
| 707 | (if (file-directory-p file-name) | ||
| 708 | (setq file-name (expand-file-name (change-log-name) file-name))) | ||
| 709 | ;; Chase links before visiting the file. | ||
| 710 | ;; This makes it easier to use a single change log file | ||
| 711 | ;; for several related directories. | ||
| 712 | (setq file-name (file-chase-links file-name)) | ||
| 713 | (setq file-name (expand-file-name file-name)) | ||
| 714 | ;; Move up in the dir hierarchy till we find a change log file. | ||
| 715 | (let ((file1 file-name) | ||
| 716 | parent-dir) | ||
| 717 | (while (and (not (or (get-file-buffer file1) (file-exists-p file1))) | ||
| 718 | (progn (setq parent-dir | ||
| 719 | (file-name-directory | 704 | (file-name-directory |
| 720 | (directory-file-name | 705 | (file-chase-links |
| 721 | (file-name-directory file1)))) | 706 | (or buffer-file buffer-file-name)))) |
| 722 | ;; Give up if we are already at the root dir. | 707 | default-directory)) |
| 723 | (not (string= (file-name-directory file1) | 708 | (if (file-directory-p file-name) |
| 724 | parent-dir)))) | 709 | (setq file-name (expand-file-name (change-log-name) file-name))) |
| 725 | ;; Move up to the parent dir and try again. | 710 | ;; Chase links before visiting the file. |
| 726 | (setq file1 (expand-file-name | 711 | ;; This makes it easier to use a single change log file |
| 727 | (file-name-nondirectory (change-log-name)) | 712 | ;; for several related directories. |
| 728 | parent-dir))) | 713 | (setq file-name (file-chase-links file-name)) |
| 729 | ;; If we found a change log in a parent, use that. | 714 | (setq file-name (expand-file-name file-name)) |
| 730 | (if (or (get-file-buffer file1) (file-exists-p file1)) | 715 | ;; Move up in the dir hierarchy till we find a change log file. |
| 731 | (setq file-name file1)))) | 716 | (let ((file1 file-name) |
| 732 | ;; Make a local variable in this buffer so we needn't search again. | 717 | parent-dir) |
| 733 | (set (make-local-variable 'change-log-default-name) file-name))) | 718 | (while (and (not (or (get-file-buffer file1) (file-exists-p file1))) |
| 719 | (progn (setq parent-dir | ||
| 720 | (file-name-directory | ||
| 721 | (directory-file-name | ||
| 722 | (file-name-directory file1)))) | ||
| 723 | ;; Give up if we are already at the root dir. | ||
| 724 | (not (string= (file-name-directory file1) | ||
| 725 | parent-dir)))) | ||
| 726 | ;; Move up to the parent dir and try again. | ||
| 727 | (setq file1 (expand-file-name | ||
| 728 | (file-name-nondirectory (change-log-name)) | ||
| 729 | parent-dir))) | ||
| 730 | ;; If we found a change log in a parent, use that. | ||
| 731 | (if (or (get-file-buffer file1) (file-exists-p file1)) | ||
| 732 | (setq file-name file1))))) | ||
| 733 | ;; Make a local variable in this buffer so we needn't search again. | ||
| 734 | (set (make-local-variable 'change-log-default-name) file-name)) | ||
| 734 | file-name) | 735 | file-name) |
| 735 | 736 | ||
| 736 | (defun add-log-file-name (buffer-file log-file) | 737 | (defun add-log-file-name (buffer-file log-file) |