unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Sebastián Monía" <sebastian@sebasmonia.com>
To: Garklein <garklein97@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: Variable predicate
Date: Wed, 25 Sep 2024 11:47:49 -0400	[thread overview]
Message-ID: <thqn7cazybtm.fsf@sebasmonia.com> (raw)
In-Reply-To: <CALp=CknGoXGbCtLTAX9O_CCodFvLgU0kTUNyaLt6Gd7tDqQ_RA@mail.gmail.com> (Garklein's message of "Tue, 24 Sep 2024 08:25:58 -0400")


Hi Garklein,

I am not sure I am the most qualified person to reply, but if I am
wrong, we'll get corrections soon enough ;)

Garklein <garklein97@gmail.com> writes:
> In help-fns.el, two different ways are used to check if a symbol is a
> variable.
>
> `describe-function' uses
>
> (lambda (vv)
>  (or (get vv 'variable-documentation)
>      (and (not (keywordp vv))
>           ;; Since the variable may only exist in the
>           ;; original buffer, we have to look for it
>           ;; there.
>           (buffer-local-boundp vv orig-buffer))))

After checking the code, I think you meant this is how
'describe-variable' works.

The predicate is not checking "is the symbol a variable", but if it has
a documentation slot in its property list, -or- if it is bound
buffer-local.
The selection of symbols to run by the predicate comes from
help--symbol-completion-table which does....a lot more.

> and `variable-at-point' just uses `boundp'.

You can check this one using `describe-function' on `boundp' :)

> Is there any difference between these two methods? Which should I use?

They do very different things, if you _only_ want to know if a symbol
has been bound as a variable, boundp should be enough.

Hope that helps!

-- 
Sebastián Monía
https://site.sebasmonia.com/



      reply	other threads:[~2024-09-25 15:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-24 12:25 Variable predicate Garklein
2024-09-25 15:47 ` Sebastián Monía [this message]

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=thqn7cazybtm.fsf@sebasmonia.com \
    --to=sebastian@sebasmonia.com \
    --cc=emacs-devel@gnu.org \
    --cc=garklein97@gmail.com \
    /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 public inbox

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

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).