From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Noam Postavsky Newsgroups: gmane.emacs.bugs Subject: bug#28568: 26.0.60; [eshell] Incompatible change in alias argument handling Date: Fri, 29 Sep 2017 21:45:24 -0400 Message-ID: <87o9ptdknf.fsf@users.sourceforge.net> References: <87fubfjk10.fsf@gmail.com> <87a81mjxmz.fsf@gmail.com> <87r2uxlt6o.fsf@gmx.de> <871smxo45g.fsf_-_@users.sourceforge.net> <87efqswys7.fsf@gmail.com> <87mv5gfghl.fsf@users.sourceforge.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1506735981 5493 195.159.176.226 (30 Sep 2017 01:46:21 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 30 Sep 2017 01:46:21 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.60 (gnu/linux) Cc: 28568@debbugs.gnu.org To: Jay Kamat Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Sep 30 03:46:14 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dy6r4-0000Yq-BZ for geb-bug-gnu-emacs@m.gmane.org; Sat, 30 Sep 2017 03:46:10 +0200 Original-Received: from localhost ([::1]:37748 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dy6rB-0007zC-Pg for geb-bug-gnu-emacs@m.gmane.org; Fri, 29 Sep 2017 21:46:17 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46335) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dy6r0-0007xf-HC for bug-gnu-emacs@gnu.org; Fri, 29 Sep 2017 21:46:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dy6qw-0002us-0i for bug-gnu-emacs@gnu.org; Fri, 29 Sep 2017 21:46:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:59361) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dy6qv-0002uh-Qk for bug-gnu-emacs@gnu.org; Fri, 29 Sep 2017 21:46:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dy6qv-0005U0-JJ for bug-gnu-emacs@gnu.org; Fri, 29 Sep 2017 21:46:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Noam Postavsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 30 Sep 2017 01:46:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 28568 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 28568-submit@debbugs.gnu.org id=B28568.150673593521040 (code B ref 28568); Sat, 30 Sep 2017 01:46:01 +0000 Original-Received: (at 28568) by debbugs.gnu.org; 30 Sep 2017 01:45:35 +0000 Original-Received: from localhost ([127.0.0.1]:39809 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dy6qU-0005TC-FP for submit@debbugs.gnu.org; Fri, 29 Sep 2017 21:45:34 -0400 Original-Received: from mail-io0-f195.google.com ([209.85.223.195]:36304) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dy6qS-0005Sr-JN; Fri, 29 Sep 2017 21:45:32 -0400 Original-Received: by mail-io0-f195.google.com with SMTP id n69so658683ioi.3; Fri, 29 Sep 2017 18:45:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=pscwR++SIWjTdF3XqFnrnd5g+H1HacrFDVgpmI4B7ug=; b=e8qPXRHrT8uAPeICaW2cXqGVWXNEd/axgLQrMQa8kI+2vlz2uiUmRT9bt+4lS4Ncvg aXhF2F6ffTwHAZAqYJBXaLhFtuYMtbjygBCPzO6LxivnedUDB794SrwxaLJR6axvo803 t+o+d0GEV23ff9fQzNBfzF3Si1jhLXkZ/6pgqzJj6Hi3Y9gyUfmyuiBWwcrhpJXjrtQV hi+keJd/FyOeTXryz5EVkP4WuBA8E/HvnUSUWFNyeLSRZus0osWy98T0GGkukgtaju27 bxNNj0bsPKLW8I0P9BG2jNFASGbTyOPF9Dk1Dy1uVwZdCejtJaNY93QmgEZh90YnzcMP dP9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=pscwR++SIWjTdF3XqFnrnd5g+H1HacrFDVgpmI4B7ug=; b=UlAATuRGRnB3WAbaJP6hey9Ah6wJ9GtJzYGIvjrTLfFANAps6H9zfylegtG8vv1EDk gAP9vrb7sHCJTjm4f8XobBUU//SVFTkYOBKXUUfHXz4QkRvKTj16WGDgcDPjSb1TOY5h zsooVPYPS/JpcKrv0TTamQmj40z/LkXEnjVSu59RjcbOTI8QxMg3Ex+92aM4HPcPSYC4 cf6koxrzzOCQZu98Xxy8XDJi/BqTpPf8SqqP52pyDJsRf0/0fpjr5YaRw9NR2mEdfIm7 66kpSyajGoynNiysdvZxFnTkqGLIu98MDbMLLh9V0X8h5psEckV5nA3T3tGzqBs6CVBy AOsQ== X-Gm-Message-State: AMCzsaUJfWKFhiOTrKHqmaP1miu4tMKVxXyQrKBst021yc/2WaylgIal kN2qNEHe+DIPjN42Wamnt2nHnQ== X-Google-Smtp-Source: AOwi7QCH+QVGIqLx7GJmxBmFMa8suMj5dhqe1gooa3nod5FaElL5329SXdTpy8BcS+6o4d0ZkxGBlA== X-Received: by 10.107.83.15 with SMTP id h15mr15838705iob.72.1506735926625; Fri, 29 Sep 2017 18:45:26 -0700 (PDT) Original-Received: from zebian ([45.2.119.34]) by smtp.googlemail.com with ESMTPSA id m15sm733318itg.3.2017.09.29.18.45.24 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 29 Sep 2017 18:45:25 -0700 (PDT) In-Reply-To: <87mv5gfghl.fsf@users.sourceforge.net> (Noam Postavsky's message of "Wed, 27 Sep 2017 08:55:34 -0400") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:137658 Archived-At: --=-=-= Content-Type: text/plain tags 28568 + patch quit Noam Postavsky 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{}. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Revert-Don-t-lose-arguments-to-eshell-aliases-Bug-27.patch Content-Description: patch >From a154f4dbb09b24e4fdba69991c97e2a7a8d8581e Mon Sep 17 00:00:00 2001 From: Noam Postavsky 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 --=-=-=--