emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* export regions of a org files to other formats (most likely only to a buffer).
@ 2022-05-25 14:35 Uwe Brauer
  2022-05-25 15:19 ` William Denton
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Uwe Brauer @ 2022-05-25 14:35 UTC (permalink / raw)
  To: emacs-orgmode

Hi 

Sometimes I only want to convert/export a region or a paragraph of an
org file to another format, most likely as html or latex. 
I cannot find such a functionality also not in the package system
does anybody knows about such a function?

Regards

Uwe Brauer 


-- 
I strongly condemn Putin's war of aggression against the Ukraine.
I support to deliver weapons to Ukraine's military. 
I support the ban of Russia from SWIFT.
I support the EU membership of the Ukraine. 



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

* Re: export regions of a org files to other formats (most likely only to a buffer).
  2022-05-25 14:35 export regions of a org files to other formats (most likely only to a buffer) Uwe Brauer
@ 2022-05-25 15:19 ` William Denton
  2022-05-25 15:36   ` Uwe Brauer
  2022-05-25 15:21 ` Kaushal Modi
  2022-05-25 15:26 ` Eric S Fraga
  2 siblings, 1 reply; 12+ messages in thread
From: William Denton @ 2022-05-25 15:19 UTC (permalink / raw)
  To: Uwe Brauer; +Cc: emacs-orgmode

On 25 May 2022, Uwe Brauer wrote:

> Sometimes I only want to convert/export a region or a paragraph of an
> org file to another format, most likely as html or latex.

Is this different from subtree export?  After C-c C-e, C-s will toggle "export 
scope" between buffer and subtree.  (There's also C-v to toggle "visible only" 
export, which I've never used.)  Or would it work to add a heading for the 
paragraph temporarily, just for export?


Bill

--
William Denton
https://www.miskatonic.org/
Librarian, artist and licensed private investigator.
Toronto, Canada


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

* Re: export regions of a org files to other formats (most likely only to a buffer).
  2022-05-25 14:35 export regions of a org files to other formats (most likely only to a buffer) Uwe Brauer
  2022-05-25 15:19 ` William Denton
@ 2022-05-25 15:21 ` Kaushal Modi
  2022-05-25 15:26 ` Eric S Fraga
  2 siblings, 0 replies; 12+ messages in thread
From: Kaushal Modi @ 2022-05-25 15:21 UTC (permalink / raw)
  To: emacs-org list

On Wed, May 25, 2022 at 11:09 AM Uwe Brauer <oub@mat.ucm.es> wrote:
>
> Hi
>
> Sometimes I only want to convert/export a region or a paragraph of an
> org file to another format, most likely as html or latex.
> I cannot find such a functionality also not in the package system
> does anybody knows about such a function?

Check out this recent thread:
https://lists.gnu.org/r/emacs-orgmode/2022-05/msg00004.html
It concludes with a solution on how to convert a region in Org buffer
to Markdown. You can do something similar for any exporter.

http://mbork.pl/2021-05-02_Org-mode_to_Markdown_via_the_clipboard


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

* Re: export regions of a org files to other formats (most likely only to a buffer).
  2022-05-25 14:35 export regions of a org files to other formats (most likely only to a buffer) Uwe Brauer
  2022-05-25 15:19 ` William Denton
  2022-05-25 15:21 ` Kaushal Modi
@ 2022-05-25 15:26 ` Eric S Fraga
  2 siblings, 0 replies; 12+ messages in thread
From: Eric S Fraga @ 2022-05-25 15:26 UTC (permalink / raw)
  To: emacs-orgmode

On Wednesday, 25 May 2022 at 16:35, Uwe Brauer wrote:
> Sometimes I only want to convert/export a region or a paragraph of an
> org file to another format, most likely as html or latex.
> I cannot find such a functionality also not in the package system
> does anybody knows about such a function?

You can narrow your buffer to the region, (narrow-to-region, C-x n r),
and export then.  I believe this will work.

Alternatively, you can always export the contents of a sub-heading by
specifying C-s during export, e.g C-c C-e C-s l l


-- 
: Eric S Fraga, with org release_9.5.3-511-g8e69ad in Emacs 29.0.50


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

* Re: export regions of a org files to other formats (most likely only to a buffer).
  2022-05-25 15:19 ` William Denton
@ 2022-05-25 15:36   ` Uwe Brauer
  2022-05-26  2:32     ` Ihor Radchenko
  0 siblings, 1 reply; 12+ messages in thread
From: Uwe Brauer @ 2022-05-25 15:36 UTC (permalink / raw)
  To: William Denton; +Cc: Uwe Brauer, emacs-orgmode

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

>>> "WD" == William Denton <wtd@pobox.com> writes:

> On 25 May 2022, Uwe Brauer wrote:
>> Sometimes I only want to convert/export a region or a paragraph of an
>> org file to another format, most likely as html or latex.

> Is this different from subtree export?  After C-c C-e, C-s will toggle
> "export scope" between buffer and subtree.  (There's also C-v to
> toggle "visible only" export, which I've never used.)  Or would it
> work to add a heading for the paragraph temporarily, just for export?

It seems that I did not check this carefully enough. Indeed, if I mark a
region and run the export function, only the active region will be
exported. The docstring of that function is, however, not that clear
about it.

Sorry for the noise

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5673 bytes --]

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

* Re: export regions of a org files to other formats (most likely only to a buffer).
  2022-05-25 15:36   ` Uwe Brauer
@ 2022-05-26  2:32     ` Ihor Radchenko
  2022-05-26  5:48       ` Uwe Brauer
  0 siblings, 1 reply; 12+ messages in thread
From: Ihor Radchenko @ 2022-05-26  2:32 UTC (permalink / raw)
  To: Uwe Brauer; +Cc: William Denton, emacs-orgmode

Uwe Brauer <oub@mat.ucm.es> writes:

> It seems that I did not check this carefully enough. Indeed, if I mark a
> region and run the export function, only the active region will be
> exported. The docstring of that function is, however, not that clear
> about it.

Could you please clarify which part of the function docstring was not
clear?

Best,
Ihor


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

* Re: export regions of a org files to other formats (most likely only to a buffer).
  2022-05-26  2:32     ` Ihor Radchenko
@ 2022-05-26  5:48       ` Uwe Brauer
  2022-05-26  6:25         ` Ihor Radchenko
  0 siblings, 1 reply; 12+ messages in thread
From: Uwe Brauer @ 2022-05-26  5:48 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Uwe Brauer, William Denton, emacs-orgmode

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

>>> "IR" == Ihor Radchenko <yantar92@gmail.com> writes:

> Uwe Brauer <oub@mat.ucm.es> writes:
>> It seems that I did not check this carefully enough. Indeed, if I mark a
>> region and run the export function, only the active region will be
>> exported. The docstring of that function is, however, not that clear
>> about it.

> Could you please clarify which part of the function docstring was not
> clear?

Well
,----
| 
| org-export-dispatch is an interactive compiled Lisp function in
| ‘ox.el’.
| 
| (org-export-dispatch &optional ARG)
| 
| Export dispatcher for Org mode.
| 
| It provides an access to common export related tasks in a buffer.
| Its interface comes in two flavors: standard and expert.
| 
| While both share the same set of bindings, only the former
| displays the valid keys associations in a dedicated buffer.
| Scrolling (resp. line-wise motion) in this buffer is done with
| SPC and DEL (resp. C-n and C-p) keys.
| 
| Set variable ‘org-export-dispatch-use-expert-ui’ to switch to one
| flavor or the other.
| 
| When ARG is ‘C-u’, repeat the last export action, with the same
| set of options used back then, on the current buffer.
| 
| When ARG is ‘C-u C-u’, display the asynchronous export stack.
`----

Does not mention, that a selected region gets exported.

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5673 bytes --]

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

* Re: export regions of a org files to other formats (most likely only to a buffer).
  2022-05-26  5:48       ` Uwe Brauer
@ 2022-05-26  6:25         ` Ihor Radchenko
  2022-05-26 20:00           ` Uwe Brauer
  2022-05-26 23:08           ` Samuel Wales
  0 siblings, 2 replies; 12+ messages in thread
From: Ihor Radchenko @ 2022-05-26  6:25 UTC (permalink / raw)
  To: Uwe Brauer; +Cc: William Denton, emacs-orgmode

Uwe Brauer <oub@mat.ucm.es> writes:

>> Could you please clarify which part of the function docstring was not
>> clear?
>
> Well
> | org-export-dispatch is an interactive compiled Lisp function in
> | ‘ox.el’.
> | 
> | (org-export-dispatch &optional ARG)
> ...
>
> Does not mention, that a selected region gets exported.

Fair enough.
Ironically, it is not even wrong. Looking at the source code, respecting
region is merely a convention coming from most of backends calling
`org-export-as'.

As one possibility, we can add something like the following to the
docstring:

"Usually, exporting respects current narrowing and active region, though
individual export backends might not follow the convention.  See
`org-export-as' for more details."

Alternatively, we can modify `org-export-define-backend' to change the
docstring with links to individual backend exporters.

Or we may modify the dispatcher menu to indicate active region. Though
it is not guaranteed to be obeyed by the backends.

Best,
Ihor


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

* Re: export regions of a org files to other formats (most likely only to a buffer).
  2022-05-26  6:25         ` Ihor Radchenko
@ 2022-05-26 20:00           ` Uwe Brauer
  2022-05-26 23:08           ` Samuel Wales
  1 sibling, 0 replies; 12+ messages in thread
From: Uwe Brauer @ 2022-05-26 20:00 UTC (permalink / raw)
  To: emacs-orgmode

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

>>> "IR" == Ihor Radchenko <yantar92@gmail.com> writes:

> Uwe Brauer <oub@mat.ucm.es> writes:
>>> Could you please clarify which part of the function docstring was not
>>> clear?
>> 
>> Well
>> | org-export-dispatch is an interactive compiled Lisp function in
>> | ‘ox.el’.
>> | 
>> | (org-export-dispatch &optional ARG)
>> ...
>> 
>> Does not mention, that a selected region gets exported.

> Fair enough.
> Ironically, it is not even wrong. Looking at the source code, respecting
> region is merely a convention coming from most of backends calling
> `org-export-as'.

> As one possibility, we can add something like the following to the
> docstring:

> "Usually, exporting respects current narrowing and active region, though
> individual export backends might not follow the convention.  See
> `org-export-as' for more details."

I think this is fine, at least for me. Not sure what others think.




-- 
I strongly condemn Putin's war of aggression against the Ukraine.
I support to deliver weapons to Ukraine's military. 
I support the ban of Russia from SWIFT.
I support the EU membership of the Ukraine. 

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5673 bytes --]

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

* Re: export regions of a org files to other formats (most likely only to a buffer).
  2022-05-26  6:25         ` Ihor Radchenko
  2022-05-26 20:00           ` Uwe Brauer
@ 2022-05-26 23:08           ` Samuel Wales
  2022-05-26 23:28             ` Samuel Wales
  2022-05-27  4:26             ` Ihor Radchenko
  1 sibling, 2 replies; 12+ messages in thread
From: Samuel Wales @ 2022-05-26 23:08 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Uwe Brauer, William Denton, emacs-orgmode

i would say that respecting narrowing is expected in emacs, as a kind
of pseudo-buffer bob/eob, so it would be surprising to find that it
might not be so in a part of org.  lack of it should be mentioned, but
might be a bug.


On 5/25/22, Ihor Radchenko <yantar92@gmail.com> wrote:
> Uwe Brauer <oub@mat.ucm.es> writes:
>
>>> Could you please clarify which part of the function docstring was not
>>> clear?
>>
>> Well
>> | org-export-dispatch is an interactive compiled Lisp function in
>> | ‘ox.el’.
>> |
>> | (org-export-dispatch &optional ARG)
>> ...
>>
>> Does not mention, that a selected region gets exported.
>
> Fair enough.
> Ironically, it is not even wrong. Looking at the source code, respecting
> region is merely a convention coming from most of backends calling
> `org-export-as'.
>
> As one possibility, we can add something like the following to the
> docstring:
>
> "Usually, exporting respects current narrowing and active region, though
> individual export backends might not follow the convention.  See
> `org-export-as' for more details."
>
> Alternatively, we can modify `org-export-define-backend' to change the
> docstring with links to individual backend exporters.
>
> Or we may modify the dispatcher menu to indicate active region. Though
> it is not guaranteed to be obeyed by the backends.
>
> Best,
> Ihor
>
>


-- 
The Kafka Pandemic

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


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

* Re: export regions of a org files to other formats (most likely only to a buffer).
  2022-05-26 23:08           ` Samuel Wales
@ 2022-05-26 23:28             ` Samuel Wales
  2022-05-27  4:26             ` Ihor Radchenko
  1 sibling, 0 replies; 12+ messages in thread
From: Samuel Wales @ 2022-05-26 23:28 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Uwe Brauer, William Denton, emacs-orgmode

[i realized there is a footnote to my comment about narrowing.  of
course there might be questions about what org will do if there are
things that refer to outside the region, like links or macro
definitions.]


On 5/26/22, Samuel Wales <samologist@gmail.com> wrote:
> i would say that respecting narrowing is expected in emacs, as a kind
> of pseudo-buffer bob/eob, so it would be surprising to find that it
> might not be so in a part of org.  lack of it should be mentioned, but
> might be a bug.
>
>
> On 5/25/22, Ihor Radchenko <yantar92@gmail.com> wrote:
>> Uwe Brauer <oub@mat.ucm.es> writes:
>>
>>>> Could you please clarify which part of the function docstring was not
>>>> clear?
>>>
>>> Well
>>> | org-export-dispatch is an interactive compiled Lisp function in
>>> | ‘ox.el’.
>>> |
>>> | (org-export-dispatch &optional ARG)
>>> ...
>>>
>>> Does not mention, that a selected region gets exported.
>>
>> Fair enough.
>> Ironically, it is not even wrong. Looking at the source code, respecting
>> region is merely a convention coming from most of backends calling
>> `org-export-as'.
>>
>> As one possibility, we can add something like the following to the
>> docstring:
>>
>> "Usually, exporting respects current narrowing and active region, though
>> individual export backends might not follow the convention.  See
>> `org-export-as' for more details."
>>
>> Alternatively, we can modify `org-export-define-backend' to change the
>> docstring with links to individual backend exporters.
>>
>> Or we may modify the dispatcher menu to indicate active region. Though
>> it is not guaranteed to be obeyed by the backends.
>>
>> Best,
>> Ihor
>>
>>
>
>
> --
> The Kafka Pandemic
>
> A blog about science, health, human rights, and misopathy:
> https://thekafkapandemic.blogspot.com
>


-- 
The Kafka Pandemic

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


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

* Re: export regions of a org files to other formats (most likely only to a buffer).
  2022-05-26 23:08           ` Samuel Wales
  2022-05-26 23:28             ` Samuel Wales
@ 2022-05-27  4:26             ` Ihor Radchenko
  1 sibling, 0 replies; 12+ messages in thread
From: Ihor Radchenko @ 2022-05-27  4:26 UTC (permalink / raw)
  To: Samuel Wales; +Cc: Uwe Brauer, William Denton, emacs-orgmode

Samuel Wales <samologist@gmail.com> writes:

> i would say that respecting narrowing is expected in emacs, as a kind
> of pseudo-buffer bob/eob, so it would be surprising to find that it
> might not be so in a part of org.  lack of it should be mentioned, but
> might be a bug.

I think the main confusion was about active region, not narrowing.
Respecting active region is not as much conventional.

Best,
Ihor


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

end of thread, other threads:[~2022-05-27  4:26 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-25 14:35 export regions of a org files to other formats (most likely only to a buffer) Uwe Brauer
2022-05-25 15:19 ` William Denton
2022-05-25 15:36   ` Uwe Brauer
2022-05-26  2:32     ` Ihor Radchenko
2022-05-26  5:48       ` Uwe Brauer
2022-05-26  6:25         ` Ihor Radchenko
2022-05-26 20:00           ` Uwe Brauer
2022-05-26 23:08           ` Samuel Wales
2022-05-26 23:28             ` Samuel Wales
2022-05-27  4:26             ` Ihor Radchenko
2022-05-25 15:21 ` Kaushal Modi
2022-05-25 15:26 ` Eric S Fraga

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