help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: interactive interface to supply variables


From: Jambunathan K
Subject: Re: interactive interface to supply variables
Date: Sun, 15 Dec 2013 02:39:23 +0530
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

Declare the variable with defcustom instead of defvar.

You can `put' and `get' stuff on a symbol.  As an experiment, Try C-x n
n or any of the narrowing command and see what happens to your .emacs.

You can also use the "x" interactive spec and check the expression that
is input with symbolp.

Emanuel Berg <embe8573@student.uu.se> writes:

> (defvar test-var 1)
> (symbol-value 'test-var)      ; 1
> (symbol-name 'test-var)       ; "test-var" (both correct)
>
> But:
>
> (custom-variable-p 'test-var) ; nil
>
> This messes up this defun:
>
> (defun describe-variable-short (var)
>   (interactive "v Variable: ")
>   (message (format " %s: %s" (symbol-name var) (symbol-value var))) )
>
> Because if `custom-variable-p' is nil, (interactive "v
> ... reports [No match].
>
> How does `describe-variable' do that? (Perhaps I should
> just copy their interface, because they also suggest
> the variable at point as default. But that's step two.)



reply via email to

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