unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Emanuel Berg <embe8573@student.uu.se>
To: help-gnu-emacs@gnu.org
Subject: Re: interactive interface to supply variables
Date: Sun, 15 Dec 2013 01:09:04 +0100	[thread overview]
Message-ID: <87sitvq8jq.fsf@nl106-137-194.student.uu.se> (raw)
In-Reply-To: mailman.9258.1387055530.10748.help-gnu-emacs@gnu.org

This proved to be not so easy as I thought.

I installed emacs24-el and in help-fns.el I saw how
they did it in `describe-variable' - this is a
variation of their method, only, to determine if it is
a variable, they use

(or (get vv 'variable-documentation)
    (and (boundp vv)
         (not (keywordp vv)))))

while I use `boundp' only - I don't know what
`keywordp' brings. However, `boundp' isn't optimal for
unbounded variables (of course) - in those cases, it
should be communicated that there is such a variable,
only it isn't bound. `symbolp' perhaps in combination
with something else (because sumbolp is too inclusive).

Anyway, check it out.

(defun describe-variable-short (var)
  (interactive
   (let*((v            (variable-at-point))
         (var-at-point (not (eq v 0)))
         (v-name       (if var-at-point (symbol-name v)))
         (v-final
          (completing-read
           ;; prompt
           (format " Variable%s: " (if var-at-point
                                       (format " (default %s)" v)
                                       ""))
           obarray                   ; from this set (all objects?)
           (lambda (vv) (boundp vv)) ; delimit set
           t                         ; require match
           nil                       ; no insert to minibuffer (?)
           nil                       ; no history
           v-name                    ; default
          )))
   `(,(intern v-final))))
  (message (format " %s: %s" (symbol-name var) (symbol-value var))) )
(global-set-key "\C-hV" 'describe-variable-short)

-- 
Emanuel Berg, programmer-for-rent. CV, projects, etc at uXu
underground experts united:  http://user.it.uu.se/~embe8573


  parent reply	other threads:[~2013-12-15  0:09 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
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 [this message]
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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87sitvq8jq.fsf@nl106-137-194.student.uu.se \
    --to=embe8573@student.uu.se \
    --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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).