unofficial mirror of emacs-devel@gnu.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

* Re: Eshell manual overhaul and Eshell patches
  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:24   ` Aidan Gauland
  0 siblings, 2 replies; 6+ messages in thread
From: Stefan Monnier @ 2013-02-08 15:09 UTC (permalink / raw)
  To: Aidan Gauland; +Cc: John Wiegley, emacs-devel

> With the help of the Eshell maintainer, John Wiegley, I have filled in
> most of the missing sections in the Eshell manual,

Cool, thanks, installed in emacs-23 and emacs-24.

> and made some fixes to Eshell itself along the way.

Installed in trunk.  You didn't say what the patches were meant to do,
and I could only guess some part, so I used the following commit message:

   Summary: * lisp/eshell: Minor fixes.
   Author: Aidan Gauland <aidalgol@no8wireless.co.nz>
   
   * 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.

Would you like to take over maintainership of Eshell?


-- Stefan



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

* Re: Eshell manual overhaul and Eshell patches
  2013-02-08 15:09 ` Stefan Monnier
@ 2013-02-08 15:57   ` John Wiegley
  2013-02-08 19:26     ` Aidan Gauland
  2013-02-08 19:24   ` Aidan Gauland
  1 sibling, 1 reply; 6+ messages in thread
From: John Wiegley @ 2013-02-08 15:57 UTC (permalink / raw)
  To: emacs-devel

>>>>> Stefan Monnier <monnier@iro.umontreal.ca> writes:

> Would you like to take over maintainership of Eshell?

I would be very much in favor of Aidan taking over Eshell.

John



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

* Re: Eshell manual overhaul and Eshell patches
  2013-02-08 15:09 ` Stefan Monnier
  2013-02-08 15:57   ` John Wiegley
@ 2013-02-08 19:24   ` Aidan Gauland
  1 sibling, 0 replies; 6+ messages in thread
From: Aidan Gauland @ 2013-02-08 19:24 UTC (permalink / raw)
  To: emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> and made some fixes to Eshell itself along the way.
>
> Installed in trunk.  You didn't say what the patches were meant to do,
> and I could only guess some part, so I used the following commit message:
>
>    Summary: * lisp/eshell: Minor fixes.
>    Author: Aidan Gauland <aidalgol@no8wireless.co.nz>
>    
>    * 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.

Sorry about that; the ls patch does exactly that, and the kill rewrite
was to make the command more closely follow the argument syntax of the
Unix kill command (on GNU/Linux, at least).




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

* Re: Eshell manual overhaul and Eshell patches
  2013-02-08 15:57   ` John Wiegley
@ 2013-02-08 19:26     ` Aidan Gauland
  2013-02-08 20:08       ` Stefan Monnier
  0 siblings, 1 reply; 6+ messages in thread
From: Aidan Gauland @ 2013-02-08 19:26 UTC (permalink / raw)
  To: emacs-devel

"John Wiegley" <johnw@newartisans.com> writes:
>> Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> Would you like to take over maintainership of Eshell?
>
> I would be very much in favor of Aidan taking over Eshell.

Yes, I think I can handle maintaining Eshell.  (John has explained to me
(on IRC) what maintainership entails.)  I have more items on my (Eshell)
TODO list, so you definitely see commits from me in the future.

–Aidan




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

* Re: Eshell manual overhaul and Eshell patches
  2013-02-08 19:26     ` Aidan Gauland
@ 2013-02-08 20:08       ` Stefan Monnier
  0 siblings, 0 replies; 6+ messages in thread
From: Stefan Monnier @ 2013-02-08 20:08 UTC (permalink / raw)
  To: Aidan Gauland; +Cc: emacs-devel

>>> Would you like to take over maintainership of Eshell?
>> I would be very much in favor of Aidan taking over Eshell.
> Yes, I think I can handle maintaining Eshell.  (John has explained to me
> (on IRC) what maintainership entails.)  I have more items on my (Eshell)
> TODO list, so you definitely see commits from me in the future.

Great.  Keep the patches coming ;-)
And if/when you feel comfortable with it, we can give you write access.
BTW, take a look at the trunk where I installed a further patch on top
of yours to fix a paren-typo in your code and to adjust the code w.r.t
CL use (it used `remove-if' without requiring `cl' at run-time).


        Stefan



^ 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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).