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


From: Miles Bader
Subject: [Emacs-diffs] Changes to emacs/lisp/files.el
Date: Fri, 04 Apr 2003 01:22:07 -0500

Index: emacs/lisp/files.el
diff -c emacs/lisp/files.el:1.646 emacs/lisp/files.el:1.647
*** emacs/lisp/files.el:1.646   Mon Mar 31 11:05:49 2003
--- emacs/lisp/files.el Thu Apr  3 18:00:22 2003
***************
*** 1917,1938 ****
         (goto-char beg)
         end))))
  
! (defun hack-local-variables-prop-line ()
    "Set local variables specified in the -*- line.
  Ignore any specification for `mode:' and `coding:';
  `set-auto-mode' should already have handled `mode:',
! `set-auto-coding' should already have handled `coding:'."
    (save-excursion
      (goto-char (point-min))
      (let ((result nil)
          (end (set-auto-mode-1))
          (enable-local-variables
           (and local-enable-local-variables enable-local-variables)))
!       ;; Parse the -*- line into the `result' alist.
        (cond ((not end)
             nil)
            ((looking-at "[ \t]*\\([^ \t\n\r:;]+\\)\\([ \t]*-\\*-\\)")
             ;; Simple form: "-*- MODENAME -*-".  Already handled.
             nil)
            (t
             ;; Hairy form: '-*-' [ <variable> ':' <value> ';' ]* '-*-'
--- 1917,1943 ----
         (goto-char beg)
         end))))
  
! (defun hack-local-variables-prop-line (&optional mode-only)
    "Set local variables specified in the -*- line.
  Ignore any specification for `mode:' and `coding:';
  `set-auto-mode' should already have handled `mode:',
! `set-auto-coding' should already have handled `coding:'.
! If MODE-ONLY is non-nil, all we do is check whether the major mode
! is specified, returning t if it is specified."
    (save-excursion
      (goto-char (point-min))
      (let ((result nil)
          (end (set-auto-mode-1))
+         mode-specified
          (enable-local-variables
           (and local-enable-local-variables enable-local-variables)))
!       ;; Parse the -*- line into the RESULT alist.
!       ;; Also set MODE-SPECIFIED if we see a spec or `mode'.
        (cond ((not end)
             nil)
            ((looking-at "[ \t]*\\([^ \t\n\r:;]+\\)\\([ \t]*-\\*-\\)")
             ;; Simple form: "-*- MODENAME -*-".  Already handled.
+            (setq mode-specified t)
             nil)
            (t
             ;; Hairy form: '-*-' [ <variable> ':' <value> ';' ]* '-*-'
***************
*** 1958,1986 ****
                 (or (equal (downcase (symbol-name key)) "mode")
                     (equal (downcase (symbol-name key)) "coding")
                     (setq result (cons (cons key val) result)))
                 (skip-chars-forward " \t;")))
             (setq result (nreverse result))))
  
!       (if (and result
!              (or (eq enable-local-variables t)
!                  (and enable-local-variables
!                       (save-window-excursion
!                         (condition-case nil
!                             (switch-to-buffer (current-buffer))
!                           (error
!                            ;; If we fail to switch in the selected window,
!                            ;; it is probably a minibuffer.
!                            ;; So try another window.
!                            (condition-case nil
!                                (switch-to-buffer-other-window 
(current-buffer))
!                              (error
!                               (switch-to-buffer-other-frame 
(current-buffer))))))
!                         (y-or-n-p (format "Set local variables as specified 
in -*- line of %s? "
!                                           (file-name-nondirectory 
buffer-file-name)))))))
!         (let ((enable-local-eval enable-local-eval))
!           (while result
!             (hack-one-local-variable (car (car result)) (cdr (car result)))
!             (setq result (cdr result))))))))
  
  (defvar hack-local-variables-hook nil
    "Normal hook run after processing a file's local variables specs.
--- 1963,1996 ----
                 (or (equal (downcase (symbol-name key)) "mode")
                     (equal (downcase (symbol-name key)) "coding")
                     (setq result (cons (cons key val) result)))
+                (if (equal (downcase (symbol-name key)) "mode")
+                    (setq mode-specified t))
                 (skip-chars-forward " \t;")))
             (setq result (nreverse result))))
  
!       (if mode-only mode-specified
!       (if (and result
!                (or mode-only
!                    (eq enable-local-variables t)
!                    (and enable-local-variables
!                         (save-window-excursion
!                           (condition-case nil
!                               (switch-to-buffer (current-buffer))
!                             (error
!                              ;; If we fail to switch in the selected window,
!                              ;; it is probably a minibuffer.
!                              ;; So try another window.
!                              (condition-case nil
!                                  (switch-to-buffer-other-window 
(current-buffer))
!                                (error
!                                 (switch-to-buffer-other-frame 
(current-buffer))))))
!                           (y-or-n-p (format "Set local variables as specified 
in -*- line of %s? "
!                                             (file-name-nondirectory 
buffer-file-name)))))))
!           (let ((enable-local-eval enable-local-eval))
!             (while result
!               (hack-one-local-variable (car (car result)) (cdr (car result)))
!               (setq result (cdr result)))))
!       nil))))
  
  (defvar hack-local-variables-hook nil
    "Normal hook run after processing a file's local variables specs.
***************
*** 1991,2002 ****
    "Parse and put into effect this buffer's local variables spec.
  If MODE-ONLY is non-nil, all we do is check whether the major mode
  is specified, returning t if it is specified."
!   (unless mode-only
!     (hack-local-variables-prop-line))
!   ;; Look for "Local variables:" line in last page.
!   (let (mode-specified
        (enable-local-variables
         (and local-enable-local-variables enable-local-variables)))
      (save-excursion
        (goto-char (point-max))
        (search-backward "\n\^L" (max (- (point-max) 3000) (point-min)) 'move)
--- 2001,2014 ----
    "Parse and put into effect this buffer's local variables spec.
  If MODE-ONLY is non-nil, all we do is check whether the major mode
  is specified, returning t if it is specified."
!   (let ((mode-specified
!        ;; If MODE-ONLY is t, we check here for specifying the mode
!        ;; in the -*- line.  If MODE-ONLY is nil, we process
!        ;; the -*- line here.
!        (hack-local-variables-prop-line mode-only))
        (enable-local-variables
         (and local-enable-local-variables enable-local-variables)))
+     ;; Look for "Local variables:" line in last page.
      (save-excursion
        (goto-char (point-max))
        (search-backward "\n\^L" (max (- (point-max) 3000) (point-min)) 'move)




reply via email to

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