unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* EShell Alias for a 'cd' followed by 'ls'
@ 2020-11-19  2:28 Christopher Dimech
  2020-11-19  3:54 ` Stefan Kangas
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Christopher Dimech @ 2020-11-19  2:28 UTC (permalink / raw)
  To: Help Gnu Emacs

I would like to use Eshell to call an alias 'cl' that does
a 'cd' to a directory followed by an 'ls'.  But I do not know
how to achieve it.



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

* Re: EShell Alias for a 'cd' followed by 'ls'
  2020-11-19  2:28 EShell Alias for a 'cd' followed by 'ls' Christopher Dimech
@ 2020-11-19  3:54 ` Stefan Kangas
  2020-11-19  4:10   ` Christopher Dimech
  2020-11-19  4:49 ` Jean Louis
  2020-11-20  2:12 ` Vladimir Sedach
  2 siblings, 1 reply; 16+ messages in thread
From: Stefan Kangas @ 2020-11-19  3:54 UTC (permalink / raw)
  To: Christopher Dimech, Help Gnu Emacs

Christopher Dimech <dimech@gmx.com> writes:

> I would like to use Eshell to call an alias 'cl' that does
> a 'cd' to a directory followed by an 'ls'.  But I do not know
> how to achieve it.

I recommend familiarizing yourself with Info, reachable via `C-h i'.

You can find the Eshell manual using `m eshell RET' where you should be
able to find the information you are looking for using `i alias RET'.

Happy to help.



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

* Re: EShell Alias for a 'cd' followed by 'ls'
  2020-11-19  3:54 ` Stefan Kangas
@ 2020-11-19  4:10   ` Christopher Dimech
  2020-11-19  4:43     ` Dan Hitt
  0 siblings, 1 reply; 16+ messages in thread
From: Christopher Dimech @ 2020-11-19  4:10 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: Help Gnu Emacs

Have not found it useful.  Have tried the following.

alias cl 'cd $* && ls $*'


> Sent: Thursday, November 19, 2020 at 4:54 AM
> From: "Stefan Kangas" <stefan@marxist.se>
> To: "Christopher Dimech" <dimech@gmx.com>, "Help Gnu Emacs" <help-gnu-emacs@gnu.org>
> Subject: Re: EShell Alias for a 'cd' followed by 'ls'
>
> Christopher Dimech <dimech@gmx.com> writes:
>
> > I would like to use Eshell to call an alias 'cl' that does
> > a 'cd' to a directory followed by an 'ls'.  But I do not know
> > how to achieve it.
>
> I recommend familiarizing yourself with Info, reachable via `C-h i'.
>
> You can find the Eshell manual using `m eshell RET' where you should be
> able to find the information you are looking for using `i alias RET'.
>
> Happy to help.
>



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

* Re: EShell Alias for a 'cd' followed by 'ls'
  2020-11-19  4:10   ` Christopher Dimech
@ 2020-11-19  4:43     ` Dan Hitt
  2020-11-19  4:56       ` Dan Hitt
  2020-11-19  5:18       ` Christopher Dimech
  0 siblings, 2 replies; 16+ messages in thread
From: Dan Hitt @ 2020-11-19  4:43 UTC (permalink / raw)
  To: Christopher Dimech; +Cc: Help Gnu Emacs, Stefan Kangas

On Wed, Nov 18, 2020 at 8:11 PM Christopher Dimech <dimech@gmx.com> wrote:

> Have not found it useful.  Have tried the following.
>
> alias cl 'cd $* && ls $*'
>

Actually, it looks like it should be:

alias cl 'cd $* ; ls'

That works for me, and has the very surprising benefit that it propagates
to all shells running in emacs, as well as working in new emacses started
separately from the original one.

So some pretty powerful, heady stuff.

Thanks Stefan for pointing out the path.

dan


>
>
> > Sent: Thursday, November 19, 2020 at 4:54 AM
> > From: "Stefan Kangas" <stefan@marxist.se>
> > To: "Christopher Dimech" <dimech@gmx.com>, "Help Gnu Emacs" <
> help-gnu-emacs@gnu.org>
> > Subject: Re: EShell Alias for a 'cd' followed by 'ls'
> >
> > Christopher Dimech <dimech@gmx.com> writes:
> >
> > > I would like to use Eshell to call an alias 'cl' that does
> > > a 'cd' to a directory followed by an 'ls'.  But I do not know
> > > how to achieve it.
> >
> > I recommend familiarizing yourself with Info, reachable via `C-h i'.
> >
> > You can find the Eshell manual using `m eshell RET' where you should be
> > able to find the information you are looking for using `i alias RET'.
> >
> > Happy to help.
> >
>
>


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

* Re: EShell Alias for a 'cd' followed by 'ls'
  2020-11-19  2:28 EShell Alias for a 'cd' followed by 'ls' Christopher Dimech
  2020-11-19  3:54 ` Stefan Kangas
@ 2020-11-19  4:49 ` Jean Louis
  2020-11-19  5:49   ` Christopher Dimech
  2020-11-20  2:12 ` Vladimir Sedach
  2 siblings, 1 reply; 16+ messages in thread
From: Jean Louis @ 2020-11-19  4:49 UTC (permalink / raw)
  To: Christopher Dimech; +Cc: Help Gnu Emacs

* Christopher Dimech <dimech@gmx.com> [2020-11-19 05:30]:
> I would like to use Eshell to call an alias 'cl' that does
> a 'cd' to a directory followed by an 'ls'.  But I do not know
> how to achieve it.

This is by using function instead of alias.

(defun cll (&optional dir)
  (cd dir)
 (eshell/ls))

I have tried with cl, but there is collision with system command cl.



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

* Re: EShell Alias for a 'cd' followed by 'ls'
  2020-11-19  4:43     ` Dan Hitt
@ 2020-11-19  4:56       ` Dan Hitt
  2020-11-19  5:18       ` Christopher Dimech
  1 sibling, 0 replies; 16+ messages in thread
From: Dan Hitt @ 2020-11-19  4:56 UTC (permalink / raw)
  To: Christopher Dimech; +Cc: Help Gnu Emacs, Stefan Kangas

On Wed, Nov 18, 2020 at 8:43 PM Dan Hitt <dan.hitt@gmail.com> wrote:

>
>
> On Wed, Nov 18, 2020 at 8:11 PM Christopher Dimech <dimech@gmx.com> wrote:
>
>> Have not found it useful.  Have tried the following.
>>
>> alias cl 'cd $* && ls $*'
>>
>
> Actually, it looks like it should be:
>
> alias cl 'cd $* ; ls'
>
> That works for me, and has the very surprising benefit that it propagates
> to all shells running in emacs, as well as working in new emacses started
> separately from the original one.
>
> So some pretty powerful, heady stuff.
>
> Thanks Stefan for pointing out the path.
>
> dan
>

Sorry for making a crusade out of this topic, but one more little piece of
data.

It looks like this works by writing the file ~/.emacs/eshell/alias

But in the file it is stored without the single quotation marks.

However, if you try to interactively define the alias without the single
quotation marks, it does not work.  Rather, what you get is two commands:
the alias, and then the ls.

So however eshell is reading the the alias file seems to not be the same as
the way it reads the command line.

Anyhow, i'll take my oar out of the water now, thanks again Stefan and
Christopher for the information.

dan


>
>
>>
>>
>> > Sent: Thursday, November 19, 2020 at 4:54 AM
>> > From: "Stefan Kangas" <stefan@marxist.se>
>> > To: "Christopher Dimech" <dimech@gmx.com>, "Help Gnu Emacs" <
>> help-gnu-emacs@gnu.org>
>> > Subject: Re: EShell Alias for a 'cd' followed by 'ls'
>> >
>> > Christopher Dimech <dimech@gmx.com> writes:
>> >
>> > > I would like to use Eshell to call an alias 'cl' that does
>> > > a 'cd' to a directory followed by an 'ls'.  But I do not know
>> > > how to achieve it.
>> >
>> > I recommend familiarizing yourself with Info, reachable via `C-h i'.
>> >
>> > You can find the Eshell manual using `m eshell RET' where you should be
>> > able to find the information you are looking for using `i alias RET'.
>> >
>> > Happy to help.
>> >
>>
>>


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

* Re: EShell Alias for a 'cd' followed by 'ls'
  2020-11-19  4:43     ` Dan Hitt
  2020-11-19  4:56       ` Dan Hitt
@ 2020-11-19  5:18       ` Christopher Dimech
  2020-11-19  6:02         ` Dan Hitt
  1 sibling, 1 reply; 16+ messages in thread
From: Christopher Dimech @ 2020-11-19  5:18 UTC (permalink / raw)
  To: Dan Hitt; +Cc: Help Gnu Emacs, Stefan Kangas

> Sent: Thursday, November 19, 2020 at 5:43 AM
> From: "Dan Hitt" <dan.hitt@gmail.com>
> To: "Christopher Dimech" <dimech@gmx.com>
> Cc: "Help Gnu Emacs" <help-gnu-emacs@gnu.org>, "Stefan Kangas" <stefan@marxist.se>
> Subject: Re: EShell Alias for a 'cd' followed by 'ls'
>
> On Wed, Nov 18, 2020 at 8:11 PM Christopher Dimech <dimech@gmx.com> wrote:
>
> > Have not found it useful.  Have tried the following.
> >
> > alias cl 'cd $* && ls $*'
> >
>
> Actually, it looks like it should be:
>
> alias cl 'cd $* ; ls'

That is fine if called within eshell.  However I want the alias be set in my emacs
init file.


> That works for me, and has the very surprising benefit that it propagates
> to all shells running in emacs, as well as working in new emacses started
> separately from the original one.
>
> So some pretty powerful, heady stuff.
>
> Thanks Stefan for pointing out the path.
>
> dan
>
>
> >
> >
> > > Sent: Thursday, November 19, 2020 at 4:54 AM
> > > From: "Stefan Kangas" <stefan@marxist.se>
> > > To: "Christopher Dimech" <dimech@gmx.com>, "Help Gnu Emacs" <
> > help-gnu-emacs@gnu.org>
> > > Subject: Re: EShell Alias for a 'cd' followed by 'ls'
> > >
> > > Christopher Dimech <dimech@gmx.com> writes:
> > >
> > > > I would like to use Eshell to call an alias 'cl' that does
> > > > a 'cd' to a directory followed by an 'ls'.  But I do not know
> > > > how to achieve it.
> > >
> > > I recommend familiarizing yourself with Info, reachable via `C-h i'.
> > >
> > > You can find the Eshell manual using `m eshell RET' where you should be
> > > able to find the information you are looking for using `i alias RET'.
> > >
> > > Happy to help.
> > >
> >
> >
>



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

* Re: EShell Alias for a 'cd' followed by 'ls'
  2020-11-19  4:49 ` Jean Louis
@ 2020-11-19  5:49   ` Christopher Dimech
  0 siblings, 0 replies; 16+ messages in thread
From: Christopher Dimech @ 2020-11-19  5:49 UTC (permalink / raw)
  To: Jean Louis; +Cc: Help Gnu Emacs

> Sent: Thursday, November 19, 2020 at 5:49 AM
> From: "Jean Louis" <bugs@gnu.support>
> To: "Christopher Dimech" <dimech@gmx.com>
> Cc: "Help Gnu Emacs" <help-gnu-emacs@gnu.org>
> Subject: Re: EShell Alias for a 'cd' followed by 'ls'
>
> * Christopher Dimech <dimech@gmx.com> [2020-11-19 05:30]:
> > I would like to use Eshell to call an alias 'cl' that does
> > a 'cd' to a directory followed by an 'ls'.  But I do not know
> > how to achieve it.
>
> This is by using function instead of alias.
>
> (defun cll (&optional dir)
>   (cd dir)
>  (eshell/ls))

I have been thinking when one would need to use

(require 'eshell)

What is its use case?

> I have tried with cl, but there is collision with system command cl.
>



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

* Re: EShell Alias for a 'cd' followed by 'ls'
  2020-11-19  5:18       ` Christopher Dimech
@ 2020-11-19  6:02         ` Dan Hitt
  2020-11-19  6:39           ` Jean Louis
  0 siblings, 1 reply; 16+ messages in thread
From: Dan Hitt @ 2020-11-19  6:02 UTC (permalink / raw)
  To: Christopher Dimech; +Cc: Help Gnu Emacs, Stefan Kangas

On Wed, Nov 18, 2020 at 9:18 PM Christopher Dimech <dimech@gmx.com> wrote:

> > Sent: Thursday, November 19, 2020 at 5:43 AM
> > From: "Dan Hitt" <dan.hitt@gmail.com>
> > To: "Christopher Dimech" <dimech@gmx.com>
> > Cc: "Help Gnu Emacs" <help-gnu-emacs@gnu.org>, "Stefan Kangas" <
> stefan@marxist.se>
> > Subject: Re: EShell Alias for a 'cd' followed by 'ls'
> >
> > On Wed, Nov 18, 2020 at 8:11 PM Christopher Dimech <dimech@gmx.com>
> wrote:
> >
> > > Have not found it useful.  Have tried the following.
> > >
> > > alias cl 'cd $* && ls $*'
> > >
> >
> > Actually, it looks like it should be:
> >
> > alias cl 'cd $* ; ls'
>
> That is fine if called within eshell.  However I want the alias be set in
> my emacs
> init file.
>
>
>
>
Well, what is your init file?

If your init file is in ~/.emacs.d/init.el, it looks like the act of typing
    alias cl 'cd $* ; ls'
to the eshell prompt will write the filesystem itself, and create or modify
the file ~/.emacs.d/eshell/alias

So that might be bad or that might be good, but it's a permanent change
(unless you edit the alias file): you need only type the characters once
and then forever after the alias is available (unless you explicitly erase
it).

Anyhow, hope you find a suitable solution that addresses the problem the
way you'd like to! :)

dan


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

* Re: EShell Alias for a 'cd' followed by 'ls'
  2020-11-19  6:02         ` Dan Hitt
@ 2020-11-19  6:39           ` Jean Louis
  2020-11-19  7:10             ` Christopher Dimech
  0 siblings, 1 reply; 16+ messages in thread
From: Jean Louis @ 2020-11-19  6:39 UTC (permalink / raw)
  To: Dan Hitt; +Cc: Christopher Dimech, Help Gnu Emacs, Stefan Kangas

* Dan Hitt <dan.hitt@gmail.com> [2020-11-19 09:04]:
> Well, what is your init file?
> 
> If your init file is in ~/.emacs.d/init.el, it looks like the act of typing
>     alias cl 'cd $* ; ls'
> to the eshell prompt will write the filesystem itself, and create or modify
> the file ~/.emacs.d/eshell/alias
> 
> So that might be bad or that might be good, but it's a permanent change
> (unless you edit the alias file): you need only type the characters once
> and then forever after the alias is available (unless you explicitly erase
> it).

It is possible to undefine alias by duing

$ alias ALIAS

and alias will be not be there any more.



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

* Re: EShell Alias for a 'cd' followed by 'ls'
  2020-11-19  6:39           ` Jean Louis
@ 2020-11-19  7:10             ` Christopher Dimech
  2020-11-19  8:52               ` Dan Hitt
  2020-11-19 21:19               ` Michael Heerdegen
  0 siblings, 2 replies; 16+ messages in thread
From: Christopher Dimech @ 2020-11-19  7:10 UTC (permalink / raw)
  To: Jean Louis; +Cc: Dan Hitt, Help Gnu Emacs, Stefan Kangas

The only caveat is that the aliases will go into an
official release and cannot require users to type them.

Have done some elisp functions for that.

---------------------
Christopher Dimech
General Administrator - Naiad Informatics - GNU Project (Geocomputation)
- Geophysical Simulation
- Geological Subsurface Mapping
- Disaster Preparedness and Mitigation
- Natural Resource Exploration and Production
- Free Software Advocacy


> Sent: Thursday, November 19, 2020 at 7:39 AM
> From: "Jean Louis" <bugs@gnu.support>
> To: "Dan Hitt" <dan.hitt@gmail.com>
> Cc: "Christopher Dimech" <dimech@gmx.com>, "Help Gnu Emacs" <help-gnu-emacs@gnu.org>, "Stefan Kangas" <stefan@marxist.se>
> Subject: Re: EShell Alias for a 'cd' followed by 'ls'
>
> * Dan Hitt <dan.hitt@gmail.com> [2020-11-19 09:04]:
> > Well, what is your init file?
> >
> > If your init file is in ~/.emacs.d/init.el, it looks like the act of typing
> >     alias cl 'cd $* ; ls'
> > to the eshell prompt will write the filesystem itself, and create or modify
> > the file ~/.emacs.d/eshell/alias
> >
> > So that might be bad or that might be good, but it's a permanent change
> > (unless you edit the alias file): you need only type the characters once
> > and then forever after the alias is available (unless you explicitly erase
> > it).
>
> It is possible to undefine alias by duing
>
> $ alias ALIAS
>
> and alias will be not be there any more.
>



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

* Re: EShell Alias for a 'cd' followed by 'ls'
  2020-11-19  7:10             ` Christopher Dimech
@ 2020-11-19  8:52               ` Dan Hitt
  2020-11-19 12:00                 ` Christopher Dimech
  2020-11-19 21:19               ` Michael Heerdegen
  1 sibling, 1 reply; 16+ messages in thread
From: Dan Hitt @ 2020-11-19  8:52 UTC (permalink / raw)
  To: Christopher Dimech; +Cc: Help Gnu Emacs, Stefan Kangas, Jean Louis

On Wed, Nov 18, 2020 at 11:10 PM Christopher Dimech <dimech@gmx.com> wrote:

> The only caveat is that the aliases will go into an
> official release and cannot require users to type them.
>
> Have done some elisp functions for that.
>
> ---------------------
> Christopher Dimech
> General Administrator - Naiad Informatics - GNU Project (Geocomputation)
> - Geophysical Simulation
> - Geological Subsurface Mapping
> - Disaster Preparedness and Mitigation
> - Natural Resource Exploration and Production
> - Free Software Advocacy
>
>
> > Sent: Thursday, November 19, 2020 at 7:39 AM
> > From: "Jean Louis" <bugs@gnu.support>
> > To: "Dan Hitt" <dan.hitt@gmail.com>
> > Cc: "Christopher Dimech" <dimech@gmx.com>, "Help Gnu Emacs" <
> help-gnu-emacs@gnu.org>, "Stefan Kangas" <stefan@marxist.se>
> > Subject: Re: EShell Alias for a 'cd' followed by 'ls'
> >
> > * Dan Hitt <dan.hitt@gmail.com> [2020-11-19 09:04]:
> > > Well, what is your init file?
> > >
> > > If your init file is in ~/.emacs.d/init.el, it looks like the act of
> typing
> > >     alias cl 'cd $* ; ls'
> > > to the eshell prompt will write the filesystem itself, and create or
> modify
> > > the file ~/.emacs.d/eshell/alias
> > >
> > > So that might be bad or that might be good, but it's a permanent change
> > > (unless you edit the alias file): you need only type the characters
> once
> > > and then forever after the alias is available (unless you explicitly
> erase
> > > it).
> >
> > It is possible to undefine alias by duing
> >
> > $ alias ALIAS
> >
> > and alias will be not be there any more.
> >
>

Thanks Jean Louis for the undo info.

Christopher --- would it suit your release process to have a standardized,
prepopulated ~/.emacs.d/eshell/alias file for your users?

I have checked that one does not need to actually define an alias through
eshell.  It suffices to modify the alias file.  (Although, to figure out
what to put into the master alias file, you may have to do experiments with
eshell.)

dan


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

* Re: EShell Alias for a 'cd' followed by 'ls'
  2020-11-19  8:52               ` Dan Hitt
@ 2020-11-19 12:00                 ` Christopher Dimech
  0 siblings, 0 replies; 16+ messages in thread
From: Christopher Dimech @ 2020-11-19 12:00 UTC (permalink / raw)
  To: Dan Hitt; +Cc: Help Gnu Emacs, Stefan Kangas, Jean Louis

> Sent: Thursday, November 19, 2020 at 9:52 AM
> From: "Dan Hitt" <dan.hitt@gmail.com>
> To: "Christopher Dimech" <dimech@gmx.com>
> Cc: "Help Gnu Emacs" <help-gnu-emacs@gnu.org>, "Stefan Kangas" <stefan@marxist.se>, "Jean Louis" <bugs@gnu.support>
> Subject: Re: EShell Alias for a 'cd' followed by 'ls'
>
> On Wed, Nov 18, 2020 at 11:10 PM Christopher Dimech <dimech@gmx.com> wrote:
>
> > The only caveat is that the aliases will go into an
> > official release and cannot require users to type them.
> >
> > Have done some elisp functions for that.
> >
> > ---------------------
> > Christopher Dimech
> > General Administrator - Naiad Informatics - GNU Project (Geocomputation)
> > - Geophysical Simulation
> > - Geological Subsurface Mapping
> > - Disaster Preparedness and Mitigation
> > - Natural Resource Exploration and Production
> > - Free Software Advocacy
> >
> >
> > > Sent: Thursday, November 19, 2020 at 7:39 AM
> > > From: "Jean Louis" <bugs@gnu.support>
> > > To: "Dan Hitt" <dan.hitt@gmail.com>
> > > Cc: "Christopher Dimech" <dimech@gmx.com>, "Help Gnu Emacs" <
> > help-gnu-emacs@gnu.org>, "Stefan Kangas" <stefan@marxist.se>
> > > Subject: Re: EShell Alias for a 'cd' followed by 'ls'
> > >
> > > * Dan Hitt <dan.hitt@gmail.com> [2020-11-19 09:04]:
> > > > Well, what is your init file?
> > > >
> > > > If your init file is in ~/.emacs.d/init.el, it looks like the act of
> > typing
> > > >     alias cl 'cd $* ; ls'
> > > > to the eshell prompt will write the filesystem itself, and create or
> > modify
> > > > the file ~/.emacs.d/eshell/alias
> > > >
> > > > So that might be bad or that might be good, but it's a permanent change
> > > > (unless you edit the alias file): you need only type the characters
> > once
> > > > and then forever after the alias is available (unless you explicitly
> > erase
> > > > it).
> > >
> > > It is possible to undefine alias by duing
> > >
> > > $ alias ALIAS
> > >
> > > and alias will be not be there any more.
> > >
> >
>
> Thanks Jean Louis for the undo info.
>
> Christopher --- would it suit your release process to have a standardized,
> prepopulated ~/.emacs.d/eshell/alias file for your users?
>
> I have checked that one does not need to actually define an alias through
> eshell.  It suffices to modify the alias file.  (Although, to figure out
> what to put into the master alias file, you may have to do experiments with
> eshell.)

I can do like that.  There is some variable that sets the path and name of
the file.

> dan
>



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

* Re: EShell Alias for a 'cd' followed by 'ls'
  2020-11-19  7:10             ` Christopher Dimech
  2020-11-19  8:52               ` Dan Hitt
@ 2020-11-19 21:19               ` Michael Heerdegen
  1 sibling, 0 replies; 16+ messages in thread
From: Michael Heerdegen @ 2020-11-19 21:19 UTC (permalink / raw)
  To: help-gnu-emacs

Christopher Dimech <dimech@gmx.com> writes:

> The only caveat is that the aliases will go into an
> official release and cannot require users to type them.

I'm not an Eshell expert, but AFAIK `eshell/alias' is the corresponding
Elisp function.

So for example this would work:

#+begin_src emacs-lisp
(add-hook 'eshell-mode-hook
          (defun my-eshell-add-aliases ()
            (cl-loop
             for alias in
             '(("mkcd" "mkdir $1; cd $1")
               ;;...
               )
             do (apply 'eshell/alias alias))))
#+end_src

That modifies the alias save file as side effect.

The aliases are stored in the variable `eshell-command-aliases-list'.
That variable doesn't seem to be intended to be modified directly,
though.

Michael.




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

* Re: EShell Alias for a 'cd' followed by 'ls'
  2020-11-19  2:28 EShell Alias for a 'cd' followed by 'ls' Christopher Dimech
  2020-11-19  3:54 ` Stefan Kangas
  2020-11-19  4:49 ` Jean Louis
@ 2020-11-20  2:12 ` Vladimir Sedach
  2020-11-20  2:21   ` Christopher Dimech
  2 siblings, 1 reply; 16+ messages in thread
From: Vladimir Sedach @ 2020-11-20  2:12 UTC (permalink / raw)
  To: Christopher Dimech; +Cc: help-gnu-emacs


Christopher Dimech <dimech@gmx.com> writes:
> I would like to use Eshell to call an alias 'cl' that does
> a 'cd' to a directory followed by an 'ls'.  But I do not know
> how to achieve it.

I am not sure whether you are already aware of this: you can achieve
the same effect by setting the eshell-list-files-after-cd variable.

Also useful is the variable documentation:

"If non-nil, call "ls" with any remaining args after doing a cd.
This is provided for convenience, since the same effect is easily
achieved by adding a function to ‘eshell-directory-change-hook’ that
calls "ls" and references ‘eshell-last-arguments’."

--
Vladimir Sedach
Software engineering services in Los Angeles https://oneofus.la



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

* Re: EShell Alias for a 'cd' followed by 'ls'
  2020-11-20  2:12 ` Vladimir Sedach
@ 2020-11-20  2:21   ` Christopher Dimech
  0 siblings, 0 replies; 16+ messages in thread
From: Christopher Dimech @ 2020-11-20  2:21 UTC (permalink / raw)
  To: Vladimir Sedach; +Cc: help-gnu-emacs


> Sent: Friday, November 20, 2020 at 3:12 AM
> From: "Vladimir Sedach" <vas@oneofus.la>
> To: "Christopher Dimech" <dimech@gmx.com>
> Cc: help-gnu-emacs@gnu.org
> Subject: Re: EShell Alias for a 'cd' followed by 'ls'
>
> 
> Christopher Dimech <dimech@gmx.com> writes:
> > I would like to use Eshell to call an alias 'cl' that does
> > a 'cd' to a directory followed by an 'ls'.  But I do not know
> > how to achieve it.
> 
> I am not sure whether you are already aware of this: you can achieve
> the same effect by setting the eshell-list-files-after-cd variable.

No, I did not know that.
 
> Also useful is the variable documentation:
> 
> "If non-nil, call "ls" with any remaining args after doing a cd.
> This is provided for convenience, since the same effect is easily
> achieved by adding a function to ‘eshell-directory-change-hook’ that
> calls "ls" and references ‘eshell-last-arguments’."
> 
> --
> Vladimir Sedach
> Software engineering services in Los Angeles https://oneofus.la
>



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

end of thread, other threads:[~2020-11-20  2:21 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-19  2:28 EShell Alias for a 'cd' followed by 'ls' Christopher Dimech
2020-11-19  3:54 ` Stefan Kangas
2020-11-19  4:10   ` Christopher Dimech
2020-11-19  4:43     ` Dan Hitt
2020-11-19  4:56       ` Dan Hitt
2020-11-19  5:18       ` Christopher Dimech
2020-11-19  6:02         ` Dan Hitt
2020-11-19  6:39           ` Jean Louis
2020-11-19  7:10             ` Christopher Dimech
2020-11-19  8:52               ` Dan Hitt
2020-11-19 12:00                 ` Christopher Dimech
2020-11-19 21:19               ` Michael Heerdegen
2020-11-19  4:49 ` Jean Louis
2020-11-19  5:49   ` Christopher Dimech
2020-11-20  2:12 ` Vladimir Sedach
2020-11-20  2:21   ` Christopher Dimech

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).