From: Barry Margolin <barmar@alum.mit.edu>
To: help-gnu-emacs@gnu.org
Subject: Re: interactive interface to supply variables
Date: Sat, 14 Dec 2013 16:01:10 -0500 [thread overview]
Message-ID: <barmar-E705B1.16011014122013@news.eternal-september.org> (raw)
In-Reply-To: 87vbyr45bj.fsf@nl106-137-194.student.uu.se
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 ***
next prev parent reply other threads:[~2013-12-14 21:01 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-14 19:09 interactive interface to supply variables Emanuel Berg
2013-12-14 19:52 ` Juanma Barranquero
2013-12-15 4:58 ` Michael Heerdegen
[not found] ` <mailman.9280.1387083570.10748.help-gnu-emacs@gnu.org>
2013-12-15 5:23 ` Emanuel Berg
[not found] ` <mailman.9242.1387050824.10748.help-gnu-emacs@gnu.org>
2013-12-14 20:46 ` Emanuel Berg
2013-12-14 21:01 ` Barry Margolin [this message]
2013-12-14 21:42 ` Emanuel Berg
2013-12-14 21:09 ` Jambunathan K
[not found] ` <mailman.9258.1387055530.10748.help-gnu-emacs@gnu.org>
2013-12-14 21:46 ` Emanuel Berg
2013-12-14 21:51 ` Emanuel Berg
2013-12-15 5:41 ` Jambunathan K
[not found] ` <mailman.9281.1387086321.10748.help-gnu-emacs@gnu.org>
2013-12-15 18:14 ` Emanuel Berg
2013-12-15 0:09 ` Emanuel Berg
2013-12-15 0:46 ` Emanuel Berg
2013-12-14 23:39 ` Drew Adams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=barmar-E705B1.16011014122013@news.eternal-september.org \
--to=barmar@alum.mit.edu \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.