[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Risky local variable mechanism
From: |
Luc Teirlinck |
Subject: |
Re: Risky local variable mechanism |
Date: |
Fri, 10 Feb 2006 18:31:05 -0600 (CST) |
Chong Yidong wrote:
! ;; Commonly-encountered local variables that are safe:
! (mapc (lambda (pair)
! (put (car pair) 'safe-local-variable (cdr pair)))
! '((compile-command . stringp)
! (fill-column . integerp)
! (fill-prefix . t)
! (indent-tabs-mode . t)
! (page-delimiter . t)
! (paragraph-separate . t)
! (sentence-end . t)
! (sentence-end-double-space . t)
! (tab-width . integerp)
! (version-control . t)))
After some further thought, I would be very reluctant to use
(put 'myvar 'safe-local-variable t) for _any_ variable myvar. There
is no reason to give an unscrupulous person any chance to try to play
games with perverse values. So just always check that the value makes
sense. This also automatically prevents problems if one later allows
dangerous values and forgets to update the 'safe-local-variables
property. Why not something like:
! ;; Commonly-encountered local variables that are safe:
! (mapc (lambda (pair)
! (put (car pair) 'safe-local-variable (cdr pair)))
! '((compile-command . stringp)
! (fill-column . integerp)
! (fill-prefix . (lambda (val) (or (not val) (stringp val))))
! ;; This is OK, because indent-tabs-mode is defined using
! ;; DEFVAR_BOOL and hence can only be set to t or nil.
! (indent-tabs-mode . t)
! (page-delimiter . stringp)
! (paragraph-separate . stringp)
! (sentence-end . stringp)
! (sentence-end-double-space . (lambda (val) (memq val '(t nil))))
! (tab-width . integerp)
! (version-control . (lambda (val) (memq val '(t nil never))))))
- Re: Disabled commands, (continued)
- Re: Disabled commands, Kim F. Storm, 2006/02/13
- Re: Disabled commands, Giorgos Keramidas, 2006/02/13
- Re: Disabled commands, Romain Francoise, 2006/02/13
- Re: Disabled commands, Kevin Rodgers, 2006/02/09
- RE: Risky local variable mechanism, Drew Adams, 2006/02/08
- Re: Risky local variable mechanism, Luc Teirlinck, 2006/02/08
- Re: Risky local variable mechanism, Richard M. Stallman, 2006/02/09
- Re: Risky local variable mechanism, Chong Yidong, 2006/02/10
- Re: Risky local variable mechanism, Stefan Monnier, 2006/02/10
- Re: Risky local variable mechanism, Chong Yidong, 2006/02/10
- Re: Risky local variable mechanism,
Luc Teirlinck <=
- Re: Risky local variable mechanism, Stefan Monnier, 2006/02/11
- Re: Risky local variable mechanism, Richard M. Stallman, 2006/02/11
- Re: Risky local variable mechanism, Luc Teirlinck, 2006/02/10
- Re: Risky local variable mechanism, Stefan Monnier, 2006/02/11
- Re: Risky local variable mechanism, Luc Teirlinck, 2006/02/11
- Re: Risky local variable mechanism, Richard M. Stallman, 2006/02/11
- Re: Risky local variable mechanism, Chong Yidong, 2006/02/13
- Re: Risky local variable mechanism, Luc Teirlinck, 2006/02/13
- Re: Risky local variable mechanism, Richard M. Stallman, 2006/02/14
- Re: Risky local variable mechanism, Luc Teirlinck, 2006/02/13