Re: [PATCH] org-manual: Use ol-man.el in "Adding Hyperlink Types"

2020-01-09 Thread Tom Gillespie
Great thanks!

On Thu, Jan 9, 2020 at 8:50 AM Nicolas Goaziou  wrote:
> I removed this since you have signed FSF papers.

Got it, I'll leave it out in the future and add a note in
org-contribute.org in case someone
else missed the implication of that paragraph.



Re: Accessing properties in code blocks

2020-01-09 Thread Mike Gauland

Looking at git, it seems that was introduced in 9.2.

On 10/01/2020 10:32 am, sergio ruiz wrote:

I am getting:

eval: Symbol’s function definition is void: org-macro--get-property

I am using:

Org mode version 9.1.9 (release_9.1.9-65-g5e4542 @ 
/Applications/Emacs.app/Contents/Resources/lisp/org/)

Mark set

Is this a newer function?

Thanks!



You can use elisp code to look up the property you want to pass as a 
variable:


#+BEGIN_SRC shell :var url=(org-macro--get-property "url" "")
curl $url
#+END_SRC





peace,
sergio
photographer, journalist, visionary

Public Key: 
https://pgp.key-server.io/pks/lookup?op=get=0x69B08F58923AB3A2

#BitMessage BM-NBaswViL21xqgg9STRJjaJaUoyiNe2dV
@sergio_101@mastodon.social 
https://sergio101.com
http://www.codeandmusic.com
http://www.twitter.com/sergio_101
http://www.facebook.com/sergio101



Re: Bug: refiling gobbles a newline and absorbs the next heading [9.1.9 (release_9.1.9-65-g5e4542 @ /Applications/Emacs.app/Contents/Resources/lisp/org/)]

2020-01-09 Thread Miguel Morin
It's interesting that you are unable to reproduce the result. I have Emacs 26.3 
(9.0) on macOS Mojave 10.14.6. I have reproduced it with `emacs -q`, so the 
problem is not my init file. Then I don't know what the culprit is and am 
curious and available to try things to find it.

Miguel


On Thu, 09 Jan 2020 at 16:40 WET, Nicolas Goaziou wrote:

> Hello,
>
> Miguel Morin  writes:
>
>> I put "refiling" in the title as that is the moment when things go awry, so 
>> I noticed it when I refiled items.
>>
>> I updated Org to 9.3.1 and confirm that the bug is still present. Because I 
>> got some compatibility problems, I tested it with `emacs -q`, in which I 
>> didn't have email, and then drafted the email after reverting to the 
>> built-in 9.1.9.
>>
>> Below is the relevant part to reproduce the bug. What do you mean by
>> ECM? Error Correction Mode? Engineering Change Management?
>
> Complete Minimal Example, using French wording order, which is more or
> less what you did provide.
>
>> Start a file at `~/test.org` with:
>>
>> ```
>> * heading 1
>>
>> * heading 2
>>   
>> * heading 3
>> ```
>>
>> Set this capture template:
>>
>> ```
>> (setq org-capture-templates
>>   '(("t" "Todo" entry (file+headline "~/test.org" "heading 1")
>>   "* TODO %?\n")))
>> ```
>>
>> add a capture item, delete newlines from the end of the org-capture buffer, 
>> and refile to "heading 3". The heading next to the refiled item is gobbled 
>> and both the org-capture item and the gobbled "heading 2" move to "heading 
>> 3".
>>
>> [![Empty lines method, step 1 - create an org-capture item][1]][1]
>>
>> [![Empty lines method, step 2 - delete lines from end of org-capture 
>> buffer][2]][2]
>>
>> [![Empty lines method, step 3 - refile][3]][3]
>>
>>   [1]: https://i.stack.imgur.com/6cUlo.png
>>   [2]: https://i.stack.imgur.com/GPwg8.png
>>   [3]: https://i.stack.imgur.com/tzAJI.png
>
> FWIW, I cannot reproduce it with your recipe. Maybe someone else could.
>
> Regards,




Re: Accessing properties in code blocks

2020-01-09 Thread sergio ruiz
I am getting:

eval: Symbol’s function definition is void: org-macro--get-property

I am using:

Org mode version 9.1.9 (release_9.1.9-65-g5e4542 @ 
/Applications/Emacs.app/Contents/Resources/lisp/org/)
Mark set

Is this a newer function?

Thanks!



> You can use elisp code to look up the property you want to pass as a variable:
> 
> #+BEGIN_SRC shell :var url=(org-macro--get-property "url" "")
> curl $url
> #+END_SRC
> 
> 


peace,
sergio
photographer, journalist, visionary

Public Key: 
https://pgp.key-server.io/pks/lookup?op=get=0x69B08F58923AB3A2
#BitMessage BM-NBaswViL21xqgg9STRJjaJaUoyiNe2dV
@sergio_101@mastodon.social
https://sergio101.com
http://www.codeandmusic.com
http://www.twitter.com/sergio_101
http://www.facebook.com/sergio101



signature.asc
Description: Message signed with OpenPGP


Re: Accessing properties in code blocks

2020-01-09 Thread Mike Gauland

On 10/01/2020 9:23 am, sergio ruiz wrote:

* Report section
:PROPERTIES:
:url: http://www.googole.com
:END:

I'd like to have several sections like this. Each section woudl have 
different values for the same property. They would make different 
calls to respective url. something like


#+BEGIN_SRC shell
curl 
#+END_SRC

You can use elisp code to look up the property you want to pass as a 
variable:


#+BEGIN_SRC shell :var url=(org-macro--get-property "url" "")
curl $url
#+END_SRC




Re: [org-babel] String interpolation using shell

2020-01-09 Thread Mike Gauland

On 10/01/2020 5:56 am, sergio ruiz wrote:

#+BEGIN_SRC shell :var url_input=url_name
  curl url_input
#+END_SRC

#+RESULTS:

^^ This doesn't work. It is trying to use "url_input" in the curl command.


You need  a $ in front of the name when referencing a variable in the shell:

#+BEGIN_SRC shell :var url_input=url_name
  curl $url_input
#+END_SRC





Accessing properties in code blocks

2020-01-09 Thread sergio ruiz
I realized this is related to my previous post, but if i could do this, it 
would save alot of work.

I would like to access the values of the properties inside the (shell) code 
block.

Thanks!



* Report section
:PROPERTIES:
:url:  http://www.googole.com
:END:

I'd like to have several sections like this. Each section woudl have different 
values for the same property. They would make different calls to respective 
url. something like

#+BEGIN_SRC shell
curl 
#+END_SRC

where the result of that call woudl be whatever i get from that running curl on 
that url.




peace,
sergio
photographer, journalist, visionary

Public Key: 
https://pgp.key-server.io/pks/lookup?op=get=0x69B08F58923AB3A2
#BitMessage BM-NBaswViL21xqgg9STRJjaJaUoyiNe2dV
@sergio_101@mastodon.social
https://sergio101.com
http://www.codeandmusic.com
http://www.twitter.com/sergio_101
http://www.facebook.com/sergio101



signature.asc
Description: Message signed with OpenPGP


Re: [Properties] accessing propreties in text

2020-01-09 Thread Kyle Meyer
sergio ruiz  writes:

> Is there a way to reference the values of properties, so that at render time, 
> the document does something like:
>
> * Opening section
> :PROPERTIES:
> :section:  test
> :time: 1 day
> :END:
>
> Is there a way to do something like.. this section is the  section 
> and will be done in 
>
>
>
> which would render as:
>
> Is there a way to do something like.. this section is the test section and 
> will be done in 1 day

How about something like this?

--8<---cut here---start->8---
* Opening section
:PROPERTIES:
:section:  test
:time: 1 day
:END:

this section is the {{{property(section)}}} section and will be done
in {{{property(time)}}}
--8<---cut here---end--->8---

See (info "(org)Macro replacement") for more information on macros.



[Properties] accessing propreties in text

2020-01-09 Thread sergio ruiz
Is there a way to reference the values of properties, so that at render time, 
the document does something like:

* Opening section
:PROPERTIES:
:section:  test
:time: 1 day
:END:

Is there a way to do something like.. this section is the  section and 
will be done in 



which would render as:

Is there a way to do something like.. this section is the test section and will 
be done in 1 day

Thanks!


peace,
sergio
photographer, journalist, visionary

Public Key: 
https://pgp.key-server.io/pks/lookup?op=get=0x69B08F58923AB3A2
#BitMessage BM-NBaswViL21xqgg9STRJjaJaUoyiNe2dV
@sergio_101@mastodon.social
https://sergio101.com
http://www.codeandmusic.com
http://www.twitter.com/sergio_101
http://www.facebook.com/sergio101



signature.asc
Description: Message signed with OpenPGP


Re: Keyboard macros and export dispatcher

2020-01-09 Thread Jack Kamm
Hello,

John Hendy  writes:

> I had no problem doing the following:
>
> - C-x (
> - C-e C-s l p C-n
> - C-x )
> - go to first of my results headlines
> - C-u 51 C-x e
>
> It sounds like you already tried this... are you using `C-x (` or are
> you defining the macros via elisp?

I'm doing the following to create the macro:
- C-x (
- C-c C-e C-s l P
- C-x )

Then executing it with `C-x e`.

Since it works for you, it seems like there must be some problem with my
configuration.

When I have a moment, I'll try to create a minimal reproducible example
as you suggest. For now, Kyle's suggestion to use a prefix argument
`C-u` solves my immediate needs.

Cheers,
Jack



Re: Keyboard macros and export dispatcher

2020-01-09 Thread Jack Kamm
Hello,

Kyle Meyer  writes:

> As an alternative, can't you type `C-u C-c C-e` (i.e. call
> org-export-dispatch with a prefix argument)?

Thank you for the suggestion -- this accomplishes exactly what I want!

Next time, I'll remember to RTFM before asking for help :P

Cheers,
Jack



Re: Keyboard macros and export dispatcher

2020-01-09 Thread John Hendy
On Thu, Jan 9, 2020 at 12:24 PM Jack Kamm  wrote:
>
> Hello,
>
> I have an org-mode file, and am exporting one of its subtrees to a
> beamer presentation.
>
> I would like to use a keyboard macro for this, because re-exporting the
> presentation requires a lot of keypresses:
> - Jump to the appropriate heading
> - Start the dispatcher
> - Toggle subtree export (C-s)
> - Finally, export
>
> So, I defined a keyboard macro to do all this, but when I try to run it,
> Emacs simply hangs, and I need to quit with C-g. I think this might be
> the fault of the export dispatcher, but am not sure.

Funny timing. I have used Org for maybe 10 years and just found about
about macros yesterday! I have a spreadsheet with reference
information per work group, coded up some R code to spit out a
tree-per-group, and then wanted to export these 51 documents to their
own PDFs. I've done this before, but got sick of `C-e C-s l p` for
every one so I looked into it. I had no problem doing the following:

- C-x (
- C-e C-s l p C-n
- C-x )
- go to first of my results headlines
- C-u 51 C-x e

It sounds like you already tried this... are you using `C-x (` or are
you defining the macros via elisp? If the latter, can we see the code?
Anything in the Messages buffer? I had an error yesterday and realized
that some of the group names were "Foo/Bar" and since my code titles
the tree's :export_file_name property according to the group name,
emacs was interpreting the `/` in the filename as a directory that
didn't exist.

My suggestion:
- give us a stripped down, beamer file so we can reproduce (maybe with
one non-exporting headline and an analog of your target subtree to
export)
- tell us what you run manually to accomplish your goal
- give us the exact details of your macro setup

John

>
> Anyone have ideas on what's going wrong here, or on alternative
> approaches to achieve what I want?
>
> Thanks,
> Jack
>



Re: Keyboard macros and export dispatcher

2020-01-09 Thread Kyle Meyer
Jack Kamm  writes:

> I would like to use a keyboard macro for this, because re-exporting the
> presentation requires a lot of keypresses:
> - Jump to the appropriate heading
> - Start the dispatcher
> - Toggle subtree export (C-s)
> - Finally, export
>
> So, I defined a keyboard macro to do all this, but when I try to run it,
> Emacs simply hangs, and I need to quit with C-g. I think this might be
> the fault of the export dispatcher, but am not sure.
>
> Anyone have ideas on what's going wrong here, or on alternative
> approaches to achieve what I want?

As an alternative, can't you type `C-u C-c C-e` (i.e. call
org-export-dispatch with a prefix argument)?



Keyboard macros and export dispatcher

2020-01-09 Thread Jack Kamm
Hello,

I have an org-mode file, and am exporting one of its subtrees to a
beamer presentation.

I would like to use a keyboard macro for this, because re-exporting the
presentation requires a lot of keypresses:
- Jump to the appropriate heading
- Start the dispatcher
- Toggle subtree export (C-s)
- Finally, export

So, I defined a keyboard macro to do all this, but when I try to run it,
Emacs simply hangs, and I need to quit with C-g. I think this might be
the fault of the export dispatcher, but am not sure.

Anyone have ideas on what's going wrong here, or on alternative
approaches to achieve what I want?

Thanks,
Jack



Re: [PATCH] restore window configuration after org-edit-src-exit

2020-01-09 Thread Jack Kamm
Hello,

Nicolas Goaziou  writes:

> Thank you for the patch! Some comments follow.
>
> It would be useful to also explain what happens when the value is
> `reorganize-frame', `split-window-right', or `split-window-right', e.g.,
> that previous window configuration is restored.
>
> It may be useful to wrap `set-window-configuration' within
> `unwind-protect' so we can still reset the
> `org-src--saved-temp-window-config' variable even though something went
> wrong.
>
> WDYT?

Thank you for reviewing my patch, I agree with both of your suggestions,
and have added them to the attached patch, which I also rebased on
latest master.

I am wondering whether this should be considered a new feature, or
instead fixing a regression, in which case I could rebase on maint
instead.

Finally, I think we should consider moving to the display-buffer
framework
(https://www.gnu.org/software/emacs/manual/html_node/elisp/Choosing-Window.html#Choosing-Window),
as this will provide a lot more flexibility, and simplify the code as
well. We could also use `quit-restore-window'
(https://www.gnu.org/software/emacs/manual/html_node/elisp/Quitting-Windows.html)
to restore the window configuration after editing. I'll start a new
thread/RFC/patch for this later this month, when I have a bit more time.

>From 8d1cf7500d69823bc4869248bbe251758d3dcdda Mon Sep 17 00:00:00 2001
From: Jack Kamm 
Date: Mon, 23 Dec 2019 08:55:55 -0800
Subject: [PATCH] org-src: restore windows for some values of
 org-src-window-setup

---
 etc/ORG-NEWS|  5 +
 lisp/org-src.el | 22 +-
 2 files changed, 22 insertions(+), 5 deletions(-)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 0f836d946..67c3ca2ed 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -30,6 +30,11 @@ group new datetime entries by month.
 Babel Java blocks recognize header argument =:cmdargs= and pass its
 value in call to =java=.
 
+*** Refinement in window behavior on exiting Org source buffer
+
+After editing a source block, Org will restore the window layout when
+~org-src-window-setup~ is set to a value that modifies the layout.
+
 ** New functions
 *** ~org-columns-toggle-or-columns-quit~
 == bound to ~org-columns-toggle-or-columns-quit~ replaces the
diff --git a/lisp/org-src.el b/lisp/org-src.el
index 7876deaba..878821b14 100644
--- a/lisp/org-src.el
+++ b/lisp/org-src.el
@@ -156,10 +156,12 @@ split-window-right Show edit buffer to the right of the current window,
keeping all other windows.
 other-window   Use `switch-to-buffer-other-window' to display edit buffer.
 reorganize-frame   Show only two windows on the current frame, the current
-   window and the edit buffer.  When exiting the edit buffer,
-   return to one window.
+   window and the edit buffer.
 other-frameUse `switch-to-buffer-other-frame' to display edit buffer.
-   Also, when exiting the edit buffer, kill that frame."
+   Also, when exiting the edit buffer, kill that frame.
+
+Values that modify the window layout (reorganize-frame, split-window-below,
+split-window-right) will restore the layout after exiting the edit buffer."
   :group 'org-edit-structure
   :type '(choice
 	  (const current-window)
@@ -276,6 +278,9 @@ issued in the language major mode buffer."
 (defvar-local org-src--remote nil)
 (put 'org-src--remote 'permanent-local t)
 
+(defvar-local org-src--saved-temp-window-config nil)
+(put 'org-src--saved-temp-window-config 'permanent-local t)
+
 (defvar-local org-src--source-type nil
   "Type of element being edited, as a symbol.")
 (put 'org-src--source-type 'permanent-local t)
@@ -469,6 +474,10 @@ When REMOTE is non-nil, do not try to preserve point or mark when
 moving from the edit area to the source.
 
 Leave point in edit buffer."
+  (when (memq org-src-window-setup '(reorganize-frame
+ split-window-below
+ split-window-right))
+(setq org-src--saved-temp-window-config (current-window-configuration)))
   (let* ((area (org-src--contents-area datum))
 	 (beg (copy-marker (nth 0 area)))
 	 (end (copy-marker (nth 1 area) t))
@@ -1182,8 +1191,11 @@ Throw an error if there is no such buffer."
(write-back (org-src--goto-coordinates coordinates beg end
 ;; Clean up left-over markers and restore window configuration.
 (set-marker beg nil)
-(set-marker end nil)))
-
+(set-marker end nil)
+(when org-src--saved-temp-window-config
+  (unwind-protect
+	  (set-window-configuration org-src--saved-temp-window-config)
+	(setq org-src--saved-temp-window-config nil)
 
 (provide 'org-src)
 
-- 
2.24.1



[org-babel] String interpolation using shell

2020-01-09 Thread sergio ruiz
Hey, all.

I am trying to set a string at the head of the file and use it in different 
places in the file.

Everything works correctly for somethign like ruby, but I am not sure how do do 
this with a shell command.

Just sets the string to the url
#+NAME: url_name
#+BEGIN_SRC ruby
"http://www.google.com;
#+END_SRC

#+RESULTS: url_name
: http://www.google.com

#+BEGIN_SRC ruby :var url_input=url_name
url_input
#+END_SRC

#+RESULTS:
: http://www.google.com

^^ This seems to work fine.

#+BEGIN_SRC shell :var url_input=url_name
  curl url_input
#+END_SRC

#+RESULTS:

^^ This doesn't work. It is trying to use "url_input" in the curl command.

#+BEGIN_SRC shell
  curl {url_input}
#+END_SRC

#+RESULTS:

^^ this doesn't work. It is trying to use "url_input" in the curl command.

Thanks!


peace,
sergio
photographer, journalist, visionary

Public Key: 
https://pgp.key-server.io/pks/lookup?op=get=0x69B08F58923AB3A2
#BitMessage BM-NBaswViL21xqgg9STRJjaJaUoyiNe2dV
@sergio_101@mastodon.social
https://sergio101.com
http://www.codeandmusic.com
http://www.twitter.com/sergio_101
http://www.facebook.com/sergio101



signature.asc
Description: Message signed with OpenPGP


Re: [PATCH] org-manual: Use ol-man.el in "Adding Hyperlink Types"

2020-01-09 Thread Nicolas Goaziou
Hello,

Tom Gillespie  writes:

> This is a tiny change to the manual to account for the change from org
> -> ol in the org-man example. There may be other references in the
> manual that have similar issues but I did not check.

Applied. Thank you.

> TINYCHANGE

I removed this since you have signed FSF papers.

Regards,

-- 
Nicolas Goaziou



Re: Bug: refiling gobbles a newline and absorbs the next heading [9.1.9 (release_9.1.9-65-g5e4542 @ /Applications/Emacs.app/Contents/Resources/lisp/org/)]

2020-01-09 Thread Nicolas Goaziou
Hello,

Miguel Morin  writes:

> I put "refiling" in the title as that is the moment when things go awry, so I 
> noticed it when I refiled items.
>
> I updated Org to 9.3.1 and confirm that the bug is still present. Because I 
> got some compatibility problems, I tested it with `emacs -q`, in which I 
> didn't have email, and then drafted the email after reverting to the built-in 
> 9.1.9.
>
> Below is the relevant part to reproduce the bug. What do you mean by
> ECM? Error Correction Mode? Engineering Change Management?

Complete Minimal Example, using French wording order, which is more or
less what you did provide.

> Start a file at `~/test.org` with:
>
> ```
> * heading 1
>
> * heading 2
>   
> * heading 3
> ```
>
> Set this capture template:
>
> ```
> (setq org-capture-templates
>   '(("t" "Todo" entry (file+headline "~/test.org" "heading 1")
>"* TODO %?\n")))
> ```
>
> add a capture item, delete newlines from the end of the org-capture buffer, 
> and refile to "heading 3". The heading next to the refiled item is gobbled 
> and both the org-capture item and the gobbled "heading 2" move to "heading 3".
>
> [![Empty lines method, step 1 - create an org-capture item][1]][1]
>
> [![Empty lines method, step 2 - delete lines from end of org-capture 
> buffer][2]][2]
>
> [![Empty lines method, step 3 - refile][3]][3]
>
>   [1]: https://i.stack.imgur.com/6cUlo.png
>   [2]: https://i.stack.imgur.com/GPwg8.png
>   [3]: https://i.stack.imgur.com/tzAJI.png

FWIW, I cannot reproduce it with your recipe. Maybe someone else could.

Regards,

-- 
Nicolas Goaziou



Re: Hiding a node title in export but not the content

2020-01-09 Thread Fraga, Eric
On Thursday,  9 Jan 2020 at 16:09, alain.coch...@unistra.fr wrote:
> It seems to me that this is what you are referring to, Eric: using the
> :ignore: tag in conjunction with package 'ox-extra'.

Thanks.  I haven't tried it but, looking at the documentation & code, it
does what my little snippet does and a lot more.

-- 
Eric S Fraga via Emacs 27.0.50, Org release_9.3-34-g2eee3c



Re: Hiding a node title in export but not the content

2020-01-09 Thread Alain . Cochard


 > Note that my implementation is old and it could very well be that
 > later versions of org have introduced something to cater for this
 > use case.  I have org customizations going back over 10 years...

It seems to me that this is what you are referring to, Eric: using the
:ignore: tag in conjunction with package 'ox-extra'.


-- 
EOST (École et Observatoire des Sciences de la Terre) 
IPG (Institut de Physique du Globe) | alain.coch...@unistra.fr
5 rue René Descartes   [bureau 106] | Phone: +33 (0)3 68 85 50 44 
F-67084 Strasbourg Cedex, France| Fax:   +33 (0)3 68 85 01 25 



Re: [PATCH] restore window configuration after org-edit-src-exit

2020-01-09 Thread Matt Price
Hi, sorry I missed this thread in the peri-holiday rush, just want to say
thank you all for ironing out the difficulties arsing from that change
earlier.

On Tue, Jan 7, 2020 at 4:06 AM Nicolas Goaziou 
wrote:

> Hello,
>
> Jack Kamm  writes:
>
> > Attached is a patch to restore the window configuration after exiting an
> > org source buffer, when org-src-window-setup is one of reorganize-frame,
> > split-window-below, or split-window-right.
>
> Thank you for the patch! Some comments follow.
>
> > @@ -156,8 +156,7 @@ split-window-right Show edit buffer to the right of
> the current window,
> > keeping all other windows.
> >  other-window   Use `switch-to-buffer-other-window' to display edit
> buffer.
> >  reorganize-frame   Show only two windows on the current frame, the
> current
> > -   window and the edit buffer.  When exiting the edit
> buffer,
> > -   return to one window.
> > +   window and the edit buffer.
> >  other-frameUse `switch-to-buffer-other-frame' to display edit
> buffer.
> > Also, when exiting the edit buffer, kill that
> > frame."
>
> It would be useful to also explain what happens when the value is
> `reorganize-frame', `split-window-right', or `split-window-right', e.g.,
> that previous window configuration is restored.
>
> > +(when org-src--saved-temp-window-config
> > +  (set-window-configuration org-src--saved-temp-window-config)
> > +  (setq org-src--saved-temp-window-config nil
>
> It may be useful to wrap `set-window-configuration' within
> `unwind-protect' so we can still reset the
> `org-src--saved-temp-window-config' variable even though something went
> wrong.
>
> WDYT?
>
> Regards,
>
> --
> Nicolas Goaziou
>
>


Re: Hiding a node title in export but not the content

2020-01-09 Thread Sven Bretfeld
Fraga, Eric writes:

> On Thursday,  9 Jan 2020 at 11:38, Sven Bretfeld wrote:
>> Works like a charm! Almost perfect. Thank you very much. One problem:
>> For some reason the :ignoreheading: tag causes the PROPERTY drawer to be
>> exported. 
>
> Ah, probably because the property drawer is now not in the right place
> (i.e. immediately after a headline) so prop:nil doesn't affect it.  You
> may need to disable export of all drawers (d:nil) which may or may not
> cause you other problems...

Oh yes, works. I never need any drawers in the output, so I disabled
them globally:

(setq org-export-with-drawers nil)

So far no unwanted consequences.

Thank you very much,

Sven

-- 
Sven Bretfeld
Department of Philosophy and Religious Studies
NTNU Trondheim




Re: Hiding a node title in export but not the content

2020-01-09 Thread Fraga, Eric
On Thursday,  9 Jan 2020 at 11:38, Sven Bretfeld wrote:
> Works like a charm! Almost perfect. Thank you very much. One problem:
> For some reason the :ignoreheading: tag causes the PROPERTY drawer to be
> exported. 

Ah, probably because the property drawer is now not in the right place
(i.e. immediately after a headline) so prop:nil doesn't affect it.  You
may need to disable export of all drawers (d:nil) which may or may not
cause you other problems...
-- 
Eric S Fraga via Emacs 27.0.50, Org release_9.3-34-g2eee3c



Re: Hiding a node title in export but not the content

2020-01-09 Thread Sven Bretfeld
Fraga, Eric writes:

> On Thursday,  9 Jan 2020 at 09:20, Sven Bretfeld wrote:
>> Hi everybody
>>
>> Is this possible?
>>
>> ** headline  <-- not exported
>>:PROPERTIES:  <-- not exported
>>Some content. <-- exported
>
> yes.  I do this all the time to add structure to a document, structure
> that is not required in the exported version.
>
> I have the following code:
>
> #+begin_src emacs-lisp
>   (defun esf/remove-lines-with-ignore-heading-tag (backend)
> (message "Deleting lines with ignore heading tag")
> (while (search-forward-regexp "^\\*+.*[ 
> \t]+[a-ZA-Z0-9:]*:ignoreheading:[a-ZA-Z0-9:]*$" (point-max) t)
>   (cond
>((eq backend 'latex) (replace-match "#+latex: % \\&" ))
>((eq backend 'html) (replace-match "#+html: " ))
>(t (replace-match ""
> (message "... done deleting ignored headings."))
>   (add-hook 'org-export-before-processing-hook 
> 'esf/remove-lines-with-ignore-heading-tag)
> #+end_src
>
> which then causes any headline with the ignoreheading tag to be removed,
> leaving the subtree under that headline present.

Works like a charm! Almost perfect. Thank you very much. One problem:
For some reason the :ignoreheading: tag causes the PROPERTY drawer to be
exported. So every paragraph starts with the org-brain ID of the node. I
have the option prop:nil set in the file but it is ignored for nodes
containing the :ignoreheading: tag. Same for other properties like
CATEGORY. I saw properties unexpectedly exported already yesterday,
before I had your code. It went away after I inserted the prop:nil
option. But now it's back. Some changes in a recent update that I'm
unaware of?

> One caveat: the subtree content inherits behaviour from the previous
> headline.  For instance, if the previous headline was one that would not
> be exported at all, then this subtree will also not be exported.  E.g.:

This is fine for me.

Sven

--
Sven Bretfeld
Department of Philosophy and Religious Studies
NTNU Trondheim



Re: Hiding a node title in export but not the content

2020-01-09 Thread Fraga, Eric
On Thursday,  9 Jan 2020 at 09:20, Sven Bretfeld wrote:
> Hi everybody
>
> Is this possible?
>
> ** headline  <-- not exported
>:PROPERTIES:  <-- not exported
>Some content. <-- exported

yes.  I do this all the time to add structure to a document, structure
that is not required in the exported version.

I have the following code:

#+begin_src emacs-lisp
  (defun esf/remove-lines-with-ignore-heading-tag (backend)
(message "Deleting lines with ignore heading tag")
(while (search-forward-regexp "^\\*+.*[ 
\t]+[a-ZA-Z0-9:]*:ignoreheading:[a-ZA-Z0-9:]*$" (point-max) t)
  (cond
   ((eq backend 'latex) (replace-match "#+latex: % \\&" ))
   ((eq backend 'html) (replace-match "#+html: " ))
   (t (replace-match ""
(message "... done deleting ignored headings."))
  (add-hook 'org-export-before-processing-hook 
'esf/remove-lines-with-ignore-heading-tag)
#+end_src

which then causes any headline with the ignoreheading tag to be removed,
leaving the subtree under that headline present.

One caveat: the subtree content inherits behaviour from the previous
headline.  For instance, if the previous headline was one that would not
be exported at all, then this subtree will also not be exported.  E.g.:

#+begin_src org
  ,* heading 1
  Text that will be exported
  ,* heading 2:ignoreheading:
  Text that will also be exported but without the heading
  ,* heading 3 :noexport:
  Text that will not be exported.
  ,* heading 4:ignoreheading:
  Text here will also not be exported because it ends up being under
  "heading 3" which has the :noexport: tag.
#+end_src

Note that my implementation is old and it could very well be that later
versions of org have introduced something to cater for this use case.  I
have org customizations going back over 10 years...

-- 
Eric S Fraga via Emacs 27.0.50, Org release_9.3-34-g2eee3c



Re: Bug: org-babel-expand-noweb-references is very slow [9.1.9 (release_9.1.9-65-g5e4542 @ /usr/share/emacs/26.3/lisp/org/)]

2020-01-09 Thread Diego Zamboni
Hi Vladimir,

The main difference I have noticed is that you can have multiple blocks
with the same :noweb-ref header argument, and they will be concatenated on
tangle. I use this in some of my files to progressively build a block of
code which is then referenced somewhere else. With #+name, you can have
only one block with each name, the others are discarded (can't remember if
it's the first or the last one that gets used).

I guess this is also why :noweb-ref tangling is slow, since all blocks need
to be scanned and put together.

--Diego


On Thu, Jan 9, 2020 at 2:43 AM Vladimir Nikishkin 
wrote:

> Ouch, that was unexpected.
>
> The manual for my version only includes four mentions if the noweb-ref
> header argument. Is it becoming deprecated?
>
> What does "apparently don't need" actually mean? That is, when should I
> use the name, and when the header argument? What can the header argument do
> that the name cannot?
>
>
> Nicolas Goaziou  於 2020年1月9日 週四 01:23 寫道:
>
>> Hello,
>>
>> Vladimir Nikishkin  writes:
>>
>> > I am attaching the file in which tangling is still slow.
>> >
>> > The file is quite big, but that alone doesn't seem to be the reason
>> > for slowliness (I tried adding 1M-long words in the random places of
>> > the previous mwe).
>> >
>> > You can see the result by C-c C-v C-v'ing the code block at the
>> > "Ramanujan numbers" heading.
>> >
>> > Below is the profiler report for C-c C-v C-v'ing.with the heaviest
>> > blocks expanded:
>>
>> This is because you're using :noweb-ref, which _is_ slow, although you
>> apparently don't need it in the document. Use name keyword instead,
>> e.g.,
>>
>> #+name: primetest
>> #+begin_src scheme :exports both :results output
>>   (define (smallest-divisor n)
>> (find-divisor n 2))
>>   (define (find-divisor n test-divisor)
>> (cond ((> (square test-divisor) n) n)
>>   ((divides? test-divisor n) test-divisor)
>>   (else (find-divisor n (+ test-divisor 1)
>>   (define (divides? a b) (= (remainder b a) 0))
>>
>>   (define (prime? n)
>> (= n (smallest-divisor n)))
>> #+end_src
>>
>>
>> Regards,
>>
>> --
>> Nicolas Goaziou
>>
>


Hiding a node title in export but not the content

2020-01-09 Thread Sven Bretfeld
Hi everybody

Is this possible?

** headline  <-- not exported
   :PROPERTIES:  <-- not exported
   Some content. <-- exported

The reason is that I use to finely pre-structure articles, starting with
org-brain and gradually developing each node into a paragraph of the
article. So basically each argumentative or informative block is an
individual org-node. In this way paragraphs of the article can be kept
mobile during the writing process and they can easily be moved when I
decide to restructure the text.

In a LaTeX export of the draft, each node-name is, of course,
interpreted as a section/subsection title, leaving me with dozens of
headlines for a 10-paper draft. Very disturbing while
proof-reading. This is why I'm looking for a way to exclude the
headlines from the export. They should be interpreted as a blank line,
so that LaTeX simply makes a new paragraph.

It would be even better if the node names can be converted to margin
text instead of completely hiding them. This would be a great
orientation help without distracting the reading flow.

Thanks for ideas,

Sven

--
Sven Bretfeld
Department of Philosophy and Religious Studies
NTNU Trondheim