Show
Ignore:
Timestamp:
04/07/07 15:49:28 (2 years ago)
Author:
miyoshi
Message:

Sync up with Emacs CVS HEAD.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lisp/button.el

    r4190 r4200  
    9090;; inheriting its properties. 
    9191(put 'default-button 'rear-nonsticky t) 
    92 ;; Text property buttons don't have a `button' property of their own, so 
    93 ;; they inherit this. 
    94 (put 'default-button 'button t) 
    9592 
    9693;; A `category-symbol' property for the default button type 
     
    317314              (button-category-symbol (car (cdr type-entry)))))) 
    318315  ;; Now add all the text properties at once 
    319   (add-text-properties beg end properties) 
     316  (add-text-properties beg end 
     317                       ;; Each button should have a non-eq `button' 
     318                       ;; property so that next-single-property-change can 
     319                       ;; detect boundaries reliably. 
     320                       (cons 'button (cons (list t) properties))) 
    320321  ;; Return something that can be used to get at the button. 
    321322  beg) 
     
    366367 
    367368(defun previous-button (pos &optional count-current) 
    368   "Return the Nth button before position POS in the current buffer. 
     369  "Return the previous button before position POS in the current buffer. 
    369370If COUNT-CURRENT is non-nil, count any button at POS in the search, 
    370371instead of starting at the next button." 
    371   (unless count-current 
    372     (setq pos (previous-single-char-property-change pos 'button))) 
    373   (and (> pos (point-min)) 
    374        (or (button-at (1- pos)) 
    375            ;; We must have originally been on a button, and are now in 
    376            ;; the inter-button space.  Recurse to find a button. 
    377            (previous-button pos)))) 
     372  (let ((button (button-at pos))) 
     373    (if button 
     374        (if count-current 
     375            button 
     376          ;; We started out on a button, so move to its start and look 
     377          ;; for the previous button boundary. 
     378          (setq pos (previous-single-char-property-change 
     379                     (button-start button) 'button)) 
     380          (let ((new-button (button-at pos))) 
     381            (if new-button 
     382                ;; We are in a button again; this can happen if there 
     383                ;; are adjacent buttons (or at bob). 
     384                (unless (= pos (button-start button)) new-button) 
     385              ;; We are now in the space between buttons. 
     386              (previous-button pos)))) 
     387      ;; We started out in the space between buttons. 
     388      (setq pos (previous-single-char-property-change pos 'button)) 
     389      (or (button-at pos) 
     390          (and (> pos (point-min)) 
     391               (button-at (1- pos))))))) 
    378392 
    379393