Hi, Does anyone know a way to copy a link at point with fewer keystrokes than C-c C-l to edit the link C-a C-k C-y to go to the beginning of the link line, kill and re-yank the link <RET> <RET> to finish editing the link without changing anything ? Yours, Christian
That wasn't clear -- I meant to copy the URL part (link type and path)
of the link (not the description part).
CM
On 6/23/11 11:31 AM, Christian Moe wrote:
> Hi,
>
> Does anyone know a way to copy a link at point with fewer keystrokes than
>
> C-c C-l to edit the link
>
> C-a C-k C-y to go to the beginning of the link line, kill and re-yank
> the link
>
> <RET> <RET> to finish editing the link without changing anything
>
> ?
>
> Yours,
> Christian
>
>
>
Christian Moe <mail@christianmoe.com> writes:
>> Does anyone know a way to copy a link at point with fewer keystrokes than
>>
>> C-c C-l to edit the link
>> C-a C-k C-y to go to the beginning of the link line, kill and re-yank
>> the link
>> <RET> <RET> to finish editing the link without changing anything
What about:
C-c C-l C-a C-k C-g
Memnon
Christian Moe <mail@christianmoe.com> writes:
> That wasn't clear -- I meant to copy the URL part (link type and path)
> of the link (not the description part).
Does this work?
I did only some quick testing, this is "C-c C-l" cut down
for this purpose only.
--8<---------------cut here---------------start------------->8---
(defun my-extract-link ()
"Extract the link location at point and put it on the killring."
(interactive)
(when (org-in-regexp org-bracket-link-regexp 1)
(kill-new (org-link-unescape (org-match-string-no-properties 1)))))
--8<---------------cut here---------------end--------------->8---
Memnon
Memnon Anon <gegendosenfleisch@googlemail.com> writes:
> Christian Moe <mail@christianmoe.com> writes:
>
>>> Does anyone know a way to copy a link at point with fewer keystrokes than
>>>
>>> C-c C-l to edit the link
>>> C-a C-k C-y to go to the beginning of the link line, kill and re-yank
>>> the link
>>> <RET> <RET> to finish editing the link without changing anything
>
> What about:
>
> C-c C-l C-a C-k C-g
>
> Memnon
And if you do this, saving it as a kmacro, you can generate code that
does this:
#+begin_src emacs-lisp
(fset 'getlink
(lambda (&optional arg)
"Keyboard macro."
(interactive "p")
(kmacro-exec-ring-item (quote ("\C-c\C-l\C-a\C-k\C-g" 0 "%d")) arg)))
#+end_src
You can then bind /getlink/ to a key or execute it directly with
M-x getlink RET
--
: Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.50.1
: using Org-mode version 7.5 (release_7.5.422.g40d8)
On 6/23/11 2:17 PM, Memnon Anon wrote:
> (defun my-extract-link ()
> "Extract the link location at point and put it on the killring."
> (interactive)
> (when (org-in-regexp org-bracket-link-regexp 1)
> (kill-new (org-link-unescape (org-match-string-no-properties 1)))))
Thanks, that seems to work nicely!
Thanks for the tip about saving two keystrokes by aborting with C-g,
too -- why didn't I think of that??
Yours,
Christian
Cool! Thanks. Yours, Christian On 6/23/11 2:56 PM, Eric S Fraga wrote: > Memnon Anon<gegendosenfleisch@googlemail.com> writes: (...) >> >> C-c C-l C-a C-k C-g >> >> Memnon > > And if you do this, saving it as a kmacro, you can generate code that > does this: > > #+begin_src emacs-lisp > (fset 'getlink > (lambda (&optional arg) > "Keyboard macro." > (interactive "p") > (kmacro-exec-ring-item (quote ("\C-c\C-l\C-a\C-k\C-g" 0 "%d")) arg))) > #+end_src > > You can then bind /getlink/ to a key or execute it directly with > M-x getlink RET > >
Memnon, Eric, Memnon Anon <gegendosenfleisch@googlemail.com> writes: > (defun my-extract-link () > "Extract the link location at point and put it on the killring." > (interactive) > (when (org-in-regexp org-bracket-link-regexp 1) > (kill-new (org-link-unescape (org-match-string-no-properties 1))))) Eric S Fraga <e.fraga@ucl.ac.uk> writes: > And if you do this, saving it as a kmacro, you can generate code that > does this: > > #+begin_src emacs-lisp > (fset 'getlink > (lambda (&optional arg) > "Keyboard macro." > (interactive "p") > (kmacro-exec-ring-item (quote ("\C-c\C-l\C-a\C-k\C-g" 0 "%d")) arg))) > #+end_src > > You can then bind /getlink/ to a key or execute it directly with > M-x getlink RET These two snippets could live on Worg -- can anyone add this to org-hacks.el (or any relevant place)? Thanks in advance! -- Bastien
Bastien <bzg@altern.org> writes:
> These two snippets could live on Worg -- can anyone add this to
> org-hacks.el (or any relevant place)?
Done.
Hope everythings okay, will check the html export when I wake up.
,----
| commit d0d55a275fa2a78b864ed8eec48ed205aaae42f5
| Author: Memnon Anon <gegendosenfleisch@gmail.com>
| Date: Sun Jul 3 02:14:56 2011 +0200
|
| org-hacks.org: Reorganization, added "copy link dest to killring" hack
|
| Rationale:
| * Remove "Enhancing the Org experience"
| Everything in org-hacks enhances the org experience.
| This headline conveys no information, even worse, it
| can easily end up a kitchen sink for all kinds of
| information that eventually no one will find anymore.
| Distributed hacks to new headlines:
|
| * New Headlines
| - Structure Movement and Editing
| - Org Table
| - Capture and Remember
| - Handling Links
|
| * Remove Speed Commands
| Speed commands are no hack but a regular feature for quite
| a while now. So far, there was only a link to the manual
| and "add your stuff here". Definately worth a headline
| when there is actually content to put in there.
`----
Memnon
Hi Memnon,
Memnon Anon <gegendosenfleisch@googlemail.com> writes:
> Bastien <bzg@altern.org> writes:
>
>> These two snippets could live on Worg -- can anyone add this to
>> org-hacks.el (or any relevant place)?
>
> Done.
Thanks for this!
--
Bastien