emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/lisp/files.el,v


From: Chong Yidong
Subject: [Emacs-diffs] Changes to emacs/lisp/files.el,v
Date: Thu, 01 Mar 2007 17:06:40 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Chong Yidong <cyd>      07/03/01 17:06:40

Index: files.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/files.el,v
retrieving revision 1.885
retrieving revision 1.886
diff -u -b -r1.885 -r1.886
--- files.el    25 Feb 2007 09:24:11 -0000      1.885
+++ files.el    1 Mar 2007 17:06:40 -0000       1.886
@@ -2285,14 +2285,12 @@
 If optional arg KEEP-MODE-IF-SAME is non-nil, MODE is chased of
 any aliases and compared to current major mode.  If they are the
 same, do nothing and return nil."
-  (when keep-mode-if-same
-    (while (symbolp (symbol-function mode))
-      (setq mode (symbol-function mode)))
-    (if (eq mode major-mode)
-       (setq mode nil)))
+  (unless (and keep-mode-if-same
+              (eq (indirect-function mode)
+                  (indirect-function major-mode)))
   (when mode
     (funcall mode)
-    mode))
+      mode)))
 
 (defun set-auto-mode-1 ()
   "Find the -*- spec in the buffer.
@@ -2811,9 +2809,15 @@
                      ok)))))))
 
 (defun hack-one-local-variable (var val)
-  "Set local variable VAR with value 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)
-        (funcall (intern (concat (downcase (symbol-name val)) "-mode"))))
+        (let ((mode (intern (concat (downcase (symbol-name val))
+                                    "-mode"))))
+          (unless (eq (indirect-function mode)
+                      (indirect-function major-mode))
+            (funcall mode))))
        ((eq var 'eval)
         (save-excursion (eval val)))
        (t




reply via email to

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