Re: Org 9.6-pre and Bash sessions

2022-10-21 Thread Ihor Radchenko
Rudolf Adamkovič  writes:

> Ihor Radchenko  writes:
>
>> See the attached tentative patch.
>> I'd appreciate some testing. Hopefully, I did not break anything.
>
> I did some testing and found no issues.
>
> Great work!
>
> Below, I include some suggestions regarding the patch.

Thanks!
Applied onto main incorporating your suggestions.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=801c93638ab4b6616567035c6438ad229bc14c1d

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



[BUG] ox-odt file: links are not pointing to the real files (was: [BUG] ox-odt fails for org-id links (e.g., from org-roam v2) [9.5.2 (9.5.2-gfbff08 @ /home/moritz/.emacs.d/elpa/27.2/develop/org-9.5.2

2022-10-21 Thread Ihor Radchenko
Max Nikulin  writes:

> I am sorry. I confused this thread with some other bug report. I agree 
> that the original post describes namely file links. When Moritz provided 
> an example in response to your request for more details I decided that 
> more similar problems are coming. Perhaps particular use case does not 
> include links to specific headings in files and I was wrong. On the 
> other hand if ox-odt code works with id links better than ox-html then 
> the former may be a source of inspiration how to fix the latter.

I am not sure which bug you are referring to.

>> Here, we at least fix the export error. So that people can at least get
>> some exported .odt file.
>
> I have tried main HEAD (your fix should be applied) and I did not get an 
> error, but the result is quite strange. Consider a single file with an 
> internal link:
>
> :PROPERTIES:
> :ID:   3c885843-13ad-4dd8-a57f-de8271403b85
> :END:
> #+TITLE: Note A
>
> * H 1
> Some text
>
> * H 2
> [[id:3c885843-13ad-4dd8-a57f-de8271403b85][Link to Note A]]
>
> Link in the exported document:
>
> Link to Note 
> A
>
> I would expect a target withing the same .odt file.
>
> Properties as displayed in LibreOffice UI are even more peculiar:
> Document path
> file:///tmp/d/test-odt.odt/test-odt.org
> Target in document is empty.
>
> My expectation for path is file:///tmp/d/test-odt.odt or at least 
> file:///tmp/d/test-odt.org, but certainly not their combination. I am 
> unsure if you consider this observation as relevant to this thread.

I improved the code a bit, directly reusing file: link transcoder:
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=2f5e7103e59f06631e985d3dd39af21b5b7464ea

However, it does not change your observed behaviour.

I also tried the following Org file, and it looks like something is wrong
about file: link export in ox-odt. Even file: links have the erroneous
document path.

Probably, href=file.org is treated as a link to resource packed inside
.odt file.
I tried to look through
https://www.w3.org/TR/2001/REC-xlink-20010627/#link-locators, but I
cannot see any obvious correct way to link to external files from odt.
May someone more familiar with ODT schema take a look?


:PROPERTIES:
:ID:   3c885843-13ad-4dd8-a57f-de8271403b85
:END:
#+TITLE: Note A

* H 1
Some text

* H 2
[[id:3c885843-13ad-4dd8-a57f-de8271403b85][Link to Note A]]
[[file:test.org]]


-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: [PATCH] Re: Bug: Incorrect indentation in Org Babel list output with multiline text [9.4.4 (release_9.4.4 @ /Applications/Emacs.app/Contents/Resources/lisp/org/)]

2022-10-21 Thread Ihor Radchenko
Rudolf Adamkovič  writes:

> I wrote a regression test, so that we do not need to fix this problem
> again next time.  Please see the attached patch.

Thanks!
Applied onto main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=524e0e0b7b5eb4c02f3da5eaf59eb1df82d1c1cc

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: [PATCH 2-v4] New: auto display inline images under subtree when `org-cycle'.

2022-10-21 Thread Christopher M. Miles

Whether can this patch be merged at first, put the test in future to
finish? In recent days, I still have not figured out this image overlays
test.

"Christopher M. Miles"  writes:

> [[PGP Signed Part:Undecided]]
>
> Ihor Radchenko  writes:
>
>> "Christopher M. Miles"  writes:
>>
 I think that the best we can do in this situation is mocking
 `create-image' in batch mode to return non-nil using `cl-letf'.
>>>
>>> I checked the `create-image' in image.el source code, don't know how to
>>> mocking this. I have no experience and idea about this. I also searched
>>> org testing. Have not found similar situations.
>>>
>>> If you have idea how to write this test, I suggest pass this word to
>>> you. What do you think?
>>
>> I imagine something like
>>
>> ;; Mock `create-image' to work noninteractively.
>> (cl-letf (((symbol-function 'create-image)
>> (lambda ( _)
>>   `(image :type "dummy" :data "dummy"
>>   )
>
> After wrapped your cl-letf redefining function binding. Still failed on test.
>
> Here is the new test code:
>
> #+begin_src emacs-lisp
> (ert-deftest test-org-fold/org-fold-display-inline-images ()
>   "Test inline images displaying when cycling."
>   ;; Mock `create-image' to work noninteractively.
>   (cl-letf (((symbol-function 'create-image)
>(lambda ( _) `(image :type "dummy" :data "dummy"
> (let* ((org-cycle-inline-images-display t)
>(images-dir (expand-file-name "examples/images/" org-test-dir))
>(org-logo-image (expand-file-name "Org mode logo mono-color.png" 
> images-dir)))
>   ;; `org-cycle' -(state)-> `'children' display child inline images.
>   (org-test-with-temp-text
>(format "* Heading 1
> [[file:%s]]
> " org-logo-image)
>(org-overview)
>;; (org-cycle)
>;; (org-cycle-internal-local)
>;; (org-cycle-display-inline-images 'children)
>(org-fold-show-children)
>(run-hook-with-args 'org-cycle-hook 'children)
>(org-next-link)
>(should org-inline-image-overlays)
>(should (overlays-at (point)))
>(org-toggle-inline-images)
>(should-not (overlays-at (point
>   
>   ;; `org-cycle' -(state)-> `'subtree' display subtrees inline images.
>   (org-test-with-temp-text
>(format "* Heading 1
> [[file:%s]]
> ** Subheading 1
> [[file:%s]]
> ** Subheading 2
> [[file:%s]]" org-logo-image org-logo-image org-logo-image)
>(org-overview)
>;; (org-cycle)
>;; (org-cycle)
>;; (org-cycle-internal-global)
>(org-fold-show-subtree)
>(run-hook-with-args 'org-cycle-hook 'subtree)
>(org-next-link)
>(org-next-link)
>;; (should org-inline-image-overlays)
>(should (overlays-at (point)))
>(org-toggle-inline-images)
>(should-not (overlays-at (point
>   
>   ;; `org-cycle' -(state)-> `'folded' remove inline image overlays.
>   (org-test-with-temp-text
>(format "* Heading 1
> [[file:%s]]
> ** Subheading 1
> [[file:%s]]
> ** Subheading 2
> [[file:%s]]" org-logo-image org-logo-image org-logo-image)
>(org-overview)
>(org-show-subtree)
>(org-fold-subtree t)
>(run-hook-with-args 'org-cycle-hook 'folded)
>(should (null org-inline-image-overlays))
>(should (null (overlays-in (point-min) (point-max
>(org-show-subtree)
>(should-not org-inline-image-overlays)
>(should-not (overlays-in (point-min) (point-max)))
> #+end_src
>
>
> And failed after command:
>
> #+begin_src shell
> make BTEST_RE="test-org-fold/org-fold-display-inline-images" test-dirty 
> #+end_src
>
>
> Here is the output:
>
> #+begin_example
> ~/Code/Emacs/org-mode:main*:1 λ make 
> BTEST_RE="test-org-fold/org-fold-display-inline-images" test-dirty  
> install -m 755 -d 
> /var/folders/ym/f3v5_yk1279g5ls70x3hzblhgn/T//tmp-orgtest
> TMPDIR=/var/folders/ym/f3v5_yk1279g5ls70x3hzblhgn/T//tmp-orgtest emacs  
> -Q -batch --eval '(setq vc-handled-backends nil org-startup-folded nil 
> org-element-cache-persistent nil)'  --eval '(add-to-list '"'"'load-path 
> (concat default-directory "lisp"))' --eval '(add-to-list '"'"'load-path 
> (concat default-directory "testing"))'  -l org-batch-test-init --eval '(setq 
> org-batch-test t org-babel-load-languages (quote ( (awk . t)  (C . t)  
> (fortran . t)  (maxima . t)  (lilypond . t)  (octave . t)  (perl . t)  
> (python . t)  (emacs-lisp . t)  (shell . t)  (org . t))) org-test-select-re 
> "test-org-fold/org-fold-display-inline-images" )' -l org-loaddefs.el -l cl -l 
> testing/org-test.el -l ert -l org -l ox -l ol  --eval 
> '(org-test-run-batch-tests org-test-select-re)'
> Package cl is deprecated
> Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/org.el' newer than 
> byte-compiled file; using older file
> Source file `/Users/stardiviner/Code/Emacs/org-mode/lisp/org-compat.el' newer 
> than byte-compiled file; using older file

Re: Do not show a TODO item in the global TODO list until certain date?

2022-10-21 Thread Angel de Vicente
Hello, 

Ihor Radchenko  writes:

> Try the following adjusted version:
>
> (defun org-agenda-skip-before-SHOWFROMDATE-property ()
>   "Skip agenda item if :SHOWFROMDATE: property is set and the day is before 
> it"
>   (when-let* ((showfromdate (if (bound-and-true-p org-ql--current-element)
> (org-element-property :SHOWFROMDATE 
> (org-element-lineage org-ql--current-element '(headline) t))
>   (org-entry-get (point) "SHOWFROMDATE")))
>   (showfromdate (unless (seq-empty-p showfromdate) (ts-parse-org 
> showfromdate)))
> (currenttime (ts-now)))
> (when (ts< currenttime showfromdate)
>   (or (outline-next-heading) (point-max)

Fantastic. It does work now beautifully.

[I was about to tell you that it was still not working, because I was
still trying with the following TODO item:

,
| ** TODO test   :personal:
| 
|:PROPERTIES:
|:SHOWFROMDATE: 2022-10-16
|:END:
`

and then I realized that the empty line before :PROPERTIES: was breaking
it. With no empty line it works fine (I should've used
org-command-set-SHOWFROMDATE-property from the beginning, which sets the
PROPERTIES in the right format).

,
| ** TODO test   :personal:
|:PROPERTIES:
|:SHOWFROMDATE: 2022-10-16
|:END:
`

Many thanks for your help. My TODO list is going to become a lot cleaner
from now!

Cheers,
-- 
Ángel de Vicente
 Research Software Engineer (Supercomputing and BigData)
 Tel.: +34 922-605-747
 Web.: http://research.iac.es/proyecto/polmag/
-
AVISO LEGAL: Este mensaje puede contener información confidencial y/o 
privilegiada. Si usted no es el destinatario final del mismo o lo ha recibido 
por error, por favor notifíquelo al remitente inmediatamente. Cualquier uso no 
autorizadas del contenido de este mensaje está estrictamente prohibida. Más 
información en: https://www.iac.es/es/responsabilidad-legal
DISCLAIMER: This message may contain confidential and / or privileged 
information. If you are not the final recipient or have received it in error, 
please notify the sender immediately. Any unauthorized use of the content of 
this message is strictly prohibited. More information:  
https://www.iac.es/en/disclaimer



Re: Line breaks and brackets in LaTeX export

2022-10-21 Thread Juan Manuel Macías
Max Nikulin writes:

> My impression is that tabularray has an ambitious goal to replace all
> current table packages. I have no idea if other packages will adopt
> similar approach with regexp-based parsing instead of usual expanding
> of TeX commands.

Yes, that's the impression I have too. Tabularray certainly solves a lot
of traditional LaTeX table problems (unfortunately not the one we're
dealing with). Time will tell if it also creates other new problems. In
any case, it brings a lot of flexibility to a part of LaTeX, tables,
that has always suffered from a certain constriction. We'll see what
happens. LaTeX is becoming very complex and now several layers coexist,
since the jump to LaTeX 3 is going to be gradual. On the other hand, I
don't know if the latex core developers have a cleaner \\ command in
their roadmap, without those absurd current problems (and that LaTeX has
been carrying for almost 40 years).

> I do not like necessity to add \NewTableCommand\empty{} to documents
> somehow (only if tabularray is loaded). I do not have an idea better
> than \\[0pt] and an optimizing filter to remove [0pt] in almost all
> cases.

I totally agree.

Best regards,

Juan Manuel 




[BUG] hyperbole action key on path name results in org-element-cache warning [9.6-pre (release_9.5.5-997-ge58bd0 @ /home/grfz/src/org-mode/lisp/)]

2022-10-21 Thread Gregor Zattler


Dear org-mode and hyperbole developers, hitting hyperbole's
action-key with point in "~/src/org-mode/contrilb/lisp" in a
*Pp Eval Output* buffer holding my complete load-path
resulted in this org-element--cache warning:

 ■  Warning (org-element-cache): org-element--cache: Org parser error in *Pp 
Eval Output*::5288. Resetting.
 The error was: (error "rx ‘**’ range error")
 Backtrace:
"  backtrace-to-string(nil)
  org-element-at-point()
  org-element-context()
  hsys-org-link-at-p()
  ibtypes::org-link-outside-org-mode()
  ibut:at-p()
  hbut:at-p()
  eval((hbut:at-p))
  hkey-execute(nil)
  action-key-internal()
  action-key()
  funcall-interactively(action-key)
  call-interactively(action-key nil nil)
  command-execute(action-key)
"
 Please report this to Org mode mailing list (M-x org-submit-bug-report).

I wanted to know if this directory exists (it doesn't) and
thought it was easiest to use action-key in order to visit
it.


I assume hyperbole wrongly assumed that this was an org-mode
buffer and did something wrong with org-element, but I'm
only guessing, since this is way above my elisp foo.

I hope this somehow helps.

Emacs  : GNU Emacs 29.0.50 (build 2, x86_64-pc-linux-gnu, cairo version 1.16.0)
 of 2022-10-19
Package: Org mode version 9.6-pre (release_9.5.5-997-ge58bd0 @ 
/home/grfz/src/org-mode/lisp/)

and hyperbole 8.0.0.

Ciao,
-- 
Gregor



Re: Do not show a TODO item in the global TODO list until certain date?

2022-10-21 Thread Ihor Radchenko
Angel de Vicente  writes:

> [I was about to tell you that it was still not working, because I was
> still trying with the following TODO item:
>
> ,
> | ** TODO test   
> :personal:
> | 
> |:PROPERTIES:
> |:SHOWFROMDATE: 2022-10-16
> |:END:
> `
>
> and then I realized that the empty line before :PROPERTIES: was breaking
> it. With no empty line it works fine (I should've used
> org-command-set-SHOWFROMDATE-property from the beginning, which sets the
> PROPERTIES in the right format).

Note M-x org-lint. It tries to check for Org syntax issues like this.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: Line breaks and brackets in LaTeX export

2022-10-21 Thread Max Nikulin

On 21/10/2022 10:34, Ihor Radchenko wrote:

Juan Manuel Macías writes:

I see the tabularray issue simply as an example that \empty is not as
reliable as we thought. There might be other LaTeX packages throwing
errors on \\\empty.


My impression is that tabularray has an ambitious goal to replace all 
current table packages. I have no idea if other packages will adopt 
similar approach with regexp-based parsing instead of usual expanding of 
TeX commands.


I do not like necessity to add \NewTableCommand\empty{} to documents 
somehow (only if tabularray is loaded). I do not have an idea better 
than \\[0pt] and an optimizing filter to remove [0pt] in almost all cases.






Re: Line breaks and brackets in LaTeX export

2022-10-21 Thread Max Nikulin

On 21/10/2022 10:41, Ihor Radchenko wrote:

Max Nikulin writes:


On 20/10/2022 12:07, Ihor Radchenko wrote:

When transcoding children (e.g. table rows), the sibling rows can always
be accessed using org-export-get-previous-element and
org-export-get-next-element.


Decision if escaping is necessary should be based on export result, not
on the source element.


I am not sure. The export result may originate from constructs like

#+MACRO: pagebreak @@latex:\\@@

Some paragraph {{{pagebreak}}}
src_elisp[:results raw]{(format "@@latex:[%dpt]@@" (or my-spacing-value 0))}

The point is: it can be done on purpose for some reason.


I agree that it can be done for purpose and I am not happy that due to 
table syntax it is not easy to emit custom code between rows.


Since you declined an idea to mark default line breaks with some unique 
comment to use it in search pattern in a filter, I may suggest to change 
custom code to either remove newline before brackets or to add a comment 
after \\


Some paragraph
src_elisp[:results raw]{(format "@@latex:[%dpt]@@" (or 
my-spacing-value 0))}


or #+MACRO: pagebreak @@latex:\\%@@

With any variant such line break will be ignored by "optimizing" filter.

Concerning element vs. exported text, consider a derived backend that 
ignores italics markers if a paragraph has some attribute. Usually

 Paragraph \\
 \emph{[something]}
does not cause any problem, however if italics is ignored it is an error
 Paragraph\\
 [something]
That is why namely exported code of adjacent leaf node should be 
examined. Ideally there should be a possibility to add some attributes 
or properties to distinguish raw export snippet. Unfortunately it 
requires complete redesign of org-export.






Re: org-persist-write slow when pp-use-max-width is t

2022-10-21 Thread Michael Eliachevitch




pp-max-width has been introduced in Emacs 29.
The fact that pp becomes too slow is likely something to be fixed before
the next Emacs release.


Good catch and I agree. I compile emacs from the master branch and probably 
discovered in the emacs-news which I check between upgrades and I probably 
customized it subsequently, even though I forgot about the customization later.


While we can work around this issue on Org side, I'd prefer to ask Emacs
developers first and see if they can come up with a fix.

I suggest you to file a bug report to Emacs.
You may provide the contents of your org-persist-index-file inside
org-persist-directory. AFAIU, it is what is taking a lot of time to
print.


I submitted a bug report where I attached the index file and a minimal example 
file which benchmarks running pp on it, with which I could reproduce my issue 
from emacs -Q:

https://debbugs.gnu.org/cgi/bugreport.cgi?bug=58687

Let's see what the emacs devs have to say about it.
--
Michael Eliachevitch
Public PGP Key: 
https://keyoxide.org/hkp/546908c782383ad0e7d894ec1b8f95c8125dce31



Re: [BUG] Mention #+PRINT_BIBLIOGRAPHY in the Org manual

2022-10-21 Thread Rudolf Adamkovič
Ihor Radchenko  writes:

> Feel free to submit a patch for org-cite-make-insert-processor.

Could the patch make '[cite: @key]' the new default when inserting
citations, or should it introduce a new customization point?

Rudy
-- 
"Strange as it may sound, the power of mathematics rests on its evasion
of all unnecessary thought and on its wonderful saving of mental
operations."
-- Ernst Mach, 1838-1916

Rudolf Adamkovič  [he/him]
Studenohorská 25
84103 Bratislava
Slovakia



Re: [BUG] ox-odt fails for org-id links (e.g., from org-roam v2) [9.5.2 (9.5.2-gfbff08 @ /home/moritz/.emacs.d/elpa/27.2/develop/org-9.5.2/)]

2022-10-21 Thread Max Nikulin

On 21/10/2022 10:16, Ihor Radchenko wrote:

Max Nikulin writes:


I am apologizing if my comments make no sense. I remember a thread on
improper handling on id links in ox-html, so I am a bit surprised that a
link to the whole file (if I got the goal of the patch correctly, of
course) is the only problem with ODT.


It is likely not the only problem. But this thread is about one
particular problem that should also be fixed regardless of others.
If you find other problems, please report them.


I am sorry. I confused this thread with some other bug report. I agree 
that the original post describes namely file links. When Moritz provided 
an example in response to your request for more details I decided that 
more similar problems are coming. Perhaps particular use case does not 
include links to specific headings in files and I was wrong. On the 
other hand if ox-odt code works with id links better than ox-html then 
the former may be a source of inspiration how to fix the latter.



Here, we at least fix the export error. So that people can at least get
some exported .odt file.


I have tried main HEAD (your fix should be applied) and I did not get an 
error, but the result is quite strange. Consider a single file with an 
internal link:


:PROPERTIES:
:ID:   3c885843-13ad-4dd8-a57f-de8271403b85
:END:
#+TITLE: Note A

* H 1
Some text

* H 2
[[id:3c885843-13ad-4dd8-a57f-de8271403b85][Link to Note A]]

Link in the exported document:

Link to Note 
A


I would expect a target withing the same .odt file.

Properties as displayed in LibreOffice UI are even more peculiar:
Document path
file:///tmp/d/test-odt.odt/test-odt.org
Target in document is empty.

My expectation for path is file:///tmp/d/test-odt.odt or at least 
file:///tmp/d/test-odt.org, but certainly not their combination. I am 
unsure if you consider this observation as relevant to this thread.







[PATCH] Re: Bug: Incorrect indentation in Org Babel list output with multiline text [9.4.4 (release_9.4.4 @ /Applications/Emacs.app/Contents/Resources/lisp/org/)]

2022-10-21 Thread Rudolf Adamkovič
Ihor Radchenko  writes:

> Applied onto main.

I wrote a regression test, so that we do not need to fix this problem
again next time.  Please see the attached patch.

>From 9cb3c86abcc1fe983b5e6d2ff7a80c1d714fb126 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rudolf=20Adamkovi=C4=8D?= 
Date: Fri, 21 Oct 2022 16:26:33 +0200
Subject: [PATCH] test-ob: Test indentation of multiline text in list output

* testing/lisp/test-ob.el (test-ob/org-babel-results-indented-list):
Add a regression test for the recent change to ob-core list formatting
in e7005787993f521f76e99f00e8a04d87703c493f.
---
 testing/lisp/test-ob.el | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/testing/lisp/test-ob.el b/testing/lisp/test-ob.el
index 4ac278faf..4beaecf7b 100644
--- a/testing/lisp/test-ob.el
+++ b/testing/lisp/test-ob.el
@@ -1175,6 +1175,29 @@ trying to find the :END: marker."
 (org-babel-execute-src-block)
 (org-babel-execute-src-block)))
 
+(ert-deftest test-ob/org-babel-results-indented-list ()
+  "Test that :results value list indents multi-line items correctly."
+  (should
+   (string= "- Foo1
+  Bar1
+- Foo2
+
+  Bar2
+"
+(org-test-with-temp-text
+"#+begin_src emacs-lisp :results value list
+'(\"Foo1
+Bar1\"
+  \"Foo2
+
+Bar2\")
+#+end_src"
+  (org-babel-execute-src-block)
+  (org-forward-element)
+  (org-narrow-to-element)
+  (delete-trailing-whitespace)
+  (buffer-string)
+
 (ert-deftest test-ob/file-desc-header-argument ()
   "Test that the :file-desc header argument is used."
   (org-test-with-temp-text "#+begin_src emacs-lisp :results file :file-desc bar
-- 
2.38.0


Rudy
-- 
"Be especially critical of any statement following the word
'obviously.'"
-- Anna Pell Wheeler, 1883-1966

Rudolf Adamkovič  [he/him]
Studenohorská 25
84103 Bratislava
Slovakia


Re: [PATCH] ob-java: Define the list of all supported header arguments

2022-10-21 Thread Ihor Radchenko
Rudolf Adamkovič  writes:

> Rudolf Adamkovič  writes:
>
>> Please see the attached patch with updated tests.
>
> Oops, I had a typo (a wrong tense) in the commit message.
>
> Please see the patch attached to this message that has it fixed.

Thanks!
Applied onto main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=bed47b437d8cde7a98bafdb07996e248b40f70e6

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: Org 9.6-pre and Bash sessions

2022-10-21 Thread Rudolf Adamkovič
Ihor Radchenko  writes:

> See the attached tentative patch.
> I'd appreciate some testing. Hopefully, I did not break anything.

I did some testing and found no issues.

Great work!

Below, I include some suggestions regarding the patch.

> * lisp/ob-comint.el (org-babel-comint-with-output): Cleanup empty
> output.  Such output is spitted unnecessarily for multi-line scripts.

- 'cleanup' (noun) -> 'clean up' (verb)
- 'spitted' -> ??? (did you mean 'split', perhaps?)

> * testing/lisp/test-ob-shell.el (test-ob-shell/session): Add test.

- 'test' -> 'a test'

> +  (let ((res (org-babel-execute:sh "if true; then\necho \"yes\"\nfi" 
> '((:session . "yes")

This line has 93 columns, which makes it needlessly hard to read.

Consider,

(let ((result (org-babel-execute:sh
 "if true \n then \n echo yes \n fi"
 '((:session . "yes")
(should result)
(should (string= "yes" result)))

I replaced the remaining semicolons with newlines, given the test
focuses on "multi-line scripts".  Further, I removed the needless
(escaped) quotes around "yes".  Lastly, I renamed 'res' to 'result',
improving readability and consistency, given the file already uses
'result' in another 'let'.

Rudy
-- 
"Programming reliably -- must be an activity of an undeniably
mathematical nature […] You see, mathematics is about thinking, and
doing mathematics is always trying to think as well as possible."
-- Edsger W. Dijkstra, 1981

Rudolf Adamkovič  [he/him]
Studenohorská 25
84103 Bratislava
Slovakia



Re: [PATCH] ob-java: Define the list of all supported header arguments

2022-10-21 Thread Rudolf Adamkovič
Rudolf Adamkovič  writes:

> Please see the attached patch with updated tests.

Oops, I had a typo (a wrong tense) in the commit message.

Please see the patch attached to this message that has it fixed.

Rudy

>From 37bd1716a652751e6941781464d47c283be3b4b9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rudolf=20Adamkovi=C4=8D?= 
Date: Fri, 21 Oct 2022 14:48:56 +0200
Subject: [PATCH] test-ob-java: Test Java source block header arguments at all
 levels
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* testing/lisp/test-ob-java.el (ob-java/lint-header-arguments):
Rename to ob-java/lint-header-args-block.

* testing/lisp/test-ob-java.el (ob-java/lint-header-args-heading):
Test source block header arguments at the heading level.

* testing/lisp/test-ob-java.el (ob-java/lint-header-args-buffer):
Test source block header arguments at the buffer level.

Reported-by: Rudolf Adamkovič 
Link: https://orgmode.org/list/m2y1ta9rqe@me.com
---
 testing/lisp/test-ob-java.el | 31 ++-
 1 file changed, 30 insertions(+), 1 deletion(-)

diff --git a/testing/lisp/test-ob-java.el b/testing/lisp/test-ob-java.el
index a62d66557..1cc7fbeb2 100644
--- a/testing/lisp/test-ob-java.el
+++ b/testing/lisp/test-ob-java.el
@@ -27,7 +27,36 @@
 
 ;;; No Java required
 
-(ert-deftest ob-java/lint-header-arguments ()
+(ert-deftest ob-java/lint-header-args-buffer ()
+  ;; Test that the Org linter accepts every supported Java source
+  ;; block header argument at the buffer level.
+  (org-test-with-temp-text "
+#+property: header-args:java+ :dir /tmp
+#+property: header-args:java+ :classname com.example.Example
+#+property: header-args:java+ :imports com.example.OtherExample
+#+property: header-args:java+ :cmpflag -classpath .:/tmp/example/
+#+property: header-args:java+ :cmdline -classpath .:/tmp/example/
+#+property: header-args:java+ :cmdarg -verbose"
+(should-not (org-lint '(wrong-header-argument)
+
+(ert-deftest ob-java/lint-header-args-heading ()
+  ;; Test that the Org linter accepts every supported Java source
+  ;; block header argument at the heading level.
+  (org-test-with-temp-text "
+* Test
+:PROPERTIES:
+:header-args:java+: :dir /tmp
+:header-args:java+: :classname com.example.Example
+:header-args:java+: :imports com.example.OtherExample
+:header-args:java+: :cmpflag -classpath .:/tmp/example/
+:header-args:java+: :cmdline -classpath .:/tmp/example/
+:header-args:java+: :cmdarg -verbose
+:END:"
+(should-not (org-lint '(wrong-header-argument)
+
+(ert-deftest ob-java/lint-header-args-block ()
+  ;; Test that the Org linter accepts every supported Java source
+  ;; block header argument at the block level.
   (org-test-with-temp-text "
 #+header: :dir /tmp
 #+header: :classname com.example.Example
-- 
2.38.0

-- 
"Genius is 1% inspiration and 99% perspiration."
-- Thomas Alva Edison, 1932

Rudolf Adamkovič  [he/him]
Studenohorská 25
84103 Bratislava
Slovakia


Re: [PATCH] ob-java: Define the list of all supported header arguments

2022-10-21 Thread Rudolf Adamkovič
Ihor Radchenko  writes:

> Thanks!
> Applied onto main.

Fantastic!

> Fixed.

Thanks.  Please see the attached patch with updated tests.

Rudy

>From 5405d0419295bb1a0314cb2b3ce07713fc77e792 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rudolf=20Adamkovi=C4=8D?= 
Date: Fri, 21 Oct 2022 14:48:56 +0200
Subject: [PATCH] test-ob-java: Test Java source block header arguments at all
 levels
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* testing/lisp/test-ob-java.el (ob-java/lint-header-arguments):
Renamed to ob-java/lint-header-args-block.

* testing/lisp/test-ob-java.el (ob-java/lint-header-args-heading):
Test source block header arguments at the heading level.

* testing/lisp/test-ob-java.el (ob-java/lint-header-args-buffer):
Test source block header arguments at the buffer level.

Reported-by: Rudolf Adamkovič 
Link: https://orgmode.org/list/m2y1ta9rqe@me.com
---
 testing/lisp/test-ob-java.el | 31 ++-
 1 file changed, 30 insertions(+), 1 deletion(-)

diff --git a/testing/lisp/test-ob-java.el b/testing/lisp/test-ob-java.el
index a62d66557..1cc7fbeb2 100644
--- a/testing/lisp/test-ob-java.el
+++ b/testing/lisp/test-ob-java.el
@@ -27,7 +27,36 @@
 
 ;;; No Java required
 
-(ert-deftest ob-java/lint-header-arguments ()
+(ert-deftest ob-java/lint-header-args-buffer ()
+  ;; Test that the Org linter accepts every supported Java source
+  ;; block header argument at the buffer level.
+  (org-test-with-temp-text "
+#+property: header-args:java+ :dir /tmp
+#+property: header-args:java+ :classname com.example.Example
+#+property: header-args:java+ :imports com.example.OtherExample
+#+property: header-args:java+ :cmpflag -classpath .:/tmp/example/
+#+property: header-args:java+ :cmdline -classpath .:/tmp/example/
+#+property: header-args:java+ :cmdarg -verbose"
+(should-not (org-lint '(wrong-header-argument)
+
+(ert-deftest ob-java/lint-header-args-heading ()
+  ;; Test that the Org linter accepts every supported Java source
+  ;; block header argument at the heading level.
+  (org-test-with-temp-text "
+* Test
+:PROPERTIES:
+:header-args:java+: :dir /tmp
+:header-args:java+: :classname com.example.Example
+:header-args:java+: :imports com.example.OtherExample
+:header-args:java+: :cmpflag -classpath .:/tmp/example/
+:header-args:java+: :cmdline -classpath .:/tmp/example/
+:header-args:java+: :cmdarg -verbose
+:END:"
+(should-not (org-lint '(wrong-header-argument)
+
+(ert-deftest ob-java/lint-header-args-block ()
+  ;; Test that the Org linter accepts every supported Java source
+  ;; block header argument at the block level.
   (org-test-with-temp-text "
 #+header: :dir /tmp
 #+header: :classname com.example.Example
-- 
2.38.0

-- 
"Thinking is a momentary dismissal of irrelevancies."
-- Richard Buckminster Fuller, 1969

Rudolf Adamkovič  [he/him]
Studenohorská 25
84103 Bratislava
Slovakia


Re: [BUG] ox-odt fails for org-id links (e.g., from org-roam v2) [9.5.2 (9.5.2-gfbff08 @ /home/moritz/.emacs.d/elpa/27.2/develop/org-9.5.2/)]

2022-10-21 Thread Ihor Radchenko
Ihor Radchenko  writes:

> Subject: [PATCH] ox-odt: Allow id: links to files
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
>
> * lisp/ox-odt.el (org-odt-link): Transcode id: links to file property
> drawers.
>
> Reported-by: Moritz Schäfer 
> Link: 
> https://orgmode.org/list/CA+FVMQDBUwCQHFOWieELaB3=4mh2yba66+npcuqwvvv_1hv...@mail.gmail.com

Applied onto main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=4e5c7373115cfeb88fb4392252d682fad8d178a8

We can further improve things, like with escaping the file name, but the
patch should at least fix the immediate export problem.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: Org-mode syntax as a tool-independent MIME type (was: Shower thought: submit an IETF RFC to register Org as a MIME type)

2022-10-21 Thread Ihor Radchenko
Karl Voit  writes:

> For reasons explained in my Orgdown-related articles[1] I would
> propose to use this chance to introduce a different term for the
> Org-mode lightweight markup language in contrast to the Org-mode
> Elisp implementation in order to push the syntax in a tool-agnostic
> way. We should not think only of GNU Emacs because there is a
> rising number of tools that do support text files in Org-mode
> syntax[2] which is also a huge advantage for users of GNU Emacs:
> collaboration, public awareness of the syntax, more tool support,
> ...

I do not like the idea of using Orgdown term for MIME type.
MIME type already imply syntax, not the implementation. I think that it
will be better to keep "Org" term for MIME type and avoid too much
confusion.

The Emacs-independent description of the syntax is being worked on in
https://orgmode.org/worg/dev/org-syntax.html.

> I proposed the term Orgdown for the Org-mode syntax and also
> proposed various levels in order to provide sub-sets of Org-mode
> syntax[3] that are realistic to implement with finite effort. Using
> those OD-levels to come up with a formal definition (EBNF?) might
> play perfectly well with different parameters of the MIME type[4].

I do understand and accept your idea about simplified syntax
description. As we are going to need the syntax white-paper for MIME
type registration anyway, we may as well define your syntax levels in
that document. I envision a section in
https://orgmode.org/worg/dev/org-syntax.html that will define subsets
syntax elements can be supported.

The first step now if finalizing
https://orgmode.org/worg/dev/org-syntax.html. It would help if other Org
users read through the document and try to spot what is missing,
unclear, or inaccurate.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: Org-mode syntax as a tool-independent MIME type

2022-10-21 Thread Ihor Radchenko
Karl Voit  writes:

> I tried to collect projects on
> https://gitlab.com/publicvoit/orgdown/-/blob/master/doc/Tool-Support.org

Would you be interested to contribute to https://orgmode.org/tools.html?

>> Perhaps TEC is right and we will end up having the minimal syntax
>> being the one we currently use for Org-mode: we'll see.
>>
>> But we need volunteers: one to work on worg/dev/org-synxtax.org (I'm
>> assuming TEC can lead the work here) and one to set up a discussion
>> with people implementing Org in various places (you ?).
>
> What kind of discussion is on your mind? At the moment, I tend to
> think that the Org-mode community should provide directions by
> developing a formal definition of the syntax and maybe later-on
> define viable sub-sets (the OD levels?) so that tool developers
> don't have to implement the whole large thing.
>
> At this stage, I don't know what discussions you're trying to start
> here. Can you elaborate?

You can start from reading https://orgmode.org/worg/dev/org-syntax.html
and providing suggestions to improve it. That document will eventually
become the syntax reference.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: Error during PDF export but the PDF file is exported

2022-10-21 Thread Pascal Quesseveur
>"IR" == Ihor Radchenko  writes:

  IR> Pascal, could you please try the latest main and see if the
  IR> problem is fixed?

Unfortunately I can't try at the moment. I have followed the link

https://list.orgmode.org/thu03t$16vt$1...@ciao.gmane.io

and FWIU it should work fine as it takes the file modification time
instead of current-time in org-compile-file as I did in my first
attempt.


-- 
Pascal Quesseveur
pques...@gmail.com



Re: Export of deadline status via ~org-batch-agenda-csv~

2022-10-21 Thread Ihor Radchenko
"Stefan van der Walt"  writes:

> I am trying to process all of my TODOs in a script, and therefore use 
> ~org-batch-agenda-csv~ to export them to CSV.
>
> I am running into two problems:
>
> 1. It seems to be impossible to get deadline/schedule information for tasks 
> that have been marked as DONE and
> 2. There exists a ~type~ value ~past-scheduled~ for when a task's scheduled 
> date has been missed, but there is no equivalent for ~past-deadline~.
>
> (See =org-agenda.el=, docstring for ~defmacro org-batch-agenda-csv~).
>
> I think (2) can be fixed fairly easily by adding a "past-deadline" type.  I'm 
> not sure how to address (1).  Any thoughts?

Sorry for the late reply.
Could you please provide more details?
It is not very clear for me what you are trying to achieve.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: [BUG] Beamer export fails with async export [9.5.3 (9.5.3-g4197fc @ /home/thomas/.emacs.d/straight/build/org/)]

2022-10-21 Thread Ihor Radchenko
Thomas Freeman  writes:

> When exporting a LaTeX beamer presentation as an asynchronous process
> (by using C-a prior to selecting the export option), the export fails with 
> the following error:
>
> (error "Unknown \"nil\" back-end: Aborting export")

Could you please provide detailed steps how to reproduce the problem
together with a sample beamer presentation file?
See https://orgmode.org/manual/Feedback.html#Feedback

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: Bug: Incorrect indentation in Org Babel list output with multiline text [9.4.4 (release_9.4.4 @ /Applications/Emacs.app/Contents/Resources/lisp/org/)]

2022-10-21 Thread Ihor Radchenko
Vikas Kumar  writes:

> Here is a patch with the fix.

Thanks, and sorry for the late reply.
Applied onto main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=e7005787993f521f76e99f00e8a04d87703c493f

You are now listed as an Org contributor
https://git.sr.ht/~bzg/worg/commit/d0d3287e851a7365069b9dd8970ae5756e20240d

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: Bug: org-clock-select-task reuses reserved characters [9.3 (release_9.3 @ /home/unhammer/PREFIX/emacs/share/emacs/28.0.50/lisp/org/)]

2022-10-21 Thread Ihor Radchenko
Kevin Brubeck Unhammer  writes:

> If your org-clock-history has 44 or more elements, then the "c"
> character will no longer go to the current task, but to the 44th clocked
> in task. Similarly for [d]efault and [i]nterrupted.
>
> The function first adds (?c . marker-to-current-task) to the sel-list,
> then goes through org-history and uses 0-9 and A-Z and then keeps going
> through lower case letters without caring about whether the letter was
> already in there.

Thanks for reporting, and sorry for the late reply.
Fixed on main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=85ab64c2b3487b1e16d3174448ff980b56007e80

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at