bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: PROMPT_COMMAND is not executed after edit-and-execute-command


From: Chet Ramey
Subject: Re: PROMPT_COMMAND is not executed after edit-and-execute-command
Date: Thu, 18 Mar 2021 15:49:33 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.8.1

On 3/18/21 11:29 AM, earnestly wrote:
When using edit-and-execute-command to edit the command-line I've
noticed that PROMPT_COMMAND is not evaluated upon returning to the
prompt

It shouldn't be. Bash executes PROMPT_COMMAND before it calls readline to
read the first line of a command.

edit-and-execute-command is a bindable readline command. All the commands
executed as a result of it happen in the context of a single call to
readline(), and it is readline that redisplays the prompt when edit-and-
execute-command completes. The readline() call doesn't return the line at
that point.

Since readline prints the prompt as part of redisplay, and it doesn't know
anything about PROMPT_COMMAND or command execution, it doesn't execute it.


--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]