branch: elpa/git-commit commit 73eb393aec7e33d6ad54a7e01ec42742110668a9 Author: Jonas Bernoulli <jo...@bernoul.li> Commit: Jonas Bernoulli <jo...@bernoul.li>
magit-insert-section: Cosmetics --- lisp/magit-section.el | 106 +++++++++++++++++++++++++------------------------- 1 file changed, 53 insertions(+), 53 deletions(-) diff --git a/lisp/magit-section.el b/lisp/magit-section.el index 9864b70042..1758083fa6 100644 --- a/lisp/magit-section.el +++ b/lisp/magit-section.el @@ -1384,59 +1384,59 @@ anything this time around. (pop args))) (`((,class ,value ,hide) . ,body) args) (s (cl-gensym "section"))) - `(let ((,s (magit-insert-section--create - ,(if (eq (car-safe class) 'eval) (cadr class) `',class) - ,value ,hide))) - (let ((magit-insert-section--current ,s) - (magit-insert-section--parent ,s) - (magit-insert-section--oldroot - (or magit-insert-section--oldroot - (and (not magit-insert-section--parent) - (prog1 magit-root-section - (setq magit-root-section ,s)))))) - (catch 'cancel-section - ,@(if bind `((let ((,bind ,s)) ,@body)) body) - (run-hooks 'magit-insert-section-hook) - (magit-insert-child-count ,s) - (unless magit-section-inhibit-markers - (set-marker-insertion-type (oref ,s start) t)) - (let ((end (oset ,s end - (if magit-section-inhibit-markers - (point) - (point-marker)))) - (map (symbol-value (oref ,s keymap)))) - (save-excursion - (goto-char (oref ,s start)) - (while (< (point) end) - (let ((next (or (next-single-property-change - (point) 'magit-section) - end))) - (unless (magit-section-at) - (put-text-property (point) next 'magit-section ,s) - (when map - (put-text-property (point) next 'keymap map))) - (magit-section-maybe-add-heading-map ,s) - (goto-char next))))) - (cond - ((eq ,s magit-root-section) - (when (eq magit-section-inhibit-markers 'delay) - (setq magit-section-inhibit-markers nil) - (magit-map-sections - (lambda (section) - (oset section start (copy-marker (oref section start) t)) - (oset section end (copy-marker (oref section end) t))))) - (let ((magit-section-cache-visibility nil)) - (magit-section-show ,s))) - (magit-section-insert-in-reverse - (push ,s (oref (oref ,s parent) children))) - ((let ((parent (oref ,s parent))) - (oset parent children - (nconc (oref parent children) - (list ,s))))))) - (when magit-section-insert-in-reverse - (setq magit-section-insert-in-reverse nil) - (oset ,s children (nreverse (oref ,s children)))) - ,s)))) + `(let* ((,s (magit-insert-section--create + ,(if (eq (car-safe class) 'eval) (cadr class) `',class) + ,value ,hide)) + (magit-insert-section--current ,s) + (magit-insert-section--oldroot + (or magit-insert-section--oldroot + (and (not magit-insert-section--parent) + (prog1 magit-root-section + (setq magit-root-section ,s))))) + (magit-insert-section--parent ,s)) + (catch 'cancel-section + ,@(if bind `((let ((,bind ,s)) ,@body)) body) + (run-hooks 'magit-insert-section-hook) + (magit-insert-child-count ,s) + (unless magit-section-inhibit-markers + (set-marker-insertion-type (oref ,s start) t)) + (let ((end (oset ,s end + (if magit-section-inhibit-markers + (point) + (point-marker)))) + (map (symbol-value (oref ,s keymap)))) + (save-excursion + (goto-char (oref ,s start)) + (while (< (point) end) + (let ((next (or (next-single-property-change + (point) 'magit-section) + end))) + (unless (magit-section-at) + (put-text-property (point) next 'magit-section ,s) + (when map + (put-text-property (point) next 'keymap map))) + (magit-section-maybe-add-heading-map ,s) + (goto-char next))))) + (cond + ((eq ,s magit-root-section) + (when (eq magit-section-inhibit-markers 'delay) + (setq magit-section-inhibit-markers nil) + (magit-map-sections + (lambda (section) + (oset section start (copy-marker (oref section start) t)) + (oset section end (copy-marker (oref section end) t))))) + (let ((magit-section-cache-visibility nil)) + (magit-section-show ,s))) + (magit-section-insert-in-reverse + (push ,s (oref (oref ,s parent) children))) + ((let ((parent (oref ,s parent))) + (oset parent children + (nconc (oref parent children) + (list ,s))))))) + (when magit-section-insert-in-reverse + (setq magit-section-insert-in-reverse nil) + (oset ,s children (nreverse (oref ,s children)))) + ,s))) (defun magit-insert-section--create (class value hide) (let (type)