Inconsistent text markup handling when double-nesting markers

2023-10-09 Thread Tom Alexander
I used the following test document:
```
__foo__

**foo**
```

I'd expect the two to behave the same but the first one parses as:
```
(paragraph
  "_"
  (subscript "foo")
  "__"
  )
```

Whereas the second parses as:
```
(paragraph
  (bold
(bold
  "foo"
  )
)
  )
```

This pattern happens in worg at [2]

Looking at the description for text markup in the syntax document[1], I don't 
see any reason the first wouldn't be parsed as an underline:

1. PRE: valid because it is the beginning of a line
2. MARKER: valid underscore
3. CONTENTS: valid. Series of objects from standard set includes both subscript 
and text markup, so regardless of how we parse the interior, its valid. Also 
cannot begin or end with whitespace but there is no whitespace in the CONTENTS.
4. MARKER: valid underscore
5. POST: Only valid if we extend the underline to the 2nd underscore so it ends 
at the end of the line. But the 2nd line shows us that having copies of the 
marker inside the CONTENTS is fine so I see two possible expected parses of the 
CONTENTS:
4a. (underline "foo")
4b. ((subscript "foo") (plain-text "_"))

I also ran the following test document to further prove that having copies of 
the marker inside the CONTENTS is fine:
```
*foo*bar*
```
which parses as (bold "foo*bar")

So the only way the top line would fail to parse as an underline is if it 
matched the first closing underscore as closing the underline, but that would 
be invalid because underscore is not a valid POST character and invalid copies 
of the closing marker are ignored as proven by both "**foo**" and "*foo*bar*".


[1] https://orgmode.org/worg/org-syntax.html#Emphasis_Markers
[2] 
https://git.sr.ht/~bzg/worg/tree/ba6cda890f200d428a5d68e819eef15b5306055f/org-contrib/babel/intro.org#L117

--
Tom Alexander
pgp: https://fizz.buzz/pgp.asc



Event management

2023-10-09 Thread Rainer Hansen
Hi,

I wonder if somebody has used Org mode to plan and manage a webinar
where all participants register via LinkedIn?

I am running a webinar together with a friend. She will be the main
presenter and I will be the host and invite people to the webinar and
make people aware of it, which includes sending reminders etc. As Org
Mode is my working horse I try to do the event management with it.

The event is managed via LinkedIn:
https://www.linkedin.com/events/communicatesuccessfullyininterv7115081313199509504/

but it is difficult to keep track of who has recently signed-up in
LinkedIn. I can only see the complete list of people having
signed-up. Therefore I use Firefox and the extension Copy as Org-Mode to
copy the participant lists into Org Mode manually. In Org Mode I can
finally sort them after I have done a lot of manual cleaning ... Then I
can track in Org Mode to whom I have sent a reminder or a question and
if I have got feedback.

I wonder if anyone has used Org Mode to organize an LinkedIn event where
he was not the LinkedIn event organizer. Have you found a good way to
reduce the manual cleaning?

Regards,
Rainer

P.S. In case anyone wonders, the event is about commnunication styles
and how to use them to be more successful in interviews or other
situations when you don't know the other person very well ...




Logging previous SCHEDULED property before changing TODO state of a habit

2023-10-09 Thread Ilya Chernyshov


Hi.

Is there anything I can do with my Org config so that every time I
change the TODO state of my habit (example below), Org logs inactive
timestamp from SCHEDULED property before TODO state change?

For example, I have this habit, which I have been forgetting to mark as
DONE/MISSED/WHATEVER for the past several days:


* TODO heading
SCHEDULED: <2023-10-05 Thu +1d>
:PROPERTIES:
:CREATED:  [2023-10-01 Sun 01:25]
:END:


Now, I want Org to log when I done the task and when I missed it, but
instead it inserts the timestamp of current time:


* TODO heading
SCHEDULED: <2023-10-08 Sun +1d>
:PROPERTIES:
:CREATED:  [2023-10-01 Sun 01:25]
:LAST_REPEAT: [2023-10-10 Tue 02:08]
:END:
:LOGBOOK:
- State "DONE"   from "TODO"   [2023-10-10 Tue 02:08]
- State "MISSED" from "TODO"   [2023-10-10 Tue 02:08]
- State "DONE"   from "TODO"   [2023-10-10 Tue 02:08]
:END:


What I want to get instead is:


* TODO heading
SCHEDULED: <2023-10-08 Sun +1d>
:PROPERTIES:
:CREATED:  [2023-10-01 Sun 01:25]
:LAST_REPEAT: [2023-10-10 Tue 02:08]
:END:
:LOGBOOK:
- State "DONE"   from "TODO"   [2023-10-08 Sun]
- State "MISSED" from "TODO"   [2023-10-07 Sat]
- State "DONE"   from "TODO"   [2023-10-06 Fri]
:END:


It would be awesome, if there was a placeholder in org-log-note-headings
(for example "%e") that is replaced with previous SCHEDULED
timestamp. Can we do that? Or is there a better option to achieve that?



Re: org beamer strange behaviour

2023-10-09 Thread Guillaume MULLER



On 10/9/23 17:09, Fraga, Eric wrote:

I haven't looked at your file but do consider running org-lint on the
file to see if it picks up anything.


Thanks! I didn't know about org-lint!!!

Running it, I got these "errors":
   221 low   Unknown source block language: 'latex'
   252 low   Unknown source block language: 'bibtex'
   268 low   Unknown source block language: 'latex'
   282 low   Unknown source block language: 'sh'
   329 low   Unknown source block language: 'bibtex'
   434 low   Unknown source block language: 'latex'

...which is very strange as I have the following lines in my config.org file:

  ;; sh code in org-mode!
  (setq org-babel-sh-command "bash")
  (org-babel-do-load-languages
   'org-babel-load-languages
   '((shell . t))) ; this line activates Bash

  ;; LaTeX code in org-mode!
  (org-babel-do-load-languages
   'org-babel-load-languages
   '((latex . t))) ; this line activates LaTeX


I also define lstlisting "keywords" for bibtex in the header (taken from some 
StackOverflow thread; removing it does not change anything):

#+BEAMER_HEADER: \def\BibTeX{Bib\TeX{}}
#+BEAMER_HEADER:\lstdefinelanguage{BibTeX}
#+BEAMER_HEADER: {keywords={%
#+BEAMER_HEADER:  
@article,@book,@collectedbook,@conference,@electronic,@ieeetranbstctl,%
#+BEAMER_HEADER:  
@inbook,@incollectedbook,@incollection,@injournal,@inproceedings,%
#+BEAMER_HEADER:  
@manual,@mastersthesis,@misc,@patent,@periodical,@phdthesis,@preamble,%
#+BEAMER_HEADER:  @proceedings,@standard,@string,@techreport,@unpublished%
#+BEAMER_HEADER:  },
#+BEAMER_HEADER:   comment=[l][\itshape]{@comment},
#+BEAMER_HEADER:   sensitive=false,
#+BEAMER_HEADER: }

And org is supposed to use lstlisting to render the blocks (also in my 
config.org):
(after! org
  (setq org-latex-src-block-backend 'listings) ;; not always the best choice, 
but prevent DoomEmacs to go Berzerck (ask file to save to everytime) when using 
lstlistings-specific commands in org/beamer files
  ;;(setq org-export-allow-bind-keywords 1) ;; allows binding of emacs/lisp 
vars directly in .org files VERY INSECURE!!!
)



--
Guillaume MULLER


OpenPGP_0xF3BCAD9F46F5FADC.asc
Description: OpenPGP public key


OpenPGP_signature.asc
Description: OpenPGP digital signature


Re: org beamer strange behaviour

2023-10-09 Thread Fraga, Eric
I haven't looked at your file but do consider running org-lint on the
file to see if it picks up anything.

-- 
: Eric S Fraga, with org release_9.6.6-418-g294a4d in Emacs 30.0.50


org beamer strange behaviour

2023-10-09 Thread Guillaume MULLER

Hi,

I'm writing a lot of my courses in Org with a final export to Beamer/PDF.

Recently, I tried to improve the slides for a course I gave last year. When I 
opened the org file, I got a very weird coloring, as if a section was not 
closed correctly. You can find the org file and a screenshot of the rendering 
here:
https://seafile.emse.fr/d/f689a4318aff4e12a72e/

What's VERY strange to me is that whatever (sub)sections of the org original 
file I extract and yank/paste in another org file, then everything is OK...

Any idea what could be wrong?

--
Guillaume MULLER


OpenPGP_0xF3BCAD9F46F5FADC.asc
Description: OpenPGP public key


OpenPGP_signature.asc
Description: OpenPGP digital signature


Re: Bug in org-insert-link?

2023-10-09 Thread Guillaume MULLER

Hi,

Thanks for the answer... I'll have a look at your links.

However, since I wrote the email, I've seen the behavior occur without changing 
(at least voluntarily) the cursor position in the Org buffer...

On 10/5/23 12:18, Ihor Radchenko wrote:

Guillaume MULLER  writes:


...
- Switch back to (Doom)Emacs ("window"/desktop)
- Click inside the Emacs "window" to give it focus
[Here is the problem: sometimes I forgot that I already started the 
org-insert-link]
- Call org-insert-link
- Paste the URL
- Validate the link creation

Then the link is inserted where I clicked last (to give focus to the Emacs 
"window").


By default, Emacs moves point to where you click. You can do the same
thing if you deliberately C-x o from the minibuffer. See 9.3 Editing in
the Minibuffer section of Emacs manual.
I see nothing wrong on the Org side.


Of course, the problem lies in my mistake of calling twice the org-insert-link 
method, but the behavior is very strange, and it took me some time to identify 
why my links were inserted at random places in my text.

However, wouldn't it be possible to prevent it from the beginning by forbidding 
me to call org-insert-link twice, i.e. making it a singleton/atomic function (I 
don't see a UseCase where this could be useful to be able to call it inside 
itself, but maybe I'm wrong)?


Check out 22.1 Mouse Commands for Editing section of Emacs manual.
`x-mouse-click-focus-ignore-position' might be something you want to
customize.



--
Guillaume MULLER
Associate Professor, PhD
Fayol Institue - ISI Department
 #426
☎ 04 77 42 02 71
 https://www.mines-stetienne.fr
留= Physical Address =
  Espace Fauriel
  29 Rue Pierre et Dominique Ponchardier
  42100 Saint-Étienne
 = Postal Address =
  École des Mines de Saint-Étienne
  158 cours Fauriel
  42100 Saint-Étienne


OpenPGP_0xF3BCAD9F46F5FADC.asc
Description: OpenPGP public key


OpenPGP_signature.asc
Description: OpenPGP digital signature


Re: [BUG] Warning when creating preview

2023-10-09 Thread Edgar Lux
On Oct 9, 2023 at 3:59 PM

if I comment out the (add-hook 'org-mode-hook #'org-indent-mode), the error is 
gone

-- 
Sent with https://mailfence.com  
Secure and private email

-- 
Sent with https://mailfence.com  
Secure and private email



Re: [BUG] Warning when creating preview

2023-10-09 Thread Edgar Lux
On Oct 9, 2023 
> #--- bug.org
> \(a = 1\)
> #---

further, if you stay "inside" the equation and do C-u C-c C-x C-l (to remove 
the preview) and try to show it again with C-c C-x C-l, the preview is not 
regenerated, but the minibuffer shows =Creating LaTeX previews in section... 
done.=

-- 
Sent with https://mailfence.com  
Secure and private email


init.el.gz
Description: File Attachment: init.el.gz


Re: [BUG] No newline at end of exported HTML file [9.6.6 (release_9.6.6 @ /Applications/MacPorts/Emacs.app/Contents/Resources/lisp/org/)]

2023-10-09 Thread Ihor Radchenko
Bruno Barbier  writes:

> The change seems to come from this commit:
>
>commit d7a55bbd537314d2776b082bd92a1a08b3edc84e
>Date:   Wed Sep 28 12:07:14 2022 +0800
>org-latex-export-to-latex: Do not suppress major modes in babel
>
> It replaces 'write-file' with 'write-region', but, according to the
> documentation of 'require-final-newline', 'write-region' ignores
> 'require-final-newline'.

Thanks for narrowing down the cause!
We indeed cannot revert the commit - the change was made for a reason.

> See attached diff that reverts the problematic change.
>
> In summary, before this commit, Emacs was fixing exported text files
> (HTML, markdown, etc.) for free, adding a newline if needed for text
> files.  It's not anymore.  I'm not sure what would be the best way to
> fix this though.

I do not think that we need to honour `require-final-newline' during
export - this was (1) not documented; (2) caused inconsistency when
exporting with different user configs.

However, we indeed changed the existing behaviour.

AFAIU, `require-final-newline' is t by default, except binary data.
Also, Org export is not designed to generate binary output.
So, it should be OK to ensure the final newline manually, in
`org-export-to-file' - to minimize possible breakage.

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



Re: [BUG] No newline at end of exported HTML file [9.6.6 (release_9.6.6 @ /Applications/MacPorts/Emacs.app/Contents/Resources/lisp/org/)]

2023-10-09 Thread Bruno Barbier

Hi Ye, Ihor, Max,


The change seems to come from this commit:

   commit d7a55bbd537314d2776b082bd92a1a08b3edc84e
   Date:   Wed Sep 28 12:07:14 2022 +0800
   org-latex-export-to-latex: Do not suppress major modes in babel

It replaces 'write-file' with 'write-region', but, according to the
documentation of 'require-final-newline', 'write-region' ignores
'require-final-newline'.

See attached diff that reverts the problematic change.

In summary, before this commit, Emacs was fixing exported text files
(HTML, markdown, etc.) for free, adding a newline if needed for text
files.  It's not anymore.  I'm not sure what would be the best way to
fix this though.



Bruno

diff --git a/lisp/ox.el b/lisp/ox.el
index f8ccd2a9f..5ff105d3b 100644
--- a/lisp/ox.el
+++ b/lisp/ox.el
@@ -6893,7 +6893,7 @@ (defun org-export-to-file
   (with-temp-buffer
 (insert output)
 (let ((coding-system-for-write encoding))
-	  (write-region nil nil file)))
+	  (write-file file)))
   (when (and (org-export--copy-to-kill-ring-p) (org-string-nw-p output))
 (org-kill-new output))
   ;; Get proper return value.


Re: [BUG] [PATCH] Add yank-media and DND handler [9.6.7 (9.6.7-g6eb773 @ /home/viz/lib/emacs/straight/build/org/)]

2023-10-09 Thread Visuwesh
[திங்கள் அக்டோபர் 09, 2023] Ihor Radchenko wrote:

> Thanks!
>
>> +(defun org--dnd-attach-file (url action)
>> ...
>> +(insert
>> + (org-link-make-string
>> +  (concat (if separatep
>> +  "file:"
>> +"attachment:")
>> +  (if separatep
>> +  (expand-file-name (file-name-nondirectory filename)
>> +org-yank-image-save-type)
>> +(file-name-nondirectory filename
>> + "\n")
>> +'private))
>
>> +(pcase org--dnd-xds-method
>> +  (`attach (insert (org-link-make-string
>> +(concat "attachment:" (file-name-nondirectory 
>> filename)))
>
>> +  (`file-link (insert (org-link-make-string (concat "file:" filename))
>> +  "\n"))
>
> Is there any particular reason why you insert a newline after the image
> link?

It is for when you drop multiple files onto a frame.  AFAIU/AFAICT
there's no way to know beforehand if multiple files will be dropped or
not.  I will look into it in bit more detail in the coming days and drop
the newline if only one file is dropped.

> Also, we might want to add a subsection describing the new customization to
> 17 Miscellaneous section of the manual. Otherwise, users might have
> difficulties discovering relevant settings to customize dnd and yank
> behavior.

OK, I will do so.



Re: Exporting elisp: and shell: links

2023-10-09 Thread Ihor Radchenko
Max Nikulin  writes:

>> +(defun org-link--export-code (path description _ info  lang)
>
> I think, the fragment above should be a public function that is a 
> building block for users who want to override export of links having 
> descriptions.

Sure, but that's minor.

>> +   (when description (format " (%s)" description
>
> I hope, path was never added as default description, so checks (or 
> (string-equal path description) (string-equal (concat type ":" path) 
> description))) are not necessary to avoid annoying repetitions.

Valid, but I am more concerned about the whole idea. I _feel_ that

code (description)

does not look nice in html export. I like more how ox-ascii (without the
proposed diff) handles the situation via footnote-like link.

That's my personal preferences though. Which is why I want to hear more
opinions. In particular, I encourage others to play around with various
exported documents with and without the diff and comment on how they
look.

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



Re: [BUG] No newline at end of exported HTML file [9.6.6 (release_9.6.6 @ /Applications/MacPorts/Emacs.app/Contents/Resources/lisp/org/)]

2023-10-09 Thread Ihor Radchenko
Max Nikulin  writes:

>>> Ihor, it changed between Org-9.5 and 9.6.
>> 
>> Are you sure? I tried Org 9.5 and there is no newline.
>
> Org mode version 9.5.5 (release_9.5.5 @ /usr/share/emacs/28.2/lisp/org/)
>
> and the same for uncompiled release_9.5.5 from git
>
> a test file containing just "test", C-c C-e h h.
>
>  tail /tmp/test.org
>
> next shell prompt starts at the beginning of next line. For a file 
> exported by 9.6 shell prompt is placed after  on the same line.

I can reproduce, but not with C-c C-e h H - there is no newline in the
export HTML buffer. If you have time, you may try to bisect.

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



Re: Exporting elisp: and shell: links

2023-10-09 Thread Max Nikulin

On 08/10/2023 16:48, Ihor Radchenko wrote:

+++ b/lisp/ol.el
@@ -1377,7 +1377,29 @@ (defun org-link--open-elisp (path _)
 (call-interactively (read path
 (user-error "Abort")))
 
-(org-link-set-parameters "elisp" :follow #'org-link--open-elisp)

+(defun org-link--export-code (path description _ info  lang)
+  "Export executable link with PATH and DESCRIPTION.
+INFO is the current export info plist.
+LANG is the language name, as in #+begin_src lang.  For example, \"elisp\"
+or \"shell\"."
+  (concat
+   (org-export-data
+(org-element-create
+ 'inline-src-block
+ `( :language ,lang
+:value ,path
+:parameters ":exports code :noweb no :eval never"))
+info)


I think, the fragment above should be a public function that is a 
building block for users who want to override export of links having 
descriptions.



+   (when description (format " (%s)" description


I hope, path was never added as default description, so checks (or 
(string-equal path description) (string-equal (concat type ":" path) 
description))) are not necessary to avoid annoying repetitions.





Re: [FR] A more general case than footnotes

2023-10-09 Thread Ihor Radchenko
Maske  writes:

> I propose links to arbitrary points in different files.
>
> Furthermore, I think it would be a very nice new feature, probably more 
> opinions than mine should be heard.

See:
- 
https://list.orgmode.org/orgmode/118435e8-0b20-46fd-af6a-88de8e19f...@app.fastmail.com/
- 
https://list.orgmode.org/orgmode/cajniy+ovd0ncwzztpit5t7wvsblbgllxzmpub5tgq3gshsg...@mail.gmail.com/
- 
https://list.orgmode.org/orgmode/CAJcAo8s=cjNY-7-mA1zQk3R9HEWYreTatdVeHfJ39ccM9=k...@mail.gmail.com/

The idea is not new, but we need someone to implement it one way or another.

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



Re: [BUG] No newline at end of exported HTML file [9.6.6 (release_9.6.6 @ /Applications/MacPorts/Emacs.app/Contents/Resources/lisp/org/)]

2023-10-09 Thread Max Nikulin

On 09/10/2023 18:46, Ihor Radchenko wrote:

Max Nikulin  writes:


On 09/10/2023 18:29, Ihor Radchenko wrote:

Not ending is also not uncommon though. And causes no harm (no bug
reports during all the >10 years when ox-html is a thing).


Ihor, it changed between Org-9.5 and 9.6.


Are you sure? I tried Org 9.5 and there is no newline.


Org mode version 9.5.5 (release_9.5.5 @ /usr/share/emacs/28.2/lisp/org/)

and the same for uncompiled release_9.5.5 from git

a test file containing just "test", C-c C-e h h.

tail /tmp/test.org

next shell prompt starts at the beginning of next line. For a file 
exported by 9.6 shell prompt is placed after  on the same line.





Re: [BUG] No newline at end of exported HTML file [9.6.6 (release_9.6.6 @ /Applications/MacPorts/Emacs.app/Contents/Resources/lisp/org/)]

2023-10-09 Thread Ihor Radchenko
Max Nikulin  writes:

> On 09/10/2023 18:29, Ihor Radchenko wrote:
>> Not ending is also not uncommon though. And causes no harm (no bug 
>> reports during all the >10 years when ox-html is a thing).
>
> Ihor, it changed between Org-9.5 and 9.6.

Are you sure? I tried Org 9.5 and there is no newline.

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



Re: [BUG] No newline at end of exported HTML file [9.6.6 (release_9.6.6 @ /Applications/MacPorts/Emacs.app/Contents/Resources/lisp/org/)]

2023-10-09 Thread Max Nikulin

On 09/10/2023 18:29, Ihor Radchenko wrote:
Not ending is also not uncommon though. And causes no harm (no bug 
reports during all the >10 years when ox-html is a thing).


Ihor, it changed between Org-9.5 and 9.6.




Re: [BUG] No newline at end of exported HTML file [9.6.6 (release_9.6.6 @ /Applications/MacPorts/Emacs.app/Contents/Resources/lisp/org/)]

2023-10-09 Thread Ihor Radchenko
YE  writes:

>> May you please explain why missing newline is a problem?
>
> It's not necessarily a problem, since HTML parser implementations are
> permissive. Still, a couple of arguments for adding it by default:
>
> 1. diff tools output "\ No newline at end of file" message when a
> newline is missing. Supposedly, it's not optimal for default behavior.

IMHO, I see no problem with that message.

> 2. POSIX.1-2017 states:
> "3.206 Line
> A sequence of zero or more non-  characters plus a terminating
>  character."

Does POSIX has anything to do with HTML?
Were you to show us HTML standard, it would be more convincing.

> 3. Ending a line of text with a particular identifier is rather a
> canonical approach.

Not ending is also not uncommon though. And causes no harm (no bug
reports during all the >10 years when ox-html is a thing).

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



Re: [BUG] [PATCH] Add yank-media and DND handler [9.6.7 (9.6.7-g6eb773 @ /home/viz/lib/emacs/straight/build/org/)]

2023-10-09 Thread Ihor Radchenko
Thanks!

> +(defun org--dnd-attach-file (url action)
> ...
> +(insert
> + (org-link-make-string
> +  (concat (if separatep
> +  "file:"
> +"attachment:")
> +  (if separatep
> +  (expand-file-name (file-name-nondirectory filename)
> +org-yank-image-save-type)
> +(file-name-nondirectory filename
> + "\n")
> +'private))

> +(pcase org--dnd-xds-method
> +  (`attach (insert (org-link-make-string
> +(concat "attachment:" (file-name-nondirectory 
> filename)))

> +  (`file-link (insert (org-link-make-string (concat "file:" filename))
> +  "\n"))

Is there any particular reason why you insert a newline after the image
link?

Also, we might want to add a subsection describing the new customization to
17 Miscellaneous section of the manual. Otherwise, users might have
difficulties discovering relevant settings to customize dnd and yank
behavior.

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