* Export a Subtree to an other .org file @ 2013-04-03 17:35 Steve Prud'Homme 2013-04-03 18:36 ` Bastien 0 siblings, 1 reply; 12+ messages in thread From: Steve Prud'Homme @ 2013-04-03 17:35 UTC (permalink / raw) To: emacs-orgmode Hi, I want to export a subtree C-e-1 to an other org file. It is possible ? Thanks ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Export a Subtree to an other .org file 2013-04-03 17:35 Export a Subtree to an other .org file Steve Prud'Homme @ 2013-04-03 18:36 ` Bastien 2013-04-03 19:31 ` Steve Prud'Homme 0 siblings, 1 reply; 12+ messages in thread From: Bastien @ 2013-04-03 18:36 UTC (permalink / raw) To: Steve Prud'Homme; +Cc: emacs-orgmode Hi Steve, "Steve Prud'Homme" <sprudhom@gmail.com> writes: > I want to export a subtree C-e-1 to an other org file. It is > possible ? Did you try C-c C-e C-s ... ? -- Bastien ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Export a Subtree to an other .org file 2013-04-03 18:36 ` Bastien @ 2013-04-03 19:31 ` Steve Prud'Homme 2013-04-03 20:35 ` John Hendy 0 siblings, 1 reply; 12+ messages in thread From: Steve Prud'Homme @ 2013-04-03 19:31 UTC (permalink / raw) To: 'Bastien'; +Cc: emacs-orgmode Message : No command associated with key ^S -----Original Message----- From: Bastien Guerry [mailto:bastienguerry@gmail.com] On Behalf Of Bastien Sent: 3 avril 2013 14:37 To: Steve Prud'Homme Cc: emacs-orgmode@gnu.org Subject: Re: Export a Subtree to an other .org file Hi Steve, "Steve Prud'Homme" <sprudhom@gmail.com> writes: > I want to export a subtree C-e-1 to an other org file. It is possible > ? Did you try C-c C-e C-s ... ? -- Bastien ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Export a Subtree to an other .org file 2013-04-03 19:31 ` Steve Prud'Homme @ 2013-04-03 20:35 ` John Hendy 2013-04-03 21:36 ` Hsiu-Khuern Tang 0 siblings, 1 reply; 12+ messages in thread From: John Hendy @ 2013-04-03 20:35 UTC (permalink / raw) To: Steve Prud'Homme; +Cc: Bastien, emacs-orgmode On Wed, Apr 3, 2013 at 2:31 PM, Steve Prud'Homme <sprudhom@gmail.com> wrote: > Message : > No command associated with key ^S > Bastien's response was for the new exporter and your C-e 1 command indicates you're not using that version yet. I'm on the new exporter, so I can't recall what old options looked like, but from the manual could you try ASCII? - http://orgmode.org/manual/ASCII_002fLatin_002d1_002fUTF_002d8-export.html#ASCII_002fLatin_002d1_002fUTF_002d8-export Perhaps you could just export that to a buffer and then save as *.org instead of the default export format of .txt? As an alternative, would it take about the same amount of time to fold the headline and do =C-space C-e M-w C-x C-f ~/path/to/file.org RET C-y C-x C-s= ? That would just copy, yank, and save your desired subtree into a new org file. Not sure what your intentions are, though, so maybe that's too laborious. Best regards, John P.S. If you're interested in upgrading: http://orgmode.org/worg/org-8.0.html > > -----Original Message----- > From: Bastien Guerry [mailto:bastienguerry@gmail.com] On Behalf Of Bastien > Sent: 3 avril 2013 14:37 > To: Steve Prud'Homme > Cc: emacs-orgmode@gnu.org > Subject: Re: Export a Subtree to an other .org file > > Hi Steve, > > "Steve Prud'Homme" <sprudhom@gmail.com> writes: > >> I want to export a subtree C-e-1 to an other org file. It is possible >> ? > > Did you try C-c C-e C-s ... ? > > -- > Bastien > > ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Export a Subtree to an other .org file 2013-04-03 20:35 ` John Hendy @ 2013-04-03 21:36 ` Hsiu-Khuern Tang 2013-04-03 22:50 ` John Hendy 2013-04-04 12:19 ` Nicolas Goaziou 0 siblings, 2 replies; 12+ messages in thread From: Hsiu-Khuern Tang @ 2013-04-03 21:36 UTC (permalink / raw) To: emacs-orgmode * On Wed 03:35PM, 03 Apr 2013, John Hendy (jw.hendy@gmail.com) wrote: > On Wed, Apr 3, 2013 at 2:31 PM, Steve Prud'Homme <sprudhom@gmail.com> wrote: > > Message : > > No command associated with key ^S > > > > Bastien's response was for the new exporter and your C-e 1 command > indicates you're not using that version yet. I'm on the new exporter, > so I can't recall what old options looked like, but from the manual > could you try ASCII? > - http://orgmode.org/manual/ASCII_002fLatin_002d1_002fUTF_002d8-export.html#ASCII_002fLatin_002d1_002fUTF_002d8-export > > Perhaps you could just export that to a buffer and then save as *.org > instead of the default export format of .txt? I think the ascii export does not produce a file in Org format. The old exporter function org-export-as-org may do the trick for Steve. I too find it useful to export to org, and would love to see this implemented in the new exporter. I rely on this together with the SELECT_TAGS and EXCLUDE_TAGS keywords to create an Org file with a subset of the headings, not just a subtree. Is there a new exporter function that does this? -- Best, Hsiu-Khuern. ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Export a Subtree to an other .org file 2013-04-03 21:36 ` Hsiu-Khuern Tang @ 2013-04-03 22:50 ` John Hendy 2013-04-04 12:19 ` Nicolas Goaziou 1 sibling, 0 replies; 12+ messages in thread From: John Hendy @ 2013-04-03 22:50 UTC (permalink / raw) To: Hsiu-Khuern Tang; +Cc: emacs-orgmode On Wed, Apr 3, 2013 at 4:36 PM, Hsiu-Khuern Tang <tangoh@gmail.com> wrote: > * On Wed 03:35PM, 03 Apr 2013, John Hendy (jw.hendy@gmail.com) wrote: >> On Wed, Apr 3, 2013 at 2:31 PM, Steve Prud'Homme <sprudhom@gmail.com> wrote: >> > Message : >> > No command associated with key ^S >> > >> >> Bastien's response was for the new exporter and your C-e 1 command >> indicates you're not using that version yet. I'm on the new exporter, >> so I can't recall what old options looked like, but from the manual >> could you try ASCII? >> - http://orgmode.org/manual/ASCII_002fLatin_002d1_002fUTF_002d8-export.html#ASCII_002fLatin_002d1_002fUTF_002d8-export >> >> Perhaps you could just export that to a buffer and then save as *.org >> instead of the default export format of .txt? > > I think the ascii export does not produce a file in Org format. You're right -- sorry about that; had never tried it. I'm curious about a use case for this? Is it just that it's faster than this combo: #+begin_quote http://orgmode.org/manual/Structure-editing.html C-c C-x M-w (org-copy-subtree)Copy subtree to kill ring. With a numeric prefix argument N, copy the N sequential subtrees. C-c C-x C-y (org-paste-subtree)Yank subtree from kill ring. This does modify the level of the subtree to make sure the tree fits in nicely at the yank position. The yank level can also be specified with a numeric prefix argument, or by yanking after a headline marker like ‘****’. #+end_quote I can also see advantages in not having to C-x C-f to a new file before yanking and just being able to "send" the subtree to a generated file specified with an :EXPORT_FILE_NAME: property in the tree (though from the manual, that looks only to apply to ODT, DocBook, and LaTeX). Best regards, John > > The old exporter function org-export-as-org may do the trick for Steve. > > I too find it useful to export to org, and would love to see this implemented > in the new exporter. I rely on this together with the SELECT_TAGS and > EXCLUDE_TAGS keywords to create an Org file with a subset of the headings, not > just a subtree. Is there a new exporter function that does this? > > > -- > Best, > Hsiu-Khuern. > ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Export a Subtree to an other .org file 2013-04-03 21:36 ` Hsiu-Khuern Tang 2013-04-03 22:50 ` John Hendy @ 2013-04-04 12:19 ` Nicolas Goaziou 2013-04-04 12:23 ` Bastien 1 sibling, 1 reply; 12+ messages in thread From: Nicolas Goaziou @ 2013-04-04 12:19 UTC (permalink / raw) To: Hsiu-Khuern Tang; +Cc: emacs-orgmode Hello, Hsiu-Khuern Tang <tangoh@gmail.com> writes: > * On Wed 03:35PM, 03 Apr 2013, John Hendy (jw.hendy@gmail.com) wrote: >> On Wed, Apr 3, 2013 at 2:31 PM, Steve Prud'Homme <sprudhom@gmail.com> wrote: >> > Message : >> > No command associated with key ^S >> > >> >> Bastien's response was for the new exporter and your C-e 1 command >> indicates you're not using that version yet. I'm on the new exporter, >> so I can't recall what old options looked like, but from the manual >> could you try ASCII? >> - http://orgmode.org/manual/ASCII_002fLatin_002d1_002fUTF_002d8-export.html#ASCII_002fLatin_002d1_002fUTF_002d8-export >> >> Perhaps you could just export that to a buffer and then save as *.org >> instead of the default export format of .txt? > > I think the ascii export does not produce a file in Org format. > > The old exporter function org-export-as-org may do the trick for Steve. > > I too find it useful to export to org, and would love to see this implemented > in the new exporter. I rely on this together with the SELECT_TAGS and > EXCLUDE_TAGS keywords to create an Org file with a subset of the headings, not > just a subtree. Is there a new exporter function that does this? There's an org back-end for the new export framework (see ox-org.el). It doesn't provide any interactive function, though. Anyway, it's possible to (require 'ox-org) and (org-export-to-file 'org "my-file.org"). Regards, -- Nicolas Goaziou ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Export a Subtree to an other .org file 2013-04-04 12:19 ` Nicolas Goaziou @ 2013-04-04 12:23 ` Bastien 2013-04-04 13:10 ` Nicolas Goaziou 0 siblings, 1 reply; 12+ messages in thread From: Bastien @ 2013-04-04 12:23 UTC (permalink / raw) To: Nicolas Goaziou; +Cc: emacs-orgmode Hi Nicolas, Nicolas Goaziou <n.goaziou@gmail.com> writes: > Anyway, it's possible to (require 'ox-org) and (org-export-to-file 'org > "my-file.org"). I can see how useful it would be to have an interactive function and keybindings for it. I can implement it if you want, but feel free to beat me on this one. Thanks, -- Bastien ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Export a Subtree to an other .org file 2013-04-04 12:23 ` Bastien @ 2013-04-04 13:10 ` Nicolas Goaziou 2013-04-04 13:13 ` Bastien 2013-04-05 23:58 ` Hsiu-Khuern Tang 0 siblings, 2 replies; 12+ messages in thread From: Nicolas Goaziou @ 2013-04-04 13:10 UTC (permalink / raw) To: Bastien; +Cc: emacs-orgmode [-- Attachment #1: Type: text/plain, Size: 413 bytes --] Hello, Bastien <bzg@altern.org> writes: > Nicolas Goaziou <n.goaziou@gmail.com> writes: > >> Anyway, it's possible to (require 'ox-org) and (org-export-to-file 'org >> "my-file.org"). > > I can see how useful it would be to have an interactive function and > keybindings for it. I can implement it if you want, but feel free to > beat me on this one. What about the following? Regards, -- Nicolas Goaziou [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: 0001-ox-org-Add-interactive-functions-to-back-end.patch --] [-- Type: text/x-patch, Size: 5801 bytes --] From 3d65b46c0cefb37808507ba1cc61c6c35e3230f2 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou <n.goaziou@gmail.com> Date: Thu, 4 Apr 2013 15:09:22 +0200 Subject: [PATCH] ox-org: Add interactive functions to back-end * lisp/ox-org.el (org): Add a menu entry for the back-end. (org-org-export-as-org, org-org-export-to-org): New functions. * lisp/org.el (org-export-backends): Accept `org' as a loadable back-end. --- lisp/org.el | 1 + lisp/ox-org.el | 101 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 98 insertions(+), 4 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 06ba60a..1c15afd 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -495,6 +495,7 @@ depends on, if any." (const :tag " man Export buffer to MAN format" man) (const :tag " md Export buffer to Markdown format" md) (const :tag " odt Export buffer to ODT format" odt) + (const :tag " org Export buffer to Org format" org) (const :tag " texinfo Export buffer to Texinfo format" texinfo) (const :tag "C confluence Export buffer to Confluence Wiki format" confluence) (const :tag "C deck Export buffer to deck.js presentations" deck) diff --git a/lisp/ox-org.el b/lisp/ox-org.el index fdd009a..18925c5 100644 --- a/lisp/ox-org.el +++ b/lisp/ox-org.el @@ -20,9 +20,13 @@ ;;; Commentary: -;; This library implements an Org back-end for Org exporter. Since -;; its usage is mainly internal, it doesn't provide any interactive -;; function. +;; This library implements an Org back-end for Org exporter. +;; +;; It introduces two interactive functions, `org-org-export-as-org' +;; and `org-org-export-to-org', which export, respectively, to +;; a temporary buffer and to a file. +;; +;; A publishing function is also provided: `org-org-publish-to-org'. ;;; Code: (require 'ox) @@ -102,7 +106,15 @@ setting of `org-html-htmlize-output-type' is 'css." (timestamp . org-org-identity) (underline . org-org-identity) (verbatim . org-org-identity) - (verse-block . org-org-identity))) + (verse-block . org-org-identity)) + :menu-entry + '(?O "Export to Org" + ((?O "As Org buffer" org-org-export-as-org) + (?o "As Org file" org-org-export-to-org) + (?v "As Org file and open" + (lambda (a s v b) + (if a (org-org-export-to-org t s v b) + (org-open-file (org-org-export-to-org nil s v b)))))))) (defun org-org-identity (blob contents info) "Transcode BLOB element or object back into Org syntax." @@ -132,6 +144,86 @@ Ignore keywords targeted at other export back-ends." (org-element-keyword-interpreter keyword nil))) ;;;###autoload +(defun org-org-export-as-org (&optional async subtreep visible-only ext-plist) + "Export current buffer to an Org buffer. + +If narrowing is active in the current buffer, only export its +narrowed part. + +If a region is active, export that region. + +A non-nil optional argument ASYNC means the process should happen +asynchronously. The resulting buffer should be accessible +through the `org-export-stack' interface. + +When optional argument SUBTREEP is non-nil, export the sub-tree +at point, extracting information from the headline properties +first. + +When optional argument VISIBLE-ONLY is non-nil, don't export +contents of hidden elements. + +EXT-PLIST, when provided, is a property list with external +parameters overriding Org default settings, but still inferior to +file-local settings. + +Export is done in a buffer named \"*Org ORG Export*\", which will +be displayed when `org-export-show-temporary-export-buffer' is +non-nil." + (interactive) + (if async + (org-export-async-start + (lambda (output) + (with-current-buffer (get-buffer-create "*Org ORG Export*") + (erase-buffer) + (insert output) + (goto-char (point-min)) + (org-mode) + (org-export-add-to-stack (current-buffer) 'org))) + `(org-export-as 'org ,subtreep ,visible-only nil ',ext-plist)) + (let ((outbuf + (org-export-to-buffer + 'org "*Org ORG Export*" subtreep visible-only nil ext-plist))) + (with-current-buffer outbuf (org-mode)) + (when org-export-show-temporary-export-buffer + (switch-to-buffer-other-window outbuf))))) + +;;;###autoload +(defun org-org-export-to-org (&optional async subtreep visible-only ext-plist) + "Export current buffer to an org file. + +If narrowing is active in the current buffer, only export its +narrowed part. + +If a region is active, export that region. + +A non-nil optional argument ASYNC means the process should happen +asynchronously. The resulting file should be accessible through +the `org-export-stack' interface. + +When optional argument SUBTREEP is non-nil, export the sub-tree +at point, extracting information from the headline properties +first. + +When optional argument VISIBLE-ONLY is non-nil, don't export +contents of hidden elements. + +EXT-PLIST, when provided, is a property list with external +parameters overriding Org default settings, but still inferior to +file-local settings. + +Return output file name." + (interactive) + (let ((outfile (org-export-output-file-name ".org" subtreep))) + (if async + (org-export-async-start + (lambda (f) (org-export-add-to-stack f 'org)) + `(expand-file-name + (org-export-to-file + 'org ,outfile ,subtreep ,visible-only nil ',ext-plist))) + (org-export-to-file 'org outfile subtreep visible-only nil ext-plist)))) + +;;;###autoload (defun org-org-publish-to-org (plist filename pub-dir) "Publish an org file to org. @@ -167,6 +259,7 @@ Return output file name." (unless visitingp (kill-buffer work-buffer))) (set-buffer-modified-p nil))) + (provide 'ox-org) ;; Local variables: -- 1.8.2 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: Export a Subtree to an other .org file 2013-04-04 13:10 ` Nicolas Goaziou @ 2013-04-04 13:13 ` Bastien 2013-04-04 18:40 ` Hsiu-Khuern Tang 2013-04-05 23:58 ` Hsiu-Khuern Tang 1 sibling, 1 reply; 12+ messages in thread From: Bastien @ 2013-04-04 13:13 UTC (permalink / raw) To: Nicolas Goaziou; +Cc: emacs-orgmode Nicolas Goaziou <n.goaziou@gmail.com> writes: > What about the following? Looks greaaaat! Feel free to apply it, -- Bastien ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Export a Subtree to an other .org file 2013-04-04 13:13 ` Bastien @ 2013-04-04 18:40 ` Hsiu-Khuern Tang 0 siblings, 0 replies; 12+ messages in thread From: Hsiu-Khuern Tang @ 2013-04-04 18:40 UTC (permalink / raw) To: emacs-orgmode * On Thu 03:13PM, 04 Apr 2013, Bastien (bzg@altern.org) wrote: > Nicolas Goaziou <n.goaziou@gmail.com> writes: > > > What about the following? > > Looks greaaaat! Feel free to apply it, > > -- > Bastien > Hi Nicolas and Bastien, I've updated to the latest git version and tested this. Works like a charm -- thank you! -- Best, Hsiu-Khuern. ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Export a Subtree to an other .org file 2013-04-04 13:10 ` Nicolas Goaziou 2013-04-04 13:13 ` Bastien @ 2013-04-05 23:58 ` Hsiu-Khuern Tang 1 sibling, 0 replies; 12+ messages in thread From: Hsiu-Khuern Tang @ 2013-04-05 23:58 UTC (permalink / raw) To: Nicolas Goaziou; +Cc: emacs-orgmode Hi Nicolas, For the org-org-export-to-org function, if the input is ============================================================ * test #+BEGIN_SRC R -n :var a=1 a #+END_SRC ============================================================ the output is ============================================================ * test #+BEGIN_SRC R -n a #+END_SRC ============================================================ That is, the ":var a=1" header argument is stripped (but the "-n" switch is preserved). Is this intentional? I think /everything/ in the #+BEGIN_SRC line should be preserved. What do you think? Thanks! -- Best, Hsiu-Khuern. ^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2013-04-06 0:00 UTC | newest] Thread overview: 12+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-04-03 17:35 Export a Subtree to an other .org file Steve Prud'Homme 2013-04-03 18:36 ` Bastien 2013-04-03 19:31 ` Steve Prud'Homme 2013-04-03 20:35 ` John Hendy 2013-04-03 21:36 ` Hsiu-Khuern Tang 2013-04-03 22:50 ` John Hendy 2013-04-04 12:19 ` Nicolas Goaziou 2013-04-04 12:23 ` Bastien 2013-04-04 13:10 ` Nicolas Goaziou 2013-04-04 13:13 ` Bastien 2013-04-04 18:40 ` Hsiu-Khuern Tang 2013-04-05 23:58 ` Hsiu-Khuern Tang
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).