emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 7dda131: * lisp/emacs-lisp/easy-mmode.el: Fix most


From: Stefan Monnier
Subject: [Emacs-diffs] master 7dda131: * lisp/emacs-lisp/easy-mmode.el: Fix most obvious bug#34723
Date: Wed, 13 Mar 2019 15:55:45 -0400 (EDT)

branch: master
commit 7dda131ab02b36362ae63744db66413a9f1df58d
Author: Stefan Monnier <address@hidden>
Commit: Stefan Monnier <address@hidden>

    * lisp/emacs-lisp/easy-mmode.el: Fix most obvious bug#34723
    
    (easy-mmode-define-navigation): Don't scroll in the opposite direction of
    the movement.
---
 lisp/emacs-lisp/easy-mmode.el | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el
index 0cb9a6f..8ac0a1d 100644
--- a/lisp/emacs-lisp/easy-mmode.el
+++ b/lisp/emacs-lisp/easy-mmode.el
@@ -628,6 +628,7 @@ BODY is executed after moving to the destination location."
                  ,body
                  (when was-narrowed (funcall #',narrowfun)))))))
     (unless name (setq name base-name))
+    ;; FIXME: Move most of those functions's bodies to helper functions!
     `(progn
        (defun ,next-sym (&optional count)
         ,(format "Go to the next COUNT'th %s.
@@ -649,7 +650,11 @@ Interactively, COUNT is the prefix numeric argument, and 
defaults to 1." name)
                                         `(re-search-forward ,re nil t 2)))
                                    (point-max))))
                     (unless (pos-visible-in-window-p endpt nil t)
-                      (recenter '(0)))))))
+                      (let ((ws (window-start)))
+                        (recenter '(0))
+                        (if (< (window-start) ws)
+                            ;; recenter scrolled in the wrong direction!
+                            (set-window-start nil ws))))))))
            ,@body))
        (put ',next-sym 'definition-name ',base)
        (defun ,prev-sym (&optional count)



reply via email to

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