diff options
author | Arni Magnusson <arnima@hafro.is> | 2013-08-07 11:43:57 -0400 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2013-08-07 11:43:57 -0400 |
commit | 400a3178cb749fe9cdbad59871aa0786babd434e (patch) | |
tree | 94ae8e0a8c6dd7f72495749017d6a7e03fe253e7 /lisp/generic-x.el | |
parent | 03eb60c17ad3abb221aaa71623ce837906836d49 (diff) | |
download | emacs-400a3178cb749fe9cdbad59871aa0786babd434e.tar.gz |
* lisp/progmodes/dos.el: New file.
* lisp/generic-x.el (bat-generic-mode): Redefine as an obsolete alias to
dos-mode.
Diffstat (limited to 'lisp/generic-x.el')
-rw-r--r-- | lisp/generic-x.el | 125 |
1 files changed, 1 insertions, 124 deletions
diff --git a/lisp/generic-x.el b/lisp/generic-x.el index 1867759b549..698819d73a1 100644 --- a/lisp/generic-x.el +++ b/lisp/generic-x.el @@ -460,130 +460,7 @@ like an INI file. You can add this hook to `find-file-hook'." ;;; DOS/Windows BAT files (when (memq 'bat-generic-mode generic-extras-enable-list) - -(define-generic-mode bat-generic-mode - nil - nil - (eval-when-compile - (list - ;; Make this one first in the list, otherwise comments will - ;; be over-written by other variables - '("^[@ \t]*\\([rR][eE][mM][^\n\r]*\\)" 1 font-lock-comment-face t) - '("^[ \t]*\\(::.*\\)" 1 font-lock-comment-face t) - '("^[@ \t]*\\([bB][rR][eE][aA][kK]\\|[vV][eE][rR][iI][fF][yY]\\)[ \t]+\\([oO]\\([nN]\\|[fF][fF]\\)\\)" - (1 font-lock-builtin-face) - (2 font-lock-constant-face t t)) - ;; Any text (except ON/OFF) following ECHO is a string. - '("^[@ \t]*\\([eE][cC][hH][oO]\\)[ \t]+\\(\\([oO]\\([nN]\\|[fF][fF]\\)\\)\\|\\([^>|\r\n]+\\)\\)" - (1 font-lock-builtin-face) - (3 font-lock-constant-face t t) - (5 font-lock-string-face t t)) - ;; These keywords appear as the first word on a line. (Actually, they - ;; can also appear after "if ..." or "for ..." clause, but since they - ;; are frequently used in simple text, we punt.) - ;; In `generic-bat-mode-setup-function' we make the keywords - ;; case-insensitive - '("^[@ \t]*\\_<\\(for\\|if\\)\\_>" 1 font-lock-keyword-face) - ;; These keywords can be anywhere on a line - ;; In `generic-bat-mode-setup-function' we make the keywords - ;; case-insensitive - (list (regexp-opt '("do" "exist" "errorlevel" "goto" "not") 'symbols) - 1 font-lock-keyword-face) - ;; These are built-in commands. Only frequently-used ones are listed. - (list (concat "[ \t|\n]" - (regexp-opt '("CALL" "call" "Call" - "CD" "cd" "Cd" - "CLS" "cls" "Cls" - "COPY" "copy" "Copy" - "DEL" "del" "Del" - "ECHO" "echo" "Echo" - "MD" "md" "Md" - "PATH" "path" "Path" - "PAUSE" "pause" "Pause" - "PROMPT" "prompt" "Prompt" - "RD" "rd" "Rd" - "REN" "ren" "Ren" - "SET" "set" "Set" - "START" "start" "Start" - "SHIFT" "shift" "Shift") 'symbols)) - 1 font-lock-builtin-face) - '("^[ \t]*\\(:\\sw+\\)" 1 font-lock-function-name-face t) - '("\\(%\\sw+%\\)" 1 font-lock-variable-name-face t) - '("\\(%[0-9]\\)" 1 font-lock-variable-name-face t) - '("[\t ]+\\([+-/][^\t\n\" ]+\\)" 1 font-lock-type-face) - '("[ \t\n|]\\<\\([gG][oO][tT][oO]\\)\\>[ \t]*\\(\\sw+\\)?" - (1 font-lock-keyword-face) - (2 font-lock-function-name-face nil t)) - '("[ \t\n|]\\<\\([sS][eE][tT]\\)\\>[ \t]*\\(\\sw+\\)?[ \t]*=?" - (1 font-lock-builtin-face) - (2 font-lock-variable-name-face t t)))) - '("\\.[bB][aA][tT]\\'" - "\\.[cC][mM][dD]\\'" - "\\`[cC][oO][nN][fF][iI][gG]\\." - "\\`[aA][uU][tT][oO][eE][xX][eE][cC]\\.") - '(generic-bat-mode-setup-function) - "Generic mode for MS-Windows batch files.") - -(defvar bat-generic-mode-syntax-table nil - "Syntax table in use in `bat-generic-mode' buffers.") - -(defvar bat-generic-mode-keymap (make-sparse-keymap) - "Keymap for `bat-generic-mode'.") - -(defun bat-generic-mode-compile () - "Run the current BAT file in a compilation buffer." - (interactive) - (let ((compilation-buffer-name-function - (function - (lambda (_ign) - (concat "*" (buffer-file-name) "*"))))) - (compile - (concat (w32-shell-name) " -c " (buffer-file-name))))) - -(declare-function comint-mode "comint" ()) -(declare-function comint-exec "comint" (buffer name command startfile switches)) - -(defun bat-generic-mode-run-as-comint () - "Run the current BAT file in a comint buffer." - (interactive) - (require 'comint) - (let* ((file (buffer-file-name)) - (buf-name (concat "*" file "*"))) - (with-current-buffer (get-buffer-create buf-name) - (erase-buffer) - (comint-mode) - (comint-exec - buf-name - file - (w32-shell-name) - nil - (list "-c" file)) - (display-buffer buf-name)))) - -(define-key bat-generic-mode-keymap "\C-c\C-c" 'bat-generic-mode-compile) - -;; Make underscores count as words -(unless bat-generic-mode-syntax-table - (setq bat-generic-mode-syntax-table (make-syntax-table)) - (modify-syntax-entry ?_ "w" bat-generic-mode-syntax-table)) - -;; bat-generic-mode doesn't use the comment functionality of -;; define-generic-mode because it has a three-letter comment-string, -;; so we do it here manually instead -(defun generic-bat-mode-setup-function () - (make-local-variable 'parse-sexp-ignore-comments) - (make-local-variable 'comment-start) - (make-local-variable 'comment-start-skip) - (make-local-variable 'comment-end) - (setq imenu-generic-expression '((nil "^:\\(\\sw+\\)" 1)) - parse-sexp-ignore-comments t - comment-end "" - comment-start "REM " - comment-start-skip "[Rr][Ee][Mm] *") - (set-syntax-table bat-generic-mode-syntax-table) - ;; Make keywords case-insensitive - (setq font-lock-defaults '(generic-font-lock-keywords nil t)) - (use-local-map bat-generic-mode-keymap))) + (define-obsolete-function-alias 'bat-generic-mode 'dos-mode "24.4")) ;;; Mailagent ;; Mailagent is a Unix mail filtering program. Anyone wanna do a |