emacs hg-histedit and an alias
Uwe Brauer
oub at mat.ucm.es
Wed Oct 9 17:45:19 UTC 2024
>>> "SF" == Steve Fink <sphink at gmail.com> writes:
hi Steve
>>
>> 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))
Somehow the function confuses me because it uses also "--rev" which is
an argument for histedit, but most likely this does not require a shell.
Thanks very much for this clarification that was very useful.
Unfortunately your elisp suggestion did not work, emacs is just ignoring
the command jumps to the end of the function and executes
(message "Histedit finished.")
I shall ask the elisp elders.
--
I strongly condemn Hamas heinous despicable pogroms/atrocities on Israel
I strongly condemn Putin's war of aggression against Ukraine.
I support to deliver weapons to Ukraine's military.
I support the EU and NATO membership of Ukraine.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5684 bytes
Desc: not available
URL: <http://lists.mercurial-scm.org/pipermail/mercurial/attachments/20241009/6bc904d7/attachment.p7s>
More information about the Mercurial
mailing list