emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs-25 528997d: Keep point when switching from and to *t


From: Eli Zaretskii
Subject: [Emacs-diffs] emacs-25 528997d: Keep point when switching from and to *terminal* buffer
Date: Sat, 15 Oct 2016 13:54:36 +0000 (UTC)

branch: emacs-25
commit 528997daa15d6e864f4f7119fe073fe37ab4c685
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    Keep point when switching from and to *terminal* buffer
    
    * lisp/term.el (term-reset-size): Don't reset the size if it
    didn't change.  If the size did change, restore point after
    adjusting the size.  (Bug#24465)
---
 lisp/term.el |   16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/lisp/term.el b/lisp/term.el
index f477bcc..993e580 100644
--- a/lisp/term.el
+++ b/lisp/term.el
@@ -1116,12 +1116,16 @@ Entry to this mode runs the hooks on `term-mode-hook'."
   (term-update-mode-line))
 
 (defun term-reset-size (height width)
-  (setq term-height height)
-  (setq term-width width)
-  (setq term-start-line-column nil)
-  (setq term-current-row nil)
-  (setq term-current-column nil)
-  (term-set-scroll-region 0 height))
+  (when (or (/= height term-height)
+            (/= width term-width))
+    (let ((point (point)))
+      (setq term-height height)
+      (setq term-width width)
+      (setq term-start-line-column nil)
+      (setq term-current-row nil)
+      (setq term-current-column nil)
+      (term-set-scroll-region 0 height)
+      (goto-char point))))
 
 ;; Recursive routine used to check if any string in term-kill-echo-list
 ;; matches part of the buffer before point.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]