Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'assignment': 0.07; 'modify': 0.07; 'bash': 0.09; 'received:151': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'statements': 0.09; 'assume': 0.14; 'default)': 0.16; 'emanuele': 0.16; 'fetches': 0.16; 'presume': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'pushed': 0.16; 'basically': 0.19; 'finished': 0.19; 'typing': 0.19; 'not,': 0.20; '>>>': 0.22; 'input': 0.22; 'header:User-Agent:1': 0.23; 'skip': 0.24; 'regardless': 0.24; 'looks': 0.24; "i've": 0.25; 'least': 0.26; 'gets': 0.27; 'header:X-Complaints-To:1': 0.27; 'lines': 0.31; 'correctly.': 0.31; 'subject:next': 0.31; 'writes:': 0.31; 'yes.': 0.31; 'sequence': 0.36; 'next': 0.36; 'clear': 0.37; 'easily': 0.37; 'skip:o 20': 0.38; 'to:addr:python-list': 0.38; 'does': 0.39; 'sure': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'che': 0.60; 'you.': 0.62; 'back': 0.62; 'reach': 0.63; '(that': 0.65; 'series': 0.66; 'here': 0.66; 'press': 0.70; 'subject:get': 0.81; 'disappear': 0.84; 'keystrokes': 0.84; 'quando': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Lele Gaifax Subject: Re: Adapt bash readline operate-and-get-next Date: Tue, 19 Aug 2014 10:44:41 +0200 Organization: Nautilus Entertainments References: <232acf45-096d-466a-aa75-06d8c378b128@googlegroups.com> <53cc376e$0$2898$e4fe514c@news.xs4all.nl> <53926733-5e65-482f-96bc-0171c6a93d59@googlegroups.com> <4882fd4d-b772-4ebb-8aaa-0c20be6051b6@googlegroups.com> <53cd47fc$0$6574$c3e8da3$5496439d@news.astraweb.com> <87egwdiqfq.fsf_-_@nautilus.nautilus> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Gmane-NNTP-Posting-Host: 151.62.28.218 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.93 (gnu/linux) Cancel-Lock: sha1:mb4Igh/P52CwGbC2zLXUGvpmX4c= X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 55 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1408437898 news.xs4all.nl 2974 [2001:888:2000:d::a6]:35951 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:76544 Skip Montanaro writes: > Looks reasonable to me, at least if I understand the intent correctly. > I've never used this functionality in bash (wasn't aware it existed). > I assume the intention here is to easily re-execute compound > statements pulled from saved history. Yes, or any arbitrary sequence of statements/expressions. > Does your position in the history disappear if you > operate_and_get_next(), then modify the next recalled input line? Not sure what you mean with "disappear": basically o-a-g-n "accepts" the current line (that is, "executes" it, and this means it gets pushed at the top of history), regardless you edited or not, then fetches the following input line from the history and presents it to you. Given these lines in the history: >>> a=10 >>> a-=1 >>> print(a) 9 Going back twice, to reach the assignment to "a", and then typing ^O (bound to o-a-g-n by default) repeatedly, you get: >>> a-=1 >>> print(a) 8 >>> a-=1 >>> print(a) 7 >>> a-=1 >>> print(a) 6 >>> a-=1 >>> print(a) 5 >>> a-=1[#] where the "[#]" is the input cursor. > When you are finished with a series of Ctl-O > keystrokes I presume you (as the user) press Ctl-U or Ctl-K to clear > the input buffer? Yes. ciao, lele. -- nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia. lele@metapensiero.it | -- Fortunato Depero, 1929.