Re: How to organize tasks about Worg within Worg documents

2024-04-01 Thread Adam Porter

On 4/1/24 06:34, Ihor Radchenko wrote:


What we may do is the following:
1. Make sure that we stick to the recommended todo keywords, so that
todo keywords have a known-in-advance class in html export.
2. Put notes into LOGBOOK drawers (set `org-log-into-drawer' in WORG
dirlocals)
3. Change `org-html-format-drawer-function' during publishing to mark
the LOGBOOK drawers with a distinct class.
4. Enable org-inlinetask library during publishing.

Then, the CSS switch will involve toggling visibility of (1) todo
keyword classes; (2) inlinetask class; (3) LOGBOOK drawer class.


Sounds good to me!



Re: [BUG] (org-element-context) caused (re-search-forward ) + (match-string-no-properties 1) returned matched data wrong

2024-04-01 Thread Ihor Radchenko
"Christopher M. Miles"  writes:

> Re: [BUG] (org-element-context) caused (re-search-forward ) + 
> (match-string-no-properties 1) returned matched data wrong

`org-element-context' does not guarantee that match data is not altered.
You need to wrap it into `save-match-data' if necessary.
:

org-element-context is an autoloaded and natively compiled function
defined in org-element.el.

...
This function may modify match data.

Not a bug.
Canceled.

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



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

2024-04-01 Thread Ihor Radchenko
Ihor Radchenko  writes:

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

No objections.
Applied, onto main, adding ORG-NEWS entry.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=ce5e8ecbb
I also updated org-syntax reference to clarify about this edge case.
https://git.sr.ht/~bzg/worg/commit/f0323698

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



Re: [PATCH] lisp/org-capture.el: Simplify 'org-capture-get-indirect-buffer'

2024-04-01 Thread Ihor Radchenko
Morgan Smith  writes:

> * lisp/org-capture.el (org-capture-get-indirect-buffer): Simplify by
> using 'generate-new-buffer-name'.
> ...
> -  (let ((n 1) (base (buffer-name buffer)) bname)
> -(setq bname (concat prefix "-" base))
> -(while (buffer-live-p (get-buffer bname))
> -  (setq bname (concat prefix "-" (number-to-string (cl-incf n)) "-" 
> base)))
> +  (let ((bname (generate-new-buffer-name (concat prefix "-" (buffer-name 
> buffer)

Thanks, but this is potentially backwards-incompatible.

`generate-new-buffer-name' following a different naming scheme compared
to the current implementation of `org-capture-get-indirect-buffer':
CAPTURE--foo.org vs. CAPTURE-foo.org

Different naming scheme may potentially break user customization in
`display-buffer-alist'.

The change is not justified.
Canceled.

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



Re: How to organize tasks about Worg within Worg documents

2024-04-01 Thread Ihor Radchenko
Adam Porter  writes:

>> May we have some kind of css-based toggle that will enable "developer
>> mode", revealing all the todo keywords, inlinetasks, and notes? Then, we
>> hide the "unfinished" parts from users by default, but let them see what
>> can be contributed?
>
> I like the idea of a visual toggle very much, so I'm certainly in favor 
> of that.
>
> I'm not sure that we must have a constraint on the way TODOs are 
> written, but having some limitations on or conventions about it might 
> make such a visual toggle easier to implement (as well as other tools 
> one might use to collect and visualize tasks across the project).

What we may do is the following:
1. Make sure that we stick to the recommended todo keywords, so that
   todo keywords have a known-in-advance class in html export.
2. Put notes into LOGBOOK drawers (set `org-log-into-drawer' in WORG
   dirlocals)
3. Change `org-html-format-drawer-function' during publishing to mark
   the LOGBOOK drawers with a distinct class.
4. Enable org-inlinetask library during publishing.

Then, the CSS switch will involve toggling visibility of (1) todo
keyword classes; (2) inlinetask class; (3) LOGBOOK drawer class.

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



Re: [PATCH] Unit tests for function calling MathML converters (Re: Warn about shell-expansion in the docstring of org-latex-to-html-convert-command)

2024-04-01 Thread Ihor Radchenko
Max Nikulin  writes:

>> I have a concern about this test - it will not work on windows or in
>
> I do not mind to add
>
> (skip-unless (not (memq system-type '(ms-dos windows-nt
>
>> non-standard system shells. We should probably disable the test unless
>> "printf" can be evaluated in the current system shell.
>
> POSIX printf is more portable than "echo". Anyway Makefile expects a 
> POSIX compatible shell. So I believe, it is developer responsibility to 
> run build and test with a sane shell even if they prefer something 
> unusual as the interactive shell.

Agree.
Applied, onto main, after adding skip-unless.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=a3bcb5536

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



Re: Warn about shell-expansion in the docstring of org-latex-to-html-convert-command

2024-04-01 Thread Ihor Radchenko
Max Nikulin  writes:

>> I have incorporated the above suggestions into the attached version of
>> the patch.
>
> Thanks, I have not tried the updated patch in action, but it looks like 
> what I expect.

> I would consider explicit mention of stripping quotes
> ...

I incorporated your suggestions and applied the updated version of the
patch.
Fixed, on main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=a698d073a

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



Re: [BUG] Partially broken Org mode when remote setupfile is unavailable

2024-04-01 Thread Ihor Radchenko
Max Nikulin  writes:

>> This part is now addressed by
>> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=4255d5dcc
>
> You are right that a workaround with `org-file-remote-p' would not help. 
> On the other hand I can reproduce the issue with Emacs-28 and the error 
> happens in `org--collect-keywords-1' due to the `expand-file-name' call. 
> That is why I can not agree that it is addressed.

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

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



Re: [BUG] org-export-table-row-number off by one when special row present [9.6.23 ( @ /home/jet/.config/emacs/elpa/org-9.6.23/)]

2024-04-01 Thread Ihor Radchenko
Jeff Trull  writes:

> Consider this table:
>
> ...
> org-export-table-row-number correctly returns 3 for the cell containing '4'
> (and the target of the formula)
>
> Now add a column alignment row:
>
> ...
> |  ||
> ...

> org-export-table-row-number still returns 3 for the same cell, despite
> the extra row. I think this is inconsistent with the documentation of
> the function, which implies that only separator lines are considered
> when determining the count. Also note that from a user perspective,
> special rows (but not separators) are part of the row count.

During export, table may be not the same as it appears in the original
document - some rows may be omitted. `org-export-table-row-number'
returns the coordinates in as-exported table, not in the original table.

> I did some initial investigation and determined that org-element-map is
> used to count the row numbers, and special rows are ignored in that
> function.

`org-element-map' by itself does not ignore special rows. It only
ignores the AST elements that are marked to be ignored. In your example,
with many built-in exporters, alignment rows are omitted from the export
and thus `org-export-table-row-number' intentionally ignores them.

So, there is no bug here.

Or may it be that you encountered a different, more specific, problem?

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



Re: [PATCH] Unit tests for function calling MathML converters (Re: Warn about shell-expansion in the docstring of org-latex-to-html-convert-command)

2024-04-01 Thread Max Nikulin

On 31/03/2024 15:27, Ihor Radchenko wrote:

Max Nikulin writes:


+(ert-deftest test-org/format-latex-as-html ()
+  "Test shell special characters escaping in `org-format-latex-as-html'."
+  (let ((org-latex-to-html-convert-command
+ "printf \"\" %i"))


I have a concern about this test - it will not work on windows or in


I do not mind to add

   (skip-unless (not (memq system-type '(ms-dos windows-nt


non-standard system shells. We should probably disable the test unless
"printf" can be evaluated in the current system shell.


POSIX printf is more portable than "echo". Anyway Makefile expects a 
POSIX compatible shell. So I believe, it is developer responsibility to 
run build and test with a sane shell even if they prefer something 
unusual as the interactive shell.






Re: Warn about shell-expansion in the docstring of org-latex-to-html-convert-command

2024-04-01 Thread Max Nikulin

On 31/03/2024 15:25, Ihor Radchenko wrote:

Max Nikulin writes:


I think it is in the right direction.
- Manual needs update as well.
- I would explicitly stress that quotes causes undefined or even
dangerous behavior. See e.g. the last paragraph
https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s07.html


I have incorporated the above suggestions into the attached version of
the patch.


Thanks, I have not tried the updated patch in action, but it looks like 
what I expect.



+++ b/etc/ORG-NEWS
@@ -13,6 +13,16 @@ Please send Org bug reports to mailto:emacs-orgmode@gnu.org.
 
 * Version 9.7 (not released yet)

 ** Important announcements and breaking changes
+*** ~org-latex-to-mathml-convert-command~ and 
~org-latex-to-html-convert-command~ shell-escape LaTeX code
+
+Previously, ~org-latex-to-mathml-convert-command~ and
+~org-latex-to-html-convert-command~ replaced %i placeholders with raw
+LaTeX fragment text, potentially triggering shell-expansion.
+
+Now, the %i placeholders are shell-escaped to prevent shell expansion.
+
+The existing customizations that assume no shell-escaping must be updated.
+


I would consider explicit mention of stripping quotes

+Previously, =%i= placeholders in the ~org-latex-to-mathml-convert-command~
and ~org-latex-to-html-convert-command~ user options were replaced
with raw LaTeX fragment text, potentially triggering shell-expansion
and incorrect result.

Now, the =%i= placeholders are shell-escaped to prevent shell expansion.

If you have single or double quotes around =%i= then update
customizations and remove quotes.





Re: [BUG] Partially broken Org mode when remote setupfile is unavailable

2024-04-01 Thread Max Nikulin

On 30/03/2024 17:02, Ihor Radchenko wrote:

Ihor Radchenko writes:


Unexpected errors:
- When point is on any non-empty line, RET is broken

save-excursion: Wrong type argument: stringp, nil

- The link is not fontified (it is parsed properly however and even may
be opened).


This is because `file-remote-p' throws an error. I believe that it is
Emacs bug.
See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=68976


This part is now addressed by
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=4255d5dcc


You are right that a workaround with `org-file-remote-p' would not help. 
On the other hand I can reproduce the issue with Emacs-28 and the error 
happens in `org--collect-keywords-1' due to the `expand-file-name' call. 
That is why I can not agree that it is addressed.