summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2009-08-28 17:02:53 +0000
committerStefan Monnier <monnier@iro.umontreal.ca>2009-08-28 17:02:53 +0000
commit20e9c4bb9cee699f1e286874d959c030dfd036ad (patch)
treea312a7983c12f7f87cc6c098d54760062423f4dc /lisp
parent6b30df44ef302e80371c6002372ac13faf86f720 (diff)
downloademacs-20e9c4bb9cee699f1e286874d959c030dfd036ad.tar.gz
* 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.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog13
-rw-r--r--lisp/arc-mode.el2
-rw-r--r--lisp/autoinsert.el2
-rw-r--r--lisp/ehelp.el9
-rw-r--r--lisp/emacs-lisp/bytecomp.el13
-rw-r--r--lisp/emacs-lisp/re-builder.el2
-rw-r--r--lisp/emulation/viper.el11
-rw-r--r--lisp/files.el2
-rw-r--r--lisp/gnus/ChangeLog6
-rw-r--r--lisp/gnus/mm-util.el36
-rw-r--r--lisp/gnus/nnheader.el24
-rw-r--r--lisp/hexl.el5
-rw-r--r--lisp/mh-e/mh-folder.el2
-rw-r--r--lisp/mh-e/mh-letter.el2
-rw-r--r--lisp/mh-e/mh-show.el2
-rw-r--r--lisp/org/ChangeLog6
-rw-r--r--lisp/org/org-docbook.el4
-rw-r--r--lisp/org/org-html.el2
-rw-r--r--lisp/progmodes/verilog-mode.el6
-rw-r--r--lisp/ses.el2
-rw-r--r--lisp/textmodes/reftex.el10
21 files changed, 94 insertions, 67 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index fb1dde90099..522852fdf5f 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -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):
diff --git a/lisp/arc-mode.el b/lisp/arc-mode.el
index e812a47ddc6..6e65d64bb81 100644
--- a/lisp/arc-mode.el
+++ b/lisp/arc-mode.el
@@ -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))))
diff --git a/lisp/autoinsert.el b/lisp/autoinsert.el
index 17a9e4258a2..0fbc3d66c79 100644
--- a/lisp/autoinsert.el
+++ b/lisp/autoinsert.el
@@ -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)
diff --git a/lisp/ehelp.el b/lisp/ehelp.el
index d8e7ea57deb..8f1eeefa95a 100644
--- a/lisp/ehelp.el
+++ b/lisp/ehelp.el
@@ -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)
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 01d1e270f36..c234fd70a43 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -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 @@ 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))
diff --git a/lisp/emacs-lisp/re-builder.el b/lisp/emacs-lisp/re-builder.el
index 97aba431c0f..ed45bd65304 100644
--- a/lisp/emacs-lisp/re-builder.el
+++ b/lisp/emacs-lisp/re-builder.el
@@ -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)
diff --git a/lisp/emulation/viper.el b/lisp/emulation/viper.el
index 1631b1aa6ba..2d65f5c4a06 100644
--- a/lisp/emulation/viper.el
+++ b/lisp/emulation/viper.el
@@ -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))
diff --git a/lisp/files.el b/lisp/files.el
index 3ff6c5c9f26..2c695c1d4bd 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -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))
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index eb191b1d7a8..cce8b6d0f8b 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -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.
diff --git a/lisp/gnus/mm-util.el b/lisp/gnus/mm-util.el
index 403d967f8e4..8866befb4f9 100644
--- a/lisp/gnus/mm-util.el
+++ b/lisp/gnus/mm-util.el
@@ -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)
diff --git a/lisp/gnus/nnheader.el b/lisp/gnus/nnheader.el
index 572f80bea9d..ce52ac96564 100644
--- a/lisp/gnus/nnheader.el
+++ b/lisp/gnus/nnheader.el
@@ -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)
diff --git a/lisp/hexl.el b/lisp/hexl.el
index d4aec1484ba..19c1b996b16 100644
--- a/lisp/hexl.el
+++ b/lisp/hexl.el
@@ -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)))
diff --git a/lisp/mh-e/mh-folder.el b/lisp/mh-e/mh-folder.el
index e43c56ba68f..52a6d787cae 100644
--- a/lisp/mh-e/mh-folder.el
+++ b/lisp/mh-e/mh-folder.el
@@ -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
diff --git a/lisp/mh-e/mh-letter.el b/lisp/mh-e/mh-letter.el
index dcb8d8588e2..051a98de89a 100644
--- a/lisp/mh-e/mh-letter.el
+++ b/lisp/mh-e/mh-letter.el
@@ -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
diff --git a/lisp/mh-e/mh-show.el b/lisp/mh-e/mh-show.el
index 97a9883d558..70852f0bb05 100644
--- a/lisp/mh-e/mh-show.el
+++ b/lisp/mh-e/mh-show.el
@@ -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.
diff --git a/lisp/org/ChangeLog b/lisp/org/ChangeLog
index 82010dc1493..f5efef377cf 100644
--- a/lisp/org/ChangeLog
+++ b/lisp/org/ChangeLog
@@ -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.
diff --git a/lisp/org/org-docbook.el b/lisp/org/org-docbook.el
index 8d47b552e5d..38af0803434 100644
--- a/lisp/org/org-docbook.el
+++ b/lisp/org/org-docbook.el
@@ -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
diff --git a/lisp/org/org-html.el b/lisp/org/org-html.el
index 35eb45ab179..3170f3ae07c 100644
--- a/lisp/org/org-html.el
+++ b/lisp/org/org-html.el
@@ -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))
diff --git a/lisp/progmodes/verilog-mode.el b/lisp/progmodes/verilog-mode.el
index 4c5a21f4b2a..57a51fd2187 100644
--- a/lisp/progmodes/verilog-mode.el
+++ b/lisp/progmodes/verilog-mode.el
@@ -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
diff --git a/lisp/ses.el b/lisp/ses.el
index 95685e7d7e3..86239022ed6 100644
--- a/lisp/ses.el
+++ b/lisp/ses.el
@@ -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)
diff --git a/lisp/textmodes/reftex.el b/lisp/textmodes/reftex.el
index 23cf167dc93..d905ce66905 100644
--- a/lisp/textmodes/reftex.el
+++ b/lisp/textmodes/reftex.el
@@ -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?