diff options
| author | Glenn Morris <rgm@gnu.org> | 2019-12-25 07:50:19 -0800 |
|---|---|---|
| committer | Glenn Morris <rgm@gnu.org> | 2019-12-25 07:50:19 -0800 |
| commit | 43d97f17b812f0e847f64717c57fc4ca48b4ef31 (patch) | |
| tree | 901b26877ee1c270edcd5578f5b447e669c55d28 /lisp | |
| parent | b766a9d0a8e31d00b27b1033390b3e71d9e6c8bf (diff) | |
| parent | 91c16acbe2436a77b3841a455378149a3c807375 (diff) | |
| download | emacs-43d97f17b812f0e847f64717c57fc4ca48b4ef31.tar.gz | |
Merge from origin/emacs-27
91c16acbe2 (origin/emacs-27) Improve doc string of 'files--message'
c3be58a8f5 (emacs-27) Improve vc--add-line, vc--remove-regexp
9ea9ac9a61 Apply the 'xref-group' property properly
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/files.el | 6 | ||||
| -rw-r--r-- | lisp/progmodes/xref.el | 2 | ||||
| -rw-r--r-- | lisp/vc/vc.el | 20 |
3 files changed, 15 insertions, 13 deletions
diff --git a/lisp/files.el b/lisp/files.el index 503f7fca72a..059fdbbe371 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -2166,9 +2166,9 @@ If that fails, try to open it with `find-file-literally' (* total-free-memory 1024))))))))) (defun files--message (format &rest args) - "Like `message', except sometimes don't print to minibuffer. -If the variable `save-silently' is non-nil, the message is not -displayed on the minibuffer." + "Like `message', except sometimes don't show the message text. +If the variable `save-silently' is non-nil, the message will not +be visible in the echo area." (apply #'message format args) (when save-silently (message nil))) diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index 8d8e7ab208e..13a1600594f 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -814,7 +814,7 @@ GROUP is a string for decoration purposes and XREF is an for line-format = (and max-line-width (format "%%%dd: " max-line-width)) do - (xref--insert-propertized '(face xref-file-header 'xref-group t) + (xref--insert-propertized '(face xref-file-header xref-group t) group "\n") (cl-loop for (xref . more2) on xrefs do (with-slots (summary location) xref diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index 132278e8230..c5584188b31 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -1460,20 +1460,22 @@ Argument BACKEND is the backend you are using." ;; Subroutine for `vc-git-ignore' and `vc-hg-ignore'. (defun vc--add-line (string file) "Add STRING as a line to FILE." - (with-temp-buffer - (insert-file-contents file) + (with-current-buffer (find-file-noselect file) + (goto-char (point-min)) (unless (re-search-forward (concat "^" (regexp-quote string) "$") nil t) (goto-char (point-max)) - (insert (concat "\n" string)) - (write-region (point-min) (point-max) file)))) + (unless (bolp) (insert "\n")) + (insert string "\n") + (save-buffer)))) (defun vc--remove-regexp (regexp file) "Remove all matching for REGEXP in FILE." - (with-temp-buffer - (insert-file-contents file) - (while (re-search-forward regexp nil t) - (replace-match "")) - (write-region (point-min) (point-max) file))) + (if (file-exists-p file) + (with-current-buffer (find-file-noselect file) + (goto-char (point-min)) + (while (re-search-forward regexp nil t) + (replace-match "")) + (save-buffer)))) (defun vc-checkout (file &optional rev) "Retrieve a copy of the revision REV of FILE. |
