all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#14591: New keyword :local for defcustom
@ 2013-06-11 17:18 Juanma Barranquero
  2013-06-11 21:01 ` Ted Zlatanov
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Juanma Barranquero @ 2013-06-11 17:18 UTC (permalink / raw)
  To: 14591

Package: emacs
Version: 24.3.50
Severity: wishlist
Tags: patch



This patch adds a new keyword :local to defcustom, to simplify cases like

(defcustom some-var some-val
   "A very long description
filling many lines
...
...
..."
  ;; some keywords)
(make-variable-buffer-local 'some-var)

i.e., it tries to solve the same problem (non-locality) for
customization variables that the new macro defvar-local solves for
defvars.

As designed, it accepts values 'local (which means make the symbol
automatically buffer-local), 'permanent (which makes the symbol
permanent-local), and t which does both.

OK to the idea, the interface, comments...?

    Juanma




2013-06-11  Juanma Barranquero  <lekktu@gmail.com>

* custom.el (custom-declare-variable): Accept new keyword :local.
(defcustom): Document it.

=== modified file 'etc/NEWS'
--- etc/NEWS 2013-06-07 03:23:57 +0000
+++ etc/NEWS 2013-06-11 17:04:53 +0000
@@ -544,6 +544,9 @@
 and functions should be separated by two hyphens if the symbol is not
 meant to be used by other packages.

+** defcustom now has a new keyword :local to mark the variable as
+automatically buffer-local and/or permanent-local.
+

 * Changes in Emacs 24.4 on Non-Free Operating Systems


=== modified file 'lisp/custom.el'
--- lisp/custom.el 2013-01-02 16:13:04 +0000
+++ lisp/custom.el 2013-06-11 16:44:11 +0000
@@ -173,6 +173,11 @@
  (put symbol 'risky-local-variable value))
  ((eq keyword :safe)
  (put symbol 'safe-local-variable value))
+                ((eq keyword :local)
+                 (when (memq value '(t local))
+                   (make-variable-buffer-local symbol))
+                 (when (memq value '(t permanent))
+                   (put symbol 'permanent-local t)))
  ((eq keyword :type)
  (put symbol 'custom-type (purecopy value)))
  ((eq keyword :options)
@@ -246,6 +251,9 @@
 :risky Set SYMBOL's `risky-local-variable' property to VALUE.
 :safe Set SYMBOL's `safe-local-variable' property to VALUE.
         See Info node `(elisp) File Local Variables'.
+:local  VALUE should be t, `local' or `permanent'.
+        If t or `local', mark SYMBOL as automatically buffer-local.
+        If t or `permanent', set SYMBOL's `permanent-local' property to t.

 The following common keywords are also meaningful.





^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2019-06-28 11:04 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-11 17:18 bug#14591: New keyword :local for defcustom Juanma Barranquero
2013-06-11 21:01 ` Ted Zlatanov
2013-06-12 17:27 ` Glenn Morris
2013-06-13  1:57   ` Juanma Barranquero
2013-06-13 14:16     ` Stefan Monnier
2013-06-13 14:25       ` Juanma Barranquero
2013-06-13 19:53         ` Stefan Monnier
2013-06-14 13:06           ` Juanma Barranquero
2019-06-27 11:28             ` Lars Ingebrigtsen
2019-06-28 11:04               ` Juanma Barranquero
2013-06-14 13:03   ` Juanma Barranquero
2013-06-12 18:56 ` Stefan Monnier
2013-06-13  2:01   ` Juanma Barranquero

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.