changeset 80895:776cb0a1bb24

Merge from emacs--rel--22 Patches applied: * emacs--rel--22 (patch 13) - Update from CVS 2007-05-10 Richard 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 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
author Miles Bader <miles@gnu.org>
date Fri, 11 May 2007 04:44:30 +0000
parents 47f2f1844e89 (current diff) 1b827e0f56e3 (diff)
children b28700641d1c 41aaac7180d5 ddc474387d53
files admin/FOR-RELEASE etc/NEWS lisp/ChangeLog lisp/progmodes/compile.el lispref/ChangeLog lispref/files.texi
diffstat 13 files changed, 132 insertions(+), 61 deletions(-) [+]
line wrap: on
line diff
--- a/admin/FOR-RELEASE	Thu May 10 14:46:52 2007 +0000
+++ b/admin/FOR-RELEASE	Fri May 11 04:44:30 2007 +0000
@@ -56,7 +56,9 @@
 ** 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
 
--- a/etc/NEWS	Thu May 10 14:46:52 2007 +0000
+++ b/etc/NEWS	Fri May 11 04:44:30 2007 +0000
@@ -5013,6 +5013,10 @@
 *** 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.
 
--- a/lisp/ChangeLog	Thu May 10 14:46:52 2007 +0000
+++ b/lisp/ChangeLog	Fri May 11 04:44:30 2007 +0000
@@ -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
--- a/lisp/emacs-lisp/easy-mmode.el	Thu May 10 14:46:52 2007 +0000
+++ b/lisp/emacs-lisp/easy-mmode.el	Fri May 11 04:44:30 2007 +0000
@@ -197,7 +197,7 @@
 
 	  (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')
--- a/lisp/files.el	Thu May 10 14:46:52 2007 +0000
+++ b/lisp/files.el	Fri May 11 04:44:30 2007 +0000
@@ -2151,8 +2151,21 @@
 \"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 @@
 	      (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 @@
       ;; 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 @@
 					  (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
--- a/lisp/international/iso-cvt.el	Thu May 10 14:46:52 2007 +0000
+++ b/lisp/international/iso-cvt.el	Fri May 11 04:44:30 2007 +0000
@@ -823,13 +823,13 @@
  (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"))
--- a/lisp/progmodes/compile.el	Thu May 10 14:46:52 2007 +0000
+++ b/lisp/progmodes/compile.el	Fri May 11 04:44:30 2007 +0000
@@ -1448,10 +1448,7 @@
     (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)
--- a/lisp/startup.el	Thu May 10 14:46:52 2007 +0000
+++ b/lisp/startup.el	Fri May 11 04:44:30 2007 +0000
@@ -1149,21 +1149,25 @@
                 "\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 @@
 	 "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
--- a/lispref/ChangeLog	Thu May 10 14:46:52 2007 +0000
+++ b/lispref/ChangeLog	Fri May 11 04:44:30 2007 +0000
@@ -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.
--- a/lispref/files.texi	Thu May 10 14:46:52 2007 +0000
+++ b/lispref/files.texi	Fri May 11 04:44:30 2007 +0000
@@ -2903,9 +2903,10 @@
 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
--- a/lispref/help.texi	Thu May 10 14:46:52 2007 +0000
+++ b/lispref/help.texi	Fri May 11 04:44:30 2007 +0000
@@ -384,6 +384,10 @@
 @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
--- a/lispref/keymaps.texi	Thu May 10 14:46:52 2007 +0000
+++ b/lispref/keymaps.texi	Fri May 11 04:44:30 2007 +0000
@@ -1895,7 +1895,8 @@
 @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
--- a/lispref/modes.texi	Thu May 10 14:46:52 2007 +0000
+++ b/lispref/modes.texi	Fri May 11 04:44:30 2007 +0000
@@ -616,6 +616,11 @@
 @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,