aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAidan Gauland2013-02-08 10:07:03 -0500
committerStefan Monnier2013-02-08 10:07:03 -0500
commit276a61a690dce8e4d1ecd5da1a964792c6e5754e (patch)
treef7b48cca1fee880cdc318a99d08dee8624b1cf2e
parent8ca30920525154d5eef67899b04dde77f4176169 (diff)
downloademacs-276a61a690dce8e4d1ecd5da1a964792c6e5754e.tar.gz
emacs-276a61a690dce8e4d1ecd5da1a964792c6e5754e.zip
* lisp/eshell: Minor fixes.
* lisp/eshell/em-ls.el (show-almost-all): Declare. (eshell-do-ls): Add support for -A argument. * lisp/eshell/esh-proc.el (eshell/kill): Rewrite.
-rw-r--r--lisp/ChangeLog7
-rw-r--r--lisp/eshell/em-ls.el19
-rw-r--r--lisp/eshell/esh-proc.el70
3 files changed, 56 insertions, 40 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index f2a8deeef40..9bcb53cd066 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
12013-02-08 Aidan Gauland <aidalgol@no8wireless.co.nz>
2
3 * eshell/esh-proc.el (eshell/kill): Rewrite.
4
5 * eshell/em-ls.el (show-almost-all): Declare.
6 (eshell-do-ls): Add support for -A argument.
7
12013-02-08 Jambunathan K <kjambunathan@gmail.com> 82013-02-08 Jambunathan K <kjambunathan@gmail.com>
2 9
3 * icomplete.el (icomplete-forward-completions) 10 * icomplete.el (icomplete-forward-completions)
diff --git a/lisp/eshell/em-ls.el b/lisp/eshell/em-ls.el
index eec932103ee..eb24d8da0b6 100644
--- a/lisp/eshell/em-ls.el
+++ b/lisp/eshell/em-ls.el
@@ -328,6 +328,7 @@ instead."
328(defvar numeric-uid-gid) 328(defvar numeric-uid-gid)
329(defvar reverse-list) 329(defvar reverse-list)
330(defvar show-all) 330(defvar show-all)
331(defvar show-almost-all)
331(defvar show-recursive) 332(defvar show-recursive)
332(defvar show-size) 333(defvar show-size)
333(defvar sort-method) 334(defvar sort-method)
@@ -337,13 +338,15 @@ instead."
337(defun eshell-do-ls (&rest args) 338(defun eshell-do-ls (&rest args)
338 "Implementation of \"ls\" in Lisp, passing ARGS." 339 "Implementation of \"ls\" in Lisp, passing ARGS."
339 (funcall flush-func -1) 340 (funcall flush-func -1)
340 ;; process the command arguments, and begin listing files 341 ;; Process the command arguments, and begin listing files.
341 (eshell-eval-using-options 342 (eshell-eval-using-options
342 "ls" (if eshell-ls-initial-args 343 "ls" (if eshell-ls-initial-args
343 (list eshell-ls-initial-args args) 344 (list eshell-ls-initial-args args)
344 args) 345 args)
345 `((?a "all" nil show-all 346 `((?a "all" nil show-all
346 "show all files in directory") 347 "do not ignore entries starting with .")
348 (?A "almost-all" nil show-almost-all
349 "do not list implied . and ..")
347 (?c nil by-ctime sort-method 350 (?c nil by-ctime sort-method
348 "sort by last status change time") 351 "sort by last status change time")
349 (?d "directory" nil dir-literal 352 (?d "directory" nil dir-literal
@@ -558,7 +561,17 @@ relative to that directory."
558 ;; later when we are going to 561 ;; later when we are going to
559 ;; display user and group names. 562 ;; display user and group names.
560 (if numeric-uid-gid 'integer 'string)))) 563 (if numeric-uid-gid 'integer 'string))))
561 (when (and (not show-all) eshell-ls-exclude-regexp) 564 (when (and show-almost-all
565 (not show-all))
566 (setq entries
567 (remove-if
568 (lambda (entry)
569 (let ((filename (caar entry)))
570 (or (string= filename ".")
571 (string= filename ".."))))
572 entries)))
573 (when (and (not show-all)
574 eshell-ls-exclude-regexp)
562 (while (and entries (string-match eshell-ls-exclude-regexp 575 (while (and entries (string-match eshell-ls-exclude-regexp
563 (caar entries))) 576 (caar entries)))
564 (setq entries (cdr entries))) 577 (setq entries (cdr entries)))
diff --git a/lisp/eshell/esh-proc.el b/lisp/eshell/esh-proc.el
index 406822367d1..81ca2182488 100644
--- a/lisp/eshell/esh-proc.el
+++ b/lisp/eshell/esh-proc.el
@@ -165,43 +165,39 @@ The signals which will cause this to happen are matched by
165 (list-processes))) 165 (list-processes)))
166 166
167(defun eshell/kill (&rest args) 167(defun eshell/kill (&rest args)
168 "Kill processes, buffers, symbol or files." 168 "Kill processes.
169 (let ((ptr args) 169Usage: kill [-<signal>] <pid>|<process> ...
170 (signum 'SIGINT)) 170Accepts PIDs and process objects."
171 (while ptr 171 ;; If the first argument starts with a dash, treat it as the signal
172 (if (or (eshell-processp (car ptr)) 172 ;; specifier.
173 (and (stringp (car ptr)) 173(let ((signum 'SIGINT))
174 (string-match "^[A-Za-z/][A-Za-z0-9<>/]+$" 174 (let ((arg (car args))
175 (car ptr)))) 175 (case-fold-search nil))
176 ;; What about when $lisp-variable is possible here? 176 (when (stringp arg)
177 ;; It could very well name a process. 177 (cond
178 (setcar ptr (get-process (car ptr)))) 178 ((string-match "^-[[:digit:]]+$" arg)
179 (setq ptr (cdr ptr))) 179 (setq signum (abs (string-to-number arg)))
180 (while args 180 ((or (string-match "^-[[:upper:]]+$" arg)
181 (let ((id (if (eshell-processp (car args)) 181 (string-match "^-[[:lower:]]+$" arg))
182 (process-id (car args)) 182 (setq signum (abs (string-to-number arg))))))
183 (car args)))) 183 (setq args (cdr args))))
184 (when id 184 (while args
185 (cond 185 (let ((arg (if (eshell-processp (car args))
186 ((null id) 186 (process-id (car args))
187 (error "kill: bad signal spec")) 187 (car args))))
188 ((and (numberp id) (= id 0)) 188 (when arg
189 (error "kill: bad signal spec `%d'" id)) 189 (cond
190 ((and (stringp id) 190 ((null arg)
191 (string-match "^-?[0-9]+$" id)) 191 (error "kill: null pid. Process may actually be a network connection."))
192 (setq signum (abs (string-to-number id)))) 192 ((not (numberp arg))
193 ((stringp id) 193 (error "kill: invalid argument type: %s" (type-of arg)))
194 (let (case-fold-search) 194 ((and (numberp arg)
195 (if (string-match "^-\\([A-Z]+[12]?\\)$" id) 195 (<= arg 0))
196 (setq signum 196 (error "kill: bad pid: %d" arg))
197 (intern (concat "SIG" (match-string 1 id)))) 197 (t
198 (error "kill: bad signal spec `%s'" id)))) 198 (signal-process arg signum)))))
199 ((< id 0) 199 (setq args (cdr args))))
200 (setq signum (abs id))) 200 nil)
201 (t
202 (signal-process id signum)))))
203 (setq args (cdr args)))
204 nil))
205 201
206(defun eshell-read-process-name (prompt) 202(defun eshell-read-process-name (prompt)
207 "Read the name of a process from the minibuffer, using completion. 203 "Read the name of a process from the minibuffer, using completion.