emacs-devel
[Top][All Lists]
Advanced

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

Re: doc string of `local-variable-if-set-p'


From: Luc Teirlinck
Subject: Re: doc string of `local-variable-if-set-p'
Date: Wed, 13 Oct 2004 13:25:55 -0500 (CDT)

David Kastrup wrote:

   Oh, come on, that is mathematician speak, working with parens.  Just
   say:

   Non-nil if after setting the VARIABLE in buffer BUFFER it will be
   local, either because it is already so, or because it is automatic
   buffer-local (see `make-variable-buffer-local').

That first line is way too long (needs to be 67 characters or less).
I believe that the new first line I sent is clear.

   However, can anybody tell me what the point of the BUFFER argument is?
   It makes it hard to find out whether a variable that might already
   have a local binding is automatic buffer-local.

I believe you misunderstand the purpose of `local-variable-if-set-p'.

`(local-variable-p var)' tests whether VAR actually _has_ a buffer
local binding in BUFFER.

`(local-variable-if-set-p var)' tests whether VAR would have a
buffer-local binding in buffer if we would bind it right now.

See the ielm run I sent earlier.

Concerning the second paragraph quoted above: you want to check
whether variable is automatically buffer-local when set.
`describe-variable' does this as follows:

(when (and (local-variable-if-set-p variable)
           (or (not (local-variable-p variable))
               (with-temp-buffer
                 (local-variable-if-set-p variable))))
  (save-excursion
    (forward-line -1)
    (insert "Automatically becomes buffer-local when set in any fashion.\n")))

I do not know whether there is a better way to do it.  If there is a
one, then the above piece of code should be changed to use it.

Sincerely,

Luc.




reply via email to

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