Re: [BUG] Setting org-map-continue from to avoid skipping headings while archiving no longer works [9.5.2 (9.5.2-gd01235 @ /home/john/.emacs.d/straight/build/org/)]

2021-12-31 Thread Ihor Radchenko
Ihor Radchenko  writes:

> I tried to make sure that org-map-continue-from is not broken, but your
> scenario is apparently not covered by our tests.
>
> Let me investigate and fix this.

It turned out to be more tricky than I thought.

Fixed by 06f58e475

Let me know if you are still seeing the problem.

Best,
Ihor



Re: [BUG] ob-python :results value pp does not working

2021-12-31 Thread Jack Kamm
Hi Christopher,

> This might need to mentioned in Org manual and in ob-python.el source
> code with comment. WDYT?

The main documentation for this is in the Worg page for ob-python, in
particular see the section "Return values":

https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-python.html

I think that is the appropriate place to put this sort of documentation
(i.e. usage of specific babel languages). However, the clarity of this
documentation could be improved; contributions on that would be very
welcome.

In addition, this is also mentioned in the Org manual on return values
in Org babel, "Results of Evaluation":

For languages like Python, an explicit ‘return’ statement is
mandatory when using ‘:results value’.



Re: org table problems with sorting of some column

2021-12-31 Thread Tim Cross


Uwe Brauer  writes:

> [[S/MIME Signed Part:Undecided]]
 "TC" == Tim Cross  writes:
>
>> Uwe Brauer  writes:
>
>
>> For problem 1, I suspect you will need to either change the date format
>> or tell org what the date format is. It won't work trying to sort
>> numerically as those values are not really numerical values. The date
>> format you currently have I think is ambiguous - in Europe it would
>> represent dd-mm-, but in the US it would represent mm-dd-. Best
>> solution would be to convert the values into an ISO format i.e.
>> -mm-dd.
>
> I just checked 
> I have the setting 
> ,
> | org-time-stamp-custom-formats is a variable defined in ‘org.el’.
> | Its value is (" %d.%m.%Y " . " %d.%m.%Y %a %H:%M ")
> `
>
> But this as I understand only effect via 
> ‘org-display-custom-times’ the representation. 
>
> It does not help me to recognise  28.04.2020 as a European date.
>
> [[End of S/MIME Signed Part]]

I suspect org is actually passing off the sorting/comparison to calc
(based on nothing but a guess of course). I would look into how calc
determines the format for date/time calculations and see if that can
help.



Re: [PATCH] ob-shell-test, test-ob-shell and introduction

2021-12-31 Thread Thomas S. Dye

Aloha Matt,

Matt  writes:


 > Wow.  Nice work!

Thanks. I pushed things to Worg, if you haven't seen already 
(https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-shell.html). 
If you read it and find anything missing or unclear, please let 
me know. I'm still waiting on work to sign the FSF disclaimer in 
order to work on ob-shell.el. I might just implement something 
on the side and use that to inform any future contributions.


I was looking at the Worg page when I wrote "Wow" :)

Many thanks for this contribution.

All the best,
Tom

--
Thomas S. Dye
https://tsdye.online/tsdye



Re: [PATCH] ob-shell-test, test-ob-shell and introduction

2021-12-31 Thread Matt


 > Wow.  Nice work!

Thanks. I pushed things to Worg, if you haven't seen already 
(https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-shell.html). If 
you read it and find anything missing or unclear, please let me know. I'm still 
waiting on work to sign the FSF disclaimer in order to work on ob-shell.el. I 
might just implement something on the side and use that to inform any future 
contributions.



bug#52545: 29.0.50; Make org-babel-execute-buffer ignore irrelevant src blocks

2021-12-31 Thread Berry, Charles
Max,

> On Dec 31, 2021, at 4:05 AM, Max Nikulin  wrote:
> 
> 
> Should some function a macro be provided to facilitate declaring languages as 
> data format (config files, JSON, YAML, etc.) rather than executable source 
> code?

I think we already have this in the form of export blocks, viz.

#+name: yaml_header_1
#+begin_export yaml
output:
  html_document:
toc: true
toc_depth: 2
#+end_export

will be ignored by babel and by exporters that do not define a transcoder for 
`yaml' blocks.

The data can be used in transcoders for derived backends or in src blocks like 
this one:

#+begin_src emacs-lisp :var yaml_dat_1=yaml_header_1
  yaml_dat_1
#+end_src

And =C-c '= will invoke an edit buffer in yaml mode (if available).

And it seems that fontifying natively works just as with src blocks.

Best,
Chuck







Re: [PATCH] ob-shell-test, test-ob-shell and introduction

2021-12-31 Thread Thomas S. Dye

Aloha Matt,

Wow.  Nice work!

All the best,
Tom

Matt  writes:

 > Contributions to Worg aren't similarly restricted.  Feel free 
 > to 
 > push material there in the meantime.


Looks like the email finally got sent to the right person at my 
company. Who knows how long it will take for them to get the FSF 
disclaimer back to me...


Now that I'm on holiday, I've got a little more time to 
contribute to Worg. Here's a few patches showing what I've come 
up with. I'll finish it up in the next few days, hopefully.  Not 
sure if the patches are formed correctly,  sorry about that if 
not. It's late here and I wanted to show progress. I'll worry 
about those kinds of details later. :)



--
Thomas S. Dye
https://tsdye.online/tsdye



Re: ascii-timestamps like 31.12.2021 to iso(org) format <2020-12-31> and back

2021-12-31 Thread Eric S Fraga
On Friday, 31 Dec 2021 at 17:05, Uwe Brauer wrote:
> Thanks the \{4\} surprise me. I tried
>
> (query-replace-regexp "\\(\\<[0-9]*\\)\\([\\.]\\)\\([0-9]*\\>\\)" "\\3\\2\\1")

Not sure what this is trying to do.  If it's going from <2021-12-31> to 
31.12.2021, you shouldn't escape the < or >, you are not matching the -, and 
there are only 2 number matches.  Maybe you want

<\\([0-9]+\\)-\\([0-9]+\\)-\\([0-9]+\\)>
to
\\3.\\2.\\1

?

-- 
: Eric S Fraga, with org release_9.5.2-289-gce75d2 in Emacs 29.0.50
: Latest paper written in org: https://arxiv.org/abs/2106.05096



Re: ascii-timestamps like 31.12.2021 to iso(org) format <2020-12-31> and back

2021-12-31 Thread Uwe Brauer
>>> "ESF" == Eric S Fraga  writes:

> On Friday, 31 Dec 2021 at 14:21, Uwe Brauer wrote:
>> ⚠️ Caution: External sender
>> 
>> 
>> Hi
>> 
>> Does anybody know about a function that would convert between
>> date format  like 31.12.2021 to  <2020-12-31> and back?

> This is Emacs, of course, so you could use query-replace-regexp (M-%)
> with, for instance

> \([0-9][0-9]\)\.\([0-9][0-9]\)\.\([0-9]\{4\}\)

> as the pattern to search for and

> <\3-\2-\1>

> as the replacement.  The converse is left as an exercise for the
> reader. ;-)

Thanks the \{4\} surprise me. I tried

(query-replace-regexp "\\(\\<[0-9]*\\)\\([\\.]\\)\\([0-9]*\\>\\)" "\\3\\2\\1")

And that did not work.

Uwe 


smime.p7s
Description: S/MIME cryptographic signature


[PATCH] Re: [BUG] Underlined text in parentheses is not exported correctly

2021-12-31 Thread Ihor Radchenko
Juan Manuel Macías  writes:

>> The priority appears to be intentional.
>
> I see. But then the compatibility with the rest of the emphasis is
> broken. I mean, the user would expect things like (_underline_) will be
> exported as (\uline{underline}), in the same way that (/emphasis/) is
> exported as (\emph{emphasis}). I would say there is a slight
> inconsistency in the syntax here.

I agree with you. I think that the initial intention was to avoid
parsing things like (x+y)_1+x_2 as underline.

However, thinking about it more, I feel that prioritising underline
should work better. The underline parser recently got changed into a
stricter version. Now, only underlines starting after spaces,-,(,',",
and { are recognised as an underlines.

So, the attached patch is changing the priority of the parsing.
Maybe Nicolas knows some tricky cases when the patch makes things wrong,
but those cases are certainly not covered by tests.

Best,
Ihor

>From 12272f1ea89c169dcbece009c3a227e354019366 Mon Sep 17 00:00:00 2001
Message-Id: <12272f1ea89c169dcbece009c3a227e354019366.1640961654.git.yanta...@gmail.com>
From: Ihor Radchenko 
Date: Fri, 31 Dec 2021 22:39:03 +0800
Subject: [PATCH] Fix underline parser inside parenthesis

* lisp/org-element.el (org-element--object-lex): prioritise underline
parser over subscript.  `org-element-underline-parser' is more strict
compared to `org-element-subscript-parser'.
* testing/lisp/test-org-element.el (test-org-element/underline-parser):
Add test.

Fixes https://list.orgmode.org/87v8z52eom@posteo.net/T/#t
---
 lisp/org-element.el  |  8 
 testing/lisp/test-org-element.el | 11 ++-
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/lisp/org-element.el b/lisp/org-element.el
index 45ddc79b7..c9d1d80bb 100644
--- a/lisp/org-element.el
+++ b/lisp/org-element.el
@@ -4850,10 +4850,10 @@ (defun org-element--object-lex (restriction)
 		(pcase (char-after)
 		  (?^ (and (memq 'superscript restriction)
 			   (org-element-superscript-parser)))
-		  (?_ (or (and (memq 'subscript restriction)
-   (org-element-subscript-parser))
-			  (and (memq 'underline restriction)
-   (org-element-underline-parser
+		  (?_ (or (and (memq 'underline restriction)
+   (org-element-underline-parser))
+  (and (memq 'subscript restriction)
+   (org-element-subscript-parser
 		  (?* (and (memq 'bold restriction)
 			   (org-element-bold-parser)))
 		  (?/ (and (memq 'italic restriction)
diff --git a/testing/lisp/test-org-element.el b/testing/lisp/test-org-element.el
index 338204eab..b58d71c8c 100644
--- a/testing/lisp/test-org-element.el
+++ b/testing/lisp/test-org-element.el
@@ -2661,7 +2661,16 @@ (ert-deftest test-org-element/underline-parser ()
  (org-test-with-temp-text "_first line\nsecond line_"
(org-element-map
 	   (org-element-parse-buffer) 'underline #'identity nil t)))
-'("first line\nsecond line"
+'("first line\nsecond line")))
+  ;; Starting after non-blank
+  (should
+   (eq 'underline
+   (org-test-with-temp-text "(_underline_)"
+ (org-element-type (org-element-context)
+  (should-not
+   (eq 'underline
+   (org-test-with-temp-text "x_underline_)"
+ (org-element-type (org-element-context))
 
 
  Verbatim
-- 
2.32.0



Re: ascii-timestamps like 31.12.2021 to iso(org) format <2020-12-31> and back

2021-12-31 Thread Eric S Fraga
On Friday, 31 Dec 2021 at 14:21, Uwe Brauer wrote:
> ⚠️ Caution: External sender
>
>
> Hi
>
> Does anybody know about a function that would convert between
> date format  like 31.12.2021 to  <2020-12-31> and back?

This is Emacs, of course, so you could use query-replace-regexp (M-%)
with, for instance

\([0-9][0-9]\)\.\([0-9][0-9]\)\.\([0-9]\{4\}\)

as the pattern to search for and

<\3-\2-\1>

as the replacement.  The converse is left as an exercise for the
reader. ;-)

-- 
: Eric S Fraga, with org release_9.5.2-289-gce75d2 in Emacs 29.0.50
: Latest paper written in org: https://arxiv.org/abs/2106.05096



ascii-timestamps like 31.12.2021 to iso(org) format <2020-12-31> and back

2021-12-31 Thread Uwe Brauer


Hi

Does anybody know about a function that would convert between 
date format  like 31.12.2021 to  <2020-12-31> and back?

Thanks

Uwe Brauer 




bug#52545: 29.0.50; Make org-babel-execute-buffer ignore irrelevant src blocks

2021-12-31 Thread Max Nikulin

On 30/12/2021 15:00, Rudolf Adamkovič wrote:


#+property: header-args:bibtex+ :eval yes


Why do you set ":eval yes" explicitly for bibtex if you believe that it 
should not be executed?


I suppose, the following may be considered as a complete example 
suitable to compare behavior of `org-babel-execute-buffer' and export:


 >8 
#+property: header-args:bibtex+ :exports none

Test file with =bibtex= (to tangle)
and =elisp= (to execute) code blocks.

#+begin_src bibtex :tangle yes
  @misc{ex1,
title = "Example"
  }
#+end_src

#+begin_src elisp
  (message "From elisp")
#+end_src
 8< 

To solve the problem avoiding per-file configuration you can try

   (setq org-babel-default-header-args:bibtex '((:eval . "no")))

Unsure if it should be default. Since LaTeX export is important part of 
Org it is reasonable to expect that Org have some notion of BibTeX 
allowing to avoid execution of such source blocks.


Currently there is no BibTeX babel backend, but some user might create 
one that e.g. formats entries as some alternative to org-cite. Can 
default header arguments cause a problem in such case?


Should some function a macro be provided to facilitate declaring 
languages as data format (config files, JSON, YAML, etc.) rather than 
executable source code?






Re: [BUG] Underlined text in parentheses is not exported correctly

2021-12-31 Thread Juan Manuel Macías
Ihor Radchenko writes:

> I am not sure if  it is an actual issue.
>
> Note that (_u can be interpreted as a subscript.
> Org prioritises subscript over underline.
>
> Looking at the code:
>
> (?_ (or (and (memq 'subscript restriction)
>  (org-element-subscript-parser))
>   (and (memq 'underline restriction)
>  (org-element-underline-parser
>
> The priority appears to be intentional.

I see. But then the compatibility with the rest of the emphasis is
broken. I mean, the user would expect things like (_underline_) will be
exported as (\uline{underline}), in the same way that (/emphasis/) is
exported as (\emph{emphasis}). I would say there is a slight
inconsistency in the syntax here.

Anyway, in my case I have solved it by always forcing the
super/sub-scripts with brackets overriding `org-element-subscript-parser'
(I never use them without brackets), as I mentioned in my previous
message.

Best regards,

Juan Manuel 



Re: [BUG] Underlined text in parentheses is not exported correctly

2021-12-31 Thread Ihor Radchenko
Juan Manuel Macías  writes:

> I don't know if this is a known issue...
>
> Consider the text:
>
> (_underline_)

I am not sure if  it is an actual issue.

Note that (_u can be interpreted as a subscript.
Org prioritises subscript over underline.

Looking at the code:

(?_ (or (and (memq 'subscript restriction)
   (org-element-subscript-parser))
  (and (memq 'underline restriction)
   (org-element-underline-parser

The priority appears to be intentional.

Unless Nicolas (the author of this code) sees anything wrong here, I
recommend you to use zero-width space in front of the first _ to make
sure that you obtain underline, not subscripts (see
https://orgmode.org/manual/Escape-Character.html#Escape-Character)

P.S.
Note that the fontification you observe in Org is wrong. It is not how
the actual exporter sees the text. I am sorry about this. Fixing the
fontification is a work-in-progress.

Best,
Ihor




Re: [BUG] Underlined text in parentheses is not exported correctly

2021-12-31 Thread Juan Manuel Macías
Juan Manuel Macías writes:

> If I do M-! (occur org-match-substring-regexp)
>
> I get:
>
>  10:(_underline_)
>  22:(_underline_ text)

Well, in my case the temporary workaround was to force super/subscripts
with braces:

#+begin_src emacs-lisp
  (defun my-org-element-subscript-with-braces-parser ()
(save-excursion
  (unless (bolp) (backward-char))
  (when (looking-at org-match-substring-with-braces-regexp)
(let ((bracketsp (match-beginning 4))
  (begin (match-beginning 2))
  (contents-begin (or (match-beginning 4)
  (match-beginning 3)))
  (contents-end (or (match-end 4) (match-end 3)))
  (post-blank (progn (goto-char (match-end 0))
 (skip-chars-forward " \t")))
  (end (point)))
  (list 'subscript
(list :begin begin
  :end end
  :use-brackets-p bracketsp
  :contents-begin contents-begin
  :contents-end contents-end
  :post-blank post-blank))

(advice-add 'org-element-subscript-parser :override 
#'my-org-element-subscript-with-braces-parser)
#+end_src



Re: bug#52771: 29.0.50; org-fill-paragraph does not work for several plain lists

2021-12-31 Thread Sébastien Miquel

Hi,

Kyle Meyer writes:

Rudolf Adamkovič writes:


Reproduction steps:

1. start "emacs -Q"
2. type "C-x C-f" and "test.org" and RET
3. type the following:

- one

  two

- three
  four

4. mark all with "C-x h"
5. type "M-q" to fill

Actual:

- one
  two

- three four

Expected:

- one two

- three four


Note that this issue is fixed by the patch proposed at

https://list.orgmode.org/041ca43d-2efb-db1e-76ab-7c15af088...@posteo.eu/

Regards,

--
Sébastien Miquel


[BUG] Underlined text in parentheses is not exported correctly

2021-12-31 Thread Juan Manuel Macías
Hi all,

I don't know if this is a known issue...

Consider the text:

(_underline_)

When exported to LaTeX we get:

(\textsubscript{underline}\_)

And to HTML:

(underline_)

The same result with:

(_underline_ text)

LaTeX:

(\textsubscript{underline}\_ text)

But this:

(this word is _underline_)

is exported correctly:

(this word is \uline{underline})

If I do M-! (occur org-match-substring-regexp)

I get:

 10:(_underline_)
 22:(_underline_ text)

Best regards, and happy New Year,

Juan Manuel 



Re: org table problems with sorting of some column

2021-12-31 Thread Uwe Brauer
>>> "TC" == Tim Cross  writes:

> Uwe Brauer  writes:


> For problem 1, I suspect you will need to either change the date format
> or tell org what the date format is. It won't work trying to sort
> numerically as those values are not really numerical values. The date
> format you currently have I think is ambiguous - in Europe it would
> represent dd-mm-, but in the US it would represent mm-dd-. Best
> solution would be to convert the values into an ISO format i.e.
> -mm-dd.

I just checked 
I have the setting 
,
| org-time-stamp-custom-formats is a variable defined in ‘org.el’.
| Its value is (" %d.%m.%Y " . " %d.%m.%Y %a %H:%M ")
`

But this as I understand only effect via 
‘org-display-custom-times’ the representation. 

It does not help me to recognise  28.04.2020 as a European date.


smime.p7s
Description: S/MIME cryptographic signature


Re: org table problems with sorting of some column

2021-12-31 Thread Uwe Brauer
>>> "TC" == Tim Cross  writes:

> Uwe Brauer  writes:

>> [[S/MIME Signed Part:Undecided]]
>> 
>> 
>> * Problem 1
>> 
>> I imported this column from a CVS file, so the date format was already 
>> chosen.
>> 
>> |   Date |
>> ||
>> | 05.05.2020 |
>> | 07.01.2021 |
>> | 07.01.2021 |
>> | 07.05.2020 |
>> | 09.03.2021 |
>> | 12.05.2020 |
>> | 13.02.2020 |
>> | 13.03.2020 |
>> | 13.03.2020 |
>> | 14.05.2020 |
>> | 15.02.2021 |
>> | 15.02.2021 |
>> | 17.02.2020 |
>> | 17.04.2020 |
>> | 20.04.2020 |
>> | 22.04.2020 |
>> | 23.06.2020 |
>> | 24.02.2021 |
>> | 24.04.2020 |
>> | 25.09.2020 |
>> | 25.11.2020 |
>> 
>> I'd like to sort these dates, but when I do that numerically it does not 
>> work as expected, any idea what to do.
>> 
>> 
>> * Problem 2
>> I'd like to order the column below descending 
>> 
>> |   Income |
>> |--|
>> |   837.00 |
>> |   681.71 |
>> |   664.16 |
>> |   499.46 |
>> |   316.64 |
>> |   258.30 |
>> |   258.30 |
>> |   258.30 |
>> |   187.52 |
>> |   173.15 |
>> |   170.87 |
>> |   163.50 |
>> |   127.76 |
>> |   117.00 |
>> |94.80 |
>> |91.00 |
>> | 2.852.21 |
>> | 2.401.74 |
>> | 1.912.16 |
>> | 1.735.14 |
>> | 1.480.87 |
>> | 1.407.73 |
>> 
>> But again it does not work.
>> 
>> Any idea what to do?
>> 
>> regards
>> 
>> Uwe Brauer 
>> 
>> [[End of S/MIME Signed Part]]

> When reporting a problem, it would really help if you made it clear what
> you have tried and how it didn't work. From your description above, it
> is impossible to know if you actually tried using the built-in table
> sorting command and if you did, how you used it (what input, how you
> tried calling it etc). You also don't provide any details on what did
> not work - was it an error, was the sorting wrong, did nothing happen at
> all? There is also no details regarding your Emacs version or the org
> version you are running. 


Point taken. I am using 
GNU Emacs master 846ff294206c922da
org master commit e2fa3c4c4046b

> For problem 1, I suspect you will need to either change the date format
> or tell org what the date format is. It won't work trying to sort
> numerically as those values are not really numerical values. The date
> format you currently have I think is ambiguous - in Europe it would
> represent dd-mm-, but in the US it would represent mm-dd-. Best
> solution would be to convert the values into an ISO format i.e.
> -mm-dd.


It is a European format: dd.mm. 

So the most convenient way would be to tell org to use that format,
since changing the format to iso, would require to use a sophisticated
reg-expression.

I had a quick look but I cannot find a way to tell org to use the
European dd.mm.  format.




> For problem 2, I suspect the issue is because all your values are not
> numerical. The value 2.852.21 might be composed of numbers, but that is
> not a numerical value (what is the value of 1 + 2.852.21?). Org will
> interpret those values as strings and will sort them alphabetically.

Right, sorry 

| 2.852.21 |
| 2.401.74 |
| 1.912.16 |
| 1.735.14 |
| 1.480.87 |
| 1.407.73 |

Does not make much sense, I replace it by 

| 2852.21 |
| 2401.74 |
| 1912.16 |
| 1735.14 |
| 1480.87 |
| 1407.73 |

And everything worked as expected.


smime.p7s
Description: S/MIME cryptographic signature