unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* FW: comint.el fix
@ 2003-06-20 14:19 Marshall, Simon
  2003-06-22  3:01 ` Richard Stallman
  0 siblings, 1 reply; 3+ messages in thread
From: Marshall, Simon @ 2003-06-20 14:19 UTC (permalink / raw)
  Cc: 'Gordon.Grimes@bcbsnc.com'

Over to you guys.  There are 2 (if ...) forms in comint-arguments where
this change seems applicable, though I've not tested the suggested
change at all.
 
-----Original Message-----
From: Gordon Grimes [mailto:Gordon.Grimes@bcbsnc.com] 
Sent: 20 June 2003 15:08
To: shivers@cs.cmu.edu; simon@gnu.org
Subject: comint.el fix


Hi,
I don't use the patch utils so I'll just detail the fix.  Also, there's
no version information in my comint.el file so I can't refer you to a
version.
 
Problem:
When completing a "!$" history item with TAB, the behavior is wrong if
the preceeding line had a ";" not surrounded by spaces.
 
Example:
% echo hi; echo bye
% echo !$       ## completes to "echo echo bye" rather than simply "echo
bye".
 
Cause:
An extra token from the preceeding line is grabbed because the second
token "hi;" is split into two but the token counter is incremented only
once.
 
In function 'comint-arguments', the variable 'count' is incremented in
the '(if beg..." conditional. It assumes that the variable 'args' will
get a single element added ('str') if the clause is executed. However,
the function 'comint-delim-arg' splits tokens such as "foo;" into "foo
;".  
 
Fix:
Rather than incrementing 'count', just set it to the length of the list
(outside of the conditional):
 
    (if beg
       (setq str ......
               args ....
       )
    )  ;; end of if
    (setq count (length args))    ;; unconditional
 
enjoy,
gordon

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: FW: comint.el fix
  2003-06-20 14:19 Marshall, Simon
@ 2003-06-22  3:01 ` Richard Stallman
  0 siblings, 0 replies; 3+ messages in thread
From: Richard Stallman @ 2003-06-22  3:01 UTC (permalink / raw)
  Cc: emacs-devel

Is this the right fix?


*** comint.el.~1.288.~	Tue Jun  3 07:07:46 2003
--- comint.el	Sat Jun 21 18:11:50 2003
***************
*** 1344,1351 ****
  	    ;; Put the previous arg, if there was one, onto ARGS.
  	    (setq str (substring string beg pos)
  		  args (if quotes (cons str args)
! 			 (nconc (comint-delim-arg str) args))
! 		  count (1+ count)))
  	(setq quotes (match-beginning 1))
  	(setq beg (match-beginning 0))
  	(setq pos (match-end 0))))
--- 1344,1351 ----
  	    ;; Put the previous arg, if there was one, onto ARGS.
  	    (setq str (substring string beg pos)
  		  args (if quotes (cons str args)
! 			 (nconc (comint-delim-arg str) args))))
! 	(setq count (length args))
  	(setq quotes (match-beginning 1))
  	(setq beg (match-beginning 0))
  	(setq pos (match-end 0))))
***************
*** 1354,1359 ****
--- 1354,1360 ----
  	      args (if quotes (cons str args)
  		     (nconc (comint-delim-arg str) args))
  	      count (1+ count)))
+     (setq count (length args))
      (let ((n (or nth (1- count)))
  	  (m (if mth (1- (- count mth)) 0)))
        (mapconcat
***************
*** 2083,2090 ****
    (interactive)
    (comint-skip-input)
    (interrupt-process nil comint-ptyp)
! ;;  (process-send-string nil "\n")
!   )
  
  (defun comint-kill-subjob ()
    "Send kill signal to the current subjob.
--- 2084,2090 ----
    (interactive)
    (comint-skip-input)
    (interrupt-process nil comint-ptyp)
!   (process-send-string nil "\n"))
  
  (defun comint-kill-subjob ()
    "Send kill signal to the current subjob.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: FW: comint.el fix
@ 2003-06-23 10:23 Marshall, Simon
  0 siblings, 0 replies; 3+ messages in thread
From: Marshall, Simon @ 2003-06-23 10:23 UTC (permalink / raw)
  Cc: emacs-devel

It seems OK with my rudimentary testing, except:

The second patch block should remove the setq of count (1+ count) in the
same way as the first patch block does.

I couldn't apply the third path block, but I don't think it's important.

-----Original Message-----
From: Richard Stallman [mailto:rms@gnu.org]
Sent: 22 June 2003 04:01
To: Marshall, Simon
Cc: emacs-devel@gnu.org; Gordon.Grimes@bcbsnc.com
Subject: Re: FW: comint.el fix


Is this the right fix?


*** comint.el.~1.288.~	Tue Jun  3 07:07:46 2003
--- comint.el	Sat Jun 21 18:11:50 2003
***************
*** 1344,1351 ****
  	    ;; Put the previous arg, if there was one, onto ARGS.
  	    (setq str (substring string beg pos)
  		  args (if quotes (cons str args)
! 			 (nconc (comint-delim-arg str) args))
! 		  count (1+ count)))
  	(setq quotes (match-beginning 1))
  	(setq beg (match-beginning 0))
  	(setq pos (match-end 0))))
--- 1344,1351 ----
  	    ;; Put the previous arg, if there was one, onto ARGS.
  	    (setq str (substring string beg pos)
  		  args (if quotes (cons str args)
! 			 (nconc (comint-delim-arg str) args))))
! 	(setq count (length args))
  	(setq quotes (match-beginning 1))
  	(setq beg (match-beginning 0))
  	(setq pos (match-end 0))))
***************
*** 1354,1359 ****
--- 1354,1360 ----
  	      args (if quotes (cons str args)
  		     (nconc (comint-delim-arg str) args))
  	      count (1+ count)))
+     (setq count (length args))
      (let ((n (or nth (1- count)))
  	  (m (if mth (1- (- count mth)) 0)))
        (mapconcat
***************
*** 2083,2090 ****
    (interactive)
    (comint-skip-input)
    (interrupt-process nil comint-ptyp)
! ;;  (process-send-string nil "\n")
!   )
  
  (defun comint-kill-subjob ()
    "Send kill signal to the current subjob.
--- 2084,2090 ----
    (interactive)
    (comint-skip-input)
    (interrupt-process nil comint-ptyp)
!   (process-send-string nil "\n"))
  
  (defun comint-kill-subjob ()
    "Send kill signal to the current subjob.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-06-23 10:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-06-23 10:23 FW: comint.el fix Marshall, Simon
  -- strict thread matches above, loose matches on Subject: below --
2003-06-20 14:19 Marshall, Simon
2003-06-22  3:01 ` Richard Stallman

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).