all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Eshell manual overhaul and Eshell patches
@ 2013-02-08  3:44 Aidan Gauland
  2013-02-08 15:09 ` Stefan Monnier
  0 siblings, 1 reply; 6+ messages in thread
From: Aidan Gauland @ 2013-02-08  3:44 UTC (permalink / raw
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 927 bytes --]

Hello,

With the help of the Eshell maintainer, John Wiegley, I have filled in
most of the missing sections in the Eshell manual, and made some fixes
to Eshell itself along the way.  There is still much more to do, but I
would like to submit my changes so far, because I have done the easier
parts of this task (i.e. trivial documentation and source patches).

John has seen my changes, and said I should send them to the Emacs devel
mailing list instead of him directly.  I have attached patches for the
Eshell source, but as my changes to the manual affect most of the file,
I will instead refer to the complete texinfo file on the Web:
<https://raw.github.com/aidalgol/eshell-manual/master/eshell.texi>. I
started from the texinfo file in Emacs 23 (the version of Emacs I was
using when I started this project):
<http://git.savannah.gnu.org/cgit/emacs.git/plain/doc/misc/eshell.texi?h=emacs-23>

Best regards,
Aidan Gauland

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: eshell/kill patch --]
[-- Type: text/x-diff, Size: 2647 bytes --]

--- a/esh-proc.el	2012-10-25 16:15:47.469236248 +1300
+++ b/esh-proc.el	2012-10-25 16:15:37.184135738 +1300
@@ -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.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: ls -A patch --]
[-- Type: text/x-diff, Size: 1430 bytes --]

--- a/em-ls.el	2012-10-27 16:58:13.256903342 +1300
+++ b/em-ls.el	2012-10-27 16:16:16.207204792 +1300
@@ -327,6 +327,7 @@
 (defvar numeric-uid-gid)
 (defvar reverse-list)
 (defvar show-all)
+(defvar show-almost-all)
 (defvar show-recursive)
 (defvar show-size)
 (defvar sort-method)
@@ -342,7 +343,9 @@
 	    (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
@@ -557,7 +560,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)))

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-02-08 20:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-08  3:44 Eshell manual overhaul and Eshell patches Aidan Gauland
2013-02-08 15:09 ` Stefan Monnier
2013-02-08 15:57   ` John Wiegley
2013-02-08 19:26     ` Aidan Gauland
2013-02-08 20:08       ` Stefan Monnier
2013-02-08 19:24   ` Aidan Gauland

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.