From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jacob Gerlach Subject: Internal Links with Spaces Date: Mon, 09 Mar 2015 13:05:40 +0000 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a114412bcf43a140510dab00f Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:56911) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YUxNP-0004yJ-AK for emacs-orgmode@gnu.org; Mon, 09 Mar 2015 09:05:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YUxNN-0003zs-V7 for emacs-orgmode@gnu.org; Mon, 09 Mar 2015 09:05:43 -0400 Received: from mail-qg0-x22a.google.com ([2607:f8b0:400d:c04::22a]:44155) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YUxNN-0003yg-RD for emacs-orgmode@gnu.org; Mon, 09 Mar 2015 09:05:41 -0400 Received: by qgfl89 with SMTP id l89so28031790qgf.11 for ; Mon, 09 Mar 2015 06:05:41 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Org-mode --001a114412bcf43a140510dab00f Content-Type: text/plain; charset=UTF-8 Hi List, I'd like to re-raise the issue discussed here . In short, storing and inserting an internal link to a headline containing spaces using org-store-link and org-insert-link causes export to fail because the space is "hexified" into %20. It seems like the thread died because hexifying links to support external URL's conflicted with internal links containing spaces with no clear path forward. Am I missing further discussion where this was resolved? If not, is a fix still possible or is this a "won't fix" because of the clash with external links? If it's "won't fix", is it possible for me to advise org-insert-link (or some other function) or configure some other individual hack to work around the problem? I never use org-insert-link for URL's, so I'd be glad to blindly stop hexifying even if it breaks that functionality. Regards, Jake --001a114412bcf43a140510dab00f Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi List,

I'd like to re-raise= the issue discussed here. In short, storing and inserting an in= ternal link to a headline containing spaces using org-store-link and org-in= sert-link causes export to fail because the space is "hexified" i= nto %20.

It seems like the thread died because hexifying= links to support external URL's conflicted with internal links contain= ing spaces with no clear path forward.

Am I missin= g further discussion where this was resolved?

If n= ot, is a fix still possible or is this a "won't fix" because = of the clash with external links?

If it's &quo= t;won't fix", is it possible for me to advise org-insert-link (or = some other function) or configure some other individual hack to work around= the problem? I never use org-insert-link for URL's, so I'd be glad= to blindly stop hexifying even if it breaks that functionality.
=
Regards,
Jake
--001a114412bcf43a140510dab00f-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: Leo Ufimtsev Subject: Re: Internal Links with Spaces Date: Mon, 9 Mar 2015 10:38:16 -0400 (EDT) Message-ID: <1825534239.18268273.1425911896744.JavaMail.zimbra@redhat.com> References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_18268272_1644421526.1425911896743" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:49248) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YUyp6-0004IK-BL for emacs-orgmode@gnu.org; Mon, 09 Mar 2015 10:38:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YUyp1-0007hf-OR for emacs-orgmode@gnu.org; Mon, 09 Mar 2015 10:38:24 -0400 Received: from mx5-phx2.redhat.com ([209.132.183.37]:50352) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YUyp1-0007gH-GN for emacs-orgmode@gnu.org; Mon, 09 Mar 2015 10:38:19 -0400 In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Jacob Gerlach Cc: Org-mode ------=_Part_18268272_1644421526.1425911896743 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit On the side, if of any help: I generally use ID's for linking to headings. The benefit is that headings can be re-named safley and links still work. There is an org-module called 'org-id', which when enabled in conjunction with the variable below allows you to automatically generate a unique id for the heading when you press C-c l and link to it with C-c C-l. This exports nicley also. E.g here is a unique anchor link to one of those unique ID's: http://leoufimtsev.github.io./org/swt-dev.html#ID-a636a35d-6100-4f6a-974c-6bbeedc0f2a2 (org-id-link-to-org-use-id (quote create-if-interactive-and-no-custom-id)) '(org-modules (quote (org-id ... Leo Ufimtsev | Intern Software Engineer @ Eclipse Team ----- Original Message ----- From: "Jacob Gerlach" To: "Org-mode" Sent: Monday, March 9, 2015 9:05:40 AM Subject: [O] Internal Links with Spaces Hi List, I'd like to re-raise the issue discussed here . In short, storing and inserting an internal link to a headline containing spaces using org-store-link and org-insert-link causes export to fail because the space is "hexified" into %20. It seems like the thread died because hexifying links to support external URL's conflicted with internal links containing spaces with no clear path forward. Am I missing further discussion where this was resolved? If not, is a fix still possible or is this a "won't fix" because of the clash with external links? If it's "won't fix", is it possible for me to advise org-insert-link (or some other function) or configure some other individual hack to work around the problem? I never use org-insert-link for URL's, so I'd be glad to blindly stop hexifying even if it breaks that functionality. Regards, Jake ------=_Part_18268272_1644421526.1425911896743 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
On the side, if of any help:

I= generally use ID's for linking to headings.
The benefit is that headin= gs can be re-named safley and links still work.

There is an org-modu= le called 'org-id', which when enabled in conjunction with the variable
= below allows you to automatically generate a unique id for the heading when= you press C-c l and link to it with C-c C-l.

This exports nicley al= so. E.g here is a unique anchor link to one of those unique ID's:
http:/= /leoufimtsev.github.io./org/swt-dev.html#ID-a636a35d-6100-4f6a-974c-6bbeedc= 0f2a2

(org-id-link-to-org-use-id (quote create-if-interactive-and-no= -custom-id))

'(org-modules
(quote
(org-id ...

<= div id=3D"abf6255e-ddcd-416f-887c-b48c88bceed6">Leo= Ufimtsev | Intern Software Engineer @ Eclipse Team=



From: "Jacob Gerlach" <jacobgerlach@gmail= .com>
To: "Org-mode" <emacs-orgmode@gnu.org>
Sent:= Monday, March 9, 2015 9:05:40 AM
Subject: [O]  Internal= Links with Spaces

Hi List,

I'd like to re-raise the issue discussed here. In short, s= toring and inserting an internal link to a headline containing spaces using= org-store-link and org-insert-link causes export to fail because the space= is "hexified" into %20.

It seems like the thr= ead died because hexifying links to support external URL's conflicted w= ith internal links containing spaces with no clear path forward.
=
Am I missing further discussion where this was resolved?

If not, is a fix still possible or is this a "wo= n't fix" because of the clash with external links?

<= /div>
If it's "won't fix", is it possible for me to a= dvise org-insert-link (or some other function) or configure some other indi= vidual hack to work around the problem? I never use org-insert-link for URL= 's, so I'd be glad to blindly stop hexifying even if it breaks that= functionality.

Regards,
Jake

------=_Part_18268272_1644421526.1425911896743-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jacob Gerlach Subject: Re: Internal Links with Spaces Date: Mon, 9 Mar 2015 16:50:51 -0400 Message-ID: References: <1825534239.18268273.1425911896744.JavaMail.zimbra@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:58760) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YV4dZ-0007mE-1r for emacs-orgmode@gnu.org; Mon, 09 Mar 2015 16:50:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YV4dY-0002x6-4i for emacs-orgmode@gnu.org; Mon, 09 Mar 2015 16:50:53 -0400 Received: from mail-qg0-x22f.google.com ([2607:f8b0:400d:c04::22f]:34980) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YV4dX-0002ws-Qd for emacs-orgmode@gnu.org; Mon, 09 Mar 2015 16:50:51 -0400 Received: by qgfh3 with SMTP id h3so31765819qgf.2 for ; Mon, 09 Mar 2015 13:50:51 -0700 (PDT) In-Reply-To: <1825534239.18268273.1425911896744.JavaMail.zimbra@redhat.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Leo Ufimtsev Cc: Org-mode On Mon, Mar 9, 2015 at 10:38 AM, Leo Ufimtsev wrote: > On the side, if of any help: > > I generally use ID's for linking to headings. > The benefit is that headings can be re-named safley and links still work. A great suggestion. I wasn't aware of the feature, and renaming safety is a great benefit while also solving my space problem. I don't suppose there's a trick to automatically update descriptions for links whose target has been renamed? When exploring this, I found the function org-id-store-link. This seemed like what I wanted - it creates a custom ID if one doesn't exist, but it doesn't actually store a link (or at least, it wasn't available when I then ran org-insert-link). The docstring is pretty light, but it seems like this might be a bug. Is this the expected behavior? Thanks for the pointer in any case. Regards, Jake From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: Re: Internal Links with Spaces Date: Mon, 09 Mar 2015 19:28:41 -0400 Message-ID: References: <1825534239.18268273.1425911896744.JavaMail.zimbra@redhat.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:45744) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YV76P-000352-G4 for emacs-orgmode@gnu.org; Mon, 09 Mar 2015 19:28:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YV76K-0002Tt-Iw for emacs-orgmode@gnu.org; Mon, 09 Mar 2015 19:28:49 -0400 Received: from mail-qg0-x236.google.com ([2607:f8b0:400d:c04::236]:39564) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YV76K-0002Tn-Dk for emacs-orgmode@gnu.org; Mon, 09 Mar 2015 19:28:44 -0400 Received: by qgdq107 with SMTP id q107so32655287qgd.6 for ; Mon, 09 Mar 2015 16:28:44 -0700 (PDT) In-reply-to: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Jacob Gerlach Cc: Leo Ufimtsev , Org-mode I think you need to set (setq org-id-link-to-org-use-id 'create-if-interactive) Then the usual C-c l and C-c C-l should work to store links and insert them. It might be worth noting though, that in my experience, this is most useful for links within a file, or to files in your agenda list. org does not have a good way to find an id in a non-agenda file if that file is not already open. Although there should be a .org-id-locations file somewhere that stores this mapping of id to file. I have not experienced 100% success with this. Also, you have to be a little cautious about copying a headline to another place, because then you have two ids in different places. anyway, the point is try it out and see if it works for you ;) Jacob Gerlach writes: > On Mon, Mar 9, 2015 at 10:38 AM, Leo Ufimtsev wrote: >> On the side, if of any help: >> >> I generally use ID's for linking to headings. >> The benefit is that headings can be re-named safley and links still work. > > A great suggestion. I wasn't aware of the feature, and renaming safety > is a great benefit while also solving my space problem. > > I don't suppose there's a trick to automatically update descriptions > for links whose target has been renamed? > > When exploring this, I found the function org-id-store-link. This > seemed like what I wanted - it creates a custom ID if one doesn't > exist, but it doesn't actually store a link (or at least, it wasn't > available when I then ran org-insert-link). The docstring is pretty > light, but it seems like this might be a bug. Is this the expected > behavior? > > Thanks for the pointer in any case. > > Regards, > Jake -- Professor John Kitchin Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 @johnkitchin http://kitchingroup.cheme.cmu.edu From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: Re: Internal Links with Spaces Date: Tue, 10 Mar 2015 10:30:28 -0400 Message-ID: References: <1825534239.18268273.1425911896744.JavaMail.zimbra@redhat.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7bea2e3a0b48480510effeba Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:50381) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YVLB2-0000l7-B8 for emacs-orgmode@gnu.org; Tue, 10 Mar 2015 10:30:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YVLB1-0001Yy-0o for emacs-orgmode@gnu.org; Tue, 10 Mar 2015 10:30:32 -0400 Received: from mail-pd0-x230.google.com ([2607:f8b0:400e:c02::230]:39146) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YVLB0-0001YX-Ql for emacs-orgmode@gnu.org; Tue, 10 Mar 2015 10:30:30 -0400 Received: by pdbft15 with SMTP id ft15so2172144pdb.6 for ; Tue, 10 Mar 2015 07:30:29 -0700 (PDT) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Jacob Gerlach , "emacs-orgmode@gnu.org" --047d7bea2e3a0b48480510effeba Content-Type: text/plain; charset=UTF-8 I am not sure what the convention there is. John ----------------------------------- Professor John Kitchin Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 @johnkitchin http://kitchingroup.cheme.cmu.edu On Tue, Mar 10, 2015 at 10:05 AM, Jacob Gerlach wrote: > On Mon, Mar 9, 2015 at 7:28 PM John Kitchin > wrote: > > > > I think you need to set > > > > (setq org-id-link-to-org-use-id 'create-if-interactive) > > Indeed, this is a variation of what Leo suggested and customizing > org-id-link-to-org-use-id is working well for me. > > After perusing the source code further, I think that my confusion > about org-id-store-link arose because this function isn't intended to > be called on it's own (it's called by org-store-link when appropriate > based on the value of org-id-link-to-org-use-id). > > I've seen a double hyphen in function names to sometimes indicate > internal functions. Would this function be more appropriately named > org-id--store-link or am I misunderstanding the convention? > > Regards, > Jake > --047d7bea2e3a0b48480510effeba Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
I am not sure what the convention there is.

John

---------------------------= --------
Professor John Kitchin=C2=A0
Doherty Hall A207F
Departmen= t of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 1= 5213
412-268-7803


--047d7bea2e3a0b48480510effeba-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jacob Gerlach Subject: Re: Internal Links with Spaces Date: Tue, 10 Mar 2015 10:39:54 -0400 Message-ID: References: <1825534239.18268273.1425911896744.JavaMail.zimbra@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:54068) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YVLK8-0007wN-G4 for emacs-orgmode@gnu.org; Tue, 10 Mar 2015 10:40:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YVLK7-00058p-BX for emacs-orgmode@gnu.org; Tue, 10 Mar 2015 10:39:56 -0400 Received: from mail-qg0-x22b.google.com ([2607:f8b0:400d:c04::22b]:44860) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YVLK7-00058f-7V for emacs-orgmode@gnu.org; Tue, 10 Mar 2015 10:39:55 -0400 Received: by qgfl89 with SMTP id l89so2241865qgf.11 for ; Tue, 10 Mar 2015 07:39:54 -0700 (PDT) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: John Kitchin Cc: Leo Ufimtsev , Org-mode On Mon, Mar 9, 2015 at 7:28 PM, John Kitchin wrote: > I think you need to set > > (setq org-id-link-to-org-use-id 'create-if-interactive) Indeed, this is a variation of what Leo suggested and customizing org-id-link-to-org-use-id is almost working for me... Unfortunately, I want the links to export to latex using latex \ref{}'s and section labels. A link stored with a custom id has to have a description to have a reasonably readable org buffer, but links with descriptions are exported using the headline text instead of the section number. Is there a workaround for this? On Mon, Mar 9, 2015 at 4:50 PM, Jacob Gerlach wrote: > When exploring this, I found the function org-id-store-link. This > seemed like what I wanted - it creates a custom ID if one doesn't > exist, but it doesn't actually store a link (or at least, it wasn't > available when I then ran org-insert-link). The docstring is pretty > light, but it seems like this might be a bug. Is this the expected > behavior? After perusing the source code further, I think that my confusion about org-id-store-link arose because this function isn't intended to be called on it's own (it's called by org-store-link when appropriate based on the value of org-id-link-to-org-use-id). I've seen a double hyphen in function names to sometimes indicate internal functions. Would this function be more appropriately named org-id--store-link or am I misunderstanding the convention? Regards, Jake From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jacob Gerlach Subject: Re: Internal Links with Spaces Date: Tue, 10 Mar 2015 15:47:44 -0400 Message-ID: References: <1825534239.18268273.1425911896744.JavaMail.zimbra@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:55871) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YVQ82-00027c-9O for emacs-orgmode@gnu.org; Tue, 10 Mar 2015 15:47:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YVQ81-0002Nb-6q for emacs-orgmode@gnu.org; Tue, 10 Mar 2015 15:47:46 -0400 Received: from mail-qc0-x230.google.com ([2607:f8b0:400d:c01::230]:41322) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YVQ81-0002NX-1m for emacs-orgmode@gnu.org; Tue, 10 Mar 2015 15:47:45 -0400 Received: by qcrw7 with SMTP id w7so4785939qcr.8 for ; Tue, 10 Mar 2015 12:47:44 -0700 (PDT) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: John Kitchin , Org-mode On Tue, Mar 10, 2015 at 12:12 PM, John Kitchin wrote: > As far as I know you have only two options to use refs to a headline in > Latex export. > > 1) Use a CUSTOM_ID property on a heading and then use [[#your-custom-id]] as > your link. You have to put relevant text in like: see section > [[#your-custom-id]]. If you want readable custom-ids you should make > them yourself, e.g. C-c C-x p CUSTOM_ID your-custom-id, or craft an > elisp function that prompts you for the custom-id and sets it for you, > maybe even copying it to the kill-ring so it is easy to insert later. > > 2) Put \label{some-name} in the heading (yes, it is not pretty), e.g. > > * Results \label{sec-results} > > and use \ref{some-name} where you want the link to export to (or, if you > use org-ref you can use ref:some-name which will be a clickable link, > and also label:sec-results which is also a functional link). You still > have to put relevant text in, e.g. see section ref:some-label. Thanks to John for the recommendations, but given these options, I'm more attracted to solving the original problem with the % escaped spaces. I came up with the following wrapper function - it successfully replaces the hex encoded spaces (elisp feedback welcome): (defun jg/insert-link-unescape-spaces () (interactive) (org-insert-link) (save-excursion (let ((beg (point))) (org-previous-link) (let ((end (point))) (replace-string "%20" " " nil beg end))))) After finally getting this function to work, I discovered that I had the same problem as when I used org-id: the link description causes exported latex references to use the headline text instead of the \label{}. Any (of several) attempts to insert a link so that it has no description is foiled. I think this is done by org-make-link-string, which just re-uses the link text for the description when none is given. In any case, here's an ugly hack to manually remove the description. This works for me, but I'd love to find a more elegant approach: (defun jg/insert-link-unescape-spaces () (interactive) (org-insert-link) (save-excursion (let ((beg (point))) (org-previous-link) (let ((end (point))) (replace-string "%20" " " nil beg end)))) ;expose the link so that search can see brackets (delete-char -1) (let ((end (point)) (beg (search-backward "["))) (delete-region beg end) (insert "]"))) Alternatively, if someone has a latex export hack that forces links to reference labels instead of headline text (even when the org link has a description), I'd be interested in that. It seems like this would be a common request for exporting scientific writing to latex (unless those users prefer one of the approaches John suggested above). Regards, Jake