Re: [TASK] Allow customizeable ditaa executable in ob-ditaa.el

2023-11-09 Thread Leo Butler
On Thu, Nov 09 2023, Max Nikulin  wrote:

> On 09/11/2023 10:17, Leo Butler wrote:
>> While I was reviewing the documentation, ob-doc-ditaa.org, and the
>> source, ob-ditaa.el, I realized that there is a simple way to run a
>> script file instead of a jar file.
>
>
> It is better to avoid obstacles than to document them.

Ok, I figured that would be the response.

> diff --git a/lisp/ob-ditaa.el b/lisp/ob-ditaa.el
> index fa864c7bc..4a2b09cd9 100644
> --- a/lisp/ob-ditaa.el
> +++ b/lisp/ob-ditaa.el
> @@ -100,11 +100,13 @@ (defun org-babel-execute:ditaa (body params)
>  "epstopdf"
>  " " eps-file
>  " -o=" (org-babel-process-file-name out-file
> +(jar (org-string-nw-p (if eps org-ditaa-eps-jar-path
> org-ditaa-jar-path)))
>  (cmd (concat org-babel-ditaa-java-cmd
> - " " java " " org-ditaa-jar-option " "
> - (shell-quote-argument
> -  (expand-file-name
> -   (if eps org-ditaa-eps-jar-path org-ditaa-jar-path)))
> + " " java
> + (and jar
> +  (concat
> +" " org-ditaa-jar-option " "
> +(shell-quote-argument (expand-file-name jar
>   " " cmdline
>   " " (org-babel-process-file-name in-file)
>   " " (if pdf-cmd
>
> should allow to set :java to
>
> flatpak-spawn --host toolbox run /usr/bin/ditaa
>
> without abusing of org-ditaa-jar-path. Untested.

Doesn't this abuse the `java' header argument, which is intended to pass
arguments to the java runtime?

I think that it would be best to implement the change to mirror that
done in ob-plantuml, as Ihor suggested earlier. But, ob-plantuml uses a
customization switch: `org-plantuml-exec-mode'. Its documentation reads:

  Method to use for PlantUML diagram generation.
  `jar' means to use java together with the JAR.
  The JAR can be configured via `org-plantuml-jar-path'.
  
  `plantuml' means to use the PlantUML executable.
  The executable can be configured via `org-plantuml-executable-path'.
  You can also configure extra arguments via
  `org-plantuml-executable-args'.[fn:1] 

My reading of the documentation and ob-plantuml.el is that it is not
possible to use the `java' header argument in the way you propose for
ob-ditaa.el.

Leo

[fn:1] (Aside: `org-plantuml-executable-args' should be `org-plantuml-args';
Ihor missed it when he made the change in commit b5f0efc049).


Re: [BUG] org-contrib: org-eldoc has an autload, but is incompatible with modern emacs. [9.6.8 (release_9.6.8-3-g21171d @ /usr/share/emacs/30.0.50/lisp/org/)]

2023-11-09 Thread Vladimir Nikishkin


Ihor Radchenko  writes:

> Vladimir Nikishkin  writes:
>
>>> May you elaborate about incompatibility?
>>>
>>
>> Yes. With org-eldoc loaded, and having a property '#+date: unpublished'
>> in an org file, I am having the '*Messages*' buffer filled with
>> #+begin_src elisp
>> ⛔ Warning (org-element-cache): org-element--cache: Org parser error in 
>> 2015_Passwords.org.rclignore::53653. Resetting.
>>  The error was: (error "Invalid search bound (wrong side of point)")
>>  Backtrace:
>> "  backtrace-to-string(nil)
>>   org-element-at-point()
>
> This has nothing to do with eldoc.
> If you can reproduce this problem consistently, may you create a minimal
> example as described in https://orgmode.org/manual/Feedback.html#Feedback ?

I found and fixed this problem.
It was actually unrelated to bare org, it was due to my experiments with
org-ts-mode. Sorry for the confusion.


-- 
Your sincerely,
Vladimir Nikishkin (MiEr, lockywolf)
(Laptop)



ancestor/descendant in agenda

2023-11-09 Thread Samuel Wales
anybody know the latest, in built-in features or in 3rd party
packages, for doing the following?

  - dim entries that have an ancestor in the same agenda buffer
  - dim/highlight entries that have a descendant in the same agenda buffer

this would work in the text search agenda and the ts [daily/weekly] agenda.

it would work regardless of sorting or multiple parts etc.



[BUG] org-resolve-clocks use of read-char-exclusive without telling EXWM to change the focus back to Emacs results in deadlock

2023-11-09 Thread SyedZuhair
The deadlock happens if org-resolve-clocks is called automatically (for
resolving idle time) while focus is in a EXWM-mode buffer. The
result is that the focus is stuck with the EXWM-mode buffer away from
Emacs and the user can not tell EXWM to change the focus to the
mini-buffer to interact with org because org is grabbing all the input
away from EXWM.

The only way out for the user is to kill the application in EXWM buffer
from another ttyn terminal to be able to interact with
org-resolve-clocks.

See the issue discussion here as well: https://github.com/ch11ng/exwm/issues/921

Steps to reproduce:

1. Run X with EXWM as its window manager.

2. Clock in some tasks in an org-buffer.

3. Start some non-Emacs application (like Firefox)) it will run in an
EXWM-mode buffer.

4. Leave the input for more than org-clock-idle-time.

5. org-resolve-clocks is get called and you get stuck in your
EXWM-mode buffer till you kill the application somehow, because all you
keys are all going to the EXWM-buffer and those that are supposed to go
to EXWM to interact with Emacs is grabbed by org-resolve-clocks and ignored.

Thank you very much.

Emacs  : GNU Emacs 29.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.38, 
cairo version 1.17.8)
Package: Org mode version 9.6.6 (release_9.6.6 @ 
/usr/share/emacs/29.1/lisp/org/)



Re: [PATCH] org-id: allow using parent's existing id in links to headlines

2023-11-09 Thread Rick Lupton
On Tue, 25 Jul 2023, at 8:43 AM, Ihor Radchenko wrote:
> Ideally, we should have all the necessary logic to store the link within
> `org-id-store-link' and then use `org-link-set-parameters' to configure
> id links.

I agree this would be neater, but looking at how this would work, I have a 
question:

Behaviour in `org-store-link` currently depends on the `interactive?` argument, 
e.g. in this logic

(and interactive?
 (or (eq org-id-link-to-org-use-id 'create-if-interactive)
 (and (eq org-id-link-to-org-use-id
  'create-if-interactive-and-no-custom-id)
  (not custom-id

To move this logic to `org-id-store-link`, is there a way that 
`org-id-store-link` can tell whether `org-store-link` was called (a) 
interactively, or (b) with the `interactive?` argument true?

Thanks
Rick



Re: How to export org as org and keep heading IDs?

2023-11-09 Thread Ihor Radchenko
shortcutz  writes:

> org-md-export-as-markdown preserves the ID property of an org buffer, but
> for some reason org-org-export-as-org does not. I don't have the "visible
> only" option set.

See `org-export-with-properties'.

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



How to export org as org and keep heading IDs?

2023-11-09 Thread shortcutz
org-md-export-as-markdown preserves the ID property of an org buffer, but
for some reason org-org-export-as-org does not. I don't have the "visible
only" option set.

According to the function documentation I should be able to pass a property
list "with external parameters overriding Org default settings", but I
don't know what those default settings are or what parameters will cause
the ID to be exported.

How can I export org headings to org buffers while preserving the ID?
Thanks.


Re: bash source code block: problem after ssh commands

2023-11-09 Thread Matt


  On Thu, 09 Nov 2023 13:13:36 +0100  Ihor Radchenko  wrote --- 

 > A bigger problem is that errors *Org Babel Error
 > Output* are not clickable:
 
Interesting.

 > So, it looks like we may need an alternative `org-babel-eval' function
 > that works with script files rather than input and arranges
 > stdout/stderr separation.

Yes, it seems like a separate handler may be in order.

 > We should reuse `process-file' in this scenario as well,
 > but utilizing its ARGS argument + arrange to generate the temporary
 > script file in the appropriate context - see `make-nearby-temp-file'.

I was unaware of `make-nearby-temp-file'.  Thank you.  It's helpful for this 
situation.

I'm not in a position to address these points right now.  My main focus is 
re-familiarizing myself with the =ob-shell= and =ob-comint= source.  When I was 
implementing async shell evaluatation earlier this year, I remember having the 
impression that execution paths, especially `org-babel-comint-with-output', 
could probably be simplified.  It seems to me that everything we're talking 
about in this thread aligns with that objective.  I've made a note of your 
points and have every intention to return to them when I get to writing code.  
However, don't let me stop you if this is something you were interested in 
doing.  I'll do what I can to assist.



Re: Issue with org-persist and Tramp

2023-11-09 Thread Fabio Natali
On 2023-11-09, 12:17 +, Ihor Radchenko  wrote:
> May I know what
>(file-remote-p "/ssh::/home/user/test.org")
> (with appropriate ) returns on your side?

Hi Ihor,

Sure, no particular reason to obfuscate the remote address, it's
actually a LAN IP. The above function returns "/ssh:192.168.1.100:". Is
that the kind of output one should be expecting? Anything wrong about
it?

Thanks, cheers, Fabio.



Re: [TASK] Allow customizeable ditaa executable in ob-ditaa.el

2023-11-09 Thread Max Nikulin

On 09/11/2023 10:17, Leo Butler wrote:

While I was reviewing the documentation, ob-doc-ditaa.org, and the
source, ob-ditaa.el, I realized that there is a simple way to run a
script file instead of a jar file.


diff --git a/lisp/ob-ditaa.el b/lisp/ob-ditaa.el
index fa864c7bc..4a2b09cd9 100644
--- a/lisp/ob-ditaa.el
+++ b/lisp/ob-ditaa.el
@@ -100,11 +100,13 @@ (defun org-babel-execute:ditaa (body params)
 "epstopdf"
 " " eps-file
 " -o=" (org-babel-process-file-name out-file
+(jar (org-string-nw-p (if eps org-ditaa-eps-jar-path 
org-ditaa-jar-path)))

 (cmd (concat org-babel-ditaa-java-cmd
- " " java " " org-ditaa-jar-option " "
- (shell-quote-argument
-  (expand-file-name
-   (if eps org-ditaa-eps-jar-path org-ditaa-jar-path)))
+ " " java
+ (and jar
+  (concat
+" " org-ditaa-jar-option " "
+(shell-quote-argument (expand-file-name jar
  " " cmdline
  " " (org-babel-process-file-name in-file)
  " " (if pdf-cmd

should allow to set :java to

flatpak-spawn --host toolbox run /usr/bin/ditaa

without abusing of org-ditaa-jar-path. Untested.

It is better to avoid obstacles than to document them.




Re: Issue with org-persist and Tramp

2023-11-09 Thread Ihor Radchenko
Fabio Natali  writes:

> On 2023-11-08, 18:01 +, Ihor Radchenko  wrote:
>> I see the problem now.
>> Does the attached patch solve the "freeze"?
>
> Hey, thanks for sending this, really appreciate it.
>
> Unfortunately that didn't seem to fix it though. Here's what I did.
>
> - Added `(not (file-remote-p associated))' to the right place
> - Revaluated the function `org-persist--normalize-associated'
> - Tried to close the stale buffer (without repeating the entire
>   workflow, just trying with the buffer from the previous test)
>
> Result: the problem is still there, same backtrace.

Then I need to ask about
tramp-file-name-handler(file-attributes 
"/ssh::/home/user/test.org")

"/ssh::/home/user/test.org" is obfuscated to mask your
personal data, but it apparently fails to be filtered by `file-remote-p'
check. May I know what
   (file-remote-p "/ssh::/home/user/test.org")
(with appropriate ) returns on your side?

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



Re: bash source code block: problem after ssh commands

2023-11-09 Thread Ihor Radchenko
Matt  writes:

> ... Aside from permission, any code we
> insert needs to be correct. For example, a shebang would need to point
> to the correct application and any arguments would need to correspond
> to the implementation being called. I doubt we'd need anything beyond
> /bin/. FWIW, it looks like there's been at least one instance
> where :shebang's formatting was questioned
> (https://yhetil.org/orgmode/ca+a2izz1vmmkiuf4fem1au7ca1m9gqap+bkvrosz+0bxrt6...@mail.gmail.com/).

It is a problem, but I am not sure how useful it is to solve the line
numbering there. A bigger problem is that errors *Org Babel Error
Output* are not clickable:

Try
#+begin_src bash
cdf
#+end_src
and you will get
-- *Org Babel Error Output* -
bash: line 1: cdf: command not found
[ Babel evaluation exited with code 127 ]
-

Clicking on "line 1" will yield file opening dialogue.

However, there is yet another problem revealed when we try

#+begin_src bash :cmdline bash
cdf
#+end_src

#+RESULTS:
: /tmp/babel-47DarV/sh-script-vkbRfJ: line 2: cdf: command not found

There is no *Org Babel Error Output* buffer at all.

So, it looks like we may need an alternative `org-babel-eval' function
that works with script files rather than input and arranges
stdout/stderr separation.

> We'd also need to control for what environment the script runs in.
> That was another issue I saw raised in the list
> (https://yhetil.org/orgmode/87609ug5ae@luisa.c0t0d0s0.de/). Of
> course, we'd need to read the stdout and stderr. This is handled by
> =process-file=. Any step I missed or some kind of failure I didn't
> consider?

Valid concern. We should reuse `process-file' in this scenario as well,
but utilizing its ARGS argument + arrange to generate the temporary
script file in the appropriate context - see `make-nearby-temp-file'.

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



Re: [RFC][PATCH v2] Allow to export to ascii custom link types as notes

2023-11-09 Thread Max Nikulin

On 08/11/2023 18:16, Ihor Radchenko wrote:

We can introduce a special ox-ascii-specific object `object-with-note'
that will be exported by ox-ascii according to
`org-ascii-links-to-notes' settings. Then, we can transform link objects
into `object-with-note' that will later be used in
`org-ascii--describe-links'.


I am in doubts if it is a bright idea to transform in place passed link 
object inside `org-ascii-link'.


I see 2 ways:
- Use ad-hoc object-with-note org-element object instead of `cons' in my 
patch (rather cosmetic change).
- Introduce :filter property for links that is called before export 
pass. These functions may return arbitrary elements instead of original 
links. For ox-ascii a dedicated transcoder for object-with-note is 
added. Only custom link types having :export property are processed by 
`org-ascii-link'.