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

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

Re: copy a link + hyperlink & text


From: Emanuel Berg
Subject: Re: copy a link + hyperlink & text
Date: Fri, 03 Jun 2016 23:32:57 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

Sharon Kimble <address@hidden>
writes:

> How can I copy a link with the text and the
> hyperlink all at once from either emacs w3m
> or from gnus please? Preferably all with one
> keypress? It will be pasted into a org-mode
> document as its destination.

I have a DWIM function to do that. If point is
at a link, it gets (kills) the link's
destination (the URL). If there is a literal
URL at point, it gets that. If nothing, it gets
the URL of the current w3m buffer.

For Gnus - perhaps it works there as well! (the
literal stuff) - otherwise it is a good idea to
have...

    (defun w3m-kill-url-dwim ()
      (interactive)
      (let ((anchor-url (w3m-anchor)))
        (if anchor-url (kill-new anchor-url)
          (let ((literal-url (thing-at-point 'url)))
            (if literal-url (kill-new literal-url)
              (kill-new w3m-current-url) ))))
      (message "killed: %s" (current-kill 0)) )

Code in context:

    http://user.it.uu.se/~embe8573/conf/emacs-init/w3m/w3m-my.el

Bind it to "s" and "u":

    http://user.it.uu.se/~embe8573/conf/emacs-init/w3m/w3m-keys.el

Don't thank me - I'll send an invoice :)

-- 
underground experts united .... http://user.it.uu.se/~embe8573
Emacs Gnus Blogomatic ......... http://user.it.uu.se/~embe8573/blogomatic
                   - so far: 45 Blogomatic articles -                   


reply via email to

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