[Top][All Lists]
[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: |
Sun, 01 Apr 2007 17:10:12 +0000 |
CVSROOT: /sources/emacs
Module name: emacs
Changes by: Chong Yidong <cyd> 07/04/01 17:10:11
Index: button.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/button.el,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- button.el 28 Mar 2007 03:20:30 -0000 1.23
+++ button.el 1 Apr 2007 17:10:11 -0000 1.24
@@ -366,16 +366,29 @@
(next-button pos))))
(defun previous-button (pos &optional count-current)
- "Return the Nth button before position POS in the current buffer.
+ "Return the previous button before position POS in the current buffer.
If COUNT-CURRENT is non-nil, count any button at POS in the search,
instead of starting at the next button."
- (unless count-current
- (setq pos (previous-single-char-property-change pos 'button)))
- (and (> pos (point-min))
- (or (button-at (1- pos))
- ;; We must have originally been on a button, and are now in
- ;; the inter-button space. Recurse to find a button.
+ (let ((button (button-at pos)))
+ (if button
+ (if count-current
+ button
+ ;; We started out on a button, so move to its start and look
+ ;; for the previous button boundary.
+ (setq pos (previous-single-char-property-change
+ (button-start button) 'button))
+ (let ((new-button (button-at pos)))
+ (if new-button
+ ;; We are in a button again; this can happen if there
+ ;; are adjacent buttons (or at bob).
+ (unless (eq new-button button) new-button)
+ ;; We are now in the space between buttons.
(previous-button pos))))
+ ;; We started out in the space between buttons.
+ (setq pos (previous-single-char-property-change pos 'button))
+ (or (button-at pos)
+ (and (> pos (point-min))
+ (button-at (1- pos)))))))
;; User commands
- [Emacs-diffs] Changes to emacs/lisp/button.el,v,
Chong Yidong <=
- [Emacs-diffs] Changes to emacs/lisp/button.el,v, Chong Yidong, 2007/04/01
- [Emacs-diffs] Changes to emacs/lisp/button.el,v, Glenn Morris, 2007/04/22
- [Emacs-diffs] Changes to emacs/lisp/button.el,v, Nick Roberts, 2007/04/22
- [Emacs-diffs] Changes to emacs/lisp/button.el,v, Glenn Morris, 2007/04/25