(re-search-backward "\\(\\`\\|[\n:,]\\)[ \t]*")
(goto-char (match-end 0))
(point))))
- (orig (buffer-substring beg end))
- (typed (downcase orig))
+ (typed (or (and (eq this-command last-command)
+ (get this-command 'typed))
+ (downcase (buffer-substring beg end))))
+ (index (or (and (eq this-command last-command)
+ (get this-command 'index))
+ 0))
(match-recs '()))
(eweouz-search-do '(lambda (x) (add-to-list 'match-recs x)) typed)
- (message (format "%s" match-recs))
- (message (format "%d" (length match-recs)))
(cond ((= 0 (length match-recs))
(message "No matching records"))
((= 1 (length match-recs))
((< 1 (length match-recs))
;; For now, just display the records and leave the user to
;; complete
- (save-excursion
- (set-buffer (get-buffer-create eweouz-buffer-name))
- (mapcar '(lambda (x) (insert (format "%s\n"
+ (if (eq this-command last-command)
+ ;; Select next in list
+ (progn
+ (delete-region beg end)
+ (insert (vcard-format-sample-get-name (nth index match-recs)))
+ (put this-command 'index (% (+ 1 index)
+ (length match-recs))))
+ (save-excursion
+ (put this-command 'typed typed)
+ (put this-command 'index 0)
+ (set-buffer (get-buffer-create eweouz-buffer-name))
+ (mapcar '(lambda (x) (insert (format "%s\n"
(vcard-format-sample-get-name x)))) match-recs)
- (eweouz-pop-up-eweouz-buffer))))))
+ (eweouz-pop-up-eweouz-buffer)))))))
;
; Mostly stolen from bbdb-pop-up-bbdb-buffer