* Copy link at point
@ 2011-06-23 9:31 Christian Moe
2011-06-23 11:03 ` Christian Moe
0 siblings, 1 reply; 10+ messages in thread
From: Christian Moe @ 2011-06-23 9:31 UTC (permalink / raw)
To: Org Mode
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
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Copy link at point
2011-06-23 9:31 Copy link at point Christian Moe
@ 2011-06-23 11:03 ` Christian Moe
2011-06-23 12:00 ` Memnon Anon
2011-06-23 12:17 ` Function: Extract link location to killring (was: Copy link at point) Memnon Anon
0 siblings, 2 replies; 10+ messages in thread
From: Christian Moe @ 2011-06-23 11:03 UTC (permalink / raw)
Cc: Org Mode
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
>
>
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Copy link at point
2011-06-23 11:03 ` Christian Moe
@ 2011-06-23 12:00 ` Memnon Anon
2011-06-23 12:56 ` Eric S Fraga
2011-06-23 12:17 ` Function: Extract link location to killring (was: Copy link at point) Memnon Anon
1 sibling, 1 reply; 10+ messages in thread
From: Memnon Anon @ 2011-06-23 12:00 UTC (permalink / raw)
To: emacs-orgmode
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
^ permalink raw reply [flat|nested] 10+ messages in thread
* Function: Extract link location to killring (was: Copy link at point)
2011-06-23 11:03 ` Christian Moe
2011-06-23 12:00 ` Memnon Anon
@ 2011-06-23 12:17 ` Memnon Anon
2011-06-23 14:20 ` Function: Extract link location to killring Christian Moe
2011-07-02 9:29 ` Bastien
1 sibling, 2 replies; 10+ messages in thread
From: Memnon Anon @ 2011-06-23 12:17 UTC (permalink / raw)
To: emacs-orgmode
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
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Copy link at point
2011-06-23 12:00 ` Memnon Anon
@ 2011-06-23 12:56 ` Eric S Fraga
2011-06-23 15:42 ` Christian Moe
0 siblings, 1 reply; 10+ messages in thread
From: Eric S Fraga @ 2011-06-23 12:56 UTC (permalink / raw)
To: Memnon Anon; +Cc: emacs-orgmode
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)
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Function: Extract link location to killring
2011-06-23 12:17 ` Function: Extract link location to killring (was: Copy link at point) Memnon Anon
@ 2011-06-23 14:20 ` Christian Moe
2011-07-02 9:29 ` Bastien
1 sibling, 0 replies; 10+ messages in thread
From: Christian Moe @ 2011-06-23 14:20 UTC (permalink / raw)
To: Memnon Anon; +Cc: emacs-orgmode
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
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Copy link at point
2011-06-23 12:56 ` Eric S Fraga
@ 2011-06-23 15:42 ` Christian Moe
0 siblings, 0 replies; 10+ messages in thread
From: Christian Moe @ 2011-06-23 15:42 UTC (permalink / raw)
To: Memnon Anon, emacs-orgmode
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
>
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Function: Extract link location to killring
2011-06-23 12:17 ` Function: Extract link location to killring (was: Copy link at point) Memnon Anon
2011-06-23 14:20 ` Function: Extract link location to killring Christian Moe
@ 2011-07-02 9:29 ` Bastien
2011-07-03 0:30 ` Memnon Anon
1 sibling, 1 reply; 10+ messages in thread
From: Bastien @ 2011-07-02 9:29 UTC (permalink / raw)
To: Memnon Anon; +Cc: emacs-orgmode
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
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Function: Extract link location to killring
2011-07-02 9:29 ` Bastien
@ 2011-07-03 0:30 ` Memnon Anon
2011-07-03 11:27 ` Bastien
0 siblings, 1 reply; 10+ messages in thread
From: Memnon Anon @ 2011-07-03 0:30 UTC (permalink / raw)
To: emacs-orgmode
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
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Function: Extract link location to killring
2011-07-03 0:30 ` Memnon Anon
@ 2011-07-03 11:27 ` Bastien
0 siblings, 0 replies; 10+ messages in thread
From: Bastien @ 2011-07-03 11:27 UTC (permalink / raw)
To: Memnon Anon; +Cc: emacs-orgmode
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
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2011-07-03 11:27 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-23 9:31 Copy link at point Christian Moe
2011-06-23 11:03 ` Christian Moe
2011-06-23 12:00 ` Memnon Anon
2011-06-23 12:56 ` Eric S Fraga
2011-06-23 15:42 ` Christian Moe
2011-06-23 12:17 ` Function: Extract link location to killring (was: Copy link at point) Memnon Anon
2011-06-23 14:20 ` Function: Extract link location to killring Christian Moe
2011-07-02 9:29 ` Bastien
2011-07-03 0:30 ` Memnon Anon
2011-07-03 11:27 ` Bastien
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).