emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/lisp/button.el,v


From: Chong Yidong
Subject: [Emacs-diffs] Changes to emacs/lisp/button.el,v
Date: Thu, 31 Jul 2008 22:15:47 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Chong Yidong <cyd>      08/07/31 22:15:45

Index: button.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/button.el,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -b -r1.36 -r1.37
--- button.el   10 Jun 2008 14:17:32 -0000      1.36
+++ button.el   31 Jul 2008 22:15:45 -0000      1.37
@@ -437,15 +437,22 @@
            (goto-char (button-start button)))
       ;; Move to Nth next button
       (let ((iterator (if (> n 0) #'next-button #'previous-button))
-           (wrap-start (if (> n 0) (point-min) (point-max))))
+           (wrap-start (if (> n 0) (point-min) (point-max)))
+           opoint fail)
        (setq n (abs n))
        (setq button t)                 ; just to start the loop
-       (while (and (> n 0) button)
+       (while (and (null fail) (> n 0) button)
          (setq button (funcall iterator (point)))
          (when (and (not button) wrap)
            (setq button (funcall iterator wrap-start t)))
          (when button
            (goto-char (button-start button))
+           ;; Avoid looping forever (e.g., if all the buttons have
+           ;; the `skip' property).
+           (cond ((null opoint)
+                  (setq opoint (point)))
+                 ((= opoint (point))
+                  (setq fail t)))
            (unless (button-get button 'skip)
              (setq n (1- n)))))))
     (if (null button)




reply via email to

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