aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2001-02-16 14:36:39 +0000
committerEli Zaretskii2001-02-16 14:36:39 +0000
commitfb339cd5b61c23d14bd17098331850af11efdefb (patch)
tree2f38ce797c780350fffb45ecb2626e501ffd3f25
parentc3ddcbc8cecede3f4707a1423c9f5d5d94bb3497 (diff)
downloademacs-fb339cd5b61c23d14bd17098331850af11efdefb.tar.gz
emacs-fb339cd5b61c23d14bd17098331850af11efdefb.zip
(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.
-rw-r--r--lisp/ChangeLog8
-rw-r--r--lisp/generic.el27
2 files changed, 31 insertions, 4 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index bd49da114c9..58407876833 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,11 @@
12001-02-16 Eli Zaretskii <eliz@is.elta.co.il>
2
3 * generic.el (generic-find-file-regexp): Doc fix.
4 (generic-ignore-files-regexp): New defcustom.
5 (generic-mode-find-file-hook): If the file's name matches the
6 regexp in `generic-ignore-files-regexp', don't enter
7 default-generic-mode. Doc fix.
8
12001-02-16 Gerd Moellmann <gerd@gnu.org> 92001-02-16 Gerd Moellmann <gerd@gnu.org>
2 10
3 * textmodes/flyspell.el (flyspell-region, flyspell-buffer): 11 * textmodes/flyspell.el (flyspell-region, flyspell-buffer):
diff --git a/lisp/generic.el b/lisp/generic.el
index 497a90956de..97eb131346e 100644
--- a/lisp/generic.el
+++ b/lisp/generic.el
@@ -160,12 +160,24 @@ This variable should be set to a small positive number."
160 160
161(defcustom generic-find-file-regexp "^#" 161(defcustom generic-find-file-regexp "^#"
162 "*Regular expression used by `generic-mode-find-file-hook'. 162 "*Regular expression used by `generic-mode-find-file-hook'.
163Used to determine if files in fundamental mode should be put into 163Files in fundamental mode whose first few lines contain a match for
164`default-generic-mode' instead." 164this regexp, should be put into `default-generic-mode' instead.
165The number of lines tested for the matches is specified by the value
166of the variable `generic-lines-to-scan', which see."
165 :group 'generic 167 :group 'generic
166 :type 'regexp 168 :type 'regexp
167 ) 169 )
168 170
171(defcustom generic-ignore-files-regexp "[Tt][Aa][Gg][Ss]\\'"
172 "*Regular expression used by `generic-mode-find-file-hook'.
173Files whose names match this regular expression should not be put
174into `default-generic-mode', even if they have lines which match the
175regexp in `generic-find-file-regexp'. If the value is nil,
176`generic-mode-find-file-hook' does not check the file names."
177 :group 'generic
178 :type '(choice (const :tag "Don't check file names" nil) regexp)
179 )
180
169;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 181;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
170;; Functions 182;; Functions
171;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 183;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -358,10 +370,17 @@ Some generic modes are defined in `generic-x.el'."
358(defun generic-mode-find-file-hook () 370(defun generic-mode-find-file-hook ()
359 "Hook function to enter `default-generic-mode' automatically. 371 "Hook function to enter `default-generic-mode' automatically.
360Done if the first few lines of a file in `fundamental-mode' start with 372Done if the first few lines of a file in `fundamental-mode' start with
361a hash comment character. This hook will be installed if the variable 373a match for the regexp in `generic-find-file-regexp', unless the
374file's name matches the regexp which is the value of the variable
375`generic-ignore-files-regexp'.
376This hook will be installed if the variable
362`generic-use-find-file-hook' is non-nil. The variable 377`generic-use-find-file-hook' is non-nil. The variable
363`generic-lines-to-scan' determines the number of lines to look at." 378`generic-lines-to-scan' determines the number of lines to look at."
364 (when (eq major-mode 'fundamental-mode) 379 (when (and (eq major-mode 'fundamental-mode)
380 (or (null generic-ignore-files-regexp)
381 (not (string-match
382 generic-ignore-files-regexp
383 (file-name-sans-versions buffer-file-name)))))
365 (save-excursion 384 (save-excursion
366 (goto-char (point-min)) 385 (goto-char (point-min))
367 (when (re-search-forward generic-find-file-regexp 386 (when (re-search-forward generic-find-file-regexp