branch: elpa/magit
commit 54c15f5c01f1fe66467853a0c68989e18c9d7f32
Author: Jonas Bernoulli <[email protected]>
Commit: Jonas Bernoulli <[email protected]>
magit-diff-tab-width: Kill buffer after caching
If the file was not already being visited in some buffer, then kill
the buffer we create, when we are done getting `tab-width's value.
---
lisp/magit-diff.el | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/lisp/magit-diff.el b/lisp/magit-diff.el
index bc5be2f0159..b17381c9044 100644
--- a/lisp/magit-diff.el
+++ b/lisp/magit-diff.el
@@ -3366,8 +3366,10 @@ actually a `diff' but a `diffstat' section."
(and (numberp magit-diff-adjust-tab-width)
(>= magit-diff-adjust-tab-width
(nth 7 (file-attributes file)))))
- (setf (alist-get file magit-diff--tab-width-cache nil nil #'equal)
- (buffer-local-value 'tab-width (find-file-noselect file))))
+ (let* ((buf (find-file-noselect file))
+ (val (buffer-local-value 'tab-width buf)))
+ (kill-buffer buf)
+ (setf (alist-get file magit-diff--tab-width-cache nil nil #'equal)
val)))
((prog1 tab-width
(setf (alist-get file magit-diff--tab-width-cache nil nil #'equal)
nil))))) ; The buffer is too large. Don't check size again.