From: Chong Yidong Date: Sun, 17 Jun 2012 08:26:13 +0000 (+0800) Subject: Fix point motion bug in term-emulate-terminal. X-Git-Tag: emacs-24.2.90~1199^2~447 X-Git-Url: https://code.delx.au/gnu-emacs/commitdiff_plain/eb4a8a9a88652ca7f092e2c5e51b82c631f74749 Fix point motion bug in term-emulate-terminal. * lisp/term.el (term-emulate-terminal): If term-check-size is called, move point to the process mark without resetting point. Fixes: debbugs:4635 --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 30bdefac5b..ae67fac2f4 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2012-06-17 Chong Yidong + + * term.el (term-emulate-terminal): If term-check-size is called, + move point to the process mark without resetting point (Bug#4635). + 2012-06-13 Glenn Morris * international/mule-cmds.el (mule-menu-keymap) diff --git a/lisp/term.el b/lisp/term.el index e6a4bc15dd..06bdd21a40 100644 --- a/lisp/term.el +++ b/lisp/term.el @@ -2710,10 +2710,8 @@ See `term-prompt-regexp'." (str-length (length str))) (save-selected-window - ;; Let's handle the messages. -mm - - (let* ((newstr (term-handle-ansi-terminal-messages str))) - (when (not (eq str newstr)) + (let ((newstr (term-handle-ansi-terminal-messages str))) + (unless (eq str newstr) (setq handled-ansi-message t str newstr))) (setq str-length (length str)) @@ -2723,18 +2721,19 @@ See `term-prompt-regexp'." (delete-region term-pending-delete-marker (process-mark proc)) (set-marker term-pending-delete-marker nil)) + (when (/= (point) (process-mark proc)) + (setq save-point (point-marker))) + + ;; Note if the window size has changed. We used to reset + ;; point too, but that gives incorrect results (Bug#4635). (if (eq (window-buffer) (current-buffer)) (progn (setq term-vertical-motion (symbol-function 'vertical-motion)) (term-check-size proc)) (setq term-vertical-motion (symbol-function 'term-buffer-vertical-motion))) - (setq save-marker (copy-marker (process-mark proc))) - - (when (/= (point) (process-mark proc)) - (setq save-point (point-marker)) - (goto-char (process-mark proc))) + (goto-char (process-mark proc)) (save-restriction ;; If the buffer is in line mode, and there is a partial