all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Bruno Tavernier <tavernier.bruno@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Ido & emacs-w3m bookmarks
Date: Mon, 21 Jun 2010 11:41:15 +0900	[thread overview]
Message-ID: <87hbkxumyc.wl%tavernier.bruno@gmail.com> (raw)

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	other threads:[~2010-06-21  2:41 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87hbkxumyc.wl%tavernier.bruno@gmail.com \
    --to=tavernier.bruno@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.