Re: Archive done tasks and preserve tree structure

2024-05-21 Thread General discussions about Org-mode.


Naresh Gurbuxani  writes:

> How can I get the archiving done to preserve tree structure of tasks?

I've been using the solution in this gist comment for a while without
issue:

https://gist.github.com/Fuco1/e86fb5e0a5bb71ceafccedb5ca22fcfb?permalink_comment_id=3006243#gistcomment-3006243



Re: [PATCH] Add org-after-note-stored-hook

2024-05-20 Thread General discussions about Org-mode.


Ihor Radchenko  writes:

> Right. Yet, using a hook is still not ideal - what if you configure todo
> keywords to not store note at all in future? Then, the hook will never
> be executed or will be executed at the time you don't expect.
>
> Note-taking mechanisms is generally tricky - it is schedule-based,
> with note being taken after the current command is executed.
>
> I think I know how to make it possible for the note to be taken at the
> right place after subtree archival. May you try the attached patch?

Indeed, after testing it quickly it does what I want and notes are not a
special case in `org-trigger-hook' anymore which is perfect. Thank you!

> I added necessary keywords to the defcustom, changed the docstring to
> state explicitly that the point is at the note taken when running a
> hook, and changed the NEWS entry to (1) not have a link - we usually do
> not do it; (2) moved it under appropriate heading.
> I also removed your example from the commit message as it is not the
> best illustration (see my considerations above).
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=f3e306c73
>
> You are now listed among Org mode contributors.
> https://git.sr.ht/~bzg/worg/commit/3093b569

Thanks for your help!




Re: [PATCH] Add org-after-note-stored-hook

2024-05-12 Thread General discussions about Org-mode.
Ihor Radchenko  writes:
> Although, removing heading from inside
> `org-after-todo-state-change-hook' is a bad idea - Org mode does not
> expect the heading to disappear from under the cursor when this hook is
> executed. I recommend using `org-trigger-hook' instead.

Thanks for your help! I switched to `org-trigger-hook' without issue.

> An easier way would be forcing note earlier by calling
> `org-add-log-note' from your hook.

I remember trying that before adding the hook (and I tried again today)
but the problem with adding the note directly is that I only seem to
manage storing the note where the task was before being archived,
eg. with this (or any variants I could think of while making sense of
what note functions do):

#+begin_src elisp
  (when (member (plist-get properties ':to) '("CANCELLED" "READ"))
(org-add-log-note)
(my/org-roam-archive-to-today))
#+end_src

which I find logical, since `org-store-log-note' is only called after
=C-c C-c= is pressed, whereas the archival function is called just after
the note buffer is created. So I still struggle to see how I could do
without the hook (maybe if the archival function would return the
position of the task after moving it, but that seems more complicated
than just using the hook).

> It will probably be better to run such new hooks right before (message "Note 
> stored")
> in `org-store-log-note'.

A patch modified to match the suggested location for the `run-hooks' is
attached.

>From 779d6b85acf9c30d7230bffccb2f98764372034a Mon Sep 17 00:00:00 2001
From: Joris Caravati 
Date: Sun, 12 May 2024 21:29:52 +0200
Subject: [PATCH] lisp/org.el: Add `org-after-note-stored-hook'

* lisp/org.el: Add `org-after-note-stored-hook' which is called at the
end of the `org-store-log-note' function.
* etc/ORG-NEWS: Document the new hook.

This change allows customization after a note is taken. One case where
it is useful is when one wants to move a task after a state change but
cannot do so in `org-after-todo-state-change' because the new state is
configured to take a note (with '@' in `org-todo-keywords').

Setting this hook in `org-after-todo-state-change' allows to defer the
move after the note is taken and prevents the note to be placed where
the task was before being moved.

TINYCHANGE
---
 etc/ORG-NEWS | 4 
 lisp/org.el  | 4 
 2 files changed, 8 insertions(+)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 87b72ad12..4b7636765 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -1569,6 +1569,10 @@ optional argument =NEW-HEADING-CONTAINER= specifies where in the
 buffer it will be added.  If not specified, new headings are created
 at level 1 at the end of the accessible part of the buffer, as before.
 
+*** New hook [[doc::org-after-note-stored-hook][org-after-note-stored-hook]]
+
+This new hook runs when a note has been stored.
+
 ** Miscellaneous
 *** =org-crypt.el= now applies initial visibility settings to decrypted entries
 
diff --git a/lisp/org.el b/lisp/org.el
index 598b4ca23..64f6d07ee 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -1990,6 +1990,9 @@ Lisp variable `org-state'."
   :group 'org-todo
   :type 'hook)
 
+(defcustom org-after-note-stored-hook nil
+  "Hook which is run after a note was stored")
+
 (defvar org-blocker-hook nil
   "Hook for functions that are allowed to block a state change.
 
@@ -10845,6 +10848,7 @@ items are State notes."
(unless (string-empty-p line)
 	 (indent-line-to ind)
 	 (insert-and-inherit line
+   (run-hooks 'org-after-note-stored-hook)
 	   (message "Note stored")
 	   (org-back-to-heading t))
   ;; Don't add undo information when called from `org-agenda-todo'.
-- 
2.44.0



Re: [PATCH] Add org-after-note-stored-hook

2024-05-09 Thread General discussions about Org-mode.


Hello,

Is there anything wrong with the patch or with the proposition of
adding a hook there? The first I'd like to know for doing better next
time (or maybe correcting this one), the second to know if  I should
stop using it.

Thanks!
Joris

Joris Caravati  writes:

> Hello,
>
> I've been archiving tasks automatically using
> `org-after-todo-state-change-hook' but I've been recently bit with a
> note (entering a todo state configured with '@') being placed where the
> task was before its archival.
>
> This patch aims to offer a way to defer the archival after the
> note is stored. Actually, I am using it like this:
>
> #+begin_src elisp
> (add-to-list 'org-after-todo-state-change-hook
>(lambda ()
>  ;; States configured without mandatory note
>  (when (member org-state '("DONE"))
>(my/org-roam-archive-to-today))
>  ;; States configured with mandatory note
>  (when (member org-state '("CANCELLED" "READ"))
>(add-to-list 'org-after-note-stored-hook 
> 'my/org-roam-archive-to-today
> #+end_src
>
> With `my/org-roam-archive-to-today' removing itself from
> `org-after-note-stored-hook'.
>
> Hopefully I did not miss an existing way to do this.
>
> Regards,
> Joris
>
> [2. text/x-patch; 0001-Add-org-after-note-stored-hook.patch]...



Re: [BUG] Org parser error when removing latex preview [9.6.15 (release_9.6.15 @ /gnu/store/gnvv2a1nxfbibkm1wdxdv6bd6mhk4cf8-emacs-29.3/share/emacs/29.3/lisp/org/)]

2024-04-13 Thread General discussions about Org-mode.


> Then, it looks like a duplicate of
> https://list.orgmode.org/orgmode/caedgbw4gmfmpt4-w6edrh7poapd5drarbtusfulrq7vbvtu...@mail.gmail.com/
>
> There is no bug on the latest development version of Org mode (main).

Sure!  
Thank you for pointing it out and helping with the resolution.

--
Anush Veeranala



Re: [BUG] Org parser error when removing latex preview [9.6.15 (release_9.6.15 @ /gnu/store/gnvv2a1nxfbibkm1wdxdv6bd6mhk4cf8-emacs-29.3/share/emacs/29.3/lisp/org/)]

2024-04-13 Thread General discussions about Org-mode.


> I did the following:
>
> 1. Save your file to /tmp/
> 2. rm -rf /tmp/ltximg
> 3. emacs-29 --version
> GNU Emacs 29.3
> Copyright (C) 2024 Free Software Foundation, Inc.
>
> 4. emacs-29 -Q
> 5. C-x C-f /tmp/tmp.org 
> 6. C-n
> 7. C-c C-x C-l
> 8. C-c C-x C-l
> 9. I do not observe any warnings


Thanks for outlining your steps.  I’ve added an additional step
(5). Here's the updated sequence:

1. Save your file to /tmp/
2. rm -rf /tmp/ltximg
3. emacs-29 --version
GNU Emacs 29.3
Copyright (C) 2024 Free Software Foundation, Inc.

4. emacs-29 -Q


5. M-: (setq org-startup-numerated t)


6. C-x C-f /tmp/tmp.org 
7. C-n
8. C-c C-x C-l
9. C-c C-x C-l
10. I observe warning

--
Anush Veeranala



Re: [BUG] Org parser error when removing latex preview [9.6.15 (release_9.6.15 @ /gnu/store/gnvv2a1nxfbibkm1wdxdv6bd6mhk4cf8-emacs-29.3/share/emacs/29.3/lisp/org/)]

2024-04-12 Thread General discussions about Org-mode.
> From: Ihor Radchenko 
> Date: Fri, 12 Apr 2024 18:24:17 +
>
> Anush V via "General discussions about Org-mode."
>  writes:
>
>> Below are the steps to replicate the issue:
>>
>> Start emacs by running "emacs --no-init".
>>
>> Set the org-startup-numerated variable to true with the command (setq
>> org-startup-numerated t).
>>
>> Create a new file named tmp.org and insert the following content:
>>
>> - H
>> $\alpha$
>>
>> To view the latex equation, place the cursor on the equation and press
>> the shortcut C-c C-x C-l to run org-latex-preview.  This will display
>> the latex preview.
>>
>> Press C-c C-x C-l again to remove the latex preview and receive the
>> warning:
>>
>>
>>
>> ■ Warning (org-element-cache): org-element--cache: Org parser error in 
>> tmp.org::11. Resetting.
>> The error was: (error "Invalid search bound (wrong side of point)")
>> Backtrace: nil
>> Please report this issue to the Org mode mailing list using M-x 
>> org-submit-bug-report.
>
> Thanks for reporting!
> I tried to follow your steps, but I am unable to reproduce the problem.
> May you please attach the exact problematic Org file, so that we can
> make sure that we do the same thing?

Thanks for the prompt response.

Please find the attached file tmp.org.

Please ensure that the LaTeX preview image for the equation ($\alpha$)
is not in the directory specified by org-preview-latex-image-directory.
This warning appears when you generate a preview image that is not
already present in the directory specified by
org-preview-latex-image-directory.  I should have clarified this in the
initial email.  Apologies for any confusion.

-- 
Anush Veeranala
- H
$\alpha$


[BUG] Org parser error when removing latex preview [9.6.15 (release_9.6.15 @ /gnu/store/gnvv2a1nxfbibkm1wdxdv6bd6mhk4cf8-emacs-29.3/share/emacs/29.3/lisp/org/)]

2024-04-11 Thread General discussions about Org-mode.


Remember to cover the basics, that is, what you expected to happen and
what in fact did happen.  You don't know how to make a good report?  See

 https://orgmode.org/manual/Feedback.html#Feedback

Your bug report will be posted to the Org mailing list.

Hello,

Below are the steps to replicate the issue:

Start emacs by running "emacs --no-init".

Set the org-startup-numerated variable to true with the command (setq
org-startup-numerated t).

Create a new file named tmp.org and insert the following content:



- H
$\alpha$




To view the latex equation, place the cursor on the equation and press
the shortcut C-c C-x C-l to run org-latex-preview.  This will display
the latex preview.

Press C-c C-x C-l again to remove the latex preview and receive the
warning:



■ Warning (org-element-cache): org-element--cache: Org parser error in 
tmp.org::11. Resetting.
The error was: (error "Invalid search bound (wrong side of point)")
Backtrace: nil
Please report this issue to the Org mode mailing list using M-x 
org-submit-bug-report.



Running C-c C-x C-l again will not trigger the warning.  However, the
warning reappears whenever a new latex preview is generated.

For example, changing $\alpha$ to $\beta$ and generating a latex preview
using C-c C-x C-l and removing preview using C-c C-x C-l will again
result in this warning.



Emacs  : GNU Emacs 29.3 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.41, 
cairo version 1.16.0)
Package: Org mode version 9.6.15 (release_9.6.15 @ 
/gnu/store/gnvv2a1nxfbibkm1wdxdv6bd6mhk4cf8-emacs-29.3/share/emacs/29.3/lisp/org/)

current state:
==
(setq
 org-link-elisp-confirm-function 'yes-or-no-p
 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-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-odt-format-inlinetask-function 'org-odt-format-inlinetask-default-function
 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-startup-numerated t
 org-persist-before-read-hook '(org-element--cache-persist-before-read)
 org-mode-hook '(#[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-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-odt-format-headline-function 'org-odt-format-headline-default-function
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 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-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
 org-odt-format-drawer-function #[514 "\207" [] 3 "\n\n(fn NAME CONTENTS)"]
 org-persist-directory "/tmp/org-persist-Wop8rB"
 org-fold-core-isearch-open-function 'org-fold--isearch-reveal
 org-latex-format-inlinetask-function 
'org-latex-format-inlinetask-default-function
 org-persist-before-write-hook '(org-element--cache-persist-before-write)
 org-tab-first-hook '(org-babel-hide-result-toggle-maybe
  org-babel-header-arg-expand)
 org-link-shell-confirm-function 'yes-or-no-p
 org-babel-pre-tangle-hook '(save-buffer)
 org-agenda-loop-over-headlines-in-active-region nil
 org-occur-hook '(org-first-headline-recenter)
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-link-parameters '(("attachment" :follow org-attach-follow :complete
org-attach-complete-link)
   ("id" :follow org-id-open)
   ("eww" :follow org-eww-open :store org-eww-store-link)
   ("rmail" :follow org-rmail-open :store
org-rmail-store-link)

[BUG] Org parser error Invalid search bound (wrong side of point) [9.7 (9.7-??-7a6bb0904 @ /Users/dougheadley/.config/emacs/.local/straight/build-29.2/org/)]

2024-02-16 Thread General discussions about Org-mode.
using org-ai seemed to cause this bug.  I wouldn't have recieved this 
error otherwise.


Never filed a bug report before.  Please ignore if this seems incomplete.



⛔ Warning (org-element): org-element--cache: Org parser error in 
2024-02-14.org::898. Resetting.

The error was: (error "Invalid search bound (wrong side of point)")
Backtrace:
" backtrace-to-string(nil)
org-element-at-point()
org-eldoc-get-src-lang()
#f(compiled-function ( args) \"Return breadcrumbs when on a 
headline, args for src block header-line,\\n calls other documentation 
functions depending on lang when inside src body.\" #0x16f3b50a8f808dd9>)(#f(compiled-function (string  plist) 
#))
apply(#f(compiled-function ( args) \"Return breadcrumbs when on a 
headline, args for src block header-line,\\n calls other documentation 
functions depending on lang when inside src body.\" #0x16f3b50a8f808dd9>) #f(compiled-function (string  plist) 
#))
org-eldoc-documentation-function(#f(compiled-function (string  
plist) #))

eldoc-documentation-default()
eldoc--invoke-strategy(nil)
eldoc-print-current-symbol-info()
#()
apply(# nil)
timer-event-handler([t 0 0 50 nil #F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_13> nil idle 0 nil])

"
Please report this to Org mode mailing list (M-x org-submit-bug-report).

Emacs : GNU Emacs 29.2 (build 2, x86_64-apple-darwin23.2.0, NS 
appkit-2487.30 Version 14.2.1 (Build 23C71))

of 2024-01-24
Package: Org mode version 9.7 (9.7-??-7a6bb0904 @ 
/Users/dougheadley/.config/emacs/.local/straight/build-29.2/org/)


current state:
==
(setq
org-noter--doc-goto-location-hook '(org-noter-djvu--goto-location
org-noter-nov--goto-location
org-noter-pdf--goto-location)
org-journal-date-prefix "#+TITLE: "
org-link-elisp-confirm-function nil
org-directory "~/Network/syncthing/org"
org-after-refile-insert-hook '(save-buffer)
org-indirect-buffer-display 'current-window
org-roam-db-gc-threshold 2305843009213693951
org-crypt-key nil
org-hide-emphasis-markers t
org-bibtex-headline-format-function 'org-bibtex-headline-format-default
org-log-done 'time
org-roam-mode-hook '(+org-roam-detach-magit-section-mode-map-h
turn-on-visual-line-mode)
org-roam-dailies-capture-templates '(("d" "Default" entry "** %<%H:%M> %?"
:if-new
(file+head "%<%Y-%m-%d>.org"
"#+title: %<%Y-%m-%d>\n#+STARTUP: overview\n\n* master 
[[file:~/Network/syncthing/org/todo.org][todo]], 
[[id:0261f526-24cf-43a2-83b6-f9612334b685][job hunt]]\n* coffee time\n* 
work\n* personal\n* wrap up\n* daily journal\n")

)
)
org-load-hook '(+org-init-org-directory-h +org-init-appearance-h
+org-init-agenda-h +org-init-attachments-h
+org-init-babel-h +org-init-babel-lazy-loader-h
+org-init-capture-defaults-h +org-init-capture-frame-h
+org-init-custom-links-h +org-init-export-h
+org-init-habit-h +org-init-hacks-h +org-init-keybinds-h
+org-init-popup-rules-h +org-init-smartparens-h
+org-init-roam-h)
org-journal-find-file-fn 'find-file
org-startup-folded nil
org-babel-after-execute-hook 
'(+org-redisplay-inline-images-in-babel-result-h)

org-link-abbrev-alist '(("doomdir" . "/Users/dougheadley/.config/doom/%s")
("emacsdir" . "/Users/dougheadley/.config/emacs/%s")
("doom-repo" .
"https://github.com/doomemacs/doomemacs/%s;)
("wolfram" . "https://wolframalpha.com/input/?i=%s;)
("wikipedia" . "https://en.wikipedia.org/wiki/%s;)
("duckduckgo" . "https://duckduckgo.com/?q=%s;)
("kagi" . "https://kagi.com/search?q=%s;)
("gmap" . "https://maps.google.com/maps?q=%s;)
("gimages" . "https://google.com/images?q=%s;)
("google" . "https://google.com/search?q=;)
("youtube" . "https://youtube.com/watch?v=%s;)
("github" . "https://github.com/%s;))
org-agenda-files 
'("/Users/dougheadley/Network/syncthing/org/roam/20230912175002-job_hunt.org" 
"/Users/dougheadley/Network/syncthing/org/d.passiveobserver.org" 
"/Users/dougheadley/Network/syncthing/org/roam/20230612223054-diycloud.org" 
"/Users/dougheadley/Network/syncthing/org/20240104160254-iccesar.org" 
"/Users/dougheadley/Network/syncthing/org/todo.org" 
"/Users/dougheadley/Network/syncthing/org/20231101101832-gusto.org" 
"/Users/dougheadley/Network/syncthing/org/agenda.org")

org-journal-dir "~/Network/syncthing/org/journal/"
org-journal-date-format "%a, %Y-%m-%d"
org-capture-templates '(("d" "d.passiveobserver" entry
(file "~/Documents/org/d.passiveobserver.org")
"* TODO %?")
("g" "GitHub Link Capture" entry
(file "~/Documents/org/github.org")
"* [[%?]] Entered on %U")
("t" "Personal todo" entry
(file+headline +org-capture-todo-file "Inbox")
"* %u %?\n%i\n%a" :prepend t)
("n" "Personal notes" entry
(file+headline +org-capture-notes-file "Inbox")
"* %u %?\n%i\n%a" :prepend t)
("p" "Templates for projects")
("pt" "Project-local todo" entry
(file+headline +org-capture-project-todo-file
"Inbox")
"* TODO %?\n%i\n%a" :prepend t)
("pn" "Project-local notes" entry
(file+headline +org-capture-project-notes-file
"Inbox")
"* %U %?\n%i\n%a" :prepend t)
("pc" "Project-local changelog" entry
(file+headline +org-capture-project-changelog-file

Re: problems with templates and ID in properties

2024-02-02 Thread General discussions about Org-mode.


> Thanks for you answer


> So that cannot be changed, do I understand correctly.



> Thanks for trying it out, I suspect it is then my setting, I just looked
> up the org-mode-hook

> And I can't find any suspicious. I will try to eyeball my org-add-ons
> files.

> What command/variable could org-mode force to have always an UUID in the
> ID property?

> I also will try to debug org-capture and org-capture-finalize
> I tried it once and cannot see when the UUID is automatically inserted.

Ok, I debugged it again, the function org-caputre-finalize adds the
property with the UUID more specifically the line

(run-hooks 'org-capture-prepare-finalize-hook)

Hm I will investigate this further 

> hm

-- 
I strongly condemn Hamas heinous despicable pogroms/atrocities on Israel
I strongly condemn Putin's war of aggression against Ukraine.
I support to deliver weapons to Ukraine's military. 
I support the EU and NATO membership of Ukraine. 



smime.p7s
Description: S/MIME cryptographic signature


Re: problems with templates and ID in properties

2024-02-02 Thread General discussions about Org-mode.

> Uwe Brauer  writes:

Thanks for you answer
> This is expected. As per `org-capture-templates' docstring, "entry"
> capture type inserts top-level entries into files:

>entry   an Org node, with a headline.  Will be filed
>as the child of the target entry or as a
>top-level entry.  Its default template is:
>  "* %?

So that cannot be changed, do I understand correctly.


> I am unable to reproduce this problem.
> May you please simplify the example, so that it can be reproduced
> starting from emacs -Q?

Thanks for trying it out, I suspect it is then my setting, I just looked
up the org-mode-hook

And I can't find any suspicious. I will try to eyeball my org-add-ons
files.

What command/variable could org-mode force to have always an UUID in the
ID property?

I also will try to debug org-capture and org-capture-finalize
I tried it once and cannot see when the UUID is automatically inserted.

hm


-- 
I strongly condemn Hamas heinous despicable pogroms/atrocities on Israel
I strongly condemn Putin's war of aggression against Ukraine.
I support to deliver weapons to Ukraine's military. 
I support the EU and NATO membership of Ukraine. 



smime.p7s
Description: S/MIME cryptographic signature


Re: org-->latex and beamer, avoid blocks

2024-01-18 Thread General discussions about Org-mode.
>>> "FE" == Fraga, Eric  writes:

> On Thursday, 18 Jan 2024 at 16:40, Uwe Brauer via "General discussions
> about Org-mode." wrote: 
>> Any suggestion how to tell the converter not convert
>> 
>> *** First step
>> 
>> To a block?

> Add the :B_ignoreheading: tag and the following property to the headline:

> :PROPERTIES:
> :BEAMER_env: ignoreheading
> :END:

> which you can do easily if you have

Ah, thanks very much.


> #+startup: beamer

> in your org file which allows you to then use "C-c C-b i" to add that
> information.

Aha also very useful (the allowframebreaks and shrink option that I use
often is unfortunately not among these property templates)

> Although the idea of a single document that exports to both beamer and
> LaTeX is attractive, I've always found it to be more effort than it's
> worth.  Just my 2¢.


Well, right. I just realized that for example 
when I export the document to LatReX article, then cosntructs like


*** Code
 :PROPERTIES:
 :BEAMER_env: ignoreheading
 :END:

Get converted in the sense that the properties are not simply ignored
but transformed to text, which is not what I want.



-- 
I strongly condemn Hamas heinous despicable pogroms/atrocities on Israel
I strongly condemn Putin's war of aggression against Ukraine.
I support to deliver weapons to Ukraine's military. 
I support the EU and NATO membership of Ukraine. 



smime.p7s
Description: S/MIME cryptographic signature


export to latex (article) but with multicolums

2024-01-18 Thread General discussions about Org-mode.


Hello

According to 

https://orgmode.org/worg/exporters/beamer/tutorial.html

It is possible to have multicolumns in beamer.

Now I am writing a bilingual text, and would have each language in a column.

Is there any similar configuration possible for exporting to LaTeX (article)?

Thanks and regards

Uwe Brauer 
-- 
I strongly condemn Hamas heinous despicable pogroms/atrocities on Israel
I strongly condemn Putin's war of aggression against Ukraine.
I support to deliver weapons to Ukraine's military. 
I support the EU and NATO membership of Ukraine. 





org-->latex and beamer, avoid blocks

2024-01-18 Thread General discussions about Org-mode.



Hi

I have a longer documents with a lot of graphics, and the following setting:

#+OPTIONS: H:2

So that 
** Introduction 

Will be converted to a frame, while if converted to LaTeX (article) it
will be converted to a subsection.

Now I also have  subsubsections like 

*** First step

Containing two graphics, 

This subsubsection will be converted to a block and then I cannot use
allowframebreaks and only one graphics is displayed.

Any suggestion how to tell the converter not convert 

*** First step 

To a block?

Thanks and regards

Uwe Brauer 


-- 
I strongly condemn Hamas heinous despicable pogroms/atrocities on Israel
I strongly condemn Putin's war of aggression against Ukraine.
I support to deliver weapons to Ukraine's military. 
I support the EU and NATO membership of Ukraine. 





Re: problem with https://orgmode.org/manual/Results-of-Evaluation.html

2024-01-16 Thread General discussions about Org-mode.
>>> "IR" == Ihor Radchenko  writes:

> Uwe Brauer via "General discussions about Org-mode."
>  writes:

>> #+NAME: many-cols
>> | a | b | c |
>> | d | e | f |
>> | g | h | i |
>> 
>> #+NAME: hline-please
>> #+BEGIN_SRC python :var tab=many-cols :hlines yes
>> return tab
>> #+END_SRC
>> 
>> #+RESULTS: hline-please
>> | a | b | c |
>> | d | e | f |
>> | g | h | i |
>> 
>> Works, but I also hoped that I could use python to add hlines to table
>> without hline, but alas it does not work!

> :hlines controls filtering  from input. It does nothing about code
> block output.

> More specifically, ":hlines no" takes care about removing hlines from
> the input. ":hlines yes" does not perform any filtering.

Ok understood, but then, who can I add hlines to table that does not
possess any?
-- 
I strongly condemn Hamas heinous despicable pogroms/atrocities on Israel
I strongly condemn Putin's war of aggression against Ukraine.
I support to deliver weapons to Ukraine's military. 
I support the EU and NATO membership of Ukraine. 



smime.p7s
Description: S/MIME cryptographic signature


Re: problem with https://orgmode.org/manual/Results-of-Evaluation.html

2024-01-15 Thread General discussions about Org-mode.

> Uwe Brauer via "General discussions about Org-mode."
>  writes:


> No, this is because you customized `org-src-preserve-indentation' or
> `org-edit-src-content-indentation', while the provided example only
> works with default indentation settings. Python is sensitive to
> whitespace and your config prevents Org mode from removing the two
> spaces in the example block.

> I adjusted the manual to not indent src blocks.  Then, they should work
> across more wide range of user settings.

Thanks, I confirm that 

#+NAME: many-cols
| a | b | c |
| d | e | f |
| g | h | i |

#+NAME: hline-please
#+BEGIN_SRC python :var tab=many-cols :hlines yes
return tab
#+END_SRC

#+RESULTS: hline-please
| a | b | c |
| d | e | f |
| g | h | i |

Works, but I also hoped that I could use python to add hlines to table
without hline, but alas it does not work!


-- 
I strongly condemn Hamas heinous despicable pogroms/atrocities on Israel
I strongly condemn Putin's war of aggression against Ukraine.
I support to deliver weapons to Ukraine's military. 
I support the EU and NATO membership of Ukraine. 



smime.p7s
Description: S/MIME cryptographic signature


problem with https://orgmode.org/manual/Results-of-Evaluation.html

2024-01-15 Thread General discussions about Org-mode.


Hi 

I tried to use the examples of the above link

#+NAME: many-cols
| a | b | c |
|---+---+---|
| d | e | f |
|---+---+---|
| g | h | i |

#+NAME: no-hline
#+BEGIN_SRC python :var tab=many-cols :hlines no
  return tab
#+END_SRC

Now already the first failed:
,
| 
|   File "", line 4
| return tab
| ^
| IndentationError: unexpected indent
| [ Babel evaluation exited with code 1 ]
`

Problem could be that which python on my Ubuntu system returns
Python 2.7.12

I presume the code is for python 3.X. How can I tell org to use that
one?

Regards

Uwe Brauer 

-- 
I strongly condemn Hamas heinous despicable pogroms/atrocities on Israel
I strongly condemn Putin's war of aggression against Ukraine.
I support to deliver weapons to Ukraine's military. 
I support the EU and NATO membership of Ukraine. 





org-table add hlines when import from csv, and regionwise

2024-01-14 Thread General discussions about Org-mode.


Hi

Does anybody know about the following enhancements:

1. When importing from CSV all rows in the org table get a hline

2. Marking a some rows in a table, should then allow to insert
   htlines to each row in the marked region.

Thanks

Uwe Brauer 


-- 
I strongly condemn Hamas heinous despicable pogroms/atrocities on Israel
I strongly condemn Putin's war of aggression against Ukraine.
I support to deliver weapons to Ukraine's military. 
I support the EU and NATO membership of Ukraine. 





Re: Real-time, granular synchronization of .org files across devices?

2024-01-06 Thread General discussions about Org-mode.


> I use nextcloud to sync my org files, i.e. I have my own nextcloud
> instance to sync my files between different computers
> (laptop/PC/work/home). There are occasional file conflicts which have to
> be solved, but rarely. Files are synchronised immediately on save (if
> the devices are connected or as sson as you go online.

Thank you for the suggestion.

I do have a Nextcloud instance running on Hetzner, but it is not
really suited for syncing files: Syncthing, as a specialized tool, works
slightly better and works on Android, too. (Can't sync files on Android
using the official Nextcloud app). Plus, both of them have no way to
merge file based on their content



Re: Real-time, granular synchronization of .org files across devices?

2024-01-06 Thread General discussions about Org-mode.



> Single threading is not an issue. In fact, Emacs already has
> https://code.librehq.com/qhong/crdt.el that provides live collaborative
> editing. In theory, you might even make crdt.el work on your phone with
> the new official Emacs Android port. Might be tricky though.

That's really impressive! 

> You can try https://github.com/bcpierce00/unison
> Also, there is https://github.com/Artawower/orgnote.el (still in early 
> development).

Unison appears to allow to set custom conflict resolution
methods. That's neat, but the whole synchronization process is not
automatic but must be initiated by the user. Might rather go the git
route at this point.

The orgnote project looks really awesome. A synchronization server would
greatly benefit Org Mode (However, if a CRDT based mechanism were ever to
be implemented and a parser would be needed, I wonder if it would be as
featureful as the Emacs bundled Org Element API). I'm gonna keep a close
eye at it.

Thank you for pointing out these two solutions. I wasn't aware of these before





Real-time, granular synchronization of .org files across devices?

2024-01-04 Thread General discussions about Org-mode.
Hi,

I've been using Emacs+Org Mode on my Linux and Android devices
for some time now and have been encountering some little synchronization
issues that have made it difficult for me to use Org as a task manager.

I've encountered no big issues regarding long documents or note writing, but
due to the frequently interleaved sessions between my laptop and my
smartphone - sometimes in areas without Internet connection -  it is kind of 
frequent
to have conflicting files generated from SyncThing among my Org agenda (task)
files, which are edited way more frequently.

One such concrete instance of this problem is when I clock-in an
entry from my smartphone and then try to edit another entry from my
laptop with no Internet connection.  Syncthing has no way to perform an
automatic conflict resolution and couldn't care less if the edits on the
.org file are disjointed or not.

Git can deal with conflicting files line-wise and apparently many users do use
it, but having to deal with pulling and pushing each time does not look
compelling and it also does not look intended for automatic synchronization.

Org mode looks incredibly versatile as a task manager and no alternative
turns out to be on par, but the synchronization issues grudgingly strive me from
using it. I'm writing this message to ask you if there's some
alternative solution I've not considered yet.

Alternatively, I'd also like to now if there could be in the future
solutions like obsidian-livesync
(https://github.com/vrtmrz/obsidian-livesync) which apparently allow to
perform live synchronization over multiple writes on the same file. I
don't really need to know if someone will work on it (which is obviously
unpredictable) but rather if it would be feasible or if Emacs (being
single threaded, for example) and Org could instead be a blocker.

Thank you in advance for your answers.
Cheers.



[PATCH] Add org-after-note-stored-hook

2024-01-02 Thread General discussions about Org-mode.

Hello,

I've been archiving tasks automatically using
`org-after-todo-state-change-hook' but I've been recently bit with a
note (entering a todo state configured with '@') being placed where the
task was before its archival.

This patch aims to offer a way to defer the archival after the
note is stored. Actually, I am using it like this:

#+begin_src elisp
(add-to-list 'org-after-todo-state-change-hook
   (lambda ()
 ;; States configured without mandatory note
 (when (member org-state '("DONE"))
   (my/org-roam-archive-to-today))
 ;; States configured with mandatory note
 (when (member org-state '("CANCELLED" "READ"))
   (add-to-list 'org-after-note-stored-hook 
'my/org-roam-archive-to-today
#+end_src

With `my/org-roam-archive-to-today' removing itself from
`org-after-note-stored-hook'.

Hopefully I did not miss an existing way to do this.

Regards,
Joris

>From 18de09a3aa08e3d06f180165530cbaeeccdf3ccf Mon Sep 17 00:00:00 2001
From: Joris Caravati 
Date: Tue, 2 Jan 2024 22:50:32 +0100
Subject: [PATCH] lisp/org.el: Add `org-after-note-stored-hook'

* lisp/org.el: Add `org-after-note-stored-hook' which is called at the
end of the `org-store-log-note' function.
* etc/ORG-NEWS: Document the new hook.

This change allows customization after a note is taken. One case where
it is useful is when one wants to move a task after a state change but
cannot do so in `org-after-todo-state-change' because the new state is
configured to take a note (with '@' in `org-todo-keywords').

Setting this hook in `org-after-todo-state-change' allows to defer the
move after the note is taken and prevents the note to be placed where
the task was before being moved.

TINYCHANGE
---
 etc/ORG-NEWS | 4 
 lisp/org.el  | 6 +-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index c54473f55..911e8ffeb 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -742,6 +742,10 @@ Completion is enabled for links to man pages added using ~org-insert-link~:
 =C-c C-l man RET emacscl TAB= to get =emacsclient=.  Of course, the ~ol-man~
 library should be loaded first.
 
+*** New hook [[doc::org-after-note-stored-hook][org-after-note-stored-hook]]
+
+This new hook runs when a note has been stored.
+
 ** New functions and changes in function arguments
 *** ~org-fold-hide-drawer-all~ is now interactive
 
diff --git a/lisp/org.el b/lisp/org.el
index 6e6e075b4..fad21d8ba 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -1944,6 +1944,9 @@ Lisp variable `org-state'."
   :group 'org-todo
   :type 'hook)
 
+(defcustom org-after-note-stored-hook nil
+  "Hook which is run after a note was stored")
+
 (defvar org-blocker-hook nil
   "Hook for functions that are allowed to block a state change.
 
@@ -10729,7 +10732,8 @@ items are State notes."
   (with-current-buffer (marker-buffer org-log-note-return-to)
 (goto-char org-log-note-return-to))
   (move-marker org-log-note-return-to nil)
-  (when org-log-post-message (message "%s" org-log-post-message)))
+  (when org-log-post-message (message "%s" org-log-post-message))
+  (run-hooks 'org-after-note-stored-hook))
 
 (defun org-remove-empty-drawer-at (pos)
   "Remove an empty drawer at position POS.
-- 
2.38.5


[BUG] Warnings pop-ups in the org buffer [9.6.13 ( @ /home/soumya/.emacs.d/elpa/org-9.6.13/)]

2023-12-15 Thread General discussions about Org-mode.


Remember to cover the basics, that is, what you expected to happen and
what in fact did happen.  You don't know how to make a good report?  See

 https://orgmode.org/manual/Feedback.html#Feedback

Your bug report will be posted to the Org mailing list.


When I am working in a org-buffer, warnings pop-up like this:

 "Warning (org-element-cache): org-element--cache: Org parser error in 
init.org::75168. Resetting.
 The error was: (error "Invalid search bound (wrong side of point)")
 Backtrace:
nil
 Please report this to Org mode mailing list (M-x org-submit-bug-report)."

Emacs  : GNU Emacs 29.0.90 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.33, 
cairo version 1.16.0)
 of 2023-05-11
Package: Org mode version 9.6.13 ( @ /home/soumya/.emacs.d/elpa/org-9.6.13/)

current state:
==
(setq
 org-link-elisp-confirm-function 'yes-or-no-p
 org-bibtex-headline-format-function #[257 "\300\236A\207" [:title] 3 "\n\n(fn 
ENTRY)"]
 org-log-done 'time
 org-agenda-custom-commands '(("c" "Simple agenda view"
   ((alltodo ""
 ((org-agenda-skip-function
   '(org-agenda-skip-entry-if 'notregexp 
"\\[#A\\]" 'todo 'done))
  (org-agenda-overriding-header "High-priority 
unfinished tasks:"))
 )
(agenda "")
(alltodo ""
 ((org-agenda-skip-function
   '(or (air-org-skip-subtree-if-priority 65)
 (org-agenda-skip-if nil '(scheduled 
deadline)))
   )
  )
 )
)
   )
  )
 org-startup-folded t
 org-agenda-files '("~/org_files/elfeed/" "~/org_files/")
 org-persist-after-read-hook '(org-element--cache-persist-after-read)
 org-refile-targets '((+org/opened-buffer-files :maxlevel . 9))
 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-refile-use-outline-path 'file
 org-finalize-agenda-hook '(org-agenda-to-appt)
 org-archive-hook '(org-attach-archive-delete-maybe)
 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-wild-notifier-mode t
 org-persist-before-read-hook '(org-element--cache-persist-before-read)
 org-link-from-user-regexp 
"|\\"
 org-image-actual-width nil
 org-mode-hook '(pulsar-mode #[0 "\301\211\207" [imenu-create-index-function 
org-imenu-get-tree] 2]
 jinx-mode
 #[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-modern-indent-mode)
 org-babel-load-languages '((shell . t))
 org-modern-label-border nil
 org-modern-timestamp nil
 org-agenda-tags-column -120
 org-confirm-shell-link-function 'yes-or-no-p
 org-adapt-indentation 'headline-data
 outline-isearch-open-invisible-function 'outline-isearch-open-invisible
 org-startup-indented t
 org-modern-todo nil
 org-babel-python-command "python3"
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-babel-tangle-lang-exts '(("python" . "py") ("latex" . "tex") ("emacs-lisp" 
. "el")
  ("elisp" . "el"))
 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-todo-keywords '((sequence "TODO(t)" "ONGOING(o)" "WAIT(w@/!)" "|" 
"DONE(d!/!)" "|"
  "CANCELED(c@/!)")
 )
 org-speed-command-hook '(org-speed-command-activate 
org-babel-speed-command-activate)
 org-modern-priority nil
 org-modern-mode-hook '(org-modern-mode-set-explicitly)
 org-export-backends '(ascii beamer html icalendar latex md odt)
 org-confirm-babel-evaluate nil
 org-fold-core-isearch-open-function 'org-fold-core--isearch-reveal
 org-persist-before-write-hook '(org-element--cache-persist-before-write)
 org-tab-first-hook '(org-babel-hide-result-toggle-maybe 
org-babel-header-arg-expand)
 org-link-shell-confirm-function 'yes-or-no-p
 org-agenda-finalize-hook '(org-modern-agenda)
 org-babel-pre-tangle-hook '(save-buffer)
 org-agenda-loop-over-headlines-in-active-region nil
 org-todo-keyword-faces '(("TODO" . "red") ("ONGOING" . "orange") ("WAIT" . 
"grey") ("DONE" . "blue")
  ("CANCELED" . "yellow"))
 

[BUG] Parser error: Invalid search bound (wrong side of point) [9.7 (9.7-??-e90a8a69a @ /home/user/.emacs.d/.local/straight/build-29.1/org/)]

2023-10-17 Thread General discussions about Org-mode.
Hello,
I ran `C-c C-x C-l` to create a LaTeX preview of the following inline fragment 
in an Org document: $\text{CaCo}_3$, and this bug happened. This is my first 
bug report so let me know if anything else is necessary.
- Lorenzo



Emacs  : GNU Emacs 29.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.24, 
cairo version 1.16.0)
 of 2023-08-24
Package: Org mode version 9.7 (9.7-??-e90a8a69a @ 
/home/user/.emacs.d/.local/straight/build-29.1/org/)

current state:
==
(setq
 org-link-elisp-confirm-function nil
 org-cite-insert-processor 'citar
 org-after-refile-insert-hook '(save-buffer)
 org-indirect-buffer-display 'current-window
 org-crypt-key nil
 org-hide-emphasis-markers t
 org-bibtex-headline-format-function 'org-bibtex-headline-format-default
 org-load-hook '(+org-init-org-directory-h +org-init-appearance-h 
+org-init-agenda-h +org-init-attachments-h
                 +org-init-babel-h +org-init-babel-lazy-loader-h 
+org-init-capture-defaults-h +org-init-capture-frame-h
                 +org-init-custom-links-h +org-init-export-h +org-init-habit-h 
+org-init-hacks-h +org-init-keybinds-h
                 +org-init-popup-rules-h +org-init-smartparens-h)
 org-startup-folded t
 org-babel-after-execute-hook '(+org-redisplay-inline-images-in-babel-result-h)
 org-link-abbrev-alist '(("doomdir" . "/home/user/.doom.d/%s") ("emacsdir" . 
"/home/user/.emacs.d/%s")
                         ("doom-repo" . 
"https://github.com/doomemacs/doomemacs/%s;)
                         ("wolfram" . "https://wolframalpha.com/input/?i=%s;)
                         ("wikipedia" . "https://en.wikipedia.org/wiki/%s;) 
("duckduckgo" . "https://duckduckgo.com/?q=%s;)
                         ("gmap" . "https://maps.google.com/maps?q=%s;) 
("gimages" . "https://google.com/images?q=%s;)
                         ("google" . "https://google.com/search?q=;) ("youtube" 
. "https://youtube.com/watch?v=%s;)
                         ("github" . "https://github.com/%s;))
 org-agenda-files '("~/nextcloud-sync/todo.org")
 org-capture-templates '(("t" "Personal todo" entry (file+headline 
+org-capture-todo-file "Inbox") "* [ ] %?\n%i\n%a"
                          :prepend t)
                         ("n" "Personal notes" entry (file+headline 
+org-capture-notes-file "Inbox") "* %u %?\n%i\n%a"
                          :prepend t)
                         ("j" "Journal" entry (file+olp+datetree 
+org-capture-journal-file) "* %U %?\n%i\n%a" :prepend t)
                         ("p" "Templates for projects")
                         ("pt" "Project-local todo" entry (file+headline 
+org-capture-project-todo-file "Inbox")
                          "* TODO %?\n%i\n%a" :prepend t)
                         ("pn" "Project-local notes" entry (file+headline 
+org-capture-project-notes-file "Inbox")
                          "* %U %?\n%i\n%a" :prepend t)
                         ("pc" "Project-local changelog" entry
                          (file+headline +org-capture-project-changelog-file 
"Unreleased") "* %U %?\n%i\n%a" :prepend t)
                         ("o" "Centralized templates for projects")
                         ("ot" "Project todo" entry 
#'+org-capture-central-project-todo-file "* TODO %?\n %i\n %a" :heading
                          "Tasks" :prepend nil)
                         ("on" "Project notes" entry 
#'+org-capture-central-project-notes-file "* %U %?\n %i\n %a" :heading
                          "Notes" :prepend t)
                         ("oc" "Project changelog" entry 
#'+org-capture-central-project-changelog-file "* %U %?\n %i\n %a"
                          :heading "Changelog" :prepend t)
                         )
 org-persist-after-read-hook '(org-element--cache-persist-after-read)
 org-refile-targets '((nil :maxlevel . 3) (org-agenda-files :maxlevel . 3))
 org-export-before-parsing-hook '(org-attach-expand-links)
 org-cycle-tab-first-hook '(+org-yas-expand-maybe-h +org-indent-maybe-h 
org-babel-hide-result-toggle-maybe
                            org-babel-header-arg-expand 
+org-clear-babel-results-h +org-cycle-only-current-subtree-h)
 org-default-notes-file "/home/user/org/notes.org"
 org-auto-tangle-default t
 org-refile-use-outline-path 'file
 org-publish-timestamp-directory 
"/home/user/.emacs.d/.local/cache/org/timestamps/"
 org-archive-hook '(org-attach-archive-delete-maybe)
 org-cite-follow-processor 'citar
 org-file-apps '((remote . emacs) (auto-mode . emacs) (directory . emacs) 
("\\.mm\\'" . default)
                 ("\\.x?html?\\'" . default) ("\\.pdf\\'" . default))
 org-odt-format-inlinetask-function 'org-odt-format-inlinetask-default-function
 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)
 

[BUG] tikz latex figures don't render properly in the html output. [9.6.6 (release_9.6.6 @ /usr/share/emacs/29.1/lisp/org/)]

2023-09-18 Thread General discussions about Org-mode.
Remember to cover the basics, that is, what you expected to happen and
what in fact did happen.  You don't know how to make a good report?  See

 https://orgmode.org/manual/Feedback.html#Feedback

Your bug report will be posted to the Org mailing list.


#+LATEX_HEADER: \usepackage{tikz}

\begin{tikzpicture}
\draw (0,0) circle [radius=2cm];
\end{tikzpicture}

This is the minimal document to reproduce this error. I do have some
additional org config as follows:

#+begin_src elisp
  (custom-set-variables '(org-format-latex-options
  '(:foreground default :background default :scale
3 :html-foreground "Black" :html-background
"Transparent" :html-scale 1 :matchers
("begin" "$1" "$" "$$" "\\("
"\\["
  (setq org-preview-latex-default-process 'imagemagick)
#+end_src

I have already tried changing the `org-preview-latex-default-process`
file, but thats doesn't solve it.

Instead of the figure it draws the command in a latexy font.


Emacs  : GNU Emacs 29.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.38, cairo version 1.17.8)
Package: Org mode version 9.6.6 (release_9.6.6 @
/usr/share/emacs/29.1/lisp/org/)

current state:
==
(setq
 org-link-elisp-confirm-function 'yes-or-no-p
 org-bibtex-headline-format-function #[257 "\300\236A\207" [:title] 3
"\n\n(fn ENTRY)"]
 org-roam-node-display-template #("${title:*} ${tags:10}" 11 21 (face
org-tag))
 org-persist-after-read-hook '(org-element--cache-persist-after-read)
 org-format-latex-options '(:foreground default :background default :scale 3
:html-foreground "Black" :html-background 
"Transparent"
:html-scale 1 :matchers ("begin" "$1" "$" "$$" 
"\\(" "\\["))
 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-roam-find-file-hook '(org-roam-buffer--setup-redisplay-h
   org-roam--register-completion-functions-h
   org-roam--replace-roam-links-on-save-h
   org-roam-db-autosync--setup-update-on-save-h)
 org-archive-hook '(org-attach-archive-delete-maybe)
 org-odt-format-inlinetask-function
'org-odt-format-inlinetask-default-function
 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-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]
 (lambda nil
  (setq prettify-symbols-alist
   '(("[ ]" . "  ") ("[-]" . "  ") ("[X]" . 
"  ")))
  )
 ECFPAW/org-latex-yas turn-on-org-cdlatex
 (lambda nil
  (set (make-local-variable 'electric-pair-inhibit-predicate)
   (list 'lambda '(c)
(list 'if '(char-equal c 60) t
 (cons electric-pair-inhibit-predicate '(c)))
)
   )
  )
 org-tempo-setup (lambda nil (org-bullets-mode 1)) 
org-indent-mode
 auto-fill-mode flyspell-mode
 #[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-babel-load-languages '((emacs-lisp . t) (python . t))
 org-roam-ref-annotation-function 'org-roam-ref-read--annotation
 org-roam-directory "/home/tusharhero/Documents/roam"
 org-latex-format-drawer-function #[514 "\207" [] 3 "\n\n(fn _ CONTENTS)"]
 org-roam-db-node-include-function #[0 "\300\207" [t] 1]
 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-odt-format-headline-function 'org-odt-format-headline-default-function
 org-protocol-protocol-alist '(("org-roam-node" :protocol "roam-node"
:function
org-roam-protocol-open-node)
   ("org-roam-ref" :protocol "roam-ref" :function
org-roam-protocol-open-ref)
   )
 org-roam-capture-preface-hook '(org-roam-dailies--override-capture-time-h
 

[BUG] org-element--cache: Org parser error (error "rx '**' range error") [9.7 (9.7-??-d6f3aed7b @ /Users/fbartik/.config/emacs/.local/straight/build-29.1/org/)]

2023-08-24 Thread General discussions about Org-mode.



Hi,

I'm very new to Emacs and org and I'm running into this issue when I 
start Emacs from scratch and reload my last session.


The error I get looks like this and there are multiples on each start:

Warning (org-element-cache): org-element--cache: Org parser error in 
config.el::5943. Resetting.

 The error was: (error "rx '**' range error")
 Backtrace:
nil

I'm sure there are issues with my configuration, which is pasted below.  
This is because I'm using the Doom Emacs framework as well as snippets 
of other users' configurations.


Thanks for any advice,
Franta Bartik

Emacs  : GNU Emacs 29.1 (build 2, x86_64-apple-darwin22.6.0, NS 
appkit-2299.70 Version 13.5 (Build 22G74))

 of 2023-08-10
Package: Org mode version 9.7 (9.7-??-d6f3aed7b @ 
/Users/fbartik/.config/emacs/.local/straight/build-29.1/org/)


current state:
==
(setq
 org-link-elisp-confirm-function nil
 org-directory "~/syncthing/org/"
 org-after-todo-state-change-hook '(log-todo-next-creation-date)
 org-after-refile-insert-hook '(save-buffer)
 org-indirect-buffer-display 'current-window
 org-roam-db-gc-threshold 2305843009213693951
 org-bibtex-headline-format-function #[257 "\300\236A\207" [:title] 3 
"\n\n(fn ENTRY)"]

 org-log-done 'time
 org-roam-mode-hook '(+org-roam-detach-magit-section-mode-map-h 
turn-on-visual-line-mode)

 org-agenda-custom-commands '(("g" "Get Things Done (GTD)"
   ((agenda ""
 ((org-agenda-skip-function
   '(org-agenda-skip-entry-if 
'deadline))

  (org-deadline-warning-days 0))
 )
(todo "NEXT"
 ((org-agenda-skip-function
   '(org-agenda-skip-entry-if 
'deadline))
  (org-agenda-prefix-format "  %i %-12:c 
[%e] ")
  (org-agenda-overriding-header 
"\nTasks\n"))

 )
(agenda nil
 ((org-agenda-entry-types '(:deadline))
  (org-agenda-format-date "") 
(org-deadline-warning-days 7)

  (org-agenda-skip-function
   '(org-agenda-skip-entry-if 'notregexp 
"\\* NEXT"))
  (org-agenda-overriding-header 
"\nDeadlines"))

 )
(tags-todo "inbox"
 ((org-agenda-prefix-format "  %?-12t% 
s")
  (org-agenda-overriding-header 
"\nInbox\n"))

 )
(tags "CLOSED>=\"\""
 ((org-agenda-overriding-header 
"\nCompleted today\n")))

)
   )
  )
 org-load-hook '(+org-init-org-directory-h +org-init-appearance-h 
+org-init-agenda-h
 +org-init-attachments-h +org-init-babel-h 
+org-init-babel-lazy-loader-h

 +org-init-capture-defaults-h +org-init-capture-frame-h
 +org-init-custom-links-h +org-init-export-h 
+org-init-habit-h
 +org-init-hacks-h +org-init-keybinds-h 
+org-init-popup-rules-h

 +org-init-smartparens-h +org-init-roam-h)
 org-startup-folded nil
 org-babel-after-execute-hook 
'(+org-redisplay-inline-images-in-babel-result-h)

 org-link-abbrev-alist '(("doomdir" . "/Users/fbartik/.config/doom/%s")
 ("emacsdir" . 
"/Users/fbartik/.config/emacs/%s")
 ("doom-repo" . 
"https://github.com/doomemacs/doomemacs/%s;)
 ("wolfram" . 
"https://wolframalpha.com/input/?i=%s;)
 ("wikipedia" . 
"https://en.wikipedia.org/wiki/%s;)

 ("duckduckgo" . "https://duckduckgo.com/?q=%s;)
 ("gmap" . "https://maps.google.com/maps?q=%s;)
 ("gimages" . "https://google.com/images?q=%s;)
 ("google" . "https://google.com/search?q=;)
 ("youtube" . "https://youtube.com/watch?v=%s;)
 ("github" . "https://github.com/%s;))
 org-agenda-files '("~/git/organised-exchange/exchange.org"
"/Users/fbartik/syncthing/org/inbox.org"
"/Users/fbartik/syncthing/org/agenda.org"
"/Users/fbartik/syncthing/org/projects.org"
"/Users/fbartik/syncthing/org/work.org")
 org-capture-templates '(("i" "Inbox" entry (file 
"~/syncthing/org/inbox.org")

  "* TODO %?\n/Entered on/ %U")
 ("s" "Slipbox" entry (file 
"~/syncthing/org/org-roam/inbox.org")

  "* %?\n/Entered on/ %U")
   

[PATCH] org.el: Respect org-extend-today-until in timestamps with ++

2023-08-16 Thread General discussions about Org-mode.
* org.el (org-auto-repeat-maybe): Changed org-auto-repeat-maybe, so that
switching a repeating todo with a timestamp of the form <… ++…> respects
`org-extend-today-until'.
---
 lisp/org.el | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index c037b3ee0..d9cc9bee6 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -10099,9 +10099,10 @@ This function is run automatically after each state 
change to a DONE state."
 (- (org-today) (time-to-days time)) 'day)))
 ((equal "+" repeater-type)
  (let ((nshiftmax 10)
-   (nshift 0))
+   (nshift 0)
+(time-to-extend (seconds-to-time (* 3600 
org-extend-today-until
(while (or (= nshift 0)
-  (not (time-less-p nil time)))
+   (not (time-less-p nil (time-add 
time-to-extend time
  (when (= nshiftmax (cl-incf nshift))
(or (y-or-n-p
 (format "%d repeater intervals were not \
-- 
2.40.1




[PATCH] org.el: Respect org-extend-today-until in timestamps with ++

2023-08-13 Thread General discussions about Org-mode.
* org.el (org-auto-repeat-maybe): Changed org-auto-repeat-maybe, so that
switching a repeating todo with a timestamp of the form <… ++…> respects
`org-extend-today-until'.
---
 lisp/org.el | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index c037b3ee0..d9cc9bee6 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -10099,9 +10099,10 @@ This function is run automatically after each state 
change to a DONE state."
 (- (org-today) (time-to-days time)) 'day)))
 ((equal "+" repeater-type)
  (let ((nshiftmax 10)
-   (nshift 0))
+   (nshift 0)
+(time-to-extend (seconds-to-time (* 3600 
org-extend-today-until
(while (or (= nshift 0)
-  (not (time-less-p nil time)))
+   (not (time-less-p nil (time-add 
time-to-extend time
  (when (= nshiftmax (cl-incf nshift))
(or (y-or-n-p
 (format "%d repeater intervals were not \
-- 
2.40.1




Re: Add a Chinese version to index.org of orgmode.org

2023-08-08 Thread General discussions about Org-mode.
Hello Ihor, Lux and all,

On Aug 8, 2023, at 14:55, Ihor Radchenko  wrote:
> 
> lux  writes:
> 
>> Hi
>>  To facilitate Chinese users' understanding of Org Mode, I have
>> translated index.org into Simplified Chinese. Please review it.
> 
> Thanks!
> However, we already have another, more complete translation pending.
> See https://list.orgmode.org/orgmode/sdvzg71zzor@netyu.xyz/

Thank you, Ihor, for mentioning my translation. 

I had been busy for a few months (and will be for a while as far as I know), 
and don’t currently have the energy to push the translation further until 
probably early October.  However, I believe what I had done was pretty much 
complete (apart from the changelog etc that are pointless to translate), so, 
Lux, please try to make improvements to it first (by, I guess, comparing your 
translation with mine and determining what needs rewording).  Getting that 
patchset installed would help the lot of Chinese speaking users in 
understanding Org better.  

FWIW, all my translation work was done before my employment status changed (and 
the patchset consisted of almost no real code), so I have no concern with 
seeing it installed without having gotten the employer disclaimer. 

P.S.: I do still scan over the Emacs mailing lists daily, but I’m only on 
mobile where I am not fully equipped for email conversations nor sending 
patches. :)

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

-- 


RY



[Pre-PATCH v2] Add the capability to specify lexical scope in tangled files (was: Add new :lexical header argument)

2023-07-13 Thread General discussions about Org-mode.

Ihor Radchenko  writes:

> Evgenii Klimov  writes:
>
>> * lisp/ob-core.el (org-babel-common-header-args-w-values): Add new
>> :lexical header argument.
>
> A short note: ob-emacs-lisp already defines :lexical header arg. See
> org-babel-header-args:emacs-lisp.

Thanks for pointing it out. Updated the patch to reflect your note and
documented the change.

>From 7e75b55ccb4e82d9341b6b308b558e5d01df5128 Mon Sep 17 00:00:00 2001
From: Evgenii Klimov 
Date: Thu, 13 Jul 2023 18:16:08 +0100
Subject: [PATCH v2] ob-tangle.el: Add the capability to specify lexical scope
 in tangled files

* lisp/ob-tangle.el (org-babel-tangle): Add the ability to enable
lexical binding in Elisp tangled file.

* etc/ORG-NEWS (=:lexical= header argument now influences tangled
files): Document this change.

Previously one could achieve this manually, but 1) had to keep in mind
to hold this source block top-most, 2) couldn't use comment header
argument, as `lexical-binding' variable must be set in the first line
of a file.
---
 etc/ORG-NEWS  | 7 +++
 lisp/ob-tangle.el | 9 +++--
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index a4725ae8c..c632c4814 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -284,6 +284,13 @@ setting the ~STYLE~ property for each sub-task.
 The change is breaking when ~org-use-property-inheritance~ is set to ~t~.
 
 ** New and changed options
+*** =:lexical= header argument now influences tangled files
+
+When extracting an Elisp src block, the target's file
+~lexical-binding~ variable is set according to the src block's
+=:lexical= parameter.  If at least one block is set to lexical scope,
+then the whole file will be with lexical scope.
+
 *** Commands affected by ~org-fold-catch-invisible-edits~ can now be customized
 
 New user option ~org-fold-catch-invisible-edits-commands~ controls
diff --git a/lisp/ob-tangle.el b/lisp/ob-tangle.el
index 1274d0db7..10fe5dcf5 100644
--- a/lisp/ob-tangle.el
+++ b/lisp/ob-tangle.el
@@ -262,7 +262,7 @@ expression."
 	 (when file-name
(let ((lspecs (cdr by-fn))
 		 (fnd (file-name-directory file-name))
-		 modes make-dir she-banged lang)
+		 modes make-dir she-banged scoped lang)
 	 ;; drop source-blocks to file
 	 ;; We avoid append-to-file as it does not work with tramp.
 	 (with-temp-buffer
@@ -273,6 +273,8 @@ expression."
 			 (get-spec (lambda (name) (cdr (assq name (nth 4 spec)
 			 (she-bang (let ((sheb (funcall get-spec :shebang)))
  (when (> (length sheb) 0) sheb)))
+ (lexicalp (org-babel-emacs-lisp-lexical
+(funcall get-spec :lexical)))
 			 (tangle-mode (funcall get-spec :tangle-mode)))
 		(unless (string-equal block-lang lang)
 			  (setq lang block-lang)
@@ -294,7 +296,10 @@ expression."
 		(when (and she-bang (not she-banged))
 			  (insert (concat she-bang "\n"))
 			  (setq she-banged t))
-		(org-babel-spec-to-string spec)
+(org-babel-spec-to-string spec)
+		(when (and lexicalp (not scoped))
+			  (save-excursion (elisp-enable-lexical-binding))
+			  (setq scoped t))
 		(setq block-counter (+ 1 block-counter
 		lspecs)
 		   (when make-dir
-- 
2.34.1



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

2023-06-13 Thread General discussions about Org-mode.
On Jun 13, 2023, at 20:02, Ihor Radchenko  wrote:
> 
> Ruijie Yu  writes:
> 
>> -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.
> 
> May you please rebase the patchset onto current master?
> I had problems applying the patchset on my side.

Will do this weekend.  Please note that I will no longer have much time during 
weekdays, and that I really want to have my employer disclaimer done before 
this should go in.  I’ll keep you updated when everything is ready on my end, 
thanks. 

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




[BUG] org-agenda-custom-commands with org-agenda-category-filter-preset not working [9.6.4 (release_9.6.4-9-g8eb209 @ /usr/local/share/emacs/29.0.90/lisp/org/)]

2023-06-06 Thread General discussions about Org-mode.


In every work related org-file, I set the category like this: 

#+CATEGORY: work

I then use org-agenda-custom-commands like those below to show work related 
content or not work related content. This works in Org version 9.5.5/Emacs 
28.2, but in Org version 9.6.4/Emacs 29.0.90, both custom-commands shows the 
content of every file, category "work" or not.

I posted this on Reddit, and according to a user it can be reproduced in the 
stable version, while it works fine in the development version.
My org-agenda-custom-commands settings looks like this: 
'(org-agenda-custom-commands   '(("p" "private"  ((agenda "" nil)   
(alltodo "" ((org-agenda-category-filter-preset   
'("-work")  nil) ("w" "Work"  ((agenda "" nil)   (alltodo 
""  ((org-agenda-category-filter-preset   
'("+work")  nil nil)))



[PATCH] org-manual: Mark up nil as ~nil~ [9.6.6 (release_9.6.6 @ /home/blc/.local/share/emacs/30.0.50/lisp/org/)]

2023-06-01 Thread General discussions about Org-mode.
In emacs.git I noticed some occurrences of 'nil' in the generated
doc/misc/org.texi were not marked up as @code.

Is this TRT?  (I already have an Emacs CA on file.)

>From 69ee9636fb2cd52efe8c11ca5877c83fb984a9ea Mon Sep 17 00:00:00 2001
From: "Basil L. Contovounesios" 
Date: Thu, 1 Jun 2023 22:19:28 +0100
Subject: [PATCH] doc/org-manual.org: Mark up nil as ~nil~

* doc/org-manual.org (Images, Plain lists in Texinfo export)
(Results of Evaluation): Mark up plain nil as ~nil~.
(Org Crypt): Ditto.  Clarify wording.
---
 doc/org-manual.org | 22 +++---
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/doc/org-manual.org b/doc/org-manual.org
index ab5c10c1d..537cd046f 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -11597,8 +11597,8 @@ command:
   =ORG-IMAGE-ACTUAL-WIDTH= property (subtree-level)[fn:: The width can
   be customized in Emacs >= 24.1, built with imagemagick support.].
   Their value can be the following:
-  - (default) Non-nil, use the actual width of images when inlining them.
-If the actual width is too wide, limit it according to
+  - (default) Non-~nil~, use the actual width of images when inlining
+them.  If the actual width is too wide, limit it according to
 ~org-image-max-width~.
   - When set to a number, use imagemagick (when available) to set the
 image's width to this value.
@@ -11608,7 +11608,7 @@ command:
 ,#+ATTR_HTML: :width 300px
 #+end_example
 and fall back on that number if none is found.
-  - When set to nil, try to get the width from an =#+ATTR.*= keyword
+  - When set to ~nil~, try to get the width from an =#+ATTR.*= keyword
 and fall back on the original width or ~org-image-max-width~ if
 none is found.
 
@@ -11618,8 +11618,8 @@ command:
   - (default) ~fill-column~, limit width to ~fill-column~ number of
 characters.
   - ~window~, limit width to current window width.
-  - integer number, limit width that specified number of pixels.
-  - nil, do not limit the width.
+  - integer number, limit width to that specified number of pixels.
+  - ~nil~, do not limit the width.
 
 #+vindex: org-cycle-inline-images-display
 Inline images can also be displayed when cycling the folding state.
@@ -15756,9 +15756,9 @@ This is the common text for variables foo and bar.
 
 The =:compact= attribute is an alternative to the =:sep= attribute,
 which allows writing each entry on its own line.  If this attribute is
-non-nil and an item in a description list has no body but is followed
-by another item, then the second item is transcoded to =@itemx=.  This
-example is transcoded to the same output as above.
+non-~nil~ and an item in a description list has no body but is
+followed by another item, then the second item is transcoded to
+=@itemx=.  This example is transcoded to the same output as above.
 
 #+begin_example
 ,#+ATTR_TEXINFO: :table-type vtable :indic asis :compact t
@@ -18666,7 +18666,7 @@ options; they are mutually exclusive.
   but no processing is performed on the return value.  Calling the
   code block programmatically (see [[*How to evaluate source code]]) or by
   reference (see [[*Passing arguments]] and [[*Noweb Reference Syntax]]) will
-  always yield nil.
+  always yield ~nil~.
 
 - =append= ::
 
@@ -20932,8 +20932,8 @@ specifying the respective key as property =CRYPTKEY=, e.g.:
   :END:
 #+end_example
 
-Note that =CRYPTKEY= property is only effective when ~org-crypt-key~
-is set to non-nil.  ~nil~ value of ~org-crypt-key~ makes Org use
+Note that the =CRYPTKEY= property is only effective when
+~org-crypt-key~ is non-~nil~.  If ~org-crypt-key~ is ~nil~, Org uses
 symmetric encryption unconditionally.
 
 Excluding the =crypt= tag from inheritance prevents already encrypted
-- 
2.34.1


This is one of my first times posting here, and I am not subscribed to
the mailing list, so please keep me CCed and let me know if anything is
amiss.

Thanks,

-- 
Basil

Emacs  : GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo 
version 1.16.0, Xaw3d scroll bars)
 of 2023-05-30
Package: Org mode version 9.6.6 (release_9.6.6 @ 
/home/blc/.local/share/emacs/30.0.50/lisp/org/)

current state:
==
(setq
 org-archive-location "/home/blc/.emacs.d/org/archive.org::"
 org-list-use-circular-motion t
 org-checkbox-hierarchical-statistics nil
 org-link-elisp-confirm-function 'yes-or-no-p
 org-hierarchical-todo-statistics nil
 org-agenda-category-icon-alist '(("" (space :width (16
 org-directory "/home/blc/.emacs.d/org/"
 org-global-properties '(("Effort_ALL" . "0 0:15 0:30 0:45 1:00 2:00 3:00"))
 org-agenda-scheduled-leaders '("" "%3dd -")
 org-log-done 'note
 org-log-into-drawer t
 org-agenda-timerange-leaders '("" "(%d/%d)")
 org-agenda-files "/home/blc/.emacs.d/org/agenda-index"
 org-persist-after-read-hook '(org-element--cache-persist-after-read)
 org-refile-targets '((org-agenda-files :maxlevel . 10))
 org-export-before-parsing-hook '(org-attach-expand-links)
 

Re: [FR] Please add environment variable substitution in `org-display-inline-images'

2023-05-28 Thread General discussions about Org-mode.


Pan Xie  writes:

> So my proposal of the code change would be (find "pxie" in the codes):

Thanks for proposing a change.  It would be best if you produced a patch
file from this :) But someone with a bit more free time could do that as
well.

This is just FYI, and by no means a big deal, but it would become a huge
burden for the maintainers to apply the proposed changes if the
changeset becomes larger.

For future reference, I'm talking about something like this (assuming
you have git and a shell supporting IO redirect):

$ git diff this-file.el > something.diff

, or even better:

$ git commit -m commit-message...
$ git format-patch ...

In either case, you would attach the generated file in your message.

See also https://orgmode.org/worg/org-contribute.html for details.

-- 
Best,


RY



Re: [PATCH] org-id: implement arbitrary cross-file references

2023-05-27 Thread General discussions about Org-mode.
Thanks for the patch.  Some in-line comments below.

Sergei Kosyrev  writes:

> From f712fa57a90c68d3d9066b10f49822ea0337b923 Mon Sep 17 00:00:00 2001
> From: Kosyrev Serge 
> Date: Thu, 25 May 2023 19:30:01 +0800
> Subject: [PATCH] org-id: implement arbitrary cross-file references
> 
> * Table formulae can now refer to data from tables in other files.
> 
> TINYCHANGE

First of all, I believe this is not within the scope of TINYCHANGE,
because as you see below, you added 58 lines and removed 11.  In this
case, the very first thing required before Org maintainers can consider
its inclusion is that you sign the FSF copyright assignment.  If you
need more details, Ihor or Bastien could probably elaborate and/or send
you the form.

> ---
>  etc/ORG-NEWS  | 10 +
>  lisp/org-id.el| 57 ++-
>  lisp/org-table.el |  2 +-
>  3 files changed, 58 insertions(+), 11 deletions(-)
> 
> diff --git a/lisp/org-id.el b/lisp/org-id.el
> index aa9610f16..2fcecbb50 100644
> --- a/lisp/org-id.el
> +++ b/lisp/org-id.el
> @@ -337,6 +337,40 @@ Move the cursor to that entry in that buffer."
>  (move-marker m nil)
>  (org-fold-show-context)))
>  
> +(defun org-id-parse-remote-table-ref (refstr)
> +  (let ((match (string-match "^file:\\([^:]+\\)\\(\\|:.+\\)$" refstr)))
> +(unless (null match)
> +  (let* ((m1 (match-string 1 refstr))
> + (m2 (match-string 2 refstr))
> + (filename (cl-remove-if (lambda (c) (member c '(40 41)))
> +  (org-table-formula-substitute-names m1)))
> + (table-name (org-table-formula-substitute-names m2)))
> +(list filename table-name)

First, do we need to wrap it with `save-match-data'?  In my personal
code I almost always do, but I need a second opinion on that.

Second, instead of the let-unless-null combination, you can just do this
instead:

(when-let ((match ...))
  (let* (...)
...))

And, if those values can't ever be nil, you could even combine the
entirety of the `let*' form into the `when-let' form (and turn it into a
`when-let*' form).

No comments on the rest, so I didn't quote them from my response to save
bandwidth.

-- 
Best,


RY



Re: It's possible, to translate the org-mode website into Spanish?

2023-05-11 Thread General discussions about Org-mode.


Antonio Simón  writes:

> Greetings from Spain.
>
> I'm a newbie in the FOSS world and a big fan of Emacs and org-mode in which 
> I'm taking my first steps.
>
> I have seen that the Org mode page is available in several languages, and 
> Spanish is not one of them.
>
> I was thinking of contributing my time to the project by developing the 
> Spanish version of the site, if you find it useful.
>
> If you accept this collaboration I would need a small list of the tools and 
> procedures to use, to ensure that I'm competent with them.
>
> Thank you for your patience, I look forward to hearing from you.
>
> Regards, 
>
> ___
> Antonio Simón (Quijote)

Hi Antonio,

Since your initial message in January, are you still interested in
contributing a new translation to orgweb?

Assuming you still are interested, you can take the skeleton of my
(which is, admittedly, stalled due to lack of time) translation on
zh-CN, and go from there.  If you don't know where it is, I'll dig up a
url for you.

The workflow I used for zh-CN translation was
(1): first make a single mega-copy+symlink commit
(2): translate the org files one-by-one

This way reviewers don't need to go back and forth between two files and
"diff with naked eyes".

You can also choose to start small and only translate the main site at
first -- in fact, no translations except mine covers all
(reasonably-sized) pages of orgweb.

I believe either Ihor or Bastien mentioned somewhere that you need to
finish the FSF copyright assignment for the translation work as well.
I don't know who to ask on orgmode ML, but someone should be able to get
you started if you express interest in the translation work.

In any case, let the list know if you encounter any problems -- someone
should be able to resolve them should any comes up.

-- 
Best,


RY



Re: refiling heading onto itself

2023-05-10 Thread General discussions about Org-mode.


Oliver Epper  writes:

> When choosing the very same heading that is going to be refiled as its target 
> the message buffer states success but the heading is gone. This is
> version 9.5.5 of org-mode with emacs 28.2
>
> -*- mode: org -*-
> * one
> * two
> * three
>
> Try refiling two and choose two as the target. Result when started with emacs 
> -Q is:
>
> * one
> * three
>
> no error message.
>
> greetings
> Oliver Epper

Reproducible in built-in Org from 28.2 ("Org mode version 9.5.5
(release_9.5.5 @ /opt/src/emacs/base/emacs-28.2/lisp/org/)").

Also reproducible in built-in Org from recent master ("Org mode version
9.6.5 (release_9.6.5-3-g2993f4 @ /usr/share/emacs/30.0.50/lisp/org/)").

Didn't test the main branch -- haven't pulled in a few days and it is
too late today.  HTH.

Two problems I found in a hurry: (1) refiling "two" into "two" make the
entire thing gone.  (2) the completiong system shouldn't even provide
"two" as a completion candidate.

-- 
Best,


RY



Re: [Pre-PATCH] Overhaul of the LaTeX preview system

2023-05-09 Thread General discussions about Org-mode.


Timothy  writes:

> Hi Ihor,
>
>>> As a result of this issue (plus other issues with xelatex), I’m
>>> considering adding an option to specify different LaTeX compilers for
>>> previews and exports, with the default option continuing to be
>>> the value of `org-latex-compiler’.
>>
>> I am not sure if it is a good idea.
>> I can easily see Lualatex-specific preamble simply failing to work on
>> Latex. Or things being rendered wrongly.
>>
>> One option could be trying pdflatex first and falling back to the
>> default compiler on failure. But only as non-default option.
>
> To be clear, the default will be “use the same preview compiler as document
> compiler”, but the hassles we’re currently experiencing with XeLaTeX/LuaLaTeX
> make us think it could be worth adding an override option.

Since we had been talking only about LuaLaTeX being slow, can we also
establish whether XeLaTeX is slow?  I don't think we have confirmed this
yet.  Thanks.

> All the best,
> Timothy


-- 
Best,


RY



Re: Help using org-entities or arternatives.

2023-05-09 Thread General discussions about Org-mode.


Ypo  writes:

> Hi
>
> Is it possible to, each time I write "" to be subsituted by "[...]" ?
>
> I can't do it using abbrev, and I don't know how to do it using org-entities.
>
> I use it to yank quotes, for example, I write:
>
>  "Like other editors, Emacs has commands to search for occurrences of a 
> string. There are also commands that do the same thing, but
>  search for patterns instead of fixed strings."
>
> And I would like to get, automatically:
>
>  "Like other editors, Emacs has commands to search for occurrences of a 
> string. [...] There are also commands that do the same thing, but
>  search for patterns instead of fixed strings."
>
> Best regards

Not necessarily Org-specific, but here's my idea, untested:

```emacs-lisp
(defun my/yank-subst-ellipses ()
  (interactive)
  (let* ((start (point-marker))
 (_ (insert (current-kill 0)))
 (end (point-marker)))
(save-match-data
  ;; Play around with this regexp
  (while (re-search-forward (rx "...") end t)
;; And this replacement text
(replace-match "[...]")
```

Then, since Org sets C-y as `org-yank', make an advice with it.  I am
not confident in this portion at all, but here goes nothing ;)

```emacs-lisp
(require 'cl-lib)
(advice-add
 #'org-yank :around
 (lambda (org-yank  arg)
   (cl-letf (((symbol-function 'yank)
  (symbol-function 'my/yank-subst/ellipses)))
 (funcall org-yank arg
```

-- 
Best,


RY



Re: An Org-mode-based blogging engine?

2023-05-08 Thread General discussions about Org-mode.
Hello Marcin,

I’m on mobile, so please excuse my brevity and top-posting.  Did you check the 
org website?  I remember from my orgweb translation that there is one 
particular page which outlines all the different tools that integrate org with 
blogging.  Maybe those will give you some inspirations. 

--
Best, 


RY

> On May 8, 2023, at 16:18, Marcin Borkowski  wrote:
> 
> Hello fellow Orgers,
> 
> I'm preparing to set up a new blog, and I'd like to have a fully
> Org-mode-based workflow.  Ideally, I'd like to be able to do everything
> - including publishing the posts - from within Emacs.
> 
> I know about things like "Org publish" and ox-hugo, though I never used
> them - and there are probably others - but I'm asking specifically about
> two things:
> 
> A. other people's experiences with similar workflows, and
> B. tool/workflow recommendations.
> 
> Here are my requirements, in no particular order.
> 
> 1. I want the blog to be fully static HTML+CSS, with a tiny sprinkling
> of (my custom) JS.
> 
> 2. I want to publish a whole set of HTML files from a single Org mode
> file.  I will need to preserve internal links (so that I can link to
> another headline and the result will be one post linking to another),
> and of course I will need external links.  The blog will live on some
> server I will have ssh access to, so for publishing it should be enough
> to scp some files somewhere.
> 
> 3. I want to be able to fully customize the HTML produced.  I want it to
> be as simple as possible (but see below).  I will also need it to be put
> in some kind of a template, so that every page will contain things like
> a header, footer and a sidebar.
> 
> 4. I am going, though, to need some custom "blocks" - in HTML parlance,
> s and possibly also s.  I want to be able to mark them up
> somehow in my Org source and get  and  class="...">.  Reusing existing markup (like _underline_, which I'm not
> going to use) is not enough - I will need more than a dozen of those
> custom classes.
> 
> Any thought, suggestions, recommendations?
> 
> -- 
> Marcin Borkowski
> http://mbork.pl
> 




Re: org mode to github markdown

2023-05-07 Thread General discussions about Org-mode.


Uwe Brauer  writes:

> There seems no export backend for (github) markdown

I think you are looking for "ox-gfm".

I can find it via [search engine] and on melpa.

-- 
Best,


RY



Re: [PATCH] Add tests for ob-haskell (GHCi)

2023-05-07 Thread General discussions about Org-mode.
Minor remarks below regarding the patchset.

Bruno Barbier  writes:

> From 9ef867cd2cf89e77b5c5a5a7090fd37b1702e06a Mon Sep 17 00:00:00 2001
> From: Bruno BARBIER 
> Date: Fri, 18 Nov 2022 20:14:20 +0100
> Subject: [PATCH 01/13] ob-haskell: Add tests for GHCi
>
> testing/lisp/test-ob-haskell-ghci.el: New file.
> ---
>  testing/lisp/test-ob-haskell-ghci.el | 453 +++
>  1 file changed, 453 insertions(+)
>  create mode 100644 testing/lisp/test-ob-haskell-ghci.el
>
> diff --git a/testing/lisp/test-ob-haskell-ghci.el 
> b/testing/lisp/test-ob-haskell-ghci.el
> new file mode 100644
> index 0..aba94d73f
> --- /dev/null
> +++ b/testing/lisp/test-ob-haskell-ghci.el
> @@ -0,0 +1,453 @@
> +;;; test-ob-haskell-ghci.el --- tests for ob-haskell.el GHCi  -*- 
> lexical-binding: t; -*-
> +
> +;; Copyright (c) 2023  Free Software Foundation, Inc.

lisp/org.el has only a single space, so probably single space here as well.

> +
> +;; Authors: Bruno BARBIER 
> +
> +;; This program is free software; you can redistribute it and/or modify
> +;; it under the terms of the GNU General Public License as published by
> +;; the Free Software Foundation, either version 3 of the License, or
> +;; (at your option) any later version.

Do we need the text for "part of GNU Emacs"?

> +
> +;; This program is distributed in the hope that it will be useful,
> +;; but WITHOUT ANY WARRANTY; without even the implied warranty of
> +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +;; GNU General Public License for more details.
> +
> +;; You should have received a copy of the GNU General Public License
> +;; along with this program.  If not, see .
> +
> +;;; Commentary:
> +;;
> +
> + Useful references
> +;;
> +;;  - https://orgmode.org/worg/org-contrib/babel/languages/lang-compat.html
> +;;  - GHCi manual: 
> https://downloads.haskell.org/ghc/latest/docs/users_guide/ghci.html
> + FIXME: Random failures
> +;;
> +;; To increase the chances of failure when running tests, you can use this 
> command line:
> +;;
> +;;(for I in 0 1 2 3 4 5 6 7 8 9 10 0 1 2 3 4 5 6 7 8 9 10 0 1 2 3 4 5 6 
> 7 8 9 10; do make 'BTEST_OB_LANGUAGES=haskell' BTEST_RE='haskell' test-dirty 
> & done) 2>&1 | grep FAILED
> +;;

Wanted to say something here, but then realized that you deleted this
portion in a later commit.

> +
> + Status
> +;;
> +;; All the tests should succeed (except for random failures); those
> +;; flagged with ":expected-result :failed" are known
> +;; limitations/bugs.  Tested with (2023-03-18):
> +;;
> +;; | emacs-version |  29.0.60 |
> +;; | org-version   | main@4cad6c8ea (Mar 16 2023) |
> +;; | haskell-mode  | master@20d4e23 (Mar 4  2023) |
> +;; | ghci  |9.0.2 |
> +
> +
> +;;; Code:
> +;;
> +
> +(require 'org-test "../testing/org-test")
> +(org-test-for-executable "ghci")
> +(unless (featurep 'haskell-mode)
> +  (signal 'missing-test-dependency "haskell-mode"))
> +
> +
> +;;; Helpers
> +;;
> +
> +(defun test-ob-haskell-ghci--with-global-session-worker (todo)
> +  "See `test-ob-haskell-ghci--with-global-session-worker'."

This docstring doesn't say much and only refers to itself.  Maybe
explain what it does?  (Or now that I look at it, potentially you wanted
to refer to the macro `test-ob-haskell-ghci-with-global-session'
instead.)

> +(defun test-ob-haskell-ghci (args content  preamble unprotected)
> +  "Execute the code block CONTENT in a new GHCi session; return the result.
> +Add ARGS to the code block argument line.  Insert PREAMBLE
> +before the code block.  When UNPROTECTED is non-nil, don't control
> +which session is used (i.e. don't call
> +`test-ob-haskell-ghci--with-global-session-worker')."
> +  (when (listp content)
> +(setq content (string-join content "\n")))
> +  (unless preamble
> +(setq preamble ""))
> +  (let ((todo  (lambda ()

One space.

> + Data tables
> +;;
> +
> +(ert-deftest ob-haskell/int-table-data ()
> +  "From worg: int-table-data."
> +  (should (equal 10 (test-ob-haskell-ghci ":var t=int-table-data"
> +  "sum [sum r | r <- t]"
> +  "#+name: int-table-data
> +| 1 | 2 |
> +| 3 | 4 |"
> +
> +(ert-deftest ob-haskell/float-table-data ()
> +  "From worg: float-table-data."
> +  (should (equal 11.0 (test-ob-haskell-ghci ":var t=float-table-data"
> +"sum [sum r | r <- t]"
> +"#+name: float-table-data
> +| 1.1 | 2.2 |
> +| 3.3 | 4.4 |"
> +
> +(ert-deftest ob-haskell/string-table-data ()
> +  "From worg: string-table-data."
> +  (should (equal "abcd" (test-ob-haskell-ghci ":var t=string-table-data"
> +  "concat [concat r | r <- t]"
> +  "#+name: string-table-data
> +| a | b |

Re: [ANN] lisp/ob-tangle-sync.el

2023-05-02 Thread General discussions about Org-mode.


Mehmet Tekman  writes:

> Hello again, sorry for the delay - I had some holiday time off
> that couldn't wait ;-)
>
> I've modified the ob-tangle.el file for the main tangling and
> detangling functions.  Most importantly, both functions can now
> exchange information from the source Org mode file to the target
> remote tangle file in either direction, depending on whether the
> source Org file has `:tangle-sync ' in the header.
>
> The action is one of:
>
> - "export" = always transmit information from the source Org mode
>  block to the target remote file.
> - "import" = always transmit information from the target remote
>  file to the source Org mode block.
> - "skip" = skip the block.
> - "both" = transmit information from source block to target block
>or target block to source, depending on whether the
>tangle or detangle is called from the source buffer or
>the target buffer respectively.
>
> These functions work at the whole buffer and at the per-block
> level.  The `org-babel-tangle-sync' functions automate this
> process by hooking into the `after-save-hook' and tangling /
> detangling the current block.
>
> I feel that I should write what the main motivation for this is:
> Dotfiles that are always in sync with the org-mode files they
> stem from.
>
> Hope this turns into something big!
> Best,
>
> Mehmet
>
> [4. application/x-patch; 
> 0005-lisp-ob-tangle-sync.el-Automatic-synchronization-of-.patch]...
>
> [5. application/x-patch; 
> 0004-lisp-ob-tangle.el-Sync-aware-tangle-function-with-be.patch]...
>
> [6. application/x-patch; 
> 0002-lisp-ob-tangle.el-Sync-action-aware-detangle-functio.patch]...
>
> [7. application/x-patch; 
> 0003-lisp-ob-tangle.el-Tangle-function-made-aware-of-remo.patch]...
>
> [8. application/x-patch; 
> 0001-lisp-ob-tangle.el-Detangle-a-single-block.patch]...
>
> [9. application/x-patch; 
> 0006-etc-ORG-NEWS-lisp-ob-tangle.el-Added-news-and-name.patch]...

I noticed that you modified argument order of a public function
`org-babel-detangle' -- is it possible that you retain the order of
arguments?

The accumulated change you proposed is this:

-(defun org-babel-detangle ( source-code-file)
+(defun org-babel-detangle ( arg source-code-file ignore-header)

What I think it should be:

(defun org-babel-detangle ( source-code-file arg ignore-header) 
...)

This way, existing (external) users of this function can rest assured
that their code is not broken by your patchset.  Thoughts?

-- 
Best,


RY

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



Re: [Need Help] Error to evaluate "mpv" command in inline src block

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


stardiviner  writes:

> I have example Org file like bellowing.
>
> Here is the testing Org content:
>
> #+begin_src org
> ,* 《枕刀歌》
> :PROPERTIES:
> :DATE: [2021-05-13 Thu 20:09]
> :Douban:   https://movie.douban.com/subject/35350794/
> :DIR:  枕刀歌
> :EVAL: src_sh{mpv "枕刀歌/《枕刀歌》SE05 江海阔 歌谣哼唱.mp4"}
> :END:
> #+end_src
>
> When I press Tab key to expand upper headline. I check the inline src block 
> session buffer, here is the output:
>
> #+begin_example
> bash-5.2$ bash-5.2$ PROMPT_COMMAND=;PS1="org_babel_sh_prompt> ";PS2=
> org_babel_sh_prompt> echo 
> 'ob_comint_async_shell_start_d1cc7563-be0c-4ed0-a4c2-d1b545333983'
> mpv "枕刀歌/《枕刀歌》SE05 江海阔 歌谣哼唱.mp4"
> echo 'ob_comint_async_shell_end_d1cc7563-be0c-4ed0-a4c2-d1b545333983'
> ob_comint_async_shell_start_d1cc7563-be0c-4ed0-a4c2-d1b545333983
> org_babel_sh_prompt> =[input] No key binding found for key 'c'.
> [input] No key binding found for key 'h'.
> [input] No key binding found for key '''.
> [input] No key binding found for key 'b'.
> [input] No key binding found for key 'c'.
> [input] No key binding found for key 'n'.
> [input] No key binding found for key 'a'.
> [input] No key binding found for key 'y'.
> [input] No key binding found for key 'n'.
> [input] No key binding found for key 'c'.
> [input] No key binding found for key 'h'.
> [input] No key binding found for key 'n'.
> [input] No key binding found for key 'c'.
> [input] No key binding found for key 'c'.
> [input] No key binding found for key '-'.
> [input] No key binding found for key 'b'.
> [input] No key binding found for key 'c'.
> [input] No key binding found for key '-'.
> [input] No key binding found for key '-'.
> [input] No key binding found for key 'a'.
> [input] No key binding found for key 'c'.
> [input] No key binding found for key '-'.
> [input] No key binding found for key 'b'.
> [input] No key binding found for key '''.
>
> Resuming playback. This behavior can be disabled with --no-resume-playback.
>
>  Video --vid=1 (*) (h264 1920x1080 25.000fps)
>  (+) Audio --aid=1 (*) (aac 2ch 48000Hz)
> AO: [coreaudio] 48000Hz stereo 2ch floatp
> Mute: yes
>
>   C-c C-c>
> Saving state.
>
> Exiting... (Quit)
> org_babel_sh_prompt> echo $SHELL 
> /bin/zsh
> org_babel_sh_prompt> 
> #+end_example
>
> Then I try to replace the "mpv" shell command with another command without 
> need to invoke desktop GUI. Like bellowing Org content:
>
> #+begin_src org
> ,* 《枕刀歌》
> :PROPERTIES:
> :DATE: [2021-05-13 Thu 20:09]
> :Douban:   https://movie.douban.com/subject/35350794/
> :DIR:  枕刀歌
> :EVAL: src_sh{sleep 10; echo "done"}
> :END:
> #+end_src
>
> It evaluated fine.

Try putting "cat" there.  I suspect something is fed into the stdin of
the process.

-- 
Best,


RY

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



Re: [ANN] lisp/ob-tangle-sync.el

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


Mehmet Tekman  writes:

> Ruijie Yu   writes:
>
>> Great idea!  Some inline comments below.
>>
>> You only need to say #'expand-file-name instead of the quoted lambda.
>> Also, you need to set the variable, otherwise the variable
>> `org-babel-tangle-sync-files' is undefined.
>>
>> What I have in mind is this:
>>:set (lambda (var val) (set var (mapcar #'expand-file-name val)))
>>
>> Here you don't have to use `progn' because it is implied from 
>> `save-excursion'.
>>
>
> Thanks! I've made your changes, and I've also incorporated John
> Wiegley's comments about using "import" instead of "pull" as a
> tangle-sync action word (small diff attached).
>
> I've also written up my changes in the ~etc/ORG-NEWS~ and
> targeted my custom variable for the 9.7 release (diff attached).

Thanks.  Can you make a full patch from the current main branch to your
changes, with a commit message and so on?  This would help reviewers to
look at the full picture of what are modified.  Take a look at the
manpage git-format-patch(1) if you aren't sure how to do it.

For the commit message, take a look at
https://orgmode.org/worg/org-contribute.html#commit-messages for
inspirations.

>> Is there possibility to have a local minor mode (without introducing too
>> much code changes)?
>
> I initially tried it this way, but the problem is that an org
> source block buffer might be in sync-mode, but it's
> corresponding tangle file might not be, making any changes
> asymmetric.
>
> Another issue is in order to see the changes in the tangled file,
> the tangle buffer needs to be reverted (with user prompt) which
> then switches off the sync-mode for that buffer on reload.
>
> One way around this (and it's something I implemented 3 years ago in
> my messy org-tanglesync[0] MELPA code) is to set an explicit list of
> "sync files", and then for Emacs to parse every =:tangle= header in a
> given file when loaded (via =org-src-mode-hook=) to create an alist of
> config files and their associated tangled files[1], such as
> =((file1.conf . (tanglefile1.txt tanglefile2.txt etc)))=. Then, for
> example, when ~tanglefile1.txt~ is loaded, Emacs knows that it should
> load the sync-mode too.
>
> This approach works reasonably well when the "sync files" list is
> mandatory, but it's also prone to errors if a sync file is edited and
> the alist of config files isn't updated, and the user would also lose
> the flexibility of having ~ob-tangle-sync~ function everywhere.
>
> I think a global minor mode is really elegant in this regard and I
> wish I knew about it 3 years ago!

Thanks for explaining this.  Yes, this sounds like a lot of work with
probably insufficient audience, so I'd wait for more use cases to come
up before thinking about local minor modes.

-- 
Best,


RY

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



Re: [ANN] lisp/ob-tangle-sync.el

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


Mehmet Tekman  writes:

> Dear fellow org-users,
>
> I would like to contribute some a new library into org-mode, which
> performs automatic synchronization between tangled files and their
> org-mode source blocks via a global minor mode
> `org-babel-tangle-sync-mode' which uses the after-save-hook.

Great idea!  Some inline comments below.

> diff --git a/lisp/ob-tangle-sync.el b/lisp/ob-tangle-sync.el
> new file mode 100644
> index 0..61c23f647
> --- /dev/null
> +++ b/lisp/ob-tangle-sync.el
> @@ -0,0 +1,172 @@
> +;;; ob-tangle-sync.el --- Synchronize Source Code and Org Files -*- 
> lexical-binding: t; -*-
> +
> +;; Copyright (C) 2009-2023 Free Software Foundation, Inc.
> +
> +;; Author: Mehmet Tekman
> +;; Keywords: literate programming, reproducible research
> +;; URL: https://orgmode.org
> +
> +;; This file is part of GNU Emacs.
> +
> +;; GNU Emacs is free software: you can redistribute it and/or modify
> +;; it under the terms of the GNU General Public License as published by
> +;; the Free Software Foundation, either version 3 of the License, or
> +;; (at your option) any later version.
> +
> +;; GNU Emacs is distributed in the hope that it will be useful,
> +;; but WITHOUT ANY WARRANTY; without even the implied warranty of
> +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +;; GNU General Public License for more details.
> +
> +;; You should have received a copy of the GNU General Public License
> +;; along with GNU Emacs.  If not, see .
> +
> +;;; Commentary:
> +
> +;; Synchronize the code between source blocks and raw source-code files.
> +
> +;;; Code:
> +
> +(require 'org-macs)
> +(org-assert-version)
> +
> +(require 'ol)
> +(require 'org)
> +(require 'org-element)
> +(require 'ob-core)
> +
> +(defgroup org-babel-tangle-sync nil
> +  "Options for synchronizing source code and code blocks."
> +  :tag "Org Babel Tangle sync"
> +  :group 'org-babel-tangle)
> +
> +;;;###autoload
> +(define-minor-mode org-babel-tangle-sync-mode
> +  "Global minor mode that synchronizes tangled files after every save."
> +  :global t

Is there possibility to have a local minor mode (without introducing too
much code changes)?

> +  :interactive t

I believe interactive is the default?

> +  :lighter " o-ts"
> +  (if org-babel-tangle-sync-mode
> +  (add-hook 'after-save-hook 'org-babel-tangle-sync-synchronize nil t)
> +(remove-hook 'after-save-hook 'org-babel-tangle-sync-synchronize t)))
> +
> +(defcustom org-babel-tangle-sync-files nil
> +  "A list of `org-mode' files.
> +When `org-babel-tangle-sync-mode' is enabled only files listed
> +here are subject to the org-babel-tangle-sync treatment.  If nil,
> +then all org files with tangle headers are considered."
> +  :group 'org-babel-tangle-sync
> +  :type 'list
> +  :package-version '(Org . "9.6.5")
> +  :set (lambda (_var val) (mapcar #'(lambda (x) (expand-file-name x)) val)))

You only need to say #'expand-file-name instead of the quoted lambda.
Also, you need to set the variable, otherwise the variable
`org-babel-tangle-sync-files' is undefined.

What I have in mind is this:
:set (lambda (var val) (set var (mapcar #'expand-file-name val)))

> +
> +
> +(defun org-babel-tangle-sync--babel-tangle-jump (link block-name)
> +  "Jump from a tangled file to the Org file without returning anything.
> +The location of the code block in the Org file is given by a
> +combination of the LINK filename and header, followed by the
> +BLOCK-NAME Org mode source block number.  The code is borrowed
> +heavily from `org-babel-tangle-jump-to-org'"
> +  ;; Go to the beginning of the relative block in Org file.
> +  ;; Explicitly allow fuzzy search even if user customized
> +  ;; otherwise.
> +  (let (org-link-search-must-match-exact-headline)
> +(org-link-open-from-string link))
> +  ;;(setq target-buffer (current-buffer))
> +  (if (string-match "[^ \t\n\r]:\\([[:digit:]]+\\)" block-name)
> +  (let ((n (string-to-number (match-string 1 block-name
> + (if (org-before-first-heading-p) (goto-char (point-min))
> +   (org-back-to-heading t))
> + ;; Do not skip the first block if it begins at point min.
> + (cond ((or (org-at-heading-p)
> +(not (eq (org-element-type (org-element-at-point))
> + 'src-block)))
> +(org-babel-next-src-block n))
> +   ((= n 1))
> +   (t (org-babel-next-src-block (1- n)
> +(org-babel-goto-named-src-block block-name))
> +  (goto-char (org-babel-where-is-src-block-head))
> +  (forward-line 1))
> +
> +;;;###autoload
> +(defun org-babel-tangle-sync-synchronize ()
> +  "Synchronize a tangled code block to its source-specific file, or vice 
> versa.
> +If the cursor is either within the source file or in destination
> +tangled file, perform a desired tangling action.  The tangling
> +action by default is to detangle the tangled files' changes back
> +to its source block, or to tangle the source 

Re: "Indent headline data" is indenting non-headline-data

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


"\"James Harkins\" "  writes:

> I just discovered a strange auto-indentation behavior. Org 9.5.2.
>
> I'm currently using org to draft a paper.
>
> I have set org-adapt-indentation to "adapt indentation for headline data 
> lines."
>
> Now I have (just stealing some body text):
>
> ```
> * Headline
>
> When this variable is set to ‘headline-data’, Org only adapts the
> indentation of the data lines right below the headline, such as
> planning/clock lines and property/logbook drawers.
> ```
>
> If I position the cursor at the end of this paragraph, after "drawers.", and 
> I hit return twice to start a new paragraph, org does not indent (as I 
> expect).
>
> If I position the cursor in the middle of the paragraph and hit return twice 
> to break the paragraph into two, upon the second return, org *does* indent by 
> two spaces.
>
> Uh. What?
>
> Perhaps I'm misunderstanding what is the definition of "headline data lines," 
> but this looks to me like it's body text. Why is it being indented?
>
> hjh

Reproducible in built-in Org (9.5.5 release) from Emacs 28.2, but
unreproducible in latest Org main branch (release_9.6.4-329-g466a37).
So, assuming that this indeed is a bug, it has been fixed, but the fix
is not present in your version.  Maybe you can try to install Org from
elpa and see if that helps?

-- 
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-25 Thread General discussions about Org-mode.


Ihor Radchenko  writes:

> Ruijie Yu  writes:
>
>>> 1. `setopt' already triggers loading when variable is set. It is just
>>>`setq', often used in place of `setopt', that does not trigger
>>>loading/unloading.
>>
>> Speaking of which, since we now (or are about to?) depend on compat, we
>> can just do (require 'compat) and forget that `setopt' is an Emacs 29
>> addition.
>
> No. Compat does not support and does not plan to support `setopt' (see
> https://elpa.gnu.org/packages/doc/compat.html#Limitations).
> And it is not us who needs to use `setopt', but users.
> We just have to deal with de facto situation with users using `setq'
> mindlessly.

Makes sense.  So, does that mean nothing should be changed, except for
maybe some additions to documentation mentioning that the users should
avoid using `setq' to set customizable variables, and instead use
`setopt' if >= 29, or [some function in cus-edit.el which I don't
recall] otherwise?

-- 
Best,


RY

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



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

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

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

> Ihor Radchenko  writes:
>
>> (let ((org-time-stamp-formats '("%Y-%m-%d" . "%Y-%m-%d %H:%M")))
>>  (org-element-timestamp-interpreter timestamp nil))
>
> Thanks for the pointer.  I have made this into a macro and redid my
> changes accordingly.  Please also let me know if more work should be
> dedicated to avoid code duplication in tests (I see a lot of duplication
> in the portions I touched in testing/lisp/test-org.el).
>
> What currently still fails unexpectedly:
>
> zh_CN.UTF-8:
> test-org-clock/clocktable/lang
> - This test only fails in batch mode, as I mentioned up-thread.  I
>   might try to convert this into a test that expects failure
>   depending on whether Emacs is in batch mode.
> test-org-colview/columns-width
> - This patch did not attempt to fix it.  I posted a diff file under
>   v2 (not included in this patch), but that didn't work either.
>
> ja_JA.UTF-8:
> test-org-colview/columns-width
> - See above.
>
> fr_FR.UTF-8:
> test-org-clok/org-clock-timestamps-change
> - This is tracked in the other thread I created, and won't be fixed
>   by this patch.
>
> en_US.UTF-8 and de_DE.UTF-8:
> No unexpected test failures.
>
> [2. text/x-patch; 
> 0001-DRAFT-Fix-dependence-on-locale-in-org-testing-facili.patch]...
>
>
> To summarize, the remaining goal of this patchset is to fix
> `test-org-colview/columns-width', and to optionally expect-failure on
> `test-org-clock/clocktable/lang'.

Iteration v6.  Everything, other than the French test and the
batch-non-batch Chinese test, now passes.  I'll look up how to determine
whether we are in batch mode or not, and slap that onto the expect tag
for `test-org-clock/clocktable/lang'.  And the French test belongs to
its own thread, so I won't try to fix it here.

V6 has two commits: the first commit is the *exact copy* of v5, and the
second commit tries to fix the zh_CN columns-width code & test.  Hence I
only attach the patch file for the second commit.

>From 59cbb93b9fc221bdc8ee708b05943a245c41ad25 Mon Sep 17 00:00:00 2001
From: Ruijie Yu 
Date: Tue, 25 Apr 2023 22:56:02 +0800
Subject: [PATCH 2/2] Let org-columns correctly detect string-widths in code

TODO: maybe I should also make a test directly on
`org-columns-add-ellipses'.  Will do in next iteration unless
objections.

* lisp/org-colview.el (org-columns--truncate-below-width): add a
helper function that will trim off just enough data from string to
fit into expected width.
(org-columns-add-ellipses): make sure to do truncation correctly
even in CJK locales (where an ellipsis character takes two
spaces).

* testing/lisp/test-org-colview.el
(test-org-colview/substring-below-width): add test to make sure
helper function is correct.
(test-org-colview/columns-width): fix incorrect expectations for
CJK locales about ellipses.
---
 lisp/org-colview.el  | 26 +-
 testing/lisp/test-org-colview.el | 19 ++-
 2 files changed, 39 insertions(+), 6 deletions(-)

diff --git a/lisp/org-colview.el b/lisp/org-colview.el
index 92a3b473d..6311a9274 100644
--- a/lisp/org-colview.el
+++ b/lisp/org-colview.el
@@ -452,14 +452,30 @@ DATELINE is non-nil when the face used should be
 	"Type \\`\\[org-columns-edit-value]' \
 to edit property")))
 
+(defun org-columns--truncate-below-width (string width)
+  "Return a substring of STRING no wider than WIDTH.
+This substring must start at 0, and must be the longest possible
+substring whose `string-width' does not exceed WIDTH."
+  (declare (side-effect-free t))
+  (let ((end (min width (length string))) res)
+(while (and end (>= end 0))
+  (let* ((curr (string-width string 0 end))
+ (excess (- curr width)))
+(if (> excess 0)
+(cl-decf end (max 1 (/ excess 2)))
+  (setq res (substring string 0 end) end nil
+res))
+
 (defun org-columns-add-ellipses (string width)
   "Truncate STRING with WIDTH characters, with ellipses."
   (cond
-   ((<= (length string) width) string)
-   ((<= width (length org-columns-ellipses))
-(substring org-columns-ellipses 0 width))
-   (t (concat (substring string 0 (- width (length org-columns-ellipses)))
-	  org-columns-ellipses
+   ((<= (string-width string) width) string)
+   ((<= width (string-width org-columns-ellipses))
+(org-columns--truncate-below-width org-columns-ellipses width))
+   (t (concat
+   (org-columns--truncate-below-width
+string (- width (string-width org-columns-ellipses)))
+   org-columns-ellipses
 
 (defvar org-columns-full-header-line-format nil
   "The full header line format, will be shifted by horizontal scrolling." )
diff --git a/t

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

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


Ihor Radchenko  writes:

>> +(defun org-columns--substring-below-width (string start width)
>> +  "Similar to `substring', but use `string-width' to check width.
>
> This is not really similar to `substring' as `substring' has totally
> different third argument.

Addressed in v6 -- see my update in the other subthread.

>> +The returned value is a substring of STRING, starting at START,
>> +and is the largest possible substring whose width does not exceed
>> +WIDTH."
>> +  (let ((end (min (+ start width) (length string))) res)
>> +(while (and end (>= end start))
>> +  (let* ((curr (string-width string start end))
>> + (excess (- curr width)))
>> +(if (cl-plusp excess)
>
> Why not simply (> excess 0)? `cl-plusp' is a bit confusing - we
> generally avoid cl-lib functions unless necessary. (I've never seen
> `cl-plusp' used frequently)

Well, one of the courses I took last year used Common Lisp, where plusp
and minusp were largely preferred over (> x 0), hence the habit.  I have
switched over accordingly in v6.

>>  (defun org-columns-add-ellipses (string width)
>>"Truncate STRING with WIDTH characters, with ellipses."
>>(cond
>> -   ((<= (length string) width) string)
>> -   ((<= width (length org-columns-ellipses))
>> -(substring org-columns-ellipses 0 width))
>> -   (t (concat (substring string 0 (- width (length org-columns-ellipses)))
>> -  org-columns-ellipses
>> +   ((<= (string-width string) width) string)
>> +   ((<= width (string-width org-columns-ellipses))
>> +(org-columns--substring-below-width org-columns-ellipses 0 width))
>> +   (t (concat
>> +   (org-columns--substring-below-width
>> +string 0 (- width (length org-columns-ellipses)))
>> +   org-columns-ellipses
>
> It will be best to write dedicated tests here that will clearly indicate
> issues when some non-standard LANG environment is used. The current
> failure is rather difficult to debug.

Done -- somewhat.  At the time I wrote the tests I misunderstood what
you said, so now we have a test on org-columns--truncate-below-width
(renamed from org-columns--substring-below-width).  I can add a test on
org-columns-add-ellipses as well, if you think it is necessary.  But
probably tomorrow.

-- 
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-25 Thread General discussions about Org-mode.


Ihor Radchenko  writes:

> lin Sun  writes:
>
>> Thanks for the comment.
>> If we switch to the `add-variable-watcher', it seems we'll load the
>> ob-LANG in the callback immediately.
>> The previous change can lazyly load the babel languages until the user
>> tries to evaluate the source block.
>
> Is there any advantage doing the loading lazily?
> I can only see disadvantages:
>
> 1. `setopt' already triggers loading when variable is set. It is just
>`setq', often used in place of `setopt', that does not trigger
>loading/unloading.

Speaking of which, since we now (or are about to?) depend on compat, we
can just do (require 'compat) and forget that `setopt' is an Emacs 29
addition.

-- 
Best,


RY

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



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

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

Ihor Radchenko  writes:

> (let ((org-time-stamp-formats '("%Y-%m-%d" . "%Y-%m-%d %H:%M")))
>  (org-element-timestamp-interpreter timestamp nil))

Thanks for the pointer.  I have made this into a macro and redid my
changes accordingly.  Please also let me know if more work should be
dedicated to avoid code duplication in tests (I see a lot of duplication
in the portions I touched in testing/lisp/test-org.el).

What currently still fails unexpectedly:

zh_CN.UTF-8:
test-org-clock/clocktable/lang
- This test only fails in batch mode, as I mentioned up-thread.  I
  might try to convert this into a test that expects failure
  depending on whether Emacs is in batch mode.
test-org-colview/columns-width
- This patch did not attempt to fix it.  I posted a diff file under
  v2 (not included in this patch), but that didn't work either.

ja_JA.UTF-8:
test-org-colview/columns-width
- See above.

fr_FR.UTF-8:
test-org-clok/org-clock-timestamps-change
- This is tracked in the other thread I created, and won't be fixed
  by this patch.

en_US.UTF-8 and de_DE.UTF-8:
No unexpected test failures.

>From d17e33802b0e53af131a2ab3f44d9ee3ecfb2a59 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-clock/clock-drawer-dwim): make use of the pre-generated
DoW names in the testing to remove assumptions on LANG=C.
(test-org-clock/org-clock-timestamps-change): renamed from
test-org-clok/org-clock-timestamps-change; used DoW pre-generated
names.

* testing/lisp/test-org.el (org-test-with-result):
(org-test-without-dow): add two macros to combat the 40-time
repetition of "do not add day-of-week, do something, and return
buffer string".
(test-org/clone-with-time-shift): (test-org/add-planning-info):
(test-org/deadline): (test-org/schedule): rewrite the
day-of-week-removal portion to avoid generating day-of-week names
altogether, using the new macro `org-test-without-dow'.
---
 testing/lisp/test-org-clock.el |  64 ++---
 testing/lisp/test-org.el   | 415 +++--
 testing/org-test.el|  25 ++
 3 files changed, 250 insertions(+), 254 deletions(-)

diff --git a/testing/lisp/test-org-clock.el b/testing/lisp/test-org-clock.el
index 7d8123e1f..d4beb76e0 100644
--- a/testing/lisp/test-org-clock.el
+++ b/testing/lisp/test-org-clock.el
@@ -89,29 +89,34 @@ the buffer."
 ;; Remove clocktable.
 (delete-region (point) (search-forward "#+END:\n"
 
-(ert-deftest test-org-clok/org-clock-timestamps-change ()
+(ert-deftest test-org-clock/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 

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

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

Ihor Radchenko  writes:

> Ruijie Yu  writes:
>
>>> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=63029
>>
>> From my understanding of Eli's response, org-colview is at fault here, by
>> calling `length' instead of `string-width' in
>> `org-columns-add-ellipses'.  Changing this function call might be all it
>> needs to fix the colview test failure?
>
> This is tricky because string width may be different depending on
> in-buffer settings, fonts used, etc.
>
> We can try to be a tiny little bit more accurate using
> `truncate-string-to-width', `string-width', or `org-string-width'.

Just had a try at this, fully untested code (other than starting a
LANG=zh_CN.UTF-8 Emacs session and running this substring function to
see its effects).  It is a bit too late for me now, so I'll call it a
day (literally) for coding today.

diff --git a/lisp/org-colview.el b/lisp/org-colview.el
index 92a3b473d..e8106f9cd 100644
--- a/lisp/org-colview.el
+++ b/lisp/org-colview.el
@@ -452,14 +452,30 @@ DATELINE is non-nil when the face used should be
 	"Type \\`\\[org-columns-edit-value]' \
 to edit property")))
 
+(defun org-columns--substring-below-width (string start width)
+  "Similar to `substring', but use `string-width' to check width.
+The returned value is a substring of STRING, starting at START,
+and is the largest possible substring whose width does not exceed
+WIDTH."
+  (let ((end (min (+ start width) (length string))) res)
+(while (and end (>= end start))
+  (let* ((curr (string-width string start end))
+ (excess (- curr width)))
+(if (cl-plusp excess)
+(cl-decf end (max 1 (/ excess 2)))
+  (setq res (substring string start end) end nil
+res))
+
 (defun org-columns-add-ellipses (string width)
   "Truncate STRING with WIDTH characters, with ellipses."
   (cond
-   ((<= (length string) width) string)
-   ((<= width (length org-columns-ellipses))
-(substring org-columns-ellipses 0 width))
-   (t (concat (substring string 0 (- width (length org-columns-ellipses)))
-	  org-columns-ellipses
+   ((<= (string-width string) width) string)
+   ((<= width (string-width org-columns-ellipses))
+(org-columns--substring-below-width org-columns-ellipses 0 width))
+   (t (concat
+   (org-columns--substring-below-width
+string 0 (- width (length org-columns-ellipses)))
+   org-columns-ellipses
 
 (defvar org-columns-full-header-line-format nil
   "The full header line format, will be shifted by horizontal scrolling." )

-- 
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-23 Thread General discussions about Org-mode.


Ihor Radchenko  writes:

> Ruijie Yu  writes:
>
 (format "%-5.5s |" "1234…")

 returns different results for different locales, causing
 `test-org-colview/columns-width' to break.
>>>
>>> What are these different results?
>>
>> In CJK locales such as zh_CN and ja_JA, the ellipsis character is
>> truncated, and replaced by a space.
>>
>> I reported to Emacs devs a few minutes ago because I wanted to
>> understand how `format' decide the ellipsis is a two-unit wide character
>> in CJK locales.  I also wasn't sure if that is an Emacs bug or an Org
>> one, and their response would help a lot.
>
> For future reference:
> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=63029

>From my understanding of Eli's response, org-colview is at fault here, by
calling `length' instead of `string-width' in
`org-columns-add-ellipses'.  Changing this function call might be all it
needs to fix the colview test failure?

-- 
Best,


RY

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



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

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


Ihor Radchenko  writes:

> Ruijie Yu via "General discussions about Org-mode."
>  writes:
>
>> Something very troublesome for me is `test-org-clock/clocktable/lang' on
>> zh_CN.UTF-8.  What I noticed is that when I run this test in batch mode
>> (one of the two methods below), it fails:
>
> Well. Batch and non-batch modes are not the same, especially wrt display
> things. And the differences are not consistent for different Emacs
> versions. This only happens for weird edge cases though. (Or when
> displaying images).

Hmm.  I guess I won't be trying to fix this particular issue then -- it
is a bit beyond my knowledge.  Thanks for explaining it.

>> +(defconst org-test-timestamp-regexp
>
> I recommend `org-element-timestamp-parser' for analysis.

Thanks for pointing that out!  I didn't realize it was there.  Although,
I don't think I can use this function as-is, nor its internal regexps:
all the relevant tests where I used `org-test-timestamp-regexp' tried to
remove the day-of-week part.  So I would need to know the region for the
day-of-week portion.  At the moment, I can't think of anything other
than making a group for DoW, and removing wrapping `save-match-data' in
`org-element-timestamp-parser' -- which is why I had those convoluted
group numbers in my `org-test-timestamp-regexp' for all portions that
one may ever want to use, hoping that nobody goes beyond defining 100
groups.

I also don't know if it is viable to integrate my full-of-`rx' and
full-of-`group-n' regexp expression into the 10s of different internal
constants representing different possible components of a timestamp.

Alternatively (and I say this very hesitantly), we could try to rewrite
all the involved tests so that we don't need to try to remove DoW from
the timestamp.  But, I haven't figured out how to do all of them (they
are also of different styles, some with repeater, some with warning
period, some are bare, etc), and there are -- I think -- around 40 of
them that needs changing.

-- 
Best,


RY

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



Re: How to disable org-persist in a given file?

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


Gustavo Barros  writes:
>> You can use `org-persist-before-write-hook' to disable writing
>> selectively.
>
> Thanks! That's the one. Though it would be nice if a variable existed
> for the purpose. `(add-hook 'org-persist-before-write-hook (lambda
> ( _args) t) nil t)' is not our average file local variable. :)

(lambda ( _args) t)

Side track: remember that you have `always' and `ignore' in your
collection of functions. :)

-- 
Best,


RY

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



[BUG] LANG=fr_FR.UTF-8 org-clock "not at timestamp"

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

I am investigating test failures with LANG=fr_FR.UTF-8 amongst some
other locales.  I noticed that the test
`test-org-clok/org-clock-timestamps-change' in
testing/lisp/test-org-clock.el around line 92 failed with "not at
timestamp", which I presume reveals a genuine bug.

To simplify, here is a reproducer:

--8<---cut here---start->8---
(require 'org-clock)
(with-temp-buffer
  (org-mode)
  (insert "CLOCK: [2023-02-19 Sun 22:30]--[2023-02-20 Mon 00:35] =>  2:05")
  (goto-char 25); 2|2:30
  (org-clock-timestamps-change 'down 1))
--8<---cut here---end--->8---

The error appears: "Not at timestamp".  I think it is due to the "." in
French day-of-week words, such as "dim.", "lun.", etc.  Something must
not be expecting punctuations in that place.

Reproduced in newest orgmode, and 1-month old Emacs master.

-- 
Best,


RY

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



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

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

Axel Kielhorn  writes:

>> 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

Thank you for confirming that it works.

The following is an update of my progress trying to fix all issues I
found when I tested against different $LANG values.

I was able to iron out most of the errors found in my testing on
zh_CN.UTF-8.  The amount of unexpected failures went down from 8 to 2.

I also noticed that new errors are introduced in LANG=fr_FR.UTF-8 (was
1, now 5), so I will take a look at that for the next iteration.

Something very troublesome for me is `test-org-clock/clocktable/lang' on
zh_CN.UTF-8.  What I noticed is that when I run this test in batch mode
(one of the two methods below), it fails:

$ LANG=zh_CN.UTF-8 make test
$ LANG=zh_CN.UTF-8 emacs -Q -nw -batch \
   -L lisp -L testing/lisp \
   -l ert \
   -l testing/org-test.el \
   -l testing/lisp/test-org-clock.el \
   -f ert-run-tests-batch-and-exit

Whereas when I run it interactively, it succeeds:

$ LANG=zh_CN.UTF-8 emacs -Q -nw \
   -L lisp -L testing/lisp \
   -l ert \
   -l testing/org-test.el \
   -l testing/lisp/test-org-clock.el

M-x ert-i test-org-clock/clocktable/lang RET

Not sure what to make of it just yet.

The other failure I got in zh_CN.UTF-8 is
`test-org-colview/columns-width', as I mentioned somewhere up-thread.
It is caused by this s-exp:

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

which returns "1234… |" when locale is en_US.UTF-8 or fr_FR.UTF-8, and
"1234 |" when locale is zh_CN.UTF-8 or ja_JA.UTF-8.

I think it might be due to the "perceived width" of the ellipsis, or
something?

Anyways, this is enough progress for now.  Here is the 4th iteration.
Note the very big rx regexp, where I asked in another thread whether my
understanding of a timestamp is complete.  Thanks.

>From d8525132d3f90623a6e8c732bd2a580ba23a2156 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.el org-test-timestamp-regexp: make a comprehensive
timestamp regexp for testing.
(test-org/clone-with-time-shift): (test-org/add-planning-info):
(test-org/deadline): (test-org/schedule): replace the regexps which try to match
the DoW string in a timestamp into using `org-test-timestamp-regexp'.
---
 testing/lisp/test-org-clock.el |  62 +
 testing/lisp/test-org.el   | 231 +
 testing/org-test.el|  25 
 3 files changed, 177 insertions(+), 141 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

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  

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.]



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 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.]



[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&qu

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: 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: 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] 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.]



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

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

Ihor Radchenko  writes:

> Ruijie Yu  writes:
>
>>> -org-mode-parser
>>> +/org-mode-parser/
>>>
>>> This probably belongs to the English version as well.
>>
>> Should the English version change belong to a new commit, unrelated to
>> the translation patchset?  Or would I just modify it in the same commit
>> where I translate zh-CN/tools.org?
>
> A separate commit would be cleaner. However, if it requires you to do too
> much unnecessary rebasing, we can postpone it until the main translation
> is merged.

I had planned to send an update email but forgot to actually send it..
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.

---
What changed from v5?

The first patch (0001, a9fef16e) addresses the italicization and added a
period mentioned up-thread.

The copy-symlink patch (0003, 1b8b2f2f) and the patch on zh-CN/tools.org
(0008, 6b81da7c) are then adjusted accordingly.

On the postamble patch (0013, 0abd949), I translated the "unicorn" in
the alttext.

Then, we have this patch (0014, d448a30) that was part of another
thread, LGTM'd by Bastien, which converts `load' into `require' in
publish.sh.

The final patch (0016, 9c8a8d8) requires Bastien's attention (CC'd): it
is a patch on publish.sh which introduces a fallback definition to
`file-name-with-extension', then replaces ad-hoc use in the `dolist'
form into calling this function.  In addition, it replaces `find-file'
into `find-file-noselect' so that contributors who `eval-buffer' this
script can rest assured that no .org buffers will pop up on the right
side.

If necessary, I can rebase patches 0014 and 0016 onto current master so
that they can be installed separately.

---
Should there be more iterations needed, I will only post patches that
are new or changed in order to save bandwidth.  I will be (hopefully)
very clear in what remains, what gets replaced by what, and what is
removed, etc.

---
>From a9fef16eb3cdbebf380220a64c2285949f6510b8 Mon Sep 17 00:00:00 2001
From: Ruijie Yu 
Date: Mon, 17 Apr 2023 17:05:59 +0800
Subject: [PATCH 01/16] * tools.org (Parsers): italicize for consistency;
 sentence period

---
 tools.org | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools.org b/tools.org
index a2325ca..1b1c27c 100644
--- a/tools.org
+++ b/tools.org
@@ -118,7 +118,7 @@ Includes (primitive) system for literate programming.
 {{{link(/gioorgi.com/org-mode-parser/)}}}
 [[https://seeklogo.com/images/N/nodejs-logo-FBE122E377-seeklogo.com.png]]
 
-org-mode-parser
+/org-mode-parser/
 {{{end-link}}}
 ** Python
 {{{gh(karlicoss/orgparse)}}}
@@ -130,7 +130,7 @@ org-mode-parser
 {{{link(metacpan.org/release/Org-Parser)}}}
 [[https://upload.wikimedia.org/wikipedia/commons/f/f0/Cebolla_Chulita.png]]
 
-Org​::parser
+/Org​::parser/
 {{{end-link}}}
 ** Ruby
 {{{gh(bdewey/org-ruby)}}}
@@ -198,7 +198,7 @@ other makups to org.
 {{{gh(fasheng/vimwiki2org)}}}
 [[https://cdn.freebiesupply.com/logos/large/2x/vim-logo-png-transparent.png]]
 
-A simple tool to convert vimwiki file to Org
+A simple tool to convert vimwiki file to Org.
 {{{end-link}}}
 ** Exchange calenders
 {{{gh(kautsig/ews-orgmode)}}}
-- 
2.40.0

>From 549f5d50e8803e0f028f1a171f667da150e6d09f Mon Sep 17 00:00:00 2001
From: Ruijie Yu 
Date: Tue, 11 Apr 2023 23:19:42 +0800
Subject: [PATCH 02/16] * zh-CN/.gitignore: Added gitignore for output HTML
 files

---
 zh-CN/.gitignore | 5 +
 1 file changed, 5 insertions(+)
 create mode 100644 zh-CN/.gitignore

diff --git a/zh-CN/.gitignore b/zh-CN/.gitignore
new file mode 100644
index 000..d36543d
--- /dev/null
+++ b/zh-CN/.gitignore
@@ -0,0 +1,5 @@
+/features.html
+/index.html
+/manuals.html
+/quickstart.html
+/tools.html
\ No newline at end of file
-- 
2.40.0

>From 1b8b2f2fa76f2dd908146fea1df24def408f6982 Mon Sep 17 00:00:00 2001
From: Ruijie Yu 
Date: Tue, 11 Apr 2023 01:32:26 +0800
Subject: [PATCH 03/16] Copies and symlinks to initialize zh-CN

Symlinking zh-CN/Changes.org because translating it is not worth the effort due
to its size.

Symlinking zh-CN/elpa.org because this file is unreferenced in any language, so
it is not worth translating it.  See relevant discussion in
https://list.orgmode.org/87a5zeu136.fsf@localhost/.

* zh-CN/Changes.org: Symlink from Changes.org.
* zh-CN/LICENSE.org: Copy from LICENSE.org.
* zh-CN/elpa.org: Symlink from elpa.org.
* zh-CN/features.org: Copy from features.org.
* zh-CN/index.org: Copy from index.org.
* zh-CN/manuals.org: Copy from manuals.org.
* zh-CN/org-demo.html: Copy from org-demo.html.
* zh-CN/quickstart.org: Copy from quickstart.org.
* zh-CN/resources/fonts: Symlink from resources/fonts.
* zh-CN/resources/img: Symlink from resources/img.
* zh-CN/resources/js: Symlink from resources/js.
* zh-CN/resources/normal-outline-3.html: Symlink from
resources/normal-outline-3.html.
* zh-CN/resources/oembed.info.json: Symlink from resources/oembed.info.json.
* 

Re: Major mode of orgweb/publish.sh?

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


Bastien Guerry  writes:

> Ihor Radchenko  writes:
>
>>> Converted the `load' into `require' because it allows someone working on a 
>>> local
>>> repo to `eval-buffer' successfully, given that the individual installs these
>>> dependencies from GNU/NonGNU Elpa.  Previously, due to the hard-coded path,
>>> `eval-buffer' would not be successful.
>>
>> Looks reasonable, but I will let Bastien decide on this. He is the
>> author of this file.
>
> LGTM too!  Please go ahead, thanks,

Thanks, I'll include this part in my translation patchset if you don't
mind.

-- 
Best,


RY

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



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-20 Thread General discussions about Org-mode.

Ihor Radchenko  writes:

> Ruijie Yu  writes:
>
>>> Compiler list may also be nil.
>>
>> This should be covered by the repeat case?  Unless you want to be explicit
>> about this, in which case you can wrap it in a choice, whose first choice
>> being (const :tag “description” nil), and the second choice being the repeat
>> case.
>
> Yes, explicit tag will be better.

Updated and rebased (cleanly) onto current main.  Note that I moved the
type into a new line to keep everything below 66 columns.

>From cd9bc0751c8ab5b9a733cfbad3230d73d9642af0 Mon Sep 17 00:00:00 2001
From: Ruijie Yu 
Date: Thu, 13 Apr 2023 13:14:36 +0800
Subject: [PATCH] * lisp/org.el org-latex-packages-alist: fixed type definition

---
 lisp/org.el | 18 +++---
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 463b4f594..bef5d0ca4 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -3485,13 +3485,17 @@ Make sure that you only list packages here which:
   :group 'org-export-latex
   :set 'org-set-packages-alist
   :get 'org-get-packages-alist
-  :type '(repeat
-	  (choice
-	   (list :tag "options/package pair"
-		 (string :tag "options")
-		 (string :tag "package")
-		 (boolean :tag "Snippet"))
-	   (string :tag "A line of LaTeX"
+  :type
+  '(repeat
+(choice
+ (list :tag "options/package pair"
+   (string :tag "options")
+   (string :tag "package")
+   (boolean :tag "snippet")
+   (choice
+(const :tag "All compilers include this package" nil)
+(repeat :tag "Only include from these compilers" string)))
+ (string :tag "A line of LaTeX"
 
 (defgroup org-appearance nil
   "Settings for Org mode appearance."
-- 
2.40.0


-- 
Best,


RY

[Please note that this mail might go to spam due to some
misconfiguration in my mail server -- will fix soon.]


Re: [BUG] ob-js "SyntaxError: Unexpected end of input" when code block ends with comment

2023-04-17 Thread General discussions about Org-mode.
Happy to help and thanks for fixing it so quickly:)
Best regards,
--
Salah 



Apr 17, 2023 at 12:10 by yanta...@posteo.net:

> sgherdao--- via "General discussions about Org-mode."
>  writes:
>
>> The following code snippet fails to execute
>>
>> #+begin_src js
>> console.log("Hello Friends!");
>> // -> logs "Hello Friends"
>> #+end_src
>>
>> I encounter the following error message:
>>
>> #+begin_src text
>> /tmp/js-script-dn2Wrp:2
>> // -> logs "Hello Friends"}()));
>>
>> SyntaxError: Unexpected end of input
>> ...
>> As a simple fix, I have added a \n after %s
>>
>> #+begin_src emacs-lisp
>> (defvar org-babel-js-function-wrapper
>>   
>> "require('process').stdout.write(require('util').inspect(function(){%s\n}()));"
>>   "Javascript code to print value of body.")
>> #+end_src
>>
>
> Thanks for reporting and providing a fix!
> Fixed, on bugfix.
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=7d8a9324f
>
> -- 
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at <https://orgmode.org/>.
> Support Org development at <https://liberapay.com/org-mode>,
> or support my work at <https://liberapay.com/yantar92>
>



[BUG] ob-js "SyntaxError: Unexpected end of input" when code block ends with comment

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

I would like to report a bug, I am using the following versions

GNU Emacs 28.2
Org mode version 9.6.1
Node v19.9.0


The following code snippet fails to execute

#+begin_src js
console.log("Hello Friends!");
// -> logs "Hello Friends"
#+end_src

I encounter the following error message:

#+begin_src text
/tmp/js-script-dn2Wrp:2
// -> logs "Hello Friends"}()));

SyntaxError: Unexpected end of input
    at internalCompileFunction (node:internal/vm:73:18)
    at wrapSafe (node:internal/modules/cjs/loader:1195:20)
    at Module._compile (node:internal/modules/cjs/loader:1239:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1329:10)
    at Module.load (node:internal/modules/cjs/loader:1133:32)
    at Module._load (node:internal/modules/cjs/loader:972:12)
    at Function.executeUserEntryPoint [as runMain] 
(node:internal/modules/run_main:83:12)
    at node:internal/main/run_main_module:23:47
#+end_src


Upon further inspection, I found that the generated JavaScript code in the tmp 
file contains an unbalanced brace and parentheses, as shown below:


#+begin_src js
require('process').stdout.write(require('util').inspect(function(){console.log("Hello
 Friends!");
// -> logs "Hello Friends"}()));
#+end_src


Since the last line of the code snippet contains a comment the brace and parens 
are unbalanced
This seems to point to the way the following variable is defined in ob-js.el


#+begin_src emacs-lisp
(defvar org-babel-js-function-wrapper
  "require('process').stdout.write(require('util').inspect(function(){%s}()));"
  "Javascript code to print value of body.")
#+end_src

As a simple fix, I have added a \n after %s

#+begin_src emacs-lisp
(defvar org-babel-js-function-wrapper
  
"require('process').stdout.write(require('util').inspect(function(){%s\n}()));"
  "Javascript code to print value of body.")
#+end_src


Please let me know if you need any additional information or if there's 
anything else I can do to help resolve this issue.


Best regards,
--
Salah



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

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


Ihor Radchenko  writes:

> Ruijie Yu  writes:
>
>>> Series of commits is ok.
>>
>> I have decided to push the changes to an unlisted cloned project on
>> sourcehut (https://sr.ht/~ruijieyu/orgweb), since otherwise I would have
>> to generate the patchset in every iteration, and attach the files to
>> emails _one by one_ on mu4e.  Let me know if you need me to attach the
>> patchset to keep a trace on the ML -- it takes me a while but I can do
>> it.
>
> mu4e does not support multiple selection when attaching files? AFAIK,
> Emacs supports drag-and-drop for attachments.

Hanno provided additional hints on that, and I will try to use dired to
place attachments in my next iteration. 

   * I think the "#+description:" portion of each *.org file can be just
 moved into setup.org?  That way we don't duplicate it twenty times.
>>>
>>> Agree.
>>
>> Noted.  I did not touch the descriptions outside of zh-CN; please let me
>> know if I should.
>
> It will be a good idea.

I'll update all "#+description" fields outside zh-CN in a single,
separate commit, unless you have other ideas.

>>> It will be useful to add alternative websites in Mandarin/Cantonese as a
>>> secondary link.
>>
>> Sounds good, will do on my next iteration.  One more question: should I
>> add the secondary link next to the primary link, or should I add them as
>> footnotes?
>
> IMHO, it will make sense to have an immediately visible alternative
> link. So, secondary link will do. Or you may even make the Chinese link
> primary, as the one that is more likely to be useful.

Noted.

>> On second look, this may just be because I ran `C-c C-e h h'.  I tried
>> to run this command on the English site, and the generated site also
>> behaves like what I described above.
>>
>> I am curious about the differences between `C-c C-e h h' and publish.sh.
>> I didn't run publish.sh because I don't think the publish script should
>> be run locally as-is, since it contains hardcoded paths.
>
> Publishing is quite a bit different. For example, it tries hard to make
> the HTML anchors stable. There are other differences as well.

Got it.  As evident from some of my other messages, I have therefore
switched over to using publish.sh because I want to be able to see how
exactly each page looks.

-- 
Best,


RY



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

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


Ihor Radchenko  writes:

> Ruijie Yu via "General discussions about Org-mode."
>  writes:
>
>> I underwent a (painfully long) process of git magickery so that each
>> "translation" commit only _translates_ a file, instead of adds a brand
>> new file with brand new contents.  This means reviewers can have an
>> easier time to just review the diff without needing to look back and
>> forth between two files.
>
> Thanks!
>
>> +  
>> +概述显示 
>
> I'd look into, for example, how Chinese version of WPS office names outlines.

Thanks, installing it now and will take a look.

> Also, I noticed that in tools.org you changed
>
> -org-mode-parser
> +/org-mode-parser/
>
> This probably belongs to the English version as well.

Should the English version change belong to a new commit, unrelated to
the translation patchset?  Or would I just modify it in the same commit
where I translate zh-CN/tools.org?

-- 
Best,


RY



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

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


Hanno Perrey  writes:

>>> I have decided to push the changes to an unlisted cloned project on
>>> sourcehut (https://sr.ht/~ruijieyu/orgweb), since otherwise I would have
>>> to generate the patchset in every iteration, and attach the files to
>>> emails _one by one_ on mu4e.  Let me know if you need me to attach the
>>> patchset to keep a trace on the ML -- it takes me a while but I can do
>>> it.
>>
>>mu4e does not support multiple selection when attaching files? AFAIK,
>>Emacs supports drag-and-drop for attachments.
>
> Just FYI: It is possible to attach several files in one go in mu4e, by using 
> the integration into dired and marking any file to be attached: 
> https://www.djcbsoftware.nl/code/mu/mu4e/Dired.html

Thanks for mentioning it and for the link, I'll remember to use that
next time.

> Best wishes,
> Hanno
>
> PS: hope the formatting of this mail is ok, I am currently struggling with 
> the k9mail configuration on my mobile

All your paragraphs show up as long lines on my end, so evidently your
mobile email client soft-wraps your paragraphs for you (instead of
hard-wrapping, i.e., adding real newline chars).  Typical behavior on
mobile email clients, so I'm not surprised.

-- 
Best,


RY



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

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

This is a new iteration:
https://git.sr.ht/~ruijieyu/orgweb/log/translate/zh-CN--v5 for the zh-CN
translation.  Well, it says v5 because it went through some internal
iterations, and I pushed too soon before soon discovering that something
else needed to be changed.  I want to keep all these iterations alive
until the entire thing goes into orgmode.org.

Please also take the final commit (4965b363) with a grain of salt -- it
is only a modification on publish.sh which provides me a minor aesthetic
improvement (not having to see all these .org buffers pop up at me), and
don't necessarily need to be considered together with the rest of the
translation patchset.  If necessary, I'll post this commit as a separate
patch mail in the ML for consideration.

I underwent a (painfully long) process of git magickery so that each
"translation" commit only _translates_ a file, instead of adds a brand
new file with brand new contents.  This means reviewers can have an
easier time to just review the diff without needing to look back and
forth between two files.

Here attached is a diff between translate/zh-CN--v2 and
translate/zh-CN--v5~1.  Note that I deliberately omitted the commit
4965b363 in this diff.

I'll also tell the folks at emacs-china.org about this iteration shortly
after so that they can review these translations.

diff --git a/publish.sh b/publish.sh
index f756ff6..8486760 100755
--- a/publish.sh
+++ b/publish.sh
@@ -28,7 +28,7 @@
   org-html-postamble t
   org-html-postamble-format
   `(("en" ,(get-postamble "."))
-("zh-CN" ,(get-postamble "zh_CN"
+("zh-CN" ,(get-postamble "zh-CN"
 
 (dolist (org-file (directory-files-recursively default-directory "\\.org$"))
   (let ((html-file (concat (file-name-directory org-file)
diff --git a/zh-CN/features.org b/zh-CN/features.org
index 79ab8f7..0367040 100644
--- a/zh-CN/features.org
+++ b/zh-CN/features.org
@@ -62,7 +62,7 @@ Org 里最基础的结构是由可嵌套、可折叠的章节构成的树。你
 
 Org 的树结构给用户带来了快速且优雅的导引与强大的信息遮避功能,让你在保持获取需要信息的能力的同时专心于手头的任务。
 
-控制章节可见与否只是 Org 的一个小小的功能,而 Org 仍有其它多种工具与命令来为纯文本结构化的编辑带来便利。 Org 的语法让用户把枯燥的任务变成了单个的键盘命令,让用户更着重于内容而不是形式。
+控制章节可见与否只是 Org 的一个小小的功能,而 Org 仍有其它多种工具与命令来为结构化地编辑纯文本带来便利。 Org 的语法让用户把枯燥的任务变成了单个的键盘命令,让用户更着重于内容而不是形式。
 
 *** 更多
 
@@ -123,7 +123,7 @@ Org 目前支持超过[[file:../worg/org-contrib/babel/languages/index.html][80
 
 Worg(英语):[[file:../worg/org-contrib/babel/languages/index.html][支持语言]]列表
 
-* 导出与发表
+* 导出与发布
   :PROPERTIES:
   :CUSTOM_ID: publishing
   :HTML_CONTAINER_CLASS: side-fig
@@ -135,7 +135,7 @@ Worg(英语):[[file:../worg/org-contrib/babel/languages/index.html][支持
 
 ** 描述
 
-Org 是一个撰写与发表的工具 - 它既可以是静态网页生成器,也可以是一系列为发表内容提供便利的工具。
+Org 是一个撰写与发布的工具 - 它既可以是静态网页生成器,也可以是一系列为发布内容提供便利的工具。
 
 你使用 Org 的简洁易懂的标记语法来撰写稿件,然后导出到你所选择的任何一种格式。 Org 支持很多格式,其中包含:
 
@@ -146,15 +146,15 @@ Org 是一个撰写与发表的工具 - 它既可以是静态网页生成器
 
 开发者可以轻松地为任何格式创造新的导出后端(详见[[file:../worg/dev/org-export-reference.html][ox的文档]]),并且 Org 也被[[https://pandoc.org][Pandoc]]支持。
 
-除开导出单一的文件以外,你还可以​/发表项目/ - 将一个或更多的 =.org= 文件以及其需要的各种资源导出到一个或更多的发表后端。
+除开导出单一的文件以外,你还可以​/发布项目/ - 将一个或更多的 =.org= 文件以及其需要的各种资源导出到一个或更多的发布后端。
 
 *** 更多
 
 冷知识:Org 的网页是由 Org 编写而成!
 
-详见手册(英语):[[file:../manual/Markup-for-Rich-Contents.html][标记]],[[file:../manual/Exporting.html][导出]],[[file:../manual/Publishing.html][发表]]
+详见手册(英语):[[file:../manual/Markup-for-Rich-Contents.html][标记]],[[file:../manual/Exporting.html][导出]],[[file:../manual/Publishing.html][发布]]
 
-Worg 教程(英语):发表到 [[file:../worg/org-tutorials/org-publish-html-tutorial.html][HTML]] ;发表到 [[file:../worg/org-tutorials/org-latex-export.html][\(\LaTeX\)]]
+Worg 教程(英语):发布到 [[file:../worg/org-tutorials/org-publish-html-tutorial.html][HTML]] ;发布到 [[file:../worg/org-tutorials/org-latex-export.html][\(\LaTeX\)]]
 
 * 把握任务的进程
   :PROPERTIES:
@@ -169,11 +169,11 @@ Worg 教程(英语):发表到 [[file:../worg/org-tutorials/org-publish-htm
 
 Org 是一个功能齐全的任务计划工具、时间管理工具以及待办事项工具。
 
-任何一个章节都可以通过增加例如 =TODO= 或者 =HOLD= 等关键词来被设置成​/待办/​。你可以由此跟踪纪录此任务的进度。你也可以使用快捷键 =S-= 和 =S-= 来把任务切换到不同状态。
+任何一个章节都可以通过增加例如 =TODO= 或者 =HOLD= 等关键词来被设置成​/待办事项/​。你可以由此跟踪纪录此任务的进度。你也可以使用快捷键 =S-= 和 =S-= 来把任务切换到不同状态。
 
 需要增加其他的任务状态?没问题。你可以根据你的工作流程自由地设置任务状态。
 
-在 Org /日程/​(Agenda)里,你可以轻松地查看多个文件里的任务 - 你仅需要添加一个任务状态关键词,例如 =TODO=​。Org 为以下功能有内置支持:任务优先级、截止日期、计划中任务、标签、打卡等等。​/日程/​能够使用上述所有功能来整理任务以及设置优先级。因此,在仅仅使用纯文本标记的同时,你可以把一个简单的待办事项列表无缝升级为一个完整的项目管理软件。
+在 Org /日程/​(Agenda)里,你可以轻松地查看多个文件里的任务 - 你仅需要添加一个任务状态关键词,例如 =TODO=​。Org 为以下功能有内置支持:任务优先级、截止日期、计划中任务、标签、打卡等等。​/日程/​能够使用上述所有功能来整理任务以及设置优先级。因此,在仅需使用纯文本标记的同时,你可以把一个简单的待办事项列表无缝升级为一个完整的项目管理软件。
 
 *** 更多
 
diff --git a/zh-CN/index.org b/zh-CN/index.org
index 1397a37..b5da846 100644
--- a/zh-CN/index.org
+++ b/zh-CN/index.org
@@ -1,7 +1,7 @@
 #+title: Emacs 的 Org 主模式
 #+setupfile: setup.org
-#+html_head: 
-#+html_head: 
+#+html_head: 
+#+html_head: 
 #+include: "resources/preamble.html" export html
 
 #+html_head: 
@@ -13,13 +13,13 @@
alt="Org unicorn logo" itemprop="image"/>
   
 
-  Org Mode
+  Org 主模式
   纯文本的生活
 
 
 

Re: Major mode of orgweb/publish.sh?

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


Ihor Radchenko  writes:

> Ruijie Yu via "General discussions about Org-mode."
>  writes:
>
>> Major mode was erronously set to shell-script-mode because of the empty line.
>
> There is no error there. The line in question is inline stdin redirect
> in shell. "#..." is what is fed to exec emacs. There is no intention to
> define mode for publish.sh there, just a standard Elisp script header.

Instead of "inline stdin redirect", this instead just passes Emacs the
file name and Emacs just reads from the file again.

I was about to propose changing the shbang line into just
#!/usr/bin/emacs -x, but even though the --help text says this is
exactly the case to use it, running such a script opens up a graphical
terminal which is unexpected.

But regardless, I don't quite care about it as long as it does its job
(other than the fact that I need to `M-x emacs-lisp-mode RET' at its
current state, and the concern that the lexical binding property line
takes effect neither in-buffer nor during script execution), so I'll let
you or Bastien decide whether doing anything about the first few lines
is worth it.

>> Converted the `load' into `require' because it allows someone working on a 
>> local
>> repo to `eval-buffer' successfully, given that the individual installs these
>> dependencies from GNU/NonGNU Elpa.  Previously, due to the hard-coded path,
>> `eval-buffer' would not be successful.
>
> Looks reasonable, but I will let Bastien decide on this. He is the
> author of this file.

Sounds good.  Let's wait for that, along with his confirmation that my
copyright process is complete.

-- 
Best,


RY



Re: Major mode of orgweb/publish.sh?

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


Ihor Radchenko  writes:

> Ruijie Yu via "General discussions about Org-mode."
>  writes:
>
>> What is the expected major mode for orgweb/publish.sh?  When I open it,
>> I see it is in `shell-script-mode'.  This is what I see in
>> orgweb/publish.sh:
>>
>> --8<---cut here---start->8---
>> #!/usr/bin/env sh
>>
>> ":" ; exec emacs --quick --script "$0" -- "$@" # -*- mode: emacs-lisp; 
>> lexical-binding: t; -*-
>> ...
>
> The mode is technically shell-script. The file is using shell script
> magic to write foreign language (Elisp) script inline.
>
>> When I remove the empty line 2 and run `normal-mode', the file now opens
>> in `emacs-lisp-mode'.  I have a sneaking suspicion that
>> `emacs-lisp-mode' is the expected major mode for this file, because
>> there is also the `lexical-binding' variable declaration on the property
>> line, which has no effects when the major mode is shell.
>
> You can do either way, depending on which part of the script you want to edit.

I tried to actually compare the two versions, and found out that the
lexical-binding does nothing at all during the script execution,
regardless of whether there is an empty line or not.  Is this a bug or
an expected behavior?

FTR, when opening the file in a buffer, the property line in a file
without empty line is properly recognized, whereas in the file with
empty line it is not recognized.

-- 
Best,


RY



Re: Major mode of orgweb/publish.sh?

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

Ruijie Yu  writes:

>> Hello,
>>
>> What is the expected major mode for orgweb/publish.sh?  When I open it,
>> I see it is in `shell-script-mode'.  This is what I see in
>> orgweb/publish.sh:
>>
>> --8<---cut here---start->8---
>> #!/usr/bin/env sh
>>
>> ":" ; exec emacs --quick --script "$0" -- "$@" # -*- mode: emacs-lisp; 
>> lexical-binding: t; -*-
>> ...
>> --8<---cut here---end--->8---
>>
>> When I remove the empty line 2 and run `normal-mode', the file now opens
>> in `emacs-lisp-mode'.  I have a sneaking suspicion that
>> `emacs-lisp-mode' is the expected major mode for this file, because
>> there is also the `lexical-binding' variable declaration on the property
>> line, which has no effects when the major mode is shell.
>
> In case I am right, I'll send a patch for this and another issue I find
> for review shortly.

Here attached is the patch for orgweb.  The commit message describes the
two issues I find regarding orgweb/publish.sh.

>From 90fd8ecc39cb279ee27e0db2f637f60c7b80af07 Mon Sep 17 00:00:00 2001
From: Ruijie Yu 
Date: Fri, 14 Apr 2023 16:04:27 +0800
Subject: [PATCH] * publish.sh: fixed major mode; converted load into require

Major mode was erronously set to shell-script-mode because of the empty line.

Converted the `load' into `require' because it allows someone working on a local
repo to `eval-buffer' successfully, given that the individual installs these
dependencies from GNU/NonGNU Elpa.  Previously, due to the hard-coded path,
`eval-buffer' would not be successful.
---
 publish.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/publish.sh b/publish.sh
index f756ff6..b3911d2 100755
--- a/publish.sh
+++ b/publish.sh
@@ -1,13 +1,13 @@
 #!/usr/bin/env sh
-
-":"; exec emacs --quick --script "$0" -- "$@" # -*- mode: emacs-lisp; lexical-binding: t; -*-
+":" ; exec emacs --quick --script "$0" -- "$@" # -*- mode: emacs-lisp; lexical-binding: t; -*-
 
 (add-to-list 'load-path "~/org-mode/lisp/")
 (add-to-list 'load-path "~/org-contrib/lisp/")
 (require 'ox-html)
 (require 'ox-extra)
 (ox-extras-activate '(ignore-headlines))
-(load "/usr/share/emacs/site-lisp/elpa-src/htmlize-1.56/htmlize.el")
+(add-to-list 'load-path "/usr/share/emacs/site-lisp/elpa-src/htmlize-1.56")
+(require 'htmlize)
 
 (setq make-backup-files nil
   debug-on-error t)
-- 
2.40.0


-- 
Best,


RY


Re: Major mode of orgweb/publish.sh?

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


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

> Hello,
>
> What is the expected major mode for orgweb/publish.sh?  When I open it,
> I see it is in `shell-script-mode'.  This is what I see in
> orgweb/publish.sh:
>
> --8<---cut here---start->8---
> #!/usr/bin/env sh
>
> ":" ; exec emacs --quick --script "$0" -- "$@" # -*- mode: emacs-lisp; 
> lexical-binding: t; -*-
> ...
> --8<---cut here---end--->8---
>
> When I remove the empty line 2 and run `normal-mode', the file now opens
> in `emacs-lisp-mode'.  I have a sneaking suspicion that
> `emacs-lisp-mode' is the expected major mode for this file, because
> there is also the `lexical-binding' variable declaration on the property
> line, which has no effects when the major mode is shell.

In case I am right, I'll send a patch for this and another issue I find
for review shortly.

-- 
Best,


RY



Major mode of orgweb/publish.sh?

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

What is the expected major mode for orgweb/publish.sh?  When I open it,
I see it is in `shell-script-mode'.  This is what I see in
orgweb/publish.sh:

--8<---cut here---start->8---
#!/usr/bin/env sh

":" ; exec emacs --quick --script "$0" -- "$@" # -*- mode: emacs-lisp; 
lexical-binding: t; -*-
...
--8<---cut here---end--->8---

When I remove the empty line 2 and run `normal-mode', the file now opens
in `emacs-lisp-mode'.  I have a sneaking suspicion that
`emacs-lisp-mode' is the expected major mode for this file, because
there is also the `lexical-binding' variable declaration on the property
line, which has no effects when the major mode is shell.

-- 
Best,


RY



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-13 Thread General discussions about Org-mode.


> On Apr 13, 2023, at 19:23, Ihor Radchenko  wrote:
> 
> Ruijie Yu via "General discussions about Org-mode."
>  writes:
> 
>> From 0be8702357ddf699c5ff1814a5fa57a6443b10de Mon Sep 17 00:00:00 2001
>> From: Ruijie Yu 
>> Date: Thu, 13 Apr 2023 13:14:36 +0800
>> Subject: [PATCH] * lisp/org.el org-latex-packages-alist: fixed type 
>> definition
> 
> Thanks!
> May I know if you got any reply about your FSF assignment?

Yes, it is now complete.  I presume you want to check with Bastien, so I took 
the liberty of CC’ing him myself. 

>> ---
>> lisp/org.el | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>> diff --git a/lisp/org.el b/lisp/org.el
>> index 26d2a8610..5bad16fd9 100644
>> --- a/lisp/org.el
>> +++ b/lisp/org.el
>> @@ -3490,7 +3490,8 @@ Make sure that you only list packages here which:
>>  (list :tag "options/package pair"
>>(string :tag "options")
>>(string :tag "package")
>> - (boolean :tag "Snippet"))
>> + (boolean :tag "snippet")
>> + (repeat :tag "compilers" string))
> 
> Compiler list may also be nil.

This should be covered by the repeat case?  Unless you want to be explicit 
about this, in which case you can wrap it in a choice, whose first choice being 
(const :tag “description” nil), and the second choice being the repeat case.  
Can’t change the patch myself because I don’t have access to a computer ATM. 

> -- 
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at <https://orgmode.org/>.
> Support Org development at <https://liberapay.com/org-mode>,
> or support my work at <https://liberapay.com/yantar92>

--
Best,


RY



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-12 Thread General discussions about Org-mode.

Gustavo Barros  writes:

> Hi All,
>
> I'm testing here the new pretest for Emacs 29, and I noticed a small
> problem in the type specification of the `org-latex-packages-alist'
> defcustom.
>
> The docstring states that each element of the alist is composed of up
> to four elements, but the type specification comprises just the first
> three.

Does this work in your `setopt' expression?

>From 0be8702357ddf699c5ff1814a5fa57a6443b10de Mon Sep 17 00:00:00 2001
From: Ruijie Yu 
Date: Thu, 13 Apr 2023 13:14:36 +0800
Subject: [PATCH] * lisp/org.el org-latex-packages-alist: fixed type definition

---
 lisp/org.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/org.el b/lisp/org.el
index 26d2a8610..5bad16fd9 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -3490,7 +3490,8 @@ Make sure that you only list packages here which:
 	   (list :tag "options/package pair"
 		 (string :tag "options")
 		 (string :tag "package")
-		 (boolean :tag "Snippet"))
+		 (boolean :tag "snippet")
+ (repeat :tag "compilers" string))
 	   (string :tag "A line of LaTeX"
 
 (defgroup org-appearance nil
-- 
2.40.0


-- 
Best,


RY


#o544 is user rw?

2023-04-12 Thread General discussions about Org-mode.
I'm looking at this `defcustom', and its docstring looks wrong.  It says
that #o544 corresponds to "u=rw,g=r,o=r", but shouldn't it be
"u=rx,g=r,o=r"?  Something is wrong, unless there is another definition
of permissions that I'm not aware of.

--8<---cut here---start->8---
(defcustom org-babel-tangle-default-file-mode #o544
  "The default mode used for tangled files, as an integer.
The default value 356 correspands to the octal #o544, which is
read-write permissions for the user, read-only for everyone else."
  :group 'org-babel-tangle
  :package-version '(Org . "9.6")
  :type 'integer)
--8<---cut here---end--->8---

This is lisp/ob-tangle.el:161, in recent master.

-- 
Best,


RY



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

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

Thanks for your response.  I made some changes accordingly, which can be
found here: https://git.sr.ht/~ruijieyu/orgweb/tree/translate/zh-CN--v2 .

More responses inline below.


Ihor Radchenko  writes:

> Ruijie Yu via "General discussions about Org-mode."
>  writes:
>
>> This is a tentative patchset for orgweb zh_CN translation.
>
> Thanks!
>
>>   * How do I change the heading for the footnote section?  In
>> particular, can I set it in a file- or dir-local variable, or in the
>> setup.org file?  This is needed for _fully_ translating
>> /quickstart.org.
>
> You just need to use #+language: zh-CN (note dash).

Thank you, that fixes it.  I am therefore updating all traces of "zh_CN"
into "zh-CN".

>>   * Is translating /elpa.org worth it?  I presume not, because part of
>> it describes the use of the now-deprecated Org Elpa repository.
>
> This page is, AFAIK, not referenced anywhere. And obsolete. No need to
> bother.

Noted.  I therefore made zh-CN/elpa.org a symlink.

>>   * I noticed that /resources/postamble.html is unused in all languages.
>> Should it be deleted?
>
> It is used in every single html. See /publish.sh.

Got it.  I have hence added my translation of postamble.html, and
slightly modified publish.sh so that it makes use of the translation.

>>   * I have added additional notes regarding zero-width spaces, because
>> CJK languages rarely use spaces whereas markups need them.  I
>> presume this is an acceptable addition.
>> + This addition would also be helpful for when _eventually_ the
>>   Japanese version is updated or some other CJK language is added.
>
> You can also link to https://orgmode.org/manual/Escape-Character.html

Got it.

>>   * I left the changes in a series of commits, each handling one file --
>> please let me know if I should squash them into fewer commits.
>> Alternatively, let me know if I should push this to some online Git
>> repo.
>
> Series of commits is ok.

I have decided to push the changes to an unlisted cloned project on
sourcehut (https://sr.ht/~ruijieyu/orgweb), since otherwise I would have
to generate the patchset in every iteration, and attach the files to
emails _one by one_ on mu4e.  Let me know if you need me to attach the
patchset to keep a trace on the ML -- it takes me a while but I can do
it.

>>   * Please let me know if there are any guidelines for commit messages
>> which I should follow.
>
> See https://orgmode.org/worg/org-contribute.html#commit-messages

Tried to abide, please confirm.

>>   * I think the "#+description:" portion of each *.org file can be just
>> moved into setup.org?  That way we don't duplicate it twenty times.
>
> Agree.

Noted.  I did not touch the descriptions outside of zh-CN; please let me
know if I should.

>>   * There are hyperlinks which link to sites unreachable from mainland
>> China.  I have marked them as "external sites" (外网) for now, but I
>> wonder if I should look for equivalent sites accessible from within
>> mainland China.
>
> It will be useful to add alternative websites in Mandarin/Cantonese as a
> secondary link.

Sounds good, will do on my next iteration.  One more question: should I
add the secondary link next to the primary link, or should I add them as
footnotes?

> You should not assume that all the Chinese users experience the same set
> of blocked websites. Different provinces have slightly varying rules,
> the rules change with time, and Hong Kong in particular is not likely to
> block much. Not to mention VPN.

Yes, I understand, as I have had first-hand experience on the
aforementioned differences.  What I have observed is that Wikipedia and
Google are the two main sites that came to my mind which are universally
blocked from mainland China, both of which are referenced in some degree
in the English version.  And at least in the case of Wikipedia, I offer
to look for alternative sites because the task should be relatively easy
for me.

[And small nit, Hong Kong is not a province but a S.A.R. :) ]

>>   * When translating /index.org, I noticed that, within the first
>> section, the spacing between the icons and their texts (e.g., the
>> rocket icon and its accompanying text "quickstart") in
>> /zh_CN/index.org are smaller than that of /index.org.  I don't know
>> if it is because I unintentionally changed something that caused
>> this.
>
> Timothy, may you take a look?

On second look, this may just be because I ran `C-c C-e h h'.  I tried
to run this command on the English site, and the generated site also
behaves like what I described above.

I am curio

[orgweb/zh_CN] [DRAFT PATCH] Tentative zh_CN translation

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

This is a tentative patchset for orgweb zh_CN translation.  However,
some questions remain before I can finalize the translation, see below.
Note that they are not of any particular order -- just the order in
which they appeared in my mind when I composed this message.

- General
  * How do I change the heading for the footnote section?  In
particular, can I set it in a file- or dir-local variable, or in the
setup.org file?  This is needed for _fully_ translating
/quickstart.org.

  * Is translating /elpa.org worth it?  I presume not, because part of
it describes the use of the now-deprecated Org Elpa repository.

  * I noticed that /resources/postamble.html is unused in all languages.
Should it be deleted?

  * I have added additional notes regarding zero-width spaces, because
CJK languages rarely use spaces whereas markups need them.  I
presume this is an acceptable addition.
+ This addition would also be helpful for when _eventually_ the
  Japanese version is updated or some other CJK language is added.

  * I left the changes in a series of commits, each handling one file --
please let me know if I should squash them into fewer commits.
Alternatively, let me know if I should push this to some online Git
repo.

  * Please let me know if there are any guidelines for commit messages
which I should follow.

  * I think the "#+description:" portion of each *.org file can be just
moved into setup.org?  That way we don't duplicate it twenty times.

  * There are hyperlinks which link to sites unreachable from mainland
China.  I have marked them as "external sites" (外网) for now, but I
wonder if I should look for equivalent sites accessible from within
mainland China.

  * When translating /index.org, I noticed that, within the first
section, the spacing between the icons and their texts (e.g., the
rocket icon and its accompanying text "quickstart") in
/zh_CN/index.org are smaller than that of /index.org.  I don't know
if it is because I unintentionally changed something that caused
this.

  * Should I mark English links as "English", and if so, how
aggressively should I mark them?  Or do you think it is too
distracting for readers?  I ask because there are some links in /ja
that are marked as "English".

- Chinese speakers
  * Please check for consistency on all major terminologies.  The
translation was done during a long timespan, and I may have
unintentionally chosen different words for the same term on
different days.

  * Please suggest alternative translations for various portions if you
see fit.  There were some portions where I _struggled_ to come up
with sound translations.


>From c3ae2c1963933ca363da6b9d01757d14463d7a9a Mon Sep 17 00:00:00 2001
From: Ruijie Yu 
Date: Tue, 11 Apr 2023 01:32:26 +0800
Subject: [PATCH 01/12] * **/resources/preamble.html

---
 resources/preamble.html   |  4 +++-
 zh_CN/resources/preamble.html | 23 +++
 2 files changed, 26 insertions(+), 1 deletion(-)
 create mode 100644 zh_CN/resources/preamble.html

diff --git a/resources/preamble.html b/resources/preamble.html
index a64832f..c3836f3 100644
--- a/resources/preamble.html
+++ b/resources/preamble.html
@@ -7,7 +7,9 @@
 
 [ en
 - fr
-- ja ]
+- ja
+- 简
+]
 
 
Org Mode
diff --git a/zh_CN/resources/preamble.html b/zh_CN/resources/preamble.html
new file mode 100644
index 000..5e9e3e5
--- /dev/null
+++ b/zh_CN/resources/preamble.html
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+[ en
+- fr
+- ja
+- 简
+]
+
+
+  Org 主模式
+功能
+更新内容
+https://updates.orgmode.org;>项目状态
+安装
+手册
+Worg
+贡献
+
-- 
2.40.0

>From f6aa08604a825badfa76e8f35f0e39cbe13c8fa8 Mon Sep 17 00:00:00 2001
From: Ruijie Yu 
Date: Tue, 11 Apr 2023 01:32:26 +0800
Subject: [PATCH 02/12] * zh_CN/resources/* symlinks

---
 zh_CN/resources/fonts | 1 +
 zh_CN/resources/img   | 1 +
 zh_CN/resources/js| 1 +
 zh_CN/resources/normal-outline-3.html | 1 +
 zh_CN/resources/oembed-info.json  | 1 +
 zh_CN/resources/style | 1 +
 6 files changed, 6 insertions(+)
 create mode 12 zh_CN/resources/fonts
 create mode 12 zh_CN/resources/img
 create mode 12 zh_CN/resources/js
 create mode 12 zh_CN/resources/normal-outline-3.html
 create mode 12 zh_CN/resources/oembed-info.json
 create mode 12 zh_CN/resources/style

diff --git a/zh_CN/resources/fonts b/zh_CN/resources/fonts
new file mode 12
index 000..db461b9
--- /dev/null
+++ b/zh_CN/resources/fonts
@@ -0,0 +1 @@
+../../resources/fonts
\ No newline at end of file
diff --git a/zh_CN/resources/img b/zh_CN/resources/img
new file mode 12
index 000..a3dbcb6
--- /dev/null
+++ b/zh_CN/resources/img
@@ -0,0 +1 @@
+../../resources/img
\ No newline 

BUG: Org babel can't return a cons cell

2023-04-06 Thread General discussions about Org-mode.
Hello,
I've found a bug in org-babel. The simple code

#+begin_src scheme
  (cons 1 2)
#+end_src

Produces an error:

#+begin_quote
Debugger entered--Lisp error: (wrong-type-argument listp 2)
  org-babel-scheme--table-or-string("(1 . 2)")
  org-babel-execute:scheme("(cons 1 2)" ((:colname-names) (:rowname-names) 
(:result-params "replace") (:result-type . value) (:results . "replace") 
(:exports . "code") (:session . "none") (:cache . "no") (:noweb . "no") 
(:hlines . "no") (:tangle . "no")))
  org-babel-execute-src-block(nil ("scheme" "(cons 1 2)" ((:colname-names) 
(:rowname-names) (:result-params "replace") (:result-type . value) (:results . 
"replace") (:exports . "code") (:tangle . "no") (:hlines . "no") (:noweb . 
"no") (:cache . "no") (:session . "none")) "" nil 203 "(ref:%s)"))
  org-ctrl-c-ctrl-c(nil)
  funcall-interactively(org-ctrl-c-ctrl-c nil)
  command-execute(org-ctrl-c-ctrl-c)
#+end_quote

There is a fix I've found (thanks yantar92Orgcontr from
#org-m...@libera.chat)

#+begin_src elisp
(defun org-babel-scheme--table-or-string (results)
  "Convert RESULTS into an appropriate elisp value.
If the results look like a list or tuple, then convert them into an
Emacs-lisp table, otherwise return the results as a string."
  (let ((res (and results (org-babel-script-escape results
(cond ((proper-list-p res)
   (mapcar (lambda (el)
 (if (or (null el) (eq el 'null))
 org-babel-scheme-null-to
   el))
   res))
  (t res
#+end_src

should work on emacs older then Emacs 26 (proper-list-p not implemented here).

--
With best regards,
Igor Gajsin



Re: [Q] How to italicize without introducing a space?

2023-03-29 Thread General discussions about Org-mode.


"Dr. Arne Babenhauserheide"  writes:

> [...]
> You could try using a ZERO WIDTH SPACE around the expression [...]

Thank you Arne and Steven.  I have tried to just insert the zero width
space, and it seems to work very well (at least on HTML export, which is
the only backend that orgweb wants, because I'm working on a translation
for it).

I do realize that LaTeX export may struggle with zero width space, but
I'll only look into it when it becomes a problem.

--
Best,


RY



[Q] How to italicize without introducing a space?

2023-03-28 Thread General discussions about Org-mode.
Hello,

I am working on a piece of CJK text, which requires italicization.

--8<---cut here---start->8---
任何一个章节可以通过增加例如 =TODO= 或者 =HOLD= 等关键词来被设置成 /待办/ 。
--8<---cut here---end--->8---

Note the spaces before and after the pair of `?/'.  Without these
spaces, the HTML export does not show "待办" as italicized, but instead
treat them as inline literal `?/' characters, which is expected in
current Org implementation.

Also note that -- unlike English -- Chinese sentences rarely use spaces
(if at all), so showing the space simply because the Org grammar needs
it seems unnatural.

However, I don't immediately see how to resolve the issue natively in
Org.  If we allow `?/' to italicize regardless of spaces, then things
like Unix paths would no longer work.

So, I came up with using LaTeX like this:

--8<---cut here---start->8---
任何一个章节可以通过增加例如 =TODO= 或者 =HOLD= 等关键词来被设置成\(\textit{待办}\)。
--8<---cut here---end--->8---

This has two drawbacks:
1. (network-related?) Delay.  Apparently HTML uses MathJax to render
LaTeX, and my browser experiences a 1-second delay due to it needing to
download JS code from MathJax and doing some processing.
2. Transferability.  This only resolves the issue of /italicization/.
What if I need to underscore or bold a piece of text (likely), or to add
an inline code block with CJK characters (unlikely)?  I would have to
search for how to do each in LaTeX and write the workaround accordingly,
instead of simply using the Org markup syntax for each of them.

Are there any other solutions than what I have currently?

-- 
Best,


RY



Re: [FR] Do not resolve relative "file" paths

2023-03-27 Thread General discussions about Org-mode.


Ihor Radchenko  writes:

> [...]
> You can customize `org-link-file-path-type'.

Thank you, this is exactly what I needed.  It is even able to convert my
previous absolute paths back to relative paths, which is great.

--
Best,


RY



[FR] Do not resolve relative "file" paths

2023-03-27 Thread General discussions about Org-mode.
Both Emacs and Org are on recent master commits.

Repro:

--8<---cut here---start->8---
$ cd $(mktemp -d)
$ mkdir 1
$ touch 2
$ emacs -L /org/lisp/ -Q 1/3.org
M-: emacs-repository-version RET
"db7e95531ac36ae842787b6c5f2859d0642c78cc"
M-x org-version RET
Org mode version 9.7-pre (release_9.6.1-321-g44e1cb @ 
/opt/src/emacs/packages/orgmode/main/lisp/)
C-c C-l file:../4 RET RET
[[file:/tmp/tmp.ztrbRDDtKy/4]]
C-c C-l file:../2 RET RET
[[file:/tmp/tmp.ztrbRDDtKy/2]]
--8<---cut here---end--->8---

Note that I showcased both ../4 and ../2 because it seems that the
referenced file does not need to exist.

I expect the links to be literally [[file:../4]] and [[file:../2]]
respectively.  This is helpful for me to reference other files
relatively (e.g., in a repository).

For example, since I am working on translating orgweb to zh_CN, I have
/zh_CN/index.org referencing /resources/img/xyz.svg, where after I do
`C-c C-l file:../resources/img/xyz.svg RET' inside /zh_CN/index.org, Org
resolves this link to an absolute path which is counterproductive and
does not work beyond my own computer.

--
Best,


RY



Re: orgmode website contributions to translations? -- Was: It's possible, to translate the org-mode website into Spanish?

2023-03-24 Thread General discussions about Org-mode.


Bastien Guerry  writes:

> Ihor Radchenko  writes:
>
>> The main issue with non-English translations is maintenance. As you
>> noticed, English and non-English pages are already out of sync.
>
> Anyone willing to help with orgmode.org website can get access to the
> https://git.sr.ht/~bzg/orgweb repository and help with translations too.
>
> Just let me know!   And thanks in advance.

I can help translate to zh_CN occasionally, seeing that the repo is not
updated too frequently.  Although I might need some pointers on how to
start a new translation, and how sourcehut works. :)

Also, does this need a copyright assignment?  FTR, I am still waiting
for a counter-signature from FSF on Emacs.

--
Best,


RY



Re: orgmode website contributions to translations? -- Was: It's possible, to translate the org-mode website into Spanish?

2023-03-24 Thread General discussions about Org-mode.


Ihor Radchenko  writes:

> Ruijie Yu  writes:
>
>> I can help translate to zh_CN occasionally, seeing that the repo is not
>> updated too frequently.  Although I might need some pointers on how to
>> start a new translation, and how sourcehut works. :)
>
> Just clone the repo from https://git.sr.ht/~bzg/orgweb and send patches
> to this mailing list as usual. See
> https://orgmode.org/worg/org-contribute.html
>
>> Also, does this need a copyright assignment?  FTR, I am still waiting
>> for a counter-signature from FSF on Emacs.
>
> AFAIK, yes. For the official Org page (not WORG), we require FSF
> copyright assignment.
>
> Note that FSF should usually reply within 5 working days. If not, you
> follow up once, wait another 5 working days, and then let us know - we
> can push them stronger.

Thanks, now I have cloned the repo locally.

While reading the files, there is one immediate issue I have found: on
current orgweb master (feed1160), line 153 of /index.org has a broken
link on how to contribute to worg.  Similarly, /ja/index.org has the
same broken link, whereas /fr/index.org has a different paragraph in its
place so no broken links there.

--
Best,


RY



Re: [RFC] Limit inline image width by default (was: feature request: easy embedding of images)

2023-03-23 Thread General discussions about Org-mode.


Small nit, in case you are about to install it.

> +It the actual width is too wide, limit it according to
> +~org-image-max-width~.

"It" -> "If".

--
Best,


RY



Re: 1 character fix to make ob-haskell compatible with table outputs

2023-03-21 Thread General discussions about Org-mode.


Oh, great to hear it's fixed!




Re: org-agenda on Mac M1

2023-03-16 Thread General discussions about Org-mode.
Henrik Frisk  writes:

> When I run org-agenda I get the sub menu but if I hit 'a' emacs hangs,
> though I can get it back if I hit C-g.  [...]
>
> I have no experience in debugging, but I tried to run debug-on-error
> with org-agenda and I got the following, which is not so helpful (to
> me):
>
> [...]
>
> Anyone else has a suggestion on a next step here?

What happens when you run `M-x toggle-debug-on-quit RET' right after you
run `emacs -Q', and do your usual steps to reproduce the issue?  That
might provide a more detailed backtrace for investigation.

In addition, what version of Emacs and of org are you using?  Posting
the results of these two commands would help a lot:
- `M-: emacs-repository-version RET'
- `M-x org-version RET'

--
Best,


RY



1 character fix to make ob-haskell compatible with table outputs

2023-03-14 Thread General discussions about Org-mode.


Just change the `[` and `]` to `(` and `)` respectively.

List of lists aren't parsed correctly by ob-haskell, but tuples of
tuples are.

That means this code change I just tested works:

(defun org-babel-haskell-var-to-haskell (var)
  "Convert an elisp value VAR into a haskell variable.
The elisp VAR is converted to a string of haskell source code
specifying a variable of the same value."
  (if (listp var)
  (concat "(" (mapconcat #'org-babel-haskell-var-to-haskell var ", ") ")")
(format "%S" var)))

For something like:

name:tbl
#+begin_src sh
echo -e "1\t2\t3"
#+end_src

#+RESULTS:
| 1 | 2 | 3 |

#+begin_src haskell :var table=tbl
print table
#+end_src

#+RESULTS:
| 1 | 2 | 3 |

Whereas before it would not print the table out because it isn't parsed 
correctly.




  1   2   3   >