branch: elpa/git-commit
commit ee6fbba360195b0d2ab0ea245e5bddaa260cedac
Author: Jonas Bernoulli <[email protected]>
Commit: Jonas Bernoulli <[email protected]>
magit-insert-section-body: Limit scope of a binding
Only the lambda may run delayed, outside a `magit-insert-section'.
BODY must not use `magit-insert-section--current'; if it must have
access to the section it is inserting, `magit-insert-section's
SECTION must be used.
---
lisp/magit-section.el | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/lisp/magit-section.el b/lisp/magit-section.el
index 0869ccc20f..d42bbba403 100644
--- a/lisp/magit-section.el
+++ b/lisp/magit-section.el
@@ -1550,19 +1550,19 @@ is explicitly expanded."
(let ((f (cl-gensym))
(s (cl-gensym))
(l (cl-gensym)))
- `(let ((,f (lambda () ,@body))
- (,s magit-insert-section--current))
- (if (oref ,s hidden)
- (oset ,s washer
- (lambda ()
- (let ((,l (magit-section-lineage ,s t)))
- (dolist (s ,l)
- (set-marker-insertion-type (oref s end) t))
- (funcall ,f)
- (dolist (s ,l)
- (set-marker-insertion-type (oref s end) nil))
- (magit-section-maybe-remove-heading-map ,s)
- (magit-section-maybe-remove-visibility-indicator ,s))))
+ `(let ((,f (lambda () ,@body)))
+ (if (oref magit-insert-section--current hidden)
+ (oset magit-insert-section--current washer
+ (let ((,s magit-insert-section--current))
+ (lambda ()
+ (let ((,l (magit-section-lineage ,s t)))
+ (dolist (s ,l)
+ (set-marker-insertion-type (oref s end) t))
+ (funcall ,f)
+ (dolist (s ,l)
+ (set-marker-insertion-type (oref s end) nil))
+ (magit-section-maybe-remove-heading-map ,s)
+ (magit-section-maybe-remove-visibility-indicator ,s)))))
(funcall ,f)))))
(defun magit-insert-headers (hook)