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: Stuart D. Herring
Subject: Re: Mode loaded twice with Local Variables
Date: Tue, 9 May 2006 09:08:02 -0700 (PDT)
User-agent: SquirrelMail/1.4.3a-11.EL3

>   I propose this, maybe naive, change:
> [patch to `normal-mode']

How about this?  It seems simpler to me.

Davis

PS - I copied the manual implementation of `indirect-function' from
`set-auto-mode-0'.  Is there some reason i-f isn't used?  Is it just to
avoid errors for unfbound symbols?  What if the major mode was itself an
alias, or does that not happen?

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

-- 
This product is sold by volume, not by mass.  If it appears too dense or
too sparse, it is because mass-energy conversion has occurred during
shipping.




reply via email to

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