From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Nick Roberts Newsgroups: gmane.emacs.devel Subject: Bug in diff-mode? (was: Re: comint-accumulate-marker) Date: Wed, 19 Apr 2006 12:01:34 +1200 Message-ID: <17477.32222.240006.555797@farnswood.snap.net.nz> References: <17477.22692.214810.459362@farnswood.snap.net.nz> <1145396335.27500.36.camel@turtle.as.arizona.edu> <17477.29995.58613.692001@farnswood.snap.net.nz> <1145403002.27500.42.camel@turtle.as.arizona.edu> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1145404945 14923 80.91.229.2 (19 Apr 2006 00:02:25 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 19 Apr 2006 00:02:25 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Apr 19 02:02:24 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FW09F-00083Q-43 for ged-emacs-devel@m.gmane.org; Wed, 19 Apr 2006 02:02:21 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FW09E-0004j7-No for ged-emacs-devel@m.gmane.org; Tue, 18 Apr 2006 20:02:20 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FW08X-0004XA-CA for emacs-devel@gnu.org; Tue, 18 Apr 2006 20:01:37 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FW08W-0004Wp-Oc for emacs-devel@gnu.org; Tue, 18 Apr 2006 20:01:37 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FW08W-0004Wk-L8 for emacs-devel@gnu.org; Tue, 18 Apr 2006 20:01:36 -0400 Original-Received: from [202.37.101.8] (helo=viper.snap.net.nz) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FW09U-000503-Ud for emacs-devel@gnu.org; Tue, 18 Apr 2006 20:02:37 -0400 Original-Received: from farnswood.snap.net.nz (p202-124-114-66.snap.net.nz [202.124.114.66]) by viper.snap.net.nz (Postfix) with ESMTP id 36478752956; Wed, 19 Apr 2006 12:01:34 +1200 (NZST) Original-Received: by farnswood.snap.net.nz (Postfix, from userid 500) id C2FD562A99; Wed, 19 Apr 2006 01:01:35 +0100 (BST) Original-To: JD Smith In-Reply-To: <1145403002.27500.42.camel@turtle.as.arizona.edu> X-Mailer: VM 7.19 under Emacs 22.0.50.37 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:53044 Archived-At: > > 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