[O] :noweb expansion happens before :prologue expansion. Why?

2019-08-20 Thread Vladimir Nikishkin
Hello, everyone

I wanted to do the following
#+name: common
#+begin_src scheme
(display "Common header\n")
#+end_src

#+begin_src scheme :noweb yes :prologue "<>"
(display "particular block")
#+end_src

This fails, because :prologue is language-specific, and is expanded
later than :noweb, so I am getting <> in my code rather than
the expansion.

Why? Only four language modules care to implement :prologue (R,
scheme, maxima, gnuplot) , and all of them do it by just concatenating
it with the rest of the code, and as a result the wonderful
possibility of attaching common headers to blocks is greatly reduced,
since they are not expanded at all.

Would it make more sense to expand the :prologue and :epilogue
_before_ :noweb rather than after and do it in a uniform way (that is,
simply concatenate)?

I am ready to make a patch, as long as it won't be rejected.

-- 
Yours sincerely, Vladimir Nikishkin



Re: [O] Insert subheading at top respect content

2019-08-20 Thread Carsten Dominik
Hi Nate,

What do you mean by passing "the right argument".  Which argument do you
want to pass?

At first, I thought the direct way to fix your function would be

(defun njn-subheading-respect-content ()
  (interactive "")
  (org-next-visible-heading 1)
  (org-insert-heading nil)
 )

because in your original example, the heading did already have a child.
However, that is not guaranteed, and in the above implementation, the
new heading is created with the level of the next headline, and that
next headline might be a sibling, a child or a parent.  So we need to
explicitly set the level:

(defun njn-subheading-respect-content ()
  (interactive "")
  (let ((level (car (org-heading-components
(org-next-visible-heading 1)
(org-insert-heading nil)
(while (<= (car (org-heading-components)) level)
  (org-demote

I am using (possibly repeated) calls to `org-demote', because this will
do everything correct, also with stuff like org-odd-levels only etc.

Hope this helps.

- Carsten





On Wed, Aug 21, 2019 at 12:43 AM Nathan Neff  wrote:

>
>
> On Fri, Aug 16, 2019 at 4:03 AM Carsten Dominik  wrote:
>
>>
>>
>> On Fri, Aug 16, 2019 at 10:21 AM Nathan Neff 
>> wrote:
>>
>>> Hello all,
>>>
>>> Something that's eluded me all this time has been an
>>> "Insert subheading, after the content, but before other subheadings"
>>>
>>> For example:
>>> If my cursor is anywhere between lines 1 and 4, I would like the
>>> subheading
>>> to be inserted at line 5.
>>>
>>> 1* Heading
>>> :PROPERTIES:...
>>> 2 Some content
>>> 3 More content
>>> 4
>>> 5** Subheading 1
>>> 6** Subheading 2
>>> 7
>>> I know there's org-insert-subheading and C-u which respects content, but
>>> respect-content will insert a subheading at line 7 in the example
>>> above.  I would
>>> like to have a new subheading at line 4.
>>>
>>
>> What about C-c C-n M-RET
>>
>
> Thanks Carsten - I created a function:
> (defun njn-subheading-respect-content ()
>   (interactive "")
>   (org-next-visible-heading 1)
>   (org-insert-subheading 't)
>  )
>
> But I'm trying to find out where to get the "correct" arg
> to org-next-visible-heading - I have hard-coded a 1 in the
> above example, but this produces the following subheading:
>
> * Heading <-exec when cursor on this heading
> Some content about Heading
> *** New heading is inserted here (and is the wrong level - should be 2
> instead of 3)
> ** Sub1
> ** Sub2
>
> I will mess with this function a bit and post if I find a solution.
>
> Thanks,
> --Nate
>
>>
>> Carsten
>>
>>
>>>
>>> Thanks,
>>> --Nate
>>>
>>


Re: [O] Insert subheading at top respect content

2019-08-20 Thread Nathan Neff
On Tue, Aug 20, 2019 at 5:42 PM Nathan Neff  wrote:

>
>
> On Fri, Aug 16, 2019 at 4:03 AM Carsten Dominik  wrote:
>
>>
>>
>> On Fri, Aug 16, 2019 at 10:21 AM Nathan Neff 
>> wrote:
>>
>>> Hello all,
>>>
>>> Something that's eluded me all this time has been an
>>> "Insert subheading, after the content, but before other subheadings"
>>>
>>> For example:
>>> If my cursor is anywhere between lines 1 and 4, I would like the
>>> subheading
>>> to be inserted at line 5.
>>>
>>> 1* Heading
>>> :PROPERTIES:...
>>> 2 Some content
>>> 3 More content
>>> 4
>>> 5** Subheading 1
>>> 6** Subheading 2
>>> 7
>>> I know there's org-insert-subheading and C-u which respects content, but
>>> respect-content will insert a subheading at line 7 in the example
>>> above.  I would
>>> like to have a new subheading at line 4.
>>>
>>
>> What about C-c C-n M-RET
>>
>
> Thanks Carsten - I created a function:
> (defun njn-subheading-respect-content ()
>   (interactive "")
>   (org-next-visible-heading 1)
>   (org-insert-subheading 't)
>  )
>
> But I'm trying to find out where to get the "correct" arg
> to org-next-visible-heading - I have hard-coded a 1 in the
> above example, but this produces the following subheading:
>
> * Heading <-exec when cursor on this heading
> Some content about Heading
> *** New heading is inserted here (and is the wrong level - should be 2
> instead of 3)
> ** Sub1
> ** Sub2
>
> I will mess with this function a bit and post if I find a solution.
>
> Thanks,
> --Nate
>
>>
>> Carsten
>>
>>
>>>
>>> Thanks,
>>> --Nate
>>>
>>


Re: [O] Custom function: Detect agenda mode

2019-08-20 Thread Samuel Wales
good point.


On 8/20/19, Adam Porter  wrote:
> Samuel Wales  writes:
>
>> i do (eq major-mode 'org-agenda-mode)
>
> That works, but you should probably use:
>
>   (derived-mode-p 'org-agenda-mode)
>
>
>
>


-- 
The Kafka Pandemic

What is misopathy?
https://thekafkapandemic.blogspot.com/2013/10/why-some-diseases-are-wronged.html

The disease DOES progress. MANY people have died from it. And ANYBODY
can get it at any time.



Re: [O] Custom function: Detect agenda mode

2019-08-20 Thread Adam Porter
Samuel Wales  writes:

> i do (eq major-mode 'org-agenda-mode)

That works, but you should probably use:

  (derived-mode-p 'org-agenda-mode)





Re: [O] Insert subheading at top respect content

2019-08-20 Thread Nathan Neff
On Fri, Aug 16, 2019 at 4:03 AM Carsten Dominik  wrote:

>
>
> On Fri, Aug 16, 2019 at 10:21 AM Nathan Neff 
> wrote:
>
>> Hello all,
>>
>> Something that's eluded me all this time has been an
>> "Insert subheading, after the content, but before other subheadings"
>>
>> For example:
>> If my cursor is anywhere between lines 1 and 4, I would like the
>> subheading
>> to be inserted at line 5.
>>
>> 1* Heading
>> :PROPERTIES:...
>> 2 Some content
>> 3 More content
>> 4
>> 5** Subheading 1
>> 6** Subheading 2
>> 7
>> I know there's org-insert-subheading and C-u which respects content, but
>> respect-content will insert a subheading at line 7 in the example above.
>> I would
>> like to have a new subheading at line 4.
>>
>
> What about C-c C-n M-RET
>

Thanks Carsten - I created a function:
(defun njn-subheading-respect-content ()
  (interactive "")
  (org-next-visible-heading 1)
  (org-insert-subheading 't)
 )

But I'm trying to find out where to get the "correct" arg
to org-next-visible-heading - I have hard-coded a 1 in the
above example, but this produces the following subheading:

* Heading <-exec when cursor on this heading
Some content about Heading
*** New heading is inserted here (and is the wrong level - should be 2
instead of 3)
** Sub1
** Sub2

I will mess with this function a bit and post if I find a solution.

Thanks,
--Nate

>
> Carsten
>
>
>>
>> Thanks,
>> --Nate
>>
>


Re: [O] Custom function: Detect agenda mode

2019-08-20 Thread Samuel Wales
i do (eq major-mode 'org-agenda-mode)

On 8/20/19, Nathan Neff  wrote:
> Hello all,
>
> I would like to map the same key to different functions in evil mode.
>
> For example, ",s" should be a shortcut to the schedule command.
>
> I'd like to have one function that I would map the command to, which
> would call either org-schedule or org-agenda-schedule, depending on whether
> the cursor is in an Agenda view or an org file.
>
> What is the "correct" way to do this?  Is there some handy functional
> programming
> fu that I should know?  For example, I wouldn't be surprised to find a
> function
> in org-mode already that would do the detection and take the proper action.
>
> Thanks,
> --Nate
>


-- 
The Kafka Pandemic

What is misopathy?
https://thekafkapandemic.blogspot.com/2013/10/why-some-diseases-are-wronged.html

The disease DOES progress. MANY people have died from it. And ANYBODY
can get it at any time.



[O] Custom function: Detect agenda mode

2019-08-20 Thread Nathan Neff
Hello all,

I would like to map the same key to different functions in evil mode.

For example, ",s" should be a shortcut to the schedule command.

I'd like to have one function that I would map the command to, which
would call either org-schedule or org-agenda-schedule, depending on whether
the cursor is in an Agenda view or an org file.

What is the "correct" way to do this?  Is there some handy functional
programming
fu that I should know?  For example, I wouldn't be surprised to find a
function
in org-mode already that would do the detection and take the proper action.

Thanks,
--Nate


[O] Unschedule an item from the date prompt

2019-08-20 Thread Nathan Neff
Hello all,

I seem to remember a way to unschedule an item
from the date prompt.  I found:
https://orgmode.org/manual/The-date_002ftime-prompt.html

But there's nothing mentioned there.  Is there a way to unschedule
something other than C-u C-c C-s?

Just curious

--Nate


Re: [O] bug: org-table-convert-region-max-lines causes a "Code block produced nop output"

2019-08-20 Thread Charles Millar via Emacs-orgmode

A follow up

On 8/20/19 9:32 AM, Charles Millar via Emacs-orgmode wrote:
In an org file I have a source code block to convert entries into and 
generate a recutils file


#+begin_src sh?? :file SomeFile.rec
cat << EOF
# -*- mode: rec -*-

 Begin recutils file

Approximately 770 records in recutils format each with about 20 
entries; over 17,000 lines including line feeds or carriage returns


#+end_src

The following error is produced:

Starting new Ispell process /usr/bin/aspell with en_US dictionary...
executing Sh code block...
Wrote /tmp/babel-k8j93s/ob-input-LL2cYo
Error reading results: (user-error Region is longer than 
???org-table-convert-region-max-lines??? (999) lines; not converting)

Code block produced no output.

I admit that I have not evaluated this code block since last 
October.At that time the SomeFile.rec file was produced, as expected. 
However, the size of the entries has not changed and now the above 
error results.


I modified my init.el file to include

(setq org-table-convert-region-max-lines 2)

closed emacs, etc. (load-file init.el did not change the default 999 
to 2)


When I C-c C-c'ed the code block again the process hung. I confirmed 
that org-table-convert-region-max-lines was set to 2.


Is org-table-convert-region-max-lines?? supposed to be invoked and if 
so what should I modify?


Version information

Org mode version 9.2.5 (release_9.2.5-488-g9ddba9 @ 
/usr/local/share/org-mode/lisp/)
GNU Emacs 27.0.50 (build 57, x86_64-pc-linux-gnu, GTK+ Version 
3.24.10) of 2019-08-20


Charlie Millar

It appears that the above now creates a table, not a recutils file. 
Spaces are the delimiter,



#+begin_src sh?? :file test.rec
cat << EOF
# -*- mode: rec -*-

%rec: somerecord

Account: something
Amount: 0.00

 end of file
EOF

#+end_src

#+RESULTS:
| #?? | -*-?? | mode: | rec?? | -*- |
| %rec:?? | somerecord | |?? | |
| Account: | sometyhing | |?? | |
| Amount:?? | 0.0?? | |?? | |
|  | end?? | of?? | file | |




[O] bug: org-table-convert-region-max-lines causes a "Code block produced nop output"

2019-08-20 Thread Charles Millar via Emacs-orgmode
In an org file I have a source code block to convert entries into and 
generate a recutils file


#+begin_src sh?? :file SomeFile.rec
cat << EOF
# -*- mode: rec -*-

 Begin recutils file

Approximately 770 records in recutils format each with about 20 entries; 
over 17,000 lines including line feeds or carriage returns


#+end_src

The following error is produced:

Starting new Ispell process /usr/bin/aspell with en_US dictionary...
executing Sh code block...
Wrote /tmp/babel-k8j93s/ob-input-LL2cYo
Error reading results: (user-error Region is longer than 
???org-table-convert-region-max-lines??? (999) lines; not converting)

Code block produced no output.

I admit that I have not evaluated this code block since last October.At 
that time the SomeFile.rec file was produced, as expected. However, the 
size of the entries has not changed and now the above error results.


I modified my init.el file to include

(setq org-table-convert-region-max-lines 2)

closed emacs, etc. (load-file init.el did not change the default 999 to 
2)


When I C-c C-c'ed the code block again the process hung. I confirmed 
that org-table-convert-region-max-lines was set to 2.


Is org-table-convert-region-max-lines?? supposed to be invoked and if so 
what should I modify?


Version information

Org mode version 9.2.5 (release_9.2.5-488-g9ddba9 @ 
/usr/local/share/org-mode/lisp/)
GNU Emacs 27.0.50 (build 57, x86_64-pc-linux-gnu, GTK+ Version 3.24.10) 
of 2019-08-20


Charlie Millar





Re: [O] NLS/Augment

2019-08-20 Thread Fraga, Eric
On Tuesday, 13 Aug 2019 at 20:39, Jean Louis wrote:

[...]

> So is the concept of hierarchical data management or structured data
> management.

You might be interested in reading about Plan 9: https://9p.io/plan9/

-- 
Eric S Fraga via Emacs 27.0.50, Org release_9.2.4-401-gfabd6d



Re: [O] change font-size in python plots depending on context

2019-08-20 Thread johanna . may


Hi there,

thanks to Thomas and Eric.
I actually found a rather stupid mistake: I was already using a var (for
the png filename generation) and the header did not read the next
:var. So I added ,fs=fontsize to the first :var and now it works.

I will have a look Eric's function of how to get the value of
e.g. fontsize and so on (btw, I also need textwidth and textheight from
somewhere). I also found a python pgf package but I couldn't figure out
fast how to implement that (it sounds as if instead of png a pgf is
generated and then everything has the right latex layout, so pretty
cool, but it seemed not so easy to implement).

So long, cheers!

J

Thomas S. Dye writes:

> Aloha Johanna May,
>
> This works:
>
> #+name: fs
> #+BEGIN_SRC emacs-lisp
> 10
> #+END_SRC
>
> #+RESULTS: fs
> : 10
>
> #+header: :var fontsize=fs() :results output
> #+begin_src python
> print(fontsize)
> #+end_src
>
> #+RESULTS:
> : 10
>
> Note "fs()" instead of "fs".
>
> All the best,
> Tom


-- 
Prof. Dr. Johanna May
Stellvertretende Institutsleiterin CIRE
Fakultät für Informations-, Medien- und Elektrotechnik (F07)
Institut für Elektrische Energietechnik (IET)
Cologne Institute for Renewable Energy (CIRE)
Lehrgebiete: Energieeffizienz und Grundlagen Elektrotechnik

T: +49 221-8275-2697
M: +49 174 891 9002
E: johanna@th-koeln.de

Technische Hochschule Köln
Campus Deutz
Betzdorfer Str. 2
50679 Köln
Raum: HW2-40

www.th-koeln.de



Re: [O] Pandoc and Org-mode: list indention

2019-08-20 Thread Joost Kremers



On Mon, Aug 19 2019, Devin Prater wrote:
I’ve taken it upon myself to clean all this up, and Org-mode 
does it all. The only problem is, when I convert from HTML to 
Org-mode using Pandoc, just doing:

Pandoc -I lesson1.html -o lesson1.org 
The lists are not made into indented ones, just a paragraph, 
which I manually have to indent,


If you're using Pandoc to convert html to org, then you should 
probably ask on the Pandoc mailing list:


https://pandoc.org/help.html

HTH

--
Joost Kremers
Life has its moments