Romain Francoise <[EMAIL PROTECTED]> writes:
> Is there a more efficient alternative to my code below?
If anyone is interested (doesn't look like it), since then I found out
that getting a hash of the current buffer is very fast. So my function
now recomputes the completion list only if the library buffer has
changed (or if a prefix argument is passed).
(defvar ore-bongo-jump-tracks nil)
(defvar ore-bongo-jump-sum nil)
(defun ore-bongo-jump ()
"Prompt for a track and go to the corresponding line in the
playlist buffer."
(interactive)
(when (or current-prefix-arg
(and ore-bongo-jump-sum
(not (string= ore-bongo-jump-sum
(md5 (buffer-string)))))
(null ore-bongo-jump-tracks))
(let (message-log-max garbage-collection-messages)
(message "Building completion list..."))
(setq ore-bongo-jump-sum (md5 (buffer-string)))
(save-excursion
;; Go through the buffer, collecting infosets and positions.
(with-bongo-library-buffer
(goto-char (point-max))
(while (bongo-previous-object-line t)
(push (list (bongo-format-infoset (bongo-line-infoset)) (point))
ore-bongo-jump-tracks)))))
(goto-char
(cadr (assoc (ido-completing-read "Jump to track: "
ore-bongo-jump-tracks nil t)
ore-bongo-jump-tracks))))
--
Romain Francoise <[EMAIL PROTECTED]> | The sea! the sea! the open
it's a miracle -- http://orebokech.com/ | sea! The blue, the fresh, the
| ever free! --Bryan W. Procter
_______________________________________________
bongo-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/bongo-devel