org-agenda-dim-blocked-tasks don't use org-todo face

2022-12-11 Thread Mark Kerr
The org-todo face is used for todo keywords in non-blocked items.

When org-agenda-dim-blocked-tasks is set to true, however, the todo keyword
is instead displayed using org-agenda-dimmed-todo-face.

The org-priority face, however, is still used for blocked tasks.

Is this by design or due to an error on my part? Is there a possible
workaround?


Re: Org functions in source blocks

2022-12-11 Thread William Denton

On 10 December 2022, Max Nikulin wrote:

@I$A and the "remote" function are available in table formulas only. Moreover 
you quoted remote, so this s-expression is not evaluated. In addition, unlike 
in table formulas, in elisp function arguments are separated by space, not by 
comma.


Thanks for your explanation about this and the rest.  I have a better sense now 
of what works where and how Elisp code blocks can interact with the Org document 
they're in.  I'll be back with more questions eventually, I'm sure, but for now 
just learning about all the table features I've overlooked so far will keep me 
busy.


Bill

--
William Denton
https://www.miskatonic.org/
Librarian, artist and licensed private investigator.
Toronto, Canada



Re: Images generated by R code blocks do not display

2022-12-11 Thread William Denton

On 10 December 2022, Ihor Radchenko wrote:


Ihor Radchenko  writes:


I now reported this to Emacs upstream.
I do not see anything wrong on Org side in this case.
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=59902


Since the bug will affect older Emacs versions, I pushed a workaround to
bugfix.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=7fefc3027

It will no longer be necessary when Emacs fixes the issue and when we
stop supporting all the older Emacs versions with this bug being present.


Thank you!  It's so nice to have this working again.  I have a couple of Org 
files where I'm updating data and images a few times a week, and when this broke 
it was a real pain---particularly because everything had worked so well for so 
long.  Now my life is easy again.  I appreciate your work on this and everything 
else, Ihor.


Bill

--
William Denton
https://www.miskatonic.org/
Librarian, artist and licensed private investigator.
Toronto, Canada



Re: Flyspell causes severe slowdown when manipulating footnotes

2022-12-11 Thread arozbiz
Thanks. It definitely helps, but it's still quite slow. What's made the
biggest difference is is advising the relevant functions to turn flyspell
off beforehand and then turn it back on.

```
(defun azr/org-footnote-disable-flyspell (orig-fun  args)
  (flyspell-mode -1)
  (apply orig-fun args)
  (flyspell-mode))

(advice-add 'org-footnote-new :around #'azr/org-footnote-disable-flyspell)
(advice-add 'org-footnote-delete :around
#'azr/org-footnote-disable-flyspell)
```

Best,
Alan

On Sat, Dec 10, 2022 at 4:24 AM Ihor Radchenko  wrote:

> aroz...@gmail.com writes:
>
> > Thanks Ihor for the response. Unfortunately, setting
> > org-element--cache-self-verify to nil didn't work. Profile report
> attached.
>
> Thanks!
> I just pushed a slight optimization to the footnote sorting code.
> Can you try again using the latest main?
>
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=169333e1c
>
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at .
> Support Org development at ,
> or support my work at 
>


Re: [PATCH] ob-core: add org-confirm-babel-evaluate-cell custom variable

2022-12-11 Thread Tom Gillespie
> Please use :package-version and let the mapping be handled by
> customize-package-emacs-version-alist.

Got it. Here's the updated patch (I think I did it correctly?).
From 47a47aa9453a54a4f5f2e9188e2ad072a77c50cb Mon Sep 17 00:00:00 2001
From: Tom Gillespie 
Date: Sat, 10 Dec 2022 12:11:17 -0800
Subject: [PATCH] ob-core: add org-confirm-babel-evaluate-cell custom variable

* lisp/ob-core.el (org-confirm-babel-evaluate-cell): Added to control
execution of cells separate from execution of src blocks, it works in
exactly the same way as org-confirm-babel-evaluate.
* lisp/ob-core.el (org-babel-read): org-confirm-babel-evaluate-cell is
now used to check cells independent of org-confirm-babel-evaluate.

Following the change in 10e857d42859a55b23cd4206ffce3ebd0f678583 it
became extremely annoying to tangle files that make extensive use of
elisp expression in src block #+header: statements.

This commit resolves the issue by making it possible to ignore checks
on cells (the old behavior) without compromising general security for
running src blocks.

This is necessary because there is no easy way to hop swap
org-confirm-babel-evaluate between org-get-src-block-info where
org-babel-read is called and the execution of that src block. It could
probably be done using advice around org-babel-read, but that is a
level of hackery that should be avoided.
---
 lisp/ob-core.el | 20 
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index 62b0d3612..aa73a9cbc 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -128,6 +128,15 @@ remove code block execution from the `\\[org-ctrl-c-ctrl-c]' keybinding."
 ;; don't allow this variable to be changed through file settings
 (put 'org-confirm-babel-evaluate 'safe-local-variable (lambda (x) (eq x t)))
 
+(defcustom org-confirm-babel-evaluate-cell t
+  "Confirm before evaluating a cell.
+This follows the same conventions as `org-confirm-babel-evaluate'."
+  :group 'org-babel
+  :package-version '(Org . "9.6")
+  :type '(choice boolean function))
+;; don't allow this variable to be changed through file settings
+(put 'org-confirm-babel-evaluate-cell 'safe-local-variable (lambda (x) (eq x t)))
+
 (defcustom org-babel-no-eval-on-ctrl-c-ctrl-c nil
   "\\\
 Remove code block evaluation from the `\\[org-ctrl-c-ctrl-c]' key binding."
@@ -3180,11 +3189,14 @@ situations in which is it not appropriate."
 		  (string= cell "*this*")))
  ;; Prevent arbitrary function calls.
  (if (and (memq (string-to-char cell) '(?\( ?`))
+  (if (functionp org-confirm-babel-evaluate-cell)
+  (funcall org-confirm-babel-evaluate-cell "emacs-lisp" cell)
+org-confirm-babel-evaluate-cell)
   (not (org-babel-confirm-evaluate
-  ;; See `org-babel-get-src-block-info'.
-  (list "emacs-lisp" (format "%S" cell)
-'((:eval . yes)) nil (format "%S" cell)
-nil nil
+;; See `org-babel-get-src-block-info'.
+(list "emacs-lisp" (format "%S" cell)
+  '((:eval . yes)) nil (format "%S" cell)
+  nil nil
  ;; Not allowed.
  (user-error "Evaluation of elisp code %S aborted." cell)
 	   (eval (read cell) t)))
-- 
2.37.4



Re: [PATCH] lisp/org-expiry.el: Account for org-time-stamp-formats

2022-12-11 Thread Tom Gillespie
Looks like string-replace doesn't support that notation,
so both too aggressive and without sufficient control.
I've switched to replace-regexp-in-string which does
what we want.

Here's the updated patch.
From 12ca29965e867acd64fecaecd14f2f74e90d7e99 Mon Sep 17 00:00:00 2001
From: Tom Gillespie 
Date: Sun, 4 Dec 2022 01:02:35 -0800
Subject: [PATCH] lisp/org-expiry.el: Account for org-time-stamp-formats
 refactor

* lisp/org-expiry.el (org-expiry-insert-created)
(org-expiry-insert-expiry): timestamp formats dropped delimiters so a
slight modification is required following org commit
e3a7c01874c9bb80e04ffa58c578619faf09e7f0, the change is made backward
compatible by removing < and > from the old timestamp format
---
 lisp/org-expiry.el | 22 ++
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/lisp/org-expiry.el b/lisp/org-expiry.el
index 98ad58a..0462735 100644
--- a/lisp/org-expiry.el
+++ b/lisp/org-expiry.el
@@ -299,10 +299,13 @@ update the date."
   (setq d-hour (format-time-string "%H:%M" d-time))
   (setq timestr
 	;; two C-u prefixes will call org-read-date
-	(if (equal arg '(16))
-		(concat "<" (org-read-date
-			 nil nil nil nil d-time d-hour) ">")
-	  (format-time-string (cdr org-time-stamp-formats
+(concat "<"
+(if (equal arg '(16))
+(org-read-date nil nil nil nil d-time d-hour)
+  (format-time-string
+   (replace-regexp-in-string "\\(^<\\|>$\\)" ""
+   (cdr org-time-stamp-formats
+">"))
   ;; maybe transform to inactive timestamp
   (if org-expiry-inactive-timestamps
 	  (setq timestr (concat "[" (substring timestr 1 -1) "]")))
@@ -320,10 +323,13 @@ and insert today's date."
 (setq d-time (if d (org-time-string-to-time d)
 		   (current-time)))
 (setq d-hour (format-time-string "%H:%M" d-time))
-(setq timestr (if today
-		  (format-time-string (cdr org-time-stamp-formats))
-		(concat "<" (org-read-date
- nil nil nil nil d-time d-hour) ">")))
+(setq timestr (concat "<"
+  (if today
+  (format-time-string
+   (replace-regexp-in-string "\\(^<\\|>$\\)" ""
+   (cdr org-time-stamp-formats)))
+(org-read-date nil nil nil nil d-time d-hour))
+  ">"))
 ;; maybe transform to inactive timestamp
 (if org-expiry-inactive-timestamps
 	(setq timestr (concat "[" (substring timestr 1 -1) "]")))
-- 
2.37.4



Re: [PATCH] ob-core: add org-confirm-babel-evaluate-cell custom variable

2022-12-11 Thread Kyle Meyer
Tom Gillespie writes:

[...]
>> :package-version instead of :version?
>
> I think because org is part of emacs core we use the emacs version?

Please use :package-version and let the mapping be handled by
customize-package-emacs-version-alist.

> I see "24.1" included with other org defcustoms.

There has a been a good amount of clean up to remove :version and use
:package-version, but, yes, there are still :version instances.  Things
look good for the last Org release, though:

  $ git grep '29\.1'
  lisp/org.el:   ("9.6" . "29.1")))




Re: [PATCH] ob-core: add org-confirm-babel-evaluate-cell custom variable

2022-12-11 Thread Tom Gillespie
Here is an updated version of the patch with the convention
corrected and the docstring updated for clarity. It would be
great to try to get this into any 9.6 patches before the 29
release, but I'm not sure if that is possible. If it is missing
we are likely to get a lot of messages from unhappy users.
Best!
Tom
From 54e468b60f17b54d81edafd8ee9e22311e519793 Mon Sep 17 00:00:00 2001
From: Tom Gillespie 
Date: Sat, 10 Dec 2022 12:11:17 -0800
Subject: [PATCH] ob-core: add org-confirm-babel-evaluate-cell custom variable

* lisp/ob-core.el (org-confirm-babel-evaluate-cell): Added to control
execution of cells separate from execution of src blocks, it works in
exactly the same way as org-confirm-babel-evaluate.
* lisp/ob-core.el (org-babel-read): org-confirm-babel-evaluate-cell is
now used to check cells independent of org-confirm-babel-evaluate.

Following the change in 10e857d42859a55b23cd4206ffce3ebd0f678583 it
became extremely annoying to tangle files that make extensive use of
elisp expression in src block #+header: statements.

This commit resolves the issue by making it possible to ignore checks
on cells (the old behavior) without compromising general security for
running src blocks.

This is necessary because there is no easy way to hop swap
org-confirm-babel-evaluate between org-get-src-block-info where
org-babel-read is called and the execution of that src block. It could
probably be done using advice around org-babel-read, but that is a
level of hackery that should be avoided.
---
 lisp/ob-core.el | 20 
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index 62b0d3612..60dabab0a 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -128,6 +128,15 @@ remove code block execution from the `\\[org-ctrl-c-ctrl-c]' keybinding."
 ;; don't allow this variable to be changed through file settings
 (put 'org-confirm-babel-evaluate 'safe-local-variable (lambda (x) (eq x t)))
 
+(defcustom org-confirm-babel-evaluate-cell t
+  "Confirm before evaluating a cell.
+This follows the same conventions as `org-confirm-babel-evaluate'."
+  :group 'org-babel
+  :version "29.1"
+  :type '(choice boolean function))
+;; don't allow this variable to be changed through file settings
+(put 'org-confirm-babel-evaluate-cell 'safe-local-variable (lambda (x) (eq x t)))
+
 (defcustom org-babel-no-eval-on-ctrl-c-ctrl-c nil
   "\\\
 Remove code block evaluation from the `\\[org-ctrl-c-ctrl-c]' key binding."
@@ -3180,11 +3189,14 @@ situations in which is it not appropriate."
 		  (string= cell "*this*")))
  ;; Prevent arbitrary function calls.
  (if (and (memq (string-to-char cell) '(?\( ?`))
+  (if (functionp org-confirm-babel-evaluate-cell)
+  (funcall org-confirm-babel-evaluate-cell "emacs-lisp" cell)
+org-confirm-babel-evaluate-cell)
   (not (org-babel-confirm-evaluate
-  ;; See `org-babel-get-src-block-info'.
-  (list "emacs-lisp" (format "%S" cell)
-'((:eval . yes)) nil (format "%S" cell)
-nil nil
+;; See `org-babel-get-src-block-info'.
+(list "emacs-lisp" (format "%S" cell)
+  '((:eval . yes)) nil (format "%S" cell)
+  nil nil
  ;; Not allowed.
  (user-error "Evaluation of elisp code %S aborted." cell)
 	   (eval (read cell) t)))
-- 
2.37.4



Re: [PATCH] ob-core: add org-confirm-babel-evaluate-cell custom variable

2022-12-11 Thread Tom Gillespie
Hi Max,
   Thank you for the feedback. More replies in lines. Best!
Tom

> I am not sure concerning "exactly".
>
> lisp/ob-core.el:248
> `org-confirm-babel-evaluate' is called with 2 arguments. In your patch
> `org-confirm-babel-evaluate-cell' has a single argument.

You're right, and in point of fact I should have retained the structure
exactly because in other contexts I have thought about ways to use
other languages in contexts like that. At the moment everything is
elisp so I dropped the argument, but that is clearly a mistake.

> It seems, you do not change defaults. Could you, please, provide an
> example of configuration that is less annoying, but still safe?

#+begin_src elisp :results none
(setq-local
 org-confirm-babel-evaluate-cell
 (lambda (lang body)
   (ignore lang)
   (let ((rb (read body)))
 (not ; aka (unless condition t)
  (or
   (member rb
   '((or)
 (and)
 ;; add more forms that are known safe here
 ))
   (and
(eq (car rb) 'identity)
(let ((v (cadr rb)))
  (or
   (symbolp v)
   (stringp v)
   (numberp v)
   
#+end_src

#+header: :var v1=(or) v2=(and) v3=(identity nil)
#+header: :var v4=(identity default-directory) v5=(identity #o0755)
#+header: :var v6=(identity "not sure why you would want to do this")
#+header: :var v7=(identity (concat "this" "will" "fail"))
#+header: :var v8="reminder that strings are ok"
#+begin_src elisp
(mapcar
 #'list
 (list v1 v2 v3 v4 v5 v6 v7 v8))
#+end_src

> I was thinking if it is possible to collect requests to confirm and to
> allow the user to decide for the whole bunch of expressions and code
> blocks. Besides implementation issues, there is a question concerning UI
> that will allow to inspect code to be evaluated.

Yes, in the example above I thought about including something
with a yes-or-no-p where users could quickly add forms to a
safe list some (defcustom org-known-safe-cells '()) or something
like that. A user could do that with the new machinery, and we
could do the same for the default implementation. I think that
is the next step once we get the basics in place.

> Calling convention for the case of function value is not described. If
> it is really the same as for `org-confirm-babel-evaluate' then this user
> option should be mentioned in the docstring.

When I correct the function signature to actually match
I will make a note in the docstring.

> :package-version instead of :version?

I think because org is part of emacs core we use the emacs version?
I see "24.1" included with other org defcustoms.

> Is there any reason to not use the :safe property of `defcustom'? I see
> that you take definition of `org-confirm-babel-evaluate' as a template
> so I wonder if there is some particular reason or the original code was
> just written before introducing of :safe.

I'm guessing that it was written before :safe, but don't
know for sure. A systematic cleanup of stuff like that
could come after this maybe?



Re: [PATCH] oc-csl: Improve LaTeX bibliography formatting

2022-12-11 Thread András Simonyi
Dear All,

first of all, apologies for the delay, unfortunately, I haven't been
able to work on my WIP patches for a while. Now I've attached a new
version of the patch, which hopefully addresses all issues discussed
earlier.

best wishes,
András

On Tue, 8 Nov 2022 at 06:26, Ihor Radchenko  wrote:
>
> András Simonyi  writes:
>
> >> Also, it would be nice to describe CSL usage and tweaks in the manual.
> >
> > Time permitting I may try to add something, but wouldn't it be a
> > problem if the CSL export processor was discussed in much more detail
> > than the others?
> > I was also thinking about providing a list of available citation
> > substyles but I do not want to make the manual very unbalanced.
>
> Maybe not in the release, but otherwise we need to finish the citation
> section of the manual one way or another. May as well start from CSL
> part.
>
> >> I have two comments here:
> >> 1. Where are all these new commands coming from? They are not used
> >>directly in the code. Are you tweaking citeproc.el output this way? May
> >>it be better to use customizations provided by citeproc.el itself?
> >
> > Yes, the citeproc org-latex formatter, which I added specifically for
> > Org, uses these commands in the LaTeX code produced for the
> > bibliography. As citeproc doesn't have customizable variables by
> > design (if I recall correctly, the only exception is 2 hooks), and
> > oc-csl already had some variables concerned with very similar
> > formatting settings (org-cite-csl-latex-hanging-indent,
> > org-cite-csl-html-hanging-indent,
> > org-cite-csl-html-label-width-per-char) I think it is more consistent
> > to have the new ones also in Org.
>
> Thanks for the clarification. I'd prefer to see a similar explanation
> and the details about what the LaTeX variables/commands do in the
> docstring.
>
> >> 2. You are declaring this variable as defcustom, but it is not clear
> >>what is going to happen if the user changes it. It is not how to
> >>change this template in meaningful ways either.
> >
> > Right, I can try to detail a bit in the docstring what type of
> > commands and environments have to be provided by the preamble (are
> > expected by citeproc). I tried to follow Timothy's handling of the
> > ox-latex engraved preamble, but a simpler alternative would be to
> > treat it simply as a constant template, at least for the time being --
> > WDYT?
>
> Note that `org-latex-engraved-preamble' explains which packages need to
> be loaded and which commands need to be defined in the preamble. This at
> least make it more clear what the users may change and not break the
> export.
>
> I see not problem keeping this a defcustom, but we definitely need to
> explain the default value and what is required to be in there. At least,
> to make the code readable for future contributors.
>
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at .
> Support Org development at ,
> or support my work at 
From 7f02881ff1ef9c3dd3eca0cd63a91936dcb90a45 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A1s=20Simonyi?= 
Date: Sun, 11 Dec 2022 18:03:39 +0100
Subject: [PATCH] oc-csl: Improve LaTeX bibliography formatting

* lisp/oc-csl.el (org-cite-csl--output-format): Use the dedicated
'org-latex' citeproc formatter to export references in LaTeX.
(org-cite-csl-latex-preamble, org-cite-csl--generate-latex-preamble,
org-cite-csl-finalizer): Insert a preamble fragment compatible with
the 'org-latex' citeproc formatter.
(org-cite-csl-latex-label-separator,
org-cite-csl-latex-label-width-per-char): Introduce additional
variables to control bibliography formatting.

* etc/ORG-NEWS: Describe the introduced new options.
---
 etc/ORG-NEWS   |  11 +
 lisp/oc-csl.el | 126 ++---
 2 files changed, 120 insertions(+), 17 deletions(-)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 5d5e726e0..6441cdc1f 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -12,6 +12,17 @@ See the end of the file for license conditions.
 Please send Org bug reports to mailto:emacs-orgmode@gnu.org.
 
 * Version 9.7 (not released yet)
+
+** New options
+*** New custom settings for the "csl" citation export processor's LaTeX output
+
+The settings ~org-cite-csl-latex-label-separator~ and
+~org-cite-csl-latex-label-width-per-char~ allow the user to control
+the horizontal positioning of entry labels for labeled bibliography
+styles, and the setting ~org-cite-csl-latex-preamble~ makes it
+possible to customize the entire fragment that is injected into the
+preamble when the "csl" citation processor is used for LaTeX export.
+
 * Version 9.6
 
 ** Important announcements and breaking changes
diff --git a/lisp/oc-csl.el b/lisp/oc-csl.el
index 1ccb74e92..e3f57918c 100644
--- a/lisp/oc-csl.el
+++ b/lisp/oc-csl.el
@@ -214,6 +214,92 @@ Used only when `second-field-align' is activated by the used 

Re: [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-12-11 Thread Robert Weiner
Hi Ihor:

So if we want to determine the Org type of an element outside of an Org
buffer (when using org-type minor modes for example), how would we change
this 'let' code:

 (let* ((context
 ;; Only consider supported types, even if they are not
 ;; the closest one.
 (org-element-lineage
  ;; Next line can trigger an error when `looking-at' is called
  ;; with a `nil' value of `org-complex-heading-regexp'.
  (org-element-context)
  '(clock footnote-definition footnote-reference headline
inlinetask link timestamp)
  t))
(type (org-element-type context))
 ...)

Thanks,

Bob

On Sat, Oct 22, 2022 at 3:53 AM Ihor Radchenko  wrote:

> Gregor Zattler  writes:
>
> > 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()
>
> This is a hyperbole bug.
> The latest version of Org no longer supports calling
> org-element-at-point in non-Org buffers. Previously it worked by
> accident and did not throw an error.
>
> I recommend using regexp constants from Org to match against org-like
> constructs outside Org mode buffers.
>
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at .
> Support Org development at ,
> or support my work at 
>
>


Re: Flyspell process called frequently when using Org export (was: Flyspell causes severe slowdown when manipulating footnotes)

2022-12-11 Thread Rudolf Adamkovič
Ihor Radchenko  writes:

> Rudolf Adamkovič  writes:
>
>> Unrelated to the footnotes mentioned above
>
> Note how I change the email subject to mark a new topic.
> In Emacs, it is M-x message-change-subject

TIL!  Thank you.

> I am unable to reproduce using the latest Org.

I apologize for not providing a sequence of reproduction steps.

Upon further investigation, Org frequently starts and kills the
spellchecker when the document contains `LocalWords' comments.

1. Start Emacs

   emacs -Q

2. Configure Flyspell

   (add-hook 'text-mode-hook #'flyspell-mode)
   (add-hook 'prog-mode-hook #'flyspell-prog-mode)

3. Create a new Org file

   # LocalWords: xyz
   
   Hello there!

4. Export the file to HTML

Expected:

  No Ispell process started on export.

Actual:

  A new Ispell process started on export.

P.S. I also see Org starting Ispell over and over when holding down
`C-v' in a long document that contains lots of scattered `LocalWords'
comments.

Rudy
-- 
"The whole science is nothing more than a refinement of everyday
thinking."
-- Albert Einstein, 1879-1955

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



Re: [BUG] ob-R.el: extra empty data.frame columns generated from plain lists after recent change [9.6 (release_9.6-3-ga4d38e @ /usr/share/emacs/30.0.50/lisp/org/)]

2022-12-11 Thread Jeremie Juste
Hello Ihor

On Thursday,  8 Dec 2022 at 09:07, Ihor Radchenko wrote:

> I am not sure if I like the approach you used in the commit.
>
> -(unless (listp (car value)) (setq value (list value)))
> +(unless (listp (car value)) (setq value (mapcar 'list value)))
>
> In the above, you are transforming (val1 val2 val3 ...) list into
> ((val1) (val2) (val3) ...).
>
> Does it make sense from the point of view of R code?
> AFAIU, the current ob-R implementation converts lists into R tables,
> which is not accurate? Would it make sense to convert Elisp lists into R
> lists directly?

Many thanks for the feedback. At this point I don't know. On one hand you are
right on the other, this option is backward compatible, and the user can
always create an interface in R to suit his need.

If there are more complaints about that in the future, I'll reconsider. 

Best regards,
Jeremie



Autoloading side effects (was: Re: [BUG] org-mouse is activated without explicit require)

2022-12-11 Thread Max Nikulin

On 11/12/2022 16:45, Ihor Radchenko wrote:

We cannot do much about Emacs' handling of autoloads, but what we can
(and should) do is changing org-mouse to become a global minor mode.
Then, loading org-mouse will cause no side effects.


I am afraid, requirement that loading should not cause side effects is 
too strict and it will make usage inconvenient. Examples:

- ol-info calls `org-link-set-parameters'.
- org-protocol installs an advice for `server-visit-files'. (It should 
not be necessary, but currently Emacs does not provide a better option.)


However I agree that it is undesired when attempt to call interactive 
help causes side effects. I would say that in such cases loading of 
packages should be sandboxed and should not propagate to global scope.





Failed to connect to MPV

2022-12-11 Thread Alexei Gilev
Hi,

I'm trying to use org-media-note and mpv together.
However, I keep getting this error message.

When I eval (mpv-play "file.mp3"), the audio plays (I can't stop it though
or see where the MPV window is on Emacs or my computer...).

But when I try to use the org-media-note hydra to open the same file I get
this "Failed to connect to MPV". It's very desperating!

Thanks for any help provided.
A.


Requesting a new release of org-contrib.

2022-12-11 Thread Malcolm Purvis
Emacs 29 and the new main branch (emacs-30) require the 't' 
condition in a cl-case to be the last entry.  This breaks 
org-checklist in version 0.4 of org-contrib.


The fix has already been applied 
(https://git.sr.ht/~bzg/org-contrib/commit/6422b265f1150204f024e33d54f2dcfd8323005c) 
but it is not available in NonGNU ELPA.


Could a new release of org-contrib be made to make the fix widely 
available?


Thanks,

Malcolm
--
 Malcolm Purvis 



Re: [PATCH] Merge loaded org-persist index with index file contents

2022-12-11 Thread Timothy
Hi Max,

> Please, avoid mixing of system clock and filesystem timestamps.
>
> (file-attribute-modification-time (file-attributes file))
>
> should be more reliable.

Thanks for the tip, I’ve updated the patch to use this.

> In general, I would prefer to avoid relying on timestamps at all, but I am not
> sure if it is possible to implement in elisp with reasonable efforts. The idea
> is to save into file header a hash of content (or a random number). To check
> if file has not been modified, just header is read at first. If hash does not
> match the value stored in memory then it is necessary to read the whole file.

The current approach is certainly sub-optimal, but it’s also simple and unlikely
to cause any issues in practice.

> Another point that I am unsure is if Emacs ensures file locks. If one emacs
> process writes disk cache file then attempts to read the same file by other
> emacs instances must be postponed.

I’m not sure, but you’d need two Emacs instances to try reading/writing the
index file at near-/exactly/ the same time, which seems vanishingly unlikely.

> Cooperation in respect to disk cache would be an improvement, but it may be
> tricky to implement it reliably.

We could just write more often and run `org-persist--merge-index-with-disk' with
some heuristic during operation (if the file is unmodified since it was last
checked nothing will happen). However, I think that’s probably best left to
another conversation — let’s not allow perfect to be the enemy of good here .

All the best,
Timothy

-- 
Timothy (‘tecosaur’/‘TEC’), Org mode contributor.
Learn more about Org mode at .
Support Org development at ,
or support my work at .


Re: PATCH: include controlling language= in my previous patch

2022-12-11 Thread Pedro Andres Aranda Gutierrez
Hi Ihor,

thanks for the patience. I have a comment on the message you refer to... If
comes from 2014.

So I have resorted to my fresh Emacs29, opened it with emacs -Q for a clean
environment.

With the MWE
```
#+CAPTION: caption of block 1
#+BEGIN_SRC asm
vmpovapd %%zmm0, %zmm1
#+END_SRC


#+LABEL: lst:second
#+BEGIN_SRC asm
vmpovapd %%zmm0, %zmm1
#+END_SRC

# Local Variables:
# org-latex-listings: 'listings
# End:
```
I get the following:
```
\begin{lstlisting}[language=asm,label= ,caption={caption of block
1},captionpos=b,numbers=none]
vmpovapd %%zmm0, %zmm1
\end{lstlisting}


\begin{lstlisting}[language=asm,label=lst:org2f3fc09,caption=
,captionpos=b,numbers=none]
vmpovapd %%zmm0, %zmm1
\end{lstlisting}

```

In my most humble opinion, I looks like the global \lstset{} isn't used and
that the caption/label is set locally. And this makes me believe that
label= or caption= are not very useful.

I have extended my research to a SRC block without language and that
results in a \begin{verbatim}--\end{verbatim}

I'm attaching the patch generated with git diff -p.
Mea culpa, I should have RTFM before sending anything :-)

Best, /PA


On Sun, 11 Dec 2022 at 11:05, Ihor Radchenko  wrote:

> Note: This email thread is a followup for
> https://orgmode.org/list/cao48bk_6bqkgp1mgnzaaryku2+st6r1d4bziq5nzmwnewqf...@mail.gmail.com
>
> Pedro Andres Aranda Gutierrez  writes:
>
> > I have a second version of my previous patch, inlcuing and extra variable
> > to control whether you want to include the language= or not. It is made
> in
> > a backwards-compatible way. Default is to include it and you have to
> >
> > (setq org-latex-listings-src-omit-language t)
> >
> > to omit language=
>
> Makes sense from a first glance.
>
> > + (when label; label= w/o label makes little
> sense
> > + `(("label" ,(org-latex--label src-block info
> > + (when caption-str  ; caption= w/o caption makes
> little sense
> > +   `(("caption" ,caption-str))
> > +   `(("captionpos" ,(if caption-above-p "t" "b" ; as does
> captionpos w/o caption
>
> This is not true. We do need that empty caption/label.
> See
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=eaaa5c2e4
> and
> https://orgmode.org/list/534beafb.4080...@gmx.de
>
> Also, if you can, please create a proper patch instead of diff. See
> https://orgmode.org/worg/org-contribute.html#first-patch
>
> --
> 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
diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index 5b29a284c..a319fa830 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -1021,6 +1021,16 @@ in this list - but it does not hurt if it is present."
 	   (symbol :tag "Major mode   ")
 	   (string :tag "Listings language"
 
+(defcustom org-latex-listings-src-omit-language nil
+  "Set this option to t to omit the
+\"language=\"
+in the parameters to \\begin{lstlisting} when exporting a src block"
+  :group 'org-export-latex
+  :version "30.0"
+  :package-version '(Org . "9.7")
+  :type 'boolean
+  )
+
 (defcustom org-latex-listings-options nil
   "Association list of options for the latex listings package.
 
@@ -3593,12 +3603,13 @@ and FLOAT are extracted from SRC-BLOCK and INFO in `org-latex-src-block'."
   ((string= "multicolumn" float) '(("float" "*")))
   ((and float (not (assoc "float" lst-opt)))
`(("float" ,(plist-get info :latex-default-figure-position)
- `(("language" ,lst-lang))
- (if label
- `(("label" ,(org-latex--label src-block info)))
-   '(("label" " ")))
- (if caption-str `(("caption" ,caption-str)) '(("caption" " ")))
- `(("captionpos" ,(if caption-above-p "t" "b")))
+ (unless org-latex-listings-src-omit-language
+   `(("language" ,lst-lang)))
+ (when label; label= w/o label makes little sense
+ `(("label" ,(org-latex--label src-block info
+ (when caption-str  ; caption= w/o caption makes little sense
+   `(("caption" ,caption-str))
+   `(("captionpos" ,(if caption-above-p "t" "b" ; as does captionpos w/o caption
  (cond ((assoc "numbers" lst-opt) nil)
((not num-start) '(("numbers" "none")))
(t `(("firstnumber" ,(number-to-string (1+ num-start)))


Re: [MAINTENANCE] Org orphanage?

2022-12-11 Thread Ihor Radchenko
Bastien  writes:

> I think it is a very good idea and a natural evolution of org-contrib,
> thanks for suggesting this.
> ...
> We can announce this along with the Org 9.6 release.

So, we now have https://orgmode.org/worg/org-orphanage.html

It is very bare bones.

We can add the following:

1. Mention orphanage at https://orgmode.org/worg/org-contribute.html
   Probably, in a visible way, as a div box.
2. Add org-contrib
3. Link to orphanage from https://sr.ht/~bzg/org/
4. Maybe add a separate section to updates.orgmode.org
5. We can offer to move orphaned repositories to sr.ht under our control
   and mention that we can do minimal maintenance then.

WDYT?

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



Re: [MAINTENANCE] Do we have any backwards-compatibility policy for third-party packages?

2022-12-11 Thread Ihor Radchenko
Tim Cross  writes:

> - Adding a section regarding pubic/private API and naming conventions to
>   the Hacking section of the manual. This section could outline what the
>   processes are for adding/changing APIs. 

I think we can add a section to Hacking.

But what should we list there?

At least,

1. prefix--suffix can change any time. prefix-suffix is stable
2. ORG-NEWS mention if we do important changes breaking (1)
3. If we decide to remove or change some function/variable, we first
   obsolete it.

What else?

> - Add the maintainers pledge to the manual as well. It is useful for
>   users to know what the maintainers pledge to try and do. I doubt many
>   users will find the page on worg which already exists. At the very
>   least, add a link to the wrog page.

Should we straight put
https://bzg.fr/en/the-software-maintainers-pledge/ after Installation
section of the manual? Maybe into a new section called "Updating Org"?

Bastien, what do you think?

> - Briefly document the org maintenance and release process or add links
>   to relevant worg pages. . 

Also into Hacking, I think. As extra reference after API and
compatibility conventions.

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



Re: [PATCH] Merge loaded org-persist index with index file contents

2022-12-11 Thread Max Nikulin

On 11/12/2022 14:59, Timothy wrote:

+  (setq org-persist--index combined-index
+org-persist--index-age (current-time)


Please, avoid mixing of system clock and filesystem timestamps.

(file-attribute-modification-time (file-attributes file))

should be more reliable. See the `org-file-newer-than-p' docstring. In 
general, I would prefer to avoid relying on timestamps at all, but I am 
not sure if it is possible to implement in elisp with reasonable 
efforts. The idea is to save into file header a hash of content (or a 
random number). To check if file has not been modified, just header is 
read at first. If hash does not match the value stored in memory then it 
is necessary to read the whole file.


Another point that I am unsure is if Emacs ensures file locks. If one 
emacs process writes disk cache file then attempts to read the same file 
by other emacs instances must be postponed.


Cooperation in respect to disk cache would be an improvement, but it may 
be tricky to implement it reliably.





Re: PATCH: include controlling language= in my previous patch

2022-12-11 Thread Ihor Radchenko
Note: This email thread is a followup for 
https://orgmode.org/list/cao48bk_6bqkgp1mgnzaaryku2+st6r1d4bziq5nzmwnewqf...@mail.gmail.com

Pedro Andres Aranda Gutierrez  writes:

> I have a second version of my previous patch, inlcuing and extra variable
> to control whether you want to include the language= or not. It is made in
> a backwards-compatible way. Default is to include it and you have to
>
> (setq org-latex-listings-src-omit-language t)
>
> to omit language=

Makes sense from a first glance.

> + (when label; label= w/o label makes little sense
> + `(("label" ,(org-latex--label src-block info
> + (when caption-str  ; caption= w/o caption makes little 
> sense
> +   `(("caption" ,caption-str))
> +   `(("captionpos" ,(if caption-above-p "t" "b" ; as does 
> captionpos w/o caption

This is not true. We do need that empty caption/label.
See
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=eaaa5c2e4
and
https://orgmode.org/list/534beafb.4080...@gmx.de

Also, if you can, please create a proper patch instead of diff. See
https://orgmode.org/worg/org-contribute.html#first-patch

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



Re: PATCH: don't emit empty attributes for lstlistings in LaTeX listings backend

2022-12-11 Thread Ihor Radchenko
Pedro Andres Aranda Gutierrez  writes:

> attached is a small patch for the Latex export backend that suppresses
> emitting empty labels and captions when exporting src blocks using
> 'listings. This cleans up the emitted LaTeX.

For record.
There is a new version of this patch in 
https://orgmode.org/list/CAO48Bk9rjGXZMkuPNyXLeRYow95PfBB=+o0s0uucmtw_pja...@mail.gmail.com

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



Re: [BUG] org-mouse is activated without explicit require

2022-12-11 Thread Ihor Radchenko
Matt Lundin  writes:

> I'm not too familiar with how emacs handles autoloads. However, I find
> org-mouse is automatically loaded if I call describe-function and then
> tab complete after typing "", "org-", "org-m", etc. This seems enough to
> load the entirely of the org-mouse.el file.
>
> The problem is that this adds a lambda function to org-mode-hook that
> activates all org-mouse functionality at the next call of org-mode or
> org-mode-restart. This has two unexpected effects:
>
> 1. It changes the behavior of mouse clicks without the user's explicit
>request.
> 2. It advise org-open-at-point, with the result that it is no longer
>possible to get a list of all links in an entry when calling
>org-open-at-point on a headline. (See separate bug report on this.)

Confirmed.
We cannot do much about Emacs' handling of autoloads, but what we can
(and should) do is changing org-mouse to become a global minor mode.
Then, loading org-mouse will cause no side effects.

It will be a breaking change though. Not for Org 9.6.

Note that this bug is not new. org-mouse has not been changed for a long
time.

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



Re: [BUG] org-mouse.el breaks org-open-at-point

2022-12-11 Thread Ihor Radchenko
Matt Lundin  writes:

> - Expected behavior 
>
>   - calling org-open-at-point with the keyboard "C-c C-o" should produce
> a list of links in the entry as advertised in the docstring ("When
> point is on a headline, display a list of every link in the entry,
> so it is possible to pick one, or all, of them.")
>
> - What currently happens if org-mouse has been loaded:
>
>   - calling "C-c C-o" with the keyboard cycles the visibility of the
> entry

Confirmed.
Patches welcome!

I think we need to modify `org-open-at-mouse' directly instead of using advice.

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



Flyspell process called frequently when using Org export (was: Flyspell causes severe slowdown when manipulating footnotes)

2022-12-11 Thread Ihor Radchenko
Rudolf Adamkovič  writes:

> Unrelated to the footnotes mentioned above

Note how I change the email subject to mark a new topic.
In Emacs, it is M-x message-change-subject

> ... , but I noticed that Org
> starts and kills Ispell all the time.  I see the following messages
> repeated over and over when working with Org:
>
>   Starting new Ispell process aspell with american dictionary...done
>   ...
>   Ispell process killed
>
> For the sake of experiment, I have just tried to export (to HTML) a
> subtree that contains nothing in it but a single BibTeX source block.
> Sure enough, Org started and killed a new Ispell process!
>
> P.S. I use Flyspell with the following (standard) configuration:
>
>   (add-hook 'after-init-hook
> (lambda ()
>   (add-hook 'text-mode-hook #'flyspell-mode)
>   (add-hook 'prog-mode-hook #'flyspell-prog-mode)))

I am unable to reproduce using the latest Org.

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



Re: [PATCH] lisp/org-expiry.el: Account for org-time-stamp-formats

2022-12-11 Thread Ihor Radchenko
Tom Gillespie  writes:

> +  (format-time-string
> +   (string-replace "<" ""
> +   (string-replace ">" "" (cdr 
> org-time-stamp-formats)

`string-replace' is very aggressive. You may want something like "\\`<"
and "\\'>", matching only beginning/end of the string.

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



[FR] Allow passing nested list structures to variables in src blocks (was: [BUG] ob-R.el: extra empty data.frame columns generated from plain lists after recent change [9.6 (release_9.6-3-ga4d38e @ /u

2022-12-11 Thread Ihor Radchenko
Johan Tolö  writes:

> I do pass org plain lists to R source code blocks which is why I 
> found the current issue. It is easy enough for me to adapt my R 
> code whenever there is a change in the way it is handled. It is 
> unfortunate that it will no longer be possible to access any 
> nested elements of plain lists but it does not affect me because I 
> was not using that feature.

If necessary, we may adapt the recent idea with list-name[] and allow
passing ranges to the lists, similar to tables.

What I have in mind:

1. variable=list-name will assign top-level items as a list (item1 item2 ...)
2. variable=list-name[] will allow nesting: ((item1) (item2 (sub-list)) ...)
3. variable=list-name[from:to,...]

It will be a new feature, of course.

> I think that the output from R source code blocks should be as 
> close to the example in the org manual as possible. I also think 
> that the handling within ob-R.el should be as simple as possible. 
> I do not mind if that means that I have to convert a data.frame 
> from columns to rows.
>
> For anyone wondering, you can simply unlist() a data.frame to get 
> a vector of the columns.

I am also in favour of staying as close as possible to the manual. I find
converting lists to tables non-intuitive.

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



[PATCH] Merge loaded org-persist index with index file contents

2022-12-11 Thread Timothy
Hi All,

I’ve recently pushed a batch of improvements/fixes to org-persist, particularly
with the handling of url containers. Expect to actually see caching of remote
images now .

I’ve also noticed that the org-persist index is written when Emacs closes, and
so this sequence of event can happen:

1. Initial empty index file
2. Start Emacs session #1, add 20 entries to the index
3. Start Emacs session #2, add 1 entry to the index
4. Close Emacs session #1
   ⁃ The index file now has 20 entries in it
5. Close Emacs session #2
   ⁃ The index file now has 1 entry in it

I think ideally at the end we’d have 21 entries in the index. So, I’ve added a
simple merge function that checks to see if the index file has been updated
since loading, and if so just grabs new index entries from the file. We don’t
bother trying to merge modified entries.

How does this sound?

All the best,
Timothy

-- 
Timothy (‘tecosaur’/‘TEC’), Org mode contributor.
Learn more about Org mode at .
Support Org development at ,
or support my work at .
>From 6a12fca24f1b89129424b8fc2902719f5e053832 Mon Sep 17 00:00:00 2001
From: TEC 
Date: Sat, 10 Dec 2022 23:53:44 +0800
Subject: [PATCH] org-persist: Merge index with index file content

* lisp/org-persist.el (org-persist-write, org-persist-load,
org-persist--index-age): Check if the index file has been externally
updated since loading, and if so try to perform basic merging of the
current index file contents and the loaded index before performing GC or
overwriting the index file.
---
 lisp/org-persist.el | 53 +++--
 1 file changed, 46 insertions(+), 7 deletions(-)

diff --git a/lisp/org-persist.el b/lisp/org-persist.el
index f215310a2..e9310d172 100644
--- a/lisp/org-persist.el
+++ b/lisp/org-persist.el
@@ -259,6 +259,9 @@ (defvar org-persist--index-hash nil
   "Hash table storing `org-persist--index'.  Used for quick access.
 They keys are conses of (container . associated).")
 
+(defvar org-persist--index-age nil
+  "The time at which the index was loaded, as given by `current-time'.")
+
 (defvar org-persist--report-time 0.5
   "Whether to report read/write time.
 
@@ -589,8 +592,9 @@ (defalias 'org-persist-load:file #'org-persist-read:file)
 (defun org-persist-load:index (container index-file _)
   "Load `org-persist--index' from INDEX-FILE according to CONTAINER."
   (unless org-persist--index
-(setq org-persist--index (org-persist-read:index container index-file nil))
-(setq org-persist--index-hash nil)
+(setq org-persist--index (org-persist-read:index container index-file nil)
+  org-persist--index-hash nil
+  org-persist--index-age (current-time))
 (if org-persist--index
 (mapc (lambda (collection) (org-persist--add-to-index collection 'hash)) org-persist--index)
   (setq org-persist--index nil)
@@ -690,17 +694,49 @@ (defun org-persist-write:index (container _)
 (message "Missing write access rights to org-persist-directory: %S"
  org-persist-directory
   (when (file-exists-p org-persist-directory)
-(org-persist--write-elisp-file
- (org-file-name-concat org-persist-directory org-persist-index-file)
- org-persist--index
- t t)
-(org-file-name-concat org-persist-directory org-persist-index-file)))
+(let ((index-file
+   (org-file-name-concat org-persist-directory org-persist-index-file)))
+  (org-persist--merge-index-with-disk)
+  (org-persist--write-elisp-file index-file org-persist--index t t)
+  (setq org-persist--index-age (current-time))
+  index-file)))
 
 (defun org-persist--save-index ()
   "Save `org-persist--index'."
   (org-persist-write:index
`(index ,org-persist--storage-version) nil))
 
+(defun org-persist--merge-index-with-disk ()
+  "Merge `org-persist--index' with the current index file on disk."
+  (let* ((index-file
+  (org-file-name-concat org-persist-directory org-persist-index-file))
+ (disk-index
+  (and (file-exists-p index-file)
+   (org-file-newer-than-p index-file org-persist--index-age)
+   (org-persist-read:index `(index ,org-persist--storage-version) index-file nil)))
+ (combined-index
+  (org-persist--merge-index org-persist--index disk-index)))
+(when disk-index
+  (setq org-persist--index combined-index
+org-persist--index-age (current-time)
+
+(defun org-persist--merge-index (base other)
+  "Attempt to merge new index items in OTHER into BASE.
+Items with different details are considered too difficult, and skipped."
+  (if other
+  (let ((new (cl-set-difference other base :test #'equal))
+(base-files (mapcar (lambda (s) (plist-get s :persist-file)) base))
+(combined (reverse base)))
+(dolist (item (nreverse new))
+  (unless (or (memq 'index (mapcar #'car (plist-get collection 

PATCH: include controlling language= in my previous patch

2022-12-11 Thread Pedro Andres Aranda Gutierrez
Hi,

I have a second version of my previous patch, inlcuing and extra variable
to control whether you want to include the language= or not. It is made in
a backwards-compatible way. Default is to include it and you have to

(setq org-latex-listings-src-omit-language t)

to omit language=

I guess this full patch would go (if accepted) in the next release...

Thx, /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
diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index 5b29a284c..a319fa830 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -1021,6 +1021,16 @@ in this list - but it does not hurt if it is present."
 	   (symbol :tag "Major mode   ")
 	   (string :tag "Listings language"
 
+(defcustom org-latex-listings-src-omit-language nil
+  "Set this option to t to omit the
+\"language=\"
+in the parameters to \\begin{lstlisting} when exporting a src block"
+  :group 'org-export-latex
+  :version "30.0"
+  :package-version '(Org . "9.7")
+  :type 'boolean
+  )
+
 (defcustom org-latex-listings-options nil
   "Association list of options for the latex listings package.
 
@@ -3593,12 +3603,13 @@ and FLOAT are extracted from SRC-BLOCK and INFO in `org-latex-src-block'."
   ((string= "multicolumn" float) '(("float" "*")))
   ((and float (not (assoc "float" lst-opt)))
`(("float" ,(plist-get info :latex-default-figure-position)
- `(("language" ,lst-lang))
- (if label
- `(("label" ,(org-latex--label src-block info)))
-   '(("label" " ")))
- (if caption-str `(("caption" ,caption-str)) '(("caption" " ")))
- `(("captionpos" ,(if caption-above-p "t" "b")))
+ (unless org-latex-listings-src-omit-language
+   `(("language" ,lst-lang)))
+ (when label; label= w/o label makes little sense
+ `(("label" ,(org-latex--label src-block info
+ (when caption-str  ; caption= w/o caption makes little sense
+   `(("caption" ,caption-str))
+   `(("captionpos" ,(if caption-above-p "t" "b" ; as does captionpos w/o caption
  (cond ((assoc "numbers" lst-opt) nil)
((not num-start) '(("numbers" "none")))
(t `(("firstnumber" ,(number-to-string (1+ num-start)))