[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: An example implementation of "following anchor"
- From: TSUCHIYA Masatoshi <tsuchiya@xxxxxxxxxxxxxxxxxxxxxxx>
- Date: 05 Jun 2001 19:37:43 +0900
- X-ml-name: emacs-w3m
- X-mail-count: 01061
This is the second mail written by Christoph Conrad.
--- Begin Message ---
- From: Christoph Conrad <christoph.conrad@xxxxxx>
- Date: 05 Jun 2001 09:02:59 +0200
to illustrate what i mean i have implemented a version of following
the anchor without re-rendering, see below. The implementation might
not be perfect, it would better use defadvice. Feel free to use the
code for any purpose. BTW: is TSUCHIYA your surname or your given
(defun w3m-view-this-url (&optional arg)
"*View the URL of the link under point."
(let ((url (w3m-anchor)) (act (w3m-action)) anchor-found anchor-pos)
;; target link is an anchor in the current url?
(when (string-match (concat "^" w3m-current-url "#\\(.*$\\)") url)
;; extract anchor
(let ( (anchor-string (match-string 1 url)) )
;; search anchor
(while (and (not anchor-found)
(setq anchor-pos (next-single-property-change
(when (equal anchor-string
(plist-get (text-properties-at anchor-pos)
(setq anchor-found t))
(url (w3m-goto-url url arg))
(act (eval act))))))
=> GNU Emacs Webring @ <http://www.gnusoftware.com/WebRing/> <=
Look Ma, this man can twist his fingers as if they were made of rubber,
isn't that amazing? -- Not really, he's been using emacs for years...!
--- End Message ---