Function: previous-button
previous-button is a byte-compiled function defined in button.el.gz.
Signature
(previous-button POS &optional COUNT-CURRENT)
Documentation
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.
Source Code
;; Defined in /usr/src/emacs/lisp/button.el.gz
(defun previous-button (pos &optional count-current)
"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."
(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 (= pos (button-start 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)))))))