* comint-accumulate-marker @ 2006-04-13 19:45 JD Smith 2006-04-16 0:19 ` comint-accumulate-marker Bob Portmann 2006-04-16 2:09 ` comint-accumulate-marker Richard Stallman 0 siblings, 2 replies; 26+ messages in thread From: JD Smith @ 2006-04-13 19:45 UTC (permalink / raw) `comint-accumulate-marker' should (I believe) be left at the process mark when lines are accumulated. To see this: M-x shell echo this is test 1 [RET] echo this is test 2; [C-c SPC] echo this is more test 2 [M-p] The entire accumulated command should be replaced by the previous item on the input history, but it is not, since the accumulate marker was moved to the beginning of the 2nd line ("this is more test 2"), and use to mark the beginning of the region which is replaced by the historical command. I noticed this while I was implementing a comint feature in my IDLWAVE mode. It occurs to me that this feature might be a useful option for all comint modes, and might be better added there. In a terminal shell, using up arrow to recall history doesn't clobber the partially complete command you are composin. If you go back down, it is still there (even if it's blank). Not so in comint modes. Going down with M-p only wraps you around the input ring. You can emulate the terminal shell behavior by pretending there is another node on the ring between index 0 and the last ring index, and save the partially completed command when you stop "on" or "off" the ring. I'd envision this as a user option. Do we have a 22.1 pre-release branch where only bug-fixes are being applied, vs. HEAD where new features are being placed? ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: comint-accumulate-marker 2006-04-13 19:45 comint-accumulate-marker JD Smith @ 2006-04-16 0:19 ` Bob Portmann 2006-04-16 2:09 ` comint-accumulate-marker Richard Stallman 1 sibling, 0 replies; 26+ messages in thread From: Bob Portmann @ 2006-04-16 0:19 UTC (permalink / raw) --- JD Smith <jdsmith@as.arizona.edu> wrote: > `comint-accumulate-marker' should (I believe) be left at the process > mark when lines are accumulated. To see this: > > M-x shell > echo this is test 1 [RET] > echo this is test 2; [C-c SPC] > echo this is more test 2 [M-p] > > The entire accumulated command should be replaced by the previous > item > on the input history, but it is not, since the accumulate marker was > moved to the beginning of the 2nd line ("this is more test 2"), and > use to > mark the beginning of the region which is replaced by the historical > command. > > I noticed this while I was implementing a comint feature in my > IDLWAVE > mode. It occurs to me that this feature might be a useful option for > all comint modes, and might be better added there. In a terminal > shell, using up arrow to recall history doesn't clobber the partially > complete command you are composing. If you go back down, it is still > there (even if it's blank). I, for one, would welcome this change in shell (and other shell like) modes. I MUCH prefer the way regular terms work where one can go up in the history and then back down and still have a blank line (or whatever was there). Going immediately to the opposite end of the ring is disorienting when one has lots (1000+) of things saved in the history. And then it is a pain to type C-x u to get a blank line again. It also seems to go against the emacs philosophy that this behavior cannot (easily) be configured. Bob > Not so in comint modes. Going down with > M-p only wraps you around the input ring. You can emulate the > terminal shell behavior by pretending there is another node on the > ring between index 0 and the last ring index, and save the partially > completed command when you stop "on" or "off" the ring. I'd envision > this as a user option. > > Do we have a 22.1 pre-release branch where only bug-fixes are being > applied, vs. HEAD where new features are being placed? > > > > > _______________________________________________ > Emacs-devel mailing list > Emacs-devel@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-devel > __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: comint-accumulate-marker 2006-04-13 19:45 comint-accumulate-marker JD Smith 2006-04-16 0:19 ` comint-accumulate-marker Bob Portmann @ 2006-04-16 2:09 ` Richard Stallman 2006-04-17 18:06 ` comint-accumulate-marker JD Smith 1 sibling, 1 reply; 26+ messages in thread From: Richard Stallman @ 2006-04-16 2:09 UTC (permalink / raw) Cc: emacs-devel M-x shell echo this is test 1 [RET] echo this is test 2; [C-c SPC] echo this is more test 2 [M-p] The entire accumulated command should be replaced by the previous item on the input history, but it is not, It isn't clear to me which behavior is right, for this case. After the release we could look at the arguments for and against the change. In a terminal shell, using up arrow to recall history doesn't clobber the partially complete command you are composin. If you go back down, it is still there (even if it's blank). Not so in comint modes. Going down with M-p only wraps you around the input ring. This would clearly be an improvement. Can you implement it? ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: comint-accumulate-marker 2006-04-16 2:09 ` comint-accumulate-marker Richard Stallman @ 2006-04-17 18:06 ` JD Smith 2006-04-18 9:47 ` comint-accumulate-marker Nick Roberts 2006-04-18 12:57 ` comint-accumulate-marker Richard Stallman 0 siblings, 2 replies; 26+ messages in thread From: JD Smith @ 2006-04-17 18:06 UTC (permalink / raw) On Sat, 15 Apr 2006 22:09:39 -0400, Richard Stallman wrote: > In a terminal > shell, using up arrow to recall history doesn't clobber the partially > complete command you are composin. If you go back down, it is still > there (even if it's blank). Not so in comint modes. Going down with > M-p only wraps you around the input ring. > > This would clearly be an improvement. Can you implement it? Here is a patch which implements this behavior. I've added a custom variable controlling whether it is on or off, and have left it off by default for now. If people like it and think it would be generically useful, I can enable it by default. JD Index: comint.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/comint.el,v retrieving revision 1.337 diff -w -b -c -c -r1.337 comint.el *** comint.el 27 Mar 2006 08:50:20 -0000 1.337 --- comint.el 17 Apr 2006 17:59:10 -0000 *************** *** 251,256 **** --- 251,263 ---- file) :group 'comint) + (defcustom comint-save-partial-input nil + "*If non-nil, save partial input at the prompt when cycling through history. + The saved input is recovered when moving off of the end of input + history in either direction. If no input, restores blank line." + :type 'boolean + :group 'comint) + (defcustom comint-scroll-to-bottom-on-input nil "*Controls whether input to interpreter causes window to scroll. If nil, then do not scroll. If t or `all', scroll all windows showing buffer. *************** *** 558,563 **** --- 565,573 ---- "Non-nil if you are accumulating input lines to send as input together. The command \\[comint-accumulate] sets this.") + (defvar comint-stored-incomplete-input nil + "Stored input for history cycling.") + (put 'comint-replace-by-expanded-history 'menu-enable 'comint-input-autoexpand) (put 'comint-input-ring 'permanent-local t) (put 'comint-input-ring-index 'permanent-local t) *************** *** 638,643 **** --- 648,654 ---- (make-local-variable 'comint-scroll-to-bottom-on-input) (make-local-variable 'comint-move-point-for-output) (make-local-variable 'comint-scroll-show-maximum-output) + (make-local-variable 'comint-stored-incomplete-input) ;; This makes it really work to keep point at the bottom. (make-local-variable 'scroll-conservatively) (setq scroll-conservatively 10000) *************** *** 1034,1043 **** (ring-length comint-input-ring)) arg))) (defun comint-previous-input (arg) ! "Cycle backwards through input history." (interactive "*p") (comint-previous-matching-input "." arg)) (defun comint-next-input (arg) "Cycle forwards through input history." --- 1045,1078 ---- (ring-length comint-input-ring)) arg))) + (defun comint-previous-input (arg) ! "Cycle backwards through input history. ! Save incomplete input if `comint-save-partial-input' is non-nil." (interactive "*p") + (if comint-save-partial-input + (if (and comint-input-ring-index + (or ;; leaving the "end" of the ring + (and (< arg 0) ; going down + (eq comint-input-ring-index 0)) + (and (> arg 0) ; going up + (eq comint-input-ring-index + (1- (ring-length comint-input-ring))))) + comint-stored-incomplete-input) + (progn + (goto-char (point-max)) + (comint-delete-input) + (when (> (length comint-stored-incomplete-input) 0) + (insert comint-stored-incomplete-input) + (message "Incomplete input restored")) + (setq comint-input-ring-index nil)) + ;; If leaving edit line, save partial input + (if (null comint-input-ring-index) ;not yet on ring + (setq comint-stored-incomplete-input + (funcall comint-get-old-input))) + (goto-char (point-max)) (comint-previous-matching-input "." arg)) + (comint-previous-matching-input "." arg))) (defun comint-next-input (arg) "Cycle forwards through input history." *************** *** 1077,1082 **** --- 1112,1125 ---- (if (string-match regexp (ring-ref comint-input-ring n)) n))) + (defun comint-delete-input () + "Delete all input between accumulation or process mark and point." + (delete-region + ;; Can't use kill-region as it sets this-command + (or (marker-position comint-accum-marker) + (process-mark (get-buffer-process (current-buffer)))) + (point))) + (defun comint-previous-matching-input (regexp n) "Search backwards through input history for match for REGEXP. \(Previous history elements are earlier commands.) *************** *** 1090,1100 **** (error "Not found") (setq comint-input-ring-index pos) (message "History item: %d" (1+ pos)) ! (delete-region ! ;; Can't use kill-region as it sets this-command ! (or (marker-position comint-accum-marker) ! (process-mark (get-buffer-process (current-buffer)))) ! (point)) (insert (ring-ref comint-input-ring pos))))) (defun comint-next-matching-input (regexp n) --- 1133,1139 ---- (error "Not found") (setq comint-input-ring-index pos) (message "History item: %d" (1+ pos)) ! (comint-delete-input) (insert (ring-ref comint-input-ring pos))))) (defun comint-next-matching-input (regexp n) ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: comint-accumulate-marker 2006-04-17 18:06 ` comint-accumulate-marker JD Smith @ 2006-04-18 9:47 ` Nick Roberts 2006-04-18 11:25 ` comint-accumulate-marker Stefan Monnier 2006-04-18 12:57 ` comint-accumulate-marker Richard Stallman 1 sibling, 1 reply; 26+ messages in thread From: Nick Roberts @ 2006-04-18 9:47 UTC (permalink / raw) Cc: emacs-devel > > In a terminal > > shell, using up arrow to recall history doesn't clobber the partially > > complete command you are composin. If you go back down, it is still > > there (even if it's blank). Not so in comint modes. Going down with > > M-p only wraps you around the input ring. > > > > This would clearly be an improvement. Can you implement it? > > Here is a patch which implements this behavior. I've added a custom > variable controlling whether it is on or off, and have left it off by > default for now. If people like it and think it would be > generically useful, I can enable it by default. > > JD This patch works for me. ... > + (defcustom comint-save-partial-input nil > + "*If non-nil, save partial input at the prompt when cycling through history. > + The saved input is recovered when moving off of the end of input > + history in either direction. If no input, restores blank line." > + :type 'boolean > + :group 'comint) ... How about (current input is a term already used in comint.el): (defcustom comint-keep-current-input t "If non-nil, don't clobber the current input when cycling through history." (Since it's an improvement why not make it the default? Most people won't even know/need to know it's an option). -- Nick http://www.inet.net.nz/~nickrob ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: comint-accumulate-marker 2006-04-18 9:47 ` comint-accumulate-marker Nick Roberts @ 2006-04-18 11:25 ` Stefan Monnier 2006-04-18 20:50 ` comint-accumulate-marker Richard Stallman 0 siblings, 1 reply; 26+ messages in thread From: Stefan Monnier @ 2006-04-18 11:25 UTC (permalink / raw) Cc: emacs-devel, JD Smith >> + (defcustom comint-save-partial-input nil >> + "*If non-nil, save partial input at the prompt when cycling through history. >> + The saved input is recovered when moving off of the end of input >> + history in either direction. If no input, restores blank line." >> + :type 'boolean >> + :group 'comint) > ... > How about (current input is a term already used in comint.el): > (defcustom comint-keep-current-input t > "If non-nil, don't clobber the current input when cycling through history." > (Since it's an improvement why not make it the default? Most people won't > even know/need to know it's an option). Why bother making it a configuration option, even? Stefan ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: comint-accumulate-marker 2006-04-18 11:25 ` comint-accumulate-marker Stefan Monnier @ 2006-04-18 20:50 ` Richard Stallman 0 siblings, 0 replies; 26+ messages in thread From: Richard Stallman @ 2006-04-18 20:50 UTC (permalink / raw) Cc: nickrob, jdsmith, emacs-devel > (Since it's an improvement why not make it the default? Most people won't > even know/need to know it's an option). Why bother making it a configuration option, even? I tend to agree that we don't need an option for this. The change simply makes the feature work correctly. ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: comint-accumulate-marker 2006-04-17 18:06 ` comint-accumulate-marker JD Smith 2006-04-18 9:47 ` comint-accumulate-marker Nick Roberts @ 2006-04-18 12:57 ` Richard Stallman 2006-04-18 19:10 ` comint-accumulate-marker JD Smith 1 sibling, 1 reply; 26+ messages in thread From: Richard Stallman @ 2006-04-18 12:57 UTC (permalink / raw) Cc: emacs-devel Please install it, and enable it by default. The reason this is ok to install now is that the current behavior is wrong. ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: comint-accumulate-marker 2006-04-18 12:57 ` comint-accumulate-marker Richard Stallman @ 2006-04-18 19:10 ` JD Smith 2006-04-18 20:54 ` comint-accumulate-marker David Kastrup ` (3 more replies) 0 siblings, 4 replies; 26+ messages in thread From: JD Smith @ 2006-04-18 19:10 UTC (permalink / raw) Cc: emacs-devel On Apr 18, 2006, at 5:57 AM, Richard Stallman wrote: > Please install it, and enable it by default. The reason this > is ok to install now is that the current behavior is wrong. I will install it shortly, but wanted to run one more variant of the patch by everyone first. This version is permanently enabled. It also saves input even when you use M-r/M-s, and it binds "C-c C-g" to a new function `comint-restore-input', so no matter where you are on the history ring, you can zap back to your stranded partial input with C-c C-g. Let me know if that's a good binding (and where it should be documented). JD Index: comint.el =================================================================== RCS file: /sources/emacs/emacs/lisp/comint.el,v retrieving revision 1.337 diff -c -r1.337 comint.el *** comint.el 27 Mar 2006 08:50:20 -0000 1.337 --- comint.el 18 Apr 2006 19:06:05 -0000 *************** *** 465,470 **** --- 465,471 ---- (define-key map "\C-c\C-l" 'comint-dynamic-list-input-ring) (define-key map "\C-c\C-n" 'comint-next-prompt) (define-key map "\C-c\C-p" 'comint-previous-prompt) + (define-key map "\C-c\C-g" 'comint-restore-input) (define-key map "\C-c\C-d" 'comint-send-eof) (define-key map "\C-c\C-s" 'comint-write-output) (define-key map "\C-c." 'comint-insert-previous-argument) *************** *** 558,563 **** --- 559,567 ---- "Non-nil if you are accumulating input lines to send as input together. The command \\[comint-accumulate] sets this.") + (defvar comint-stored-incomplete-input nil + "Stored input for history cycling.") + (put 'comint-replace-by-expanded-history 'menu-enable 'comint- input-autoexpand) (put 'comint-input-ring 'permanent-local t) (put 'comint-input-ring-index 'permanent-local t) *************** *** 638,643 **** --- 642,648 ---- (make-local-variable 'comint-scroll-to-bottom-on-input) (make-local-variable 'comint-move-point-for-output) (make-local-variable 'comint-scroll-show-maximum-output) + (make-local-variable 'comint-stored-incomplete-input) ;; This makes it really work to keep point at the bottom. (make-local-variable 'scroll-conservatively) (setq scroll-conservatively 10000) *************** *** 1015,1020 **** --- 1020,1035 ---- (t arg))) + (defun comint-restore-input () + "Restore unfinished input." + (interactive) + (when comint-input-ring-index + (comint-delete-input) + (when (> (length comint-stored-incomplete-input) 0) + (insert comint-stored-incomplete-input) + (message "Input restored")) + (setq comint-input-ring-index nil))) + (defun comint-search-start (arg) "Index to start a directional search, starting at `comint-input- ring-index'." (if comint-input-ring-index *************** *** 1035,1043 **** arg))) (defun comint-previous-input (arg) ! "Cycle backwards through input history." (interactive "*p") ! (comint-previous-matching-input "." arg)) (defun comint-next-input (arg) "Cycle forwards through input history." --- 1050,1067 ---- arg))) (defun comint-previous-input (arg) ! "Cycle backwards through input history, saving input." (interactive "*p") ! (if (and comint-input-ring-index ! (or ;; leaving the "end" of the ring ! (and (< arg 0) ; going down ! (eq comint-input-ring-index 0)) ! (and (> arg 0) ; going up ! (eq comint-input-ring-index ! (1- (ring-length comint-input-ring))))) ! comint-stored-incomplete-input) ! (comint-restore-input) ! (comint-previous-matching-input "." arg))) (defun comint-next-input (arg) "Cycle forwards through input history." *************** *** 1077,1082 **** --- 1101,1114 ---- (if (string-match regexp (ring-ref comint-input-ring n)) n))) + (defun comint-delete-input () + "Delete all input between accumulation or process mark and point." + (delete-region + ;; Can't use kill-region as it sets this-command + (or (marker-position comint-accum-marker) + (process-mark (get-buffer-process (current-buffer)))) + (point-max))) + (defun comint-previous-matching-input (regexp n) "Search backwards through input history for match for REGEXP. \(Previous history elements are earlier commands.) *************** *** 1088,1100 **** ;; Has a match been found? (if (null pos) (error "Not found") (setq comint-input-ring-index pos) (message "History item: %d" (1+ pos)) ! (delete-region ! ;; Can't use kill-region as it sets this-command ! (or (marker-position comint-accum-marker) ! (process-mark (get-buffer-process (current-buffer)))) ! (point)) (insert (ring-ref comint-input-ring pos))))) (defun comint-next-matching-input (regexp n) --- 1120,1132 ---- ;; Has a match been found? (if (null pos) (error "Not found") + ;; If leaving the edit line, save partial input + (if (null comint-input-ring-index) ;not yet on ring + (setq comint-stored-incomplete-input + (funcall comint-get-old-input))) (setq comint-input-ring-index pos) (message "History item: %d" (1+ pos)) ! (comint-delete-input) (insert (ring-ref comint-input-ring pos))))) (defun comint-next-matching-input (regexp n) ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: comint-accumulate-marker 2006-04-18 19:10 ` comint-accumulate-marker JD Smith @ 2006-04-18 20:54 ` David Kastrup 2006-04-18 21:06 ` comint-accumulate-marker JD Smith 2006-04-18 21:22 ` comint-accumulate-marker Nick Roberts ` (2 subsequent siblings) 3 siblings, 1 reply; 26+ messages in thread From: David Kastrup @ 2006-04-18 20:54 UTC (permalink / raw) Cc: rms, emacs-devel JD Smith <jdsmith@as.arizona.edu> writes: > On Apr 18, 2006, at 5:57 AM, Richard Stallman wrote: > >> Please install it, and enable it by default. The reason this >> is ok to install now is that the current behavior is wrong. > > I will install it shortly, but wanted to run one more variant of the > patch by everyone first. This version is permanently enabled. It > also saves input even when you use M-r/M-s, and it binds "C-c C-g" to > a new function `comint-restore-input', so no matter where you are on > the history ring, you can zap back to your stranded partial input > with C-c C-g. Let me know if that's a good binding (and where it > should be documented). I don't think any binding should contain C-g. C-g is supposed to quit, no matter what was typed before. -- David Kastrup, Kriemhildstr. 15, 44793 Bochum ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: comint-accumulate-marker 2006-04-18 20:54 ` comint-accumulate-marker David Kastrup @ 2006-04-18 21:06 ` JD Smith 2006-04-18 23:25 ` comint-accumulate-marker Stuart D. Herring 0 siblings, 1 reply; 26+ messages in thread From: JD Smith @ 2006-04-18 21:06 UTC (permalink / raw) On Tue, 18 Apr 2006 22:54:22 +0200, David Kastrup wrote: > JD Smith <jdsmith@as.arizona.edu> writes: > >> On Apr 18, 2006, at 5:57 AM, Richard Stallman wrote: >> >>> Please install it, and enable it by default. The reason this is ok to >>> install now is that the current behavior is wrong. >> >> I will install it shortly, but wanted to run one more variant of the >> patch by everyone first. This version is permanently enabled. It also >> saves input even when you use M-r/M-s, and it binds "C-c C-g" to a new >> function `comint-restore-input', so no matter where you are on the >> history ring, you can zap back to your stranded partial input with C-c >> C-g. Let me know if that's a good binding (and where it should be >> documented). > > I don't think any binding should contain C-g. C-g is supposed to quit, no > matter what was typed before. How about C-c C-j (j for "jump") then? Of course, C-c C-g then says '"C-c C-g" is undefined', so it doesn't do what you expect anyway. ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: comint-accumulate-marker 2006-04-18 21:06 ` comint-accumulate-marker JD Smith @ 2006-04-18 23:25 ` Stuart D. Herring 0 siblings, 0 replies; 26+ messages in thread From: Stuart D. Herring @ 2006-04-18 23:25 UTC (permalink / raw) Cc: emacs-devel >> I don't think any binding should contain C-g. C-g is supposed to quit, >> no >> matter what was typed before. > > How about C-c C-j (j for "jump") then? Of course, C-c C-g then says '"C-c > C-g" is undefined', so it doesn't do what you expect anyway. The idea is not that [foo C-g] should call `keyboard-quit' or even set `quit-flag'. C-g in typing an extended key sequence "quits" (or cancels) that key sequence precisely -by- being undefined, by convention. That's a feature, not a bug. Davis -- This product is sold by volume, not by mass. If it appears too dense or too sparse, it is because mass-energy conversion has occurred during shipping. ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: comint-accumulate-marker 2006-04-18 19:10 ` comint-accumulate-marker JD Smith 2006-04-18 20:54 ` comint-accumulate-marker David Kastrup @ 2006-04-18 21:22 ` Nick Roberts 2006-04-18 21:38 ` comint-accumulate-marker JD Smith 2006-04-18 22:21 ` comint-accumulate-marker Stuart D. Herring 2006-04-19 0:02 ` comint-accumulate-marker JD Smith 3 siblings, 1 reply; 26+ messages in thread From: Nick Roberts @ 2006-04-18 21:22 UTC (permalink / raw) Cc: rms, emacs-devel > I will install it shortly, but wanted to run one more variant of the > patch by everyone first. This version is permanently enabled. It > also saves input even when you use M-r/M-s, The previous patch seems to do that already. > and it binds "C-c C-g" to > a new function `comint-restore-input', so no matter where you are on > the history ring, you can zap back to your stranded partial input > with C-c C-g. Let me know if that's a good binding (and where it > should be documented). I'm not sure that I would use/remember it. It can't be on "C-c C-g" anyway because "C-g" is used to quit a command. If it is installed, I guess it should be described in the node "Shell Ring". -- Nick http://www.inet.net.nz/~nickrob ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: comint-accumulate-marker 2006-04-18 21:22 ` comint-accumulate-marker Nick Roberts @ 2006-04-18 21:38 ` JD Smith 2006-04-18 23:24 ` comint-accumulate-marker Nick Roberts ` (2 more replies) 0 siblings, 3 replies; 26+ messages in thread From: JD Smith @ 2006-04-18 21:38 UTC (permalink / raw) Cc: rms, emacs-devel On Wed, 2006-04-19 at 09:22 +1200, Nick Roberts wrote: > > I will install it shortly, but wanted to run one more variant of the > > patch by everyone first. This version is permanently enabled. It > > also saves input even when you use M-r/M-s, > > The previous patch seems to do that already. Formerly only M-p, and M-n worked. M-r/M-s could *appear* to work if you had already used M-p to save some partial input, but it wasn't current. > > and it binds "C-c C-g" to > > a new function `comint-restore-input', so no matter where you are on > > the history ring, you can zap back to your stranded partial input > > with C-c C-g. Let me know if that's a good binding (and where it > > should be documented). > > I'm not sure that I would use/remember it. It can't be on "C-c C-g" > anyway because "C-g" is used to quit a command. If it is installed, I > guess it should be described in the node "Shell Ring". C-c C-j, then? Can you see any harm in having such a binding? In the terminal shell, since input is not a ring but a stack, you can just hold down the arrow and get all the way back to your stranded input in a hurry. This doesn't work for a ring of history like comint's. JD ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: comint-accumulate-marker 2006-04-18 21:38 ` comint-accumulate-marker JD Smith @ 2006-04-18 23:24 ` Nick Roberts [not found] ` <1145403002.27500.42.camel@turtle.as.arizona.edu> 2006-04-19 15:40 ` comint-accumulate-marker Richard Stallman 2006-04-20 7:25 ` comint-accumulate-marker David Kastrup 2 siblings, 1 reply; 26+ messages in thread From: Nick Roberts @ 2006-04-18 23:24 UTC (permalink / raw) Cc: rms, emacs-devel > > > I will install it shortly, but wanted to run one more variant of the > > > patch by everyone first. This version is permanently enabled. It > > > also saves input even when you use M-r/M-s, > > > > The previous patch seems to do that already. > > Formerly only M-p, and M-n worked. M-r/M-s could *appear* to work if > you had already used M-p to save some partial input, but it wasn't > current. OK > > > and it binds "C-c C-g" to > > > a new function `comint-restore-input', so no matter where you are on > > > the history ring, you can zap back to your stranded partial input > > > with C-c C-g. Let me know if that's a good binding (and where it > > > should be documented). > > > > I'm not sure that I would use/remember it. It can't be on "C-c C-g" > > anyway because "C-g" is used to quit a command. If it is installed, I > > guess it should be described in the node "Shell Ring". > > C-c C-j, then? Can you see any harm in having such a binding? In the > terminal shell, since input is not a ring but a stack, you can just hold > down the arrow and get all the way back to your stranded input in a > hurry. This doesn't work for a ring of history like comint's. I don't see any harm, you're not forcing me to use it. Incidentally your patch seems a bit mangled but I'm not sure why diff-mode gets quite so confused e.g why it doesn't patch comint-restore-input and comint-delete-input properly. -- Nick http://www.inet.net.nz/~nickrob ^ permalink raw reply [flat|nested] 26+ messages in thread
[parent not found: <1145403002.27500.42.camel@turtle.as.arizona.edu>]
* Re: comint-accumulate-marker [not found] ` <1145403002.27500.42.camel@turtle.as.arizona.edu> @ 2006-04-19 0:01 ` Nick Roberts 2006-04-19 0:01 ` Bug in diff-mode? (was: Re: comint-accumulate-marker) Nick Roberts 1 sibling, 0 replies; 26+ messages in thread From: Nick Roberts @ 2006-04-19 0:01 UTC (permalink / raw) Cc: emacs-devel > > Incidentally your patch seems a bit mangled but I'm not sure why diff-mode > > gets quite so confused e.g why it doesn't patch comint-restore-input and > > comint-delete-input properly. > > It's applied against the CVS, not against my last version. Could that > be the problem? Here it is again in case my mailer did mangle it. This patch looks good to me. -- Nick http://www.inet.net.nz/~nickrob ^ permalink raw reply [flat|nested] 26+ messages in thread
* Bug in diff-mode? (was: Re: comint-accumulate-marker) [not found] ` <1145403002.27500.42.camel@turtle.as.arizona.edu> 2006-04-19 0:01 ` comint-accumulate-marker Nick Roberts @ 2006-04-19 0:01 ` Nick Roberts 2006-04-19 15:40 ` Richard Stallman 1 sibling, 1 reply; 26+ messages in thread From: Nick Roberts @ 2006-04-19 0:01 UTC (permalink / raw) Cc: emacs-devel > > Incidentally your patch seems a bit mangled but I'm not sure why diff-mode > > gets quite so confused e.g why it doesn't patch comint-restore-input and > > comint-delete-input properly. > > It's applied against the CVS, not against my last version. Could that > be the problem? No, I knew that. > Here it is again in case my mailer did mangle it. Thanks. Its not mangled now. Using patch from the command line works now but diff-apply-hunk doesn't patch the functions comint-restore-input and comint-delete-input correctly. I think this must be a bug in diff-mode. It might be caused by offsets when previous hunks were applied, although I don't understand why there should be any offsets as the base version should be the same (1.337). Perhaps it is an OS thing. > Index: comint.el > =================================================================== > RCS file: /cvsroot/emacs/emacs/lisp/comint.el,v > retrieving revision 1.337 > diff -w -b -c -c -r1.337 comint.el > *** comint.el 27 Mar 2006 08:50:20 -0000 1.337 > --- comint.el 18 Apr 2006 23:29:21 -0000 > *************** > *** 465,470 **** > --- 465,471 ---- > (define-key map "\C-c\C-l" 'comint-dynamic-list-input-ring) > (define-key map "\C-c\C-n" 'comint-next-prompt) > (define-key map "\C-c\C-p" 'comint-previous-prompt) > + (define-key map "\C-c\C-j" 'comint-restore-input) > (define-key map "\C-c\C-d" 'comint-send-eof) > (define-key map "\C-c\C-s" 'comint-write-output) > (define-key map "\C-c." 'comint-insert-previous-argument) > *************** > *** 558,563 **** > --- 559,567 ---- > "Non-nil if you are accumulating input lines to send as input together. > The command \\[comint-accumulate] sets this.") > > + (defvar comint-stored-incomplete-input nil > + "Stored input for history cycling.") > + > (put 'comint-replace-by-expanded-history 'menu-enable 'comint-input-autoexpand) > (put 'comint-input-ring 'permanent-local t) > (put 'comint-input-ring-index 'permanent-local t) > *************** > *** 638,643 **** > --- 642,648 ---- > (make-local-variable 'comint-scroll-to-bottom-on-input) > (make-local-variable 'comint-move-point-for-output) > (make-local-variable 'comint-scroll-show-maximum-output) > + (make-local-variable 'comint-stored-incomplete-input) > ;; This makes it really work to keep point at the bottom. > (make-local-variable 'scroll-conservatively) > (setq scroll-conservatively 10000) > *************** > *** 1015,1020 **** > --- 1020,1035 ---- > (t > arg))) > > + (defun comint-restore-input () > + "Restore unfinished input." > + (interactive) > + (when comint-input-ring-index > + (comint-delete-input) > + (when (> (length comint-stored-incomplete-input) 0) > + (insert comint-stored-incomplete-input) > + (message "Input restored")) > + (setq comint-input-ring-index nil))) > + > (defun comint-search-start (arg) > "Index to start a directional search, starting at `comint-input-ring-index'." > (if comint-input-ring-index > *************** > *** 1035,1043 **** > arg))) > > (defun comint-previous-input (arg) > ! "Cycle backwards through input history." > (interactive "*p") > ! (comint-previous-matching-input "." arg)) > > (defun comint-next-input (arg) > "Cycle forwards through input history." > --- 1050,1067 ---- > arg))) > > (defun comint-previous-input (arg) > ! "Cycle backwards through input history, saving input." > (interactive "*p") > ! (if (and comint-input-ring-index > ! (or ;; leaving the "end" of the ring > ! (and (< arg 0) ; going down > ! (eq comint-input-ring-index 0)) > ! (and (> arg 0) ; going up > ! (eq comint-input-ring-index > ! (1- (ring-length comint-input-ring))))) > ! comint-stored-incomplete-input) > ! (comint-restore-input) > ! (comint-previous-matching-input "." arg))) > > (defun comint-next-input (arg) > "Cycle forwards through input history." > *************** > *** 1077,1082 **** > --- 1101,1114 ---- > (if (string-match regexp (ring-ref comint-input-ring n)) > n))) > > + (defun comint-delete-input () > + "Delete all input between accumulation or process mark and point." > + (delete-region > + ;; Can't use kill-region as it sets this-command > + (or (marker-position comint-accum-marker) > + (process-mark (get-buffer-process (current-buffer)))) > + (point-max))) > + > (defun comint-previous-matching-input (regexp n) > "Search backwards through input history for match for REGEXP. > \(Previous history elements are earlier commands.) > *************** > *** 1088,1100 **** > ;; Has a match been found? > (if (null pos) > (error "Not found") > (setq comint-input-ring-index pos) > (message "History item: %d" (1+ pos)) > ! (delete-region > ! ;; Can't use kill-region as it sets this-command > ! (or (marker-position comint-accum-marker) > ! (process-mark (get-buffer-process (current-buffer)))) > ! (point)) > (insert (ring-ref comint-input-ring pos))))) > > (defun comint-next-matching-input (regexp n) > --- 1120,1132 ---- > ;; Has a match been found? > (if (null pos) > (error "Not found") > + ;; If leaving the edit line, save partial input > + (if (null comint-input-ring-index) ;not yet on ring > + (setq comint-stored-incomplete-input > + (funcall comint-get-old-input))) > (setq comint-input-ring-index pos) > (message "History item: %d" (1+ pos)) > ! (comint-delete-input) > (insert (ring-ref comint-input-ring pos))))) > > (defun comint-next-matching-input (regexp n) > -- Nick http://www.inet.net.nz/~nickrob ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: Bug in diff-mode? (was: Re: comint-accumulate-marker) 2006-04-19 0:01 ` Bug in diff-mode? (was: Re: comint-accumulate-marker) Nick Roberts @ 2006-04-19 15:40 ` Richard Stallman 0 siblings, 0 replies; 26+ messages in thread From: Richard Stallman @ 2006-04-19 15:40 UTC (permalink / raw) Cc: emacs-devel, jdsmith I think this must be a bug in diff-mode. It might be caused by offsets when previous hunks were applied, although I don't understand why there should be any offsets as the base version should be the same (1.337). Perhaps it is an OS thing. Can you please try to track this down at least far enough to make a specific bug report? ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: comint-accumulate-marker 2006-04-18 21:38 ` comint-accumulate-marker JD Smith 2006-04-18 23:24 ` comint-accumulate-marker Nick Roberts @ 2006-04-19 15:40 ` Richard Stallman 2006-04-20 7:25 ` comint-accumulate-marker David Kastrup 2 siblings, 0 replies; 26+ messages in thread From: Richard Stallman @ 2006-04-19 15:40 UTC (permalink / raw) Cc: nickrob, emacs-devel Formerly only M-p, and M-n worked. M-r/M-s could *appear* to work if you had already used M-p to save some partial input, but it wasn't current. It is useful to make M-r and M-s work correctly in all cases. However, adding a new command (whether it be C-c C-j or whatever) is not appropriate now. ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: comint-accumulate-marker 2006-04-18 21:38 ` comint-accumulate-marker JD Smith 2006-04-18 23:24 ` comint-accumulate-marker Nick Roberts 2006-04-19 15:40 ` comint-accumulate-marker Richard Stallman @ 2006-04-20 7:25 ` David Kastrup 2006-04-20 7:45 ` comint-accumulate-marker Nick Roberts 2006-04-20 17:29 ` comint-accumulate-marker JD Smith 2 siblings, 2 replies; 26+ messages in thread From: David Kastrup @ 2006-04-20 7:25 UTC (permalink / raw) Cc: Nick Roberts, rms, emacs-devel JD Smith <jdsmith@as.arizona.edu> writes: > On Wed, 2006-04-19 at 09:22 +1200, Nick Roberts wrote: >> >> I'm not sure that I would use/remember it. It can't be on "C-c >> C-g" anyway because "C-g" is used to quit a command. If it is >> installed, I guess it should be described in the node "Shell Ring". > > C-c C-j, then? Can you see any harm in having such a binding? In > the terminal shell, since input is not a ring but a stack, you can > just hold down the arrow and get all the way back to your stranded > input in a hurry. This doesn't work for a ring of history like > comint's. C-c C-j would be "jump", not particularly to the end. Other options would be C-c C-l (recenter/normalize) or C-c > (to end of input). For what it's worth, in AUCTeX you get to the end of the _corresponding_ process buffer's _output_ (displaying it if not already) with C-c C-l. -- David Kastrup, Kriemhildstr. 15, 44793 Bochum ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: comint-accumulate-marker 2006-04-20 7:25 ` comint-accumulate-marker David Kastrup @ 2006-04-20 7:45 ` Nick Roberts 2006-04-20 17:29 ` comint-accumulate-marker JD Smith 1 sibling, 0 replies; 26+ messages in thread From: Nick Roberts @ 2006-04-20 7:45 UTC (permalink / raw) Cc: emacs-devel, rms, JD Smith > C-c C-j would be "jump", not particularly to the end. Other options > would be C-c C-l (recenter/normalize) or C-c > (to end of input). C-c C-l isn't an option because comint-dynamic-list-input-ring is already bound to it. JD has already removed this binding anyway, lets move forward. -- Nick http://www.inet.net.nz/~nickrob ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: comint-accumulate-marker 2006-04-20 7:25 ` comint-accumulate-marker David Kastrup 2006-04-20 7:45 ` comint-accumulate-marker Nick Roberts @ 2006-04-20 17:29 ` JD Smith 1 sibling, 0 replies; 26+ messages in thread From: JD Smith @ 2006-04-20 17:29 UTC (permalink / raw) On Thu, 20 Apr 2006 09:25:20 +0200, David Kastrup wrote: > JD Smith <jdsmith@as.arizona.edu> writes: >> C-c C-j, then? > C-c C-j would be "jump", not particularly to the end. Other options > would be C-c C-l (recenter/normalize) or C-c > (to end of input). I removed the binding at Richard's request. I have left the function `comint-restore-input' interactive, so feel free to create local bindings (unless that too gets removed). ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: comint-accumulate-marker 2006-04-18 19:10 ` comint-accumulate-marker JD Smith 2006-04-18 20:54 ` comint-accumulate-marker David Kastrup 2006-04-18 21:22 ` comint-accumulate-marker Nick Roberts @ 2006-04-18 22:21 ` Stuart D. Herring 2006-04-18 22:48 ` comint-accumulate-marker JD Smith 2006-04-18 23:39 ` comint-accumulate-marker Miles Bader 2006-04-19 0:02 ` comint-accumulate-marker JD Smith 3 siblings, 2 replies; 26+ messages in thread From: Stuart D. Herring @ 2006-04-18 22:21 UTC (permalink / raw) Cc: emacs-devel > I will install it shortly, but wanted to run one more variant of the > patch by everyone first. This version is permanently enabled. It > also saves input even when you use M-r/M-s, and it binds "C-c C-g" to > a new function `comint-restore-input', so no matter where you are on > the history ring, you can zap back to your stranded partial input > with C-c C-g. Let me know if that's a good binding (and where it > should be documented). This might make this into a "don't install now" new feature, but would it be preferable to treat all lines of the history like the current input? Readline does this, I believe, at least until you finally submit a line (at which point any changes to other lines might be forgotten -- I forget on this part). In other words, typing foo<RET> bar<RET> <UP><UP><C-a>re<UP><C-e>d<DOWN><RET> sends `rebar' as a command, and (possibly) replaces `foo' with `food' in the history. This is of course technically orthogonal to the current question, since it's about preserving editing done to history elements rather than to the current input (which is not a history element), but it's much the same to the user. Davis -- This product is sold by volume, not by mass. If it appears too dense or too sparse, it is because mass-energy conversion has occurred during shipping. ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: comint-accumulate-marker 2006-04-18 22:21 ` comint-accumulate-marker Stuart D. Herring @ 2006-04-18 22:48 ` JD Smith 2006-04-18 23:39 ` comint-accumulate-marker Miles Bader 1 sibling, 0 replies; 26+ messages in thread From: JD Smith @ 2006-04-18 22:48 UTC (permalink / raw) On Tue, 18 Apr 2006 15:21:15 -0700, Stuart D. Herring wrote: >> I will install it shortly, but wanted to run one more variant of the >> patch by everyone first. This version is permanently enabled. It >> also saves input even when you use M-r/M-s, and it binds "C-c C-g" to >> a new function `comint-restore-input', so no matter where you are on >> the history ring, you can zap back to your stranded partial input >> with C-c C-g. Let me know if that's a good binding (and where it >> should be documented). > > This might make this into a "don't install now" new feature, but would it > be preferable to treat all lines of the history like the current input? > Readline does this, I believe, at least until you finally submit a line > (at which point any changes to other lines might be forgotten -- I forget > on this part). In other words, typing > > foo<RET> > bar<RET> > <UP><UP><C-a>re<UP><C-e>d<DOWN><RET> > > sends `rebar' as a command, and (possibly) replaces `foo' with `food' in > the history. This is of course technically orthogonal to the current > question, since it's about preserving editing done to history elements > rather than to the current input (which is not a history element), but > it's much the same to the user. While the concept of editing history does have a particular resonance given our current political climate ;), I thought about this and decided it deviated too far from the "fix the broken behavior" flavor of the current proposed patch. ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: comint-accumulate-marker 2006-04-18 22:21 ` comint-accumulate-marker Stuart D. Herring 2006-04-18 22:48 ` comint-accumulate-marker JD Smith @ 2006-04-18 23:39 ` Miles Bader 1 sibling, 0 replies; 26+ messages in thread From: Miles Bader @ 2006-04-18 23:39 UTC (permalink / raw) Cc: emacs-devel "Stuart D. Herring" <herring@lanl.gov> writes: > This might make this into a "don't install now" new feature, but would it > be preferable to treat all lines of the history like the current input? > Readline does this, I believe, at least until you finally submit a line No. Readline's modification of history is one of the most awful and stupid "features" on the planet. Emacs' behavior is _far_ nicer. -miles -- Saa, shall we dance? (from a dance-class advertisement) ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: comint-accumulate-marker 2006-04-18 19:10 ` comint-accumulate-marker JD Smith ` (2 preceding siblings ...) 2006-04-18 22:21 ` comint-accumulate-marker Stuart D. Herring @ 2006-04-19 0:02 ` JD Smith 3 siblings, 0 replies; 26+ messages in thread From: JD Smith @ 2006-04-19 0:02 UTC (permalink / raw) On Tue, 18 Apr 2006 12:10:45 -0700, JD Smith wrote: > > On Apr 18, 2006, at 5:57 AM, Richard Stallman wrote: > >> Please install it, and enable it by default. The reason this >> is ok to install now is that the current behavior is wrong. This change has been checked in, along with supporting changes to the misc.texi manual. ^ permalink raw reply [flat|nested] 26+ messages in thread
end of thread, other threads:[~2006-04-20 17:29 UTC | newest] Thread overview: 26+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2006-04-13 19:45 comint-accumulate-marker JD Smith 2006-04-16 0:19 ` comint-accumulate-marker Bob Portmann 2006-04-16 2:09 ` comint-accumulate-marker Richard Stallman 2006-04-17 18:06 ` comint-accumulate-marker JD Smith 2006-04-18 9:47 ` comint-accumulate-marker Nick Roberts 2006-04-18 11:25 ` comint-accumulate-marker Stefan Monnier 2006-04-18 20:50 ` comint-accumulate-marker Richard Stallman 2006-04-18 12:57 ` comint-accumulate-marker Richard Stallman 2006-04-18 19:10 ` comint-accumulate-marker JD Smith 2006-04-18 20:54 ` comint-accumulate-marker David Kastrup 2006-04-18 21:06 ` comint-accumulate-marker JD Smith 2006-04-18 23:25 ` comint-accumulate-marker Stuart D. Herring 2006-04-18 21:22 ` comint-accumulate-marker Nick Roberts 2006-04-18 21:38 ` comint-accumulate-marker JD Smith 2006-04-18 23:24 ` comint-accumulate-marker Nick Roberts [not found] ` <1145403002.27500.42.camel@turtle.as.arizona.edu> 2006-04-19 0:01 ` comint-accumulate-marker Nick Roberts 2006-04-19 0:01 ` Bug in diff-mode? (was: Re: comint-accumulate-marker) Nick Roberts 2006-04-19 15:40 ` Richard Stallman 2006-04-19 15:40 ` comint-accumulate-marker Richard Stallman 2006-04-20 7:25 ` comint-accumulate-marker David Kastrup 2006-04-20 7:45 ` comint-accumulate-marker Nick Roberts 2006-04-20 17:29 ` comint-accumulate-marker JD Smith 2006-04-18 22:21 ` comint-accumulate-marker Stuart D. Herring 2006-04-18 22:48 ` comint-accumulate-marker JD Smith 2006-04-18 23:39 ` comint-accumulate-marker Miles Bader 2006-04-19 0:02 ` comint-accumulate-marker JD Smith
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/emacs.git https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.