aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2014-07-09 14:54:06 -0400
committerStefan Monnier2014-07-09 14:54:06 -0400
commit5d71cc6bfd658ae103baf9fb30de5daa2681b723 (patch)
tree0b1758998f19dd9a418aea4a3dbad8bf95212392
parentf972be090b0ffdfe7f6fe8a9616fb5f9d410522d (diff)
downloademacs-5d71cc6bfd658ae103baf9fb30de5daa2681b723.tar.gz
emacs-5d71cc6bfd658ae103baf9fb30de5daa2681b723.zip
* lisp/vc/log-edit.el (log-edit-changelog-entries): Don't both visiting
a non-existing file. Fixes: debbugs:17970
-rw-r--r--lisp/ChangeLog3
-rw-r--r--lisp/vc/log-edit.el77
2 files changed, 42 insertions, 38 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 1ad086acf61..a236e0470bc 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,8 @@
12014-07-09 Stefan Monnier <monnier@iro.umontreal.ca> 12014-07-09 Stefan Monnier <monnier@iro.umontreal.ca>
2 2
3 * vc/log-edit.el (log-edit-changelog-entries): Don't both visiting
4 a non-existing file (bug#17970).
5
3 * faces.el (face-name): Undo last change. 6 * faces.el (face-name): Undo last change.
4 (x-resolve-font-name): Don't call face-name (bug#17956). 7 (x-resolve-font-name): Don't call face-name (bug#17956).
5 8
diff --git a/lisp/vc/log-edit.el b/lisp/vc/log-edit.el
index 1d75411ec1f..322a9057fbc 100644
--- a/lisp/vc/log-edit.el
+++ b/lisp/vc/log-edit.el
@@ -905,44 +905,45 @@ where LOGBUFFER is the name of the ChangeLog buffer, and each
905 ;; that memoizing which is undesired here. 905 ;; that memoizing which is undesired here.
906 (setq change-log-default-name nil) 906 (setq change-log-default-name nil)
907 (find-change-log))))) 907 (find-change-log)))))
908 (with-current-buffer (find-file-noselect changelog-file-name) 908 (when (file-exists-p changelog-file-name)
909 (unless (eq major-mode 'change-log-mode) (change-log-mode)) 909 (with-current-buffer (find-file-noselect changelog-file-name)
910 (goto-char (point-min)) 910 (unless (eq major-mode 'change-log-mode) (change-log-mode))
911 (if (looking-at "\\s-*\n") (goto-char (match-end 0))) 911 (goto-char (point-min))
912 (if (not (log-edit-changelog-ours-p)) 912 (if (looking-at "\\s-*\n") (goto-char (match-end 0)))
913 (list (current-buffer)) 913 (if (not (log-edit-changelog-ours-p))
914 (save-restriction 914 (list (current-buffer))
915 (log-edit-narrow-changelog) 915 (save-restriction
916 (goto-char (point-min)) 916 (log-edit-narrow-changelog)
917 917 (goto-char (point-min))
918 ;; Search for the name of FILE relative to the ChangeLog. If that 918
919 ;; doesn't occur anywhere, they're not using full relative 919 ;; Search for the name of FILE relative to the ChangeLog. If that
920 ;; filenames in the ChangeLog, so just look for FILE; we'll accept 920 ;; doesn't occur anywhere, they're not using full relative
921 ;; some false positives. 921 ;; filenames in the ChangeLog, so just look for FILE; we'll accept
922 (let ((pattern (file-relative-name 922 ;; some false positives.
923 file (file-name-directory changelog-file-name)))) 923 (let ((pattern (file-relative-name
924 (if (or (string= pattern "") 924 file (file-name-directory changelog-file-name))))
925 (not (save-excursion 925 (if (or (string= pattern "")
926 (search-forward pattern nil t)))) 926 (not (save-excursion
927 (setq pattern (file-name-nondirectory file))) 927 (search-forward pattern nil t))))
928 928 (setq pattern (file-name-nondirectory file)))
929 (setq pattern (concat "\\(^\\|[^[:alnum:]]\\)" 929
930 (regexp-quote pattern) 930 (setq pattern (concat "\\(^\\|[^[:alnum:]]\\)"
931 "\\($\\|[^[:alnum:]]\\)")) 931 (regexp-quote pattern)
932 932 "\\($\\|[^[:alnum:]]\\)"))
933 (let (texts 933
934 (pos (point))) 934 (let (texts
935 (while (and (not (eobp)) (re-search-forward pattern nil t)) 935 (pos (point)))
936 (let ((entry (log-edit-changelog-entry))) 936 (while (and (not (eobp)) (re-search-forward pattern nil t))
937 (if (< (elt entry 1) (max (1+ pos) (point))) 937 (let ((entry (log-edit-changelog-entry)))
938 ;; This is not relevant, actually. 938 (if (< (elt entry 1) (max (1+ pos) (point)))
939 nil 939 ;; This is not relevant, actually.
940 (push entry texts)) 940 nil
941 ;; Make sure we make progress. 941 (push entry texts))
942 (setq pos (max (1+ pos) (elt entry 1))) 942 ;; Make sure we make progress.
943 (goto-char pos))) 943 (setq pos (max (1+ pos) (elt entry 1)))
944 944 (goto-char pos)))
945 (cons (current-buffer) texts)))))))) 945
946 (cons (current-buffer) texts)))))))))
946 947
947(defun log-edit-changelog-insert-entries (buffer beg end &rest files) 948(defun log-edit-changelog-insert-entries (buffer beg end &rest files)
948 "Insert the text from BUFFER between BEG and END. 949 "Insert the text from BUFFER between BEG and END.