Re: [PATCH] doc/org-manual.org: Checkboxes, add checkbox states examples

2023-11-07 Thread Sławomir Grochowski
Awesome!
Thank you Bastien.
I'm planning to add some examples with checkbox cookie data.

Regards,
Sławomir Grochowski

On Wed, Nov 8, 2023 at 12:37 AM Bastien Guerry  wrote:

> Sławomir Grochowski  writes:
>
> >> Applied, with a minor modification, using 1. instead of 1) for the
> >> list items.
> >
> > When will you merge the patch? https://git.savannah.gnu.org/cgit/
> > emacs/org-mode.git/
>
> Done now.
>
> > And when update will be visible on site https://orgmode.org/org.html#
> > Checkboxes ?
>
> When we release the main branch as a new stable version of Org, so not
> so soon.
>
> Best,
>
> --
>  Bastien Guerry
>


Re: [PATCH] doc/org-manual.org: Checkboxes, add checkbox states examples

2023-11-07 Thread Bastien Guerry
Sławomir Grochowski  writes:

>> Applied, with a minor modification, using 1. instead of 1) for the
>> list items.
>
> When will you merge the patch? https://git.savannah.gnu.org/cgit/
> emacs/org-mode.git/

Done now.

> And when update will be visible on site https://orgmode.org/org.html#
> Checkboxes ?

When we release the main branch as a new stable version of Org, so not
so soon.

Best,

-- 
 Bastien Guerry



Re: Issue with org-persist and Tramp

2023-11-07 Thread Antonio Carlos Padoan Junior
Hello Fabio,

Fabio Natali  writes:

> Hi,
>
> I seem to be having an issue with org-persist and Tramp which is close
> to what discussed in this thread:
>
> https://lists.gnu.org/archive/html//emacs-orgmode/2022-05/msg00720.html
>
> - I open a Org file on a remote machine, via Tramp.
> - The SSH connection dies.
> - I try to kill the stale buffer with kill-buffer and from IBuffer.
> - The buffer is not killed, instead Emacs hangs for a while while still
>   trying to connect to the old SSH connection.
> - The buffer becomes sentient and gains immortality... either that or I

I was intrigued by the same issue. My workaround is to save the buffer
locally (perhaps in /tmp). This action releases the buffer. I think this
behavior is probably intended to avoid loosing "local" work after the ssh
connection dies, but who knows...  

Anyway, if there is any other workaround I would be interested as well.

BR,
-- 
Antonio Carlos PADOAN JUNIOR
GPG fingerprint:
243F 237F 2DD3 4DCA 4EA3  1341 2481 90F9 B421 A6C9



Re: [PATCH] doc/org-manual.org: Checkboxes, add checkbox states examples

2023-11-07 Thread Sławomir Grochowski
> Applied, with a minor modification, using 1. instead of 1) for the
> list items.

When will you merge the patch?
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/
And when update will be visible on site
https://orgmode.org/org.html#Checkboxes ?

Regards,
Sławomir Grochowski


On Mon, Nov 6, 2023 at 5:49 PM Bastien  wrote:

> Hi Sławomir,
>
> Sławomir Grochowski  writes:
>
> > I have added some examples to the org-manual.
> > Patch in attachment and also a screenshot of generated html.
>
> Applied, with a minor modification, using 1. instead of 1) for the
> list items.
>
> I added you as a contributor on
> https://orgmode.org/worg/contributors.html
>
> Thanks!
>
> --
>  Bastien
>


Re: Exporting Hyperlinks ?

2023-11-07 Thread Max Nikulin

On 07/11/2023 19:36, Ihor Radchenko wrote:

Max Nikulin writes:


Cross-links between files work.


This is interesting. I am wondering if it is document (it should...).


file:///usr/share/doc/texlive-doc/latex/hyperref/hyperref-doc.pdf#section.6
or
file:///usr/share/doc/texlive-doc/latex/hyperref/hyperref-doc.pdf#page.23
with default counter-based LaTeX anchors or browser-specific
file:///usr/share/doc/texlive-doc/latex/hyperref/hyperref-doc.pdf#page=23


If \href{file.pdf#anchor} can work, we should indeed use it when
publishing org->pdf.


It would be nice to have a LaTeX package that redefines \label to 
generated \hypertarget from its argument.


Ideally, xr-hyper workflow should be supported as well. A downside is 
anchors are not stable and unrelated to labels.


P.S. (info "(org) Publishing")
declares that conversion to PDF is supported.





Re: [PATCH] Fix org-[beginning|end]-of-line with arguments

2023-11-07 Thread Tomohisa Kuranari
Thank you for your detailed review and the merge of my patch.
I’m so glad to contribute to org-mode!

-- 
Tomohisa Kuranari
Email: tomohisa.kuran...@gmail.com



Re: Gantt Chart with org-mode

2023-11-07 Thread Ken Mankoff
And Mermaid with ob-mermaid.

https://mermaid.js.org/syntax/gantt.html

  -k.

Please excuse brevity. Sent from tiny pocket computer with non-haptic
feedback keyboard.

On Sun, Nov 5, 2023, 05:08 Christophe Schockaert 
wrote:

> On 2023-11-04 13:30, Heime wrote:
> > Can one construct a Gantt Chart with org-mode ?
>
> Although I didn’t try it yet, there is Elgantt hat caught my eyes :
> https://github.com/legalnonsense/elgantt
>
> Have a good day and nice Org discoveries,
> Christophe
>
>


Issue with org-persist and Tramp

2023-11-07 Thread Fabio Natali
Hi,

I seem to be having an issue with org-persist and Tramp which is close
to what discussed in this thread:

https://lists.gnu.org/archive/html//emacs-orgmode/2022-05/msg00720.html

- I open a Org file on a remote machine, via Tramp.
- The SSH connection dies.
- I try to kill the stale buffer with kill-buffer and from IBuffer.
- The buffer is not killed, instead Emacs hangs for a while while still
  trying to connect to the old SSH connection.
- The buffer becomes sentient and gains immortality... either that or I
  restart Emacs, which is clearly a big no-no. :D

Looking at the backtrace, it looks like the kill operation insists on
calling org-persist-write-all-buffer, which in turn seems to be calling
Tramp and therefore SSH to the now unreachable machine.

More context:

- The SSH process is now gone, no trace of its original process.
- I've tried all combinations of tramp-cleanup-* commands, with no luck.
- I'm on Emacs 29.1 and Org 9.6.9.
- The default value of org-persist-remote-files seems to be 100.

Is there any org-persist-related setting that I should include in my
init.el? Anything that I might be missing here?

Thanks for your help, cheers, Fabio.



Re: Exporting Hyperlinks ?

2023-11-07 Thread Ihor Radchenko
Max Nikulin  writes:

> I just have tried
>
> file-a.tex:
>
> \documentclass{article}
> \usepackage{hyperref}
> \begin{document}
> A 1
>
> \href{file-b.pdf#b-2}{b-2 in file b}
> \newpage
> \section{Section in A}
> \hypertarget{a-2}{}A 2
> \end{document}
>
> file-b.tex:
>
> \documentclass{article}
> \usepackage{hyperref}
> \begin{document}
> B 1
>
> \href{file-a.pdf#a-2}{a-2 in file a}
> \newpage
> \section{Section in B}
> \hypertarget{b-2}{}B 2
> \end{document}
>
> Cross-links between files work.

This is interesting. I am wondering if it is document (it should...).

If \href{file.pdf#anchor} can work, we should indeed use it when
publishing org->pdf.

In particular, we can introduce something similar to
`org-html-link-org-files-as-html', but for pdf export.

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



Re: Exporting Hyperlinks ?

2023-11-07 Thread Max Nikulin

On 06/11/2023 16:37, Ihor Radchenko wrote:

David Masterson writes:


[[file:test.pdf::#anchor][Another document]]
-> \href{test.pdf\#anchor}{Another document}


AFAIK, this kind of URL cannot be opened except when opening pdf in
browser.


What else is there?  PDFviewer?  What is the standard for Latex?


Yes, PDFviewer.
AFAIU, it is only possible to refer to a specific page:
\href[page=X]{test.pdf}
https://tex.stackexchange.com/questions/675130/open-an-external-pdf-file-on-a-specific-page


Ihor, sorry, but your point is not clear for me. I am unaware of 
portable way to open PDF file at specific page or create a link namely 
to a page, but links to anchors work e.g. in xpdf-3 (xpopple) and okular.


https://list.orgmode.org/tevj61$17d8$1...@ciao.gmane.io/
Re: Org mode links: Open a PDF file at a given page and highlight a 
given string. Sat, 3 Sep 2022 20:00:47 +0700


(Side note: I have no idea what "standard for LaTeX" may mean, there are 
plenty of PDF viewers, browsers are usually installed any way, so no 
additional applications required.)


I just have tried

file-a.tex:

\documentclass{article}
\usepackage{hyperref}
\begin{document}
A 1

\href{file-b.pdf#b-2}{b-2 in file b}
\newpage
\section{Section in A}
\hypertarget{a-2}{}A 2
\end{document}

file-b.tex:

\documentclass{article}
\usepackage{hyperref}
\begin{document}
B 1

\href{file-a.pdf#a-2}{a-2 in file a}
\newpage
\section{Section in B}
\hypertarget{b-2}{}B 2
\end{document}

Cross-links between files work.



Re: [RFC][PATCH v2] Allow to export to ascii custom link types as notes

2023-11-07 Thread Ihor Radchenko
Max Nikulin  writes:

>> What about passing an extra argument to :export function in
>> `org-export-custom-protocol-maybe':
>> 
>> (funcall protocol path desc backend info *link-object*)
>
> It would require another iteration with `condition-case' to deal with 
> functions having old signature.

Is it a problem?
We can alternatively check function arity.

> Earlier you considered :filter property that receives link object 
> instead of path and desc pair. I am unsure concerning name, but I like 
> that idea.

I feel that :filter + :export will be rather redundant - they will do
the same thing and only differ by calling convention. And we will have
issues with priority of :filter vs. :export if both happen to be
present (e.g. when a user defines a custom :export in personal config).

I guess we may instead make :filter apply earlier, right after
`org-export-filter-parse-tree-functions'. Then, it will be called before
export transcoding process begins.

>> Then, if the :export function returns non-string, the return value is
>> further processed as (org-export-data *return-value* info).
>
> Do you mean something like the following?
>
> (defun org-man-export (link description backend)
>"Export a man page LINK with DESCRIPTION.
> BACKEND is the current export backend."
>(org-element-create-link
> (format "http://man.he.net/?topic=%s=all; link)
> description))
>
> where org-element-create-link parses link target into :type, :raw-link, 
> etc. properties.

Yes.

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



Re: [RFC][PATCH v2] Allow to export to ascii custom link types as notes

2023-11-07 Thread Max Nikulin

On 07/11/2023 16:30, Ihor Radchenko wrote:

Max Nikulin writes:

What about passing an extra argument to :export function in
`org-export-custom-protocol-maybe':

(funcall protocol path desc backend info *link-object*)


It would require another iteration with `condition-case' to deal with 
functions having old signature.


Earlier you considered :filter property that receives link object 
instead of path and desc pair. I am unsure concerning name, but I like 
that idea.



Then, if the :export function returns non-string, the return value is
further processed as (org-export-data *return-value* info).


Do you mean something like the following?

(defun org-man-export (link description backend)
  "Export a man page LINK with DESCRIPTION.
BACKEND is the current export backend."
  (org-element-create-link
   (format "http://man.he.net/?topic=%s=all; link)
   description))

where org-element-create-link parses link target into :type, :raw-link, 
etc. properties.






Re: [BUG] Tangle with symbolic links don't work

2023-11-07 Thread Ihor Radchenko
Max Nikulin  writes:

>> Max, do you see any pitfalls using `file-truename'?
>
> Sorry, I am not familiar with related code path. That is why I can not 
> reason what way to deal with file name is safer.
>
> If there is a world-writable directory in the file path (usually 
> $TMPDIR) then `file-truename' is less safe, see 
> https://www.kernel.org/doc/html/latest/admin-guide/sysctl/fs.html#protected-symlinks

Thanks!

> In general, I am never sure that Org code follows best practices in 
> respect to security in general and in respect to /tmp in particular. The 
> following citation is unrelated to /tmp, but the same proposed patch has 
> an issue with predictable name in /tmp:

We have to compromise between usability and safety... but probably not
in this case.

> Even when /tmp or similar directories are not involved, a proper 
> strategy to replace file content should be carefully chosen. E.g. cp(1) 
> preserves inode number while install(1) replaces target file atomically 
> (create a temporary one and rename). The latter way is more suitable for 
> shared libraries since it allows running application to continue call 
> function from the deleted file.

What we actually use is Elisp API. For export and tangling, we use
`write-region' - it correctly handles TRAMP files with lower-level
details taken care of.

I can now see that blindly expanding to `file-truename' may not be wise.

Without `file-truename', the difference between ox.el (that works for
Cletip) and ob-tangle.el is that ob-tangle explicitly deletes the tangle
target before tangling:

`org-babel-tangle':

 ;; erase previous file
 (when (file-exists-p file-name)
   (delete-file file-name))
 (write-region nil nil file-name)
 (mapc (lambda (mode) (set-file-modes file-name mode)) 
modes)

Rather than using `file-truename', we may instead remove the
`delete-file' part. This way, we will not risk changing file modes in
the original files and always modify the symlink, if the tangle target
is an existing symlink.

> I know, it is not an answer you expected from me, but giving a better 
> one require to much efforts to read the code and to debug it.

It is exactly an answer I expected, actually :)

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



Re: [BUG] Tangle with symbolic links don't work

2023-11-07 Thread Max Nikulin

On 06/11/2023 23:17, Ihor Radchenko wrote:

Cletip Cletip writes:


I have an Org file, test.org, from which I tangle code blocks into test.py.
The complication arises because test.py is a symbolic link.


I suggest to change your workflow to not depend on particular means to 
write tangled files. Perhaps you may set tangle directory. Unfortunately 
the description is too concise to figure out if it would be convenient 
enough.



Max, do you see any pitfalls using `file-truename'?


Sorry, I am not familiar with related code path. That is why I can not 
reason what way to deal with file name is safer.


If there is a world-writable directory in the file path (usually 
$TMPDIR) then `file-truename' is less safe, see 
https://www.kernel.org/doc/html/latest/admin-guide/sysctl/fs.html#protected-symlinks


echo content >/home/ubuntu/tmp/file.txt
ls -l /home/ubuntu/tmp/file.txt
-rw-r--r-- 1 ubuntu ubuntu 8 Nov  7 17:29 /home/ubuntu/tmp/file.txt

ls -l /tmp/ln
lrwxrwxrwx 1 test test 25 Nov  7 17:10 /tmp/ln -> /home/ubuntu/tmp/file.txt

Notice different owner of the symlink.

echo overwrite >/tmp/ln
bash: /tmp/ln: Permission denied

cat /home/ubuntu/tmp/file.txt
content

`file-truename':

echo overwrite>"$(readlink -f /tmp/ln)"
cat /home/ubuntu/tmp/file.txt
overwrite

/usr/sbin/sysctl fs.protected_symlinks
fs.protected_symlinks = 1

In general, I am never sure that Org code follows best practices in 
respect to security in general and in respect to /tmp in particular. The 
following citation is unrelated to /tmp, but the same proposed patch has 
an issue with predictable name in /tmp:


Visuwesh… Re: [BUG] [PATCH] Add yank-media and DND handler. Wed, 27 Sep 
2023 13:59:49 +0530. https://list.orgmode.org/878r8sj9xe@gmail.com

That would be quite annoying IMO.  I say we let the user shoot
themselves in the foot.


Even when /tmp or similar directories are not involved, a proper 
strategy to replace file content should be carefully chosen. E.g. cp(1) 
preserves inode number while install(1) replaces target file atomically 
(create a temporary one and rename). The latter way is more suitable for 
shared libraries since it allows running application to continue call 
function from the deleted file.


I know, it is not an answer you expected from me, but giving a better 
one require to much efforts to read the code and to debug it.




Re: [PATCH] Fix org-[beginning|end]-of-line with arguments

2023-11-07 Thread Ihor Radchenko
Bastien Guerry  writes:

>>> Finally, the copyright assignment process was completed on 2023/09/20.
>>
>> Bastien, may you please check FSF records?
>
> Done, I confirm Tomohisa Kuranari's record is okay.

Thanks for checking.
Now, I can apply the patch.

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

Tomohisa is also now listed as an Org contributor.
https://git.sr.ht/~bzg/worg/commit/334d3b28

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



Re: [PATCH] Fix org-[beginning|end]-of-line with arguments

2023-11-07 Thread Bastien Guerry
Ihor Radchenko  writes:

> Tomohisa Kuranari  writes:
>
>> Finally, the copyright assignment process was completed on 2023/09/20.
>
> Bastien, may you please check FSF records?

Done, I confirm Tomohisa Kuranari's record is okay.

-- 
 Bastien Guerry



Re: [PATCH] Fix org-[beginning|end]-of-line with arguments

2023-11-07 Thread Ihor Radchenko
Tomohisa Kuranari  writes:

> Finally, the copyright assignment process was completed on 2023/09/20.

Bastien, may you please check FSF records?

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



Re: [RFC][PATCH v2] Allow to export to ascii custom link types as notes

2023-11-07 Thread Ihor Radchenko
Max Nikulin  writes:

> `cons' is made an implementation detail, however completely opaque 
> structure is an obstacle for derived export backend. Perhaps getter 
> functions should be introduced as well.

I am looking at this again and the approach with special return values
really feels like a kludge.

What about passing an extra argument to :export function in
`org-export-custom-protocol-maybe':

(funcall protocol path desc backend info *link-object*)

Then, if the :export function returns non-string, the return value is
further processed as (org-export-data *return-value* info).

This way, we can transparently return an https link in ol-man's
`org-man-export' that will be handled automatically taking into account
the ASCII inline note settings.

All the existing export backends will continue working without
modification.

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



Re: [BUG] `org-element-at-point-no-context' error in flyspell `org-mode-flyspell-verify'

2023-11-07 Thread Ihor Radchenko
"Christopher M. Miles"  writes:

> I got following error:
>
> #+begin_example
> Please report this to Org mode mailing list (M-x org-submit-bug-report).
> ⛔ Warning (org-element-cache): org-element--cache: Org parser error in 
> Code.org::434180. Resetting.
>  The error was: (wrong-number-of-arguments ((t) nil "Return outline-regexp 
> with limited number of levels.
> The number of levels is controlled by `org-inlinetask-min-level'." (cond 
> ((not (derived-mode-p 'org-mode)) outline-regexp) ((not (featurep 
> 'org-inlinetask)) org-outline-regexp) (t (let* ((limit-level (1- 
> org-inlinetask-min-level)) (nstars (if org-odd-levels-only (1- (* limit-level 
> 2)) limit-level))) (format "\\*\\{1,%d\\} " nstars) 1)

This complains about too many arguments (1) in
`org-get-limited-outline-regexp'.

On main, `org-get-limited-outline-regexp' can accept an optional
argument, but it is not the case in the built-in Org mode.
I suspect some problem with mixed installation.

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



Re: [BUG] `org-todo` [C-c C-t] got error (args-out-of-range # 0 48016)

2023-11-07 Thread Ihor Radchenko
"Christopher M. Miles"  writes:

> Debugger entered--Lisp error: (args-out-of-range # 0 
> 48016)
>   replace-match("")

This does not ring any bells.
Do you have a reproducer?

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



Re: bash source code block: problem after ssh commands

2023-11-07 Thread Ihor Radchenko
Matt  writes:

>   On Mon, 06 Nov 2023 14:32:16 +0100  Ihor Radchenko  wrote --- 
>  > I am wondering about the possible downsides of using script approach
>  > instead of stdin redirection.
>  
> I'm curious to hear more about what you're thinking.

I am thinking to change the
  (t (org-babel-eval shell-file-name (org-trim body)))
clause in `org-babel-sh-evaluate' to something that uses a script file.

It will clearly solve the discussed problem, possibly at the cost of
small overhead to write the script file to disk.

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



Re: [bug] org-priority-up on a line with a link puts the cookie in org-link face

2023-11-07 Thread Ihor Radchenko
Samuel Wales  writes:

> i am on recent bugfix but this has been around forever.
>
>   * [[https://forums.whatever][MCAS and Omalizumab]]
>
> when i raise the priority from none to [#A], often or always the
> cookie is in link face also.

I am unable to reproduce.

> for unrelated reasons, i haven't set up an untainted reproducer, so
> this is a merely hoping others have seen this behavior report.

Nobody else confirmed this for over a month. Closing.
Canceled.

I can do nothing without a reproducer, unfortunately.

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