Re: The fate of ditaa.jar (9.4.5.)

2021-05-13 Thread Jarmo Hurri


Greetings.

"Dr. Arne Babenhauserheide"  writes:

> Arthur Miller  writes:
>
>> By the way, how difficult is to download one file from the internet
>> (ditaa.jar) if you are an user?
>
> That’s not the point. The point is that every single user with a ditaa
> block has to do it.
>
> Ask the other way round: What is the benefit of removing ditaa from
> org?  If you want to force most current org-ditaa users to unbreak
> their setup after update, there should be a significant tangible
> benefit.

I agree.

One thing I like about org is that most things work out of the box.
While I can download/install/compile/whatever ditaa.jar, having to do so
adds a step. This extra step will result in fewer people using the
combination of org and ditaa. I do not think that is a good direction.

Comparing ditaa to latex/java/C/such does not feel fair, since distros
support standard software, and ditaa does not seem to qualify. But this
is an assumption. At least my distro does not support ditaa in a
package.

Just my opinion. As always, happy to leave the final decision to the
wise ones.

Have fun and stay safe!

Jarmo




Invalid duration format (9.4.5)

2021-05-10 Thread Jarmo Hurri


Greetings.

To get my work done, I had to switch from master branch to stable, but
now I started getting "invalid duration format" error when trying to
create my daily agenda:

org-duration-to-minutes: Invalid duration format: #("12:45-14:15 +1w" 0 15 
(fontified nil org-category "schedule"))

Here is the corresponding row, and the preceding row, from file
schedule.org:

<2021-04-15 Thu 09:15-10:45 +1w>
<2021-04-19 Mon 12:45-14:15 +1w>

Any hints?

Jarmo




The fate of ditaa.jar (9.4.5.)

2021-05-10 Thread Jarmo Hurri


Greetings.

I pulled the latest master and noticed that contrib has been moved into
a separate repository. I also cloned this contrib repository, but can
not find the file

scripts/ditaa.jar

in the repo. In fact, there is no directory scripts in the repo.

The documentation in the latest master states that

Stathis Sideris wrote the ‘ditaa.jar’ ASCII to PNG converter that is now
packaged into the org-contrib repository.

How should I proceed? Should I build this separately

https://github.com/stathissideris/ditaa

or will it still be included into contrib?

Have fun and stay safe!

Jarmo




Org babel java: adding class path

2021-03-23 Thread Jarmo Hurri


Greetings.

I need to add an additional classpath to the call of
org-babel-java-command to make sure my program is able to load a
database driver. But, as it is now, org babel java already uses
classpath option -cp, and in the case of multiple -cp options, only the
last one is retained:

https://stackoverflow.com/questions/45291354/specifying-multiple-cp-or-classpath-entries-on-java-command-line

So what is the correct way to do achieve this in org babel?

>From the command line, in linux, multiple class paths would separated by
a colon ":"

java -classpath "/usr/share/java/hsqldb.jar:." Main

Have fun and stay safe,

Jarmo




Re: Missing line breaks in Beamer with alltt

2020-12-04 Thread Jarmo Hurri


Hi there Eric.

Eric S Fraga  writes:

>> I will take you up on that offer! Are you able to replicate the
>> difference between these two slides?
>
> Interesting.  It seems that the use of =...= in one of the items makes
> org insert the "fragile" option for the frame and that allows the alltt
> environment to work properly.  The solution therefore is either make
> sure that there is at least one use of =...= in the slide or, better
> yet, add the fragile option yourself by setting the BEAMER_opt property
> to fragile, as in:
>
> * Another slide
> :PROPERTIES:
> :BEAMER_opt: fragile
> :END:
>
> I've tested this and it works for me.

Works for me too, excellent!

I have an eerie feeling that this should be either
a) fixed so that it works without inserting fragile, or
b) written down somewhere in documentation.
Any ideas?

All the best, and stay safe.

Jarmo




Re: Missing line breaks in Beamer with alltt

2020-12-03 Thread Jarmo Hurri

Hi there.

Eric S Fraga  writes:

> Happy to try to help.

I will take you up on that offer! Are you able to replicate the
difference between these two slides?

# 
--
#+startup: beamer

#+latex_header: \usepackage{alltt}

* A slide with some code
  - =yes= verbatim on this line, line breaks preserved
#+begin_alltt 
N=5
if S\neq I
#+end_alltt

* Another slide
  - no verbatim on this line, line breaks not preserved
#+begin_alltt 
N=5
if S\neq I
#+end_alltt

# 
--

If you are not, then please find attached generated tex.

All the best, and stay safe.

Jarmo



beamer-alltt.tex
Description: latex


Re: Missing line breaks in Beamer with alltt

2020-11-29 Thread Jarmo Hurri


Eric S Fraga  writes:

Hi there!

> On Sunday, 29 Nov 2020 at 11:22, Jarmo Hurri wrote:
>> Any ideas?
>
> First of all, the first frame works just fine for me.  Line breaks are
> preserved.

Fascinating: it has to be something in my settings. I went through my
init files and did not find anything relevant. Off to debug I go then.

> When in doubt, export to LaTeX (C-e l b) and have a look at the LaTeX.
> Also then run pdflatex yourself on that LaTeX code to see what errors
> come up.

I did that but did not notice anything weird in the latex code. Then
again, if I export to regular latex, line breaks are preserved just
fine. Therefore, this has to be related to some beamer settings (or my
texlive version or something like that).

Thanks for pointing me in the right direction.

All the best, and stay safe.

Jarmo




Missing line breaks in Beamer with alltt

2020-11-29 Thread Jarmo Hurri


Greetings.

Any ideas?

# 
--
#+startup: beamer

#+latex_header: \usepackage{alltt}

* A slide with some code
  - export to beamer pdf with =C-e l O=
  - line breaks disappear from this:
#+begin_alltt 
x \in {0, 1, ..., n}
z \leftarrow x + 1
#+end_alltt

* An effort to fix this
  - tip from

https://tex.stackexchange.com/questions/68064/beamer-alltt-environment-and-only
  - the effort is here, but the end result is an error
#+begin_src latex
  \defverbatim\SomeCode{
  \begin{alltt}
  x \in {0, 1, ..., n}
  z \leftarrow x + 1
  \end{alltt}
  }
#+end_src

\SomeCode
# 
--

All the best, and stay safe.

Jarmo




org-indent-line of lines ending blocks

2020-11-25 Thread Jarmo Hurri


Greetings.

# 
---
* Indentation of lines ending blocks
  #+begin_example
My wish is that when the cursor is on the line indicating end of this block 
(end_example), 
and (org-indent-line) is evaluated, the line would be indented at the level 
of the 
begin_example which begins the block. Is this feasible / possible?
#+end_example
# 
---

All the best, and stay safe.

Jarmo




Re: [PATCH] ob-java

2020-11-14 Thread Jarmo Hurri


ian martins  writes:

>> > It seems that you have changed some classloader settings in the new
>> > code. I have examples which used to work perfectly; now they still
>> > compile, but fail to run, throwing exception
>> >
>> > java.lang.NoClassDefFoundError
>>
>> I had some extra time today, so I took a look at ob-java.el. Unless
>> header argument dir is set, java is run in a temporary directory. So I
>> can get around this problem by setting header argument
>>
>> :dir "."
>>
>> which is nice, at least as a workaround.
>
> You're right that this is a change. I will revert the default
> behaviour. in the meantime you could do something like
>
> (setq org-babel-default-header-args:java
>   (cons '(:dir . ".")
> org-babel-default-header-args:java))
>
> in your init file after loading org to fix it everywhere.

Thanks a bunch, will do.

All the best, and stay safe.

Jarmo




Re: [PATCH] ob-java

2020-11-14 Thread Jarmo Hurri


Hi again!

Jarmo Hurri  writes:

> It seems that you have changed some classloader settings in the new
> code. I have examples which used to work perfectly; now they still
> compile, but fail to run, throwing exception
>
> java.lang.NoClassDefFoundError

I had some extra time today, so I took a look at ob-java.el. Unless
header argument dir is set, java is run in a temporary directory. So I
can get around this problem by setting header argument

:dir "."

which is nice, at least as a workaround.

I am not sure what the default behaviour should be. At the moment,
though, I do not think temporary dir is a good default, because by
default the program will then the "miss" all opened (data) files as
well. Right?

Perhaps all babel languages have a common policy here that I am not
aware of.

But in any case it looks to me that the behaviour has changed now, so if
it is changed in the stable branch (I am running master), I think it
should be documented clearly (as an incompatible change). Perhaps it
already is documented like that.

All the best, and stay safe.

Jarmo




Re: [PATCH] ob-java

2020-11-09 Thread Jarmo Hurri
ian martins  writes:

> Let me know how it goes.

Hello again.

It seems that you have changed some classloader settings in the new
code. I have examples which used to work perfectly; now they still
compile, but fail to run, throwing exception

java.lang.NoClassDefFoundError

explained here:

https://stackoverflow.com/questions/17973970/how-to-solve-java-lang-noclassdeffounderror

I have attached a minimal example demontrating the problem.

1. You can see the error if you evaluate the code in the org
   file. Please observer that the submodule java file has been compiled
   to a class just fine.
   
2. If you untangle the org file, and then run

   javac LoadError.java
   java LoadError

   you should see that there is no problem with the code.

This issue is critical for me, because a lot of code I have depends on
other code (in git submodules).

Can you please tell me how this proceeds? (I may have to roll back to an
earlier org version soon.)

All the best,

Jarmo



load-error.tar.gz
Description: load error demo


Re: [PATCH] ob-java

2020-11-09 Thread Jarmo Hurri


Hello Ian!

ian martins  writes:

> Let me know how it goes.

The new version seems to be sensitive to whitespace:

# -
* this one works
  #+begin_src java :classname Foo :results output
public class Foo
{
  public static void main(String[] args)
  {
System.out.print("hello, world");
  }
}
  #+end_src

  #+RESULTS:
  : hello, world

* this one does not (space after word =main=)
  #+begin_src java :classname Foo2 :results output
public class Foo2
{
  public static void main (String[] args)
  {
System.out.print("hello, world");
  }
}
  #+end_src
# -

All the best,

Jarmo




Re: [PATCH] ob-java

2020-11-05 Thread Jarmo Hurri


Hello Ian.

ian martins  writes:

>> Being a heavy user, I wonder if worg documentation page is being kept
>> up to date with the changes?
> Yes, that page is up to date. Actually, the page is new.

Brilliant! So the only thing that was not up to date was me.

(I wonder if it would be possible to have timestamps in worg. I have
bumped into situations before where I have not known the temporal
relationship between worg documentation and current org version.)

> Are you using the latest? 

Yes.

> Were there any issues when you updated?

At some point I was using the latest at that time, and my org java stuff
broke in the middle of a presentation during class. I have not had the
time to check whether the very latest solves these issues. I will start
preparing some new material now, and will let you know if anything weird
happens.

I greatly appreciate the effort you are putting into this package.

All the best, and stay safe.

Jarmo




Re: [PATCH] ob-java

2020-11-05 Thread Jarmo Hurri


Hi there!

I noticed that a lot of work is being put into Java in Babel. Excellent.

Being a heavy user, I wonder if worg documentation page is being kept up
to date with the changes?

https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-java.html

All the best, and stay safe.

Jarmo




Re: Special symbols with monospace

2020-10-15 Thread Jarmo Hurri
Eric S Fraga  writes:

> In that case, you may simply wish to use the alltt environment.  This
> works for me:
>
> #+begin_src org
>   ,* algorithm pseudo code
>   ,#+latex_header: \usepackage{alltt}
>   ,#+begin_alltt
>   for i \in [0,1] do
> if i \neq 3
>   x ← i^2
> end if
>   end for
>   ,#+end_alltt
> #+end_src

Excellent, works for me too.

What a great community!

Jarmo




Re: Special symbols with monospace

2020-10-15 Thread Jarmo Hurri


Maxim Nikulin  writes:

 What is the easiest way to combine monospace and special symbols?
>>>
>>> Is there any problem with UTF-8 symbols such as "≠"? I have typed it using
>>> Compose / =
>> 
>> At least out of the box, the UTF-8 symbol is not exported.
>
> #+BEGIN_SRC emacs-lisp
> (add-to-list 'org-latex-inputenc-alist '("utf8" . "utf8x"))
> #+END_SR

Noice!

Thanks,

Jarmo




Re: Special symbols with monospace

2020-10-15 Thread Jarmo Hurri


Hello.

Maxim Nikulin  writes:

> Jarmo Hurri wrote:
>> What is the easiest way to combine monospace and special symbols?
>
> Is there any problem with UTF-8 symbols such as "≠"? I have typed it using
> Compose / =

At least out of the box, the UTF-8 symbol is not exported.

All the best,

Jarmo




Re: Special symbols with monospace

2020-10-15 Thread Jarmo Hurri


Hi there.

Eric S Fraga  writes:

> I resort to LaTeX for this, using a LaTeX src block with the algorithm
> and algpseudocode packages.

In my case there is a specific pseudocode format I need to use. I think
I would have to try to tune one of these packages pretty heavily.

But I will see. Thanks.

Jarmo




Re: Special symbols with monospace

2020-10-15 Thread Jarmo Hurri


Hi there!

Colin Baxter  writes:

> Would https://github.com/jsalzbergedu/pseudocode-mode be any good?

I will have to explore it. The documentation is almost as thin as my
wallet.

Thanks,

Jarmo




Special symbols with monospace

2020-10-15 Thread Jarmo Hurri


Greetings.

I like to embed pseudocode etc. in example blocks so that it is typeset
in monospace when exported. But sometimes I would need special symbols,
such as \neq, in pseudocode. What is the easiest way to combine
monospace and special symbols?

Jarmo




Re: Bug: links to filename containing word "loops" fail to export

2020-08-16 Thread Jarmo Hurri
Nicolas Goaziou  writes:

>> * Links to files containing the word ~loops~ are not exported
>
> Fun bug. 

Indeed! Had to take a second cup of coffee before I believed my eyes.

> This should be fixed

Seems to be working now, thank you very much.

All the best, and stay safe.

Jarmo




Bug: links to filename containing word "loops" fail to export

2020-08-15 Thread Jarmo Hurri


* Links to files containing the word ~loops~ are not exported
** What is the problem?
   It seems that if a link to a file contains the word ~loops~,
   it is not exported at all.
** How to replicate
   1. Save this org into file =org-loops-in-link.org=
   2. Save the following elisp into =minimal-org.el=, replacing the
 location of org mode with your path:
 #+begin_src elisp
   (add-to-list 'load-path (expand-file-name "~/src/org-mode/lisp"))
   (add-to-list 'load-path (expand-file-name "~/src/org-mode/contrib/lisp" 
t))
 #+end_src
   3. Open this file with
  #+begin_src sh
emacs -Q -l minimal-org.el org-loops-in-link.org
  #+end_src
   4. Export to latex as a PDF file and open (C-c C-e l o), observing
  missing items when the list below is exported:
  - [[file:loopy.org]]
  - [[file:loops.org]]
  - [[file:loopz.org]]
  - [[file:some-loops.org]]
  - [[file:some-loopz.org]]
** My org and emacs versions
   - Org mode version 9.3.7 (release_9.3.7-708-g5417e3)
   - GNU Emacs 26.3





Re: Binding RET to org-return-and-maybe-indent

2020-07-27 Thread Jarmo Hurri


Greetings Kévin.

Kévin Le Gouguec  writes:

> If I replace (electric-indent-mode -1) with
> (electric-indent-local-mode -1) in org-mode-hook, I get the behaviour
> we have with "Org 9.3" and "Org master, electric-indent-mode on".
>
> Can you tell me whether electric-indent-local-mode works better for
> you?  If it does, I'll followup with a patch to ORG-NEWS.

Seems to be working fine. Thank you very much.

All the best, and stay safe.

Jarmo




Re: Binding RET to org-return-and-maybe-indent

2020-07-23 Thread Jarmo Hurri


Hi Kévin.

Kévin Le Gouguec  writes:

>>> #+begin_src emacs-lisp
>>> (add-hook 'org-mode-hook (lambda () (electric-indent-mode -1)))
>>> #+end_src
>>
>> Unfortunately this has side effects: it changes at least the way
>> parentheses and indentation interact when opening a Babel source code
>> block. It might be a good idea to mention this in ORG-NEWS.
>
> Could you give us a precise recipe?  (Starting from emacs -Q and an
> empty Org buffer)
>
> I've fiddled a bit with source blocks just now and I'm noticing some
> weirdness that I suspect might be due to electric-indent-mode
> re-indenting the previous line when hitting RET (or C-j when disabling
> electric-indent-mode), but nothing specific to parentheses.

At the minimum it changes the way parentheses indent automatically when
editing source code blocks. Below is a minimal demo, documented using
our favorite system.

All the best, and stay safe.

Jarmo

* Demo of the effect of disabling elint
  1. Save this org into file =org-elint-disable.org=
  2. Save the following elisp into =minimal-org.el=, replacing the
 location of org mode with your path:
 #+begin_src elisp
   (add-to-list 'load-path (expand-file-name "~/src/org-mode/lisp"))
   (add-to-list 'load-path (expand-file-name "~/src/org-mode/contrib/lisp" 
t))
   (add-hook 'org-mode-hook (lambda () (electric-indent-mode -1)))
 #+end_src
  3. Toggle the last line
 #+begin_src elisp
 (add-hook 'org-mode-hook (lambda () (electric-indent-mode -1)))
 #+end_src
 in =minimal-org.el= to see the following effect:
 1. Open this file with
#+begin_src sh
  emacs -Q -l minimal-org.el org-elint-disable.org
#+end_src
 2. Type C-c ' for (org-edit-special) in the source code block below,
and follow the instructions on the comment line.
#+begin_src java :exports none :classname Demo
  class Demo
  {
  // 1st press RET at the end of this line, then type TAB and }
#+end_src
  




Re: Binding RET to org-return-and-maybe-indent

2020-07-23 Thread Jarmo Hurri


Hello again.

Kévin Le Gouguec  writes:

> As ORG-NEWS notes, if you want RET to stop indenting, you can disable
> electric-indent-mode in org-mode-hook:
>
> #+begin_src emacs-lisp
> (add-hook 'org-mode-hook (lambda () (electric-indent-mode -1)))
> #+end_src

Unfortunately this has side effects: it changes at least the way
parentheses and indentation interact when opening a Babel source code
block. It might be a good idea to mention this in ORG-NEWS.

Next I will try to change the binding of RET.

All the best, and stay safe.

Jarmo




Re: Binding RET to org-return-and-maybe-indent

2020-07-22 Thread Jarmo Hurri


Hello Kévin.

Kévin Le Gouguec  writes:

> RET indentation is something that has been introduced recently on the
> master branch (which will become Org 9.4 soon).  In Org 9.3, with your
> example, RET does not indent, while C-j does.

I was wondering why this bothered me! Such a little thing can have a
drastic effect on your workflow when it is repeated so many times.

> As ORG-NEWS notes, if you want RET to stop indenting, you can disable
> electric-indent-mode in org-mode-hook:

Thanks, I now located this feature change description in ORG-NEWS.

>> But would changing the binding of RET cause issues elsewhere?
>
> I can't think of any bad side-effect, but my imagination might be
> lacking.  The only downside I can think of is that RET will become
> redundant with C-j.

Now I have two options. I will start by disabling electric-indent-mode
in org. If that causes weird side effects, then I will rebind RET.

Thank you for your most complete answer.

All the best, and stay safe.

Jarmo




Binding RET to org-return-and-maybe-indent

2020-07-22 Thread Jarmo Hurri


Hello.

Is there any downside to binding RET to org-return-and-maybe-indent?

I want to remove RET indentation in org mode. For example

# ---
* Demo of indentation
  - when I press return at the end of the word THIS
  - I get indentation
# ---

However, if I call org-return-and-maybe-indent at the same point, I do
not get indentation.

But would changing the binding of RET cause issues elsewhere?

I am running Org mode version 9.3.7 (release_9.3.7-694-g7069dc).

Jarmo




Re: Error (args out of range) when editing list

2020-07-10 Thread Jarmo Hurri


Nicolas Goaziou  writes:

>> I think I am running the latest (stable) master:
>
> Note: stable ≠ master, so you just wrote an oxymoron ;)

Oops, exactly. :) I now pulled the latest _master_, and it does not have
the same issue branch _stable_ has. So I guess stable will also contain
the fix at some point.

Thanks, and all the best,

Jarmo




Re: Error (args out of range) when editing list

2020-07-10 Thread Jarmo Hurri


Hi there!

Nicolas Goaziou  writes:

>> * Demo of some sort of error
>>   1. (take your cursor on top of the letter X after the closing
>>  parenthesis)X
>>   2. then press Alt-Enter
>>  1. you will notice
>>  2. an error
>>   3. saying something like args out of range
>
> Could you try with latest master? I cannot reproduce it.

I think I am running the latest (stable) master:

Org mode version 9.3.7 (release_9.3.7-13-ge62ca4)

Then it has to be something in my system. Great. As a cry for help, here
is what I get with debug-on-error:

Debugger entered--Lisp error: (args-out-of-range -1 3)
  replace-match("2. " nil nil nil 1)
  #f(compiled-function (struct old-struct item) #)(((30 2 
"1. " nil nil nil 112) (112 2 "2. " nil nil nil 119) (120 2 "1. " nil nil nil 
187) (146 5 "1. " nil nil nil 170) (170 5 "2. " nil nil nil 187) (187 2 "2. " 
nil nil nil 232)) ((30 2 "1. " nil nil nil 112) (112 2 "1. " nil nil nil 119) 
(120 2 "2. " nil nil nil 187) (146 5 "1. " nil nil nil 170) (170 5 "2. " nil 
nil nil 187) (187 2 "3. " nil nil nil 232)) 187)
  org-list-struct-apply-struct(((30 2 "1. " nil nil nil 112) (112 2 "2. " nil 
nil nil 119) (120 2 "1. " nil nil nil 187) (146 5 "1. " nil nil nil 170) (170 5 
"2. " nil nil nil 187) (187 2 "2. " nil nil nil 232)) ((30 2 "1. " nil nil nil 
112) (112 2 "1. " nil nil nil 119) (120 2 "2. " nil nil nil 187) (146 5 "1. " 
nil nil nil 170) (170 5 "2. " nil nil nil 187) (187 2 "3. " nil nil nil 232)))
  org-list-write-struct(((30 2 "1. " nil nil nil 112) (112 2 "2. " nil nil nil 
119) (120 2 "1. " nil nil nil 187) (146 5 "1. " nil nil nil 170) (170 5 "2. " 
nil nil nil 187) (187 2 "2. " nil nil nil 232)) ((30) (112) (120) (146 . 120) 
(170 . 120) (187)))
  org-insert-item(nil)
  funcall-interactively(org-insert-item nil)
  call-interactively(org-insert-item)
  org-meta-return(nil)
  funcall-interactively(org-meta-return nil)
  call-interactively(org-meta-return nil nil)
  command-execute(org-meta-return)

All the best,

Jarmo




Error (args out of range) when editing list

2020-07-10 Thread Jarmo Hurri


* Demo of some sort of error
  1. (take your cursor on top of the letter X after the closing
 parenthesis)X
  2. then press Alt-Enter
 1. you will notice
 2. an error
  3. saying something like args out of range




Re: Babel: parse error when output contains opening bracket

2020-06-29 Thread Jarmo Hurri
ian martins  writes:

> Since you recommend it, I will try submitting a patch for java.

Excellent.

> I still want to share the haxe integration. What is the best way to do
> that?

What does "haxe integration" mean here?

All the best,

Jarmo




Re: Babel: parse error when output contains opening bracket

2020-06-27 Thread Jarmo Hurri


>> ian martins  writes:
>> 
>> Would it be possible for us to fix the current version without
>> introducing a new one? Can you identify the parts of your code that fix
>> the issue?
>>
> The existing code creates the java program and runs it correctly, but
> it uses `org-babel-import-elisp-from-file' to interpret the results,
> and that sees the bracket and tries to make the response into a list,
> and errors when it can't. I don't see a quick fix for it. If you allow
> unbalanced brackets but that would be a change in ob-core and would
> probably cause unwanted results in other places. If you don't try to
> convert the output into a list, you can't present java results as
> lists or tables.  Really the problem is that ob-java doesn't support
> functional mode, so it tries to guess if scripting mode output should
> be a table or list.  The version I wrote supports functional and
> scripting modes and doesn't use `org-babel-import-elisp-from-file'.

Ok.

>> I am already a contributor, so if you can post your solution here I
>> can create a patch and give you the credit.
>>
> I would really appreciate that if you are willing, but it's a
> significant change (code is 400 lines, 600 lines of tests and test
> data) and there might be iterations so you might be signing up for
> more than you realize.

Fair enough.

1. Have you considered writing a patch yourself?

2. If not, I think you lose nothing by posting your code here and
   patiently waiting if I can create something out of it.

All the best,

Jarmo




Re: Babel: parse error when output contains opening bracket

2020-06-26 Thread Jarmo Hurri
ian martins  writes:

Hello.

> I've written an alternative org-java.el that doesn't have that
> problem. I wanted to add it to contrib/ but haven't been able to get
> access. if you want to try it I can post it somewhere.

Sounds excellent.

Would it be possible for us to fix the current version without
introducing a new one? Can you identify the parts of your code that fix
the issue?

I am already a contributor, so if you can post your solution here I can
create a patch and give you the credit.

How does that sound?

Jarmo




Babel: parse error when output contains opening bracket

2020-06-25 Thread Jarmo Hurri


Greetings.

In the org file below, the first babel block will evaluate just fine,
while the second will signal "End of file during parsing". The
difference is the opening bracket "[" in output.

I think am running the most recent stable version:
Org mode version 9.3.7 (release_9.3.7-4-gba6ca7)

Thanks for any ideas.

Jarmo

# ---
* This will parse just fine
  #+name: OK
  #+begin_src java :exports results :classname OK :results output
class OK
{
  public static void main (String[] args) { System.out.println ("foo"); }
}
  #+end_src

  #+RESULTS: OK
  : foo

* This will generate a parse error when evaluated
  #+name: BAD
  #+begin_src java :exports results :classname BAD :results output
class BAD
{
  public static void main (String[] args) { System.out.println ("[foo"); }
}
  #+end_src




Re: Bug: org-insert-item behaves weirdly and then fails

2020-04-10 Thread Jarmo Hurri
Nicolas Goaziou  writes:

> Indeed. This should now be fixed.

Was that quick or what!? Kudos.

Jarmo




Bug: org-insert-item behaves weirdly and then fails

2020-04-10 Thread Jarmo Hurri


Greetings.

The following happens with the latest version of the stable branch and
the latest version of the master branch.

Consider the following org file:

# ---
1. Some text [fn:: foo]

2. 

3. with items
# ---

The bug can be reproduced with the following:
1. go to the end of first line
2. press M-return , that is (org-meta-return)
3. return to step 1

You will notice that item numbers will first start to behave weirdly,
then eventually an error will be thrown.

My emacs version is

GNU Emacs 26.3

Any ideas?

Jarmo




Latex export: setting options for packages included by default

2020-01-23 Thread Jarmo Hurri


Greetings.

When I export to Latex, org automatically creates the following line in
preamble:

\usepackage{color}

I would like to find a way to pass option [monochrome] to this
package. Adding another \usepackage creates a conflict. My preferred way
would be to add the line

\PassOptionsToPackage{monochrome}{color}

to the preamble before \usepackage.

1. Is there a way to do this (easily) in Org? I think it is possible to
   redefine the preamble template, but that would be an overkill.

2. If there is no direct option for this, could we have one? Like
   #+latex_header but which would be applied before any packages are
   loaded?

Jarmo




Re: Asymptote figure in footnote

2020-01-21 Thread Jarmo Hurri


Nicolas Goaziou  writes:

>> This has to be a borderline case, but I need some Asympote-generated
>> figures in footnotes. The following does not seem to work.
>>
>> [fn:: src_asy[:filename foo.pdf]{size(8cm,0); draw (unitcircle);}]
>
> The following works here:
>
>   [fn:: src_asymptote[:file foo.pdf]{size(8cm,0); draw (unitcircle);}]

Thank you and sorry.

That was pathetic, but it has been a long day. And continues.

Do you have an idea of how to control the size of the pic in the
footnote? The default is .9\linewidth. I figured a workaround (below),
but would prefer the structure above.

The workaround is to produce the asy image with a regular src block,
exporting nothing, and then using inline latex in footnote as follows:

[fn:: @@latex:\includegraphics[width.3\linewidth]{sine-curve-a.pdf}@@]

And, once again, I am amazed by Org's capabilities! :D

Jarmo




Asymptote figure in footnote

2020-01-21 Thread Jarmo Hurri


Greetings.

This has to be a borderline case, but I need some Asympote-generated
figures in footnotes. The following does not seem to work.

[fn:: src_asy[:filename foo.pdf]{size(8cm,0); draw (unitcircle);}]

Any ideas?

Jarmo




Re: [PATCH] ob-java.el: Add header argument to pass command line args

2019-12-27 Thread Jarmo Hurri


Greetings.

I posted an updated version of the patch here on December 1st, but I
have not yet seen it in the master branch so far. Was the patch ok, or
do I still need to do something else than wait?

As a new year approaches, I too want to thank everyone involved in Org
for creating such a great tool. I use it for all my work currently.

All the best,

Jarmo




Re: Include lines in setupfile are not evaluated: bug or feature?

2019-12-15 Thread Jarmo Hurri


Greetings again.

Nicolas Goaziou  writes:

>> Ok. As a programmer I was hoping to mix them, because it would be
>> logical to have _one_ header file that defines all the common things
>> for a set of related files.
>
> Again, there is no overlap between the two keywords. SETUPFILE is what
> you want. INCLUDE is only meaningful during export (and is only
> documented there). I cannot think of a real situation where you would
> need both for the same file.

I have such documents regularly.
1. One type is a handout containing common contents at the beginning
   (included) and settings (setup).
2. The other case is a set of files sharing setup info and code (babel
   blocks, included).

>> Do I understand correctly: the description in the documentation is
>> not correct in the sense that not all contents from SETUPFILE is
>> evaluated as if it were included in the buffer?
>
> I think the document is correct, although I understand it can be
> misleading: it uses the verb "to include", but with a different
> meaning than INCLUDE keyword. It includes in-buffer settings, not full
> contents.
>
>> I am just trying to think about how this limitation, if it exists,
>> should be expressed in documentation. Shall I give it a try?
>
> Sure, but please do not mix SETUPFILE and INCLUDE, which are
> unrelated.

I will give it a try during the Christmas break.

All the best,

Jarmo




Re: Include lines in setupfile are not evaluated: bug or feature?

2019-12-07 Thread Jarmo Hurri


Hello Nicolas!

Nicolas Goaziou  writes:

> SETUPFILE and INCLUDE are orthogonal. There is no point in mixing
> them.

Ok. As a programmer I was hoping to mix them, because it would be
logical to have _one_ header file that defines all the common things for
a set of related files.

But perhaps I can get away with using SETUPFILEs only. I will see.

> Jarmo Hurri  writes:
>> Documentation of #setupfile says that
>>
>> "Org parses the contents of this document as if it was included in the
>> buffer."
>>
>> https://orgmode.org/manual/In_002dbuffer-settings.html
>>
>> But that does not seem to be the case.
>
> SETUPFILE keyword recursively loads configuration from other files,
> without inserting anything. INCLUDE keyword recursively inserts
> contents from other files in the current document, but there is no
> guarantee that configuration from these files will be inherited.

Do I understand correctly: the description in the documentation is not
correct in the sense that not all contents from SETUPFILE is evaluated
as if it were included in the buffer?

I am just trying to think about how this limitation, if it exists,
should be expressed in documentation. Shall I give it a try?

Thanks for the clarifying response!

Jarmo




Include lines in setupfile are not evaluated: bug or feature?

2019-12-07 Thread Jarmo Hurri


Greetings.

I am (still) trying to figure out a SINGLE common setup/include file for
all settings for a large batch of files.

I found out recently that common #properties can be set in a setup file
(but not in an included file). However, now it seems that in a setup
file I can not include all common included files. Is this intended
behaviour?

Below is an example that demonstrates this. First the main (exported
file):

# --- file main-file.org 
#+setupfile: setup-file.org

src_elisp[:exports results :results raw]{(org-entry-get nil "MY_PROPERTY" t)}
# ---

Then the setup file:

# -- file setup-file.org 
#+property: MY_PROPERTY true
#+include: setup-included.org
# ---

Then the file that is supposed to be included in the setup file (and,
consequently, in the main file):

# -- file setup-included.org 
Some text to be included.
# ---

But the text is not included in the main file. Documentation of
#setupfile says that

"Org parses the contents of this document as if it was included in the
buffer."

https://orgmode.org/manual/In_002dbuffer-settings.html

But that does not seem to be the case.

Jarmo




PATCH: Display point of code block point when confirming evaluation

2019-12-06 Thread Jarmo Hurri

Greetings.

Please find attached a patch that adds the point of the source code
block to the message shown to user when confirming the evaluation of the
block.

In large org-files, I have often trouble figuring out which code block
Org is confirming me to evaluate when exporting. This is especially true
when I have set 'cache: yes'. When something changes in code, these
blocks need to be re-evaluated during export, but the '#results:' of
these blocks are not changed. Therefore, on the next export I will be
asked again, unless I find the block and evaluate it by hand myself.

This patch adds the 'start' element of source block info at the end of
the confirmation message. 

Jarmo

>From aaa68af8a7710ffe2c61fc45edf2ff377438cd32 Mon Sep 17 00:00:00 2001
From: Jarmo Hurri 
Date: Sat, 7 Dec 2019 09:14:34 +0200
Subject: [PATCH] ob-core.el: Display block point during evaluation
 confirmation

* lisp/ob-core.el (org-babel-confirm-evaluate): Display code block
point when querying confirmation of evaluation.

This addresses the problem of finding the block currently evaluated.
---
 lisp/ob-core.el | 11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index f877ff51b..7ba9894e6 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -277,7 +277,8 @@ environment, to override this check."
   (let* ((evalp (org-babel-check-confirm-evaluate info))
 	 (lang (nth 0 info))
 	 (name (nth 4 info))
-	 (name-string (if name (format " (%s) " name) " ")))
+	 (name-string (if name (format " (%s) " name) " "))
+	 (start (nth 5 info)))
 (pcase evalp
   (`nil nil)
   (`t t)
@@ -285,11 +286,11 @@ environment, to override this check."
 	   (and (not (bound-and-true-p
 			  org-babel-confirm-evaluate-answer-no))
 		(yes-or-no-p
-		 (format "Evaluate this %s code block%son your system? "
-			 lang name-string)))
+		 (format "Evaluate this %s code block%son your system (point %d)? "
+			 lang name-string start)))
 	   (progn
-		(message "Evaluation of this %s code block%sis aborted."
-			 lang name-string)
+		(message "Evaluation of this %s code block%sis aborted (point %d)."
+			 lang name-string start)
 		nil)))
   (x (error "Unexpected value `%s' from `org-babel-check-confirm-evaluate'" x)
 
-- 
2.21.0



Re: Included global properties not inherited: bug or feature?

2019-12-06 Thread Jarmo Hurri

Nicolas Goaziou  writes:

>> I find current behaviour inconvenient, because I want to set common
>> global properties for a large number of files, and I can not currently
>> do this via an included file.
>
> What happens if you use SETUPFILE instead?

It works perfectly.

Please find attached a patch that mentions this behaviour in the
include-part of Org manual. Ok?

Jarmo

>From 00701e1732fcf71180dc02f72117b44bccf5eb2d Mon Sep 17 00:00:00 2001
From: Jarmo Hurri 
Date: Sat, 7 Dec 2019 08:19:05 +0200
Subject: [PATCH] org-manual.org: Document global properties not being
 inherited when including files

* doc/org-manual.org: Note that when an org-file is included, even
  with `:only-contents` set to `nil`, global properties set with lines
  beginning `#+PROPERTY:` will not be inherited in the file that
  includes. Point the user to use `#+SETUPFILE:` for this purpose.
---
 doc/org-manual.org | 5 +
 1 file changed, 5 insertions(+)

diff --git a/doc/org-manual.org b/doc/org-manual.org
index 35f6013ce..a0aedf825 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -11770,6 +11770,11 @@ with the custom ID =theory=, you can use
 
 : #+INCLUDE: "./paper.org::#theory" :only-contents t
 
+Note that even when =:only-contents= has value ~nil~, properties set
+in the included file by lines beginning with =#+PROPERTY:= will not be
+inherited in the file that includes. To achieve such inheritance, use
+=#+SETUPFILE:= instead (see [[Summary of In-Buffer Settings]]).
+
 The following command allows navigating to the included document:
 
 - {{{kbd(C-c ')}}} (~org-edit~special~) ::
-- 
2.21.0



Included global properties not inherited: bug or feature?

2019-12-06 Thread Jarmo Hurri


Greetings.

It seems that when a file with global properties is included, the global
properties are not inherited. Is this a bug or a feature?

Consider the two files inlined below:

# -- file 'included.org' ---
#+property: MY_INCLUDED_PROPERTY some included value
# --

# -- file which includes ---

#+include: included.org :only-contents nil
#+property: MY_INLINE_PROPERTY some inline value

src_elisp[:exports results :results raw]{(org-entry-get nil 
"MY_INCLUDED_PROPERTY" t)} nil

src_elisp[:exports results :results raw]{(org-entry-get nil 
"MY_INLINE_PROPERTY" t)} some inline value
# --

As you can see from the results of evaluation of elisp blocks, the
included global property is not available in the including file. Note
that the documentation for #include states that there is a special
property :only-contents for including only contents, not properties. To
play it safe, I have set this property to 'nil' above.

https://orgmode.org/manual/Include-files.html

Based on this documentation, I was expecting global properties to be
available by default in including files.

I find current behaviour inconvenient, because I want to set common
global properties for a large number of files, and I can not currently
do this via an included file.

What is the verdict?

I am running
Org mode version 9.3 (release_9.3-34-g2eee3c)
GNU Emacs 26.2

Jarmo




Re: Babel: tangling questions

2019-12-03 Thread Jarmo Hurri


Greetings Diego.

Diego Zamboni  writes:

>> 1. I want to tangle to the default filename (derived from name of org
>>file and programming language). However, the :tangle header argument
>>only takes either "yes" or "filename." If the value is "yes", then
>>the filename is deduced automatically. How can I specify a tangling
>>directory and still have the default filename?
>
> You can specify a full path as the value of :tangle, but I don't know
> of a way to specify only the directory.

For my purposes this would be a nice new feature. Specifying a directory
would imply the default filename.

> As a workaround, you can also use emacs-lisp code as the value for
> :tangle, so you could do something like this:
>
>  :tangle (concat "/some/dir/" (file-name-base (file-name-sans-extension
> (buffer-file-name))) ".ext")

Nice! For this to be practical, I need two additional features.

1. Ability to set "/some/dir/" on a per-file basis.
2. Ability to infer ".ext" from the source block.

I was actually extend your suggestion to a solution with both of these
properties. In my emacs init file I define:

(defun org-default-tangle-file-with-dir-from-property ()
  (concat (or (org-entry-get nil "ORG_TANGLE_DIRECTORY" t) ".")
  "/"
  (file-name-base (file-name-sans-extension (buffer-file-name)))
  "."
  (let ((lang (car (org-babel-get-src-block-info t
(or (cdr (assoc lang org-babel-tangle-lang-exts)) lang

Then I set on the top of my org file, for example

#+property: ORG_TANGLE_DIRECTORY ../docs

After this the following works like a charm (at least so far):

:tangle (org-default-tangle-file-with-dir-from-property)

>> 3. Is it possible to tangle automatically on (every) export? I always
>>export, but I might forget to tangle, in which case export and tangle
>>would be out of sync.
>>
>
> I use the following hook to tangle on every save. I find it indispensable :)
>
>   (add-hook 'org-mode-hook (lambda () (add-hook 'after-save-hook
> 'org-babel-tangle
>'run-at-end 'only-in-org-mode)))

Good idea, I will explore this.

> Also, check out my free book "Literate Config", where I discuss some
> more tips about Literate Programming:
> https://leanpub.com/lit-config/read

Will do.

> Hope this helps,

Sure did. Thanks!

Jarmo




Babel: tangling questions

2019-12-03 Thread Jarmo Hurri


Greetings.

I am trying to tangle code to a specific directory.

1. I want to tangle to the default filename (derived from name of org
   file and programming language). However, the :tangle header argument
   only takes either "yes" or "filename." If the value is "yes", then
   the filename is deduced automatically. How can I specify a tangling
   directory and still have the default filename?

   There was a related question on stack exchange, but it did not use
   the default filename:
   
https://emacs.stackexchange.com/questions/41806/org-babel-set-root-dir-for-tangled-files

2. The question above implies a feature request: third possible value
   for :tangle, a directory. In this case code would be tangled into the
   specified directory into a file with default filename. Any support?

3. Is it possible to tangle automatically on (every) export? I always
   export, but I might forget to tangle, in which case export and tangle
   would be out of sync.

   Someone asked about this a while ago on stack exchange, but maybe
   things have changed:
   
https://emacs.stackexchange.com/questions/24645/exporting-and-tangling-simultaneously-in-org-mode

Thanks a bunch in advance.

Jarmo




Re: [PATCH] ob-java.el: Add header argument to pass command line args

2019-12-01 Thread Jarmo Hurri
Nicolas Goaziou  writes:

>> Any hope of this super tiny patch being applied? It addresses the
>> problem I brought up in another thread: it is currently not possible
>> to pass command line arguments to a java program.
>
> Org 9.3 is feature frozen for the time being. Do you think this
> qualifies as a bugfix or as a new feature? 

More of a new feature, I guess.

> In the latter case, could you rebase it on top of "next" branch and
> add an entry in ORG-NEWS, under "Org 9.4" section?

I did my best; see attachments. There was no 9.4 section in ORG-NEWS, so
I added my entry under "Version Next". Are these ok?

Jarmo

>From 5089053f4f3f916dfbdab009d28b16ffac6f9055 Mon Sep 17 00:00:00 2001
From: Jarmo Hurri 
Date: Wed, 6 Nov 2019 12:21:16 +0200
Subject: [PATCH 1/2] ob-java.el: Add header argument to pass command line
 args.

* lisp/ob-java.el (org-babel-execute:java): Handle new header argument `:cmdargs` and pass its value as the last element in call to java.
---
 lisp/ob-java.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/ob-java.el b/lisp/ob-java.el
index b055f85e5..80308ec32 100644
--- a/lisp/ob-java.el
+++ b/lisp/ob-java.el
@@ -58,6 +58,7 @@ parameters may be used, like javac -verbose"
 	 (src-file (concat classname ".java"))
 	 (cmpflag (or (cdr (assq :cmpflag params)) ""))
 	 (cmdline (or (cdr (assq :cmdline params)) ""))
+	 (cmdargs (or (cdr (assq :cmdargs params)) ""))
 	 (full-body (org-babel-expand-body:generic body params)))
 (with-temp-file src-file (insert full-body))
 (org-babel-eval
@@ -66,7 +67,7 @@ parameters may be used, like javac -verbose"
 (unless (or (not packagename) (file-exists-p packagename))
   (make-directory packagename 'parents))
 (let ((results (org-babel-eval (concat org-babel-java-command
-   " " cmdline " " classname) "")))
+   " " cmdline " " classname " " cmdargs) "")))
   (org-babel-reassemble-table
    (org-babel-result-cond (cdr (assq :result-params params))
 	 (org-babel-read results)
-- 
2.21.0

>From 033f455399d0821d818ef6ff1c01036c04873ddb Mon Sep 17 00:00:00 2001
From: Jarmo Hurri 
Date: Sun, 1 Dec 2019 12:26:55 +0200
Subject: [PATCH 2/2] Mention header argument to pass command arguments to Java
 blocks in ORG-NEWS

* etc/ORG-NEWS: Mention header argument :cmdargs for Java code blocks.
---
 etc/ORG-NEWS | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 689a07871..ac3d1517f 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -19,6 +19,9 @@ just as if it was at outline level 0.  Inheritance for properties will
 work also for this level.  In other words; defining things in a
 property drawer before the first headline will make them "inheritable"
 for all headlines.
+*** New header argument to pass Java command line arguments
+Babel Java blocks recognize header argument =:cmdargs= and pass its
+value in call to =java=.
 
 * Version 9.3
 
-- 
2.21.0



Re: [PATCH] ob-java.el: Add header argument to pass command line args

2019-11-21 Thread Jarmo Hurri


Greetings.

Any hope of this super tiny patch being applied? It addresses the
problem I brought up in another thread: it is currently not possible to
pass command line arguments to a java program.

All the best,

Jarmo




Re: Bug: ob-plantuml: using @start prefix in buffer returns nil body due to nil assignments [N/A (N/A @ /nix/store/1hmx5h1kn25p7s31h31dz7g3kn1dc6qx-emacs-packages-deps/share/emacs/site-lisp/org/)]

2019-11-09 Thread Jarmo Hurri


Greetings Terje.

Terje Larsen  writes:

> I noticed that I cannot run C-c C-c to convert plantuml source blocks
> since the commit (4e854974be9788f029f2d73f829c4d51d2b83faf), see changes
> at:
> https://code.orgmode.org/bzg/org-mode/commit/4e854974be9788f029f2d73f829c4d51d2b83faf#diff-9c9a333463276ff17be763269a5042f92a40817R73
>
> If I have a simple source block as such as:
>
> #+BEGIN_SRC plantuml :file output.png
> @startuml
> actor Foo1
> actor Foo2
> Foo1 -> Foo2 : Test
> @enduml
> #+END_SRC
>
> When I try to run C-c C-c I receive the following error message:
> org-babel-execute-src-block: Wrong type argument: char-or-string-p,
> nil

I started using plantuml in org last week (and am enjoying it greatly),
so take this with a hint of salt from a beginner. Still, at least in my
installation, your source code block works fine without '@startuml' and
'@enduml':

#+BEGIN_SRC plantuml :file output.png
actor Foo1
actor Foo2
Foo1 -> Foo2 : Test
#+END_SRC

All the best,

Jarmo




[PATCH] ob-java.el: Add header argument to pass command line args

2019-11-06 Thread Jarmo Hurri

... attached

Jarmo

>From bbc3f977d6b98240834af8fb009a2a080813f30b Mon Sep 17 00:00:00 2001
From: Jarmo Hurri 
Date: Wed, 6 Nov 2019 12:21:16 +0200
Subject: [PATCH] ob-java.el: Add header argument to pass command line args.

* lisp/ob-java.el (org-babel-execute:java): Handle new header argument `:cmdargs` and pass its value as the last element in call to java.
---
 lisp/ob-java.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/ob-java.el b/lisp/ob-java.el
index b055f85e5..80308ec32 100644
--- a/lisp/ob-java.el
+++ b/lisp/ob-java.el
@@ -58,6 +58,7 @@ parameters may be used, like javac -verbose"
 	 (src-file (concat classname ".java"))
 	 (cmpflag (or (cdr (assq :cmpflag params)) ""))
 	 (cmdline (or (cdr (assq :cmdline params)) ""))
+	 (cmdargs (or (cdr (assq :cmdargs params)) ""))
 	 (full-body (org-babel-expand-body:generic body params)))
 (with-temp-file src-file (insert full-body))
 (org-babel-eval
@@ -66,7 +67,7 @@ parameters may be used, like javac -verbose"
 (unless (or (not packagename) (file-exists-p packagename))
   (make-directory packagename 'parents))
 (let ((results (org-babel-eval (concat org-babel-java-command
-   " " cmdline " " classname) "")))
+   " " cmdline " " classname " " cmdargs) "")))
   (org-babel-reassemble-table
(org-babel-result-cond (cdr (assq :result-params params))
 	 (org-babel-read results)
-- 
2.21.0



Babel: command line args in java

2019-11-05 Thread Jarmo Hurri


* Intro
  I am trying to supply command line arguments to java code in
  babel. For this a logical option would be to use ~:cmdline~ header
  argument, but I can not get it to work.

  I really need to process the given values as command line arguments,
  so setting some variable values will not work.

* This does not work
  Because ~ob-java.el~ concatenates ~:cmdline~ before ~:classname~ ,
  the straightforward way fails.

  #+begin_src java :classname ArgumentExample :cmdline hi there org fans 
:results output verbatim 
class ArgumentExample
{
  public static void main (String[] args)
  {
for (String s : args)
  System.out.println (s);
  }
}
  #+end_src

  #+RESULTS:

  The results is
  #+begin_center
  Error: Could not find or load main class hi
  Caused by: java.lang.ClassNotFoundException: hi
  #+end_center

  The reason is this piece of code in ~ob-java.el~
  #+begin_src elisp
(org-babel-eval (concat org-babel-java-command " " cmdline " " classname) 
"")
  #+end_src

* This compiles and runs but not as desired
  The second try is to provide classname as the first argument. But a
  ~:classname~ header is also required, so the end result is not the
  desired one.

  #+begin_src java :classname ArgumentExample :cmdline ArgumentExample hi there 
org fans :results output verbatim 
class ArgumentExample
{
  public static void main (String[] args)
  {
for (String s : args)
  System.out.println (s);
  }
}
  #+end_src

  #+RESULTS:
  : hi
  : there
  : org
  : fans
  : ArgumentExample

* This fix does not work either
  When I try to leave out ~:classname~ , the process fails in early stages.

  #+begin_src java :cmdline ArgumentExample hi there org fans :results output 
verbatim 
class ArgumentExample
{
  public static void main (String[] args)
  {
for (String s : args)
  System.out.println (s);
  }
}
  #+end_src

  #+begin_center
  org-babel-execute:java: Can’t compile a java block without a classname
  #+end_center
* Questions
  1. Is there a correct way of doing this already?
  2. If there is no better way, is this desired behaviour or should it
 be fixed?
  3. If this is desired behaviour, can I write a patch adding a new
 header argument such as ~cmdargs~ ?




Continued lists

2019-11-02 Thread Jarmo Hurri


Greetings.

I know that lists can be continued using the following syntax:

# ---
* First heading
  1. a list begins here
* Second heading
  2. [@2] list continues
# ---

I find myself doing this all the time, especially when working on Beamer
slides.

Given how smart org mode is (it is!), I find manual list continuation
weird. My questions are:

a. Is there already a better way?
b. [@b] Could we have one?

Jarmo




Re: [O] JShell support in Babel?

2019-10-17 Thread Jarmo Hurri
Ken Mankoff  writes:

Greetings.

>> JShell is a pretty nifty tool for exploring and demonstrating basic
>> Java features. Has anyone happened to write support for it in Babel?
>
> You can start working with it even without official Babel support:
>
> #+BEGIN_SRC bash :results verbatim
> jshell

That is a nice start! Thanks.

Jarmo




[O] JShell support in Babel?

2019-10-15 Thread Jarmo Hurri


Hello.

JShell is a pretty nifty tool for exploring and demonstrating basic Java
features.

https://en.wikipedia.org/wiki/JShell

Has anyone happened to write support for it in Babel?

If no-one has done this, I might try to implement it later by mimicking
some other language support. Unfortunately I have too much work on my
plate right now, so at this point I am just hoping to find something
ready.

Have fun,

Jarmo




[O] Configuring listings for file or language

2019-10-15 Thread Jarmo Hurri


Greetings.

The help documentation for the variable org-latex-listings-options
suggests that it is easy to configure these options
- globally for all files and languages using this variable
- for each code block separately using #+attr_latex

Is it possible to configure these options for all code blocks
1. in a single org file
2. for a single language?

Thanks!

Jarmo




Re: [O] Latex single dollar math delimiter question

2019-08-05 Thread Jarmo Hurri
"Fraga, Eric"  writes:

> On Sunday,  4 Aug 2019 at 08:31, Jarmo Hurri wrote:
>> Can someone explain why the single '$' characters below are not
>> recognized as math delimiters?
>>
>> a /complex number/ $z = a + ib,$ where
>
> What are you expecting?  What happens if you export the file to PDF?

Sorry, I assumed incorrectly that my question was self-explanatory. When
I export the file to PDF, the dollar characters are not regonized as
math delimiters.

Based on the manual I would have expected math delimiters. Referring
again to the manual: "single ‘$’ characters are only recognized as math
delimiters if the enclosed text contains at most two line breaks, is
directly attached to the ‘$’ characters with no whitespace in between,
and if the closing ‘$’ is followed by whitespace, punctuation or a
dash."

Since the equation in my example contains no line breaks, is directly
attached with no whitespace in between the equation and the dollar
signs, and the closing '$' is followed by whitespace, I would expect
math delimiter behaviour.

Removing all whitespace, that is, $z=a+ib,$ does not help.

> By the way, you might be interested in the following configuration
> snippet which makes org insert \(\) when you type a single $ (and a $
> if you type 2 of them in a row).

That is a nice little tool.

I have gotten used to writing '\(' and '\)' instead of '$' for a long
time. I was doing it for the millionth time and decided to take a look
at what the manual says. Hence this post.

Hope this clarifies my question.

Jarmo




[O] Latex single dollar math delimiter question

2019-08-03 Thread Jarmo Hurri


Greetings.

Org manual says that

To avoid conflicts with currency specifications, single ‘$’ characters
are only recognized as math delimiters if the enclosed text contains at
most two line breaks, is directly attached to the ‘$’ characters with no
whitespace in between, and if the closing ‘$’ is followed by whitespace,
punctuation or a dash.

Can someone explain why the single '$' characters below are not
recognized as math delimiters?

a /complex number/ $z = a + ib,$ where

Thanks in advance.

Jarmo




Re: [O] BUG in ob-scheme WAS: Re: Babel: verbatim results yield a table

2018-08-03 Thread Jarmo Hurri


Greetings again.

"Berry, Charles"  writes:

>> The org manual states that in the :results header argument of a block
>> 
>> verbatim Interpret literally and insert as quoted text. Do not create a
>> table. Usage example: :results value verbatim
>
> Unfortunately, `org-babel-scheme--table-or-string' does not honor
> :results verbatim. :-(

I wrote a patch for this before realizing that it had already been fixed
in the master branch (I was running the stable branch).

This should teach me a lesson again... :-)

Jarmo




Re: [O] Org src blocks and multiline macros

2018-08-03 Thread Jarmo Hurri
"Berry, Charles"  writes:

> ob-org does not provide for variables AFAICS. 

I have been trying to advocate for multiline macros for years, because
those are the _only_ thing I am really missing in org, again and
again. For example, right now I am writing teaching material where I
need to reuse certain parametrised org snippets across multiple files. I
_could_ use noweb. I _could_ use elisp code. But having a tool similar
to \newcommand in Latex would be so useful that every once in a while I
find myself bringing it up again.

The latest idea was to introduce variables into org blocks in hope it
would implement the desired functionality

> But using emacs-lisp with a :results drawer to render the output as
> org should help:
>
> #+header: :results drawer :exports results
> #+begin_src emacs-lisp :var val1="foo" :var val2="bar" 
>(concat "Currently this gives me ~" val1 val2 "~ indeed!")
> #+END_SRC
>
> #+RESULTS:
> :results:
> Currently this gives me ~foobar~ indeed!
> :end:

Ok, this will work too. But my real document string contains multiple
paragraphs, org lists etc. In terms of readability and maintainability,
embedding that text as an argument in an elisp call is not a very clean
solution.

> BTW, if you really do need a long or multiline MACRO, there is the
> possibility of using an `eval' style macro with a custom elisp
> function. e.g.
>
> #+MACRO: longish-macro (eval (my-really-long-macro-def $1 $2 $3))
>
> (info "(org) Macro Replacement")
>
> But this carries the burden of having to defun
> `my-really-long-macro-def' before exporting your document.

Yes, this too will work, with similar reservations as in the previous
case.

Thanks for all the tips!

Jarmo




Re: [O] BUG in ob-scheme WAS: Re: Babel: verbatim results yield a table

2018-08-03 Thread Jarmo Hurri
"Berry, Charles"  writes:

>> The org manual states that in the :results header argument of a block
>> 
>> verbatim Interpret literally and insert as quoted text. Do not create a
>> table. Usage example: :results value verbatim
>
> Unfortunately, `org-babel-scheme--table-or-string' does not honor
> :results verbatim. :-(

Thanks, I did not have the guts to call it a bug.

I'll see if I could provide a patch for this later.

Thanks.

Jarmo




Re: [O] Org src blocks and multiline macros

2018-08-02 Thread Jarmo Hurri


>> I am once again facing a situation where I would like to define a
>> multiline org macro.
>
>
> I'm not sure what that means, but based on your example a different
> solution might work for you.
>
> 2. If not, could we have this feature? This would give us immediate
>>multiline macros in the following style, where referring to the value
>>of the variable could be done macro-style.
>>
>> #+HEADER: :var val1=foo
>> #+BEGIN_SRC org :var val2=" bar"
>>   Currently this gives me nothing but {{{val1}}}{{{val2}}}.
>> ...
>>
>
> Org macros don't get evaluated inside src blocks as far as I know. But
> Noweb might help you. Look for this feature in Org manual. I use Noweb as
> "macros for src blocks".

Yep, that will give me something similar:

#+name: val1
#+BEGIN_SRC org :exports none
foo
#+END_SRC

#+name: val2
#+BEGIN_SRC org :exports none
bar
#+END_SRC

#+BEGIN_SRC org :noweb yes
  Currently this gives me ~<><>~ indeed!
#+END_SRC

Compared to multiline macros, though, having to (re)define bunch of src
blocks for variables does seem like an overkill.

BTW, does anyone know how I could enforce the standard
Org-interpretation of '~' in the resulting, exported Org.

Jarmo




[O] Babel: verbatim results yield a table

2018-08-02 Thread Jarmo Hurri


Greetings.

The org manual states that in the :results header argument of a block

verbatim Interpret literally and insert as quoted text. Do not create a
 table. Usage example: :results value verbatim

The quote above is from https://orgmode.org/manual/results.html

Given this description, I am trying to understand the result below from
a Scheme snippet (this is an exercise in the good old SICP). In
particular, why is the table created from the (nested) list?

Jarmo

   #+BEGIN_SRC scheme :exports both :results value verbatim
 (define (deep-reverse lst)
   (define (deep-iter lst result)
 (if (null? lst)
 result
 (let ((first (car lst)) (rest (cdr lst)))
   (deep-iter rest
  (cons (if
 (pair? first)
 (deep-reverse first)
 first)
result)
   (deep-iter lst '()))

 (deep-reverse (list (list 1 2 3 4) (list (list 5 6) 7 8)))
   #+END_SRC

   #+RESULTS:
   | 8 | 7 | (6 5) |   |
   | 4 | 3 | 2 | 1 |




[O] Org src blocks and multiline macros

2018-08-02 Thread Jarmo Hurri


Greetings.

I am once again facing a situation where I would like to define a
multiline org macro. If my memory is not failing me (it might well be),
this is not possible.

So this lead me to consider the use of Org source blocks in Babel. Which
might well be a discussion I have had here before, see the reference to
the state of my memory above.

1. Is it now possible to pass variables to these blocks?

2. If not, could we have this feature? This would give us immediate
   multiline macros in the following style, where referring to the value
   of the variable could be done macro-style.

#+HEADER: :var val1=foo
#+BEGIN_SRC org :var val2=" bar" 
  Currently this gives me nothing but {{{val1}}}{{{val2}}}.

  This property would really help me structure some org documents in a
  sensible way when common parts can be reused.
#+END_SRC

Jarmo




Re: [O] Latex preview foreground color problem

2018-08-01 Thread Jarmo Hurri
Eric S Fraga  writes:

> On Monday, 30 Jul 2018 at 12:43, Jarmo Hurri wrote:
>> In my emacs config file I now have:
>>
>> (plist-put org-format-latex-options :foreground "white")
>> (plist-put org-format-latex-options :scale 2)
>
> This works for me but in the context that I also change the background
> to black (which does not necessarily match my Emacs background...).  Try
> that just to see?  It may be a LaTeX issue.

This seems to be a compatibility issue with the forest package in
Latex. The problem is demonstrated and explained in the org file
below. I don't know yet what the solution is.

Jarmo

# -

#+LATEX_HEADER: \usepackage{forest}

* \LaTeX{} fragments: package ~forest~ confuses foreground color setting 
  Interestingly enough, the foreground color set by
  #+BEGIN_SRC elisp
  (plist-put org-format-latex-options :foreground "White")
  #+END_SRC
  does /not/ change the foreground color in this simple invariant
  equation \[ ab^n = ab\cdot b^{n-1} \] if ~usepackage{forest}~ is
  included in \LaTeX{} header. When package ~forest~ is not used,
  setting the color works just fine.

  To make things a bit more complicated, after commenting or
  uncommenting the ~LATEX_HEADER~ line, you need to remove the
  contents of directory ~ltximg~ in the working directory to see the
  difference, because the system caches the generated images of the
  equations there.




[O] Latex preview foreground color problem

2018-07-30 Thread Jarmo Hurri


Greetings.

Previewing Latex fragments is one cool feature. However, I have one
problem tailoring it to my use.

In my emacs config file I now have:

(plist-put org-format-latex-options :foreground "white")
(plist-put org-format-latex-options :scale 2)

These seem to set the correct properties, because my value of
org-format-latex-options is

(:foreground "white" :background default :scale 2 :html-foreground "Black" 
:html-background "Transparent" :html-scale 1.0 :matchers
 ("begin" "$1" "$" "$$" "\\(" "\\["))

The scale factor property works just fine: I get a larger
preview. Unfortunately changing foreground has no effect. The default
black foreground - which I still get - is pretty useless for me, because
my default background in buffers is dark blue.

Any tips?

Jarmo




[O] Documentation: Babel scheme support and geiser

2018-07-25 Thread Jarmo Hurri


Greetings.

I started doing some Schemeing in org, and bumped into a couple of
documentation issues I wanted to check / report.

In short, I wonder whether
1. geiser should be listed as a scheme requirement in worg
2. ob-scheme.el should point to MELPA instead of ELPA for geiser.

The long version


First, worg lists no requirements for use of scheme

https://orgmode.org/worg/org-contrib/babel/languages.html

but typing C-c C-c in a scheme block gives error

org-babel-execute-src-block: Symbol’s value as variable is void:
geiser-default-implementation

Second, file ob-scheme.el tells me that

;; - for session based evaluation geiser is required, which is available from
;;   ELPA.

However, neither the ELPA page

https://elpa.gnu.org/packages/

nor "M-x list-packages" list geiser as an available package.

It does seem, however, that geiser _is_ available from MELPA

http://stable.melpa.org/#/geiser

(or git directly).

All the best,

Jarmo




Re: [O] Sectioning from includes gets confused in export

2018-04-15 Thread Jarmo Hurri

>> If you export the main file to LaTeX (C-c C-e l o) you will notice
>> that the correct sectioning level of the level 2 section of step.org
>> is lost in the export. The level 2 section becomes subordinate to
>> level 3 section.
>>
>> Feature or bug?
>
> Feature. See (info "(org) Include files"), in particular :minlevel
> parameter.

Thanks, that was a super quick response!

All the best,

Jarmo




[O] Sectioning from includes gets confused in export

2018-04-15 Thread Jarmo Hurri

Greetings.

Attached are two files:
1. steps.org : main org file
2. step.org : file included twice into main org file

If you export the main file to LaTeX (C-c C-e l o) you will notice that
the correct sectioning level of the level 2 section of step.org is lost
in the export. The level 2 section becomes subordinate to level 3
section.

Feature or bug? Possibility of this being fixed?

As usual, this is a simplified version of something much more
complicated I need to do.

All the best,

Jarmo


* A process
#+include: step.org
*** something more
#+include: step.org
** Step {{{n}}}
*** Short description
   1. a small list
   2. with two items


Re: [O] Exporting Latex fragment both rendered and verbatim

2018-03-07 Thread Jarmo Hurri

Eric S Fraga  writes:

> Very strange.  Attached are the org file I used to try this out and the
> result of exporting to LaTeX.

Got it: I did not have latex in my org-babel-do-load-languages.

Thanks!

Jarmo




Re: [O] Exporting Latex fragment both rendered and verbatim

2018-03-07 Thread Jarmo Hurri
Eric S Fraga <esfli...@gmail.com> writes:

> On Wednesday,  7 Mar 2018 at 18:53, Jarmo Hurri wrote:
>> Tried this before: for some weird (?) reason I am getting the verbatim
>> output only. And ":exports results" produces blank.
>
> Very strange.  Attached are the org file I used to try this out and the
> result of exporting to LaTeX.

And when I export your a.org to LaTeX, I get the attached tex with a
verbatim environment only:



a.tex.mine
Description: my tex export

Even the document classes are different. Now I am running org 9.1.7, by
the way, just did a git pull and all.

So this is a setup issue of some kind. Where should I begin... Our emacs
versions differ quite a bit (yours 27, mine 25). But that is not likely
to be the issue.

Ideas?

Jarmo


Re: [O] Exporting Latex fragment both rendered and verbatim

2018-03-07 Thread Jarmo Hurri

>> It is easy to export it verbatim as follows:
>>
>>   #+name: fragment
>>   #+BEGIN_SRC latex
>>
>> Here is an interesting (and true) equation: 
>> \begin{equation} 
>> \int uv' = uv - \int u'v \label{int}. 
>> \end{equation}
>> And that happens to be equation \eqref{int} on page \pageref{int}.
>>   #+END_SRC
>>
>> But what is the correct combination of environments (src, export) and
>
> Use this src block but add ":exports both" to the begin_src line.

Tried this before: for some weird (?) reason I am getting the verbatim
output only. And ":exports results" produces blank.

This is a beamer export with org version 9.1.6.

Hmm...

Jarmo




[O] Exporting Latex fragment both rendered and verbatim

2018-03-07 Thread Jarmo Hurri

Greetings all.

I have been using Org for years, but just bumped into a very simple
thing I don't know how to achieve.

Let's say I have a Latex fragment, and to illustrate the use of Latex, I
want to
1. write that fragment in an Org file
2. export the file so that the fragment is exported both verbatim and
   rendered (by pdflatex or similar).

It is easy to export the fragment rendered as follows:

  #+BEGIN_EXPORT latex
Here is an interesting (and true) equation: 
\begin{equation} 
\int uv' = uv - \int u'v \label{int}. 
\end{equation}
And that happens to be equation \eqref{int} on page \pageref{int}.
  #+END_EXPORT

It is easy to export it verbatim as follows:

  #+name: fragment
  #+BEGIN_SRC latex
Here is an interesting (and true) equation: 
\begin{equation} 
\int uv' = uv - \int u'v \label{int}. 
\end{equation}
And that happens to be equation \eqref{int} on page \pageref{int}.
  #+END_SRC

But what is the correct combination of environments (src, export) and
header arguments (noweb, exports, results, ...) which allows me to only
write the fragment once and produce both effects? I have tried quite a
few.

Jarmo




Re: [O] Numbering only second-level headlines in export

2018-02-28 Thread Jarmo Hurri

>> What - if any - would be the recommended way to implement numbering only
>> second-level headlines in an exported document with running numbering
>> (resets with first-level headline change)?
>
> You haven't said what export target you are using.  In any case, I would
> suggest you look at using a counter.  See section 12.5 of the org manual
> but specifically:
>
> ‘{{{n}}}’
> ‘{{{n(NAME)}}}’
> ‘{{{n(NAME,ACTION)}}}’
>  This macro implements custom counters by returning the number of
>  times the macro has been expanded so far while exporting the
>  buffer.  You can create more than one counter using different NAME
>  values.  If ACTION is ‘-’, previous value of the counter is held,
>  i.e.  the specified counter is not incremented.  If the value is a
>  number, the specified counter is set to that value.  If it is any
>  other non-empty string, the specified counter is reset to 1.  You
>  may leave NAME empty to reset the default counter.
>
> I would turn off numbering of headings (num:nil option) and then have
> the counter in each second level heading.

Brilliant, that worked like a charm on first trial. Thanks!

(BTW, my export target is html.)

Jarmo




[O] Numbering only second-level headlines in export

2018-02-28 Thread Jarmo Hurri

Greetings.

What - if any - would be the recommended way to implement numbering only
second-level headlines in an exported document with running numbering
(resets with first-level headline change)?

BTW, here is a full programming course (used to teach kids of different
ages) written almost entirely with org:

https://www.syk.fi/ohjelmointi/

The generation of the front page utilizes a couple of shell scripts,
some javascript and R, but it's all org otherwises. The entire source
code can be found here:

https://github.com/jarmohurri/ohjelmointi

All the best,

Jarmo




[O] Babel: filtering code to produce another block

2017-09-13 Thread Jarmo Hurri

Greetings.

This question can again be described shortly and in more detail.

1. Short form: what would be a convenient way to filter the source
   code in a Babel source code block so that the output would be the
   source code in another block?

2. Then the long form. I need to emulate the very basics of one
   programming language, namely Processing

   https://processing.org/

   with another, namely Asymptote

   http://asymptote.sourceforge.net/

   This is to be done within Org. I need to do this to illustrate on
   paper the visual output of simple, static (no animation) Processing
   programs.

   Making this work roughly isn't too difficult, because these two
   languages have very similar syntaxes. For example, provided that a
   function rect() has been implemented in Asymptote, the following
   code is legit in both Processing and Asymptote:

   #+name: pic
   #+BEGIN_SRC asymptote
 size (800, 600);
 for (int i = 0; i < 10; i += 2)
   rect (i * 10, i * 20, 30, 10);
   #+END_SRC

   After this block has been defined I can show it as "Processing
   code" and draw a picture with Asymptote, using noweb if need be. It
   is also easy to use transforms so that the coordinate systems of
   the two languages match. Furthermore, typedef can be used to align
   some variable type differences.

   However, my current issue is dealing with 'final' in Asymptote. The
   following is not legit Asymptote code:
   #+BEGIN_SRC asymptote
 size (800, 600);
 final int S = 20;
 rect (100, 100, S, S);
   #+END_SRC
   
   It would be legit if the word 'final' were simply removed. Which
   brings me to the question: what would be an easy way to filter this
   block to produce another block? The header arguments of the two
   blocks would be different from each other.

Thanks in advance,

Jarmo




Re: [O] [RFC] Remove Org Struct mode

2017-08-20 Thread Jarmo Hurri
Eric S Fraga  writes:

> I have no issues with org-struct-mode being removed.  I used to use
> it, especially for emails.  I now simply change the mode to org, write
> whatever content I want, and then switch back to message mode to send
> my email.  Works fine and gives me the full power of org.

This is a neat idea. After hearing this, I also have no issue with
org-struct-mode being phased out.

Jarmo




Re: [O] make compile fails

2017-08-20 Thread Jarmo Hurri

Adrian Bradd  writes:

> Looks like htmlize was removed from contrib a few days ago
> (commit d0ced9894) which is probably the cause of your issue. You can get
> it from https://github.com/hniksic/emacs-htmlize
>
> You can generate a new local.mk by running 'make local.mk'. You may have to
> remove or rename the existing local.mk for this to work.

Yeah, did these already (when I posted that the problem had been
solved).

All the best,

Jarmo




Re: [O] make compile fails

2017-08-19 Thread Jarmo Hurri
Colin Baxter  writes:

> > 
> > jarmo@localhost org-mode]$ diff local.mk local.mk~ 31c31 <
> > ORG_ADD_CONTRIB = htmlize ---
> >> #ORG_ADD_CONTRIB = ox-* # e.g. the contributed exporter
> > 
>
> > Maybe the issue is somehow related to this? Anyway, I was still
> > able to compile on August 11th, so something has changed since
> > then.
>
> I don't know of any issues surrounding local.mk. All I can suggest is
> that you try a 'make distclean' first. Failing that, why not just
> delete (or rename) your org-mode git directory and git clone a fresh
> source? That way, you'd be certain you don't have any old "corrupting"
> files in your git tree.

Running 'make cleanall' didn't help.

However, a fresh clone followed by a reconfiguration of local.mk solved
the issue. Most likely the result of a local.mk that is no longer
consistent.

Up and running again. Thanks!

Jarmo




Re: [O] make compile fails

2017-08-19 Thread Jarmo Hurri

Hi Colin.

Colin Baxter  writes:

> Works for me using 'make clean' followed by 'make all'.

For some reason I still get the same error even with that sequence of
commands.

Make reports that the error is coming from addcontrib. Isn't there some
file that controls local contrib config? Was it local.mk? It's been
years, but I remember having to make a change in that file. If I run a
diff against what was probably the original, I get the following:


jarmo@localhost org-mode]$ diff local.mk local.mk~
31c31
< ORG_ADD_CONTRIB = htmlize
---
> #ORG_ADD_CONTRIB = ox-* # e.g. the contributed exporter


Maybe the issue is somehow related to this? Anyway, I was still able to
compile on August 11th, so something has changed since then.

Jarmo




[O] make compile fails

2017-08-18 Thread Jarmo Hurri

Greetings.

Just pulled the latest version and tried to compile it. I get the
following error:

--
[jarmo@localhost org-mode]$ make compile
make -C doc clean;  make -C lisp clean;
make[1]: Entering directory '/home/jarmo/src/org-mode/doc'
rm -f org *.pdf *.html *_letter.tex org-version.inc org-version.tex \
  *.aux *.cp *.cps *.dvi *.fn *.fns *.ky *.kys *.pg *.pgs \
  *.toc *.tp *.tps *.vr *.vrs *.log *.html *.ps
make[1]: Leaving directory '/home/jarmo/src/org-mode/doc'
make[1]: Entering directory '/home/jarmo/src/org-mode/lisp'
rm -f org-version.el org-loaddefs.el org-version.elc org-loaddefs.elc 
org-install.elc
rm -f *.elc
make[1]: Leaving directory '/home/jarmo/src/org-mode/lisp'
make -C lisp compile
make[1]: Entering directory '/home/jarmo/src/org-mode/lisp'
rm -f org-version.el org-loaddefs.el org-version.elc org-loaddefs.elc 
org-install.elc
install -m 644 -p  .
install: missing destination file operand after '.'
Try 'install --help' for more information.
make[1]: *** [Makefile:64: addcontrib] Error 1
make[1]: Leaving directory '/home/jarmo/src/org-mode/lisp'
make: *** [mk/targets.mk:95: compile] Error 2
--

System specs:
--
[jarmo@localhost org-mode]$ uname -a
Linux localhost.localdomain 4.12.5-300.fc26.x86_64 #1 SMP Mon Aug 7 15:27:25 
UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
[jarmo@localhost org-mode]$ dnf list installed emacs
Installed Packages
emacs.x86_64   1:25.2-3.fc26@updates
--

Any ideas?

Jarmo




Re: [O] html export: pre.src support changed?

2017-08-17 Thread Jarmo Hurri

Greetings again.

Due to the flurry of responses to this thread (like, zero), I will make
a suggestion:

Could we reinstate pre.src by including the src class into pre tags as
well? That is, whereas we now have in the new export


Re: [O] html export: pre.src support changed?

2017-08-16 Thread Jarmo Hurri

> 2. "pre code" works incorrectly (from my point of view)
> ---
>
> I can get my CSS file to do _something_ with the following change:
>
> pre code
> {
> margin: 0 auto;
> font-size: 0.9vw;
> width: 75em;
> color: white;
> background-color: #102e4e;
> border-radius: 10px;
> }
>
> However, the problem is that this changes only the background of the
> code text, not the entire "window".

Did some further studies. It turns out that in this particular case I
can get the blocks to color correctly by coloring just pre:

pre
{
margin: 0 auto;
font-size: 0.9vw;
width: 75em;
color: white;
background-color: #102e4e;
border-radius: 10px;
}

But I can't be expected to color all preformatted text similarly. Right?
There has to be a way to format the code windows only.

(Unfortunately there is no parent selector in CSS. Otherwise I could
select the pre that have a code descendant.)

Jarmo




[O] html export: pre.src support changed?

2017-08-16 Thread Jarmo Hurri

Greetings.

The following explanation is a bit long, so here is a summary:

1. "pre.src" formatting no longer seems to work in html export
2. "pre code" works, but incorrectly from my point of view.

I am looking for a fix.

Here is the longer explanation

1. pre.src does not work


I used to have a working CSS file for some programming teaching material
exported from Org. Something has changed, because earlier formatting
used pre.src in the following style:

pre.src
{
margin: 0 auto;
font-size: 0.9vw;
width: 75em;
color: white;
background-color: #102e4e;
border-radius: 10px;
}

In particular, background-color controlled the background of the entire
source block "window" in the exported html.

According to the manual, pre.src still controls formatting for source
code blocks:

http://orgmode.org/manual/CSS-support.html

However, when I export the same files right now, pre.src no longer
works. The change in the exported html files is obvious:

old export (pre.src worked)
 ...

new export (pre.src no longer works)
 ...

2. "pre code" works incorrectly (from my point of view)
---

I can get my CSS file to do _something_ with the following change:

pre code
{
margin: 0 auto;
font-size: 0.9vw;
width: 75em;
color: white;
background-color: #102e4e;
border-radius: 10px;
}

However, the problem is that this changes only the background of the
code text, not the entire "window". The effect can be seen here:

old export (code blocks colored correctly):
https://www.syk.fi/ohjelmointi/muuttuja.html

new export (code blocks colored incorrectly);
https://www.syk.fi/ohjelmointi-paivitys/muuttuja.html

How do I fix this? Thanks!

Jarmo




[O] Org table: reuse formula in non-rectangular range

2017-08-13 Thread Jarmo Hurri

Greetings.

I have a situation where I need to use the same table formula all over
the place in a table. The problem is that "all over the place" is not
rectangular - if it were, this would be trivial.

I can see two possible solutions, but I don't know if either of them is
possible in Org.

1. A non-rectangular range on the left hand side of a formula. This
   would be the best choice if it were available.

2. The possibility to create a shorthand (macro) for the formula so that
   it would be easier to reuse the formula in a large number of
   rectangular ranges.

Is either of these feasible?

Jarmo




Re: [O] Bug: Beamer export error

2017-08-13 Thread Jarmo Hurri
Rasmus  writes:

> It should be fixed by commit 323fc95b4.

Thank you very much, seems to be in order again.

Jarmo




Re: [O] Bug: Beamer export error

2017-08-09 Thread Jarmo Hurri

While the bug is being fixed, here is a quick band-aid for anyone else
struggling with this problem.

1. When the export hangs up, press C-g to interrupt.
2. Run the following on the intermediate tex file, here exported.tex :
   sed -i 's/\[,/\[/g' exported.tex
3. Run pdflatex by hand:
   pdflatex exported.tex

Jarmo





[O] Bug: Beamer export error

2017-08-09 Thread Jarmo Hurri

Greetings.

I get an error (pdflatex hangs up) when trying to Beamer export the
following simple Org file (key command C-c C-e l O).

# -
#+STARTUP: beamer

* This is a simple test
  - let us see what happens
# -

I have traced the issue to the extra comma in the following line in the
exported TeX file:

\begin{frame}[,label={sec:org03f80c8}]{This is a simple test}

If you remove the extra comma, then the file compiles just fine.

Thanks in advance!

Jarmo




Re: [O] Scala problem in Babel

2017-04-03 Thread Jarmo Hurri

Jarmo Hurri <jarmo.hu...@iki.fi> writes:

> When I look at the temporary file I see that the code has been
> embedded in a wrapper defined in ob-scala.el. I guess it's the wrapper
> that messes up the execution of the code.

> What is the wrapper for? How am I supposed to use it?

Ok, got it by taking a closer look at ob-scala.el. In Babel scala code
isn't compiled and executed, it is run in interactive mode (shell). The
following works as expected (just as an example; you can also do this
without the Fibonacci class).

  #+BEGIN_SRC scala :exports both :results output
object Fibonacci
{
  def fib (n : Int) : Int =
  {
if (n == 1 || n == 2)
  n - 1
else
  fib (n - 1) + fib (n - 2)
  }
}
println (Fibonacci.fib (7))
  #+END_SRC

  #+RESULTS:
  : 8

Jarmo




[O] Scala problem in Babel

2017-04-02 Thread Jarmo Hurri

Greetings.

I am illustrating some basic syntactic differences between programming
languages to some people. In order to do this I embedded a small Scala
program into an Org file

  #+BEGIN_SRC scala :exports both
object Fibonacci extends App
{
  def fib (n : Int) : Int =
  {
if (n == 1 || n == 2)
  n - 1
else
  fib (n - 1) + fib (n - 2)
  }

  println (fib (7))
}
  #+END_SRC

This isn't in any way a correctly efficient way to (recursively)
calculate numbers from the sequence, but this is only about syntactics
for beginners, so I need to keep it very simple.

Anyway, when I compile and run this code in Scala it works just fine:

--
[jarmo@localhost tmp]$ scalac test.scala
[jarmo@localhost tmp]$ scala Fibonacci
8
--

But C-c C-c in Org mode gives me a warning and no result:

  #+RESULTS:
  : /tmp/babel-6890GcO/scala-6890K2a:6: warning: Fibonacci$2 has a main method 
with parameter type Array[String], but Main.$anon$2.$anonfun$1.Fibonacci$2 will 
not be a runnable program.
  :   Reason: companion contains its own main method, which means no static 
forwarder can be generated.
  : 
  : object Fibonacci extends App
  :^
  : one warning found
  : ()

When I look at the temporary file I see that the code has been embedded
in a wrapper defined in ob-scala.el. I guess it's the wrapper that
messes up the execution of the code.

What is the wrapper for? How am I supposed to use it?

Jarmo




Re: [O] Reproducing a table

2017-03-14 Thread Jarmo Hurri
Christian Moe  writes:

Greetings.

> You can simplify it even further to
>
> #+begin_src elisp :var data=my-table :hlines yes
>   data  
> #+end_src
>
> which is sane enough for me.
>
> To get simpler than that, I think you need #+INCLUDE and a separate
> file.

I think that would be the best approach.

> I can't tell from the example why you need to define it in one place
> and reproduce it in another, though, instead of just giving it a name
> right where you want it to appear.

The table contains a bivariate probability distribution, which I need to
reproduce at multiple locations in a document, and from which I need to
calculate a few things (which is why I need to pass the data part to
functions).

This is part of a process of fixing an old Org file which no longer
exports into LaTeX PDF. In some earlier version of Org the following
used to work:

  #+name: my-table
  | row 1 | 1 | 2 |
  | row 2 | 3 | 4 |
  |---+---+---|
  |   | col 1 | col 2 |

  #+call: my-table() :hlines yes

That is, in the past the table name used to sort of define a function
which could then be called to reproduce the table. But this produced
errors in the current version, so I started to figure out ways to
achieve the same end result.

Thanks!

Jarmo




[O] Reproducing a table

2017-03-13 Thread Jarmo Hurri

Greetings (again).

What is the smartest way to reproduce a table without defining the table
as an Org source block (constraint explained below).

I can do the following, but it doesn't seem very sane (need to use elisp
or some other language just to funnel the table).

# -
* define table
  #+name: my-table
  | row 1 | 1 | 2 |
  | row 2 | 3 | 4 |
  |---+---+---|
  |   | col 1 | col 2 |
* reproduce entire table
  I need to be able to reproduce the entire table in my document
  #+BEGIN_SRC elisp :var data=my-table :hlines yes
  (print data)
  #+END_SRC

  #+RESULTS:
  | row 1 | 1 | 2 |
  | row 2 | 3 | 4 |
  |---+---+---|
  |   | col 1 | col 2 |
* reproduce only data
  I also need to be able to pass only the data to functions
  #+BEGIN_SRC elisp :var data=my-table[0:1,1:2]
  (print data)
  #+END_SRC

  #+RESULTS:
  | 1 | 2 |
  | 3 | 4 |
# -

The reason I can _not_ define the table as an Org source block is the
second example. I need to pass parts of the table as data to functions,
and constructs like my-table()[0:1,1:2] don't work. (At least I have not
been able to get them to work.)

Jarmo




Re: [O] Default silent results

2017-03-13 Thread Jarmo Hurri
Jérémie Juste  writes:

Greetings.

> you can tweek the default behaviour using
> org-babel-default-header-args:org variable
>
> My default configuration for org is the following. I did not modify
> it.
>
> org-babel-default-header-args:org is a variable defined in ‘ob-org.el’.
> Its value is ((:results . "raw silent") (:exports . "code"))

So the default value is really language dependent, not always "replace"
as the manual suggested. Ok, that explains it. Thanks!

Jarmo




[O] Default silent results

2017-03-13 Thread Jarmo Hurri

Greetings.

An old org-code of mine stopped working, and while trying to fix it I
bumped into the following. What am I missing here?

Jarmo

* test
  A simple code block.
  #+name: org-block
  #+BEGIN_SRC org
  | foo | bar |
  |-+-|
  |   1 |   2 |
  #+END_SRC

  A silent call produces no results as expected.
  #+call: org-block() :results silent

  This produces results as expected.
  #+call: org-block() :results replace

  #+RESULTS:
  | foo | bar |
  |-+-|
  |   1 |   2 |

  But this also behaves like silent, while the manual says that the
  default is "replace."
  #+call: org-block()




Re: [O] BUG: agenda for current days excludes reoccurring events

2017-01-28 Thread Jarmo Hurri
Nicolas Goaziou <m...@nicolasgoaziou.fr> writes:

> Jarmo Hurri <jarmo.hu...@iki.fi> writes:
>
>> In particular the fact that you see it for all other days except today
>> makes absolutely no sense, right?
>
> It does make sense, but probably not when there is no TODO keyword.
> Also, your sentence is inaccurate: you see it _once_ in the past, not
> every others day.

That is correct, only once in the past, my bad. (Which explains some of
the weirdness in my own, more complicated setup.) Still not sure why it
would be appropriate for a TODO _as a default_ (not to show it for
today, but for future days), but like I said: we're operating above my
pay grade. Just _trying_ to provide some answers to your questions, not
sure if this is helping.

>>> I think that a nil `org-agenda-prefer-last-repeat' should display :
>>> - only the base date when the entry has a TODO keyword; - every
>>> repeat between base date and today, inclusive, otherwise.
>>>
>>> It also applies to SCHEDULED and DEADLINE repeaters.
>>>
>>> Behaviour with a non-nil value needs not be changed.
>>>
>>> WDYT?
>>
>> This is slightly beyond my pay grade, but I hope a nil
>> 'org-agenda-prefer-last-repeat' would also display all repeats for
>> _future_ days.
>
> This is orthogonal to the issue. There's a dedicated variable for
> that: `org-agenda-show-future-repeats'.

If I am on the right track here, org-agenda-show-future-repeats controls
future repetitions, and org-agenda-prefer-last-repeat controls
repetitions for today? Is that correct? (Feel completely free to ignore
this if I am on the wrong track.) I am not sure how this would work for
timed events, since "today" and "future" are not mutually exclusive:
part of today is still in the future.

> If no one objects, I'll just implement the behaviour quoted above.

Sounds like the best option to me. I can try give better informed
comments after I see what the effect will be in my setup.

Jarmo




Re: [O] What would you like to see in the next MobileOrg iOS?

2017-01-28 Thread Jarmo Hurri

Hello!

> We've started plans on the future version of MobileOrg, dubbed just v2
> currently.

I was very happy to see that you are considering the possibility to sync
MobileOrg and (regular) Org via git. If you can do that, then I will be
more than happy to jump on board - have wanted to for quite some time.

In general for me syncing the two systems needs to be as transparent as
possible. The use of a true version control upstream repo as a
synchronization point would convince me that I could _always_ fix a mess
in case there would be one.

Then just add builtin features in both base Org and MobileOrg to

1. push and pull over ssl presto

2. (automatically) sense whether the downstream or upstream repo is
   newer, and do / suggest push / pull actions accordingly.

That would be so great.

Hope my terminology made some sense.

I am sure a lot more requests and features will come in mind after
starting to use your new, brilliant version.

Jarmo




Re: [O] BUG: agenda for current days excludes reoccurring events

2017-01-28 Thread Jarmo Hurri

Greetings again.

Nicolas Goaziou <m...@nicolasgoaziou.fr> writes:

> Jarmo Hurri <jarmo.hu...@iki.fi> writes:
>
>> - how the bug shows up: the reoccurring meeting will show up yesterday
>>   and in upcoming days, but not in the current day
>
> This is the consequence of `org-agenda-prefer-last-repeat' default
> value.
>
> However, this behaviour doesn't make much sense when the entry is not
> a task (i.e., it hasn't any TODO keyword). In this case,
> `org-auto-repeat-maybe' doesn't apply, and the base date is never moved
> forward in time.

In particular the fact that you see it for all other days except today
makes absolutely no sense, right?

> I think that a nil `org-agenda-prefer-last-repeat' should display :
> - only the base date when the entry has a TODO keyword;
> - every repeat between base date and today, inclusive, otherwise.
>
> It also applies to SCHEDULED and DEADLINE repeaters.
>
> Behaviour with a non-nil value needs not be changed.
>
> WDYT?

This is slightly beyond my pay grade, but I hope a nil
'org-agenda-prefer-last-repeat' would also display all repeats for
_future_ days.

I assume quite a few people use reoccurring entries to mark regular
meetings, short tasks etc. It is imperative that they also see how the
meeting affect the schedules of future days in their agenda.

My personal opinion is that _any entry with a timestamp_ should be
repeated as far into the future as possible, regardless of whether it is
a TODO or some other type. A timestamp indicates that this entry very
likely needs to be taken into account when scheduling future
events. Thus seeing the repetition in the agenda in the future may be
crucial.

Does this make sense?

Jarmo




[O] BUG: agenda for current days excludes reoccurring events

2017-01-28 Thread Jarmo Hurri

Greetings.

- bug: day agenda for current day does not show reoccurring events

- how to replicate with the ECM provided
  1. untar the file provided below
  2. cd into created dir
  3. edit the first line of file agenda-setup.el so that the latest org
 release lisp is in the load path
  4. run
 emacs -q --load agenda-setup.el
  5. run command (org-agenda)
  6. press 'a' for day agenda
  7. press 'b' and/or 'f' to move backwards and forward in time

- how the bug shows up: the reoccurring meeting will show up yesterday
  and in upcoming days, but not in the current day

Jarmo



agenda-bug-minimal.tar
Description: ECM files


  1   2   3   >