enhancement merge request
Hello Brian and Chet, Please consider merging the enhancement made by Naseeba described here : https://github.com/ananthchellappa/bash-5.1/blob/main/README.md Thanks, Ananth
Re: enhancement merge request
Chet, Lawrence, Sincerely appreciate your time. Far as I understand, there is no way to accomplish what I want - concisely : *get a true private mode* (no logging to HISTFILE *OR* recall with history command after exiting private-mode (toggle of history using set -/+ o) *without sacrificing productivity*. That is, when you are *in private mode, you DO WANT recall with !number and arrow keys. *Even this guy https://paulh.consulting/ thought it was easy before deciding it was worth $500 of his time to try adding it :) Naseeba's implementation gives me what I need. I'd like others to benefit from it.. With current bash : analog@DESKTOP-O264A5N ~ $ echo $HISTFILE /home/analog/.bash_history analog@DESKTOP-O264A5N ~ $ unset HISTFILE analog@DESKTOP-O264A5N ~ $ echo a private command a private command analog@DESKTOP-O264A5N ~ $ echo an evil command an evil command analog@DESKTOP-O264A5N ~ $ h 10 2143 echo $HISTFILE 2144 set +o history 2145 h 10 2146 source /tmp/set_pm 2147 search roberge 2148 echo $HISTFILE 2149 unset HISTFILE 2150 echo a private command 2151 echo an evil command 2152 h 10 analog@DESKTOP-O264A5N ~ $ set HISTFILE=/home/analog/.bash_history analog@DESKTOP-O264A5N ~ $ h 15 2140 echo "set +o history" > /tmp/set_pm 2141 . /tmp/set_pm 2142 h 10 2143 echo $HISTFILE 2144 set +o history 2145 h 10 2146 source /tmp/set_pm 2147 search roberge 2148 echo $HISTFILE 2149 unset HISTFILE 2150 echo a private command < Yikes, this was in private mode! I shouldn't see this after "exiting" 2151 echo an evil command < private mode. LV suggested that using HISTFILE unset/set would be be 2152 h 10 2153 set HISTFILE=/home/analog/.bash_history 2154 h 15 On Sun, Apr 18, 2021 at 3:02 PM Chet Ramey wrote: > On 4/18/21 12:03 AM, Ananth Chellappa wrote: > > Hello Brian and Chet, > > Please consider merging the enhancement made by Naseeba > described > > here : > > What is the ultimate goal of this change? And, whatever it is, why is it > better than currently-available ways to accomplish the same thing? > > -- > ``The lyf so short, the craft so long to lerne.'' - Chaucer > ``Ars longa, vita brevis'' - Hippocrates > Chet Ramey, UTech, CWRUc...@case.eduhttp://tiswww.cwru.edu/~chet/ >
Re: enhancement merge request
But have I conveyed the functionality I'm seeking? Naseeba's version works perfectly.. I agree I can't assert the existing version doesn't provide it. I'm happy to learn how to use it to meet my needs.. The best change is always no change. On Sun, Apr 18, 2021 at 9:18 PM Lawrence Velázquez wrote: > > On Apr 18, 2021, at 7:12 PM, Ananth Chellappa > wrote: > > > > Even this guy https://paulh.consulting/ > > thought it was easy before deciding it was worth $500 of his time to try > > adding it :) > > I don't know who "this guy" is. There are a lot of very skilled > developers who aren't specifically versed in the paradigms or > particulars of shells. There's nothing wrong with that, but it's > also not really a compelling argument in favor of changing the > fundamental behavior of a shell option. > > > analog@DESKTOP-O264A5N ~ $ set HISTFILE=/home/analog/.bash_history > > This does not set the HISTFILE shell variable or affect the history > mechanism in any way. It clears all positional parameters except > the first, which is set to 'HISTFILE=/home/analog/.bash_history'. > > > 2150 echo a private command < Yikes, this was in private mode! I > > shouldn't see this after "exiting" > > 2151 echo an evil command < private mode. LV suggested that > using > > HISTFILE unset/set would be be > > HISTFILE doesn't affect the internal history list, only the external > history file. It wasn't clear to me that you cared about the former. > > -- > vq >
Re: enhancement merge request
Thanks. Rube Goldberg would approve🙂 On Sun, Apr 18, 2021 at 10:17 PM Grisha Levit wrote: > On Sun, Apr 18, 2021, 7:13 PM Ananth Chellappa > wrote: > >> Far as I understand, there is no >> way to accomplish what I want - concisely : *get a true private mode* (no >> logging to HISTFILE *OR* recall with history command after exiting >> private-mode (toggle of history using set -/+ o) *without sacrificing >> productivity*. >> > > I think you can do something similar to the patch directly in the shell by > temporarily unsetting HISTFILE and then deleting history entries in a > certain range and restoring HISTFILE when you are ready, like: > > hist_pause() { > [[ -z ${pause_histcmd-} ]] || return > pause_histcmd=$HISTCMD > old_histfile=$HISTFILE > history -a # in case we exit w/o hist_resume > HISTFILE= > } > hist_resume() { > [[ -n ${pause_histcmd-} ]] || return > local i > for ((i=HISTCMD; i>pause_histcmd; i--)); do > history -d $i > done > unset pause_histcmd > HISTFILE=$old_histfile > } > > Or, alternatively, unset HISTFILE, write out the current history to a > temporary file (`history -w $file') and then later clear the history > (`history -c'), read in the temporary file (`history -r $file'), and > restore HISTFILE. > > The latter approach might be slightly more robust but, note that the > history list will be re-numbered to start at 1 after restoring. > >>
help adding some features to 5.1
Hi Team, Could I get some help locating portions of the code that would need to be tweaked to add these features? If I had the time, I would love to get to know the code, but I have too much going on in my real job. 1. Intelligent support for !$ (and related - like !2$, !-N, etc) : This means - ignore the & at the end of the previous command. 2. Autocomplete for !$ (and related tokens) : This means - if I have typed !$ and now press TAB, I want the last word from the previous command substituted on the command-line immediately. Thanks sincerely, Ananth
Re: help adding some features to 5.1
Thanks Sincerely Chet. I hope I can make a genuine contribution at some point. On Wed, Sep 1, 2021 at 12:27 PM Chet Ramey wrote: > On 8/31/21 6:38 PM, Ananth Chellappa wrote: > > Hi Team, > >Could I get some help locating portions of the code that would > need > > to be tweaked to add these features? > > > > If I had the time, I would love to get to know the code, but I have too > > much going on in my real job. > > > > 1. Intelligent support for !$ (and related - like !2$, !-N, etc) : This > > means - ignore the & at the end of the previous command. > > This is part of the history library: lib/readline/histexpand.c. Keep in > mind that history expansion has never worked like this, so "intelligent" > is subjective. > > > 2. Autocomplete for !$ (and related tokens) : This means - if I have > typed > > !$ and now press TAB, I want the last word from the previous command > > substituted on the command-line immediately. > > This is part of bash-specific word completion: bashline.c. > > > -- > ``The lyf so short, the craft so long to lerne.'' - Chaucer > ``Ars longa, vita brevis'' - Hippocrates > Chet Ramey, UTech, CWRUc...@case.eduhttp://tiswww.cwru.edu/~chet/ >
Re: help adding some features to 5.1
Just for me :) I know my productivity will be higher. Eventually I'll do a YouTube video on it. If we see enough adoption, we can consider rolling them in. !$ picking up & from the previous command really is a no no :) On Wed, Sep 1, 2021 at 6:36 PM Lawrence Velázquez wrote: > On Wed, Sep 1, 2021, at 8:20 PM, Ananth Chellappa wrote: > > I hope I can make a genuine contribution at some point. > > If you're hoping/planning on getting these changes accepted into > bash, it might be worth hashing out details with Chet before expending > your time and energy. (I am not a contributor, nor do I have any > formal affiliation with the project. I just write email.) > > On the other hand, if this is for yourself, then hack away! > > -- > vq >