Re: HowTo: Upgrade org-mode installation from the command-line

2024-05-02 Thread Samuel Wales
On Sunday, April 28, 2024, Ihor Radchenko  wrote:

> > Note: For the upgraded version to be loaded by emacs, you mush place
> > `package-initialize` early in your init.el.  Failure to do so will
> > result in the old system version to be loaded, as can be seen:
>
> This is only true when running emacs -Q or emacs -q.
> For normal emacs invocation, since Emacs 27, by default, Emacs calls
> (package-initialize) automatically on startup.
>
> strangely in my 27, help on package-initialize does not say explicitly
whether it is called automatically.

it says "If ‘package-initialize’ is called twice during Emacs startup,
signal a warning, since this is a bad idea except in highly
advanced use cases.  To suppress the warning, remove the
superfluous call to ‘package-initialize’ from your init-file.  If
you have code which must run before ‘package-initialize’, put
that code in the early init-file."

i ran package-initialize in my .emacs and checked c-h e and did not find a
warning.  however, without running it, it still seems to have been run.



-- 
The Kafka Pandemic

A blog about science, health, human rights, and misopathy:
https://thekafkapandemic.blogspot.com


[FR]: thing-at-point 'org-table-cell

2024-05-02 Thread Pedro Andres Aranda Gutierrez
Hi,

It would be great to have a thing-at-point handler that returns a cell in
and org table. The most simple use case is to have a table in an org-file
with data that you need to transfer to an online Web page. Being able to
(copy-as-kill ...) a cell's contents could speed up the whole process...

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


Re: [FR] Support headline as a function for file+headline target for org-capture-templates

2024-05-02 Thread Nafiz Islam
> > Would you be interested to submit a patch?
> If I finish writing a patch for it. Sure.

I again forgot to CC emacs-orgmode@gnu.org


RE: HowTo: Upgrade org-mode installation from the command-line

2024-05-02 Thread Cook, Malcolm
>"Cook, Malcolm"  writes:
>
>> The section on org-mode 
>> [[https://orgmode.org/org.html#Installation][Installation]] entitled "Using 
>> Emacs packaging
>> system" might be improved with the following advice:
>
>Thanks!
>
>> Note: For the upgraded version to be loaded by emacs, you mush place
>> `package-initialize` early in your init.el. Failure to do so will
>> result in the old system version to be loaded, as can be seen:
>
>This is only true when running emacs -Q or emacs -q.
>For normal emacs invocation, since Emacs 27, by default, Emacs calls
>(package-initialize) automatically on startup.
>
>> Note further that if the above upgrade command was done in an emacs
>> shell buffer, you will need to restart emacs to pick up the updated
>> package. Failing to do so will result in `meta-x org-version`
>> reporting the old version:
>>
>> #+begin_src src
>> Org mode version 9.6.15 (release_9.6.15 @ 
>> /usr/local/share/emacs/30.0.50/lisp/org/)
>> #+end_src
>>
>> but after restart with my init.el file it reports:
>>
>> #+begin_src src
>> Org mode version 9.6.27 ( @ 
>> /home/mec/.dotfiles/emacs/.emacs.d/elpa/org-9.6.27/)
>> #+end_src
>
>Examples are probably a bit too much for the manual.
>It should be sufficient to ask to restart existing Emacs sessions, if
>any.
>
>May you prepare a patch modifying doc/org-manual.org with your suggestions?
>See https://orgmode.org/worg/org-contribute.html

Glad to try.  How's this?




0001-doc-command-line-upgrade.patch
Description: 0001-doc-command-line-upgrade.patch


Re: Possible to set block switches "globally"?

2024-05-02 Thread João Pedro
Em segunda, 29/04/2024 às 17:34 (GMT), Ihor Radchenko  
escreveu:

> Yes. This is the plan.
>
> Citing earlier syntax discussion in
> https://list.orgmode.org/orgmode/877d08bkze.fsf@localhost/
>
> > Can we drop switch support? This seems like a fairly good idea. The 
> functionality can simply be shifted to
> > ARGUMENTS with the well-established :key val forms.
> > “For the love of all that is sane” — Tom G

All right so if I understand correctly, we'd like to deprecate switches
from the parser and introduce :key val pairs for each switch, but no one
has gotten to it yet?

If that's the case, I'd propose something like

- (-|+)n => :number-lines (yes|*no*|continue)
^ +n
- -r => :labels (link|keep|*remove*) ("label string")?
 ^ -k ^ -l "label string"

and could give it a try. What do you think?

-- 
João Pedro de A. Paula
IT bachelors at Universidade Federal do Rio Grande do Norte (UFRN)


Re: [DISCUSSION] The meaning of :cmdline header argument across babel backends

2024-05-02 Thread Matt


  On Wed, 01 May 2024 20:01:03 +0200  Ihor Radchenko  wrote --- 
 > Matt m...@excalamus.com> writes:
 > 
 > > I disagree with one aspect: we shouldn't use Worg as a source of
 > > truth. The argument holds based on historical behavior of :cmdline.
 > > AFAIU, Worg is a wiki which is open, more or less, to anyone. Worg
 > > contents, AFAIU, have not always undergone review. The manual should
 > > be the final authority. Fortunately, there's nothing in the manual
 > > about :cmdline.
 > 
 > For babel backends specifically, WORG is _the_ documentation for the
 > built-in backends. It is what we will eventually move to the official
 > manual and it is what we point users to from the manual for now.

Okay, I didn't know we made an explicit reference.

  > (2) nobody got around to actually move things to the manual.

I'd be happy to help with this.  Discussion for another thread, though.

 > > Are we thinking of implementing these for other languages, beyond
 > > ob-shell?
 > 
 > Yes. The title of this thread has "across babel backends" :)

:)

 > > If we're looking at these as general headers, then I don't think "arg"
 > > is the correct term here since a switch may not take a value. For
 > > example, the "-r" option for Bash (IIUC).
 > 
 > > Quick name ideas that aren't good yet may inspire better ones by
 > > inspiring disgust--:switches, :flags, :options, (using an "i" prefix
 > > for "interpreter") :iswitches, :iflags, :ioptions
 > 
 > Emm... but "command line arguments". No?
 
I was thinking it'd be strange to have an "argument to an argument."  However, 
the Bash man says things like "non-option arguments".  It wasn't my intent to 
have an argument argument argument.

Since we're considering this for all babel backends, "interpreter-args" 
wouldn't describe gcc or other compilers.  What about :command-args, 
:command-args, :cmd-args?  "Command" is the only thing I can think of that 
describes all of the languages, other than maybe "binary" or "executable".  
Maybe we could simply use ":args"?  Maybe ":meta-args" since gcc or bash is 
meta to the script/artifact?

--
Matt Trzcinski
Emacs Org contributor (ob-shell)
Learn more about Org mode at https://orgmode.org
Support Org development at https://liberapay.com/org-mode





Re: [DISCUSSION] "quick-help" popup for org-columns (column view)

2024-05-02 Thread Sławomir Grochowski
Hi Philip, 

what's your opinion about this change?
I understand it's a low-level hack, but maybe you can advise on how to do it 
better? 

Sławomir Grochowski  writes:
> That's great idea. I tried with this code:
>
> (message "Toggle display of quick-help buffer using %s."
>  (propertize (key-description (this-command-keys)) 'face 
> 'help-key-binding 'font-lock-face 'help-key-binding))
>
> And it works perfectly. 

> But I would like 'help-quick' for org-columns to be bind to other
> keybinding: "?" not "C-h C-q".
>
> Because now it's like this:
>
> 1. invoke the command using "?" keybinding:
>
> (defun org-columns-help-quick-toggle ()
>   (interactive)
>   (let ((help-quick-sections org-columns-help-quick-sections)
> (help-quick-use-map org-columns-map))
> (help-quick-toggle)))
>
> (org-defkey org-columns-map "?" #'org-columns-help-quick-toggle)
>
> 2. 'help-quick' for org-columns buffer will appear with the message:
> "Toggle display of quick-help buffer using C-h C-q."
>
> So this is misleading.
> Because pressing 'C-h C-q' will close the buffer but pressing it again
> will show 'help-quick' buffer and not 'help-quick' for org-columns buffer.
>
> Therefore, I think that to use a different keybinding we need to modify
> the code.
> Or am I missing something?

-- 
Slawomir Grochowski



Re: Importing "quoted" strings in `org-babel-import-elisp-from-file'

2024-05-02 Thread Max Nikulin

On 01/05/2024 19:19, Ihor Radchenko wrote:

And replacing the call to org-babel-string-read with org-babel-read does not
break any tests...


Since

005e68294 2009-06-11 17:04:42 -0700 Eric Schulte: making progress 
bringing org-babel-R.el into the new evaluation schema


`org-babel-string-read' has been stripping quotes, but `org-string-read' 
got this feature later in


60a8ba556 2011-03-02 07:55:39 -0700 Eric Schulte: ob: read string 
variable values wrapped in double quotes, removing the quotes


So now outer quotes are stripped twice.

(org-babel-string-read "\"\"1\"\"")
"1"

(org-babel-read "\"\"1\"\"" t)
"\"\"1\"\""

There are still more subtle differences between these functions:

(org-babel-string-read "\"1\" 2 \"3\"")
"1\" 2 \"3"

(org-babel-read "\"1\" 2 \"3\"" t)
"\"1\" 2 \"3\""

What I do not like in `org-babel-read' is false positive for escaped 
quote when actually backslash is escaped:


(org-babel-read "\"1\" 2 \"3\"" t)
"1\\"

(org-babel-read "\"1|\" 2 |\"3\"" t)
"\"1|\" 2 |\"3\""

Test suite is far from being exhaustive.




Re: [BUG] #+CALL - permission error -bash

2024-05-02 Thread Leo Butler
On Thu, May 02 2024, vita...@gmx.com wrote:

> in org-babel-sh-evaluate
>  file:~/.emacs.d/elpa/org-9.6.28/ob-shell.el::300
>
> this do apply: (process-file "/tmp/babel-NfRG9P/sh-script-jmKNA4"
>  "/tmp/babel-NfRG9P/sh-stdin-o3CEm5" # nil nil)
>
> I don't allow executables in /tmp folder!

How about:

(setq org-babel-temporary-directory
  (let ((temporary-file-directory "/path/you/prefer"))
(make-temp-file "babel-" t)))

Leo


Re: [PATCH] ob-lua: Support all types and multiple values in results

2024-05-02 Thread Ihor Radchenko
Rudolf Adamkovič  writes:

> Max Nikulin  writes:
>
>> On 30/04/2024 03:26, Rudolf Adamkovič wrote:
>>> +local value = result[1]
>>> +if string.find(value, '[%%(%%[{]') == 1 then
>>> +  return quotes .. value .. quotes
>>
>> Am I wrong that quotes in value may cause issues? I expect some way of
>> escaping " characters.
>
> What would the reproduction steps look like?

I guess

#+begin_src lua
return '"hello " world"'
#+end_src

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



Re: [PATCH] Auto-complete PRINT_BIBLIOGRAPHY with a trailing colon

2024-05-02 Thread Ihor Radchenko
Rudolf Adamkovič  writes:

> * lisp/org.el (org-options-keywords): Add a trailing colon to the
> 'PRINT_BIBLIOGRAPHY' keyword to avoid unnecessary user confusion.

Thanks!
Applied, onto bugfix.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?h=bugfix=7cdf835c

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



Re: [PATCH] Fix regex for determining image width from attribute

2024-05-02 Thread Ihor Radchenko
Matt Huszagh  writes:

>> Thanks for continuing with this. Moving forward, I think it would be best to:
>> ⁃ Make a patch just for prioritising `#+attr_org'
>> ⁃ Make a patch just improving the regex (before or after the `#+attr_org' 
>> patch)
> ...
>> Lastly, a comment on your documentation patch from earlier. I like the 
>> changes
>> to `org-image-actual-width', however I think you’ve been over-eager with 
>> scrapping
>> the current docstring for `org-display-inline-image--width'. Since the 
>> behaviour
>> is implemented there, I think it should at a minimum be documented there.
>> The docstring for a function referring to a variable’s documentation for how 
>> it’s
>> handled by the function seems a bit weird.

I have used parts of Matt's patches + the new org-element-ast API to
implement all the discussed (and agreed upon) changes:

1. #+attr_org is prioritised
2. Docstrings are updated

Handled, on main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=fede1c990

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



[PATCH] Auto-complete PRINT_BIBLIOGRAPHY with a trailing colon

2024-05-02 Thread Rudolf Adamkovič
* lisp/org.el (org-options-keywords): Add a trailing colon to the
'PRINT_BIBLIOGRAPHY' keyword to avoid unnecessary user confusion.
---
 lisp/org.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/org.el b/lisp/org.el
index a3d0c4547..ccf552aeb 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -9048,7 +9048,7 @@ keywords relative to each registered export backend."
   '("ARCHIVE:" "AUTHOR:" "BIBLIOGRAPHY:" "BIND:" "CATEGORY:" "CITE_EXPORT:"
 "COLUMNS:" "CREATOR:" "DATE:" "DESCRIPTION:" "DRAWERS:" "EMAIL:"
 "EXCLUDE_TAGS:" "FILETAGS:" "INCLUDE:" "INDEX:" "KEYWORDS:" "LANGUAGE:"
-"MACRO:" "OPTIONS:" "PROPERTY:" "PRINT_BIBLIOGRAPHY" "PRIORITIES:"
+"MACRO:" "OPTIONS:" "PROPERTY:" "PRINT_BIBLIOGRAPHY:" "PRIORITIES:"
 "SELECT_TAGS:" "SEQ_TODO:" "SETUPFILE:" "STARTUP:" "TAGS:" "TITLE:" "TODO:"
 "TYP_TODO:" "SELECT_TAGS:" "EXCLUDE_TAGS:" "EXPORT_FILE_NAME:"))
 
-- 
2.44.0




Re: [PATCH] ob-lua: Support all types and multiple values in results

2024-05-02 Thread Rudolf Adamkovič
Rudolf Adamkovič  writes:

> I am attaching a V2 of the patch that:

Oops, I forgot to attach the patch.  Here it is. :)

Rudy
>From b4d61bf511df74094fbcdf13c8c0c2b57b1e4a22 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rudolf=20Adamkovi=C4=8D?= 
Date: Mon, 29 Apr 2024 21:42:04 +0200
Subject: [PATCH] ob-lua: Quote list-like strings, sort tables, and parse bare
 returns

* lisp/ob-lua.el (org-babel-lua-wrapper-method): 3 changes: (1) Quote
strings with list-like content to prevent Org Babel from incorrectly
guessing their type, (2) sort pretty-printed non-sequential tables to
make them reproducible, and (3) handle implicit nils produced by
'return' used with no arguments.
* testing/lisp/test-ob-lua.el (test-ob-lua/result/nil):
(test-ob-lua/result/nil/explicit):
(test-ob-lua/result/boolean):
(test-ob-lua/results/number/integer):
(test-ob-lua/results/number/integer/negative):
(test-ob-lua/results/number/integer/multiple):
(test-ob-lua/results/number/real):
(test-ob-lua/results/number/real/multiple):
(test-ob-lua/results/number/infinity):
(test-ob-lua/results/string/single-quotes):
(test-ob-lua/results/string/double-quotes):
(test-ob-lua/results/string/multiple):
(test-ob-lua/results/string/list-like):
(test-ob-lua/results/string/list-like/brackets):
(test-ob-lua/results/string/list-like/curlies):
(test-ob-lua/results/string/list-like/standard-output):
(test-ob-lua/result/table):
(test-ob-lua/result/table/pretty-print):
(test-ob-lua/result/table/pretty-print/sorted):
(test-ob-lua/results/value-separator): New tests.
---
 lisp/ob-lua.el  |  49 +--
 testing/lisp/test-ob-lua.el | 278 
 2 files changed, 284 insertions(+), 43 deletions(-)

diff --git a/lisp/ob-lua.el b/lisp/ob-lua.el
index 041abfabc..19950f2cb 100644
--- a/lisp/ob-lua.el
+++ b/lisp/ob-lua.el
@@ -254,33 +254,40 @@ then create.  Return the initialized session."
 (defvar org-babel-lua-wrapper-method
   "
 function main()
-%s
+   %s
 end
 
 function dump(it, indent)
if indent == nil then
   indent = ''
end
+
if type(it) == 'table' and %s then
-  local count = 0
-  for _ in pairs(it) do
- count = count + 1
-  end
   local result = ''
+
   if #indent ~= 0 then
  result = result .. '\\n'
   end
-  for key, value in pairs(it) do
+
+  local keys = {}
+  for key in pairs(it) do
+ table.insert(keys, key)
+  end
+
+  table.sort(keys)
+
+  for index, key in pairs(keys) do
+ local value = it[key]
  result = result
 .. indent
 .. dump(key)
 .. ' = '
 .. dump(value, indent .. '  ')
- count = count - 1
- if count ~= 0 then
+ if index ~= #keys then
 result = result .. '\\n'
  end
   end
+
   return result
else
   return tostring(it)
@@ -288,11 +295,27 @@ function dump(it, indent)
 end
 
 function combine(...)
-  local result = {}
-  for index = 1, select('#', ...) do
-result[index] = dump(select(index, ...))
-  end
-  return table.concat(result, '%s')
+   local quotes = '\"'
+   local result = {}
+
+   for index = 1, select('#', ...) do
+  result[index] = dump(select(index, ...))
+   end
+
+   if #result == 0 then
+  return dump(nil)
+   end
+
+   if #result == 1 then
+  local value = result[1]
+  if string.find(value, '[%%(%%[{]') == 1 then
+ return quotes .. value .. quotes
+  else
+ return value
+  end
+   end
+
+   return quotes .. table.concat(result, '%s') .. quotes
 end
 
 output = io.open('%s', 'w')
diff --git a/testing/lisp/test-ob-lua.el b/testing/lisp/test-ob-lua.el
index 0a60c68ca..a0a3b178c 100644
--- a/testing/lisp/test-ob-lua.el
+++ b/testing/lisp/test-ob-lua.el
@@ -136,45 +136,263 @@ return x
 	(org-babel-next-src-block)
 	(org-babel-execute-src-block)
 
-(ert-deftest test-ob-lua/types ()
-  "Test returning different types."
+(ert-deftest test-ob-lua/result/nil ()
+  "Test returning nothing."
   (should
-   (equal "nil"
-  (org-test-with-temp-text "src_lua{return nil}"
-(org-babel-execute-src-block
+   (equal
+"src_lua{return} {{{results(=nil=)}}}"
+(org-test-with-temp-text "src_lua{return}"
+  (org-babel-execute-src-block)
+  (buffer-substring-no-properties (point-min)
+  (point-max))
+
+(ert-deftest test-ob-lua/result/nil/explicit ()
+  "Test returning nothing explicitly."
+  (should
+   (equal
+"src_lua{return nil} {{{results(=nil=)}}}"
+(org-test-with-temp-text "src_lua{return nil}"
+  (org-babel-execute-src-block)
+  (buffer-substring-no-properties (point-min)
+  (point-max))
+
+(ert-deftest test-ob-lua/result/boolean ()
+  "Test returning the boolean values true and false."
+  (should
+   (equal
+"src_lua{return true} {{{results(=true=)}}}"
+(org-test-with-temp-text "src_lua{return true}"
+

Re: [PATCH] ob-lua: Support all types and multiple values in results

2024-05-02 Thread Rudolf Adamkovič
Max Nikulin  writes:

> On 30/04/2024 03:26, Rudolf Adamkovič wrote:
>> +local value = result[1]
>> +if string.find(value, '[%%(%%[{]') == 1 then
>> +  return quotes .. value .. quotes
>
> Am I wrong that quotes in value may cause issues? I expect some way of
> escaping " characters.

What would the reproduction steps look like?

Rudy
-- 
"It is far better to have a question that can't be answered than an answer that
can't be questioned."
--- Carl Sagan

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



Re: [PATCH] ob-lua: Support all types and multiple values in results

2024-05-02 Thread Rudolf Adamkovič
Ihor Radchenko  writes:

> May you please elaborate why this breaking change is going to lead to
> significant improvement? How is using "," worse than using "|"? Either
> way, strings containing the separator will become problematic and need
> to be escaped. Moreover, using "|" may lead to interpreting the output
> as Org tables, which may be surprising to users.

Thank you for the review!

The change of the separator was a lazy move on my part.  I appologize.
I changed the separator because I could not figure out how to make Org
behave sanely.  The problem is not specific to Lua:

  src_elisp{"3, 2, 1, and go!"} {{{results(=3\, 2\, 1\, and go!=)}}}

Why Org is escaping commas here?  In other words, should my tests expect
\-escapes in front of commas, or is that a bug?

I am attaching a V2 of the patch that:

- does not modify the separator anymore (resulting in 3 failing tests)
- adds one more test (which is just a sanity check, you can ignore it)
- fixes Lua code indentation (as indented by the Lua major mode)

Thank you for your guidance.

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

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



Re: [PATCH] ob-lua: Support all types and multiple values in results

2024-05-02 Thread Rudolf Adamkovič
Ihor Radchenko  writes:

> May you please elaborate why this breaking change is going to lead to
> significant improvement? How is using "," worse than using "|"? Either
> way, strings containing the separator will become problematic and need
> to be escaped. Moreover, using "|" may lead to interpreting the output
> as Org tables, which may be surprising to users.

Thank you for the review!

The change of the separator was a lazy move on my part.  I appologize.
I changed the separator because I could not figure out how to make Org
behave sanely.  The problem is not specific to Lua:

  src_elisp{"3, 2, 1, and go!"} {{{results(=3\, 2\, 1\, and go!=)}}}

Why Org is escaping commas here?  In other words, should my tests expect
\-escapes in front of commas, or is that a bug?

I am attaching a V2 of the patch that:

- does not modify the separator anymore (resulting in 3 failing tests)
- adds one more test (which is just a sanity check, you can ignore it)
- fixes Lua code indentation (as indented by the Lua major mode)

Thank you for your guidance.

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

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



Re: [BUG] #+CALL - permission error -bash

2024-05-02 Thread Ihor Radchenko
vita...@gmx.com writes:

> in org-babel-sh-evaluate
>  file:~/.emacs.d/elpa/org-9.6.28/ob-shell.el::300
>
> this do apply: (process-file "/tmp/babel-NfRG9P/sh-script-jmKNA4"
>  "/tmp/babel-NfRG9P/sh-stdin-o3CEm5" # nil nil)
>
> I don't allow executables in /tmp folder!

Why do you think that it is a bug in Org mode?
AFAIK, it is generally expected that anything can go into tmp.

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



[BUG] #+CALL - permission error -bash

2024-05-02 Thread vitalij
in org-babel-sh-evaluate
 file:~/.emacs.d/elpa/org-9.6.28/ob-shell.el::300

this do apply: (process-file "/tmp/babel-NfRG9P/sh-script-jmKNA4"
 "/tmp/babel-NfRG9P/sh-stdin-o3CEm5" # nil nil)

I don't allow executables in /tmp folder!

How to make it this way:

(process-file "/use/bin/bash /tmp/babel-NfRG9P/sh-script-jmKNA4"
 "/tmp/babel-NfRG9P/sh-stdin-o3CEm5" # nil nil)

???

It is like when you do:
./a.sh

instead of:
bash a.sh

Emacs  : GNU Emacs 29.3 (build 1, x86_64-pc-linux-gnu, X toolkit)
 of 2024-05-01
Package: Org mode version 9.6.28 ( @ /home/u/.emacs.d/elpa/org-9.6.28/)
--
Best regards,



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

2024-05-02 Thread Ihor Radchenko
"Rick Lupton"  writes:

> I have been using the simpler version using advice (without my patch).
>
> On reflection this seems ok to me -- I don't think there's really any need 
> for my proposed patch, unless it turns out in future that there are multiple 
> packages like org-roam that need to supply org-id-finding abilities in a 
> well-defined order.  So I suggest cancelling this.

Sure.
Canceled.

-- 
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-05-02 Thread Rick Lupton
I have been using the simpler version using advice (without my patch).

On reflection this seems ok to me -- I don't think there's really any need for 
my proposed patch, unless it turns out in future that there are multiple 
packages like org-roam that need to supply org-id-finding abilities in a 
well-defined order.  So I suggest cancelling this.

I just proposed this as a change to org-roam:

https://github.com/org-roam/org-roam/pull/2432

Best
Rick

On Sat, 20 Apr 2024, at 12:07 PM, Ihor Radchenko wrote:
> 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: [BUG] oddity tangling src_blk with :var [9.7-pre (release_9.6.26-1368-g1ae978 @ /home/minshall/.emacs.d/straight/build/org/)]

2024-05-02 Thread Greg Minshall
Ihor,

> Then, if the backend does not define variable expansion method, do
> nothing. If the backend is not loaded, throw an error/warning (maybe
> depending on a customization).

great.  thanks.  if customizable, i'd vote to default with an error.


then, for what it's worth, my experience led me to write some code for a
command line program (basically, an elisp script) to tangle files.

if anyone is interested in playing/using it, that'd be great.  the idea
is to figure out what languages are needed by walking the source code
blocks, keeping track of languages, then set `org-babel-load-languages`
appropriately, and tangle the file.

https://sr.ht/~minshall/org-cli-tangle/


cheers, Greg



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

2024-05-02 Thread Ihor Radchenko
Alexander Adolf  writes:

>> Will the failure disappear if you try the attached patch?
>> [...]
>
> Yes, your patch fixes that test failure on macOS.

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

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



Re: [PATCH] test-ob-shell.el: Skip based on feature detection

2024-05-02 Thread Ihor Radchenko
Max Nikulin  writes:

>> Feel free to submit a patch.
>
> See the attachment.

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

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



Re: [BUG] ob-calc and decimal number in :var [9.7-pre (release_9.6.17-1446-g252971 @ /home/viz/lib/emacs/straight/build/org/)]

2024-05-02 Thread Visuwesh
[வியாழன் மே 02, 2024] Ihor Radchenko wrote:

> Ihor Radchenko  writes:
>
>>> #+BEGIN_SRC calc :var thetarot=1.3
>>>   1/thetarot
>>> #+END_SRC
>>>
>>> and witness the following error:
>>>
>>> Debugger entered--Lisp error: (wrong-type-argument listp 1.3)
>>>   nth(2 1.3)
>>
>> Confirmed.
>
> Fixed, on main.
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=dd12e9c76

Great, thanks!  Unfortunately, I couldn't find the time to find a proper
fix, thank you for your fix.



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

2024-05-02 Thread Alexander Adolf
Ihor Radchenko  writes:

> Alexander Adolf  writes:
>
>> 4 unexpected results:
>>FAILED  ob-calc/matrix-inversion  ((should (equal "[[-1, 0.625, -0.125], 
>> [0.25, -0.5, 0.25], [0.5, 0.125, -0.125]]" (org-babel-execute-src-block))) 
>> :form (equal "[[-1, 0.625, -0.125], [0.25, -0.5, 0.25], [0.5, 0.125, 
>> -0.125]]" "[[-1, 625e-3, -125e-3], [250e-3, -500e-3, 250e-3], [500e-3, 
>> 125e-3, -125e-3]]") :value nil :explanation (arrays-of-different-length 63 
>> 77 "[[-1, 0.625, -0.125], [0.25, -0.5, 0.25], [0.5, 0.125, -0.125]]" "[[-1, 
>> 625e-3, -125e-3], [250e-3, -500e-3, 250e-3], [500e-3, 125e-3, -125e-3]]" 
>> first-mismatch-at 6))
>
> Will the failure disappear if you try the attached patch?
> [...]

Yes, your patch fixes that test failure on macOS.


Hoping to have helped,

  --alexander



Re: [FR] Support headline as a function for file+headline target for org-capture-templates

2024-05-02 Thread Ihor Radchenko
Nafiz Islam  writes:

>> May you please describe what kind of feature you want to introduce and
>> explain why it is useful for other Org mode users?
>
> The feature I want to introduce is to allow the headline parameter to be a
> function for the `file+headline' target for the `org-capture-templates'.
> The function would take a list of headlines as a parameter, and the user
> would be able to pick a headline it wants to reuse or create a new one by
> returning a string. This makes it possible, for example, to pick a headline
> dynamically based on the current time (like in my case) to add an entry, or
> the user could implement a function that prompts with existing headlines to
> choose from.

Sounds reasonable.
Such a feature would require a new function similar to
`org-capture-expand-file', but for outlines.

Would you be interested to submit a patch?

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



Re: [BUG] ob-calc and decimal number in :var [9.7-pre (release_9.6.17-1446-g252971 @ /home/viz/lib/emacs/straight/build/org/)]

2024-05-02 Thread Ihor Radchenko
Ihor Radchenko  writes:

>> #+BEGIN_SRC calc :var thetarot=1.3
>>   1/thetarot 
>> #+END_SRC
>>
>> and witness the following error:
>>
>> Debugger entered--Lisp error: (wrong-type-argument listp 1.3)
>>   nth(2 1.3)
>
> Confirmed.

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

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



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

2024-05-02 Thread Ihor Radchenko
Alexander Adolf  writes:

> 4 unexpected results:
>FAILED  ob-calc/matrix-inversion  ((should (equal "[[-1, 0.625, -0.125], 
> [0.25, -0.5, 0.25], [0.5, 0.125, -0.125]]" (org-babel-execute-src-block))) 
> :form (equal "[[-1, 0.625, -0.125], [0.25, -0.5, 0.25], [0.5, 0.125, 
> -0.125]]" "[[-1, 625e-3, -125e-3], [250e-3, -500e-3, 250e-3], [500e-3, 
> 125e-3, -125e-3]]") :value nil :explanation (arrays-of-different-length 63 77 
> "[[-1, 0.625, -0.125], [0.25, -0.5, 0.25], [0.5, 0.125, -0.125]]" "[[-1, 
> 625e-3, -125e-3], [250e-3, -500e-3, 250e-3], [500e-3, 125e-3, -125e-3]]" 
> first-mismatch-at 6))

Will the failure disappear if you try the attached patch?

>From fb317be318aaf32104e9334d34813681c26ac240 Mon Sep 17 00:00:00 2001
Message-ID: 
From: Ihor Radchenko 
Date: Thu, 2 May 2024 15:07:12 +0300
Subject: [PATCH] ob-calc/matrix-inversion: Force `calc-float-format' in the
 test

* testing/lisp/test-ob-calc.el (ob-calc/matrix-inversion): When
testing, make sure that calc output follows the expected format.
This is needed on MacOS where Emacs defaults are not exactly the same.

Reported-by: Alexander Adolf 
Link: https://list.orgmode.org/orgmode/91dfeb0fed1a1fe0564e5eb9b95a4...@condition-alpha.com/
---
 testing/lisp/test-ob-calc.el | 9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/testing/lisp/test-ob-calc.el b/testing/lisp/test-ob-calc.el
index 6d6ca104d..e5f2cee0b 100644
--- a/testing/lisp/test-ob-calc.el
+++ b/testing/lisp/test-ob-calc.el
@@ -59,7 +59,14 @@ (ert-deftest ob-calc/matrix-inversion ()
 	inv(a)
 #+END_SRC "
 (should (equal "[[-1, 0.625, -0.125], [0.25, -0.5, 0.25], [0.5, 0.125, -0.125]]"
-   (org-babel-execute-src-block)
+   (let ((calc-float-format '(float 0)))
+ ;; ;; Make sure that older Calc buffers are not present.
+ (save-current-buffer
+   (when (ignore-errors (calc-select-buffer))
+ (kill-buffer)))
+ ;; Now, let-bound `calc-float-format' will take
+ ;; effect.
+ (org-babel-execute-src-block))
 
 (ert-deftest ob-calc/matrix-algebra ()
   "Test of simple matrix algebra."
-- 
2.44.0


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


Re: [BUG] org, ispell [9.6.6 (release_9.6.6 @ /Applications/Emacs.app/Contents/Resources/lisp/org/)]

2024-05-02 Thread Ihor Radchenko
Ihor Radchenko  writes:

> Confirmed.
>
> At this point, I feel that supporting isearch + text properties is an
> uphill battle. I was hoping to contribute isearch.el patch upstream, but
> apparently numerous other libraries (ispell, regexp-search, evil,
> swiper) are relying upon invisibility being handled in very specific
> way, using overlays. Considering that using overlays is no longer slower
> compared to text properties in Emacs 29+, I am thinking of slowly
> switching back to using overlays for folding for newer Emacs versions.

Org mode development branch will have `org-fold-core-style' defaulting
to 'overlays now as long as Emacs version is recent enough to handle
overlays efficiently.

Handled.

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



Re: link can not be created in a line with another link.

2024-05-02 Thread Ihor Radchenko
Max Nikulin  writes:

> I have a more weird example. Consider you are going to get
>
> - [[#foo]] and [[#bar]]
>
> starting from
>
> - [[#bar]]
>
> There is no problem till
>
> - [[#foo[[#bar]]
>
> However in response to "]" point is moved after "["
>
> - [[#foo][[#bar]]
>
> that is displayed as
>
> - [#bar
>
> I do not see other ways than undo, SPC, and moving back. It would be 
> great to keep point between brackets "][" this case. I have no 
> idea if it is feasible to postpone hiding link target when such pattern 
> is typed.

May you try the attached patch (on top of the latest main)?
Does it feel better?

>From fce16d736a97943f2f2cde521806dd78ed97a9bc Mon Sep 17 00:00:00 2001
Message-ID: 
From: Ihor Radchenko 
Date: Thu, 2 May 2024 11:49:00 +0300
Subject: [PATCH] Honor `org-fold-catch-invisible-edits' when editing links

* lisp/org.el (org-activate-links): Mark links with 'org-link text
property.
* lisp/org-fold.el (org-fold-show-set-visibility): Reveal links at
point for 'local detail.
(org-fold-check-before-invisible-edit): When editing after links, do
not warn about inserting after invisible.
*
testing/lisp/test-org-fold.el (test-org-fold/org-catch-invisible-edits):
Update tests.
* lisp/org-fold-core.el (org-fold-core-region): Do not re-fontify
unnecessarily.
---
 lisp/org-fold-core.el |  6 --
 lisp/org-fold.el  | 37 +++--
 lisp/org.el   |  1 +
 testing/lisp/test-org-fold.el | 39 +--
 4 files changed, 50 insertions(+), 33 deletions(-)

diff --git a/lisp/org-fold-core.el b/lisp/org-fold-core.el
index 41b16851f..1b2e41cf5 100644
--- a/lisp/org-fold-core.el
+++ b/lisp/org-fold-core.el
@@ -1047,9 +1047,11 @@ (defun org-fold-core-region (from to flag  spec-or-alias)
;; past the ellipsis.  See bug#65896.  The face properties are
;; assigned via `org-activate-folds'.
(when (or (not spec) (org-fold-core-get-folding-spec-property spec :font-lock))
- (when (equal ?\n (char-after from))
+ (when (and (equal ?\n (char-after from))
+(or flag (org-fold-folded-p from)))
(font-lock-flush from (1+ from)))
- (when (equal ?\n (char-after to))
+ (when (and (equal ?\n (char-after to))
+(or flag (org-fold-folded-p to)))
(font-lock-flush to (1+ to)))
  (dolist (region (org-fold-core-get-regions :from from :to to :specs spec))
(when (equal ?\n (char-after (cadr region)))
diff --git a/lisp/org-fold.el b/lisp/org-fold.el
index 1b62168c4..2c11383ba 100644
--- a/lisp/org-fold.el
+++ b/lisp/org-fold.el
@@ -658,8 +658,6 @@ (defun org-fold-show-set-visibility (detail)
 (org-fold-show-entry)
 ;; If point is hidden make sure to expose it.
 (when (org-invisible-p)
-  ;; FIXME: No clue why, but otherwise the following might not work.
-  (redisplay)
   ;; Reveal emphasis markers.
   (when (eq detail 'local)
 (let (org-hide-emphasis-markers
@@ -668,6 +666,7 @@ (defun org-fold-show-set-visibility (detail)
   (org-hide-macro-markers nil)
   (region (or (org-find-text-property-region (point) 'org-emphasis)
   (org-find-text-property-region (point) 'org-macro)
+  (org-find-text-property-region (point) 'org-link)
   (org-find-text-property-region (point) 'invisible
   ;; Silence byte-compiler.
   (ignore org-hide-macro-markers)
@@ -882,30 +881,34 @@ (defun org-fold-check-before-invisible-edit (kind)
   "Check if editing KIND is dangerous with invisible text around.
 The detailed reaction depends on the user option
 `org-fold-catch-invisible-edits'."
+  ;; When cursor is at a link that was revealed during previous edit,
+  ;; re-fold it, so that we refresh the fontification.
+  (font-lock-ensure (max (point-min) (1- (point))) (point))
   ;; First, try to get out of here as quickly as possible, to reduce overhead
   (when (and org-fold-catch-invisible-edits
 	 (or (not (boundp 'visible-mode)) (not visible-mode))
 	 (or (org-invisible-p)
 		 (org-invisible-p (max (point-min) (1- (point))
-;; OK, we need to take a closer look.  Only consider invisibility
-;; caused by folding of headlines, drawers, and blocks.  Edits
-;; inside links will be handled by font-lock.
-(let* ((invisible-at-point (org-fold-folded-p (point) '(headline drawer block)))
+;; OK, we need to take a closer look.
+(let* ((invisible-at-point (org-invisible-p (point)))
 	   (invisible-before-point
-	(and (not (bobp))
-	 (org-fold-folded-p (1- (point)) '(headline drawer block
+	(and (not (bobp)) (org-invisible-p (1- (point)
+   (folded-before-point
+	(and (not (bobp)) (org-fold-folded-p (1- (point)
 	   (border-and-ok-direction
 	(or
 	 ;; Check if we are acting predictably before invisible
 	 ;; text.
 	  

Re: [PATCH] Add support for shortdoc link type

2024-05-02 Thread Max Nikulin

On 02/05/2024 02:24, Bruno Cardoso wrote:

+++ b/lisp/ol.el
@@ -1597,6 +1597,37 @@ PATH is a symbol name, as a string."
  (org-link-set-parameters "help"
   :follow #'org-link--open-help
   :store #'org-link--store-help)
+ "shortdoc" link type
+(when (version< "27" emacs-version)
+  (defun org-link--open-shortdoc (group _)
+"Open a \"shortdoc\" type link.
+GROUP is a symbol name."
+(if (assoc (intern group) shortdoc--groups)
+(shortdoc-display-group group)
+  (user-error "Unknown shortdoc group: %s" group)))


`condition-case' may help to avoid the internal `shortdoc--groups' 
variable here. As to completion, it is better to ask for public API. 
However emacs developers likely will decline such request.


Consider the following just as ideas.

- Support of search options. Buttons in help pages move point to 
specific functions.




- At first I considered adding shortdoc to help links that may call 
either `describe-function' or `describe-variable', but it is unlikely 
possible.




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

2024-05-02 Thread Ihor Radchenko
Emmanuel Charpentier  writes:

>> (plist-put (alist-get 'dvipng org-preview-latex-process-alist)
>>     :image-converter
>>    '("dvipng -D %D -T tight -o %O %F"))
>
> Nope, same problem : the *Org Preview LaTeX Output* buffer says :
>
> ../../../../../tmp/orgtexSyy18r.dvi: No such file or directory
> This is dvipng 1.15 Copyright 2002-2015 Jan-Ake Larsson
>
> If I understand it correctly, the %F placeholder should be an
> *absolute* filename. It is not...

May you try the attached patch?
I changed the default command templates to use absolute paths
everywhere.

>From 7ac1aacb977ded45dc713b24e18d9068baaa5148 Mon Sep 17 00:00:00 2001
Message-ID: <7ac1aacb977ded45dc713b24e18d9068baaa5148.1714645744.git.yanta...@posteo.net>
From: Ihor Radchenko 
Date: Thu, 2 May 2024 13:19:37 +0300
Subject: [PATCH] org-preview-latex-process-alist: Work around relative path
 oddities in WSL

* lisp/org-macs.el (org-compile-file-commands): Add new allowed
placeholder %P - absolute path to output dir.
* lisp/org.el (org-preview-latex-process-alist): Use absolute paths
in commands.  List all the allowed placeholders in the docstring.

Reported-by: Emmanuel Charpentier 
Link: https://orgmode.org/list/87zftr4uaj.fsf@localhost
---
 lisp/org-macs.el | 18 ++
 lisp/org.el  | 18 ++
 2 files changed, 20 insertions(+), 16 deletions(-)

diff --git a/lisp/org-macs.el b/lisp/org-macs.el
index 1254ddb54..53dc75425 100644
--- a/lisp/org-macs.el
+++ b/lisp/org-macs.el
@@ -1690,12 +1690,12 @@ (defun org-compile-file-commands (source process ext  spec err-msg)
 the SOURCE file.
 
 If PROCESS is a list of commands, each of them is called using
-`shell-command'.  By default, in each command, %b, %f, %F, %o and
-%O are replaced with, respectively, SOURCE base name, relative
-file name, absolute file name, relative directory and absolute
-output file name.  It is possible, however, to use more
-place-holders by specifying them in optional argument SPEC, as an
-alist following the pattern
+`shell-command'.  By default, in each command, %b, %f, %F, %o, %P, and
+%O are replaced with, respectively, SOURCE base name, relative file
+name, absolute file name, relative output directory, absolute output
+directory, and absolute output file name.  It is possible, however, to
+use more place-holders by specifying them in optional argument SPEC,
+as an alist following the pattern
 
   (CHARACTER . REPLACEMENT-STRING).
 
@@ -1707,9 +1707,10 @@ (defun org-compile-file-commands (source process ext  spec err-msg)
  (pwd (file-truename default-directory))
  (absname (expand-file-name source pwd))
  (relname (if (file-name-absolute-p source)
-(file-relative-name source pwd)
-  source))
+  (file-relative-name source pwd)
+source))
 	 (relpath (or (file-name-directory relname) "./"))
+ (abspath (expand-file-name relpath))
 	 (output (concat (file-name-sans-extension absname) "." ext))
 	 (err-msg (if (stringp err-msg) (concat ".  " err-msg) "")))
 (pcase process
@@ -1720,6 +1721,7 @@ (defun org-compile-file-commands (source process ext  spec err-msg)
 			 (?f . ,(shell-quote-argument relname))
 			 (?F . ,(shell-quote-argument absname))
 			 (?o . ,(shell-quote-argument relpath))
+ (?P . ,(shell-quote-argument abspath))
 			 (?O . ,(shell-quote-argument output))
  (mapcar (lambda (command) (format-spec command spec)) process)))
   (_ (error "No valid command to process %S%s" source err-msg)
diff --git a/lisp/org.el b/lisp/org.el
index 809fd8ba3..1c78c2024 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -3326,10 +3326,10 @@ (defcustom org-preview-latex-process-alist
  :image-input-type "dvi"
  :image-output-type "png"
  :image-size-adjust (1.0 . 1.0)
- :latex-compiler ("latex -interaction nonstopmode -output-directory %o %f")
- :image-converter ("dvipng -D %D -T tight -o %O %f")
+ :latex-compiler ("latex -interaction nonstopmode -output-directory %P %F")
+ :image-converter ("dvipng -D %D -T tight -o %O %F")
  :transparent-image-converter
- ("dvipng -D %D -T tight -bg Transparent -o %O %f"))
+ ("dvipng -D %D -T tight -bg Transparent -o %O %F"))
 (dvisvgm
  :programs ("latex" "dvisvgm")
  :description "dvi > svg"
@@ -3337,7 +3337,7 @@ (defcustom org-preview-latex-process-alist
  :image-input-type "dvi"
  :image-output-type "svg"
  :image-size-adjust (1.7 . 1.5)
- :latex-compiler ("latex -interaction nonstopmode -output-directory %o %f")
+ :latex-compiler ("latex -interaction nonstopmode -output-directory %P %F")
  :image-converter ("dvisvgm %f --no-fonts --exact-bbox --scale=%S --output=%O"))
 (imagemagick
  :programs ("latex" "convert")
@@ -3346,9 +3346,9 @@ (defcustom org-preview-latex-process-alist
  :image-input-type "pdf"
  :image-output-type "png"
   

[PATCH] test-ob-shell.el: Skip based on feature detection

2024-05-02 Thread Max Nikulin

On 28/04/2024 20:11, Ihor Radchenko wrote:

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



Max Nikulin  writes:

Feature detection should be more reliable.

[...]


Feel free to submit a patch.


See the attachment.
From 46db53cebef5644be4abd8dcb18ca777ec0c3be3 Mon Sep 17 00:00:00 2001
From: Max Nikulin 
Date: Thu, 2 May 2024 17:09:10 +0700
Subject: [PATCH] test-ob-shell.el: Skip based on feature detection

* testing/lisp/test-ob-shell.el (test-ob-shell/bash-uses-assoc-arrays)
(test-ob-shell/bash-uses-assoc-arrays-with-lists): Use feature detection
shell command instead of version comparison to skip tests for
associative arrays.

It affects macOS since Apple ships BASH 3.2 licensed as GPLv2.
---
 testing/lisp/test-ob-shell.el | 20 +++-
 1 file changed, 7 insertions(+), 13 deletions(-)

diff --git a/testing/lisp/test-ob-shell.el b/testing/lisp/test-ob-shell.el
index f58e85815..b760031b4 100644
--- a/testing/lisp/test-ob-shell.el
+++ b/testing/lisp/test-ob-shell.el
@@ -230,6 +230,10 @@ (ert-deftest test-ob-shell/bash-uses-assoc-arrays ()
 Bash will see a table that contains the first column as the
 'index' of the associative array, and the second column as the
 value. "
+  (skip-unless
+   ;; Old GPLv2 BASH in macOSX does not support associative arrays.
+   (if-let ((bash (executable-find "bash")))
+   (eq 0 (process-file bash nil nil nil "-c" "declare -A assoc_array"
   (org-test-with-temp-text
   "#+NAME: sample_mapping_table
 | first  | one   |
@@ -240,13 +244,6 @@ (ert-deftest test-ob-shell/bash-uses-assoc-arrays ()
 echo ${table[second]}
 
 #+end_src "
-(skip-unless (executable-find "bash"))
-(skip-unless
- (let* ((version-string (shell-command-to-string "bash -c 'echo $BASH_VERSION'"))
-(major-version (and (string-match "^\\([0-9]+\\)\\." version-string)
-			(string-to-number (match-string 1 version-string)
-   ;; Bash 4.0 introduced associative arrays support.
-   (>= major-version 4)))
 (should
  (equal "two"
 (org-trim (org-babel-execute-src-block))
@@ -256,13 +253,10 @@ (ert-deftest test-ob-shell/bash-uses-assoc-arrays-with-lists ()
 
 Bash will see an associative array that contains each row as a single
 string. Bash cannot handle lists in associative arrays."
-  (skip-unless (executable-find "bash"))
   (skip-unless
-   (let* ((version-string (shell-command-to-string "bash -c 'echo $BASH_VERSION'"))
-  (major-version (and (string-match "^\\([0-9]+\\)\\." version-string)
-			  (string-to-number (match-string 1 version-string)
- ;; Bash 4.0 introduced associative arrays support.
- (>= major-version 4)))
+   ;; Old GPLv2 BASH in macOSX does not support associative arrays.
+   (if-let ((bash (executable-find "bash")))
+   (eq 0 (process-file bash nil nil nil "-c" "declare -A assoc_array"
   (org-test-with-temp-text
   "#+NAME: sample_big_table
 | bread |  2 | kg |
-- 
2.39.2