emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* copying text from links makes it with a starting [[
@ 2022-12-27 13:06 Luca Ferrari
  2022-12-27 13:26 ` Ihor Radchenko
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Luca Ferrari @ 2022-12-27 13:06 UTC (permalink / raw)
  To: emacs-org list

Hi all,
I'm not sure this is an org problem, rather a clipboard problem or
what else, but when I select an org link in Emacs and I copy into my
Firefox browser, the link has always a starting pair of square
brackets (e.g. [[https://...).
What puzzles me is that there are no ending brackets, as it would make
more sense to me.
Is there a way to insrtument Emacs to copy in the clipboard only the
marked text and not the org mode formatting text?

I'm running Emacs 28.2 and org 9.5.5

Thanks,
Luca


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: copying text from links makes it with a starting [[
  2022-12-27 13:06 copying text from links makes it with a starting [[ Luca Ferrari
@ 2022-12-27 13:26 ` Ihor Radchenko
  2023-01-12  7:42   ` Luca Ferrari
  2022-12-27 14:34 ` Esteban Ordóñez
  2022-12-27 15:20 ` Max Nikulin
  2 siblings, 1 reply; 10+ messages in thread
From: Ihor Radchenko @ 2022-12-27 13:26 UTC (permalink / raw)
  To: Luca Ferrari; +Cc: emacs-org list

Luca Ferrari <fluca1978@gmail.com> writes:

> I'm not sure this is an org problem, rather a clipboard problem or
> what else, but when I select an org link in Emacs and I copy into my
> Firefox browser, the link has always a starting pair of square
> brackets (e.g. [[https://...).
> What puzzles me is that there are no ending brackets, as it would make
> more sense to me.

Could you please provide more details about what is happening?
What exactly do you do to copy the link?
See https://orgmode.org/manual/Feedback.html#Feedback

> Is there a way to insrtument Emacs to copy in the clipboard only the
> marked text and not the org mode formatting text?

If you configure Org to hide parts of the links, you can use
org-copy-visible.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: copying text from links makes it with a starting [[
  2022-12-27 13:06 copying text from links makes it with a starting [[ Luca Ferrari
  2022-12-27 13:26 ` Ihor Radchenko
@ 2022-12-27 14:34 ` Esteban Ordóñez
  2022-12-27 14:42   ` Esteban Ordóñez
  2022-12-27 15:20 ` Max Nikulin
  2 siblings, 1 reply; 10+ messages in thread
From: Esteban Ordóñez @ 2022-12-27 14:34 UTC (permalink / raw)
  To: emacs-orgmode

El 2022-12-27 08:06, Luca Ferrari escribió:
> Hi all,
> I'm not sure this is an org problem, rather a clipboard problem or
> what else, but when I select an org link in Emacs and I copy into my
> Firefox browser, the link has always a starting pair of square
> brackets (e.g. [[https://...).
> What puzzles me is that there are no ending brackets, as it would make
> more sense to me.

What you are probably doing is removing the ]] at the closing to see the
link.  Then you are copying the link with the openning [[.  And then you
are pasting it with that on you browser.

As Ighor wrote, please post the exact details of what you did so we can
do it the same way as you do in our own environment.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: copying text from links makes it with a starting [[
  2022-12-27 14:34 ` Esteban Ordóñez
@ 2022-12-27 14:42   ` Esteban Ordóñez
  0 siblings, 0 replies; 10+ messages in thread
From: Esteban Ordóñez @ 2022-12-27 14:42 UTC (permalink / raw)
  To: emacs-orgmode

El 2022-12-27 09:34, Esteban Ordóñez escribió:

> As Ighor wrote, please post the exact details of what you did so we can
> do it the same way as you do in our own environment.

Sorry for the typo, Ihor!


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: copying text from links makes it with a starting [[
  2022-12-27 13:06 copying text from links makes it with a starting [[ Luca Ferrari
  2022-12-27 13:26 ` Ihor Radchenko
  2022-12-27 14:34 ` Esteban Ordóñez
@ 2022-12-27 15:20 ` Max Nikulin
  2 siblings, 0 replies; 10+ messages in thread
From: Max Nikulin @ 2022-12-27 15:20 UTC (permalink / raw)
  To: Luca Ferrari, emacs-org list

On 27/12/2022 20:06, Luca Ferrari wrote:
> I'm not sure this is an org problem, rather a clipboard problem or
> what else, but when I select an org link in Emacs and I copy into my
> Firefox browser, the link has always a starting pair of square
> brackets (e.g. [[https://...).

Selecting link to copy it to an external application or even to a 
non-org buffer has another problem. Some links may contain square 
brackets. Org needs to escape them (and backslash character as well). To 
reliably copy a link, it is necessary to define a dedicated command what 
unescapes URL. Alternatively you may copy URL using C-c C-l 
(`org-insert-link') and abort the command after that.

Besides copy, another action is open URL (C-c C-o) and it should handle 
unescaping properly. Depending on your environment, you may need to 
configure the browse-url package to use the preferred browser.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: copying text from links makes it with a starting [[
  2022-12-27 13:26 ` Ihor Radchenko
@ 2023-01-12  7:42   ` Luca Ferrari
  2023-01-12  8:32     ` tomas
                       ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Luca Ferrari @ 2023-01-12  7:42 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-org list

On Tue, Dec 27, 2022 at 2:26 PM Ihor Radchenko <yantar92@posteo.net> wrote:
>
> Luca Ferrari <fluca1978@gmail.com> writes:
> Could you please provide more details about what is happening?
> What exactly do you do to copy the link?
> See https://orgmode.org/manual/Feedback.html#Feedback
>

Imagine I've this org fragment:

Link: [[https://foo.com]]

where the link is displayed without brackets, in org mode.
I place the point at the beginning of the first visibile character,
hence the 'h', and the C-space M-e M-w and then go to another
application and paste the content of the clipboard.
I've seen that sometimes the link is copied as text, so both beginning
and ending brackets are there, but with long links the ending brackets
are not there, but it could be they I remove them accidentally.
I would like to copy only the visible part, but I guess there's no
solution unless I do something manually or configure a web package to
open the link into another application.


Luca


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: copying text from links makes it with a starting [[
  2023-01-12  7:42   ` Luca Ferrari
@ 2023-01-12  8:32     ` tomas
  2023-01-12  9:15     ` Ruijie Yu via General discussions about Org-mode.
  2023-01-13  8:40     ` Ihor Radchenko
  2 siblings, 0 replies; 10+ messages in thread
From: tomas @ 2023-01-12  8:32 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1374 bytes --]

On Thu, Jan 12, 2023 at 08:42:54AM +0100, Luca Ferrari wrote:
> On Tue, Dec 27, 2022 at 2:26 PM Ihor Radchenko <yantar92@posteo.net> wrote:
> >
> > Luca Ferrari <fluca1978@gmail.com> writes:
> > Could you please provide more details about what is happening?
> > What exactly do you do to copy the link?
> > See https://orgmode.org/manual/Feedback.html#Feedback
> >
> 
> Imagine I've this org fragment:
> 
> Link: [[https://foo.com]]
> 
> where the link is displayed without brackets, in org mode.
> I place the point at the beginning of the first visibile character,
> hence the 'h', and the C-space M-e M-w and then go to another
> application and paste the content of the clipboard.
> I've seen that sometimes the link is copied as text, so both beginning
> and ending brackets are there, but with long links the ending brackets
> are not there, but it could be they I remove them accidentally.
> I would like to copy only the visible part, but I guess there's no
> solution unless I do something manually or configure a web package to
> open the link into another application.

Perhaps what's needed is to teach M-e (org-forward-sentence) to handle
this.

The challenge still is that you don't quite know whether the link
"consumer" wants to have the wrapping [[...]] or not, since the
consumer isn't known at "copy" time.

Cheers
-- 
t

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: copying text from links makes it with a starting [[
  2023-01-12  7:42   ` Luca Ferrari
  2023-01-12  8:32     ` tomas
@ 2023-01-12  9:15     ` Ruijie Yu via General discussions about Org-mode.
  2023-01-13  8:40     ` Ihor Radchenko
  2 siblings, 0 replies; 10+ messages in thread
From: Ruijie Yu via General discussions about Org-mode. @ 2023-01-12  9:15 UTC (permalink / raw)
  To: Luca Ferrari; +Cc: Ihor Radchenko, emacs-org list


> On Jan 12, 2023, at 15:45, Luca Ferrari <fluca1978@gmail.com> wrote:
> 
> On Tue, Dec 27, 2022 at 2:26 PM Ihor Radchenko <yantar92@posteo.net> wrote:
>> 
>> Luca Ferrari <fluca1978@gmail.com> writes:
>> Could you please provide more details about what is happening?
>> What exactly do you do to copy the link?
>> See https://orgmode.org/manual/Feedback.html#Feedback
>> 
> 
> Imagine I've this org fragment:
> 
> Link: [[https://foo.com]]
> 
> where the link is displayed without brackets, in org mode.
> I place the point at the beginning of the first visibile character,
> hence the 'h', and the C-space M-e M-w and then go to another
> application and paste the content of the clipboard.
> I've seen that sometimes the link is copied as text, so both beginning
> and ending brackets are there, but with long links the ending brackets
> are not there, but it could be they I remove them accidentally.
> I would like to copy only the visible part, but I guess there's no
> solution unless I do something manually or configure a web package to
> open the link into another application.
> 
> 
> Luca

Hi Luca,

If all you want to do is to copy the (visible) URI without its surrounding brackets, then maybe you can take a look at how C-c C-l is implemented regarding how it gets the URI, and from there figure out how you can put the URI into the kill ring. 

Otherwise if you want to copy portions of the URI without also copying the opening brackets, then I suppose there might have to be specialized commands for C-w and friends that handles opening brackets? 

Best,


RY


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: copying text from links makes it with a starting [[
  2023-01-12  7:42   ` Luca Ferrari
  2023-01-12  8:32     ` tomas
  2023-01-12  9:15     ` Ruijie Yu via General discussions about Org-mode.
@ 2023-01-13  8:40     ` Ihor Radchenko
  2023-01-14  0:06       ` Samuel Wales
  2 siblings, 1 reply; 10+ messages in thread
From: Ihor Radchenko @ 2023-01-13  8:40 UTC (permalink / raw)
  To: Luca Ferrari; +Cc: emacs-org list

Luca Ferrari <fluca1978@gmail.com> writes:

>> What exactly do you do to copy the link?
>> See https://orgmode.org/manual/Feedback.html#Feedback
>>
>
> Imagine I've this org fragment:
>
> Link: [[https://foo.com]]
>
> where the link is displayed without brackets, in org mode.
> I place the point at the beginning of the first visibile character,
> hence the 'h', and the C-space M-e M-w and then go to another
> application and paste the content of the clipboard.

Then, brackets being included is expected behaviour. Org cannot really
know whether you want to copy link as actual link or as Org markup.

If your link also contains escaped symbols, copying becomes even more
tricky: [[https:test.asd/\]\]s]] (original link: <https:test.asd/]]s>)

I am not sure what would be the best interface in your situation other
than creating a dedicated function to copy the link address.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: copying text from links makes it with a starting [[
  2023-01-13  8:40     ` Ihor Radchenko
@ 2023-01-14  0:06       ` Samuel Wales
  0 siblings, 0 replies; 10+ messages in thread
From: Samuel Wales @ 2023-01-14  0:06 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Luca Ferrari, emacs-org list

what i do is the dumb solution.  c-c c-l, kill the url, c-g.

On 1/13/23, Ihor Radchenko <yantar92@posteo.net> wrote:
> Luca Ferrari <fluca1978@gmail.com> writes:
>
>>> What exactly do you do to copy the link?
>>> See https://orgmode.org/manual/Feedback.html#Feedback
>>>
>>
>> Imagine I've this org fragment:
>>
>> Link: [[https://foo.com]]
>>
>> where the link is displayed without brackets, in org mode.
>> I place the point at the beginning of the first visibile character,
>> hence the 'h', and the C-space M-e M-w and then go to another
>> application and paste the content of the clipboard.
>
> Then, brackets being included is expected behaviour. Org cannot really
> know whether you want to copy link as actual link or as Org markup.
>
> If your link also contains escaped symbols, copying becomes even more
> tricky: [[https:test.asd/\]\]s]] (original link: <https:test.asd/]]s>)
>
> I am not sure what would be the best interface in your situation other
> than creating a dedicated function to copy the link address.
>
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at <https://orgmode.org/>.
> Support Org development at <https://liberapay.com/org-mode>,
> or support my work at <https://liberapay.com/yantar92>
>
>


-- 
The Kafka Pandemic

A blog about science, health, human rights, and misopathy:
https://thekafkapandemic.blogspot.com


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-01-14  0:07 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-27 13:06 copying text from links makes it with a starting [[ Luca Ferrari
2022-12-27 13:26 ` Ihor Radchenko
2023-01-12  7:42   ` Luca Ferrari
2023-01-12  8:32     ` tomas
2023-01-12  9:15     ` Ruijie Yu via General discussions about Org-mode.
2023-01-13  8:40     ` Ihor Radchenko
2023-01-14  0:06       ` Samuel Wales
2022-12-27 14:34 ` Esteban Ordóñez
2022-12-27 14:42   ` Esteban Ordóñez
2022-12-27 15:20 ` Max Nikulin

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).