* gnus/nnheader.el (nnheader-find-file-noselect):
authorStefan Monnier <monnier@iro.umontreal.ca>
Fri, 28 Aug 2009 17:02:53 +0000 (17:02 +0000)
committerStefan Monnier <monnier@iro.umontreal.ca>
Fri, 28 Aug 2009 17:02:53 +0000 (17:02 +0000)
* gnus/mm-util.el (mm-insert-file-contents):
* org/org-html.el (org-export-as-html):
* org/org-docbook.el (org-export-as-docbook):
* textmodes/reftex.el (reftex-get-file-buffer-force):
* progmodes/verilog-mode.el (verilog-batch-execute-func):
* emulation/viper.el (viper-go-away, viper-set-hooks):
* emacs-lisp/re-builder.el (re-builder-unload-function):
* emacs-lisp/bytecomp.el (byte-compile-file):
* ses.el (ses-unload-function):
* hexl.el (hexl-find-file):
* files.el (normal-mode):
* ehelp.el (with-electric-help):
* autoinsert.el (auto-insert-alist):
* arc-mode.el (archive-mode):
Use (default-value 'major-mode) instead of default-major-mode.

21 files changed:
lisp/ChangeLog
lisp/arc-mode.el
lisp/autoinsert.el
lisp/ehelp.el
lisp/emacs-lisp/bytecomp.el
lisp/emacs-lisp/re-builder.el
lisp/emulation/viper.el
lisp/files.el
lisp/gnus/ChangeLog
lisp/gnus/mm-util.el
lisp/gnus/nnheader.el
lisp/hexl.el
lisp/mh-e/mh-folder.el
lisp/mh-e/mh-letter.el
lisp/mh-e/mh-show.el
lisp/org/ChangeLog
lisp/org/org-docbook.el
lisp/org/org-html.el
lisp/progmodes/verilog-mode.el
lisp/ses.el
lisp/textmodes/reftex.el

index fb1dde9..522852f 100644 (file)
@@ -1,5 +1,18 @@
 2009-08-28  Stefan Monnier  <monnier@iro.umontreal.ca>
 
+       * textmodes/reftex.el (reftex-get-file-buffer-force):
+       * progmodes/verilog-mode.el (verilog-batch-execute-func):
+       * emulation/viper.el (viper-go-away, viper-set-hooks):
+       * emacs-lisp/re-builder.el (re-builder-unload-function):
+       * emacs-lisp/bytecomp.el (byte-compile-file):
+       * ses.el (ses-unload-function):
+       * hexl.el (hexl-find-file):
+       * files.el (normal-mode):
+       * ehelp.el (with-electric-help):
+       * autoinsert.el (auto-insert-alist):
+       * arc-mode.el (archive-mode):
+       Use (default-value 'major-mode) instead of default-major-mode.
+
        * textmodes/ispell.el (ispell-check-version, ispell-send-string):
        * international/mule.el (load-with-code-conversion):
        * emacs-lisp/debug.el (debug):
index e812a47..6e65d64 100644 (file)
@@ -638,7 +638,7 @@ archive.
   ;; mode on and off.  You can corrupt things that way.
   (if (zerop (buffer-size))
       ;; At present we cannot create archives from scratch
-      (funcall default-major-mode)
+      (funcall (default-value 'major-mode))
     (if (and (not force) archive-files) nil
       (let* ((type (archive-find-type))
             (typename (capitalize (symbol-name type))))
index 17a9e42..0fbc3d6 100644 (file)
@@ -128,7 +128,7 @@ If this contains a %s, that will be replaced by the matching rule."
 
     (("/bin/.*[^/]\\'" . "Shell-Script mode magic number")
      lambda ()
-       (if (eq major-mode default-major-mode)
+       (if (eq major-mode (default-value 'major-mode))
         (sh-mode)))
 
     (ada-mode . ada-header)
index d8e7ea5..8f1eeef 100644 (file)
@@ -96,7 +96,7 @@
 
 (defun electric-help-mode ()
   "`with-electric-help' temporarily places its buffer in this mode.
-\(On exit from `with-electric-help', the buffer is put in `default-major-mode'.)"
+\(On exit from `with-electric-help', the buffer is put in default `major-mode'.)"
   (setq buffer-read-only t)
   (setq mode-name "Help")
   (setq major-mode 'help)
@@ -131,7 +131,7 @@ If THUNK returns non-nil, we don't do those things.
 
 When the user exits (with `electric-help-exit', or otherwise), the help
 buffer's window disappears (i.e., we use `save-window-excursion'), and
-BUFFER is put into `default-major-mode' (or `fundamental-mode')."
+BUFFER is put into default `major-mode' (or `fundamental-mode')."
   (setq buffer (get-buffer-create (or buffer "*Help*")))
   (let ((one (one-window-p t))
        (config (current-window-configuration))
@@ -143,8 +143,7 @@ BUFFER is put into `default-major-mode' (or `fundamental-mode')."
             (goto-char (window-start (selected-window))))
            (let ((pop-up-windows t))
              (pop-to-buffer buffer))
-           (save-excursion
-             (set-buffer buffer)
+           (with-current-buffer buffer
              (when (and minheight (< (window-height) minheight))
               (enlarge-window (- minheight (window-height))))
              (electric-help-mode)
@@ -177,7 +176,7 @@ BUFFER is put into `default-major-mode' (or `fundamental-mode')."
       ;; afterwards.  It's also not clear that `help-mode' is always
       ;; the right thing, maybe we should add an optional parameter.
       (condition-case ()
-          (funcall (or default-major-mode 'fundamental-mode))
+          (funcall (or (default-value 'major-mode) 'fundamental-mode))
         (error nil))
 
       (set-window-configuration config)
index 01d1e27..c234fd7 100644 (file)
 ;;     Some versions of `file' can be customized to recognize that.
 
 (require 'backquote)
+(eval-when-compile (require 'cl))
 
 (or (fboundp 'defsubst)
     ;; This really ought to be loaded already!
@@ -1747,12 +1748,12 @@ The value is non-nil if there were no errors, nil if errors."
        (set-buffer-multibyte nil))
       ;; Run hooks including the uncompression hook.
       ;; If they change the file name, then change it for the output also.
-      (let ((buffer-file-name bytecomp-filename)
-           (default-major-mode 'emacs-lisp-mode)
-           ;; Ignore unsafe local variables.
-           ;; We only care about a few of them for our purposes.
-           (enable-local-variables :safe)
-           (enable-local-eval nil))
+      (letf ((buffer-file-name bytecomp-filename)
+             ((default-value 'major-mode) 'emacs-lisp-mode)
+             ;; Ignore unsafe local variables.
+             ;; We only care about a few of them for our purposes.
+             (enable-local-variables :safe)
+             (enable-local-eval nil))
        ;; Arg of t means don't alter enable-local-variables.
         (normal-mode t)
         (setq bytecomp-filename buffer-file-name))
index 97aba43..ed45bd6 100644 (file)
@@ -720,7 +720,7 @@ If SUBEXP is non-nil mark only the corresponding sub-expressions."
       (remove-hook 'kill-buffer-hook 'reb-kill-buffer t)
       (when (reb-mode-buffer-p)
        (reb-delete-overlays)
-       (funcall default-major-mode))))
+       (funcall (default-value 'major-mode)))))
   ;; continue standard unloading
   nil)
 
index 1631b1a..2d65f5c 100644 (file)
@@ -678,8 +678,9 @@ It also can't undo some Viper settings."
    global-mode-string
    (delq 'viper-mode-string global-mode-string))
 
-  (setq default-major-mode
-       (viper-standard-value 'default-major-mode viper-saved-non-viper-variables))
+  (setq-default major-mode
+                (viper-standard-value 'default-major-mode
+                                      viper-saved-non-viper-variables))
 
   (if (featurep 'emacs)
       (setq-default
@@ -834,8 +835,8 @@ It also can't undo some Viper settings."
   ;; in Fundamental Mode and Vi state.
   ;; When viper-mode is executed in such a case, it will set the major mode
   ;; back to fundamental-mode.
-  (if (eq default-major-mode 'fundamental-mode)
-      (setq default-major-mode 'viper-mode))
+  (if (eq (default-value 'major-mode) 'fundamental-mode)
+      (setq-default major-mode 'viper-mode))
 
   (add-hook 'change-major-mode-hook 'viper-major-mode-change-sentinel)
   (add-hook 'find-file-hooks 'set-viper-state-in-major-mode)
@@ -1214,7 +1215,7 @@ These two lines must come in the order given.
 (if (null viper-saved-non-viper-variables)
     (setq viper-saved-non-viper-variables
          (list
-          (cons 'default-major-mode (list default-major-mode))
+          (cons 'default-major-mode (list (default-value 'major-mode)))
           (cons 'next-line-add-newlines (list next-line-add-newlines))
           (cons 'require-final-newline (list require-final-newline))
           (cons 'scroll-step (list scroll-step))
index 3ff6c5c..2c695c1 100644 (file)
@@ -2100,7 +2100,7 @@ not set local variables (though we do notice a mode specified with -*-.)
 or from Lisp without specifying the optional argument FIND-FILE;
 in that case, this function acts as if `enable-local-variables' were t."
   (interactive)
-  (funcall (or default-major-mode 'fundamental-mode))
+  (funcall (or (default-value 'major-mode) 'fundamental-mode))
   (let ((enable-local-variables (or (not find-file) enable-local-variables)))
     (report-errors "File mode specification error: %s"
       (set-auto-mode))
index afd0c19..2bdd3df 100644 (file)
@@ -1,3 +1,9 @@
+2009-08-28  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * nnheader.el (nnheader-find-file-noselect):
+       * mm-util.el (mm-insert-file-contents):
+       Use (default-value 'major-mode) instead of default-major-mode.
+
 2009-08-27  Stefan Monnier  <monnier@iro.umontreal.ca>
 
        * nnrss.el (nnrss-request-article): Avoid default-fill-column.
index 403d967..8866bef 100644 (file)
@@ -1308,24 +1308,24 @@ to advanced Emacs features, such as file-name-handlers, format decoding,
 `find-file-hooks', etc.
 If INHIBIT is non-nil, inhibit `mm-inhibit-file-name-handlers'.
   This function ensures that none of these modifications will take place."
-  (let* ((format-alist nil)
-        (auto-mode-alist (if inhibit nil (mm-auto-mode-alist)))
-        (default-major-mode 'fundamental-mode)
-        (enable-local-variables nil)
-        (after-insert-file-functions nil)
-        (enable-local-eval nil)
-        (inhibit-file-name-operation (if inhibit
-                                         'insert-file-contents
-                                       inhibit-file-name-operation))
-        (inhibit-file-name-handlers
-         (if inhibit
-             (append mm-inhibit-file-name-handlers
-                     inhibit-file-name-handlers)
-           inhibit-file-name-handlers))
-        (ffh (if (boundp 'find-file-hook)
-                 'find-file-hook
-               'find-file-hooks))
-        (val (symbol-value ffh)))
+  (letf* ((format-alist nil)
+          (auto-mode-alist (if inhibit nil (mm-auto-mode-alist)))
+          ((default-value 'major-mode) 'fundamental-mode)
+          (enable-local-variables nil)
+          (after-insert-file-functions nil)
+          (enable-local-eval nil)
+          (inhibit-file-name-operation (if inhibit
+                                           'insert-file-contents
+                                         inhibit-file-name-operation))
+          (inhibit-file-name-handlers
+           (if inhibit
+               (append mm-inhibit-file-name-handlers
+                       inhibit-file-name-handlers)
+             inhibit-file-name-handlers))
+          (ffh (if (boundp 'find-file-hook)
+                   'find-file-hook
+                 'find-file-hooks))
+          (val (symbol-value ffh)))
     (set ffh nil)
     (unwind-protect
        (insert-file-contents filename visit beg end replace)
index 572f80b..ce52ac9 100644 (file)
@@ -992,18 +992,18 @@ find-file-hooks, etc.
 (defun nnheader-find-file-noselect (&rest args)
   "Open a file with some variables bound.
 See `find-file-noselect' for the arguments."
-  (let* ((format-alist nil)
-        (auto-mode-alist (mm-auto-mode-alist))
-        (default-major-mode 'fundamental-mode)
-        (enable-local-variables nil)
-        (after-insert-file-functions nil)
-        (enable-local-eval nil)
-        (coding-system-for-read nnheader-file-coding-system)
-        (version-control 'never)
-        (ffh (if (boundp 'find-file-hook)
-                 'find-file-hook
-               'find-file-hooks))
-        (val (symbol-value ffh)))
+  (letf* ((format-alist nil)
+          (auto-mode-alist (mm-auto-mode-alist))
+          ((default-value 'major-mode) 'fundamental-mode)
+          (enable-local-variables nil)
+          (after-insert-file-functions nil)
+          (enable-local-eval nil)
+          (coding-system-for-read nnheader-file-coding-system)
+          (version-control 'never)
+          (ffh (if (boundp 'find-file-hook)
+                   'find-file-hook
+                 'find-file-hooks))
+          (val (symbol-value ffh)))
     (set ffh nil)
     (unwind-protect
        (apply 'find-file-noselect args)
index d4aec14..19c1b99 100644 (file)
@@ -42,6 +42,7 @@
 ;;; Code:
 
 (require 'eldoc)
+(eval-when-compile (require 'cl))
 
 ;;
 ;; vars here
@@ -365,8 +366,8 @@ and edit the file in `hexl-mode'."
    (list
     (let ((completion-ignored-extensions nil))
       (read-file-name "Filename: " nil nil 'ret-must-match))))
-  ;; Ignore the user's setting of default-major-mode.
-  (let ((default-major-mode 'fundamental-mode))
+  ;; Ignore the user's setting of default major-mode.
+  (letf (((default-value 'major-mode) 'fundamental-mode))
     (find-file-literally filename))
   (if (not (eq major-mode 'hexl-mode))
       (hexl-mode)))
index e43c56b..52a6d78 100644 (file)
@@ -529,7 +529,7 @@ font-lock is done highlighting.")
 (defvar font-lock-auto-fontify)
 (defvar font-lock-defaults)             ; XEmacs
 
-;; Ensure new buffers won't get this mode if default-major-mode is nil.
+;; Ensure new buffers won't get this mode if default major-mode is nil.
 (put 'mh-folder-mode 'mode-class 'special)
 
 ;; Autoload cookie needed by desktop.el
index dcb8d85..051a98d 100644 (file)
@@ -277,7 +277,7 @@ searching for `mh-mail-header-separator' in the buffer."
 ;; Shush compiler.
 (defvar font-lock-defaults)             ; XEmacs
 
-;; Ensure new buffers won't get this mode if default-major-mode is nil.
+;; Ensure new buffers won't get this mode if default major-mode is nil.
 (put 'mh-letter-mode 'mode-class 'special)
 
 ;;;###mh-autoload
index 97a9883..70852f0 100644 (file)
@@ -825,7 +825,7 @@ operation."
 
 ;;; MH-Show Mode
 
-;; Ensure new buffers won't get this mode if default-major-mode is nil.
+;; Ensure new buffers won't get this mode if default major-mode is nil.
 (put 'mh-show-mode 'mode-class 'special)
 
 ;; Shush compiler.
index 82010dc..f5efef3 100644 (file)
@@ -1,3 +1,9 @@
+2009-08-28  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * org-html.el (org-export-as-html):
+       * org-docbook.el (org-export-as-docbook):
+       Use (default-value 'major-mode) instead of default-major-mode.
+
 2009-08-08  Carsten Dominik  <carsten.dominik@gmail.com>
 
        * org-docbook.el: Add arch-tag.
index 8d47b55..38af080 100644 (file)
@@ -9,7 +9,7 @@
 ;; Maintainer: Baoqiu Cui <cbaoqiu AT yahoo DOT com>
 ;; Keywords: org, wp, docbook
 ;; Description: Converts an org-mode buffer into DocBook
-;; $Id: org-docbook.el,v 1.2 2009/08/08 02:33:22 gm Exp $
+;; $Id: org-docbook.el,v 1.3 2009/08/08 12:18:56 cdominik Exp $
 ;; URL:
 
 ;; This file is part of GNU Emacs.
@@ -1102,7 +1102,7 @@ publishing directory."
 
       (unless (plist-get opt-plist :buffer-will-be-killed)
        (normal-mode)
-       (if (eq major-mode default-major-mode)
+       (if (eq major-mode (default-value 'major-mode))
            (nxml-mode)))
 
       ;; Remove empty paragraphs and lists.  Replace them with a
index 35eb45a..3170f3a 100644 (file)
@@ -1419,7 +1419,7 @@ lang=\"%s\" xml:lang=\"%s\">
 
       (unless (plist-get opt-plist :buffer-will-be-killed)
        (normal-mode)
-       (if (eq major-mode default-major-mode) (html-mode)))
+       (if (eq major-mode (default-value 'major-mode)) (html-mode)))
 
       ;; insert the table of contents
       (goto-char (point-min))
index 4c5a21f..57a51fd 100644 (file)
@@ -4136,18 +4136,18 @@ This lets programs calling batch mode to easily extract error messages."
 (defun verilog-batch-execute-func (funref)
   "Internal processing of a batch command, running FUNREF on all command arguments."
   (verilog-batch-error-wrapper
+   ;; !!! FIXME: Setting global variables like that is *VERY NASTY* !!!  --Stef
    ;; General globals needed
    (setq make-backup-files nil)
    (setq-default make-backup-files nil)
    (setq enable-local-variables t)
    (setq enable-local-eval t)
    ;; Make sure any sub-files we read get proper mode
-   (setq default-major-mode `verilog-mode)
+   (setq-default major-mode 'verilog-mode)
    ;; Ditto files already read in
    (mapc (lambda (buf)
           (when (buffer-file-name buf)
-            (save-excursion
-              (set-buffer buf)
+            (with-current-buffer buf
               (verilog-mode))))
         (buffer-list))
    ;; Process the files
index 95685e7..8623902 100644 (file)
@@ -3011,7 +3011,7 @@ current column and continues until the next nonblank column."
     (dolist (buf (buffer-list))
       (set-buffer buf)
       (when (eq major-mode 'ses-mode)
-       (funcall (or default-major-mode 'fundamental-mode)))))
+       (funcall (or (default-value 'major-mode) 'fundamental-mode)))))
   ;; continue standard unloading
   nil)
 
index 23cf167..d905ce6 100644 (file)
@@ -2063,11 +2063,11 @@ When DIE is non-nil, throw an error if file not found."
              ;;       with limited Magic
 
              ;; The magic goes away
-             (let ((format-alist nil)
-                   (auto-mode-alist (reftex-auto-mode-alist))
-                   (default-major-mode 'fundamental-mode)
-                   (enable-local-variables nil)
-                   (after-insert-file-functions nil))
+             (letf ((format-alist nil)
+                    (auto-mode-alist (reftex-auto-mode-alist))
+                    ((default-value 'major-mode) 'fundamental-mode)
+                    (enable-local-variables nil)
+                    (after-insert-file-functions nil))
                (setq buf (find-file-noselect file)))
 
              ;; Is there a hook to run?