[Top][All Lists]

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

Re: add info about safe-local-variable to describe-variable

From: Reiner Steib
Subject: Re: add info about safe-local-variable to describe-variable
Date: Thu, 11 May 2006 15:36:05 +0200
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.50 (gnu/linux)

On Wed, May 10 2006, Ken Manheimer wrote:

> On 5/10/06, Reiner Steib <address@hidden> wrote:
>> ;;;###autoload
>> (put 'allout-numbered-bullet 'safe-local-variable
>>      (lambda (x) (or (not x) (stringp x))))
>> ... instead of...
>> ;;;###autoload(put 'allout-numbered-bullet 'safe-local-variable (lambda (x) 
>> (or (not x) (stringp x))))
>> ... (and similar for other many other variables) in `allout.el'.
> i haven't seen some of this conversation (i looked in the archive, and
> these messages aren't there yet), and i'm not clear whether something
> is being requested here.

[ The archives on gmane.org are updated as soon as the message arrives
  from the list:
  http://news.gmane.org/gmane.emacs.pretest.bugs ]

> i deliberately chose to use the form that defines the variables in the
> file's bytecode, as well as in loaddefs, because i want to be able to
> use the most recent version of allout in versions of emacs that are
> not built with allout (eg, the old emacs version i'm running on my
> zaurus).  i would like to be able to use the same source code in such
> cases.  (i imagine other people might be in the same situation.)

AFAICS, Emacs 21 doesn't care about the safe-local-variable properties
in the first place, so you there no need for backward compatibility
here.  (I don't think we should try to be backward compatible with
older CVS versions.)

> i don't want to make allout objectionable for distribution with emacs,
> and am willing to conform to the conventions, if necessary.  is having
> the definitions exist only in loaddefs being asked, or will it be
> enough to have the active definitions in allout as well, but quote the
> lambda expressions so they're not byte-compiled (and so don't clutter
> the help)?

For Emacs 22, Richard recommended not to execute it again when the
file is loaded, i.e. use...

;;;###autoload(put '... 'safe-local-variable ...)

See <http://thread.gmane.org/gmane.emacs.devel/52972/focus=53151>.

On Wed, May 10 2006, Ken Manheimer wrote:

> On 5/10/06, Reiner Steib <address@hidden> wrote:
>> On Wed, May 10 2006, Stefan Monnier wrote:
>> [ (lambda (x) (or (not x) (stringp x))) ]
>> > Actually, we should use string-or-null-p here.
>> ACK.  And (member x (quote (t nil))) should be booleanp.
> i can make those changes.  (booleanp must be rather new addition -
> it's not in my CVS emacs built a week and a half ago.)

Stefan installed it on 2006-04-29.

>> But there are also expressions in `allout.el' where no predefined
>> predicate exists (AFAICS):
>> allout-use-mode-specific-leader

  (lambda (x) (or (member x '(t nil)) (stringp x)))

I'd rewrite this as...

  (lambda (x) (or (booleanp x) (stringp x)))

>> allout-reindent-bodies

  (lambda (x) (member x '(nil t text force)))

>> allout-layout

  (lambda (x) (or (numberp x) (listp x) (integerp x)
                  (member x '(: * + -))))

> is it necessary to have a predefined predicate in all cases, or will
> quoting the lambda be sufficient?  i could define functions to be used
> as predicates, and have them autoloaded, but i see no particular gain
> there.

I don't think it would be useful to define functions for these
predicates.  If you put them inside the autoload comment, you don't
need to quote them.  (Of course this is only _my_ opinion; maybe you
should wait for other comments before working on it.)

For completeness, here is a list of all safe-local-variable lambda
expressions in `loaddefs.el':

(lambda (x) (member x (quote (nil t text force)))); allout-reindent-bodies

==> no need for a defun, but use autoload comment.

(lambda (x) (member x (quote (t nil)))); allout-old-style-prefixes
(lambda (x) (member x (quote (t nil)))); allout-show-bodies
(lambda (x) (member x (quote (t nil)))); allout-stylish-prefixes
(lambda (x) (member x (quote (t nil)))); allout-use-hanging-indents

==> booleanp

(lambda (x) (memq x '(nil t exclusive))); ispell-check-comments

==> no need for a defun

(lambda (x) (or (member x (quote (t nil))) (stringp x))); 

==> no need for a defun, but use autoload comment.

(lambda (x) (or (not x) (stringp x))); allout-file-xref-bullet
(lambda (x) (or (not x) (stringp x))); allout-numbered-bullet

==> string-or-null-p

(lambda (x) (or (numberp x) (listp x) (integerp x) (member x (quote (: * + 
-))))); allout-layout

==> no need for a defun, but use autoload comment.

(lambda (x) (or (stringp x) (symbolp x))); reftex-fref-is-default
(lambda (x) (or (stringp x) (symbolp x))); reftex-vref-is-default

==> no need for a defun; If we'd have more of this, we could add

> (please cc me in followups in this thread...)

[ Done.  You may lookup the sub-thread here:
  http://thread.gmane.org/gmane.emacs.pretest.bugs/11847/focus=11953 ]

Bye, Reiner.
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/

reply via email to

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