summaryrefslogtreecommitdiff
path: root/lisp/generic-x.el
diff options
context:
space:
mode:
authorLute Kamstra <lute@gnu.org>2005-04-13 09:24:57 +0000
committerLute Kamstra <lute@gnu.org>2005-04-13 09:24:57 +0000
commita2d66c78bb183476b4976e879857b011e155a2c1 (patch)
tree63a337c71d233201ebad7b91f5d7bdd2ab60e987 /lisp/generic-x.el
parent59d922a4da1890ff5e773b1c0e0a8d3f310a4bdf (diff)
downloademacs-a2d66c78bb183476b4976e879857b011e155a2c1.tar.gz
(generic-mode-ini-file-find-file-hook):
Rename to ini-generic-mode-find-file-hook. Keep generic-mode-ini-file-find-file-hook as an alias. (ini-generic-mode-find-file-hook): Rename from generic-mode-ini-file-find-file-hook. Fix docstring. (ini-generic-mode): Docstring change. (bat-generic-mode-run-as-comint): Silence the byte compiler.
Diffstat (limited to 'lisp/generic-x.el')
-rw-r--r--lisp/generic-x.el28
1 files changed, 16 insertions, 12 deletions
diff --git a/lisp/generic-x.el b/lisp/generic-x.el
index f700ff6041d..a13103edb3d 100644
--- a/lisp/generic-x.el
+++ b/lisp/generic-x.el
@@ -178,16 +178,6 @@ This hook will be installed if the variable
(goto-char (point-min))
(default-generic-mode)))))
-(defun generic-mode-ini-file-find-file-hook ()
- "Hook function to enter Default-Generic mode automatically for INI files.
-Done if the first few lines of a file in Fundamental mode look like an
-INI file. This hook is NOT installed by default."
- (and (eq major-mode 'fundamental-mode)
- (save-excursion
- (goto-char (point-min))
- (and (looking-at "^\\s-*\\[.*\\]")
- (ini-generic-mode)))))
-
(and generic-use-find-file-hook
(add-hook 'find-file-hook 'generic-mode-find-file-hook))
@@ -375,8 +365,21 @@ generic-x to enable the specified modes."
(setq imenu-generic-expression
'((nil "^\\[\\(.*\\)\\]" 1)
("*Variables*" "^\\s-*\\([^=]+\\)\\s-*=" 1))))))
- "Generic mode for MS-Windows INI files."
- :group 'generic-x))
+ "Generic mode for MS-Windows INI files.
+You can use `ini-generic-mode-find-file-hook' to enter this mode
+automatically for INI files whose names do not end in \".ini\"."
+ :group 'generic-x)
+
+(defun ini-generic-mode-find-file-hook ()
+ "Hook function to enter Ini-Generic mode automatically for INI files.
+Done if the first few lines of a file in Fundamental mode look
+like an INI file. You can add this hook to `find-file-hook'."
+ (and (eq major-mode 'fundamental-mode)
+ (save-excursion
+ (goto-char (point-min))
+ (and (looking-at "^\\s-*\\[.*\\]")
+ (ini-generic-mode)))))
+(defalias 'generic-mode-ini-file-find-file-hook 'ini-generic-mode-find-file-hook))
;;; Windows REG files
;;; Unfortunately, Windows 95 and Windows NT have different REG file syntax!
@@ -487,6 +490,7 @@ generic-x to enable the specified modes."
(compile
(concat (w32-shell-name) " -c " (buffer-file-name)))))
+(eval-when-compile (require 'comint))
(defun bat-generic-mode-run-as-comint ()
"Run the current BAT file in a comint buffer."
(interactive)