emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/git-commit f5189a6a3e 19/20: magit-section: Ensure interna


From: ELPA Syncer
Subject: [nongnu] elpa/git-commit f5189a6a3e 19/20: magit-section: Ensure internal slots are only set carefully
Date: Sun, 28 Apr 2024 16:03:27 -0400 (EDT)

branch: elpa/git-commit
commit f5189a6a3e92e010bbe21072c942a18b287a44ea
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>

    magit-section: Ensure internal slots are only set carefully
    
    Certain slots should only be set using dedicated code.
    This makes it impossible to set them by passing these
    initargs to `magit-insert-section'.
---
 lisp/magit-section.el | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)

diff --git a/lisp/magit-section.el b/lisp/magit-section.el
index 1bd8a6199e..644c2b94a7 100644
--- a/lisp/magit-section.el
+++ b/lisp/magit-section.el
@@ -380,15 +380,15 @@ no effect.  This also has no effect for Emacs >= 28, where
 (defclass magit-section ()
   ((type     :initform nil :initarg :type)
    (keymap   :initform nil)
-   (value    :initform nil :initarg :value)
-   (start    :initform nil :initarg :start)
+   (value    :initform nil)
+   (start    :initform nil)
    (content  :initform nil)
    (end      :initform nil)
    (hidden   :initform nil)
    (washer   :initform nil :initarg :washer)
    (inserter :initform (symbol-value 'magit--current-section-hook))
    (heading-highlight-face :initform nil :initarg :heading-highlight-face)
-   (parent   :initform nil :initarg :parent)
+   (parent   :initform nil)
    (children :initform nil)))
 
 ;;; Mode
@@ -1406,15 +1406,10 @@ anything this time around.
       (setq type class)
       (setq class (or (cdr (assq class magit--section-type-alist))
                       'magit-section)))
-    (let ((obj (apply
-                class
-                :type type
-                :value value
-                :start (if magit-section-inhibit-markers
-                           (point)
-                         (point-marker))
-                :parent magit-insert-section--parent
-                args)))
+    (let ((obj (apply class :type type args)))
+      (oset obj value value)
+      (oset obj parent magit-insert-section--parent)
+      (oset obj start (if magit-section-inhibit-markers (point) 
(point-marker)))
       (oset obj hidden
             (if-let ((value (run-hook-with-args-until-success
                              'magit-section-set-visibility-hook obj)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]