emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 43d97f1 4/4: Merge from origin/emacs-27


From: Glenn Morris
Subject: master 43d97f1 4/4: Merge from origin/emacs-27
Date: Wed, 25 Dec 2019 10:55:06 -0500 (EST)

branch: master
commit 43d97f17b812f0e847f64717c57fc4ca48b4ef31
Merge: b766a9d 91c16ac
Author: Glenn Morris <address@hidden>
Commit: Glenn Morris <address@hidden>

    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
---
 lisp/files.el          |  6 +++---
 lisp/progmodes/xref.el |  2 +-
 lisp/vc/vc.el          | 20 +++++++++++---------
 3 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/lisp/files.el b/lisp/files.el
index 503f7fc..059fdbb 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 8d8e7ab..13a1600 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 132278e..c558418 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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]