From: Vitalie Spinu <spinuvit@gmail.com>
To: martin rudalics <rudalics@gmx.at>
Cc: 13248@debbugs.gnu.org
Subject: bug#13248: [PATCH] bug#13248: 24.2.50; select-window moves point (in comint-postoutput-scroll-to-bottom)
Date: Tue, 25 Dec 2012 01:18:56 +0100 [thread overview]
Message-ID: <87pq1z7zm7.fsf_-_@gmail.com> (raw)
In-Reply-To: <50D47143.40702@gmx.at> (martin rudalics's message of "Fri, 21 Dec 2012 15:25:07 +0100")
[-- Attachment #1: Type: text/plain, Size: 794 bytes --]
>> martin rudalics <rudalics@gmx.at>
>> on Fri, 21 Dec 2012 15:25:07 +0100 wrote:
[...]
>> So the point is clearly moved in select-window. Moreover the (point)
>> equals (window-end) just before select-window is called, so it is
>> visible. Consequently, the following (comint-adjust-point selected) is
>> completely screwed because it relies on point *not* being moved!
[...]
>>
>> The variable `comint-scroll-show-maximum-output' is the default t, this
>> is why comint runs `comint-postoutput-scroll-to-bottom' in its
>> `comint-output-filter-functions'.
>>
>> I can propose a patch for commit to reset the point,
[...]
Here is a patch of the comint-postoutput-scroll-to-bottom to circumvent
resetting the point on select-window.
Thanks,
Vitalie
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: comint-fix.patch --]
[-- Type: text/x-diff, Size: 2325 bytes --]
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 6d5e77d..dc5a4be 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
+2012-12-24 Vitalie Spinu <spinuvit@gmail.com>
+
+ * comint.el (comint-postoutput-scroll-to-bottom): Don't reset
+ buffer point on select-window (Bug#13248).
+
2012-12-24 Dmitry Gutov <dgutov@yandex.ru>
* progmodes/ruby-mode.el: Bump the version to 1.2 (Bug#13200).
diff --git a/lisp/comint.el b/lisp/comint.el
index cff9afe..fa3764d 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -2120,12 +2120,14 @@ This function should be in the list `comint-output-filter-functions'."
((bound-and-true-p follow-mode)
(follow-comint-scroll-to-bottom))
(t
- (let ((selected (selected-window)))
+ (let ((selected (selected-window))
+ ;; select-window resets point; thus, save
+ (old-point (point)))
(dolist (w (get-buffer-window-list current nil t))
(select-window w)
(unwind-protect
(progn
- (comint-adjust-point selected)
+ (comint-adjust-point selected old-point)
;; Optionally scroll to the bottom of the window.
(and comint-scroll-show-maximum-output
(eobp)
@@ -2133,9 +2135,12 @@ This function should be in the list `comint-output-filter-functions'."
(select-window selected))))))
(set-buffer current))))
-(defun comint-adjust-point (selected)
+(defun comint-adjust-point (selected &optional saved-point)
"Move point in the selected window based on Comint settings.
-SELECTED is the window that was originally selected."
+SELECTED is the window that was originally selected.
+
+If SAVED-POINT is given, use it as reference instead of the
+current point."
(let ((process (get-buffer-process (current-buffer))))
(and (< (point) (process-mark process))
(or (memq comint-move-point-for-output '(t all))
@@ -2144,7 +2149,8 @@ SELECTED is the window that was originally selected."
(if (eq (selected-window) selected) 'this 'others))
;; If point was at the end, keep it at end.
(and (marker-position comint-last-output-start)
- (>= (point) comint-last-output-start)))
+ (>= (or saved-point (point))
+ comint-last-output-start)))
(goto-char (process-mark process)))))
(defun comint-truncate-buffer (&optional _string)
next prev parent reply other threads:[~2012-12-25 0:18 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-21 13:14 bug#13248: 24.2.50; select-window moves point (in comint-postoutput-scroll-to-bottom) Vitalie Spinu
2012-12-21 14:25 ` martin rudalics
2012-12-21 14:38 ` Vitalie Spinu
2012-12-21 14:48 ` Vitalie Spinu
2012-12-22 10:18 ` martin rudalics
2012-12-25 0:18 ` Vitalie Spinu [this message]
2012-12-25 18:09 ` bug#13248: [PATCH] " martin rudalics
2012-12-25 22:28 ` Vitalie Spinu
2012-12-27 7:36 ` martin rudalics
2013-01-02 8:03 ` martin rudalics
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87pq1z7zm7.fsf_-_@gmail.com \
--to=spinuvit@gmail.com \
--cc=13248@debbugs.gnu.org \
--cc=rudalics@gmx.at \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.