[PATCH 2/3] git-blame.el: Use with-current-buffer where appropriate

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

 



From: Rüdiger Sonderfeld <ruediger@xxxxxxxxxxxxx>

In git-blame-filter and git-blame-new-commit we need to execute the
body with (current-buffer) bound to the correct output buffer.  We
then want to restore the previous value of (current-buffer).  The
idiom

   (save-excursion
     (set-buffer buf)
     ...)

will not correctly save the original buffer the code was executed in.
Instead, use with-current-buffer as recommended in Emacs documentation.

Signed-off-by: Rüdiger Sonderfeld <ruediger@xxxxxxxxxxxxx>
Signed-off-by: Lawrence Mitchell <wence@xxxxxx>
---
 contrib/emacs/git-blame.el | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/contrib/emacs/git-blame.el b/contrib/emacs/git-blame.el
index 5428ff7..20cf9a6 100644
--- a/contrib/emacs/git-blame.el
+++ b/contrib/emacs/git-blame.el
@@ -337,8 +337,7 @@ See also function `git-blame-mode'."
 (defvar in-blame-filter nil)
 
 (defun git-blame-filter (proc str)
-  (save-excursion
-    (set-buffer (process-buffer proc))
+  (with-current-buffer (process-buffer proc)
     (goto-char (process-mark proc))
     (insert-before-markers str)
     (goto-char 0)
@@ -385,8 +384,7 @@ See also function `git-blame-mode'."
           info))))
 
 (defun git-blame-create-overlay (info start-line num-lines)
-  (save-excursion
-    (set-buffer git-blame-file)
+  (with-current-buffer git-blame-file
     (let ((inhibit-point-motion-hooks t)
           (inhibit-modification-hooks t))
       (goto-char (point-min))
-- 
1.7.10.2.552.gaa3bb87

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]