[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: interactive interface to supply variables
From: |
Barry Margolin |
Subject: |
Re: interactive interface to supply variables |
Date: |
Sat, 14 Dec 2013 16:01:10 -0500 |
User-agent: |
MT-NewsWatcher/3.5.3b3 (Intel Mac OS X) |
In article <87vbyr45bj.fsf@nl106-137-194.student.uu.se>,
Emanuel Berg <embe8573@student.uu.se> wrote:
> (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.)
I'm still using Emacs 22.x. In this version, the "v" specification reads
any variable for which user-variable-p is true:
(1) the first character of its documentation is `*', or
(2) it is customizable (its property list contains a non-nil value
of `standard-value' or `custom-autoload'), or
(3) it is an alias for another user variable.
Have they removed clause (1) in your version? If not, give your variable
a doc string beginning with "*".
describe-variable uses a custom interactive specification. It accepts
any symbol that has a binding or has a documentation string. If you want
this more liberal prompt, you'll probably have to copy the code.
--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
RE: interactive interface to supply variables, Drew Adams, 2013/12/14
Message not available