help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Ido & emacs-w3m bookmarks


From: Bruno Tavernier
Subject: Ido & emacs-w3m bookmarks
Date: Mon, 21 Jun 2010 11:41:15 +0900
User-agent: Wanderlust/2.15.9 (Almost Unreal)

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?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]