summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>2007-05-11 04:44:30 +0000
committerMiles Bader <miles@gnu.org>2007-05-11 04:44:30 +0000
commit68380acf41d91014634d625e5f529cd3f773fbd4 (patch)
tree8285c9f7ccc674484bb1d945192c5e2441ac81d6
parente2e7506851231cb87c2e025dc8ba06ad95053de9 (diff)
parenta484846f80a3adae6f85b6fb897a6ae9887b32fb (diff)
Merge from emacs--rel--22
Patches applied: * emacs--rel--22 (patch 13) - Update from CVS 2007-05-10 Richard M. Stallman <rms@gnu.org> * lisp/international/iso-cvt.el (iso-cvt-read-only): Ignore arguments. (iso-cvt-write-only): Likewise. * lisp/emacs-lisp/easy-mmode.el (define-minor-mode): Fix generated doc string. * lisp/startup.el (fancy-splash-text): Add URL of guided tour. Adjust horizontal and vertical whitespace. * lisp/progmodes/compile.el (compilation-handle-exit): Use run-hook-with-args to run compilation-finish-functions. * lisp/files.el (file-start-mode-alist): New variable. (magic-mode-regexp-match-limit): Doc fix. (set-auto-mode): Handle file-start-mode-alist. A little cleanup of structure. 2007-05-10 Richard M. Stallman <rms@gnu.org> * lispref/keymaps.texi (Scanning Keymaps): Update where-is-internal example. * lispref/help.texi (Keys in Documentation): Add reference to Documentation Tips. * lispref/files.texi (Format Conversion): TO-FN gets three arguments. * lispref/modes.texi (Auto Major Mode): Document file-start-mode-alist. Revision: emacs@sv.gnu.org/emacs--devo--0--patch-743
-rw-r--r--admin/FOR-RELEASE4
-rw-r--r--etc/NEWS4
-rw-r--r--lisp/ChangeLog19
-rw-r--r--lisp/emacs-lisp/easy-mmode.el2
-rw-r--r--lisp/files.el105
-rw-r--r--lisp/international/iso-cvt.el4
-rw-r--r--lisp/progmodes/compile.el5
-rw-r--r--lisp/startup.el20
-rw-r--r--lispref/ChangeLog11
-rw-r--r--lispref/files.texi7
-rw-r--r--lispref/help.texi4
-rw-r--r--lispref/keymaps.texi3
-rw-r--r--lispref/modes.texi5
13 files changed, 132 insertions, 61 deletions
diff --git a/admin/FOR-RELEASE b/admin/FOR-RELEASE
index 8a871c86c6..7f73b904a6 100644
--- a/admin/FOR-RELEASE
+++ b/admin/FOR-RELEASE
@@ -56,7 +56,9 @@ http://lists.gnu.org/archive/html/emacs-devel/2007-04/msg01113.html
** Takaaki.Ota@am.sony.com, May 2: table cell menu does not appear at the menubar
Bug is intermittent.
-** david.reitter@gmail.com, May 4: Euro sign bound, Pound sign not bound. (Bug?)
+** Install python.el `with' patch from trunk.
+
+** Install vc-hooks.el patch from trunk.
* DOCUMENTATION
diff --git a/etc/NEWS b/etc/NEWS
index 3c73ec6ee5..87c42c0106 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -5013,6 +5013,10 @@ of multiline constructs so that such constructs get properly recognized.
*** New variable `magic-mode-alist' determines major mode for a file by
looking at the file contents. It takes precedence over `auto-mode-alist'.
+*** New variable `file-start-mode-alist' determines major mode for a file by
+looking at the file contents. It is handled after `auto-mode-alist',
+only if `auto-mode-alist' says nothing about the file.
+
*** XML or SGML major mode is selected when file starts with an `<?xml'
or `<!DOCTYPE' declaration.
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index e453a3984a..5129fa474c 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,22 @@
+2007-05-10 Richard Stallman <rms@gnu.org>
+
+ * international/iso-cvt.el (iso-cvt-read-only): Ignore arguments.
+ (iso-cvt-write-only): Likewise.
+
+ * emacs-lisp/easy-mmode.el (define-minor-mode):
+ Fix generated doc string.
+
+ * startup.el (fancy-splash-text): Add URL of guided tour.
+ Adjust horizontal and vertical whitespace.
+
+ * progmodes/compile.el (compilation-handle-exit):
+ Use run-hook-with-args to run compilation-finish-functions.
+
+ * files.el (file-start-mode-alist): New variable.
+ (magic-mode-regexp-match-limit): Doc fix.
+ (set-auto-mode): Handle file-start-mode-alist.
+ A little cleanup of structure.
+
2007-05-10 Micha,Ak(Bl Cadilhac <michael@cadilhac.name>
* man.el (Man-next-section): Don't consider the last line of the page
diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el
index 2ce4ca8cf3..19ed39a2b4 100644
--- a/lisp/emacs-lisp/easy-mmode.el
+++ b/lisp/emacs-lisp/easy-mmode.el
@@ -197,7 +197,7 @@ Use the command `%s' to change this variable." pretty-name mode))
(let ((base-doc-string
(concat "Non-nil if %s is enabled.
-See the command `%s' for a description of this minor-mode."
+See the command `%s' for a description of this minor mode."
(if body "
Setting this variable directly does not take effect;
either customize it (see the info node `Easy Customization')
diff --git a/lisp/files.el b/lisp/files.el
index 1b6a94766d..85478ac40a 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -2151,8 +2151,21 @@ If FUNCTION is nil, then it is not called. (That is a way of saying
\"allow `auto-mode-alist' to decide for these files.\")")
(put 'magic-mode-alist 'risky-local-variable t)
+(defvar file-start-mode-alist
+ nil
+ "Like `magic-mode-alist' but has lower priority than `auto-mode-alist'.
+Each element looks like (REGEXP . FUNCTION) or (MATCH-FUNCTION . FUNCTION).
+After visiting a file, if REGEXP matches the text at the beginning of the
+buffer, or calling MATCH-FUNCTION returns non-nil, `normal-mode' will
+call FUNCTION, provided that `magic-mode-alist' and `auto-mode-alist'
+have not specified a mode for this file.
+
+If FUNCTION is nil, then it is not called.")
+(put 'file-start-mode-alist 'risky-local-variable t)
+
(defvar magic-mode-regexp-match-limit 4000
- "Upper limit on `magic-mode-alist' regexp matches.")
+ "Upper limit on `magic-mode-alist' regexp matches.
+Also applies to `file-start-mode-alist'.")
(defun set-auto-mode (&optional keep-mode-if-same)
"Select major mode appropriate for current buffer.
@@ -2207,10 +2220,10 @@ only set the major mode, if that would change it."
(or (set-auto-mode-0 mode keep-mode-if-same)
;; continuing would call minor modes again, toggling them off
(throw 'nop nil))))))
+ ;; If we didn't, look for an interpreter specified in the first line.
+ ;; As a special case, allow for things like "#!/bin/env perl", which
+ ;; finds the interpreter anywhere in $PATH.
(unless done
- ;; If we didn't, look for an interpreter specified in the first line.
- ;; As a special case, allow for things like "#!/bin/env perl", which
- ;; finds the interpreter anywhere in $PATH.
(setq mode (save-excursion
(goto-char (point-min))
(if (looking-at auto-mode-interpreter-regexp)
@@ -2223,7 +2236,7 @@ only set the major mode, if that would change it."
;; If we found an interpreter mode to use, invoke it now.
(if done
(set-auto-mode-0 (cdr done) keep-mode-if-same)))
- ;; If we didn't, match the buffer beginning against magic-mode-alist.
+ ;; Next try matching the buffer beginning against magic-mode-alist.
(unless done
(if (setq done (save-excursion
(goto-char (point-min))
@@ -2236,39 +2249,55 @@ only set the major mode, if that would change it."
(if (functionp re)
(funcall re)
(looking-at re)))))))
- (set-auto-mode-0 done keep-mode-if-same)
- ;; Compare the filename against the entries in auto-mode-alist.
- (if buffer-file-name
- (let ((name buffer-file-name))
- ;; Remove backup-suffixes from file name.
- (setq name (file-name-sans-versions name))
- (while name
- ;; Find first matching alist entry.
- (setq mode
- (if (memq system-type '(vax-vms windows-nt cygwin))
- ;; System is case-insensitive.
- (let ((case-fold-search t))
- (assoc-default name auto-mode-alist
- 'string-match))
- ;; System is case-sensitive.
- (or
- ;; First match case-sensitively.
- (let ((case-fold-search nil))
- (assoc-default name auto-mode-alist
- 'string-match))
- ;; Fallback to case-insensitive match.
- (and auto-mode-case-fold
- (let ((case-fold-search t))
- (assoc-default name auto-mode-alist
- 'string-match))))))
- (if (and mode
- (consp mode)
- (cadr mode))
- (setq mode (car mode)
- name (substring name 0 (match-beginning 0)))
- (setq name))
- (when mode
- (set-auto-mode-0 mode keep-mode-if-same)))))))))
+ (set-auto-mode-0 done keep-mode-if-same)))
+ ;; Next compare the filename against the entries in auto-mode-alist.
+ (unless done
+ (if buffer-file-name
+ (let ((name buffer-file-name))
+ ;; Remove backup-suffixes from file name.
+ (setq name (file-name-sans-versions name))
+ (while name
+ ;; Find first matching alist entry.
+ (setq mode
+ (if (memq system-type '(vax-vms windows-nt cygwin))
+ ;; System is case-insensitive.
+ (let ((case-fold-search t))
+ (assoc-default name auto-mode-alist
+ 'string-match))
+ ;; System is case-sensitive.
+ (or
+ ;; First match case-sensitively.
+ (let ((case-fold-search nil))
+ (assoc-default name auto-mode-alist
+ 'string-match))
+ ;; Fallback to case-insensitive match.
+ (and auto-mode-case-fold
+ (let ((case-fold-search t))
+ (assoc-default name auto-mode-alist
+ 'string-match))))))
+ (if (and mode
+ (consp mode)
+ (cadr mode))
+ (setq mode (car mode)
+ name (substring name 0 (match-beginning 0)))
+ (setq name))
+ (when mode
+ (set-auto-mode-0 mode keep-mode-if-same)
+ (setq done t))))))
+ ;; Next try matching the buffer beginning against file-start-mode-alist.
+ (unless done
+ (if (setq done (save-excursion
+ (goto-char (point-min))
+ (save-restriction
+ (narrow-to-region (point-min)
+ (min (point-max)
+ (+ (point-min) magic-mode-regexp-match-limit)))
+ (assoc-default nil file-start-mode-alist
+ (lambda (re dummy)
+ (if (functionp re)
+ (funcall re)
+ (looking-at re)))))))
+ (set-auto-mode-0 done keep-mode-if-same)))))
;; When `keep-mode-if-same' is set, we are working on behalf of
;; set-visited-file-name. In that case, if the major mode specified is the
diff --git a/lisp/international/iso-cvt.el b/lisp/international/iso-cvt.el
index eb94794145..3448da812a 100644
--- a/lisp/international/iso-cvt.el
+++ b/lisp/international/iso-cvt.el
@@ -823,13 +823,13 @@ Optional arg BUFFER is ignored (for use in `format-alist')."
(iso-translate-conventions from to iso-sgml2iso-trans-tab))
;;;###autoload
-(defun iso-cvt-read-only ()
+(defun iso-cvt-read-only (&rest ignore)
"Warn that format is read-only."
(interactive)
(error "This format is read-only; specify another format for writing"))
;;;###autoload
-(defun iso-cvt-write-only ()
+(defun iso-cvt-write-only (&rest ignore)
"Warn that format is write-only."
(interactive)
(error "This format is write-only"))
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index 9266315d98..1613fd8f97 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -1448,10 +1448,7 @@ Turning the mode on runs the normal hook `compilation-minor-mode-hook'."
(with-no-warnings
(if compilation-finish-function
(funcall compilation-finish-function (current-buffer) msg)))
- (let ((functions compilation-finish-functions))
- (while functions
- (funcall (car functions) (current-buffer) msg)
- (setq functions (cdr functions))))))
+ (run-hook-with-args compilation-finish-functions (current-buffer) msg)))
;; Called when compilation process changes state.
(defun compilation-sentinel (proc msg)
diff --git a/lisp/startup.el b/lisp/startup.el
index 84dc4dca8d..f57bf66a3a 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -1149,21 +1149,25 @@ regardless of the value of this variable."
"\n")))
:face variable-pitch "\
Emacs FAQ\t\tFrequently asked questions and answers
-View Emacs Manual\tView the Emacs manual using Info
+View Emacs Manual\t\tView the Emacs manual using Info
Absence of Warranty\tGNU Emacs comes with "
:face (variable-pitch :slant oblique)
"ABSOLUTELY NO WARRANTY\n"
:face variable-pitch
"\
-Copying Conditions\tConditions for redistributing and changing Emacs
+Copying Conditions\t\tConditions for redistributing and changing Emacs
Getting New Versions\tHow to obtain the latest version of Emacs
More Manuals / Ordering Manuals Buying printed manuals from the FSF\n")
(:face variable-pitch
- "To quit a partially entered command, type "
+ "\nTo quit a partially entered command, type "
:face default
"Control-g"
:face variable-pitch
- ".\n"
+ ".
+
+Emacs Guided Tour\t\tSee http://www.gnu.org/software/emacs/tour/
+
+"
:face (variable-pitch :weight bold)
"Useful File menu items:\n"
:face variable-pitch
@@ -1176,13 +1180,7 @@ More Manuals / Ordering Manuals Buying printed manuals from the FSF\n")
"Control-c"
:face variable-pitch
")
-Recover Crashed Session\tRecover files you were editing before a crash
-
-
-
-
-
-"
+Recover Crashed Session\tRecover files you were editing before a crash\n"
))
"A list of texts to show in the middle part of splash screens.
Each element in the list should be a list of strings or pairs
diff --git a/lispref/ChangeLog b/lispref/ChangeLog
index 5d340be781..cb82432328 100644
--- a/lispref/ChangeLog
+++ b/lispref/ChangeLog
@@ -1,3 +1,14 @@
+2007-05-10 Richard Stallman <rms@gnu.org>
+
+ * keymaps.texi (Scanning Keymaps): Update where-is-internal example.
+
+ * help.texi (Keys in Documentation): Add reference to
+ Documentation Tips.
+
+ * files.texi (Format Conversion): TO-FN gets three arguments.
+
+ * modes.texi (Auto Major Mode): Document file-start-mode-alist.
+
2007-05-10 Thien-Thi Nguyen <ttn@gnuvola.org>
* elisp.texi (Top): Remove "Saving Properties" from detailed menu.
diff --git a/lispref/files.texi b/lispref/files.texi
index 1df6aead19..19bacb142e 100644
--- a/lispref/files.texi
+++ b/lispref/files.texi
@@ -2903,9 +2903,10 @@ convert the usual Emacs data representation into this format.
If @var{to-fn} is a string, it is a shell command; Emacs runs the
command as a filter to perform the conversion.
-If @var{to-fn} is a function, it is called with two arguments, @var{begin}
-and @var{end}, which specify the part of the buffer it should convert.
-There are two ways it can do the conversion:
+If @var{to-fn} is a function, it is called with three arguments:
+@var{begin} and @var{end}, which specify the part of the buffer it
+should convert, and @var{buffer}, which specifies which buffer. There
+are two ways it can do the conversion:
@itemize @bullet
@item
diff --git a/lispref/help.texi b/lispref/help.texi
index 70c7a48c9c..dd56aa872b 100644
--- a/lispref/help.texi
+++ b/lispref/help.texi
@@ -384,6 +384,10 @@ C-g abort-recursive-edit
@end group
@end smallexample
+ There are other special conventions for the text in documentation
+strings---for instance, you can refer to functions, variables, and
+sections of this manual. @xref{Documentation Tips}, for details.
+
@node Describing Characters
@section Describing Characters for Help Messages
@cindex describe characters and events
diff --git a/lispref/keymaps.texi b/lispref/keymaps.texi
index 88b312d227..400a2c3824 100644
--- a/lispref/keymaps.texi
+++ b/lispref/keymaps.texi
@@ -1895,7 +1895,8 @@ other command. However, if @var{no-remap} is non-@code{nil}.
@smallexample
@group
(where-is-internal 'describe-function)
- @result{} ("\^hf" "\^hd")
+ @result{} ([8 102] [f1 102] [help 102]
+ [menu-bar help-menu describe describe-function])
@end group
@end smallexample
@end defun
diff --git a/lispref/modes.texi b/lispref/modes.texi
index 5d91b238fc..56fb43a0c3 100644
--- a/lispref/modes.texi
+++ b/lispref/modes.texi
@@ -616,6 +616,11 @@ the text at the beginning of the buffer matches @var{regexp} and
@code{auto-mode-alist} gets to decide the mode.
@end defvar
+@defvar file-start-mode-alist
+This works like @code{magic-mode-alist}, except that it is handled
+only if @code{auto-mode-alist} does not specify a mode for this file.
+@end defvar
+
@defvar auto-mode-alist
This variable contains an association list of file name patterns
(regular expressions) and corresponding major mode commands. Usually,