Can we add PLOT to org-element-multiple-keywords?

2024-04-20 Thread Jeff Trull
Hi all,

I notice that multiple #+PLOT lines before a table will be coalesced and
handled as one. However, this is
accomplished through specific code in org-plot.el that does a reverse
search through the buffer for
additional lines. org-element has a built-in mechanism for this,
org-element-multiple-keywords. It seems
like it would be useful to add PLOT to it. Can that be done? If not, is
there a way to temporarily add it for
an exporter (i.e. after the export is launched but before the buffer is
parsed)?

Thanks,
Jeff


Re: [FR] Please add custom command variable to org-latex-footnote-refere

2024-04-20 Thread Alexander Gogl
Hi Pedro,

thank you for the early-init.el suggestion. However, it doesn' work for me. I 
still get the following error (even in vanilla emacs):

..
⛔ Warning (emacs): Org version mismatch.  Org loading aborted.
This warning usually appears when a built-in Org version is loaded
prior to the more recent Org version.

Version mismatch is commonly encountered in the following situations:
...
..

Maybe it has to do with the Mac OS Port "emacs-plus" 
(https://github.com/d12frosted/homebrew-emacs-plus) I am using?

I will test your concern as soon as I am able to solve the org version mismatch 
error.


Best

Alexander

"Pedro A. Aranda"  --- 2024-04-20 Sa 09:04:

> /Hi, Alexander Gogl  writes: /> ox-latex: New 
> option to customize LaTeX footnote command
>
> I hope you are aware that with your patch you are not going to be aware to 
> pass
> extra options to your foot or side notes, right? And since I'm not familiar 
> with
> kaobook, just a question. Are you sure that the foot and side notes will not 
> choke
> at a \label{} inside the text?
> //> PS: I have a hard time to setup an environment to test the patch because
>> my Spacemacs configuration conflicts with the Org mode development
>> version. Can anyone provide me a link to a ressource that describes the
>> procedure?
>
> I'm running on a vanilla Emacs and
>
> ---cut here --
> (let ((org-devel-path (expand-file-name "~/Devel/org-mode/lisp")))
>   (when (file-directory-p org-devel-path)
> ;; (message "Adding %s to load-path" org-devel-path)
> (add-to-list 'load-path  org-devel-path)))
> ---cut here --
>
> in my .emacs.d/early-init.el does the job. I have a general Devel directyl 
> for my development jobs.
>
> Hope it helps, /PA
>
> PS: Cool kaobook. I've used koma-script for most of my LaTeX work in the last 
> 15 years +/- ;-) though.




Re: Trailing whitespace after export snippets without a transcoder

2024-04-20 Thread Max Nikulin

On 20/04/2024 18:14, Ihor Radchenko wrote:

https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=a6d9fd82e

 Back-end developers should pay attention to the fact that white spaces
 before and after an ignored export snippet now are accumulated in the
 output.

I have no clue about the rationale of this special behaviour - it dates
back to the days when Org export was merged. It is also not documented
anywhere, AFAIK.


I would not expect that the space after the following export snippet is 
ignored in the case of ox-html or ox-latex backend:


A space@@ascii:*@@ character.

The space may be put inside the export snippet if the intention is to 
omit it for output formats other than plain text. So current behavior is 
perfectly reasonable and flexible enough.


The issue is empty lines that serve as paragraph separators and that may 
appear due to expansion of a macro or due to skipped export snippets. 
Perhaps transcoders of other elements, e.g. links, may return empty 
strings as well.





Re: columnview dynamic block - different time summing behaviour for EFFORT and CLOCKSUM

2024-04-20 Thread Alexander Adolf
Many thanks for your swift response!

Ihor Radchenko  writes:

> [...]
> When suggesting #+vindex, I was referring to
> org-columns-dblock-formatter variable.
> [...]
> #+cindex: @samp{formatter}, dynamic block parameter

I see; thanks for explaining. I've added both:

 Begin Quote -
- =:formatter= ::

  #+cindex: @samp{formatter}, dynamic block parameter
  #+vindex: org-columns-dblock-formatter
  A function to format column view data and insert it into the buffer.
  See the option ~org-columns-dblock-formatter~.
- End Quote --


> [...]
> I see how. It is because CELL-CONTENT is not the original heading. It is
> the heading name processed with `org-columns--clean-item'.
>
> `org-column--clean-item' removes statistics cookies among other things.
> It actually removes more, leading to some edge cases in your patch:
>
> ** TODO Foo
>
> ** TODO src_elisp{"Hello"} world
>
>
> #+begin: columnview :id global :link t
> | <25>  |  | <3>  |  |
> | ITEM  | TODO | PRIORITY | TAGS |
> |---+--+--+--|
> | [[file:/tmp/test.org::*Foo][Foo]]   | TODO | B|  |
> | [[file:/tmp/test.org::*src_elisp{"Hello"} world][world]] | TODO | B
> |  |
> #+end:
>
> Note how inline src block is stripped from the link description.

Ah, `org-column--clean-item'; well spotted!

Two observations:

1) As is now, I'm generating the links in the data collection function
   `org-columns--capture-view'. As `org-column--clean-item' is called
   from code that runs after the data collection,
   `org-column--clean-item' was probably never designed to be able to
   handle strings containing links. That it still did sort of "the right
   thing" seems more luck than anything else?

2) Considering what happens when I do `org-store-link' and
   `org-insert-link', it would seem more advisable to:

   a) move the link generation to the new formatting function
  (re-removing it from `org-columns--capture-view');

   b) pass the "cleaned" string to `org-link-make-string' as both, the
  link and the description parameter.

> We should probably also change org-clock to use
> `org-columns--clean-item'.
> [...]

As a separate patch, or as a third commit to the patch we are discussing
now?


Many thanks and looking forward to your thoughts,

  --alexander



Re: [BUG] LaTeX preview should use a subdirectory in /tmp

2024-04-20 Thread Max Nikulin

On 19/04/2024 22:00, emm.charpent...@free.fr wrote:

Embedding 
/home/charpent/WinFiles/Temporaire/Org/file:ltximg/EssaiSnippetsLaTeX_2923a1941c0e63eab69544afa1be2ec0d95a01c4.png
 as Images/0001.png...


See

Ihor Radchenko. Re: strange export problem with a file: link. Sat, 20 
Apr 2024 12:25:56 +.

https://list.orgmode.org/87cyqkmd9n.fsf@localhost




Re: strange export problem with a file: link

2024-04-20 Thread Ihor Radchenko
"Fraga, Eric"  writes:

> I have a file that consists of these three lines:
>
> --8<---cut here---start->8---
> #+begin_src latex :results file raw :exports results :file function.png
> \[ y = f(x) \]
> #+end_src
> --8<---cut here---end--->8---
>
> With "emacs -Q" and loading in org from the git repository as of maybe
> an hour or so ago, I get this error:
>
> org-odt-export-to-odt: OpenDocument export failed: Opening input file: No 
> such file or directory, /tmp/file:function.png
>
> when I try to export the file to ODT.  Exporting to LaTeX (PDF) works
> just fine.  For the ODT export, the "file:" link specification is not
> being removed.
>
> I don't think I'm doing anything wrong; is this a bug in the exporter?

Yes.
Fixed, on main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=769018718

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



Is there a way to set options *programatically* ?

2024-04-20 Thread Emmanuel Charpentier
Dear list,

I'd like to create a function able to set some options, namely

- `#+options: tex:`{t|dvipng|imagemagick}

- `#+export-file-name:`

I have been unable to find a *documented* way to do that from `elacs-lisp`.

I *think* that an `org` source block could place those options in the buffer, 
but I can't find a way to reliably trigger a "setup refreshment" of these 
options from `emacs-lisp`.

Any ideas ?

Sincerely yours,

--
Emmanuel Charpentier




Trailing whitespace after export snippets without a transcoder (was: [PATCH v2] org-faq.org: Inline comments)

2024-04-20 Thread Ihor Radchenko
Max Nikulin  writes:

>> +#+begin_src org
>> +The following line may become a patagraph separator.
>> +@@comment: might give unexpected effect @@
>> +Put some text before @@comment: a better variant
>> +@@ and after instread.
>> +#+end_src
>> 
>> I am no longer able to reproduce the problem with @@comment:...@@
>> splitting paragraph in the above example.
>
> I see no changes in respect to ox-md on the main branch.

Right.
Upon debugging further, to my great surprise, I found the following
comment in ox.el:

;; Export snippets never return a nil value so
;; that white spaces following them are never
;; ignored.
(and (eq type 'export-snippet) "")

and then even a test:

;; Ignored export snippets do not remove any blank.
  (should
   (equal "begin  end\n"
  (org-test-with-parsed-data "begin @@test:A@@ end"
(org-export-data-with-backend
 tree
 (org-export-create-backend
  :transcoders
  '((paragraph . (lambda (paragraph contents info) contents))
(section . (lambda (section contents info) contents
 info

The test was added in the commit
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=a6d9fd82e

Back-end developers should pay attention to the fact that white spaces
before and after an ignored export snippet now are accumulated in the
output.

I have no clue about the rationale of this special behaviour - it dates
back to the days when Org export was merged. It is also not documented
anywhere, AFAIK.

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



Re: [PATCH] Allow external libraries (org-roam) to supply org-id locations

2024-04-20 Thread Ihor Radchenko
Ihor Radchenko  writes:

> Also, before we merge your patch, may I know if you discussed this
> change with org-roam developers? If they do not want to use the proposed
> hook, there is no reason to add it to Org mode.

It has been over a month since the last message in this thread.
May I know if there is any progress?

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



Re: Pending contents in org documents (Re: Asynchronous blocks for everything (was Re: ...))

2024-04-20 Thread Ihor Radchenko
Bruno Barbier  writes:

> Thanks for the review.
>
> I've pushed a new version, hoping to decrease the number of dislikes
> ;-)

Thanks!

>>> Cancel is handled by sending a failure message (see
>>>  `org-pending-cancel').  It's customizable using the reglock field
>>>  ~org-pending-reglock-user-cancel-function~, which can decide what to
>>>  do (like kill a process) and which can send a better outcome.
>>>  Standard 'cancel' leaves a failure outcome mark.
>>
>> Note that this function is not documented anywhere other than in reglock
>> class documentation.
>
> Thanks. I've improved the documentation of `org-pending' to mention
> that one may want to customize the following fields of a reglock:
> before-kill-function, user-cancel-function and
> insert-details-function.  And, also, I added that one can attach
> custom properties using the "properties" field.

Thanks, but I still feel confused.
May you:

1. Explain what does "kill" and "cancel" mean in the context of the
   REGLOCK.

2. Add information about visual hints, "kill", and "cancel" to the
   top-level commentary.

For now, when reading the top commentary:

;; This library contains an API to lock a region while it is "being
;; updated"; the content of the region is "pending" and cannot be
;; modified.  It will be updated, later, when the new content is
;; available.

I have an impression that the only side effect of "locking" is that the
region becomes read-only. It is not clear at all that any other
visual indication will be provided.

>> In general, I am confused about your overall design
>> of the user interaction with the locks.
>> The updated top commentary explains well how Elisp programs can send
>> data to the locks, but it does not say anything about how Elisp programs
>> can receive the data.
>
> An elisp program, that uses org-pending, must update the locks using
> `org-pending-send-update'.  That program does not receive any data
> from the lock; it may customize Emacs behavior using the reglock
> fields mentioned above: before-kill-function, user-cancel-function and
> insert-details-function.
>
> Hopefully, it's clearer now with the improved documentation of the
> org-pending function.
>
> Just let me know if you still think that the top commentary should
> explain this.  Thanks.

Yes, I do think that top commentary should explain this.
The very idea that lock may be "canceled" or "killed" is important when
designing Elisp code that uses the org-pending library.

>> Also, I'd like to see more information in the top commentary about what
>> are the "visual hints" displayed to the user and how to configure them.
>
> If you think the current "visual hints" are good enough and could be
> shipped as-is, in a first version (indirect buffers, etc.); I could
> work on documenting them better.  What kind of configuration are you
> thinking about ? just the faces ? or more advanced configurations ?

I am not thinking about details yet.
I just want insert-details-function to be described in the top
commentary. At high level. Something like


* Visual indication of the "pending" regions

While the region is locked, it is visually highlighted in the buffer,
providing information about the lock status as an overlay. The status
can be:

1. :scheduled - the region is "being updated", but the computation has
   not yet started.
2. :progress  - the computation is in progress

After unlocking the region, the visual indication is not necessarily
removed. Instead, the outcome is indicated in an overlay. The outcome
may be:

1. :success - the computation has been successful and the region text
   has been updated
2. :failure - the computation failed

The lock status is updated according to the data submitted to REGLOCK
object via `org-pending-send-update'.

* User interaction with pending regions

For any pending region, users may request detailed description to be
displayed. The description includes the pending region status, creation
time, outcome, duration, results, errors, etc.

Elisp code using this library may also supply additional details about
any given reglock, via `insert-details-function' field of REGLOCK
object. For example, process logs can be displayed this way.



I hope that the above clarifies what I am looking for.

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



Re: Re: [FR] Please add custom command variable to org-latex-footnote-refere

2024-04-20 Thread Pedro A. Aranda

/Hi, Alexander Gogl  writes: /> ox-latex: New option 
to customize LaTeX footnote command

I hope you are aware that with your patch you are not going to be aware to pass
extra options to your foot or side notes, right? And since I'm not familiar with
kaobook, just a question. Are you sure that the foot and side notes will not 
choke
at a \label{} inside the text?
//> PS: I have a hard time to setup an environment to test the patch because

my Spacemacs configuration conflicts with the Org mode development
version. Can anyone provide me a link to a ressource that describes the
procedure?


I'm running on a vanilla Emacs and

---cut here --
(let ((org-devel-path (expand-file-name "~/Devel/org-mode/lisp")))
  (when (file-directory-p org-devel-path)
;; (message "Adding %s to load-path" org-devel-path)
(add-to-list 'load-path  org-devel-path)))
---cut here --

in my .emacs.d/early-init.el does the job. I have a general Devel directyl for 
my development jobs.

Hope it helps, /PA

PS: Cool kaobook. I've used koma-script for most of my LaTeX work in the last 
15 years +/- ;-) though.