[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/git-commit 8753fd9800 08/20: magit-insert-section--finish:
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/git-commit 8753fd9800 08/20: magit-insert-section--finish: New function |
Date: |
Sun, 28 Apr 2024 16:03:26 -0400 (EDT) |
branch: elpa/git-commit
commit 8753fd98005069befbc20ebad8867af16d6c7454
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>
magit-insert-section--finish: New function
Move existing code from macro expansion to
new `magit-insert-section--finish' function.
---
lisp/magit-section.el | 83 ++++++++++++++++++++++++++-------------------------
1 file changed, 43 insertions(+), 40 deletions(-)
diff --git a/lisp/magit-section.el b/lisp/magit-section.el
index d2d8f6aaa7..cd50aef613 100644
--- a/lisp/magit-section.el
+++ b/lisp/magit-section.el
@@ -1396,46 +1396,7 @@ anything this time around.
(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)))))
+ (magit-insert-section--finish ,s))
,s)))
(defun magit-insert-section--create (class value hide)
@@ -1480,6 +1441,48 @@ anything this time around.
(and (boundp sym) sym))))))
obj)))
+(defun magit-insert-section--finish (obj)
+ (run-hooks 'magit-insert-section-hook)
+ (magit-insert-child-count obj)
+ (unless magit-section-inhibit-markers
+ (set-marker-insertion-type (oref obj start) t))
+ (let ((end (oset obj end
+ (if magit-section-inhibit-markers
+ (point)
+ (point-marker))))
+ (map (symbol-value (oref obj keymap))))
+ (save-excursion
+ (goto-char (oref obj 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 obj)
+ (when map
+ (put-text-property (point) next 'keymap map)))
+ (magit-section-maybe-add-heading-map obj)
+ (goto-char next)))))
+ (cond
+ ((eq obj 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 obj)))
+ (magit-section-insert-in-reverse
+ (push obj (oref (oref obj parent) children)))
+ ((let ((parent (oref obj parent)))
+ (oset parent children
+ (nconc (oref parent children)
+ (list obj))))))
+ (when magit-section-insert-in-reverse
+ (setq magit-section-insert-in-reverse nil)
+ (oset obj children (nreverse (oref obj children)))))
+
(defun magit-cancel-section (&optional if-empty)
"Cancel inserting the section that is currently being inserted.
- [nongnu] elpa/git-commit updated (49ba535f52 -> 058ca81497), ELPA Syncer, 2024/04/28
- [nongnu] elpa/git-commit c594d8edee 03/20: magit-insert-section--create: New function, ELPA Syncer, 2024/04/28
- [nongnu] elpa/git-commit 13e4422584 01/20: magit-insert-section: Remove a comment, ELPA Syncer, 2024/04/28
- [nongnu] elpa/git-commit d58214a702 12/20: magit-file-section-map: Add comment, ELPA Syncer, 2024/04/28
- [nongnu] elpa/git-commit 7d07026acf 05/20: magit-insert-section--create: Find keymap by name here, ELPA Syncer, 2024/04/28
- [nongnu] elpa/git-commit 8ece720c8d 18/20: magit-section: Rearrange slots, ELPA Syncer, 2024/04/28
- [nongnu] elpa/git-commit 8753fd9800 08/20: magit-insert-section--finish: New function,
ELPA Syncer <=
- [nongnu] elpa/git-commit 4195508e2e 11/20: Set keymap slot of section classes, ELPA Syncer, 2024/04/28
- [nongnu] elpa/git-commit ff5cc5a69a 10/20: magit-log-section: Set keymap slot, ELPA Syncer, 2024/04/28
- [nongnu] elpa/git-commit 8cb278c2fc 04/20: magit-insert-section--create: Minor optimization, ELPA Syncer, 2024/04/28
- [nongnu] elpa/git-commit 4dd00058a1 16/20: Use module type instead of corresponding magit-module-section class, ELPA Syncer, 2024/04/28
- [nongnu] elpa/git-commit 73eb393aec 06/20: magit-insert-section: Cosmetics, ELPA Syncer, 2024/04/28
- [nongnu] elpa/git-commit 058ca81497 20/20: Bump magit-section dependency, ELPA Syncer, 2024/04/28
- [nongnu] elpa/git-commit 834b9632c3 13/20: magit-diff-wash-hunk: No longer set end slot explicitly, ELPA Syncer, 2024/04/28
- [nongnu] elpa/git-commit f5e32d64c1 15/20: magit-insert-section: Change indent spec, ELPA Syncer, 2024/04/28
- [nongnu] elpa/git-commit be2750e190 09/20: magit-insert-section: Cosmetics, ELPA Syncer, 2024/04/28
- [nongnu] elpa/git-commit f5189a6a3e 19/20: magit-section: Ensure internal slots are only set carefully, ELPA Syncer, 2024/04/28