all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Ido & emacs-w3m bookmarks
@ 2010-06-21  2:41 Bruno Tavernier
  0 siblings, 0 replies; only message in thread
From: Bruno Tavernier @ 2010-06-21  2:41 UTC (permalink / raw)
  To: help-gnu-emacs

I use ido almost all the time and emacs-w3m a lot.
In w3m, I find the opening of bookmark a bit unconvenient, so I wrote a small piece of code to use ido for that.
It parses the w3m-bookmark-file for links and their related name.

Hope that it could be useful to somes.


(defun my-w3m-bookmark-view ()
  "Ido style opening of w3m bookmarks."
  (interactive)
  (save-excursion
    (set-buffer (find-file-noselect w3m-bookmark-file))
    (let* ((flag "") (url "") (url-nickname "") (url-list '()))
      (while flag
	(search-forward-regexp "href=\"\\(\.*\\)\"" nil t)
	(setq url (match-string 1))
	(search-forward-regexp ">\\(\.*\\)</a>" nil t)
	(setq url-nickname (match-string 1))
	(if (string-match url flag)
	    (setq flag nil)
	  (setq flag url)
	  (add-to-list 'url-list (cons url-nickname url))))
      (kill-this-buffer)
      (w3m-goto-url
       (cdr (assoc
	     (ido-completing-read "Bookmark: " url-list) url-list))))))



Bruno


PS: For an unknown reason, each bookmark is followed by the character ^ in the minibuffer.
If anyone as a clue, why?



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-06-21  2:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-21  2:41 Ido & emacs-w3m bookmarks Bruno Tavernier

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.