Re: [DRAFT PATCH v3] Decouple LANG= and testing (was: Test failure due to LANG)

2023-04-22 Thread Axel Kielhorn



> Am 23.04.2023 um 03:47 schrieb Ruijie Yu via General discussions about 
> Org-mode. :
> 
> 
> Ruijie Yu via "General discussions about Org-mode."  
> writes:
> 
>> Axel Kielhorn  writes:
>> 
>>> With this patch I get:
>>>   FAILED  test-org-clock/clock-drawer-dwim  arrayp
>>>   FAILED  test-org-clok/org-clock-timestamps-change  arrayp
>>> 
>>> Axel
>> 
>> Thanks for testing.  Will take a look tomorrow.
> 
> Apparently `seq-map' does not preserve the type of its input.  This
> patch be good then?
> 
> <0001-DRAFT-Fix-dependence-on-locale-in-org-testing-facili.patch>

This works for me, thanks.

Axel




Where can I find the full specification of a timestamp?

2023-04-22 Thread General discussions about Org-mode.
Hello,

In the process of trying to fix all non-default-locale-related test
failures, I ran into a weird-looking timestamp somewhere around
testing/lisp/test-org.el:5969, in test `test-org/deadline':

<2021-07-20 -1d>

I couldn't find relevant information from the info page on the first try
(by having a quick scan in (info "(org) Dates and Times")).  The
previous comment says it is something called "warning period", which
then hints me at (info "(org) Deadlines and Scheduling").

My question is, what would the full specification of a timestamp be?
Or, phrased differently, what else am I missing, and where can I find
documentation for these optional fields?

Thanks.

-- 
Best,


RY

[Please note that this mail might go to spam due to some
misconfiguration in my mail server -- still investigating.]



Re: [DRAFT PATCH v3] Decouple LANG= and testing (was: Test failure due to LANG)

2023-04-22 Thread General discussions about Org-mode.

Ruijie Yu via "General discussions about Org-mode."  
writes:

> Axel Kielhorn  writes:
>
>> With this patch I get:
>>FAILED  test-org-clock/clock-drawer-dwim  arrayp
>>FAILED  test-org-clok/org-clock-timestamps-change  arrayp
>>
>> Axel
>
> Thanks for testing.  Will take a look tomorrow.

Apparently `seq-map' does not preserve the type of its input.  This
patch be good then?

>From 7621108e377c71cf083389e7bdb6f9d76cd07461 Mon Sep 17 00:00:00 2001
From: Ruijie Yu 
Date: Sat, 22 Apr 2023 20:36:18 +0800
Subject: [PATCH] [DRAFT] Fix dependence on locale in org testing facilities

* testing/org-test.el org-test-day-of-weeks-seconds: add values of
seconds that yield different days of week (by trial-and-error).
org-test-day-of-weeks-abbrev: add a vector of abbreviated DoW
names for testing.
org-test-day-of-weeks-full: add a vector of full DoW names for
testing.

* testing/lisp/test-org-clock.el
(test-org-clok/org-clock-timestamps-change):
(test-org-clock/clock-drawer-dwim): make use of the pre-generated
DoW names in the testing to remove assumptions on LANG=C.
---
 testing/lisp/test-org-clock.el | 62 +++---
 testing/org-test.el| 25 ++
 2 files changed, 59 insertions(+), 28 deletions(-)

diff --git a/testing/lisp/test-org-clock.el b/testing/lisp/test-org-clock.el
index 7d8123e1f..4d9306619 100644
--- a/testing/lisp/test-org-clock.el
+++ b/testing/lisp/test-org-clock.el
@@ -91,27 +91,32 @@ the buffer."
 
 (ert-deftest test-org-clok/org-clock-timestamps-change ()
   "Test `org-clock-timestamps-change' specifications."
-  (should
-   (equal
-"CLOCK: [2023-02-19 Sun 21:30]--[2023-02-19 Sun 23:35] =>  2:05"
-(org-test-with-temp-text
-"CLOCK: [2023-02-19 Sun 22:30]--[2023-02-20 Mon 00:35] =>  2:05"
-  (org-clock-timestamps-change 'down 1)
-  (buffer-string
-  (should
-   (equal
-"CLOCK: [2023-02-20 Mon 00:00]--[2023-02-20 Mon 00:40] =>  0:40"
-(org-test-with-temp-text
-"CLOCK: [2023-02-19 Sun 23:55]--[2023-02-20 Mon 00:35] =>  0:40"
-  (org-clock-timestamps-change 'up 1)
-  (buffer-string
-  (should
-   (equal
-"CLOCK: [2023-02-20 Mon 00:30]--[2023-02-20 Mon 01:35] =>  1:05"
-(org-test-with-temp-text
-"CLOCK: [2023-02-19 Sun 23:30]--[2023-02-20 Mon 00:35] =>  1:05"
-  (org-clock-timestamps-change 'up 1)
-  (buffer-string)
+  (let ((sun (aref org-test-day-of-weeks-abbrev 0))
+(mon (aref org-test-day-of-weeks-abbrev 1)))
+(should
+ (equal
+  (format "CLOCK: [2023-02-19 %s 21:30]--[2023-02-19 %s 23:35] =>  2:05"
+  sun sun)
+  (org-test-with-temp-text
+  "CLOCK: [2023-02-19 Sun 22:30]--[2023-02-20 Mon 00:35] =>  2:05"
+(org-clock-timestamps-change 'down 1)
+(buffer-string
+(should
+ (equal
+  (format "CLOCK: [2023-02-20 %s 00:00]--[2023-02-20 %s 00:40] =>  0:40"
+  mon mon)
+  (org-test-with-temp-text
+  "CLOCK: [2023-02-19 Sun 23:55]--[2023-02-20 Mon 00:35] =>  0:40"
+(org-clock-timestamps-change 'up 1)
+(buffer-string
+(should
+ (equal
+  (format "CLOCK: [2023-02-20 %s 00:30]--[2023-02-20 %s 01:35] =>  1:05"
+  mon mon)
+  (org-test-with-temp-text
+  "CLOCK: [2023-02-19 Sun 23:30]--[2023-02-20 Mon 00:35] =>  1:05"
+(org-clock-timestamps-change 'up 1)
+(buffer-string))
 
 
 ;;; Clock drawer
@@ -299,19 +304,20 @@ the buffer."
 
 (ert-deftest test-org-clock/clock-drawer-dwim ()
   "Test DWIM update of days for clocks in logbook drawers."
-  (should (equal "* Foo
+  (let ((thu (aref org-test-day-of-weeks-abbrev 4)))
+(should (equal (format "* Foo
 :LOGBOOK:
-CLOCK: [2022-11-03 Thu 06:00]--[2022-11-03 Thu 06:01] =>  0:01
+CLOCK: [2022-11-03 %s 06:00]--[2022-11-03 %s 06:01] =>  0:01
 :END:
-"
- (org-test-with-temp-text
- "* Foo
+" thu thu)
+   (org-test-with-temp-text
+   "* Foo
 :LOGBOOK:
 CLOCK: [2022-11-03 ??? 06:00]--[2022-11-03 ??? 06:01] =>  0:01
 :END:
 "
-   (org-ctrl-c-ctrl-c)
-   (buffer-string)
+ (org-ctrl-c-ctrl-c)
+ (buffer-string))
 
 
 ;;; Clocktable
diff --git a/testing/org-test.el b/testing/org-test.el
index 22ac60670..ced281e23 100644
--- a/testing/org-test.el
+++ b/testing/org-test.el
@@ -547,6 +547,31 @@ TIME can be a non-nil Lisp time value, or a string specifying a date and time."
,@body)
  (nreverse messages)))
 
+(defconst org-test-day-of-weeks-seconds
+  [121223891; Sun
+   3000 ; Mon
+   222  ; Tue
+   50   ; Wed
+   1000 ; Thu
+   89173; Fri
+   6]   ; Sat
+  "Epoch seconds for generating days of week strings.
+Starts at Sunday, 

Re: [orgweb/zh-CN] [DRAFT PATCH v7] Tentative zh-CN translation

2023-04-22 Thread General discussions about Org-mode.


Ihor Radchenko  writes:

> Ruijie Yu  writes:
>
>>> May I know why you use comment here and in similar places? This
>>> @@comment:...@@ thing is a bit of a hack as it is actually representing
>>> inline export snippet to non-existent "comment" export backend.
>>>
>>> I am not sure why this has been even added originally.
>>
>> I saw the existing inline comments somewhere and started to use it as
>> well.  I don't have a strong opinion as to whether the comments should
>> be kept or removed.
>
> I have no strong opinion either. You can do whatever is easier.

Since it adds nothing to the export, and removing it adds a bit of extra
work for me, I'll leave it at the current state and avoid adding new
inline comments of this kind.

 +  3. 调料
 + + 糖
 + + 盐
>>>
>>> That's a curious seasoning for omelet, but so be it ;)
>>
>> Well, I didn't have omelet-making in mind, and was just trying to
>> replace cheese with something more common.
>>
>> [Wait, omelets require milk?]
>
> Some people do add it. For example, see the discussion in
> https://old.reddit.com/r/Cooking/comments/t188k9/egg_milk_ratio_for_omelets/

Can't easily access that link, but I'll take your word for it. :)

 -Worried about aligning free text tables?
 -Org mode does it in a single keystroke -- =tab=.
 +担心无法在文本表格中对齐?你只需按一个键 - =tab=​。
>>>
>>> May I know the purpose of adding extra "-"?
>>
>> Double-dash only renders as a short dash on HTML, whereas quintuple-dash
>> yields a long dash.  This is more in the spirit of Chinese writing,
>> because we usually use two full-width dashes as a "dash punctuation".
>
> Maybe just use \mdash entity then?

Sure, I find double-\mdash looks good on HTML as well.

-- 
Best,


RY

[Please note that this mail might go to spam due to some
misconfiguration in my mail server -- still investigating.]



[BUG] RFE: Including src-blocks from different files when tangling the code [9.5.5 (release_9.5.5 @ /usr/share/emacs/28.2/lisp/org/)]

2023-04-22 Thread Garid Z.


I have following Request for Enhancement: Write src-block in separate
org-file(s), and when time comes to tangle use all those src-blocks
using some sort of reference.

In other words, take a look at following an example:



* This is ~/tmp/1.org~ file:

#+name: code_block_in_1_org
#+begin_src python :noweb yes
import pandas as pd
#+end_src



#+INCLUDE: "/tmp/1.org"   

* This is the ~/tmp/2.org~ file
#+caption: Local Code Block
#+name: code_block_local
#+begin_src python :noweb yes
import numpy as np
#+end_src

#+caption: The Final Code Block
#+name: the_final_code_block
#+begin_src python :results output :tangle output.py :noweb yes
<>  # referencing from 1.org
<> # referencing from within 2.org
#+end_src



The file ~/tmp/1.org~ contain src-block (~code_block_in_1_org~)
which is needed in block (~the_final_code_block~) of ~/tmp/2.org~
to tangle:
 - When ~/tmp/2.org~ exported to PDF via LaTeX, ~the_final_code_block~
 does contain part of code from ~code_block_in_1_org~
 - When ~/tmp/2.org~ tangled, ~the_final_code_block~
 does NOT contain part of code from ~code_block_in_1_org~

For consistency with PDF-export and file(s) management reasons,
I feel like it would be neat/cool have this feature to
spread src-blocks to different org-files.

Please take this RFE with a grain of salt, since I'm not that well
skilled/experienced person. And, I'm not even sure this spreading
src-blocks all over the places/files will be beneficial to overall
literate programming paradigm. Just for my small case, it felt
beneficial.

Please share your opinions on this, I will be  happy hear about it.

Best,
Garid Zorigoo.



Emacs  : GNU Emacs 28.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.36, 
cairo version 1.17.6)
 of 2023-01-03
Package: Org mode version 9.5.5 (release_9.5.5 @ 
/usr/share/emacs/28.2/lisp/org/)
-- 
Garid Z.



How to disable org-persist in a given file?

2023-04-22 Thread Gustavo Barros
Hi All,

this is more of a question really. I moved recently to the new pretest
version of Emacs and thus got the 9.6 version of Org. And after that I
started to notice some saving by `org-persist' going on, and indeed I
have a new associated "~/.cache/org-persist/" directory.

However, I do have some Org files which contain sensitive data. I'd
like to be able to disable persistence in those files. Now, some of
them are ".org.gpg" files, and I've seen the sources of `org-persist'
and noticed persistence is inhibited for them. But I also do have some
encrypted loop devices which, once opened, have a "plain" .org file
there.

I've greped the sources, and I see that `org-element' is making use of
`org-persist'. I've also seen the release notes, and that
`org-element' makes available `org-element-cache-persistent'.

However, taking a look at `org-persist's API, I couldn't find any
obvious handle to disable persistence there. Everything I've seen
presumes I have knowledge of registered "containers", which I don't.

Is currently `org-element' the only part of Org using persistence by
default? Is there some way to inhibit `org-persist' altogether in a
given file? (As opposed to just inhibiting `org-element' use of it
with `org-element-cache-persistent').

Best regards,
Gustavo.



Re: Why am I being told to use "straight.el"?

2023-04-22 Thread Colin Baxter
> Max Nikulin  writes:

> On 22/04/2023 14:51, Colin Baxter wrote:
>>> Max Nikulin writes:
>> > On 21/04/2023 23:17, Colin Baxter wrote:
>> > emacs -Q -l org-agenda Only message and scratch buffers
>> present.

> C-h e to check messages, but since errors or warnings buffer does
> not appear it should be OK.

>> >> 1. emacs  > Till `org-reload' C-c C-x ! at the step 10
>> org is not > involved. Does you init file loads some Org
>> component or some Org > buffer is created at startup? To be sure
>> > M-: (featurep 'org) "No match."

> I would expect either nil or t. Did you press M-x that is
> `execute-extended-command' instead of M-: that is
> `eval-expression'?  Alternatively you may execute in in the
> *scratch* buffer

> (featurep 'org)

> and C-j or C-x C-e when cursor is immediately after the closing
> parenthesis.


Sorry, my mistake. I didn't follow your recipe exactly. If enter
(featurep 'org) in the scratch buffer and do C-j then I get nil.


>> >> 2. M-x vc-dir  3. Navigate to ~/git/org-mode.  4. + (to
>> >> pull) 5. M-x compile  6. make clean  7. make 

>> In the case of build org-mode, I first select "make clean" from
>> the history of "M-x compile". Then I do "M-x compile" again and
>> select "make" from the history. The effect is the same using the
>> terminal, except the outputs are now contained in emacs buffers.

> Thank you for explanation. For some reason I believed that M-x
> compile invokes make without additional prompt. So

> make clean; make

> sounds perfectly reasonable.

>> >> 8. In an eshell buffer navigate to ~/git/emacs/lisp.  >> Typo!
>> I meant navigate to ~/git/org-mode/lisp.  >> 9. rm *.elc  >
>> Why did you decided to manually delete *.elc files? I have lost
>> at > which step you got the warning. I expect that "make clean"
>> should > remove .elc files.  If I don't delete the elc files in
>> ~/git/org-mode/lisp after the first build then I do get errors.

> Do you mean that it happens on each update?


Yes. However, there was a time several months ago when I needed only
build org-mode once to update it successfully. Something then changed in
org-mode such that initially updated .elc files caused an error. I
subsequently discovered that if a went through the build process twice,
removing the .elc files after the first build, they would be accepted at
the second build. 


> No .elc files should
> survive "make clean". I have not tried to reproduce it accordingly
> to your steps, but I have seen something strange related to .el
> and .elc files while experimenting with package.el.

> https://orgmode.org/worg/dev/org-build-system.html#orgd21575b
> "Compatibility and Convenience" and
> 
https://orgmode.org/worg/org-faq.html#keeping-current-with-Org-mode-development
> suggests that

> make uncompiled

> may be a shorter path to the same point.

> However accordingly to your description I expect that you do not
> have Org loaded yet. If you can not load compiled org now it
> should cause an error after emacs restart as well.


Org-mode is already loaded, that is the git version of org that I am about to
update is already loaded. If I C-j

--8<---cut here---start->8---
(car (assoc "/org-loaddefs.el" load-history (lambda (a b)
(string-match-p b a
--8<---cut here---end--->8---

in a scratch buffer then I get "~/git/org-mode/lisp/org-loaddefs.el". I
update org-mode during a normal emacs session that may have run over 
one or two days, during which time I will have used org-agenda, clocked
in and out of various times and perhaps used org-export.

Best wishes,

Colin.




3 times a day

2023-04-22 Thread Renato Pontefice
Hi,
I’m wondering how (and if it is possible) to have in one statement my 3 shoot a 
day, like this (that are in three separete statement):
** TODO composto I 4 granuli<2023-04-18 Tue 08:38 +1d>
** TODO composto I 4 granuli<2023-04-18 Tue 16:38 +1d>
** TODO composto I 4 granuli<2023-04-18 Tue 22:39 +1d>

I mean: can I have one TODO statement I n 3 different hour at same day?
Thank you

Renato




Re: Test failure due to LANG

2023-04-22 Thread Max Nikulin

On 22/04/2023 21:40, Axel Kielhorn wrote:

(with-environment-variables (("LC_TIME" "de_DE.UTF-8"))
  (format-time-string "%A“))

Still results in „Saturday“ when I start emacs from a shell with LANG=C.


Changing environment variable while process is running is not enough. 
There is a dedicated function


(set-locale-environment "POSIX")

I suppose, forcing "C.UTF-8" should work for tests.




Re: Why am I being told to use "straight.el"?

2023-04-22 Thread Max Nikulin

On 22/04/2023 14:51, Colin Baxter wrote:

Max Nikulin writes:


 > On 21/04/2023 23:17, Colin Baxter wrote:

 > emacs -Q -l org-agenda

Only message and scratch buffers present.


C-h e to check messages, but since errors or warnings buffer does not 
appear it should be OK.



 >> 1. emacs 

 > Till `org-reload' C-c C-x ! at the step 10 org is not
 > involved. Does you init file loads some Org component or some Org
 > buffer is created at startup? To be sure

 > M-: (featurep 'org)

"No match."


I would expect either nil or t. Did you press M-x that is 
`execute-extended-command' instead of M-: that is `eval-expression'? 
Alternatively you may execute in in the *scratch* buffer


(featurep 'org)

and C-j or C-x C-e when cursor is immediately after the closing parenthesis.


 >> 2. M-x vc-dir  3. Navigate to ~/git/org-mode.  4. + (to
 >> pull) 5. M-x compile  6. make clean  7. make 



In the case of build org-mode, I first select "make clean" from the
history of "M-x compile". Then I do "M-x compile" again and select "make"
from the history. The effect is the same using the terminal, except the
outputs are now contained in emacs buffers.


Thank you for explanation. For some reason I believed that M-x compile 
invokes make without additional prompt. So


make clean; make

sounds perfectly reasonable.


 >> 8. In an eshell buffer navigate to ~/git/emacs/lisp.
 >> Typo! I meant navigate to ~/git/org-mode/lisp.
 >> 9. rm *.elc 

 > Why did you decided to manually delete *.elc files? I have lost at
 > which step you got the warning. I expect that "make clean" should
 > remove .elc files.

If I don't delete the elc files in ~/git/org-mode/lisp after the first
build then I do get errors.


Do you mean that it happens on each update? No .elc files should survive 
"make clean". I have not tried to reproduce it accordingly to your 
steps, but I have seen something strange related to .el and .elc files 
while experimenting with package.el.


https://orgmode.org/worg/dev/org-build-system.html#orgd21575b
"Compatibility and Convenience" and
https://orgmode.org/worg/org-faq.html#keeping-current-with-Org-mode-development
suggests that

make uncompiled

may be a shorter path to the same point.

However accordingly to your description I expect that you do not have 
Org loaded yet. If you can not load compiled org now it should cause an 
error after emacs restart as well.



 > Is org-loaddefs loaded from ~/git/org-mode/lisp? It is a sanity
 > check for working Org and more interesting when it is broken.

I think it must be because ~/git/org-mode/ is the first org-mode found
and not the org-mode within emacs itself. How can I check?


(car (assoc "/org-loaddefs.el" load-history (lambda (a b) 
(string-match-p b a


Evaluate it e.g. in the *scratch* buffer by C-j

I removed parts of your message where I do not have questions concerning 
provided info. Thank you for it.


You enumerated 16 steps, but It is still unclear to me at which one you 
got the warning mentioning straight.el. Sorry for annoyance. Certainly 
you need working Org, but I am interested in a recipe that leads to 
broken state despite it looks like a valid way to update org.






Re: [orgweb/zh-CN] [DRAFT PATCH v7] Tentative zh-CN translation

2023-04-22 Thread Ihor Radchenko
Ruijie Yu  writes:

>> May I know why you use comment here and in similar places? This
>> @@comment:...@@ thing is a bit of a hack as it is actually representing
>> inline export snippet to non-existent "comment" export backend.
>>
>> I am not sure why this has been even added originally.
>
> I saw the existing inline comments somewhere and started to use it as
> well.  I don't have a strong opinion as to whether the comments should
> be kept or removed.

I have no strong opinion either. You can do whatever is easier.

>>> +  3. 调料
>>> + + 糖
>>> + + 盐
>>
>> That's a curious seasoning for omelet, but so be it ;)
>
> Well, I didn't have omelet-making in mind, and was just trying to
> replace cheese with something more common.
>
> [Wait, omelets require milk?]

Some people do add it. For example, see the discussion in
https://old.reddit.com/r/Cooking/comments/t188k9/egg_milk_ratio_for_omelets/

>>> -Worried about aligning free text tables?
>>> -Org mode does it in a single keystroke -- =tab=.
>>> +担心无法在文本表格中对齐?你只需按一个键 - =tab=​。
>>
>> May I know the purpose of adding extra "-"?
>
> Double-dash only renders as a short dash on HTML, whereas quintuple-dash
> yields a long dash.  This is more in the spirit of Chinese writing,
> because we usually use two full-width dashes as a "dash punctuation".

Maybe just use \mdash entity then?

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



Re: [DRAFT PATCH v2] Decouple LANG= and testing (was: Test failure due to LANG)

2023-04-22 Thread General discussions about Org-mode.


Axel Kielhorn  writes:

>> Am 22.04.2023 um 15:01 schrieb Ruijie Yu via General discussions about 
>> Org-mode. :
>> 
>> 
>> Ruijie Yu via "General discussions about Org-mode."  
>> writes:
>> 
>>> Ruijie Yu via "General discussions about Org-mode."  
>>> writes:
>>> 
 Ruijie Yu via "General discussions about Org-mode." 
  writes:
 
> Axel Kielhorn  writes:
> 
>> Hello!
>> 
>> I’m building org with LANG=de.
>> As a result I get two failed tests:
> 
> Reproducible using "LANG=zh_CN.UTF-8".  In fact, I got more failed tests
> in my testing.  I think the OP's two test failures are due to hardcoded
> English expected result, whereas the additional test failures on my
> testing are probably due to the fact that each Chinese character is as
> wide as two latin letters, which catches some testing code offguard.
> 
> Here are the test names that failed unexpectedly for me.  All the
> "should"'s and "should-not"'s are in the attachment below.
> 
> --8<---cut here---start->8---
> 8 unexpected results:
>   FAILED  test-org-clock/clock-drawer-dwim
>   FAILED  test-org-clock/clocktable/lang
>   FAILED  test-org-clok/org-clock-timestamps-change
>   FAILED  test-org-colview/columns-width
>   FAILED  test-org/add-planning-info
>   FAILED  test-org/clone-with-time-shift
>   FAILED  test-org/deadline
>   FAILED  test-org/schedule
> --8<---cut here---end--->8---
> 
> [3. text/plain; lang.txt]...
 
 Update: interestingly, there is one test error when setting
 "LANG=en_US.UTF-8" or "LANG=C".
 
 [2. text/plain; lang-en-us-utf8.txt]...
 
 
 And, two somewhat different test errors when setting "LANG=fr_FR.UTF-8".
 
 [4. text/plain; lang-fr-fr-utf8.txt]...
>>> 
>>> Axel, does this patch fix test-org-clock/clock-drawer-dwim on your
>>> system?
>>> 
>>> [2. text/x-patch; 0001-testing-lisp-test-org-clock.el.patch]...
>> 
>> Here is an updated patch (replacing the first iteration).  This should
>> hopefully fix both test failures that Axel found.  Once this is
>> confirmed good, I will look at the test failures of the other languages
>> to see what I can do.
>> 
>> <0001-DRAFT-Fix-dependence-on-locale-in-org-testing-facili.patch>
>
>
> With this patch I get:
>FAILED  test-org-clock/clock-drawer-dwim  arrayp
>FAILED  test-org-clok/org-clock-timestamps-change  arrayp
>
> Axel

Thanks for testing.  Will take a look tomorrow.


-- 
Best,


RY

[Please note that this mail might go to spam due to some
misconfiguration in my mail server -- still investigating.]



Re: [orgweb/zh-CN] [DRAFT PATCH v7] Tentative zh-CN translation

2023-04-22 Thread General discussions about Org-mode.


Ihor Radchenko  writes:

> Ruijie Yu  writes:
>
>> Anyways, attached at the end of this message are all the commits in
>> master..v7.  As usual, it is also available on
>> https://git.sr.ht/~ruijieyu/orgweb/log/translate/zh-CN--v7.
>
> Thanks!
>
>> Subject: [PATCH 04/16] Update preamble files
>>...
>> -- ja ]
>> +- ja
>> +- 简
>> +]
>
>> -- ja ]
>> +- ja
>> +- 简
>> +]
>
> Should be "zh-CN", I think.

Yep, forgot about it.

>> Subject: [PATCH 05/16] * zh-CN/org-demo.html: zh-CN translation
>> -Outlining
>> -Headings and folding make structured editing a breeze.
>> -Plain text makes it easy to sync and version control Org files.
>> +概述显示 
>> +章节标题与折叠让结构化编辑小菜一碟。
>> +纯文本使得将 Org 文件同步或者加入版本管理十分容易。
>
> WPS did not give any ideas?

Tried to install, but apparently I still got English?  Will try harder.

>>
>>* Revamp orgmode.org 
>> website
>>  
>>  
>> -  Agenda
>> -  List todos across all your files.
>> -  Filter content, and update it in place.
>> +  日程
>
> This is not exactly accurate, AFAIU.
> "Agenda" in English does not necessary refer to scheduled items. It also
> includes things to do, plans, etc. See
> https://www.merriam-webster.com/dictionary/agenda
> "日程", in contrast, is more specific about time-related items.

I'll look into that, thanks.

>> Subject: [PATCH 08/16] * zh-CN/tools.org: zh-CN translation
>>
>>  #+macro: link @@html:https://$1;>@@
>> +#+macro: worg @@html:@@
>>  #+macro: gh {{{link(github.com/$1)}}}
>>  #+macro: end-link @@html:@@
>
> It will be better to use this macro everywhere. Maybe move the macros to
> common setup.

Will do, and will have a scan-over to see if anything else would benefit
from macro-izing.

>> -* Getting started with Org-mode
>> +* 开始使用 Org@@comment:Get Started@@
>
> May I know why you use comment here and in similar places? This
> @@comment:...@@ thing is a bit of a hack as it is actually representing
> inline export snippet to non-existent "comment" export backend.
>
> I am not sure why this has been even added originally.

I saw the existing inline comments somewhere and started to use it as
well.  I don't have a strong opinion as to whether the comments should
be kept or removed.

>> -To buy:
>> -1. Milk
>> -2. Eggs
>> -   - Organic
>> -3. Cheese
>> -   + Parmesan
>> -   + Mozzarella
>> +  采购单:
>> +  1. 牛奶
>> +  2. 鸡蛋
>> + - 有机
>> +  3. 调料
>> + + 糖
>> + + 盐
>
> That's a curious seasoning for omelet, but so be it ;)

Well, I didn't have omelet-making in mind, and was just trying to
replace cheese with something more common.

[Wait, omelets require milk?]

>> -Worried about aligning free text tables?
>> -Org mode does it in a single keystroke -- =tab=.
>> +担心无法在文本表格中对齐?你只需按一个键 - =tab=​。
>
> May I know the purpose of adding extra "-"?

Double-dash only renders as a short dash on HTML, whereas quintuple-dash
yields a long dash.  This is more in the spirit of Chinese writing,
because we usually use two full-width dashes as a "dash punctuation".


-- 
Best,


RY

[Please note that this mail might go to spam due to some
misconfiguration in my mail server -- still investigating.]



Re: [DRAFT PATCH v2] Decouple LANG= and testing (was: Test failure due to LANG)

2023-04-22 Thread Axel Kielhorn



> Am 22.04.2023 um 15:01 schrieb Ruijie Yu via General discussions about 
> Org-mode. :
> 
> 
> Ruijie Yu via "General discussions about Org-mode."  
> writes:
> 
>> Ruijie Yu via "General discussions about Org-mode."  
>> writes:
>> 
>>> Ruijie Yu via "General discussions about Org-mode."  
>>> writes:
>>> 
 Axel Kielhorn  writes:
 
> Hello!
> 
> I’m building org with LANG=de.
> As a result I get two failed tests:
 
 Reproducible using "LANG=zh_CN.UTF-8".  In fact, I got more failed tests
 in my testing.  I think the OP's two test failures are due to hardcoded
 English expected result, whereas the additional test failures on my
 testing are probably due to the fact that each Chinese character is as
 wide as two latin letters, which catches some testing code offguard.
 
 Here are the test names that failed unexpectedly for me.  All the
 "should"'s and "should-not"'s are in the attachment below.
 
 --8<---cut here---start->8---
 8 unexpected results:
   FAILED  test-org-clock/clock-drawer-dwim
   FAILED  test-org-clock/clocktable/lang
   FAILED  test-org-clok/org-clock-timestamps-change
   FAILED  test-org-colview/columns-width
   FAILED  test-org/add-planning-info
   FAILED  test-org/clone-with-time-shift
   FAILED  test-org/deadline
   FAILED  test-org/schedule
 --8<---cut here---end--->8---
 
 [3. text/plain; lang.txt]...
>>> 
>>> Update: interestingly, there is one test error when setting
>>> "LANG=en_US.UTF-8" or "LANG=C".
>>> 
>>> [2. text/plain; lang-en-us-utf8.txt]...
>>> 
>>> 
>>> And, two somewhat different test errors when setting "LANG=fr_FR.UTF-8".
>>> 
>>> [4. text/plain; lang-fr-fr-utf8.txt]...
>> 
>> Axel, does this patch fix test-org-clock/clock-drawer-dwim on your
>> system?
>> 
>> [2. text/x-patch; 0001-testing-lisp-test-org-clock.el.patch]...
> 
> Here is an updated patch (replacing the first iteration).  This should
> hopefully fix both test failures that Axel found.  Once this is
> confirmed good, I will look at the test failures of the other languages
> to see what I can do.
> 
> <0001-DRAFT-Fix-dependence-on-locale-in-org-testing-facili.patch>


With this patch I get:
   FAILED  test-org-clock/clock-drawer-dwim  arrayp
   FAILED  test-org-clok/org-clock-timestamps-change  arrayp

Axel




Re: [DRAFT PATCH v2] Decouple LANG= and testing (was: Test failure due to LANG)

2023-04-22 Thread General discussions about Org-mode.


Ruijie Yu  writes:

> Here is an updated patch (replacing the first iteration).  This should
> hopefully fix both test failures that Axel found.  Once this is
> confirmed good, I will look at the test failures of the other languages
> to see what I can do.
>
> [2. text/x-patch; 
> 0001-DRAFT-Fix-dependence-on-locale-in-org-testing-facili.patch]...

More updates.

First, I noticed that `test-org-clock/clocktable/lang' may fail
depending on the value of `org-hide-emphasis-markers'.

Second, `org-columns--overlay-text' has a problem where

(format "%-5.5s |" "1234…")

returns different results for different locales, causing
`test-org-colview/columns-width' to break.  I stepped over the test and
found that everything, including `org-columns-add-ellipses', works fine
until we hit the `format'.

Okay, digging into these issues took me some effort so I might just call
it a day for now.  Will continue looking into it within 48 hours,
though.

-- 
Best,


RY

[Please note that this mail might go to spam due to some
misconfiguration in my mail server -- still investigating.]



Re: Test failure due to LANG

2023-04-22 Thread Axel Kielhorn



> Am 22.04.2023 um 16:21 schrieb Max Nikulin :
> 
> On 22/04/2023 19:35, Ihor Radchenko wrote:
>> Axel Kielhorn writes:
>>> "* Foo\n:LOGBOOK:\nCLOCK: [2022-11-03 Thu 06:00]--[2022-11-03 Thu 06:01] => 
>>>  0:01\n:END:\n" #(
>>> "* Foo\n:LOGBOOK:\nCLOCK: [2022-11-03 Do 06:00]--[2022-11-03 Do 06:01] =>  
>>> 0:01\n:END:\n"
>> (with-environment-variables (("LANG" "de"))
>>   (format-time-string "%A"))
>> (with-environment-variables (("LANG" "en"))
>>   (format-time-string "%A"))
> 
> ("LC_TIME" "de_DE.UTF-8")
> 
> Since it is related to dates or even "LC_ALL". E.g. Ubuntu installer may 
> configure LC_TIME overriding LANG. Some users may have LC_ALL that overrides 
> specific LC_* variable and LANG.

(with-environment-variables (("LC_TIME" "de_DE.UTF-8"))
 (format-time-string "%A“))

Still results in „Saturday“ when I start emacs from a shell with LANG=C.

Axel


Re: Test failure due to LANG

2023-04-22 Thread Axel Kielhorn



> Am 22.04.2023 um 14:35 schrieb Ihor Radchenko :
> 
> 
> (with-environment-variables (("LANG" "de"))
>  (format-time-string "%A"))
> (with-environment-variables (("LANG" "en"))
>  (format-time-string "%A“))

When I start Emacs from a shell with LANG=de I get „Samstag“ in both cases.
When I start with LANG=C I get „Saturday“ in both cases.

Axel


Re: Test failure due to LANG

2023-04-22 Thread Ihor Radchenko
Max Nikulin  writes:

>> (with-environment-variables (("LANG" "de"))
>>(format-time-string "%A"))
>> (with-environment-variables (("LANG" "en"))
>>(format-time-string "%A"))
>
> ("LC_TIME" "de_DE.UTF-8")
>
> Since it is related to dates or even "LC_ALL". E.g. Ubuntu installer may 
> configure LC_TIME overriding LANG. Some users may have LC_ALL that 
> overrides specific LC_* variable and LANG.

I guess it will also depend on whether the requested locales are
generated. I only generated "en" on my system, so even setting LC_TIME
will change nothing for me as the only available locale is used
regardless.

I now think that overriding the locale is not reliable in practice.
Ruijie's idea may be better.

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



Re: Test failure due to LANG

2023-04-22 Thread Axel Kielhorn


> Am 22.04.2023 um 14:37 schrieb Ruijie Yu :
> 
> 
> 
> Axel, does this patch fix test-org-clock/clock-drawer-dwim on your
> system?
> 
> <0001-testing-lisp-test-org-clock.el.patch>

Yes it does, thanks.

Axel




Re: [orgweb/zh-CN] [DRAFT PATCH v7] Tentative zh-CN translation

2023-04-22 Thread Ihor Radchenko
Ruijie Yu  writes:

> Anyways, attached at the end of this message are all the commits in
> master..v7.  As usual, it is also available on
> https://git.sr.ht/~ruijieyu/orgweb/log/translate/zh-CN--v7.

Thanks!

> Subject: [PATCH 04/16] Update preamble files
>...
> -- ja ]
> +- ja
> +- 简
> +]

> -- ja ]
> +- ja
> +- 简
> +]

Should be "zh-CN", I think.

> Subject: [PATCH 05/16] * zh-CN/org-demo.html: zh-CN translation
> - Outlining
> - Headings and folding make structured editing a breeze.
> - Plain text makes it easy to sync and version control Org files.
> + 概述显示 
> +章节标题与折叠让结构化编辑小菜一碟。
> +纯文本使得将 Org 文件同步或者加入版本管理十分容易。

WPS did not give any ideas?

>
>* Revamp orgmode.org 
> website
>  
>  
> -  Agenda
> -  List todos across all your files.
> -  Filter content, and update it in place.
> +  日程

This is not exactly accurate, AFAIU.
"Agenda" in English does not necessary refer to scheduled items. It also
includes things to do, plans, etc. See
https://www.merriam-webster.com/dictionary/agenda
"日程", in contrast, is more specific about time-related items.

> Subject: [PATCH 08/16] * zh-CN/tools.org: zh-CN translation
>
>  #+macro: link @@html:https://$1;>@@
> +#+macro: worg @@html:@@
>  #+macro: gh {{{link(github.com/$1)}}}
>  #+macro: end-link @@html:@@

It will be better to use this macro everywhere. Maybe move the macros to
common setup.
  
> -* Getting started with Org-mode
> +* 开始使用 Org@@comment:Get Started@@

May I know why you use comment here and in similar places? This
@@comment:...@@ thing is a bit of a hack as it is actually representing
inline export snippet to non-existent "comment" export backend.

I am not sure why this has been even added originally.

> -To buy:
> -1. Milk
> -2. Eggs
> -   - Organic
> -3. Cheese
> -   + Parmesan
> -   + Mozzarella
> +  采购单:
> +  1. 牛奶
> +  2. 鸡蛋
> + - 有机
> +  3. 调料
> + + 糖
> + + 盐

That's a curious seasoning for omelet, but so be it ;)

> -Worried about aligning free text tables?
> -Org mode does it in a single keystroke -- =tab=.
> +担心无法在文本表格中对齐?你只需按一个键 - =tab=​。

May I know the purpose of adding extra "-"?

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



[BUG] text cell contents have extra parentheses when used in formulas [9.6.4 ( @ /home/jet/.config/emacs/elpa/org-9.6.4/)]

2023-04-22 Thread Jeff Trull
Expectation: when using cell contents as strings in a formula, the
strings should contain exactly the cell's text contents

Actual: the resulting string is wrapped in parentheses

I can find nothing in the documentation that suggests this is expected,
and it is quite unintuitive if you want to (for example) filter on
a column.

#+TITLE: text formula repro

| Key | Value|
|-+--|
| A   | [40, 65, 41] |
| B   | [40, 66, 41] |
#+TBLFM: $2="$1"

Here you can see that the contents of the Key column were wrapped in
parentheses (ASCII 40 and 41) when turned into strings.

Emacs  : GNU Emacs 28.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.33, cairo version 1.16.0)
 of 2022-10-14
Package: Org mode version 9.6.4 ( @ /home/jet/.config/emacs/elpa/org-9.6.4/)

current state:
==
(setq
 org-link-elisp-confirm-function 'yes-or-no-p
 org-ditaa-jar-path "/usr/share/ditaa/ditaa.jar"
 org-bibtex-headline-format-function #[257 "\300 \236A\207" [:title] 3
"\n\n(fn ENTRY)"]
 org-persist-after-read-hook '(org-element--cache-persist-after-read)
 org-re-reveal-root "https://cdn.jsdelivr.net/npm/reveal.js@3.6.0;
 org-export-before-parsing-hook '(org-attach-expand-links)
 org-cycle-tab-first-hook '(org-babel-hide-result-toggle-maybe
org-babel-header-arg-expand)
 org-archive-hook '(org-attach-archive-delete-maybe)
 org-ascii-format-drawer-function #[771 " \207" [] 4 "\n\n(fn NAME CONTENTS
WIDTH)"]
 org-cycle-hook '(org-cycle-hide-archived-subtrees
org-cycle-show-empty-lines org-cycle-optimize-window-after-visibility-change
  org-cycle-display-inline-images)
 org-latex-listings-options '(("basicstyle" "\\footnotesize\\ttfamily")
("showstringspaces" "false") ("breaklines" "true"))
 org-persist-before-read-hook '(org-element--cache-persist-before-read)
 org-mode-hook '(#[0 "\301\211 \207" [imenu-create-index-function
org-imenu-get-tree] 2] org-superstar-mode org-tempo-setup
 (lambda nil (electric-indent-local-mode -1))
 #[0 "\300\301\302\303\304$\207" [add-hook
change-major-mode-hook org-fold-show-all append local] 5]
 #[0 "\300\301\302\303\304$\207" [add-hook
change-major-mode-hook org-babel-show-result-all append local] 5]
org-babel-result-hide-spec
 org-babel-hide-all-hashes org-eldoc-load)
 org-babel-load-languages '((emacs-lisp . t) (dot . t) (ditaa . t) (shell .
t))
 org-latex-format-drawer-function #[514 "\207" [] 3 "\n\n(fn _ CONTENTS)"]
 org-latex-format-headline-function
'org-latex-format-headline-default-function
 org-confirm-shell-link-function 'yes-or-no-p
 org-html-format-drawer-function #[514 "\207" [] 3 "\n\n(fn NAME CONTENTS)"]
 outline-isearch-open-invisible-function 'outline-isearch-open-invisible
 org-latex-classes '(("beamer"
  "\\documentclass[11pt,aspectratio=169]{beamer}\n
 \\usenavigationsymbolstemplate{} % no navigation bar\n
 \\beamertemplateballitem % items have little balls"
  ("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}") ("\\subsubsection{%s}" .
"\\subsubsection*{%s}"))
 ("article" "\\documentclass[11pt]{article}"
("\\section{%s}" . "\\section*{%s}") ("\\subsection{%s}" .
"\\subsection*{%s}")
  ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
("\\paragraph{%s}" . "\\paragraph*{%s}")
  ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
 ("report" "\\documentclass[11pt]{report}"
("\\part{%s}" . "\\part*{%s}") ("\\chapter{%s}" . "\\chapter*{%s}")
  ("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}") ("\\subsubsection{%s}" .
"\\subsubsection*{%s}"))
 ("book" "\\documentclass[11pt]{book}" ("\\part{%s}" .
"\\part*{%s}") ("\\chapter{%s}" . "\\chapter*{%s}")
  ("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}") ("\\subsubsection{%s}" .
"\\subsubsection*{%s}"))
 )
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-latex-packages-alist '(("" "moresize") ("" "fancyvrb") (""
"inconsolata") ("" "tikz") ("" "color") ("" "listings"))
 org-src-mode-hook '(org-src-babel-configure-edit-buffer
org-src-mode-configure-edit-buffer)
 org-confirm-elisp-link-function 'yes-or-no-p
 org-latex-src-block-backend t
 org-ditaa-eps-jar-path
"/home/jet/.config/emacs/elpa/contrib/scripts/DitaaEps.jar"
 org-structure-template-alist '(("n" . "notes") ("a" . "export ascii") ("c"
. "center") ("C" . "comment") ("e" . "example") ("E" . "export")
("h" . "export html") ("l" . "export
latex") ("q" . "quote") ("s" . "src") ("v" . "verse"))
 org-speed-command-hook '(org-speed-command-activate
org-babel-speed-command-activate)
 org-html-format-inlinetask-function
'org-html-format-inlinetask-default-function
 org-ascii-format-inlinetask-function 'org-ascii-format-inlinetask-default

Re: Test failure due to LANG

2023-04-22 Thread Max Nikulin

On 22/04/2023 19:35, Ihor Radchenko wrote:

Axel Kielhorn writes:

"* Foo\n:LOGBOOK:\nCLOCK: [2022-11-03 Thu 06:00]--[2022-11-03 Thu 06:01] =>  
0:01\n:END:\n" #(
"* Foo\n:LOGBOOK:\nCLOCK: [2022-11-03 Do 06:00]--[2022-11-03 Do 06:01] =>  
0:01\n:END:\n"


(with-environment-variables (("LANG" "de"))
   (format-time-string "%A"))
(with-environment-variables (("LANG" "en"))
   (format-time-string "%A"))


("LC_TIME" "de_DE.UTF-8")

Since it is related to dates or even "LC_ALL". E.g. Ubuntu installer may 
configure LC_TIME overriding LANG. Some users may have LC_ALL that 
overrides specific LC_* variable and LANG.






Re: [BUG] org-latex-packages-alist type specification [9.6.3 (release_9.6.3-2-gf2949d @ /usr/local/share/emacs/29.0.90/lisp/org/)]

2023-04-22 Thread Gustavo Barros
On Sat, 22 Apr 2023 at 10:27, Ihor Radchenko  wrote:
>
> Ruijie Yu  writes:
>
> > Subject: [PATCH] * lisp/org.el org-latex-packages-alist: fixed type 
> > definition
>
> Applied, onto bugfix.
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=14dccff8b

Thank you all!



Re: [BUG] org-latex-packages-alist type specification [9.6.3 (release_9.6.3-2-gf2949d @ /usr/local/share/emacs/29.0.90/lisp/org/)]

2023-04-22 Thread Ihor Radchenko
Ruijie Yu  writes:

> Subject: [PATCH] * lisp/org.el org-latex-packages-alist: fixed type definition

Applied, onto bugfix.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=14dccff8b

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



Re: [BUG] org-latex-packages-alist type specification [9.6.3 (release_9.6.3-2-gf2949d @ /usr/local/share/emacs/29.0.90/lisp/org/)]

2023-04-22 Thread Ihor Radchenko
Bastien Guerry  writes:

> I confirm the FSF copyright assignment is okay.

Recorded: https://git.sr.ht/~bzg/worg/commit/2c5757dd

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



[DRAFT PATCH v2] Decouple LANG= and testing (was: Test failure due to LANG)

2023-04-22 Thread General discussions about Org-mode.

Ruijie Yu via "General discussions about Org-mode."  
writes:

> Ruijie Yu via "General discussions about Org-mode."  
> writes:
>
>> Ruijie Yu via "General discussions about Org-mode."  
>> writes:
>>
>>> Axel Kielhorn  writes:
>>>
 Hello!

 I’m building org with LANG=de.
 As a result I get two failed tests:
>>>
>>> Reproducible using "LANG=zh_CN.UTF-8".  In fact, I got more failed tests
>>> in my testing.  I think the OP's two test failures are due to hardcoded
>>> English expected result, whereas the additional test failures on my
>>> testing are probably due to the fact that each Chinese character is as
>>> wide as two latin letters, which catches some testing code offguard.
>>>
>>> Here are the test names that failed unexpectedly for me.  All the
>>> "should"'s and "should-not"'s are in the attachment below.
>>>
>>> --8<---cut here---start->8---
>>> 8 unexpected results:
>>>FAILED  test-org-clock/clock-drawer-dwim
>>>FAILED  test-org-clock/clocktable/lang
>>>FAILED  test-org-clok/org-clock-timestamps-change
>>>FAILED  test-org-colview/columns-width
>>>FAILED  test-org/add-planning-info
>>>FAILED  test-org/clone-with-time-shift
>>>FAILED  test-org/deadline
>>>FAILED  test-org/schedule
>>> --8<---cut here---end--->8---
>>>
>>> [3. text/plain; lang.txt]...
>>
>> Update: interestingly, there is one test error when setting
>> "LANG=en_US.UTF-8" or "LANG=C".
>>
>> [2. text/plain; lang-en-us-utf8.txt]...
>>
>>
>> And, two somewhat different test errors when setting "LANG=fr_FR.UTF-8".
>>
>> [4. text/plain; lang-fr-fr-utf8.txt]...
>
> Axel, does this patch fix test-org-clock/clock-drawer-dwim on your
> system?
>
> [2. text/x-patch; 0001-testing-lisp-test-org-clock.el.patch]...

Here is an updated patch (replacing the first iteration).  This should
hopefully fix both test failures that Axel found.  Once this is
confirmed good, I will look at the test failures of the other languages
to see what I can do.

>From aed711f260b7214e7264df63e3154f4a75e5c5e5 Mon Sep 17 00:00:00 2001
From: Ruijie Yu 
Date: Sat, 22 Apr 2023 20:36:18 +0800
Subject: [PATCH] [DRAFT] Fix dependence on locale in org testing facilities

* testing/org-test.el org-test-day-of-weeks-seconds: add values of
seconds that yield different days of week (by trial-and-error).
org-test-day-of-weeks-abbrev: add a vector of abbreviated DoW
names for testing.
org-test-day-of-weeks-full: add a vector of full DoW names for
testing.

* testing/lisp/test-org-clock.el
(test-org-clok/org-clock-timestamps-change):
(test-org-clock/clock-drawer-dwim): make use of the pre-generated
DoW names in the testing to remove assumptions on LANG=C.
---
 testing/lisp/test-org-clock.el | 62 +++---
 testing/org-test.el| 23 +
 2 files changed, 57 insertions(+), 28 deletions(-)

diff --git a/testing/lisp/test-org-clock.el b/testing/lisp/test-org-clock.el
index 7d8123e1f..4d9306619 100644
--- a/testing/lisp/test-org-clock.el
+++ b/testing/lisp/test-org-clock.el
@@ -91,27 +91,32 @@ the buffer."
 
 (ert-deftest test-org-clok/org-clock-timestamps-change ()
   "Test `org-clock-timestamps-change' specifications."
-  (should
-   (equal
-"CLOCK: [2023-02-19 Sun 21:30]--[2023-02-19 Sun 23:35] =>  2:05"
-(org-test-with-temp-text
-"CLOCK: [2023-02-19 Sun 22:30]--[2023-02-20 Mon 00:35] =>  2:05"
-  (org-clock-timestamps-change 'down 1)
-  (buffer-string
-  (should
-   (equal
-"CLOCK: [2023-02-20 Mon 00:00]--[2023-02-20 Mon 00:40] =>  0:40"
-(org-test-with-temp-text
-"CLOCK: [2023-02-19 Sun 23:55]--[2023-02-20 Mon 00:35] =>  0:40"
-  (org-clock-timestamps-change 'up 1)
-  (buffer-string
-  (should
-   (equal
-"CLOCK: [2023-02-20 Mon 00:30]--[2023-02-20 Mon 01:35] =>  1:05"
-(org-test-with-temp-text
-"CLOCK: [2023-02-19 Sun 23:30]--[2023-02-20 Mon 00:35] =>  1:05"
-  (org-clock-timestamps-change 'up 1)
-  (buffer-string)
+  (let ((sun (aref org-test-day-of-weeks-abbrev 0))
+(mon (aref org-test-day-of-weeks-abbrev 1)))
+(should
+ (equal
+  (format "CLOCK: [2023-02-19 %s 21:30]--[2023-02-19 %s 23:35] =>  2:05"
+  sun sun)
+  (org-test-with-temp-text
+  "CLOCK: [2023-02-19 Sun 22:30]--[2023-02-20 Mon 00:35] =>  2:05"
+(org-clock-timestamps-change 'down 1)
+(buffer-string
+(should
+ (equal
+  (format "CLOCK: [2023-02-20 %s 00:00]--[2023-02-20 %s 00:40] =>  0:40"
+  mon mon)
+  (org-test-with-temp-text
+  "CLOCK: [2023-02-19 Sun 23:55]--[2023-02-20 Mon 00:35] =>  0:40"
+(org-clock-timestamps-change 'up 1)
+(buffer-string
+(should
+ (equal
+  (format "CLOCK: [2023-02-20 %s 00:30]--[2023-02-20 %s 01:35] =>  1:05"
+  mon mon)
+  (org-test-with-temp-text
+  "CLOCK: [2023-02-19 Sun 

Re: Test failure due to LANG

2023-04-22 Thread General discussions about Org-mode.


Ihor Radchenko  writes:

> Axel Kielhorn  writes:
>
>> I’m building org with LANG=de.
>> As a result I get two failed tests:
>>
>> ...
>> "* Foo\n:LOGBOOK:\nCLOCK: [2022-11-03 Thu 06:00]--[2022-11-03 Thu 06:01] =>  
>> 0:01\n:END:\n" #(
>> "* Foo\n:LOGBOOK:\nCLOCK: [2022-11-03 Do 06:00]--[2022-11-03 Do 06:01] =>  
>> 0:01\n:END:\n" 
>> ...
>> "CLOCK: [2023-02-19 Sun 21:30]--[2023-02-19 Sun 23:35] =>  2:05" #(
>> "CLOCK: [2023-02-19 So 21:30]--[2023-02-19 So 23:35] =>  2:05" 
>
> I guess we can explicitly specify LANG in these tests.
> Though I am not 100% how because I cannot reproduce on my Linux.
>
> May you try
>
> (with-environment-variables (("LANG" "de"))
>   (format-time-string "%A"))
> (with-environment-variables (("LANG" "en"))
>   (format-time-string "%A"))
>
> and report the output?
> (For me, it is all same...)

I think it is still important to try different locales, like the test
failures I found using zh_CN.UTF-8 (in the other subthread) which would
not be uncovered if you only assume one single locale.  I am working on
a patch that would hopefully help in this regard, which I will post
under the other subthread.

-- 
Best,


RY

[Please note that this mail might go to spam due to some
misconfiguration in my mail server -- still investigating.]



Re: [PATCH] before emit an error message, try to load the babel language

2023-04-22 Thread Ihor Radchenko
lin Sun  writes:

> Before the error message, the patch will give a try to load the
> associated babel language.
>
> Why does the language exist in the `lang org-babel-load-languages' but
> not be loaded?
> Because the `org-babel-load-languages' are defined as a customer
> variable with  :set 'org-babel-do-load-languages,  the ":set" function
> can only be triggered with function `custom-set-variables`.
> While setq/cl-pushnew `org-babel-load-languages' won't trigger the
> `:set' function, then the error message will be displayed if I run the
> code in the org file.

If we want to solve the problem of setting `org-babel-load-languages'
outside `defcustom', we should also consider unloading and other places
that use `fboundp' to check if babel backend is loaded. IMHO, the
cleanest way will be using `add-variable-watcher'.

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



Re: Test failure due to LANG

2023-04-22 Thread General discussions about Org-mode.

Ruijie Yu via "General discussions about Org-mode."  
writes:

> Ruijie Yu via "General discussions about Org-mode."  
> writes:
>
>> Axel Kielhorn  writes:
>>
>>> Hello!
>>>
>>> I’m building org with LANG=de.
>>> As a result I get two failed tests:
>>
>> Reproducible using "LANG=zh_CN.UTF-8".  In fact, I got more failed tests
>> in my testing.  I think the OP's two test failures are due to hardcoded
>> English expected result, whereas the additional test failures on my
>> testing are probably due to the fact that each Chinese character is as
>> wide as two latin letters, which catches some testing code offguard.
>>
>> Here are the test names that failed unexpectedly for me.  All the
>> "should"'s and "should-not"'s are in the attachment below.
>>
>> --8<---cut here---start->8---
>> 8 unexpected results:
>>FAILED  test-org-clock/clock-drawer-dwim
>>FAILED  test-org-clock/clocktable/lang
>>FAILED  test-org-clok/org-clock-timestamps-change
>>FAILED  test-org-colview/columns-width
>>FAILED  test-org/add-planning-info
>>FAILED  test-org/clone-with-time-shift
>>FAILED  test-org/deadline
>>FAILED  test-org/schedule
>> --8<---cut here---end--->8---
>>
>> [3. text/plain; lang.txt]...
>
> Update: interestingly, there is one test error when setting
> "LANG=en_US.UTF-8" or "LANG=C".
>
> [2. text/plain; lang-en-us-utf8.txt]...
>
>
> And, two somewhat different test errors when setting "LANG=fr_FR.UTF-8".
>
> [4. text/plain; lang-fr-fr-utf8.txt]...

Axel, does this patch fix test-org-clock/clock-drawer-dwim on your
system?

>From e223381ca670f99e6f6d69a7920923e2ad5ea91c Mon Sep 17 00:00:00 2001
From: Ruijie Yu 
Date: Sat, 22 Apr 2023 20:36:18 +0800
Subject: [PATCH] * testing/lisp/test-org-clock.el

Avoid hard-coded values where locales play a significant role.
---
 testing/lisp/test-org-clock.el | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/testing/lisp/test-org-clock.el b/testing/lisp/test-org-clock.el
index 7d8123e1f..3f587ce05 100644
--- a/testing/lisp/test-org-clock.el
+++ b/testing/lisp/test-org-clock.el
@@ -299,11 +299,12 @@ the buffer."
 
 (ert-deftest test-org-clock/clock-drawer-dwim ()
   "Test DWIM update of days for clocks in logbook drawers."
-  (should (equal "* Foo
+  (should (equal (let ((thu (format-time-string "%a" 1000)))
+   (format "* Foo
 :LOGBOOK:
-CLOCK: [2022-11-03 Thu 06:00]--[2022-11-03 Thu 06:01] =>  0:01
+CLOCK: [2022-11-03 %s 06:00]--[2022-11-03 %s 06:01] =>  0:01
 :END:
-"
+" thu thu))
  (org-test-with-temp-text
  "* Foo
 :LOGBOOK:
-- 
2.40.0


-- 
Best,


RY

[Please note that this mail might go to spam due to some
misconfiguration in my mail server -- still investigating.]


Re: [PATCH] ox.el: Customize org-export-dispatch options

2023-04-22 Thread Ihor Radchenko
Jim Wisniewski  writes:

> On Thu, Apr 20, 2023 at 4:46 AM Ihor Radchenko  wrote:
>
>> Thanks! Let us know when FSF replies with a countersignature.
>
> Just got it back today.

Thanks for the update!
Bastien, may you confirm?

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



Re: Test failure due to LANG

2023-04-22 Thread Ihor Radchenko
Axel Kielhorn  writes:

> I’m building org with LANG=de.
> As a result I get two failed tests:
>
> ...
> "* Foo\n:LOGBOOK:\nCLOCK: [2022-11-03 Thu 06:00]--[2022-11-03 Thu 06:01] =>  
> 0:01\n:END:\n" #(
> "* Foo\n:LOGBOOK:\nCLOCK: [2022-11-03 Do 06:00]--[2022-11-03 Do 06:01] =>  
> 0:01\n:END:\n" 
> ...
> "CLOCK: [2023-02-19 Sun 21:30]--[2023-02-19 Sun 23:35] =>  2:05" #(
> "CLOCK: [2023-02-19 So 21:30]--[2023-02-19 So 23:35] =>  2:05" 

I guess we can explicitly specify LANG in these tests.
Though I am not 100% how because I cannot reproduce on my Linux.

May you try

(with-environment-variables (("LANG" "de"))
  (format-time-string "%A"))
(with-environment-variables (("LANG" "en"))
  (format-time-string "%A"))

and report the output?
(For me, it is all same...)

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



Re: orgtable to latex export \hline[0pt] why?

2023-04-22 Thread Ihor Radchenko
Uwe Brauer  writes:

> I could modify that function, but again what is the purpose of the [0pt]

See 
https://list.orgmode.org/orgmode/cao12v+wb18nan0fudpaen94ghdt_2nbdjtc4u7n4w3hazba...@mail.gmail.com/
Also, note `org-latex-line-break-safe'.

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



Re: orgtable to latex export \hline[0pt] why?

2023-04-22 Thread Uwe Brauer
>>> "IR" == Ihor Radchenko  writes:

> Uwe Brauer  writes:
>> After pulling the latest org mode, the following table
>> 
>> Is exported to latex as
>> ...
>> \begin{center}
>> \begin{tabular}{r}
>> Ej1A & Ej1B & EjC & E2A1 & E2B & E2C & E2D & E2E & Total\\ \hline[0pt]
>> \hline

> I am seeing

> \begin{center}
> \begin{tabular}{r}
> Ej1A & Ej1B & EjC & E2A1 & E2B & E2C & E2D & E2E & Total\\[0pt]
> \hline

Well what is the purpose of the [0pt], that is new. Concerning the \hline

(defun my-latex-insert-hline-always (row backend info)
  "Add a hline to every row when exporting to  LaTeX."
  (when (org-export-derived-backend-p backend 'latex)
(replace-regexp-in-string "" " hline" row)))

(add-to-list 'org-export-filter-table-row-functions 
'my-latex-insert-hline-always)


I could modify that function, but again what is the purpose of the [0pt]


-- 
Warning: Content may be disturbing to some audiences
I strongly condemn Putin's war of aggression against the Ukraine.
I support to deliver weapons to Ukraine's military. 
I support the ban of Russia from SWIFT.
I support the EU membership of the Ukraine. 
https://addons.thunderbird.net/en-US/thunderbird/addon/gmail-conversation-view/


smime.p7s
Description: S/MIME cryptographic signature


Re: orgtable to latex export \hline[0pt] why?

2023-04-22 Thread Ihor Radchenko
Uwe Brauer  writes:

> After pulling the latest org mode, the following table
>
> Is exported to latex as
> ...
> \begin{center}
> \begin{tabular}{r}
> Ej1A & Ej1B & EjC & E2A1 & E2B & E2C & E2D & E2E & Total\\ \hline[0pt]
> \hline

I am seeing

\begin{center}
\begin{tabular}{r}
Ej1A & Ej1B & EjC & E2A1 & E2B & E2C & E2D & E2E & Total\\[0pt]
\hline

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



Re: Test failure due to LANG

2023-04-22 Thread General discussions about Org-mode.

Ruijie Yu via "General discussions about Org-mode."  
writes:

> Axel Kielhorn  writes:
>
>> Hello!
>>
>> I’m building org with LANG=de.
>> As a result I get two failed tests:
>
> Reproducible using "LANG=zh_CN.UTF-8".  In fact, I got more failed tests
> in my testing.  I think the OP's two test failures are due to hardcoded
> English expected result, whereas the additional test failures on my
> testing are probably due to the fact that each Chinese character is as
> wide as two latin letters, which catches some testing code offguard.
>
> Here are the test names that failed unexpectedly for me.  All the
> "should"'s and "should-not"'s are in the attachment below.
>
> --8<---cut here---start->8---
> 8 unexpected results:
>FAILED  test-org-clock/clock-drawer-dwim
>FAILED  test-org-clock/clocktable/lang
>FAILED  test-org-clok/org-clock-timestamps-change
>FAILED  test-org-colview/columns-width
>FAILED  test-org/add-planning-info
>FAILED  test-org/clone-with-time-shift
>FAILED  test-org/deadline
>FAILED  test-org/schedule
> --8<---cut here---end--->8---
>
> [3. text/plain; lang.txt]...

Update: interestingly, there is one test error when setting
"LANG=en_US.UTF-8" or "LANG=C".

1 unexpected results:
   FAILED  test-org-clock/clocktable/lang  ((should (equal "| En-tête| 
Durée   |\n|+-|\n| *Durée totale* | *26:00* 
|\n|+-|\n| Foo| 26:00   |" 
(org-test-with-temp-text "* Foo\n  CLOCK: [2016-12-27 Wed 13:09]--[2016-12-28 
Wed 15:09] => 26:00" (test-org-clock-clocktable-contents ":maxlevel 1 :lang 
fr" :form (equal "| En-tête| Durée   
|\n|+-|\n| *Durée totale* | *26:00* 
|\n|+-|\n| Foo| 26:00   |" "| En-tête   
 | Durée |\n|-+|\n| *Durée totale* | *26:00*
|\n|-+|\n| Foo | 26:00  |") 
:value nil :explanation (arrays-of-different-length 144 169 "| En-tête| 
Durée   |\n|+-|\n| *Durée totale* | *26:00* 
|\n|+-|\n| Foo| 26:00   |" "| En-tête   
 | Durée |\n|-+|\n| *Durée totale* | *26:00*
|\n|-+|\n| Foo | 26:00  |" 
first-mismatch-at 25))

And, two somewhat different test errors when setting "LANG=fr_FR.UTF-8".

2 unexpected results:
   FAILED  test-org-clock/clock-drawer-dwim  ((should (equal "* 
Foo\n:LOGBOOK:\nCLOCK: [2022-11-03 Thu 06:00]--[2022-11-03 Thu 06:01] =>  
0:01\n:END:\n" (org-test-with-temp-text "* Foo\n:LOGBOOK:\nCLOCK: 
[2022-11-03 ??? 06:00]--[2022-11-03 ??? 06:01] =>  0:01\n:END:\n" 
(org-ctrl-c-ctrl-c) (buffer-string :form (equal "* Foo\n:LOGBOOK:\nCLOCK: 
[2022-11-03 Thu 06:00]--[2022-11-03 Thu 06:01] =>  0:01\n:END:\n" #("* 
Foo\n:LOGBOOK:\nCLOCK: [2022-11-03 jeu. 06:00]--[2022-11-03 jeu. 06:01] =>  
0:01\n:END:\n" 0 2 (face org-level-1) 2 5 (face org-level-1) 6 15 
(font-lock-fontified t face org-drawer) 16 22 (face org-special-keyword) 46 71 
(face org-date keymap (keymap (follow-link . mouse-face) (mouse-3 . 
org-find-file-at-mouse) (mouse-2 . org-open-at-mouse)) mouse-face highlight) 81 
86 (font-lock-fontified t face org-drawer))) :value nil :explanation 
(arrays-of-different-length 85 87 "* Foo\n:LOGBOOK:\nCLOCK: [2022-11-03 Thu 
06:00]--[2022-11-03 Thu 06:01] =>  0:01\n:END:\n" #("* Foo\n:LOGBOOK:\nCLOCK: 
[2022-11-03 jeu. 06:00]--[2022-11-03 jeu. 06:01] =>  0:01\n:END:\n" 0 2 (face 
org-level-1) 2 5 (face org-level-1) 6 15 (font-lock-fontified t face 
org-drawer) 16 22 (face org-special-keyword) 46 71 (face org-date keymap 
(keymap (follow-link . mouse-face) (mouse-3 . org-find-file-at-mouse) (mouse-2 
. org-open-at-mouse)) mouse-face highlight) 81 86 (font-lock-fontified t face 
org-drawer)) first-mismatch-at 35))
   FAILED  test-org-clok/org-clock-timestamps-change  "Not at a timestamp"

-- 
Best,


RY

[Please note that this mail might go to spam due to some
misconfiguration in my mail server -- still investigating.]


Re: Test failure due to LANG

2023-04-22 Thread General discussions about Org-mode.

Axel Kielhorn  writes:

> Hello!
>
> I’m building org with LANG=de.
> As a result I get two failed tests:

Reproducible using "LANG=zh_CN.UTF-8".  In fact, I got more failed tests
in my testing.  I think the OP's two test failures are due to hardcoded
English expected result, whereas the additional test failures on my
testing are probably due to the fact that each Chinese character is as
wide as two latin letters, which catches some testing code offguard.

Here are the test names that failed unexpectedly for me.  All the
"should"'s and "should-not"'s are in the attachment below.

--8<---cut here---start->8---
8 unexpected results:
   FAILED  test-org-clock/clock-drawer-dwim
   FAILED  test-org-clock/clocktable/lang
   FAILED  test-org-clok/org-clock-timestamps-change
   FAILED  test-org-colview/columns-width
   FAILED  test-org/add-planning-info
   FAILED  test-org/clone-with-time-shift
   FAILED  test-org/deadline
   FAILED  test-org/schedule
--8<---cut here---end--->8---

8 unexpected results:
   FAILED  test-org-clock/clock-drawer-dwim  ((should (equal "* 
Foo\n:LOGBOOK:\nCLOCK: [2022-11-03 Thu 06:00]--[2022-11-03 Thu 06:01] =>  
0:01\n:END:\n" (org-test-with-temp-text "* Foo\n:LOGBOOK:\nCLOCK: 
[2022-11-03 ??? 06:00]--[2022-11-03 ??? 06:01] =>  0:01\n:END:\n" 
(org-ctrl-c-ctrl-c) (buffer-string :form (equal "* Foo\n:LOGBOOK:\nCLOCK: 
[2022-11-03 Thu 06:00]--[2022-11-03 Thu 06:01] =>  0:01\n:END:\n" #("* 
Foo\n:LOGBOOK:\nCLOCK: [2022-11-03 四 06:00]--[2022-11-03 四 06:01] =>  
0:01\n:END:\n" 0 2 (face org-level-1) 2 5 (face org-level-1) 6 15 
(font-lock-fontified t face org-drawer) 16 22 (face org-special-keyword) 43 65 
(face org-date keymap (keymap (follow-link . mouse-face) (mouse-3 . 
org-find-file-at-mouse) (mouse-2 . org-open-at-mouse)) mouse-face highlight) 75 
80 (font-lock-fontified t face org-drawer))) :value nil :explanation 
(arrays-of-different-length 85 81 "* Foo\n:LOGBOOK:\nCLOCK: [2022-11-03 Thu 
06:00]--[2022-11-03 Thu 06:01] =>  0:01\n:END:\n" #("* Foo\n:LOGBOOK:\nCLOCK: 
[2022-11-03 四 06:00]--[2022-11-03 四 06:01] =>  0:01\n:END:\n" 0 2 (face 
org-level-1) 2 5 (face org-level-1) 6 15 (font-lock-fontified t face 
org-drawer) 16 22 (face org-special-keyword) 43 65 (face org-date keymap 
(keymap (follow-link . mouse-face) (mouse-3 . org-find-file-at-mouse) (mouse-2 
. org-open-at-mouse)) mouse-face highlight) 75 80 (font-lock-fontified t face 
org-drawer)) first-mismatch-at 35))
   FAILED  test-org-clock/clocktable/lang  ((should (equal "| En-tête| 
Durée   |\n|+-|\n| *Durée totale* | *26:00* 
|\n|+-|\n| Foo| 26:00   |" 
(org-test-with-temp-text "* Foo\n  CLOCK: [2016-12-27 Wed 13:09]--[2016-12-28 
Wed 15:09] => 26:00" (test-org-clock-clocktable-contents ":maxlevel 1 :lang 
fr" :form (equal "| En-tête| Durée   
|\n|+-|\n| *Durée totale* | *26:00* 
|\n|+-|\n| Foo| 26:00   |" "| En-tête   
 | Durée  |\n|-+-|\n| *Durée totale* | *26:00* 
|\n|-+-|\n| Foo | 26:00   |") :value nil 
:explanation (arrays-of-different-length 144 146 "| En-tête| Durée   
|\n|+-|\n| *Durée totale* | *26:00* 
|\n|+-|\n| Foo| 26:00   |" "| En-tête   
 | Durée  |\n|-+-|\n| *Durée totale* | *26:00* 
|\n|-+-|\n| Foo | 26:00   |" 
first-mismatch-at 26))
   FAILED  test-org-clok/org-clock-timestamps-change  ((should (equal "CLOCK: 
[2023-02-19 Sun 21:30]--[2023-02-19 Sun 23:35] =>  2:05" 
(org-test-with-temp-text "CLOCK: [2023-02-19 Sun 22:30]--[2023-02-20 Mon 
00:35] =>  2:05" (org-clock-timestamps-change 'down 1) (buffer-string :form 
(equal "CLOCK: [2023-02-19 Sun 21:30]--[2023-02-19 Sun 23:35] =>  2:05" 
#("CLOCK: [2023-02-19 日 21:30]--[2023-02-19 日 23:35] =>  2:05" 0 6 (face 
org-special-keyword) 27 49 (face org-date keymap (keymap (follow-link . 
mouse-face) (mouse-3 . org-find-file-at-mouse) (mouse-2 . org-open-at-mouse)) 
mouse-face highlight))) :value nil :explanation (arrays-of-different-length 62 
58 "CLOCK: [2023-02-19 Sun 21:30]--[2023-02-19 Sun 23:35] =>  2:05" #("CLOCK: 
[2023-02-19 日 21:30]--[2023-02-19 日 23:35] =>  2:05" 0 6 (face 
org-special-keyword) 27 49 (face org-date keymap (keymap (follow-link . 
mouse-face) (mouse-3 . org-find-file-at-mouse) (mouse-2 . org-open-at-mouse)) 
mouse-face highlight)) first-mismatch-at 19))
   FAILED  test-org-colview/columns-width  ((should (equal "1234… |" 
(org-test-with-temp-text "* H\n:PROPERTIES:\n:P: 123456\n:END:" (let (... ...) 
(org-columns)) (org-trim (get-char-property ... ...) :form (equal "1234… |" 
"1234  |") :value nil :explanation (array-elt 4 (different-atoms (8230 "#x2026" 
"?…") (32 "#x20" "? "
   FAILED  test-org/add-planning-info  

Re: [PATCH] Add make target to ease creating reproducers and testing them

2023-04-22 Thread Max Nikulin

On 22/07/2022 20:37, Ihor Radchenko wrote:

Ihor Radchenko writes:


I propose a new make target: make repro
It will run the commands we already suggest, but without a need to
create minimal file, pass all that arguments to emacs, etc


Applied onto main via b713b9afa.


I have realized that the new target is not documented in
https://orgmode.org/worg/dev/org-build-system.html
and in the top-level Org Makefile.

P.S. I am unsure whether I have ever seen a convention suggesting to 
implement "make targets" or "make help". The following threads have no 
links:


Jude DaShiell. org-mode documentation question. Thu, 23 Jun 2011 
23:56:46 -0400 (EDT)

https://list.orgmode.org/alpine.bsf.2.00.1106232347590.38...@freire1.furyyjbeyq.arg/T/#u

Jude DaShiell. Makefile patch to show targets.  Mon, 4 Jul 2011 18:12:15 
-0400 (EDT)

https://list.orgmode.org/alpine.bsf.2.00.1107041810590.26...@freire1.furyyjbeyq.arg/T/#u

and "targets … mandated by GNU Makefile conventions" appeared on worg a 
year later:
8ebdc15f 2012-08-19 12:21:33 +0200 Achim Gratz: Build System: add target 
descriptions







Re: [PATCH] before emit an error message, try to load the babel language

2023-04-22 Thread General discussions about Org-mode.


lin Sun  writes:

> Hi,
> The function `org-babel-execute-src-block' will emit an error message
> if the language is not loaded.
>
> Before the error message, the patch will give a try to load the
> associated babel language.
>
> Why does the language exist in the `lang org-babel-load-languages' but
> not be loaded?
> Because the `org-babel-load-languages' are defined as a customer
> variable with  :set 'org-babel-do-load-languages,  the ":set" function
> can only be triggered with function `custom-set-variables`.
> While setq/cl-pushnew `org-babel-load-languages' won't trigger the
> `:set' function, then the error message will be displayed if I run the
> code in the org file.
>
> Please help review that patch. Thanks. Regards
>
> [2. text/x-patch; 
> 0001-lisp-ob-core.el-load-lang-in-org-babel-execute-src-b.patch]...

I think this patch slightly modifies the logic of the error.

--8<---cut here---start->8---
(unless (fboundp cmd)
- (error "No org-babel-execute function for %s!" lang))
+  (if (alist-get lang org-babel-load-languages)
+  (require (intern (concat "ob-" lang)))
+(error "No org-babel-execute function for %s!" lang)))
--8<---cut here---end--->8---

You are saying, that when (fboundp cmd) returns nil, and when (alist-get
...) returns non-nil, then perform the `require', and assume this
function is now available.

Instead of that, I think you should have some sort of conditional in the
`unless' condition.  Something like:

--8<---cut here---start->8---
(unless (or (fboundp cmd)
(ignore (and (alist-get lang org-babel-load-languages)
 (require (intern (concat "ob-" lang)
(fboundp cmd))
  (error "... %s" lang))
--8<---cut here---end--->8---

This preserves the logic of the message: when we cannot get
"org-babel-execute" immediately, we then try to require the module and
try again.  Then, we check the function again and conclude that the
org-babel-execute function is not found for this language.

Thoughts?

-- 
Best,


RY

[Please note that this mail might go to spam due to some
misconfiguration in my mail server -- still investigating.]



org-mode export to html fails for unknown link types - telephone links

2023-04-22 Thread Eugen Stan

Hi,

I am building my wedding page with org mode. Yay!.
I tried to add telephone links so people can click on the link and it 
will do something useful.


I used this markup [[tel:(+40)55-555-555][(+40)55-555-555]] to produce 
something like (+40)55-555-555 .


However It failed because the tel: is not recognized link.
I believe the default behavior of failing to export when encountering an 
unknown link type is not ok.


IMO org-mode export should allow export for unknown links.
Support for tel: links might be added to org-mode by default since it is 
simple to add and quite useful, at least in HTML export .

See https://css-tricks.com/the-current-state-of-telephone-links/ .

It seems it might work in PDF exports as well 
https://community.adobe.com/t5/acrobat-reader-discussions/how-to-make-clickable-phone-numbers-in-pdfs/m-p/5822600 
.


Regardless, having the export fail is a bug IMO.


To build my website I followed a slightly updated version of 
https://systemcrafters.net/publishing-websites-with-org-mode/building-the-site/ 
.


I made it work with some customization but I do believe the default

(require 'ox-publish)
(require 'ol)

(org-link-set-parameters "tel"
 :export #'org-tel-export)

(defun org-tel-export (link description format _)
  "Export a tel link from Org files."
  (let ((path link)
(desc (or description link)))
(pcase format
  (`html (format "%s" 
path desc))

  (`latex (format "\\href{%s}{%s}" path desc))
  (`texinfo (format "@uref{%s,%s}" path desc))
  (`ascii (format "%s (%s)" desc path))
  (t path

(setq org-publish-project-alist
  `(("nunta-org-site"
 :recursive t
 .. )

(org-publish-all t)



[BUG] Babel Noweb and python name clashing [9.6.1 (9.6.1-??-fe92a3ced @ /var/home/kwalerie/.emacs.d/.local/straight/build-27.1/org/)]

2023-04-22 Thread Weaver Marquez
Following the Worg documentation for python babel linked
[[here][https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-python.html]],
I had a lot of trouble with the =savefig= related examples.

Expected Behaviour:
The two code snippets below have the exact same code, except one has its
Babel name as =savefig=, which is a function name inside its code
block, and the other doesn't.

Not sure if this is a documented issue, but figured I should mention.

==---==

#+name: savefig
#+begin_src python :var filename="images/python-matplot-figure.png"
return f"plt.savefig('{filename}')\nreturn '{filename}'"
#+end_src

#+name: substitute
#+begin_src python :var filename="images/python-matplot-figure.png"
return f"plt.savefig('{filename}')\nreturn '{filename}'"
#+end_src

==---==
#+name: doesnt-work
#+begin_src python :noweb yes :results file
import matplotlib, numpy
import matplotlib.pyplot as plt
#matplotlib.use('Agg')

fig=plt.figure(figsize=(4,2))
x=numpy.linspace(-15,15)

plt.plot(numpy.sin(x)/x)
fig.tight_layout()
<>
#+end_src

#+name: does-work
#+begin_src python :noweb yes :results file
import matplotlib, numpy
import matplotlib.pyplot as plt
#matplotlib.use('Agg')

fig=plt.figure(figsize=(4,2))
x=numpy.linspace(-15,15)

plt.plot(numpy.sin(x)/x)
fig.tight_layout()

<>
#+end_src


Emacs  : GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.30, cairo version 1.16.0)
 of 2022-01-24, modified by Debian
Package: Org mode version 9.6.1 (9.6.1-??-fe92a3ced @
/var/home/kwalerie/.emacs.d/.local/straight/build-27.1/org/)

current state:
==
(setq
 org-src-mode-hook '(org-src-babel-configure-edit-buffer
org-src-mode-configure-edit-buffer)
 org-fontify-whole-heading-line t
 org-link-shell-confirm-function 'yes-or-no-p
 org-mode-local-vars-hook '(+org-init-gifs-h)
 org-babel-after-execute-hook '(+org-redisplay-inline-images-in-babel-result-h)
 org-insert-heading-respect-content t
 org-after-refile-insert-hook '(save-buffer)
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-follow-link-hook '(+nav-flash-delayed-blink-cursor-h)
 org-persist-directory "/var/home/kwalerie/.emacs.d/.local/cacheorg/persist/"
 org-refile-targets '((nil :maxlevel . 3) (org-agenda-files :maxlevel . 3))
 org-html-format-inlinetask-function
'org-html-format-inlinetask-default-function
 org-enforce-todo-dependencies t
 org-odt-format-headline-function 'org-odt-format-headline-default-function
 org-special-ctrl-a/e t
 org-imenu-depth 6
 org-persist-before-write-hook '(org-element--cache-persist-before-write)
 org-agenda-files '("/var/home/kwalerie/org/todo.org"
"/var/home/kwalerie/org/2023-02-06-healthsci.org"
"/var/home/kwalerie/org/battery.org"
"/var/home/kwalerie/org/draft.org")
 org-ascii-format-inlinetask-function 'org-ascii-format-inlinetask-default
 org-reveal-start-hook '(org-decrypt-entry)
 org-modules '(ol-bibtex)
 org-startup-folded nil
 org-blocker-hook '(org-block-todo-from-children-or-siblings-or-parent)
 org-mode-hook '(er/add-org-mode-expansions +lookup--init-org-mode-handlers-h
 (closure ((hook . org-mode-hook) (--dolist-tail--) t)
( _) (add-hook 'before-save-hook 'org-encrypt-entries nil t))
 #[0 "\300\301\302\303\304$\207" [add-hook
change-major-mode-hook org-fold-show-all append local] 5]
 #[0 "\300\301\302\303\304$\207" [add-hook
change-major-mode-hook org-babel-show-result-all append local] 5]
 org-babel-result-hide-spec org-babel-hide-all-hashes
#[0 "\301\211\207" [imenu-create-index-function org-imenu-get-tree] 2]
 doom-disable-show-paren-mode-h
doom-disable-show-trailing-whitespace-h +org-make-last-point-visible-h
evil-org-mode toc-org-enable
 embrace-org-mode-hook org-eldoc-load)
 org-clock-persist 'history
 org-export-with-smart-quotes t
 org-odt-format-drawer-function #[514 "\207" [] 3 "\n\n(fn NAME CONTENTS)"]
 org-outline-path-complete-in-steps nil
 org-archive-hook '(org-attach-archive-delete-maybe)
 org-persist-before-read-hook '(org-element--cache-persist-before-read)
 org-agenda-finalize-hook
'(+org-exclude-agenda-buffers-from-workspace-h
+org-defer-mode-in-agenda-buffers-h)
 org-startup-indented t
 org-clock-history-length 20
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-persist-after-read-hook '(org-element--cache-persist-after-read)
 org-bibtex-headline-format-function #[257 "\300\236A\207" [:title] 3
"\n\n(fn ENTRY)"]
 org-latex-format-drawer-function #[514 "\207" [] 3 "\n\n(fn _ CONTENTS)"]
 org-agenda-deadline-faces '((1.001 . error) (1.0 . org-warning) (0.5
. org-upcoming-deadline) (0.0 . org-upcoming-distant-deadline))
 org-crypt-key nil
 org-babel-pre-tangle-hook '(save-buffer)
 org-file-apps '((remote . emacs) (auto-mode . emacs) (directory .
emacs) ("\\.mm\\'" . default) ("\\.x?html?\\'" . default) ("\\.pdf\\'"
. default))
 org-tab-first-hook '(+org-yas-expand-maybe-h 

Re: Why am I being told to use "straight.el"?

2023-04-22 Thread Colin Baxter
> Max Nikulin  writes:

> On 21/04/2023 23:17, Colin Baxter wrote:
>> I will address the other points in your reply the next time I
>> update org-mode. In the meantime, I can answer some of your other
>> questions immediately.

> Thanks for info. I have asked for org git branch. I am almost sure
> it is main, but to be sure

>git -C ~/git/org-mode branch --show-current git -C
> ~/git/org-mode describe

main

> If the issue was caused by specific order of file changes, even in
> the current state output of the following command may be used for
> attempt to replay updates by git checkout + make

>git -C ~/git/org-mode reflog --max-count 20

f81ba451a (HEAD -> main, origin/main, origin/HEAD) HEAD@{0}: pull --stat: 
Fast-forward
3c449cc43 HEAD@{1}: pull: Fast-forward
4929f0c55 HEAD@{2}: pull: Fast-forward
f4446ce79 HEAD@{3}: pull: Fast-forward
7c8623be9 HEAD@{4}: clone: from 
https://git.savannah.gnu.org/git/emacs/org-mode.git

> I assume you build it yourself. Do you run emacs binary from
> source+build tree or from install tree (make install)?

>From a local install-tree.

> The latter
> has .el.gz files instead of .el, and at least in Emacs-28 it
> affects behavior of compilation of ELPA packages by package.el.

> Another point is that the origin of your issue might be in
> built-in version of Org. It has `org-assert-version' as
> well. Perhaps there is a bug in make rules for Org in Emacs
> tree. Could you, please, try the following for your *current*
> emacs build?

> emacs -Q -l org-agenda

Only message and scratch buffers present.

>> 1. emacs 

> Till `org-reload' C-c C-x ! at the step 10 org is not
> involved. Does you init file loads some Org component or some Org
> buffer is created at startup? To be sure

> M-: (featurep 'org)

"No match."

This figures since loading org-mode is only the second load-path
adjustment done by my ~/.emacs. The first is setting the path to
slime. All other load-path adjustments, such as other org-mode
application libraries come later after org-mode itself. 

> I assume that ~/git/org-mode/lisp is added to `load-path' in your
> init file.

Yes, via (add-to-list 'load-path (expand-file-name "~/git/org-mode/lisp")) 

>> 2. M-x vc-dir  3. Navigate to ~/git/org-mode.  4. + (to
>> pull) 5. M-x compile  6. make clean  7. make 

> I am sorry for my ignorance, I usually run make from a terminal
> independent of emacs. Doesn't M-x compile runs make, so I expect
> it is the same as

In the case of build org-mode, I first select "make clean" from the
history of "M-x compile". Then I do "M-x compile" again and select "make"
from the history. The effect is the same using the terminal, except the
outputs are now contained in emacs buffers.

> make; make clean; make

> and it is a bit strange for me.

>> 8. In an eshell buffer navigate to ~/git/emacs/lisp.

>> Typo! I meant navigate to ~/git/org-mode/lisp.

>> 9. rm *.elc 

> Why did you decided to manually delete *.elc files? I have lost at
> which step you got the warning. I expect that "make clean" should
> remove .elc files.

If I don't delete the elc files in ~/git/org-mode/lisp after the first
build then I do get errors. I find that a running emacs-session at this
stage of the process is happy to load new org-mode .el files but not
.elc files. I then repeat "make clean" and "make". Now the running emacs
will load the .elc files and complete the update. 

>> 10. Open any org-mode file or buffer and do C-c C-x !

> `org-reload' immediately after removing of .elc files sounds
> strange for me. At least since previous command was "make", not
> "make clean", org-loaddefs.el should exist at this moment, so
> uncompiled version should be loaded, but prefix argument should be
> used to load Org uncompiled

> C-u C-c C-x !

> If org has not been loaded before the step 10, then `org-reload'
> should-not be necessary at all.

>> 11. Return to vc-dir or eshell 12. make clean  13. make
>>  15. Return to org-mode buffer and do C-c C-x ! again.
>> 16. Update complete, usually with no warnings or errors.

> Is org-loaddefs loaded from ~/git/org-mode/lisp? It is a sanity
> check for working Org and more interesting when it is broken.

I think it must be because ~/git/org-mode/ is the first org-mode found
and not the org-mode within emacs itself. How can I check?

> emacs -Q -L ~/git/org-mode/lisp -l org-agenda

> is not affected, so the problem is solely with reloading of
> updated version without emacs restart.

Ok. I will do that.

Colin.




[PATCH] before emit an error message, try to load the babel language

2023-04-22 Thread lin Sun
Hi,
The function `org-babel-execute-src-block' will emit an error message
if the language is not loaded.

Before the error message, the patch will give a try to load the
associated babel language.

Why does the language exist in the `lang org-babel-load-languages' but
not be loaded?
Because the `org-babel-load-languages' are defined as a customer
variable with  :set 'org-babel-do-load-languages,  the ":set" function
can only be triggered with function `custom-set-variables`.
While setq/cl-pushnew `org-babel-load-languages' won't trigger the
`:set' function, then the error message will be displayed if I run the
code in the org file.

Please help review that patch. Thanks. Regards
From 39a15a34bdb8bd0c397fbd80cdfb0723ce229066 Mon Sep 17 00:00:00 2001
From: Lin Sun 
Date: Sat, 22 Apr 2023 00:00:39 +
Subject: [PATCH] *lisp/ob-core.el: load lang in (org-babel-execute-src-block)

---
 lisp/ob-core.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index 471887a3a..2ed4f6b5b 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -795,7 +795,9 @@ guess will be made."
 		 (cmd (intern (concat "org-babel-execute:" lang)))
 		 result exec-start-time)
 	(unless (fboundp cmd)
-	  (error "No org-babel-execute function for %s!" lang))
+  (if (alist-get lang org-babel-load-languages)
+  (require (intern (concat "ob-" lang)))
+(error "No org-babel-execute function for %s!" lang)))
 	(message "Executing %s %s %s..."
 		 (capitalize lang)
  (pcase executor-type
-- 
2.20.5



Test failure due to LANG

2023-04-22 Thread Axel Kielhorn
Hello!

I’m building org with LANG=de.
As a result I get two failed tests:

   FAILED  test-org-clock/clock-drawer-dwim  ((should (equal "*
Foo\n:LOGBOOK:\nCLOCK: [2022-11-03 Thu 06:00]--[2022-11-03 Thu 06:01] =>
0:01\n:END:\n" (org-test-with-temp-text "* Foo\n:LOGBOOK:\nCLOCK:
[2022-11-03 ??? 06:00]--[2022-11-03 ??? 06:01] =>  0:01\n:END:\n"
(org-ctrl-c-ctrl-c) (buffer-string :form (equal "*
Foo\n:LOGBOOK:\nCLOCK: [2022-11-03 Thu 06:00]--[2022-11-03 Thu 06:01] =>
0:01\n:END:\n" #("* Foo\n:LOGBOOK:\nCLOCK: [2022-11-03 Do
06:00]--[2022-11-03 Do 06:01] =>  0:01\n:END:\n" 0 2 (face org-level-1) 2 5
(face org-level-1) 6 15 (face org-drawer font-lock-fontified t) 16 22 (face
org-special-keyword) 44 67 (mouse-face highlight keymap (keymap (follow-link
. mouse-face) (mouse-3 . org-find-file-at-mouse) (mouse-2 .
org-open-at-mouse)) face org-date) 77 82 (face org-drawer
font-lock-fontified t))) :value nil :explanation 
(arrays-of-different-length 85 83 

"* Foo\n:LOGBOOK:\nCLOCK: [2022-11-03 Thu 06:00]--[2022-11-03 Thu 06:01] =>  
0:01\n:END:\n" #(
"* Foo\n:LOGBOOK:\nCLOCK: [2022-11-03 Do 06:00]--[2022-11-03 Do 06:01] =>  
0:01\n:END:\n" 

0 2 (face org-level-1) 2 5 (face org-level-1) 6 15 (face org-drawer 
font-lock-fontified t) 16 22 (face org-special-keyword) 44 67 (mouse-face 
highlight keymap (keymap (follow-link . mouse-face) (mouse-3 . 
org-find-file-at-mouse) (mouse-2 . org-open-at-mouse)) face org-date) 77 82 
(face org-drawer font-lock-fontified t)) first-mismatch-at 35))

   FAILED  test-org-clok/org-clock-timestamps-change  ((should (equal
"CLOCK: [2023-02-19 Sun 21:30]--[2023-02-19 Sun 23:35] =>  2:05"
(org-test-with-temp-text "CLOCK: [2023-02-19 Sun 22:30]--[2023-02-20
Mon 00:35] =>  2:05" (org-clock-timestamps-change 'down 1)
(buffer-string :form (equal "CLOCK: [2023-02-19 Sun 21:30]--[2023-02-19
Sun 23:35] =>  2:05" #("CLOCK: [2023-02-19 So 21:30]--[2023-02-19 So 23:35]
=>  2:05" 0 6 (face org-special-keyword) 28 51 (mouse-face highlight keymap
(keymap (follow-link . mouse-face) (mouse-3 . org-find-file-at-mouse)
(mouse-2 . org-open-at-mouse)) face org-date))) :value nil :explanation
(arrays-of-different-length 62 60 

"CLOCK: [2023-02-19 Sun 21:30]--[2023-02-19 Sun 23:35] =>  2:05" #(
"CLOCK: [2023-02-19 So 21:30]--[2023-02-19 So 23:35] =>  2:05" 

0 6 (face org-special-keyword) 28 51 (mouse-face highlight keymap (keymap 
(follow-link . mouse-face) (mouse-3 . org-find-file-at-mouse) (mouse-2 . 
org-open-at-mouse)) face org-date)) first-mismatch-at 20))

When I build with LANG=C, these tests pass.

I’m using macOS 11.7 on intel, but that shouldn’t affect these two fails.

Greetings Axel