comparison lisp/list-mode.el @ 292:6cb5e14cd98e r21-0b44

Import from CVS: tag r21-0b44
author cvs
date Mon, 13 Aug 2007 10:37:15 +0200
parents ca9a9ec9c1c1
children 341dac730539
comparison
equal deleted inserted replaced
291:7aa74ac42bd2 292:6cb5e14cd98e
140 (defun next-list-mode-item (n) 140 (defun next-list-mode-item (n)
141 "Move to the next item in list-mode. 141 "Move to the next item in list-mode.
142 With prefix argument N, move N items (negative N means move backward)." 142 With prefix argument N, move N items (negative N means move backward)."
143 (interactive "p") 143 (interactive "p")
144 (while (and (> n 0) (not (eobp))) 144 (while (and (> n 0) (not (eobp)))
145 (let ((prop (get-char-property (point) 'list-mode-item)) 145 (let ((extent (extent-at (point) (current-buffer) 'list-mode-item))
146 (end (point-max))) 146 (end (point-max)))
147 ;; If in a completion, move to the end of it. 147 ;; If in a completion, move to the end of it.
148 (if prop 148 (if extent (goto-char (extent-end-position extent)))
149 (goto-char (next-single-property-change (point) 'list-mode-item
150 nil end)))
151 ;; Move to start of next one. 149 ;; Move to start of next one.
152 (goto-char (next-single-property-change (point) 150 (or (extent-at (point) (current-buffer) 'list-mode-item)
153 'list-mode-item nil end))) 151 (goto-char (next-single-property-change (point) 'list-mode-item
152 nil end))))
154 (setq n (1- n))) 153 (setq n (1- n)))
155 (while (and (< n 0) (not (bobp))) 154 (while (and (< n 0) (not (bobp)))
156 (let ((prop (get-char-property (1- (point)) 'list-mode-item)) 155 (let ((extent (extent-at (point) (current-buffer) 'list-mode-item))
157 (end (point-min))) 156 (end (point-min)))
158 ;; If in a completion, move to the start of it. 157 ;; If in a completion, move to the start of it.
159 (if prop 158 (if extent (goto-char (extent-start-position extent)))
160 (goto-char (previous-single-property-change
161 (point) 'list-mode-item nil end)))
162 ;; Move to end of the previous completion.
163 (goto-char (previous-single-property-change (point) 'list-mode-item
164 nil end))
165 ;; Move to the start of that one. 159 ;; Move to the start of that one.
166 (goto-char (previous-single-property-change (point) 'list-mode-item nil 160 (if (setq extent (extent-at (point) (current-buffer) 'list-mode-item
167 end))) 161 nil 'before))
162 (goto-char (extent-start-position extent))
163 (goto-char (previous-single-property-change
164 (point) 'list-mode-item nil end))
165 (if (setq extent (extent-at (point) (current-buffer) 'list-mode-item
166 nil 'before))
167 (goto-char (extent-start-position extent)))))
168 (setq n (1+ n)))) 168 (setq n (1+ n))))
169 169
170 (defun list-mode-item-selected-1 (extent event) 170 (defun list-mode-item-selected-1 (extent event)
171 (let ((func (extent-property extent 'list-mode-item-activate-callback)) 171 (let ((func (extent-property extent 'list-mode-item-activate-callback))
172 (user-data (extent-property extent 'list-mode-item-user-data))) 172 (user-data (extent-property extent 'list-mode-item-user-data)))