comparison lisp/generic-x.el @ 61523:0428c421c463

(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.
author Lute Kamstra <lute@gnu.org>
date Wed, 13 Apr 2005 09:21:49 +0000
parents e51a703b6762
children c8781ffa45cb 146c086df160
comparison
equal deleted inserted replaced
61522:a5836c00c2ae 61523:0428c421c463
176 (forward-line generic-lines-to-scan) 176 (forward-line generic-lines-to-scan)
177 (point)) t) 177 (point)) t)
178 (goto-char (point-min)) 178 (goto-char (point-min))
179 (default-generic-mode))))) 179 (default-generic-mode)))))
180 180
181 (defun generic-mode-ini-file-find-file-hook ()
182 "Hook function to enter Default-Generic mode automatically for INI files.
183 Done if the first few lines of a file in Fundamental mode look like an
184 INI file. This hook is NOT installed by default."
185 (and (eq major-mode 'fundamental-mode)
186 (save-excursion
187 (goto-char (point-min))
188 (and (looking-at "^\\s-*\\[.*\\]")
189 (ini-generic-mode)))))
190
191 (and generic-use-find-file-hook 181 (and generic-use-find-file-hook
192 (add-hook 'find-file-hook 'generic-mode-find-file-hook)) 182 (add-hook 'find-file-hook 'generic-mode-find-file-hook))
193 183
194 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 184 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
195 ;; Other Generic modes 185 ;; Other Generic modes
373 (function 363 (function
374 (lambda () 364 (lambda ()
375 (setq imenu-generic-expression 365 (setq imenu-generic-expression
376 '((nil "^\\[\\(.*\\)\\]" 1) 366 '((nil "^\\[\\(.*\\)\\]" 1)
377 ("*Variables*" "^\\s-*\\([^=]+\\)\\s-*=" 1)))))) 367 ("*Variables*" "^\\s-*\\([^=]+\\)\\s-*=" 1))))))
378 "Generic mode for MS-Windows INI files." 368 "Generic mode for MS-Windows INI files.
379 :group 'generic-x)) 369 You can use `ini-generic-mode-find-file-hook' to enter this mode
370 automatically for INI files whose names do not end in \".ini\"."
371 :group 'generic-x)
372
373 (defun ini-generic-mode-find-file-hook ()
374 "Hook function to enter Ini-Generic mode automatically for INI files.
375 Done if the first few lines of a file in Fundamental mode look
376 like an INI file. You can add this hook to `find-file-hook'."
377 (and (eq major-mode 'fundamental-mode)
378 (save-excursion
379 (goto-char (point-min))
380 (and (looking-at "^\\s-*\\[.*\\]")
381 (ini-generic-mode)))))
382 (defalias 'generic-mode-ini-file-find-file-hook 'ini-generic-mode-find-file-hook))
380 383
381 ;;; Windows REG files 384 ;;; Windows REG files
382 ;;; Unfortunately, Windows 95 and Windows NT have different REG file syntax! 385 ;;; Unfortunately, Windows 95 and Windows NT have different REG file syntax!
383 (when (memq 'reg-generic-mode generic-extras-enable-list) 386 (when (memq 'reg-generic-mode generic-extras-enable-list)
384 387
485 (lambda(ign) 488 (lambda(ign)
486 (concat "*" (buffer-file-name) "*"))))) 489 (concat "*" (buffer-file-name) "*")))))
487 (compile 490 (compile
488 (concat (w32-shell-name) " -c " (buffer-file-name))))) 491 (concat (w32-shell-name) " -c " (buffer-file-name)))))
489 492
493 (eval-when-compile (require 'comint))
490 (defun bat-generic-mode-run-as-comint () 494 (defun bat-generic-mode-run-as-comint ()
491 "Run the current BAT file in a comint buffer." 495 "Run the current BAT file in a comint buffer."
492 (interactive) 496 (interactive)
493 (require 'comint) 497 (require 'comint)
494 (let* ((file (buffer-file-name)) 498 (let* ((file (buffer-file-name))