unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Noam Postavsky <npostavs@users.sourceforge.net>
To: Pierre Neidhardt <ambrevar@gmail.com>
Cc: 29157@debbugs.gnu.org
Subject: bug#29157: 25.3; Eshell parsing fails sometimes, e.g. "date" and "sed"
Date: Thu, 23 Nov 2017 07:59:10 -0500	[thread overview]
Message-ID: <87po89ywv5.fsf@users.sourceforge.net> (raw)
In-Reply-To: <87po891o1t.fsf@gmail.com> (Pierre Neidhardt's message of "Thu, 23 Nov 2017 07:55:58 +0100")

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

Pierre Neidhardt <ambrevar@gmail.com> writes:

> Disabling eshell/date makes Eshell less portable on one system at least,
> that is Windows.  But what does "portability" mean in this context?  Are
> the coreutils meant to be part of Eshell?  Why?  Supporting `date' but not
> its arguments does not make up for actual portability I believe.  Case
> in point: I got fooled.
>
> Let's take the case of BSD vs. GNU: bash or zsh do not wrap around `ls',
> so the behaviour will not be the same on BSD and GNU.  Why should Eshell
> be any different?

Eshell isn't exactly the same as bash or zsh.  You can use M-x shell if
you prefer them.

We could fallback to the external command if given arguments.  This is
being done currently for other commands like eshell/rm (for unrecognized
arguments, that is).


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

From ab25f638ccff0ebec36b78f9b47092fe9fb103b3 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
Date: Thu, 23 Nov 2017 07:51:13 -0500
Subject: [PATCH] eshell/date: use external date for any arguments (Bug#29157)

* lisp/eshell/em-unix.el (eshell/date): Throw `eshell-external' if
given any arguments.
(eshell-unix-initialize): Add "date" to `eshell-complex-commands'.
---
 lisp/eshell/em-unix.el | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/lisp/eshell/em-unix.el b/lisp/eshell/em-unix.el
index c486d2c51d..342a045d42 100644
--- a/lisp/eshell/em-unix.el
+++ b/lisp/eshell/em-unix.el
@@ -148,13 +148,18 @@ eshell-unix-initialize
   (make-local-variable 'eshell-complex-commands)
   (setq eshell-complex-commands
 	(append '("grep" "egrep" "fgrep" "agrep" "glimpse" "locate"
-		  "cat" "time" "cp" "mv" "make" "du" "diff")
+		  "cat" "date" "time" "cp" "mv" "make" "du" "diff")
 		eshell-complex-commands)))
 
-(defalias 'eshell/date     'current-time-string)
 (defalias 'eshell/basename 'file-name-nondirectory)
 (defalias 'eshell/dirname  'file-name-directory)
 
+(defun eshell/date (&rest args)
+  (when args
+    (throw 'eshell-external
+           (eshell-external-command "date" args)))
+  (current-time-string))
+
 (defvar em-interactive)
 (defvar em-preview)
 (defvar em-recursive)
-- 
2.11.0


  reply	other threads:[~2017-11-23 12:59 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-05 11:37 bug#29157: 25.3; Eshell parsing fails sometimes, e.g. "date" and "sed" Pierre Neidhardt
2017-11-05 13:58 ` Noam Postavsky
2017-11-05 14:16   ` Pierre Neidhardt
2017-11-23  3:13     ` Noam Postavsky
2017-11-23  6:55       ` Pierre Neidhardt
2017-11-23 12:59         ` Noam Postavsky [this message]
2017-11-23 16:26           ` Eli Zaretskii
2017-11-25 17:54             ` Pierre Neidhardt
2017-11-25 18:32               ` Michael Albinus
2017-11-25 18:35                 ` Pierre Neidhardt
2017-11-25 18:50               ` Noam Postavsky
2017-11-25 19:50                 ` Eli Zaretskii
2017-11-25 20:06                   ` Noam Postavsky
2017-11-25 20:25                     ` Eli Zaretskii
2017-11-25 21:41                       ` Noam Postavsky
2017-11-26  3:35                         ` Eli Zaretskii
2017-11-26  3:21                   ` John Wiegley
2017-11-26 15:35                     ` Eli Zaretskii
2017-11-26 21:44                       ` John Wiegley
2017-11-25 19:29               ` Eli Zaretskii
2017-11-25 19:36                 ` Pierre Neidhardt
2017-11-25 19:57                   ` Eli Zaretskii
2017-11-26  9:17                     ` Pierre Neidhardt
2017-11-26 15:53                       ` Eli Zaretskii
2017-11-26  3:21                 ` John Wiegley
2017-11-26 15:33                   ` Eli Zaretskii
2017-11-26 21:45                     ` John Wiegley
2017-11-27  3:32                       ` Eli Zaretskii
2017-12-21  8:17                         ` John Wiegley
2017-12-03 20:43         ` Noam Postavsky
2017-12-04  8:43           ` John Wiegley
2017-12-04 12:51             ` Noam Postavsky
2017-11-05 15:16   ` Andreas Schwab
2017-11-10  2:04     ` Noam Postavsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87po89ywv5.fsf@users.sourceforge.net \
    --to=npostavs@users.sourceforge.net \
    --cc=29157@debbugs.gnu.org \
    --cc=ambrevar@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).