[xemacs-base] Partial fix for comint-carriage-motion

Stephen J. Turnbull stephen at xemacs.org
Mon Apr 2 11:07:17 EDT 2007


xemacs-base

This patch fixes one problem with `comint-carriage-motion', so that
setting `comint-inhibit-carriage-motion' nil doesn't cause an error on
every bare CR.  Ie, `comint-carriage-motion' is useful and bearable now.

However, there remains some bug such that the hook doesn't always
clean up a line terminated with a bare CR.  I've added a mention of
this to the docstring for `comint-inhibit-carriage-motion'.

I'd like to commit, as I really don't know when I'll have time and
energy to work on the harder bug.  Comments?

Index: ChangeLog
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/xemacs-base/ChangeLog,v
retrieving revision 1.194
diff -u -r1.194 ChangeLog
--- ChangeLog	2007/03/07 07:28:47	1.194
+++ ChangeLog	2007/04/02 14:10:14
@@ -0,0 +1,4 @@
+2007-04-02  Stephen J. Turnbull  <stephen at xemacs.org>
+
+	* comint.el (comint-output-filter): Avoid error if filter deletes.
+	(comint-inhibit-carriage-motion): Comment on remaining bug.
+

Index: comint.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/xemacs-base/comint.el,v
retrieving revision 1.20
diff -u -r1.20 comint.el
--- comint.el	2007/03/07 04:18:40	1.20
+++ comint.el	2007/04/02 14:10:16
@@ -1692,7 +1692,10 @@
 ;; XEmacs change: don't interpret carriage control characters by default
 (defvar comint-inhibit-carriage-motion t
   "If nil, Comint will interpret `carriage control' characters in output.
-See `comint-carriage-motion' for details.")
+See `comint-carriage-motion' for details..
+Note: currently this does not work perfectly.  Specifically a bare ASCII
+CR will usually, but not always, result in the current line being erased
+(giving the effect of overwriting it).")
 
 ;; When non-nil, this is an extent over the last recognized prompt in
 ;; the buffer; it is used when highlighting the prompt.
@@ -1790,6 +1793,11 @@
 	  (force-mode-line-update)
 
 	  (unless comint-inhibit-carriage-motion
+	    ;; oend needs to be adjusted if the buffer content is changed.
+	    ;; Specifically, an error occurs if oend points beyond EOB.
+	    ;; Use of a marker seems to (mostly) work (see docstring of
+	    ;; `comint-inhibit-carriage-motion').
+	    (setq oend (copy-marker oend))
 	    ;; Interpret any carriage motion characters (newline, backspace)
 	    (comint-carriage-motion comint-last-output-start (point)))
 




More information about the XEmacs-Patches mailing list