Re: [PATCH] Async evaluation in ob-shell

2023-03-01 Thread Matt

  On Wed, 22 Feb 2023 05:29:59 -0500  Ihor Radchenko  wrote --- 
 > > +(defun ob-shell-async-chunk-callback (string)
 > > +  "Filter applied to results before insertion.
 > > +See `org-babel-comint-async-chunk-callback'."
 > > +  (replace-regexp-in-string (concat org-babel-sh-prompt "*") "" string))
 > 
 > Why not using `comint-prompt-regexp'?
 > 
 > > +(ert-deftest test-ob-shell/session-async-valid-header-arg-values ()
 > > +  "Test that session runs asynchronously for certain :async values."
 > > +  (let ((session-name 
 > > "test-ob-shell/session-async-valid-header-arg-values")
 > > +(kill-buffer-query-functions nil))
 > > +(cl-loop
 > 
 > A simple `dolist' would do here. There is no reason to use `cl-loop'.

Great points!  Changed.

0002-ob-shell-Add-async-evaluation.patch
Description: Binary data


Re: ox-beamer/latex questions

2023-03-01 Thread Leo Butler
On Wed, Mar 01 2023, Leo Butler  wrote:

> On Wed, Mar 01 2023, Ihor Radchenko  wrote:

>> For cookies, just use stat:nil in OPTIONS. See "13.2 Export Settings"
>> section of the manual.
>
> Anyhow, it does not work correctly for subtree export (or I am not
> understanding something). The title still includes the cookie. See the
> attached.

Marking the subtree with `C-c @' before export does result in the cookie
being removed from the title.

Is there an easy explanation why marking the subtree matters? I.e. why
do

C-c @ C-c C-e C-s l P

and

C-c C-e C-s l P

work differently?

Leo


Re: ox-beamer/latex questions

2023-03-01 Thread Leo Butler
On Wed, Mar 01 2023, Ihor Radchenko  wrote:

> Leo Butler  writes:
>
>> I have a couple questions about TODO items, cookies and export. I am
>> unable to find anything the manual that seems relevant. Please see the
>> attached.
>
>> *** DONE:B_block:
>> :PROPERTIES:
>> :BEAMER_env: block
>> :END:
>> With =ox-beamer=, =TODO= markers mangle the output. That looks like a bug to 
>> me.
>
> This is because
>  *** DONE :B_block:
> is actually parsed as a heading with DONE todo keyword and title
> ":B_block:". Tag is not recognized.
>
> We probably need to fix it, though I am not sure. It is one of the edge
> cases about Org parser.

Ok. I have become addicted to using TODO tags to organize composition of
beamer slides. I often have untitled blocks in the slides, in order to
control the pacing of the presentation.

>
>> I would like to be able to remove the =TODO= cookies, =[1/2]= and =[0/1]=, 
>> on export.
>> How can I do that?
>
> For cookies, just use stat:nil in OPTIONS. See "13.2 Export Settings"
> section of the manual.

Thanks for that. I am not sure how I missed it.

Anyhow, it does not work correctly for subtree export (or I am not
understanding something). The title still includes the cookie. See the
attached.

TIA,
Leo

#+TITLE: ox-beamer/latex questions
#+AUTHOR: Leo Butler
#+OPTIONS: H:2 toc:t num:t tags:nil todo:nil stat:nil
#+LATEX_CLASS: beamer
#+LATEX_CLASS_OPTIONS: [presentation]
#+LATEX_COMPILER: lualatex
#+STARTUP: beamer

* TODO [1/2] ox-beamer/latex questions
** DONE [1/2] Outline
*** DONE Slide 1:B_block:
:PROPERTIES:
:BEAMER_env: block
:END:
The =DONE= tag and =[1/2]= cookie should be filtered out by
=stat:nil=. Thanks, Ihor.

*** TODO Slide 2:B_block:
:PROPERTIES:
:BEAMER_env: block
:END:
However, the title is still mangled when exporting just this heading using =C-c C-e C-s l P= on the heading.

* TODO A second question
** TODO [1/1] Questions
*** DONE:B_block:
:PROPERTIES:
:BEAMER_env: block
:END:
With =ox-beamer=, =TODO= markers mangle the output. That looks like a bug to me.
Ihor says this is an edge case.


ox-beamer-q.pdf
Description: ox-beamer-q.pdf


Effort range support broken? (est+)

2023-03-01 Thread Derek Chen-Becker
Hi,

I was just reading
https://randomthoughts.dk/posts/2023/org-mode-for-project-estimation/ and
started learning about columnview and org mode. One thing I've run into is
that effort range values seem to be broken. The last mention of this on the
mailing list was back in 2020 (
https://lists.gnu.org/archive/html/emacs-orgmode/2020-09/msg00571.html),
and it appears that the range support for effort is still broken. I'm
wondering if anyone knows how this could be fixed, since effort ranges
would be really helpful for estimation. I'm a passable elisper, so I'm
happy to help fix this if someone can point me in the right direction.

Thanks,

Derek

-- 
+---+
| Derek Chen-Becker |
| GPG Key available at https://keybase.io/dchenbecker and   |
| https://pgp.mit.edu/pks/lookup?search=derek%40chen-becker.org |
| Fngrprnt: EB8A 6480 F0A3 C8EB C1E7  7F42 AFC5 AFEE 96E4 6ACC  |
+---+


Re: How to produce an org-ref citation from ivy-bibtex

2023-03-01 Thread John Kitchin
The best place to report org-ref issues is
https://github.com/jkitchin/org-ref/issues.

On Wed, Mar 1, 2023 at 7:25 AM Sven Bretfeld  wrote:

> Hi John
>
> Thank you very much again. Elegant solution, and it works.
>
> I just wonder why I seem to be the only one on the list who had that
> problem. Am I so out of fashion to use org-ref and ivy/helm-bibtex
> together? I have been doing that for surely 10 years but had to stick
> with an old version of org-ref until recently (because of a completely
> different problem that I will post in another thread).
>
> Have a nice day,
>
> Sven
>
>
> Am Tue, Feb 28, 2023 at 12:07:35PM -0500 schrieb John Kitchin:
> > You can try something like this
> >
> > #+BEGIN_SRC emacs-lisp
> > (setq bibtex-completion-format-citation-functions
> >   '((org-mode  . (lambda (keys) (org-ref-insert-cite-keys keys)
> ""))
> > (latex-mode. bibtex-completion-format-citation-cite)
> > (markdown-mode .
> bibtex-completion-format-citation-pandoc-citeproc)
> > (default   . bibtex-completion-format-citation-default)))
> > #+END_SRC
> >
> > it seems like ivy-bibtex at least expects some kind of string to be
> returned,
> > but org-ref-insert-cite-keys does the insertion for you.
> >
> > On Sun, Feb 26, 2023 at 11:19 AM Sven Bretfeld <[1]sven.bretf...@ntnu.no
> >
> > wrote:
> >
> > Hi everybody
> >
> > Is it at all possible to produce a correct org-ref citation format
> > from ivy-bibtex (or helm-bibtex, I tried both)? What I mean by
> > "correct" is the format: [[cite:]].
> >
> > The problem seems to come down to the question what has to be
> inserted
> > in the 2nd line here:
> >
> > (setq bibtex-completion-format-citation-functions
> >   '((org-mode  . ??)
> > (latex-mode. bibtex-completion-format-citation-cite)
> > (markdown-mode .
> bibtex-completion-format-citation-pandoc-citeproc)
> > (default   . bibtex-completion-format-citation-default)))
> >
> > (A) Not setting the variable at all, defaults to producing an ebib
> > link which is of no use to me at all.
> >
> > (B) Putting org-ref-helm-bibtex-insert-citation here (as found on
> > reddit) does not work, since the function does not seem to exist
> > anymore.
> >
> > (C) Putting org-ref-insert-cite-link here is obviously wrong.
> Choosing
> > that from the list of ivy-bibtex-actions, just calls the function
> > interactively, you have to search for the bib-entry again and the
> > resulting link looks like: [[cite:]]^&. The terminating '^&'
> > obviously makes subsequent LaTeX-exports fall.
> >
> > (D) Putting "bibtex-completion-format-citation-org-cite" here,
> > produces standard org-links: [cite:@citekey]. These are not
> correctly
> > exported to a tex file when the org-ref package is loaded.
> >
> > The only working solution I have found is to use org-ref's own cite
> > function org-ref-insert-cite-link. I know that ivy-bibtex can be set
> > as backend (require 'org-ref-ivy). But in this way ivy-bibtex's other
> > actions (like opening an associated PDF or note file) are lost.
> >
> > It would be nice to be able to use a SINGLE key-binding to select a
> > bib-entry and then decide what to do with it (insert org reference,
> > insert tex reference, open pdf, etc.). This was possible earlier (I
> > did that for years with older versions of org-ref-helm) but is
> > apparently no longer possible now.
> >
> > Many thanks for help and suggestions,
> >
> > Sven
> >
> >
> >
> > References:
> >
> > [1] mailto:sven.bretf...@ntnu.no
>
>

-- 
ohn

---
Professor John Kitchin (he/his)
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
https://kitchingroup.cheme.cmu.edu
https://pointbreezepubs.gumroad.com/ pycse bookstore


Re: How to produce an org-ref citation from ivy-bibtex

2023-03-01 Thread Sven Bretfeld
Hi John

Thank you very much again. Elegant solution, and it works.

I just wonder why I seem to be the only one on the list who had that
problem. Am I so out of fashion to use org-ref and ivy/helm-bibtex
together? I have been doing that for surely 10 years but had to stick
with an old version of org-ref until recently (because of a completely
different problem that I will post in another thread).

Have a nice day,

Sven


Am Tue, Feb 28, 2023 at 12:07:35PM -0500 schrieb John Kitchin:
> You can try something like this
> 
> #+BEGIN_SRC emacs-lisp
> (setq bibtex-completion-format-citation-functions
>   '((org-mode  . (lambda (keys) (org-ref-insert-cite-keys keys) ""))
> (latex-mode. bibtex-completion-format-citation-cite)
> (markdown-mode . bibtex-completion-format-citation-pandoc-citeproc)
> (default   . bibtex-completion-format-citation-default)))
> #+END_SRC
> 
> it seems like ivy-bibtex at least expects some kind of string to be returned,
> but org-ref-insert-cite-keys does the insertion for you.
> 
> On Sun, Feb 26, 2023 at 11:19 AM Sven Bretfeld <[1]sven.bretf...@ntnu.no>
> wrote:
> 
> Hi everybody
> 
> Is it at all possible to produce a correct org-ref citation format
> from ivy-bibtex (or helm-bibtex, I tried both)? What I mean by
> "correct" is the format: [[cite:]].
> 
> The problem seems to come down to the question what has to be inserted
> in the 2nd line here:
> 
> (setq bibtex-completion-format-citation-functions
>   '((org-mode  . ??)
> (latex-mode. bibtex-completion-format-citation-cite)
> (markdown-mode . 
> bibtex-completion-format-citation-pandoc-citeproc)
> (default   . bibtex-completion-format-citation-default)))
> 
> (A) Not setting the variable at all, defaults to producing an ebib
> link which is of no use to me at all.
> 
> (B) Putting org-ref-helm-bibtex-insert-citation here (as found on
> reddit) does not work, since the function does not seem to exist
> anymore.
> 
> (C) Putting org-ref-insert-cite-link here is obviously wrong. Choosing
> that from the list of ivy-bibtex-actions, just calls the function
> interactively, you have to search for the bib-entry again and the
> resulting link looks like: [[cite:]]^&. The terminating '^&'
> obviously makes subsequent LaTeX-exports fall.
> 
> (D) Putting "bibtex-completion-format-citation-org-cite" here,
> produces standard org-links: [cite:@citekey]. These are not correctly
> exported to a tex file when the org-ref package is loaded.
> 
> The only working solution I have found is to use org-ref's own cite
> function org-ref-insert-cite-link. I know that ivy-bibtex can be set
> as backend (require 'org-ref-ivy). But in this way ivy-bibtex's other
> actions (like opening an associated PDF or note file) are lost.
> 
> It would be nice to be able to use a SINGLE key-binding to select a
> bib-entry and then decide what to do with it (insert org reference,
> insert tex reference, open pdf, etc.). This was possible earlier (I
> did that for years with older versions of org-ref-helm) but is
> apparently no longer possible now.
> 
> Many thanks for help and suggestions,
> 
> Sven
> 
> 
> 
> References:
> 
> [1] mailto:sven.bretf...@ntnu.no



Re: [ANN] orgtbl-fit

2023-03-01 Thread tbanelwebmin

  
  


On 2/20/23 11:50, Ihor Radchenko wrote:


  tbanelwebmin  writes:


  

  
Examples & documentation can be read here:
https://github.com/tbanel/orgtblfit/blob/main/README.org

  
  Interesting.
Could it be somehow integrated with TBLFM formulas?
I imagine something like

? +?*year +?*passengers +?*(year-2016)*passengers

, when set as a column value in table formula, to be auto-updated with
actual coefficients upon re-calculating the table.
...


We need to specify the target column ("consumption" in this example). 
Therefore, the formula could be something like that:

$4 = fit (consumption = ? +?*year +?*passengers +?*(year-2016)*passengers)
It would benefit from other spreadsheet features, like constants and 
remote references.

  
  
Makes sense.


  
On the development side, the TBLFM handling is already quite a big chunk 
of code. We must take care that such an additional feature do not add 
complexity and maintenance burden.

  
  
>From point of view of org-table.el, adding fitting functionality is
mostly delegating the work to GNU Calc. Org side is just parsing the
formula and transforming it to appropriate Calc function call.


Absolutely.

From Org table to Calc and back to Org table is what the orgtbl-fit
package does. Currently it is around 400 lines of Elisp and 700
lines of unit tests.


  

So, given that the parsing is extended cleanly, I do not think that
maintenance burden will increase all that much. It may even benefit from
someone taking a fresh look and possibly refactoring org-table TBLFM
parser.


Most likely.


  


  
Orgtbl-fit as-is


It is also possible to include orgtbl-fit as-is into Org Mode core. It 
would sit side-by-side with the core without changing anything in its 
code and its unit-tests.

  
  
IMHO, it is not sufficiently integrated with org-table.el facilities in
its current state. I'm afraid that we will have code duplication if
include orgtbl-fit as is.


Yes. One of the benefits from a fresh look you were talking about,
would be avoiding code duplication.


  

BTW, the dollar replacement is something org-table can benefit from---a
number of people are confused because "$" is treated specially by Calc.


I'm not sure what you mean. The dollar in spreadsheet formulas?
Like:
#+TBLFM: $6=$5+1


  


  
Data-analysis toolkit
-

 From a higher perspective, we could give a consistent data-analysis 
toolkit to Org Mode (and call it org-data-analysis.el).

It would start with fitting, clustering & aggregation. Then, new 
algorithms would be added upon user requests.

Of course, there should be an interest among Org Mode users for such a 
toolkit.

  
  
We can, but it should be first and foremost added to GNU Calc. On Org
side, we just need appropriate integration. Maintaining generic data
analysis code in Org is out of Org's scope.


Absolutely

Although the latest Calc release seams to be 2.02f, dating back in
January 1992. Has it reached perfection 31 years ago?


  

Contributing to GNU Calc will also benefit GNU Calc users who don't use
Org mode.




  




Allow org-agenda-switch-to to restore the previous window configuration

2023-03-01 Thread Marvin J.
Org-agenda provides the possibility to automatically restore the previous
window configuration after closing the agenda buffer using org-agenda-quit
(bound to q). This is achieved by setting
org-agenda-restore-windows-after-quit to t.

However, there is also another way to "exit" the agenda, namely by calling
org-agenda-switch-to (bound to RET) on an appropriate item. However, this
command currently does not take the previous window configuration into
account.

I thus propose adding a new variable named e.g.
org-agenda-restore-windows-after-switch that controls whether the command
org-agenda-switch-to will restore the previous window configuration before
switching to the Org mode file of the item at point.

An example scenario where this is useful: Suppose you have a sophisticated
window configuration and call org agenda with org-agenda-window-setup set
to only-window. Then you want that window configuration to be restored also
when exiting the agenda view via org-agenda-switch-to. Otherwise, you would
lose your precious window configuration.

This behavior could be achieved by adding something like

(when (and org-agenda-restore-windows-after-switch
org-agenda-pre-window-conf)
  (set-window-configuration org-agenda-pre-window-conf))

before the call of pop-to-buffer-same-window within org-agenda-switch-to.


Re: [POLL] Naming of "export features"

2023-03-01 Thread Pedro Andres Aranda Gutierrez
Hi Igor

Actually, not including the line makes the MWE work, so you don't
_need_ it as such when there is no bibliography.

When I set org-cite-export-processors in my Emacs setup (for my 99.9%
of cases),
I still can set it to nil in the local variables of the .org file when
I don't want/need
bibtex/biblatex processing (Minor inconvenience I can assume).

It's in the docstring and I should have read it but
still, it's a bit confusing and
a more verbose explanation in the manual may help in the future...

Just my .2 cents... /PA

On Wed, 1 Mar 2023 at 10:40, Ihor Radchenko  wrote:
>
> Pedro Andres Aranda Gutierrez  writes:
>
> > One thing is having
> > ```
> > (setq org-cite-export-processors '((beamer . biblatex)
> > (latex .  biblatex)))
> > ```
>
> Not a bug.
> You need
>
> (setq org-cite-export-processors '((beamer biblatex)
> (latex biblatex)))
>
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at .
> Support Org development at ,
> or support my work at 



-- 
Fragen sind nicht da um beantwortet zu werden,
Fragen sind da um gestellt zu werden
Georg Kreisler

Headaches with a Juju log:
unit-basic-16: 09:17:36 WARNING juju.worker.uniter.operation we should
run a leader-deposed hook here, but we can't yet



Re: [PATCH] Avoid crash in `org-file-contents' in case of network failure

2023-03-01 Thread Ihor Radchenko
Bastien Guerry  writes:

>> Bastien, could you please check FSF records?
>
> I confirm Damien's FSF record is in order.

Thanks!
Added to contributor list: https://git.sr.ht/~bzg/worg/commit/ada245e4

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



Re: [FR] Allow to #+include files verbatim without any processing (was: Have export treat file: paths in INCLUDED file relative to the INCLUDING file's dir)

2023-03-01 Thread Ihor Radchenko
Timothy  writes:

> Hi Ihor,
>
>> This sounds like a reasonable request.
>> What we may do here is allowing a new parameter :verbatim
>
> From a read of the original email, it sounds like a `:dir' parameter could 
> also
> solve this use case, and allow for a bit more flexibility.

Sure, but is this particular use-case common? Do people generally need
to leave the links as is, but adjust everything else?

`org-export--prepare-file-contents' does the following:
1. Indents everything from beginning of requested part of the file down
   to the first heading, if #+INCLUDE keyword itself is indented.
2. Updates the link paths
3. Removes the blank lines at the beginning/end of the included region
4. Adjusts heading levels, promoting when INCLUDE is inside another heading
5. Changes footnote references and definitions to make them unique and
   not clash with other files included

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



Re: ox-beamer/latex questions

2023-03-01 Thread Ihor Radchenko
Leo Butler  writes:

> I have a couple questions about TODO items, cookies and export. I am
> unable to find anything the manual that seems relevant. Please see the
> attached.

> *** DONE:B_block:
> :PROPERTIES:
> :BEAMER_env: block
> :END:
> With =ox-beamer=, =TODO= markers mangle the output. That looks like a bug to 
> me.

This is because
 *** DONE :B_block:
is actually parsed as a heading with DONE todo keyword and title
":B_block:". Tag is not recognized.

We probably need to fix it, though I am not sure. It is one of the edge
cases about Org parser.

> I would like to be able to remove the =TODO= cookies, =[1/2]= and =[0/1]=, on 
> export.
> How can I do that?

For cookies, just use stat:nil in OPTIONS. See "13.2 Export Settings"
section of the manual.

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



Re: [POLL] Naming of "export features"

2023-03-01 Thread Ihor Radchenko
Pedro Andres Aranda Gutierrez  writes:

> One thing is having
> ```
> (setq org-cite-export-processors '((beamer . biblatex)
> (latex .  biblatex)))
> ```

Not a bug.
You need

(setq org-cite-export-processors '((beamer biblatex)
(latex biblatex)))

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



Re: Broken org-persist-storage probably leads to ‘org-open-at-point’ ask for TAGS file

2023-03-01 Thread Ihor Radchenko
Göktuğ Kayaalp  writes:

> I have discovered a weird behaviour that I have tracked back to
> org-persist and org-element-cache, where after some time, when I try to
> follow a document internal link in org mode, whether to a headline or to
> a =<>=, it would ask me to load a TAGS file, I think somewhat
> like how xref might ask you to do when you call say
> ‘xref-find-definitions’.
> ...

It appears to me that you had an issue with cache at some point, and then
it got propagated to disk, and triggered later on unrelated command.

May you set `org-element--cache-self-verify-frequency' to a larger value
and later let us know if you start seeing warnings from
org-element-cache?

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



Re: [POLL] Naming of "export features"

2023-03-01 Thread Pedro Andres Aranda Gutierrez
Hi,

before I forget, I have been thinking about this a lot. It may look
tangetial but IMHO it is not...

One thing is having
```
(setq org-cite-export-processors '((beamer . biblatex)
(latex .  biblatex)))
```
in your emacs configuration (because you need it for most situations)
and another thing is that this options forces the export process to
check that you are using a bibliography in each and every document you
generate. I may want to write a quick document  with org-mode and
generate a PDF with the LaTEX backend and another thing is that I will
need to include a bibliography even if I don't need it.

Currently, with that config for ox-latex, this MWE chokes because
their is no reference to a bibliography:

-- mwe.org -
#+LATEX_CLASS: letter
#+DATE: 01-Mar-2023

Dear friends!

It sucks a bit to need a bibliography to export this letter!

Best, /PA
---
This is the minimal emacs config that chokes at PDF export (C-c C-e lo)
- mwe.el -
(require 'org)
(require 'ox-latex)
(setq org-cite-export-processors '((beamer . biblatex)
   (latex .  biblatex)))
(setq org-latex-pdf-process
  '("latexmk -pdflatex='pdflatex --shell-escape
--interaction=nonstopmode' -pdf -f %f"))
(add-to-list 'org-latex-classes
 '("letter"
   "\\documentclass[a4paper]{letter}"))
---

To try:

emacs -Q -l mwe.el mwe.org

and then C-c C-e l o in Emacs to get the attached error message and no PDF.

This is all on

GNU Emacs 30.0.50
Development version fad366506974 on master branch; build date 2023-02-23.

It would be nice to take this discussion as an opportunity to 'fix' this

Best, /PA

-- 
Fragen sind nicht da um beantwortet zu werden,
Fragen sind da um gestellt zu werden
Georg Kreisler

Headaches with a Juju log:
unit-basic-16: 09:17:36 WARNING juju.worker.uniter.operation we should
run a leader-deposed hook here, but we can't yet