emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Bug: Can't export subtree with links to headlines outside of the subtree [8.3.1 (8.3.1-95-g1dbb25-elpa)]
@ 2015-09-01 18:14 Michael Behr
  2015-09-01 18:29 ` Nicolas Goaziou
  2015-09-01 19:10 ` Marcin Borkowski
  0 siblings, 2 replies; 5+ messages in thread
From: Michael Behr @ 2015-09-01 18:14 UTC (permalink / raw)
  To: emacs-orgmode

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

I want to export a subtree of a file, but that subtree has links to
headings in the file that are outside of the subtree. I expect the
exporting process to produce some sort of valid result, but instead it
throws an "Unable to resolve link" error. Here's a test file to
reproduce:

* Foo
* Bar :export:
[[*Foo][Foo]]

Making a file with those contents and trying to export it to e.g.
latex will fail, but if the :export: tag is removed, exporting
succeeds. I can't easily get a backtrace because the error comes from
user-error, but it happens in org-export-resolve-fuzzy-link.

Of course the exported file can't link to a target that doesn't exist,
but it's probably better to strip out the link in this case than to
throw an error, right?

Emacs  : GNU Emacs 24.4.1 (x86_64-apple-darwin13.4.0, NS
apple-appkit-1265.21)
 of 2014-10-20 on builder10-9.porkrind.org
Package: Org-mode version 8.3.1 (8.3.1-95-g1dbb25-elpa)

current state:
==============
(setq
 org-tab-first-hook '(org-hide-block-toggle-maybe
     org-babel-hide-result-toggle-maybe
     org-babel-header-arg-expand)
 org-speed-command-hook '(org-speed-command-default-hook
 org-babel-speed-command-hook)
 org-occur-hook '(org-first-headline-recenter)
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-html-format-drawer-function '(lambda (name contents) contents)
 org-latex-format-inlinetask-function
'org-latex-format-inlinetask-default-function
 org-confirm-shell-link-function 'yes-or-no-p
 org-ascii-format-inlinetask-function 'org-ascii-format-inlinetask-default
 org-latex-format-headline-function
'org-latex-format-headline-default-function
 org-after-todo-state-change-hook '(org-clock-out-if-current)
 org-latex-format-drawer-function '(lambda (name contents) contents)
 org-src-mode-hook '(org-src-babel-configure-edit-buffer
    org-src-mode-configure-edit-buffer)
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-babel-pre-tangle-hook '(save-buffer)
 org-mode-hook '(#[nil "\300\301\302\303\304$\207"
  [org-add-hook change-major-mode-hook org-show-block-all
   append local]
  5]
#[nil "\300\301\302\303\304$\207"
  [org-add-hook change-major-mode-hook
   org-babel-show-result-all append local]
  5]
org-babel-result-hide-spec org-babel-hide-all-hashes)
 org-archive-hook '(org-attach-archive-delete-maybe)
 org-ascii-format-drawer-function '(lambda (name contents width) contents)
 org-ctrl-c-ctrl-c-hook '(org-babel-hash-at-point
 org-babel-execute-safely-maybe)
 org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers
 org-cycle-show-empty-lines
 org-optimize-window-after-visibility-change)
 org-confirm-elisp-link-function 'yes-or-no-p
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-html-format-headline-function
'org-html-format-headline-default-function
 org-html-format-inlinetask-function
'org-html-format-inlinetask-default-function
 org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
 )

[-- Attachment #2: Type: text/html, Size: 4641 bytes --]

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

* Re: Bug: Can't export subtree with links to headlines outside of the subtree [8.3.1 (8.3.1-95-g1dbb25-elpa)]
  2015-09-01 18:14 Bug: Can't export subtree with links to headlines outside of the subtree [8.3.1 (8.3.1-95-g1dbb25-elpa)] Michael Behr
@ 2015-09-01 18:29 ` Nicolas Goaziou
  2015-09-01 18:39   ` Michael Behr
  2015-09-01 19:10 ` Marcin Borkowski
  1 sibling, 1 reply; 5+ messages in thread
From: Nicolas Goaziou @ 2015-09-01 18:29 UTC (permalink / raw)
  To: Michael Behr; +Cc: emacs-orgmode

Hello,

Michael Behr <mkbehr@gmail.com> writes:

> I want to export a subtree of a file, but that subtree has links to
> headings in the file that are outside of the subtree. I expect the
> exporting process to produce some sort of valid result, but instead it
> throws an "Unable to resolve link" error. Here's a test file to
> reproduce:
>
> * Foo
> * Bar :export:
> [[*Foo][Foo]]
>
> Making a file with those contents and trying to export it to e.g.
> latex will fail, but if the :export: tag is removed, exporting
> succeeds. I can't easily get a backtrace because the error comes from
> user-error, but it happens in org-export-resolve-fuzzy-link.
>
> Of course the exported file can't link to a target that doesn't exist,
> but it's probably better to strip out the link in this case than to
> throw an error, right?

Actually, wrong. It was discussed already, and the current trend is to
throw an error instead of silently dropping the link.

Can't you just filter it out before exporting?


Regards,

-- 
Nicolas Goaziou

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

* Re: Bug: Can't export subtree with links to headlines outside of the subtree [8.3.1 (8.3.1-95-g1dbb25-elpa)]
  2015-09-01 18:29 ` Nicolas Goaziou
@ 2015-09-01 18:39   ` Michael Behr
  2015-09-01 19:20     ` Nicolas Goaziou
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Behr @ 2015-09-01 18:39 UTC (permalink / raw)
  To: Michael Behr, emacs-orgmode

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

My use case is a large file of notes that I want to typeset frequently as I
update it, so that won't work for me unless there's an easy way to pass a
filtered version of the file to the exporter.

Personally I'd prefer a customization option to change this behavior, but
if that's not doable I'll work around it. Might be worth putting a note
about it in the manual, though.

(I can't find the previous discussion of this, so sorry if I'm retreading
old ground.)

Thanks,
Michael

On Tue, Sep 1, 2015 at 2:29 PM, Nicolas Goaziou <mail@nicolasgoaziou.fr>
wrote:

> Hello,
>
> Michael Behr <mkbehr@gmail.com> writes:
>
> > I want to export a subtree of a file, but that subtree has links to
> > headings in the file that are outside of the subtree. I expect the
> > exporting process to produce some sort of valid result, but instead it
> > throws an "Unable to resolve link" error. Here's a test file to
> > reproduce:
> >
> > * Foo
> > * Bar :export:
> > [[*Foo][Foo]]
> >
> > Making a file with those contents and trying to export it to e.g.
> > latex will fail, but if the :export: tag is removed, exporting
> > succeeds. I can't easily get a backtrace because the error comes from
> > user-error, but it happens in org-export-resolve-fuzzy-link.
> >
> > Of course the exported file can't link to a target that doesn't exist,
> > but it's probably better to strip out the link in this case than to
> > throw an error, right?
>
> Actually, wrong. It was discussed already, and the current trend is to
> throw an error instead of silently dropping the link.
>
> Can't you just filter it out before exporting?
>
>
> Regards,
>
> --
> Nicolas Goaziou
>

[-- Attachment #2: Type: text/html, Size: 2373 bytes --]

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

* Re: Bug: Can't export subtree with links to headlines outside of the subtree [8.3.1 (8.3.1-95-g1dbb25-elpa)]
  2015-09-01 18:14 Bug: Can't export subtree with links to headlines outside of the subtree [8.3.1 (8.3.1-95-g1dbb25-elpa)] Michael Behr
  2015-09-01 18:29 ` Nicolas Goaziou
@ 2015-09-01 19:10 ` Marcin Borkowski
  1 sibling, 0 replies; 5+ messages in thread
From: Marcin Borkowski @ 2015-09-01 19:10 UTC (permalink / raw)
  To: emacs-orgmode


On 2015-09-01, at 20:14, Michael Behr <mkbehr@gmail.com> wrote:

> I want to export a subtree of a file, but that subtree has links to
> headings in the file that are outside of the subtree. I expect the
> exporting process to produce some sort of valid result, but instead it
> throws an "Unable to resolve link" error. Here's a test file to

This /might/ be helpful: https://github.com/mbork/org-one-to-many

Best,

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University

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

* Re: Bug: Can't export subtree with links to headlines outside of the subtree [8.3.1 (8.3.1-95-g1dbb25-elpa)]
  2015-09-01 18:39   ` Michael Behr
@ 2015-09-01 19:20     ` Nicolas Goaziou
  0 siblings, 0 replies; 5+ messages in thread
From: Nicolas Goaziou @ 2015-09-01 19:20 UTC (permalink / raw)
  To: Michael Behr; +Cc: emacs-orgmode

Michael Behr <mkbehr@gmail.com> writes:

> My use case is a large file of notes that I want to typeset frequently as I
> update it, so that won't work for me unless there's an easy way to pass a
> filtered version of the file to the exporter.

There are hooks, e.g. `org-export-before-processing-hook' where you can
comment out offending links.

> Personally I'd prefer a customization option to change this behavior, but
> if that's not doable I'll work around it. Might be worth putting a note
> about it in the manual, though.

A customizable option sounds reasonable, indeed. Do you want to provide
a patch?

> (I can't find the previous discussion of this, so sorry if I'm retreading
> old ground.)

This was introduced in commit dc08e98885015c27196843aeb62bde287da84873,
dating back to 11 March. You may want to browse the list archives around
that period if you're interested.


Regards,

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

end of thread, other threads:[~2015-09-01 19:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-01 18:14 Bug: Can't export subtree with links to headlines outside of the subtree [8.3.1 (8.3.1-95-g1dbb25-elpa)] Michael Behr
2015-09-01 18:29 ` Nicolas Goaziou
2015-09-01 18:39   ` Michael Behr
2015-09-01 19:20     ` Nicolas Goaziou
2015-09-01 19:10 ` Marcin Borkowski

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