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

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

[elpa] externals/setup c2a1f64 17/24: Add (remove ...) keyword to :optio


From: Stefan Monnier
Subject: [elpa] externals/setup c2a1f64 17/24: Add (remove ...) keyword to :option and :local-set
Date: Thu, 25 Mar 2021 13:42:37 -0400 (EDT)

branch: externals/setup
commit c2a1f6490057cbbb6373634e4128b04f7b112fb9
Author: Philip K <philipk@posteo.net>
Commit: Philip K <philipk@posteo.net>

    Add (remove ...) keyword to :option and :local-set
---
 setup.el | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/setup.el b/setup.el
index ec73905..dbcc0f9 100644
--- a/setup.el
+++ b/setup.el
@@ -338,13 +338,20 @@ the first FEATURE."
                             (funcall (or (get ',name 'custom-get)
                                          #'symbol-value)
                                      ',name))))
+          ((eq (car-safe name) 'remove)
+           (setq name (cadr name)
+                 val `(remove ,val
+                              (funcall (or (get ',name 'custom-get)
+                                           #'symbol-value)
+                                       ',name))))
           ((error "Invalid option %S" name)))
     `(customize-set-variable ',name ,val "Modified by `setup'"))
   :documentation "Set the option NAME to VAL.
 NAME may be a symbol, or a cons-cell.  If NAME is a cons-cell, it
 will use the car value to modify the behaviour.  If NAME has the
 form (append VAR), VAL is appended to VAR.  If NAME has the
-form (prepend VAR), VAL is prepended to VAR."
+form (prepend VAR), VAL is prepended to VAR.  If NAME has the
+form (remove VAR), VAL is removed from VAR."
   :debug '(sexp form)
   :repeatable t)
 
@@ -365,13 +372,17 @@ form (prepend VAR), VAL is prepended to VAR."
           ((eq (car-safe name) 'prepend)
            (setq name (cadr name)
                  val `(cons ,val ,name)))
+          ((eq (car-safe name) 'remove)
+           (setq name (cadr name)
+                 val `(remove ,val ,name)))
           ((error "Invalid variable %S" name)))
     `(add-hook setup-hook (lambda () (setq-local ,name ,val))))
   :documentation "Set the value of NAME to VAL in buffers of the current mode.
 NAME may be a symbol, or a cons-cell.  If NAME is a cons-cell, it
 will use the car value to modify the behaviour.  If NAME has the
 form (append VAR), VAL is appended to VAR.  If NAME has the
-form (prepend VAR), VAL is prepended to VAR."
+form (prepend VAR), VAL is prepended to VAR.  If NAME has the
+form (remove VAR), VAL is removed from VAR."
   :debug '(sexp form)
   :repeatable t)
 



reply via email to

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