all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Noam Postavsky <npostavs@users.sourceforge.net>
To: Jay Kamat <jaygkamat@gmail.com>
Cc: 28568@debbugs.gnu.org
Subject: bug#28568: 26.0.60; [eshell] Incompatible change in alias argument handling
Date: Fri, 29 Sep 2017 21:45:24 -0400	[thread overview]
Message-ID: <87o9ptdknf.fsf@users.sourceforge.net> (raw)
In-Reply-To: <87mv5gfghl.fsf@users.sourceforge.net> (Noam Postavsky's message of "Wed, 27 Sep 2017 08:55:34 -0400")

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

tags 28568 + patch
quit

Noam Postavsky <npostavs@users.sourceforge.net> writes:

>> All this patch is doing is reverting commit e66e81679c and updating the
>> alias documentation, so feel free to remake and commit this yourself if
>> you wish (or if I'm doing it wrong).
>
> Yes, that's basically what I had in mind, although I'll probably add a
> bit more explanation to the doc.

Here it is, not sure if I've got the texinfo formatting right.  I'm not
really clear on the difference between @samp{}, @command{}, and @code{}.


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

From a154f4dbb09b24e4fdba69991c97e2a7a8d8581e Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
Date: Fri, 29 Sep 2017 21:00:10 -0400
Subject: [PATCH] Revert "Don't lose arguments to eshell aliases (Bug#27954)"

It broke the established argument handling methods provided by eshell
aliases (Bug#28568).
* doc/misc/eshell.texi (Aliases): Fix example, call out use of
arguments in aliases.
* lisp/eshell/em-alias.el (eshell-maybe-replace-by-alias): Ignore
ARGS.
---
 doc/misc/eshell.texi    | 9 ++++++++-
 lisp/eshell/em-alias.el | 6 +++---
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/doc/misc/eshell.texi b/doc/misc/eshell.texi
index 8963826c4c..8dff739612 100644
--- a/doc/misc/eshell.texi
+++ b/doc/misc/eshell.texi
@@ -431,13 +431,20 @@ Aliases
 
 Aliases are commands that expand to a longer input line.  For example,
 @command{ll} is a common alias for @code{ls -l}, and would be defined
-with the command invocation @samp{alias ll ls -l}; with this defined,
+with the command invocation @samp{alias ll 'ls -l $*'}; with this defined,
 running @samp{ll foo} in Eshell will actually run @samp{ls -l foo}.
 Aliases defined (or deleted) by the @command{alias} command are
 automatically written to the file named by @code{eshell-aliases-file},
 which you can also edit directly (although you will have to manually
 reload it).
 
+Note that unlike aliases in Bash, arguments must be handled
+explicitly.  Typically the alias definition would end in @samp{$*} to
+pass all arguments along.  More selective use of arguments via
+@samp{$1}, @samp{$2}, etc., is also possible.  For example,
+@samp{alias mcd 'mkdir $1 && cd $1'} would cause @samp{mcd foo} to
+create and switch to a directory called @samp{foo}.
+
 @node History
 @section History
 @cmindex history
diff --git a/lisp/eshell/em-alias.el b/lisp/eshell/em-alias.el
index f951efa65d..742234574f 100644
--- a/lisp/eshell/em-alias.el
+++ b/lisp/eshell/em-alias.el
@@ -214,8 +214,8 @@ eshell-lookup-alias
 
 (defvar eshell-prevent-alias-expansion nil)
 
-(defun eshell-maybe-replace-by-alias (command args)
-  "If COMMAND has an alias definition, call that instead using ARGS."
+(defun eshell-maybe-replace-by-alias (command _args)
+  "Call COMMAND's alias definition, if it exists."
   (unless (and eshell-prevent-alias-expansion
 	       (member command eshell-prevent-alias-expansion))
     (let ((alias (eshell-lookup-alias command)))
@@ -225,7 +225,7 @@ eshell-maybe-replace-by-alias
                         (eshell-command-arguments ',eshell-last-arguments)
                         (eshell-prevent-alias-expansion
                          ',(cons command eshell-prevent-alias-expansion)))
-                    ,(eshell-parse-command (nth 1 alias) args)))))))
+                    ,(eshell-parse-command (nth 1 alias))))))))
 
 (defun eshell-alias-completions (name)
   "Find all possible completions for NAME.
-- 
2.11.0


  reply	other threads:[~2017-09-30  1:45 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-22  6:59 Possible Eshell/Tramp Bug in Emacs 26 Jay Kamat
2017-09-22 20:17 ` Jay Kamat
2017-09-23  8:23   ` bug#28320: " Michael Albinus
2017-09-23 13:21     ` bug#28568: 26.0.60; [eshell] Incompatible change in alias argument handling Noam Postavsky
2017-09-23 14:55     ` bug#28568: 26.0.60; [eshell] Incompatible change in alias argument handling (Was: Possible Eshell/Tramp Bug in Emacs 26) Noam Postavsky
2017-09-27  4:28       ` bug#28568: 26.0.60; [eshell] Incompatible change in alias argument handling Jay Kamat
2017-09-27 12:55         ` Noam Postavsky
2017-09-30  1:45           ` Noam Postavsky [this message]
2017-09-30  8:06             ` Eli Zaretskii
2017-10-01  0:12               ` 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

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

  git send-email \
    --in-reply-to=87o9ptdknf.fsf@users.sourceforge.net \
    --to=npostavs@users.sourceforge.net \
    --cc=28568@debbugs.gnu.org \
    --cc=jaygkamat@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 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.