emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r111694: * lisp/eshell: Minor fixes.


From: Stefan Monnier
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r111694: * lisp/eshell: Minor fixes.
Date: Fri, 08 Feb 2013 10:07:03 -0500
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 111694
author: Aidan Gauland <address@hidden>
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Fri 2013-02-08 10:07:03 -0500
message:
  * 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.
modified:
  lisp/ChangeLog
  lisp/eshell/em-ls.el
  lisp/eshell/esh-proc.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-02-08 07:53:55 +0000
+++ b/lisp/ChangeLog    2013-02-08 15:07:03 +0000
@@ -1,3 +1,10 @@
+2013-02-08  Aidan Gauland  <address@hidden>
+
+       * eshell/esh-proc.el (eshell/kill): Rewrite.
+
+       * eshell/em-ls.el (show-almost-all): Declare.
+       (eshell-do-ls): Add support for -A argument.
+
 2013-02-08  Jambunathan K  <address@hidden>
 
        * icomplete.el (icomplete-forward-completions)

=== modified file 'lisp/eshell/em-ls.el'
--- a/lisp/eshell/em-ls.el      2013-01-01 09:11:05 +0000
+++ b/lisp/eshell/em-ls.el      2013-02-08 15:07:03 +0000
@@ -328,6 +328,7 @@
 (defvar numeric-uid-gid)
 (defvar reverse-list)
 (defvar show-all)
+(defvar show-almost-all)
 (defvar show-recursive)
 (defvar show-size)
 (defvar sort-method)
@@ -337,13 +338,15 @@
 (defun eshell-do-ls (&rest args)
   "Implementation of \"ls\" in Lisp, passing ARGS."
   (funcall flush-func -1)
-  ;; process the command arguments, and begin listing files
+  ;; Process the command arguments, and begin listing files.
   (eshell-eval-using-options
    "ls" (if eshell-ls-initial-args
            (list eshell-ls-initial-args args)
          args)
    `((?a "all" nil show-all
-        "show all files in directory")
+        "do not ignore entries starting with .")
+     (?A "almost-all" nil show-almost-all
+        "do not list implied . and ..")
      (?c nil by-ctime sort-method
         "sort by last status change time")
      (?d "directory" nil dir-literal
@@ -558,7 +561,17 @@
                                     ;; later when we are going to
                                     ;; display user and group names.
                                     (if numeric-uid-gid 'integer 'string))))
-         (when (and (not show-all) eshell-ls-exclude-regexp)
+          (when (and show-almost-all
+                     (not show-all))
+            (setq entries
+                  (remove-if
+                   (lambda (entry)
+                     (let ((filename (caar entry)))
+                       (or (string= filename ".")
+                           (string= filename ".."))))
+                   entries)))
+         (when (and (not show-all)
+                     eshell-ls-exclude-regexp)
            (while (and entries (string-match eshell-ls-exclude-regexp
                                              (caar entries)))
              (setq entries (cdr entries)))

=== modified file 'lisp/eshell/esh-proc.el'
--- a/lisp/eshell/esh-proc.el   2013-01-01 09:11:05 +0000
+++ b/lisp/eshell/esh-proc.el   2013-02-08 15:07:03 +0000
@@ -165,43 +165,39 @@
        (list-processes)))
 
 (defun eshell/kill (&rest args)
-  "Kill processes, buffers, symbol or files."
-  (let ((ptr args)
-       (signum 'SIGINT))
-    (while ptr
-      (if (or (eshell-processp (car ptr))
-             (and (stringp (car ptr))
-                  (string-match "^[A-Za-z/][A-Za-z0-9<>/]+$"
-                                (car ptr))))
-         ;; What about when $lisp-variable is possible here?
-         ;; It could very well name a process.
-         (setcar ptr (get-process (car ptr))))
-      (setq ptr (cdr ptr)))
-    (while args
-      (let ((id (if (eshell-processp (car args))
-                   (process-id (car args))
-                 (car args))))
-       (when id
-         (cond
-          ((null id)
-           (error "kill: bad signal spec"))
-          ((and (numberp id) (= id 0))
-           (error "kill: bad signal spec `%d'" id))
-          ((and (stringp id)
-                (string-match "^-?[0-9]+$" id))
-           (setq signum (abs (string-to-number id))))
-          ((stringp id)
-           (let (case-fold-search)
-             (if (string-match "^-\\([A-Z]+[12]?\\)$" id)
-                 (setq signum
-                       (intern (concat "SIG" (match-string 1 id))))
-               (error "kill: bad signal spec `%s'" id))))
-          ((< id 0)
-           (setq signum (abs id)))
-          (t
-           (signal-process id signum)))))
-      (setq args (cdr args)))
-    nil))
+  "Kill processes.
+Usage: kill [-<signal>] <pid>|<process> ...
+Accepts PIDs and process objects."
+  ;; If the first argument starts with a dash, treat it as the signal
+  ;; specifier.
+(let ((signum 'SIGINT))
+  (let ((arg (car args))
+        (case-fold-search nil))
+     (when (stringp arg)
+       (cond
+        ((string-match "^-[[:digit:]]+$" arg)
+         (setq signum (abs (string-to-number arg)))
+        ((or (string-match "^-[[:upper:]]+$" arg)
+             (string-match "^-[[:lower:]]+$" arg))
+         (setq signum (abs (string-to-number arg))))))
+       (setq args (cdr args))))
+   (while args
+     (let ((arg (if (eshell-processp (car args))
+                    (process-id (car args))
+                  (car args))))
+       (when arg
+         (cond
+          ((null arg)
+           (error "kill: null pid.  Process may actually be a network 
connection."))
+          ((not (numberp arg))
+           (error "kill: invalid argument type: %s" (type-of arg)))
+          ((and (numberp arg)
+                (<= arg 0))
+           (error "kill: bad pid: %d" arg))
+          (t
+           (signal-process arg signum)))))
+     (setq args (cdr args))))
+  nil)
 
 (defun eshell-read-process-name (prompt)
   "Read the name of a process from the minibuffer, using completion.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]