]> git.eshelyaron.com Git - emacs.git/commitdiff
(generic-find-file-regexp): Doc fix.
authorEli Zaretskii <eliz@gnu.org>
Fri, 16 Feb 2001 14:36:39 +0000 (14:36 +0000)
committerEli Zaretskii <eliz@gnu.org>
Fri, 16 Feb 2001 14:36:39 +0000 (14:36 +0000)
(generic-ignore-files-regexp): New defcustom.
(generic-mode-find-file-hook): If the file's name matches the
regexp in `generic-ignore-files-regexp', don't enter
default-generic-mode.  Doc fix.

lisp/ChangeLog
lisp/generic.el

index bd49da114c986038a9b211dd5bfe7ea319f95be7..58407876833101d16772ee87db7f29f96a71fca6 100644 (file)
@@ -1,3 +1,11 @@
+2001-02-16  Eli Zaretskii  <eliz@is.elta.co.il>
+
+       * generic.el (generic-find-file-regexp): Doc fix.
+       (generic-ignore-files-regexp): New defcustom.
+       (generic-mode-find-file-hook): If the file's name matches the
+       regexp in `generic-ignore-files-regexp', don't enter
+       default-generic-mode.  Doc fix.
+
 2001-02-16  Gerd Moellmann  <gerd@gnu.org>
 
        * textmodes/flyspell.el (flyspell-region, flyspell-buffer): 
index 497a90956de9fd1fd27f62d3d1d1cf54162ac9bf..97eb131346e1c89db2043eafc50e2df0496ad6a4 100644 (file)
@@ -160,12 +160,24 @@ This variable should be set to a small positive number."
 
 (defcustom generic-find-file-regexp "^#"
   "*Regular expression used by `generic-mode-find-file-hook'.
-Used to determine if files in fundamental mode should be put into
-`default-generic-mode' instead."
+Files in fundamental mode whose first few lines contain a match for
+this regexp, should be put into `default-generic-mode' instead.
+The number of lines tested for the matches is specified by the value
+of the variable `generic-lines-to-scan', which see."
   :group 'generic
   :type  'regexp
   )
 
+(defcustom generic-ignore-files-regexp "[Tt][Aa][Gg][Ss]\\'"
+  "*Regular expression used by `generic-mode-find-file-hook'.
+Files whose names match this regular expression should not be put
+into `default-generic-mode', even if they have lines which match the
+regexp in `generic-find-file-regexp'.  If the value is nil,
+`generic-mode-find-file-hook' does not check the file names."
+  :group 'generic
+  :type  '(choice (const :tag "Don't check file names" nil) regexp)
+  )
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Functions
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -358,10 +370,17 @@ Some generic modes are defined in `generic-x.el'."
 (defun generic-mode-find-file-hook ()
   "Hook function to enter `default-generic-mode' automatically.
 Done if the first few lines of a file in `fundamental-mode' start with
-a hash comment character.  This hook will be installed if the variable
+a match for the regexp in `generic-find-file-regexp', unless the
+file's name matches the regexp which is the value of the variable
+`generic-ignore-files-regexp'.
+This hook will be installed if the variable
 `generic-use-find-file-hook' is non-nil.  The variable
 `generic-lines-to-scan' determines the number of lines to look at."
-  (when (eq major-mode 'fundamental-mode)
+  (when (and (eq major-mode 'fundamental-mode)
+            (or (null generic-ignore-files-regexp)
+                (not (string-match
+                      generic-ignore-files-regexp
+                      (file-name-sans-versions buffer-file-name)))))
     (save-excursion
       (goto-char (point-min))
       (when (re-search-forward generic-find-file-regexp