emacs-devel
[Top][All Lists]
Advanced

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

Re: Mode loaded twice with Local Variables


From: Michaël Cadilhac
Subject: Re: Mode loaded twice with Local Variables
Date: Wed, 10 May 2006 20:29:07 +0200
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.50 (gnu/linux)

"Stuart D. Herring" <address@hidden> writes:

> ***************
> *** 2724,2733 ****
>                     ok)))))))
>
>   (defun hack-one-local-variable (var val)
> !   "Set local variable VAR with value VAL."
>     (cond ((eq var 'mode)
> !      (funcall (intern (concat (downcase (symbol-name val))
> !                               "-mode"))))
>       ((eq var 'eval)
>        (save-excursion (eval val)))
>       (t (make-local-variable var)
> --- 2738,2753 ----
>                     ok)))))))
>
>   (defun hack-one-local-variable (var val)
> !   "Set local variable VAR with value VAL.
> ! If VAR is `mode', call `VAL-mode' as a
> ! function unless it's already the major mode."
>     (cond ((eq var 'mode)
> !      (let ((mode (intern (concat (downcase (symbol-name val)) "-mode"))))
> !        (while (symbolp (symbol-function mode))
> !          (setq mode (symbol-function mode)))
> !        (if (eq mode major-mode)
> !            (setq mode nil))
> !        (when mode (funcall mode))))
>       ((eq var 'eval)
>        (save-excursion (eval val)))
>       (t (make-local-variable var)

  I didn't  think it  was the right  fix for  one reason :  some modes
  /may/  behave  differently  on  startup  if  /some/  variables  have
  /certain/  values.  In  other   words,  Local  Variables  would  set
  variables  to  some  value  before  launching  the  mode,  expecting
  a specified behavior.

  My change provides this feature, AFAIK, but I do agree that it could
  be too... dangerous to patch normal-mode, and not so needed.

  Regards.

-- 
 |      Michaël `Micha' Cadilhac   |   Un certain Blaise Pascal             |
 |         Epita/LRDE Promo 2007   |     etc... etc...                      |
 | http://www.lrde.org/~cadilh_m   |   -- Prévert (Les paris stupides)      |
 `--  -   JID: address@hidden --'                                   -  --'

Attachment: pgpzEhLSFHwOI.pgp
Description: PGP signature


reply via email to

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