On 01/12/2017 11:15 AM, David Wright wrote: > On Thu 12 Jan 2017 at 01:05:06 (-0500), kamaraju kusumanchi wrote: >> On Wed, Jan 11, 2017 at 11:53 PM, David Wright <deblis@lionunicorn.co.uk> wrote: >>> On Wed 11 Jan 2017 at 22:38:48 (-0500), kamaraju kusumanchi wrote: >>> >>>> Just unalias the alias corresponding to edit (the one you set up in >>>> ~/.zshrc) before launching reportbug. After that set it back. IIUC >>>> there is no need to launch a bash subshell to do this. You can do >>>> everything while you are in zsh. >>>> >>>> So the sequence of commands would be >>>> >>>> % unalias edit >>>> % reportbug & >>>> % alias edit='emacsclient -c -s /tmp/emacs1000/server' >>> If you're going to do it that way, you've really got to >>> interrogate the old value and restore it afterwards, rather >>> than having edit defined in two places. Otherwise, how do >>> you keep them in sync. >>> >>> Most people wouldn't run reportbug often enough to worry >>> about a subshell, would they? >> There are always multiple ways to solve a problem often with different >> advantages/disadvantages. I do not have a problem with subshell per >> se. My point is that the previously proposed solution requires OP to >> start a different shell (i.e. zsh users starting bash). What is to >> assume that there is no such alias defined in ~/.bashrc? > No, I did not propose that the OP start a different type of shell. > It surprised me that the OP did. My thinking there was that I'd be able to not have to work around not reading my zshrc, but unalias and re-source does work just as well. > > My solution was to start a subshell of the same type as their normal > shell. However, as I'm only familiar with bash, I started off with > "In bash, ..." and finished with "I haven't bothered to search all > the subsections of man zsh, but there may be something similar." > > In other words, I think the OP could do a similar thing (start a > subshell with edit unaliased) entirely in zsh. However, unlike with > bash, which covers most things in "man bash", zsh appears to have > 17 man pages. Commands like alias/unalias are typically builtin. > I am not going to the bother of searching all 17 for the appropriate > incantations in zsh. I left that as an exercise for the OP to check > out in their own (or any other) shell. > >> Little bit of a side note: I work on systems where my home directory >> is mounted across multiple machines. On different machines I use >> different shells. To keep my aliases synced across all these machines, >> I place all my aliases in a separate file and source that file in >> ~/.zshrc, ~/.bashrc etc., > Then you're a better person than I am to check/know whether my method > is possible with zsh. I would still maintain that defining the same > alias in two places is not good advice. But then, my advice would > be to use, say, edt rather than edit as the alias. I have two aliases > for emacs: nwemacs and bigemacs (nw<TAB> and big<TAB> suffice). > Others have suggested not to use an alias at all. > > Cheers, > David. > -- Boyan Penkov www.boyanpenkov.com
Attachment:
signature.asc
Description: OpenPGP digital signature