emacs hg-histedit and an alias
Steve Fink
sphink at gmail.com
Wed Oct 9 17:05:29 UTC 2024
>
> histed = !TMP=$($HG root) $HG histedit "$@"
>
>
The ! character is specific to the config file, and marks the alias as a
command to run. The shell part starts immediately after it.
"$@" means to pass through any additional command line arguments to the
command. When running it as a shell command, you're giving the arguments
directly, so do not need to pass anything through.
$HG is replaced by the name of the hg executable, so can just be hg.
Thus, the simplest replacement would just be:
TMP=$(hg root) hg histedit
though my pedantic side would spell that
TMP="$(hg root)" hg histedit
in case you ran it from a directory named "/home/uwe/never rm -rf/" and
accidentally deleted a bunch of stuff.
But also, that TMP=... syntax is for the shell command line only. It is not
something you can execute. For that, you'd want
env TMP="$(hg root)" hg histedit
(env is /bin/env, which is a command for running other commands with
environment variables set.)
Except none of this is likely to help because you're configuring emacs to
run an executable with certain arguments, and there's no shell involved, so
passing in something like `("env" "TMP=$(hg root)..."...) isn't going to
work because there's no shell to expand $(hg root).
I don't know elisp very well, but I would guess you want something like
`("bash" "-c" ,(concat "TMP=$(" hg-histedit-executable " root) "
hg-histedit-executable " --rev " changeset))
(I'm sure there's a cleaner way, using shell-command-to-string or
something, but I don't know enough to come up with it)
None of this is changing where histedit or gnuclient are running from,
though; it's just running `hg histedit` with the environment variable TMP
set to the root of your checkout. Presumably that means something to hg
and/or gnuclient.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial/attachments/20241009/2d7e0b17/attachment.html>
More information about the Mercurial
mailing list