aboutsummaryrefslogtreecommitdiff
path: root/lisp/magit-diff.el
diff options
context:
space:
mode:
authorBasil L. Contovounesios <contovob@tcd.ie>2017-12-10 14:47:54 +0000
committerJonas Bernoulli <jonas@bernoul.li>2017-12-10 16:59:38 +0100
commitbc0e6f7c602e29ac87157fc67a34eb53df7d05aa (patch)
tree734eddd853864aa4aeb2468cc53603b175b99817 /lisp/magit-diff.el
parent735be51936bf0930e70f5e65d1b82a9642243c78 (diff)
magit-diff-tab-width: Speed up buffer-local lookup
Functions find-buffer-visiting and find-file-noselect both return buffer objects, so take advantage of it for miniscule performance gain.
Diffstat (limited to 'lisp/magit-diff.el')
-rw-r--r--lisp/magit-diff.el6
1 files changed, 2 insertions, 4 deletions
diff --git a/lisp/magit-diff.el b/lisp/magit-diff.el
index 225150c..ef2755c 100644
--- a/lisp/magit-diff.el
+++ b/lisp/magit-diff.el
@@ -2446,8 +2446,7 @@ are highlighted."
((not magit-diff-adjust-tab-width)
tab-width)
((--when-let (find-buffer-visiting file)
- (with-current-buffer it
- (cache tab-width))))
+ (cache (buffer-local-value 'tab-width it))))
((--when-let (assoc file magit-diff--tab-width-cache)
(or (cdr it)
tab-width)))
@@ -2455,8 +2454,7 @@ are highlighted."
(and (numberp magit-diff-adjust-tab-width)
(>= magit-diff-adjust-tab-width
(nth 7 (file-attributes file)))))
- (with-current-buffer (find-file-noselect file)
- (cache tab-width)))
+ (cache (buffer-local-value 'tab-width (find-file-noselect file))))
(t
(cache nil)
tab-width))))