changeset 104682:73bff1db57b6

* gnus/nnheader.el (nnheader-find-file-noselect): * 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.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Fri, 28 Aug 2009 17:02:53 +0000
parents 91afee51b252
children 2b8eeeaa8c1d
files 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
diffstat 21 files changed, 94 insertions(+), 67 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Fri Aug 28 16:29:25 2009 +0000
+++ b/lisp/ChangeLog	Fri Aug 28 17:02:53 2009 +0000
@@ -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):
--- a/lisp/arc-mode.el	Fri Aug 28 16:29:25 2009 +0000
+++ b/lisp/arc-mode.el	Fri Aug 28 17:02:53 2009 +0000
@@ -638,7 +638,7 @@
   ;; 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))))
--- a/lisp/autoinsert.el	Fri Aug 28 16:29:25 2009 +0000
+++ b/lisp/autoinsert.el	Fri Aug 28 17:02:53 2009 +0000
@@ -128,7 +128,7 @@
 
     (("/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)
--- a/lisp/ehelp.el	Fri Aug 28 16:29:25 2009 +0000
+++ b/lisp/ehelp.el	Fri Aug 28 17:02:53 2009 +0000
@@ -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 @@
 
 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 @@
 	     (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 @@
       ;; 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)
--- a/lisp/emacs-lisp/bytecomp.el	Fri Aug 28 16:29:25 2009 +0000
+++ b/lisp/emacs-lisp/bytecomp.el	Fri Aug 28 17:02:53 2009 +0000
@@ -156,6 +156,7 @@
 ;;     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 @@
 	(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))
--- a/lisp/emacs-lisp/re-builder.el	Fri Aug 28 16:29:25 2009 +0000
+++ b/lisp/emacs-lisp/re-builder.el	Fri Aug 28 17:02:53 2009 +0000
@@ -720,7 +720,7 @@
       (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)
 
--- a/lisp/emulation/viper.el	Fri Aug 28 16:29:25 2009 +0000
+++ b/lisp/emulation/viper.el	Fri Aug 28 17:02:53 2009 +0000
@@ -678,8 +678,9 @@
    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 @@
   ;; 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 @@
 (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))
--- a/lisp/files.el	Fri Aug 28 16:29:25 2009 +0000
+++ b/lisp/files.el	Fri Aug 28 17:02:53 2009 +0000
@@ -2100,7 +2100,7 @@
 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))
--- a/lisp/gnus/ChangeLog	Fri Aug 28 16:29:25 2009 +0000
+++ b/lisp/gnus/ChangeLog	Fri Aug 28 17:02:53 2009 +0000
@@ -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.
--- a/lisp/gnus/mm-util.el	Fri Aug 28 16:29:25 2009 +0000
+++ b/lisp/gnus/mm-util.el	Fri Aug 28 17:02:53 2009 +0000
@@ -1308,24 +1308,24 @@
 `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)
--- a/lisp/gnus/nnheader.el	Fri Aug 28 16:29:25 2009 +0000
+++ b/lisp/gnus/nnheader.el	Fri Aug 28 17:02:53 2009 +0000
@@ -992,18 +992,18 @@
 (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)
--- a/lisp/hexl.el	Fri Aug 28 16:29:25 2009 +0000
+++ b/lisp/hexl.el	Fri Aug 28 17:02:53 2009 +0000
@@ -42,6 +42,7 @@
 ;;; Code:
 
 (require 'eldoc)
+(eval-when-compile (require 'cl))
 
 ;;
 ;; vars here
@@ -365,8 +366,8 @@
    (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)))
--- a/lisp/mh-e/mh-folder.el	Fri Aug 28 16:29:25 2009 +0000
+++ b/lisp/mh-e/mh-folder.el	Fri Aug 28 17:02:53 2009 +0000
@@ -529,7 +529,7 @@
 (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
--- a/lisp/mh-e/mh-letter.el	Fri Aug 28 16:29:25 2009 +0000
+++ b/lisp/mh-e/mh-letter.el	Fri Aug 28 17:02:53 2009 +0000
@@ -277,7 +277,7 @@
 ;; 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
--- a/lisp/mh-e/mh-show.el	Fri Aug 28 16:29:25 2009 +0000
+++ b/lisp/mh-e/mh-show.el	Fri Aug 28 17:02:53 2009 +0000
@@ -825,7 +825,7 @@
 
 ;;; 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.
--- a/lisp/org/ChangeLog	Fri Aug 28 16:29:25 2009 +0000
+++ b/lisp/org/ChangeLog	Fri Aug 28 17:02:53 2009 +0000
@@ -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.
--- a/lisp/org/org-docbook.el	Fri Aug 28 16:29:25 2009 +0000
+++ b/lisp/org/org-docbook.el	Fri Aug 28 17:02:53 2009 +0000
@@ -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 @@
 
       (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
--- a/lisp/org/org-html.el	Fri Aug 28 16:29:25 2009 +0000
+++ b/lisp/org/org-html.el	Fri Aug 28 17:02:53 2009 +0000
@@ -1419,7 +1419,7 @@
 
       (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))
--- a/lisp/progmodes/verilog-mode.el	Fri Aug 28 16:29:25 2009 +0000
+++ b/lisp/progmodes/verilog-mode.el	Fri Aug 28 17:02:53 2009 +0000
@@ -4136,18 +4136,18 @@
 (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
--- a/lisp/ses.el	Fri Aug 28 16:29:25 2009 +0000
+++ b/lisp/ses.el	Fri Aug 28 17:02:53 2009 +0000
@@ -3011,7 +3011,7 @@
     (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)
 
--- a/lisp/textmodes/reftex.el	Fri Aug 28 16:29:25 2009 +0000
+++ b/lisp/textmodes/reftex.el	Fri Aug 28 17:02:53 2009 +0000
@@ -2063,11 +2063,11 @@
              ;;       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?