aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/ChangeLog7
-rw-r--r--lisp/progmodes/dos.el26
2 files changed, 20 insertions, 13 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 6ccb8d61836..4b670eb2f8b 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
12013-08-07 Eli Zaretskii <eliz@gnu.org>
2
3 * progmodes/dos.el (dos-font-lock-keywords): Rename LINUX to UNIX
4 and add a few popular commands found in batch files.
5 (dos, dos-label-face, dos-cmd-help, dos-run, dos-run-args)
6 (dos-mode): Doc fixes.
7
12013-08-07 Stefan Monnier <monnier@iro.umontreal.ca> 82013-08-07 Stefan Monnier <monnier@iro.umontreal.ca>
2 9
3 * progmodes/dos.el (auto-mode-alist): Add entries for dos-mode. 10 * progmodes/dos.el (auto-mode-alist): Add entries for dos-mode.
diff --git a/lisp/progmodes/dos.el b/lisp/progmodes/dos.el
index adc94f201a6..593b5e9fc92 100644
--- a/lisp/progmodes/dos.el
+++ b/lisp/progmodes/dos.el
@@ -53,14 +53,14 @@
53;; 1 Preamble 53;; 1 Preamble
54 54
55(defgroup dos nil 55(defgroup dos nil
56 "Major mode for editing Dos scripts." 56 "Major mode for editing DOS/Windows batch files."
57 :link '(custom-group-link :tag "Font Lock Faces group" font-lock-faces) 57 :link '(custom-group-link :tag "Font Lock Faces group" font-lock-faces)
58 :group 'languages) 58 :group 'languages)
59 59
60;; 2 User variables 60;; 2 User variables
61 61
62(defface dos-label-face '((t :weight bold)) 62(defface dos-label-face '((t :weight bold))
63 "Font Lock mode face used to highlight Dos labels." 63 "Font Lock mode face used to highlight labels in batch files."
64 :group 'dos) 64 :group 'dos)
65 65
66;; 3 Internal variables 66;; 3 Internal variables
@@ -77,8 +77,8 @@
77 (CONTROLFLOW 77 (CONTROLFLOW
78 '("call" "cmd" "defined" "do" "else" "equ" "exist" "exit" "for" "geq" 78 '("call" "cmd" "defined" "do" "else" "equ" "exist" "exit" "for" "geq"
79 "goto" "gtr" "if" "in" "leq" "lss" "neq" "not" "start")) 79 "goto" "gtr" "if" "in" "leq" "lss" "neq" "not" "start"))
80 (LINUX 80 (UNIX
81 '("cat" "cp" "ls" "mv" "rm"))) 81 '("bash" "cat" "cp" "fgrep" "grep" "ls" "sed" "sh" "mv" "rm")))
82 `(("\\<_\\(call\\|goto\\)\\_>[ \t]+%?\\([A-Za-z0-9-_\\:.]+\\)%?" 82 `(("\\<_\\(call\\|goto\\)\\_>[ \t]+%?\\([A-Za-z0-9-_\\:.]+\\)%?"
83 (2 font-lock-constant-face t)) 83 (2 font-lock-constant-face t))
84 ("^[ \t]*\\(@?rem\\_>\\|::\\).*" 84 ("^[ \t]*\\(@?rem\\_>\\|::\\).*"
@@ -96,7 +96,7 @@
96 (,(concat "\\_<" (regexp-opt COMMANDS) "\\_>") . font-lock-builtin-face) 96 (,(concat "\\_<" (regexp-opt COMMANDS) "\\_>") . font-lock-builtin-face)
97 (,(concat "\\_<" (regexp-opt CONTROLFLOW) "\\_>") 97 (,(concat "\\_<" (regexp-opt CONTROLFLOW) "\\_>")
98 . font-lock-keyword-face) 98 . font-lock-keyword-face)
99 (,(concat "\\_<" (regexp-opt LINUX) "\\_>") 99 (,(concat "\\_<" (regexp-opt UNIX) "\\_>")
100 . font-lock-warning-face))))) 100 . font-lock-warning-face)))))
101 101
102(defvar dos-menu 102(defvar dos-menu
@@ -138,7 +138,7 @@
138;; 4 User functions 138;; 4 User functions
139 139
140(defun dos-cmd-help (cmd) 140(defun dos-cmd-help (cmd)
141 "Show help for Dos command CMD." 141 "Show help for batch file command CMD."
142 (interactive "sHelp: ") 142 (interactive "sHelp: ")
143 (if (string-equal cmd "net") 143 (if (string-equal cmd "net")
144 ;; FIXME: liable to quoting nightmare. Use call-process? 144 ;; FIXME: liable to quoting nightmare. Use call-process?
@@ -151,19 +151,19 @@
151 (switch-to-buffer "*Help*") (delete-other-windows) (message nil)) 151 (switch-to-buffer "*Help*") (delete-other-windows) (message nil))
152 152
153(defun dos-run () 153(defun dos-run ()
154 "Run Dos script." 154 "Run a batch file."
155 (interactive) 155 (interactive)
156 ;; FIXME: liable to quoting nightmare. Use call/start-process? 156 ;; FIXME: liable to quoting nightmare. Use call/start-process?
157 (save-buffer) (shell-command buffer-file-name)) 157 (save-buffer) (shell-command buffer-file-name))
158 158
159(defun dos-run-args (args) 159(defun dos-run-args (args)
160 "Run Dos script with ARGS." 160 "Run a batch file with ARGS."
161 (interactive "sArgs: ") 161 (interactive "sArgs: ")
162 ;; FIXME: Use `compile'? 162 ;; FIXME: Use `compile'?
163 (shell-command (concat buffer-file-name " " args))) 163 (shell-command (concat buffer-file-name " " args)))
164 164
165(defun dos-template () 165(defun dos-template ()
166 "Insert minimal Dos template." 166 "Insert minimal batch file template."
167 (interactive) 167 (interactive)
168 (goto-char (point-min)) (insert "@echo off\nsetlocal\n\n")) 168 (goto-char (point-min)) (insert "@echo off\nsetlocal\n\n"))
169 169
@@ -174,11 +174,11 @@
174 174
175;;;###autoload 175;;;###autoload
176(define-derived-mode dos-mode prog-mode "Dos" 176(define-derived-mode dos-mode prog-mode "Dos"
177 "Major mode for editing Dos scripts.\n 177 "Major mode for editing DOS/Windows batch files.\n
178The `dos-mode-help' command shows this page.\n 178The `dos-mode-help' command shows this page.\n
179Start a new script from `dos-template'. Read help pages for Dos commands with 179Start a new script from `dos-template'. Read help pages for Dos commands
180`dos-cmd-help'. Navigate between sections using `imenu'. Run script using 180with `dos-cmd-help'. Navigate between sections using `imenu'.
181`dos-run' and `dos-run-args'.\n 181Run script using `dos-run' and `dos-run-args'.\n
182\\{dos-mode-map}" 182\\{dos-mode-map}"
183 (setq-local comment-start "rem ") 183 (setq-local comment-start "rem ")
184 (setq-local font-lock-defaults 184 (setq-local font-lock-defaults