Re: Another low-hanging fruit

2024-02-04 Thread Pedro Andres Aranda Gutierrez
Fixed!

On Sun, 4 Feb 2024 at 19:36, Ihor Radchenko  wrote:

> Pedro Andres Aranda Gutierrez  writes:
>
> > Next version of the patch. I've done almost everything.
>
> Thanks!
> You dropped Org mailing list from CC. Was it intentional?
>
> > ... Still need to
> > consider the startup options stuff... but will need more time for that.
>
> It is easy.
> Just add
>
> ("fnanon" org-footnote-auto-label 'anonymous)
>
> to `org-startup-options'.
> And, of course, the manual (just a row in table there).
>
> > +*** Add creation of anonymous footnotes
>
> It is not clear what this is about.
>
> Maybe
>
> *** ~org-footnote-new~ can be configured to insert anonymous footnotes by
> default
>
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at .
> Support Org development at ,
> or support my work at 
>


-- 
Fragen sind nicht da, um beantwortet zu werden,
Fragen sind da um gestellt zu werden
Georg Kreisler

Headaches with a Juju log:
unit-basic-16: 09:17:36 WARNING juju.worker.uniter.operation we should run
a leader-deposed hook here, but we can't yet
From 0767bccaabde21241576eaac1103e917c7649f40 Mon Feb 05 00:00:00 2024
From: "Pedro A. Aranda Gutiérrez" 
Date: Sat, 5 Feb 2024 07:30:00 +0100
Subject: [PATCH] Silent anonymous footnote creation

* lisp/org-footnote.el: Add symbol `anonymous' to `org-footnote-auto-label'.
With this, anonymous footnotes will be created. This is sometimes useful
in long texts. Mimics \footnote{} in LaTeX. Modify `org-footnote-new'
to generate anonymous footnotes directly.

* lisp/org.el: Add `fnanon' to startup options

* testing/lisp/test-org-footnote.el: Add a test for creation of anonymous
footnotes.

* etc/ORG-NEWS: Announce new anonymous footnote support.

* doc/org-manual.el: Document `fnanon' startup option

---
diff --git a/doc/org-manual.org b/doc/org-manual.org
index 06869fd97..2eb991a4a 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -20381,6 +20381,7 @@ changes.
   | =fnconfirm=  | Offer automatic label for editing or confirmation. |
   | =fnadjust=   | Automatically renumber and sort footnotes. |
   | =nofnadjust= | Do not renumber and sort automatically.|
+  | =fnanon= | Create anonymous footnotes with ~org-footnote-new~.|

   #+vindex: org-hide-block-startup
   #+vindex: org-hide-drawer-startup
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 9847083b3..33a9d51b9 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -917,6 +917,11 @@ 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.

+*** ~org-footnote-new~ can be configured to create anonymous footnotes
+
+Add new value ~anonymous~ for ~org-footnote-auto-label~ to create
+anonymous footnotes automatically with ~org-footnote-new~.
+
 ** New functions and changes in function arguments
 *** New API functions to store data within ~org-element-cache~

diff --git a/lisp/org-footnote.el b/lisp/org-footnote.el
index c9584c3b8..16ab7f279 100644
--- a/lisp/org-footnote.el
+++ b/lisp/org-footnote.el
@@ -137,6 +137,7 @@ Possible values are:

 nilPrompt the user for each label.
 t  Create unique labels of the form [fn:1], [fn:2], etc.
+anonymous  Create anonymous footnotes
 confirmLike t, but let the user edit the created value.
The label can be removed from the minibuffer to create
an anonymous footnote.
@@ -146,6 +147,7 @@ random	   Automatically generate a unique, random label."
 	  (const :tag "Prompt for label" nil)
 	  (const :tag "Create automatic [fn:N]" t)
 	  (const :tag "Offer automatic [fn:N] for editing" confirm)
+	  (const :tag "Create anoymous [fn::]" anonymous)
 	  (const :tag "Create a random label" random))
   :safe #'symbolp)

@@ -666,15 +668,16 @@ or new, let the user edit the definition of the footnote."
 (user-error "Cannot insert a footnote here"))
   (let* ((all (org-footnote-all-labels))
 	 (label
-	  (if (eq org-footnote-auto-label 'random)
-	  (format "%x" (abs (random)))
-	(org-footnote-normalize-label
-	 (let ((propose (org-footnote-unique-label all)))
-	   (if (eq org-footnote-auto-label t) propose
-		 (completing-read
-		  "Label (leave empty for anonymous): "
-		  (mapcar #'list all) nil nil
-		  (and (eq org-footnote-auto-label 'confirm) propose
+  (unless (eq org-footnote-auto-label 'anonymous)
+	(if (eq org-footnote-auto-label 'random)
+	(format "%x" (abs (random)))
+	  (org-footnote-normalize-label
+	   (let ((propose (org-footnote-unique-label all)))
+	 (if (eq org-footnote-auto-label t) propose
+		   (completing-read
+		"Label (leave empty for anonymous): "
+		(mapcar #'list all) nil nil
+		(and (eq org-footnote-auto-label 'confirm) propose)
 (cond ((not label)
 	   (i

Re: I'm not subscriber, but want to send a code.

2024-02-04 Thread Teika Kazura
Hi, Ihor. (... мабуть привіт or привет?)

Thanks a lot for your kind, detailed reply. Yep, you've convinced me
totally!

There's an (old) question about this in emacs.stackexchange:
https://emacs.stackexchange.com/q/30894
Now I posted a summary of your reply. :)

All the best,
Teika


Re: [BUG] Unexpected result when evaluating python src block asynchronously [9.7-pre (release_9.6.17-1131-gc9ed03.dirty @ /home/yantar92/.emacs.d/straight/build/org/)]

2024-02-04 Thread Jack Kamm
Ihor Radchenko  writes:

> Jack Kamm  writes:
>
>> I think the correct solution would be for `org-babel-insert-result' to
>> not insert file results (or any other special results) for async session
>> blocks.  Perhaps in this case, `org-babel-insert-result' could return a
>> new result type, named "async", "future", or similar.
>
> That will not work.
> `org-babel-comint-async-filter' expects a unique result to be inserted
> into Org buffer, so that it can be located, and replaced by the async
> evaluation output.
>
> So, we have to insert some kind of indicator for async result.

I meant that we could return something like "async:uuid-abcd-1234" or
"async:/path/to/tmpfile", so that `org-babel-comint-async-filter' could
still find the result.

> Of course, the existing scheme of coordination between
> `org-babel-insert-result' and `org-babel-comint-async-filter' is
> erroneous:
>
> 1. We have the problem with :results file value discussed here
> 2. We have a worse problem with :results file :file foo when the result
>may not be unique
> 3. We have :results append/prepend completely broken because
>`org-babel-comint-async-filter' simply calls
>`org-babel-insert-result' implicitly assuming that the existing
>indicator is replaced.
>
> The whole thing should be re-designed.

I agree that it would be good to redesign it, but am not sure where to
start.

A bit of a tangent, but if you are thinking about re-designing this,
then it may be worth considering ob-jupyter's implementation of async
sessions [1]. In particular, I believe it leaves a marker [2] where it
needs to insert the future result. I don't remember the details,
e.g. how it keeps track of which marker is for which result. But it
seems neat, and might work better for some cases such as
appending/prepending results.

[1] https://github.com/emacs-jupyter/jupyter
[2] https://www.gnu.org/software/emacs/manual/html_node/elisp/Markers.html



Re: Async Python src block behavior with :dir header property

2024-02-04 Thread Jack Kamm
Ihor Radchenko  writes:

> Thanks!
> Attaching the two patches combined with some fixed to my patch.
>
> Please check if these two patches solve the discussed bug.

The original bug for async sessions looks fixed. But I encountered a
complication regarding the non-async bug of changing :dir. In particular
the following example:

#+begin_src python :dir otherdir :session pysession :return figname :results 
file value :mkdirp yes
  import matplotlib.pyplot as plt
  plt.figure(figsize=(1, 1))
  plt.plot([1, 2])
  figname = 'fig.svg'
  plt.savefig(figname)
#+end_src

#+RESULTS:
[[file:otherdir/fig.svg]]

#+begin_src python :dir otherdir2 :session pysession :return figname :results 
file value :mkdirp yes
  import matplotlib.pyplot as plt
  plt.figure(figsize=(1, 1))
  plt.plot([1, 2])
  figname = 'fig5.svg'
  plt.savefig(figname)
#+end_src

#+RESULTS:
[[file:otherdir2/fig5.svg]]

As you can see the second result points to the wrong directory. 

However, if replacing ":session pysession" with ":session *pysession*",
then it works.

It's because ob-python starts the session in buffer "*pysession*" (it
adds earmuffs around the session name when missing). So the following
doesn't find the inferior Python:

> +   ((when-let ((session (cdr (assq :session params
> +  (when (org-babel-comint-buffer-livep session)

Honestly, I'm not sure why ob-python insists on the session buffer
having the earmuffs, that behavior is from before my time. In
particular, I'm not yet sure if the motivation is just cosmetic (because
of the general convention like *shell*, *Python*, *R*, etc), or whether
it actually affects python.el behavior. But if it's just cosmetic, then
we might consider removing this behavior to simplify things.

Though note that ob-python is not the only one with this sort of
behavior -- looks like ob-lua might behave similarly, and until recently
ob-R also had some surprising behavior depending on whether the session
name had earmuffs.



Re: Exporting multiple #+AUTHOR keywords

2024-02-04 Thread Juan Manuel Macías
Max Nikulin writes:

> On 04/02/2024 22:21, Ihor Radchenko wrote:
>> 
>> Another option is to have a new set of keywords:
>> #+LATEX_AUTHOR: 
>> #+HTML_AUTHOR: ...
>> 
>> For multiple authors, we may introduce something like
>> 
>> #+AUTHOR: John Doe
>> #+AUTHOR+: Luke Skywalker
>
> Another idea:
>
> #+metadata:
> - author ::
>- John Doe
>- Luke Skywalker
> - title :: Some text
>
> With overrides for specific backends
>
> #+metadata: :backend latex
> - author :: 
>
> Perhaps backends may declare if they support footnotes, etc. by defining 
> some backend property.

I like both ideas. If I had to choose, perhaps I would prefer Ihor's
approach since it separates the formatting value and the metadata value
using simple keywords. I understand that in the former you could add any
direct format (LaTeX, odt, html...), macros and even footnotes. And if
the former is not explicitly included in the document, then the latter
is used to populate both the formatting value and the metadata value.

Anyway, I think your approach would work very well for more complex pdf
metadata like xmp. Maybe using the hyperxmp package, which you mentioned
in a thread months ago?

Maybe something like this:

#+latex_xmp
...
#+end

?

Best regards,

Juan Manuel 




Re: [DISCUSSION] Add "Recent News" to orgmode.org

2024-02-04 Thread Sacha Chua
On Sun, Feb 4, 2024, 14:37 Ihor Radchenko  wrote:

>
> What do you think about an idea to modify Org mode front page
> (https://orgmode.org/), adding the most recent blog posts and

discussions about Org mode?

We might use Org-related records from Sacha's news and/or
> https://planet.emacslife.com/ as a source, scrape it regularly (once per
> day/week or on every export), and embed the relevant links into the
> orgweb/index.html
>

If you like, the Org Mode section can be parsed out of
https://github.com/sachac/emacs-news/blob/master/most-recent.org and
included wherever. :)

Sacha


Re: [DISCUSSION] Add "Recent News" to orgmode.org

2024-02-04 Thread Juergen Fenn



Am 04.02.24 um 20:41 Uhr schrieb Ihor Radchenko:
> What do you think about an idea to modify Org mode front page
> (https://orgmode.org/), adding the most recent blog posts and
> discussions about Org mode?

I think that would be a good idea. Please go ahead.

Regards,
Jürgen.



Re: [DISCUSSION] Add "Recent News" to orgmode.org

2024-02-04 Thread Juan Manuel Macías
Ihor Radchenko writes:

> Hi,
>
> What do you think about an idea to modify Org mode front page
> (https://orgmode.org/), adding the most recent blog posts and
> discussions about Org mode?
>
> We might use Org-related records from Sacha's news and/or
> https://planet.emacslife.com/ as a source, scrape it regularly (once per
> day/week or on every export), and embed the relevant links into the
> orgweb/index.html
>
> This way, visitors can easily see how active Org mode community is and
> discover Org-related blogs/forums.

+1

Best regards,

Juan Manuel 



Re: [DISCUSSION] Add "Recent News" to orgmode.org

2024-02-04 Thread Thomas Dye
+1

Tom

> On Feb 4, 2024, at 9:40 AM, Ihor Radchenko  wrote:
> 
> Hi,
> 
> What do you think about an idea to modify Org mode front page
> (https://orgmode.org/), adding the most recent blog posts and
> discussions about Org mode?
> 
> We might use Org-related records from Sacha's news and/or
> https://planet.emacslife.com/ as a source, scrape it regularly (once per
> day/week or on every export), and embed the relevant links into the
> orgweb/index.html
> 
> This way, visitors can easily see how active Org mode community is and
> discover Org-related blogs/forums.
> 
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at .
> Support Org development at ,
> or support my work at 
> 




[DISCUSSION] Add "Recent News" to orgmode.org

2024-02-04 Thread Ihor Radchenko
Hi,

What do you think about an idea to modify Org mode front page
(https://orgmode.org/), adding the most recent blog posts and
discussions about Org mode?

We might use Org-related records from Sacha's news and/or
https://planet.emacslife.com/ as a source, scrape it regularly (once per
day/week or on every export), and embed the relevant links into the
orgweb/index.html

This way, visitors can easily see how active Org mode community is and
discover Org-related blogs/forums.

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



Re: problems with templates and ID in properties

2024-02-04 Thread Uwe Brauer

   > Uwe Brauer  writes:

   > It is actually not the culprit. The problem is much simpler.
   > You forgot :PROPERTIES: line in your capture template.

   > So, what Org sees is

   > * Heading
   > :ID:
   > ...
   > :END:

😱 😨

I am very sorry. Thanks for you patience and help!!!

Regards

Uwe 

-- 
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-04 Thread Ihor Radchenko
Uwe Brauer  writes:

 "IR" == Ihor Radchenko  writes:
>
>> Uwe Brauer  writes:
>>> ("my" "Annu Grupos Ejercicios" entry (file+olp 
>>> "~/ALLES/HGs/tex/vorlesungen/HGAnnu/Hojas-Teoria/Soluciones-2024/grupos2024.org"
>>>  "Grupos")
>>> "** TODO %^{Grupo} %T %^g %(org-contacts-template-name)
>>> :ID: %(org-id-new)
>>> :Link:  %a   
>>> :Email: %(org-contacts-template-email)
>>> ...
>>> Works concerning the ** entry but inserts the unwanted END after 
>>> org-id-new.
>
> I obtain.
>
>   gnorb-registry-capture() is this the culprit?
>
>
> Debugger entered--entering a function:
> * org-id-new(nil)
>   org-id-get(12826 create)
>   org-id-get-create()

It is actually not the culprit. The problem is much simpler.
You forgot :PROPERTIES: line in your capture template.

So, what Org sees is

* Heading
:ID:
...
:END:

And it is not considered a property drawer :)

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



Re: problems with templates and ID in properties

2024-02-04 Thread Uwe Brauer
>>> "IR" == Ihor Radchenko  writes:

> Uwe Brauer  writes:
>> ("my" "Annu Grupos Ejercicios" entry (file+olp 
>> "~/ALLES/HGs/tex/vorlesungen/HGAnnu/Hojas-Teoria/Soluciones-2024/grupos2024.org"
>>  "Grupos")
>> "** TODO %^{Grupo} %T %^g %(org-contacts-template-name)
>> :ID: %(org-id-new)
>> :Link:  %a   
>> :Email: %(org-contacts-template-email)
>> :Grp: %^{Gr1|Gr2|Gr3|Gr4|Gr6|Gr7|Gr8|Gr9|Gr10|Gr11|Gr12|Gr13}
>> :Usuario1: %:fromname
>> :Email1: %:fromaddress
>> :Usuario2: %(my-extract-cc)
>> :Email2:  %(my-extract-cc)
>> :Usuario3: %(my-extract-cc)
>> :Email3:  %(my-extract-cc)
>> :Usuario4: %(my-extract-cc)
>> :Email4: %(my-extract-cc)
>> :Status:   [ ]
>> :Hoja: 
>> :Ej:   
>> :END:")))
>> ...
>> Works concerning the ** entry but inserts the unwanted END after 
>> org-id-new.

> Try to remove
> :ID: %(org-id-new)
> temporarily and do M-x debug-on-entry ...



> That should reveal where else org-id-new is called.

Aha, thanks, the temporal buffer does not contain an ID, but when running  
org-capture-finalize

I obtain.

  gnorb-registry-capture() is this the culprit?


Debugger entered--entering a function:
* org-id-new(nil)
  org-id-get(12826 create)
  org-id-get-create()
  gnorb-registry-capture()
  run-hooks(org-capture-prepare-finalize-hook)
  org-capture-finalize(nil)
  funcall-interactively(org-capture-finalize nil)
  call-interactively(org-capture-finalize nil nil)
  command-execute(org-capture-finalize)
  recursive-edit()
  debug(error (error "Capture abort: Quit"))
  signal(error ("Capture abort: Quit"))
  error("Capture abort: %s" "Quit")
  org-capture(nil)
  funcall-interactively(org-capture nil)
  call-interactively(org-capture nil nil)
  command-execute(org-capture)


-- 
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-04 Thread Ihor Radchenko
Uwe Brauer  writes:

> ("my" "Annu Grupos Ejercicios" entry (file+olp 
> "~/ALLES/HGs/tex/vorlesungen/HGAnnu/Hojas-Teoria/Soluciones-2024/grupos2024.org"
>  "Grupos")
>  "** TODO %^{Grupo} %T %^g %(org-contacts-template-name)
>  :ID: %(org-id-new)
>  :Link:  %a   
>  :Email: %(org-contacts-template-email)
>  :Grp: %^{Gr1|Gr2|Gr3|Gr4|Gr6|Gr7|Gr8|Gr9|Gr10|Gr11|Gr12|Gr13}
>  :Usuario1: %:fromname
>  :Email1: %:fromaddress
>  :Usuario2: %(my-extract-cc)
>  :Email2:  %(my-extract-cc)
>  :Usuario3: %(my-extract-cc)
>  :Email3:  %(my-extract-cc)
>  :Usuario4: %(my-extract-cc)
>  :Email4: %(my-extract-cc)
>  :Status:   [ ]
>  :Hoja: 
>  :Ej:   
>  :END:")))
> ...
> Works concerning the ** entry but inserts the unwanted END after 
> org-id-new.

Try to remove
:ID: %(org-id-new)
temporarily and do M-x debug-on-entry ...

That should reveal where else org-id-new is called.

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



Re: problems with templates and ID in properties

2024-02-04 Thread Uwe Brauer


> You can try M-x debug-on-entry  org-id-new  to trigger
> backtrace when `org-id-new' is called and see what is calling it.
> Then, M-x cancel-debug-on-entry to disable the debugger.

Here are some news:

--8<---cut here---start->8---
(setq org-capture-templates
  '(
  ("mk" "Annu Grupos Ejercicios" entry (file 
"~/ALLES/HGs/tex/vorlesungen/HGAnnu/Hojas-Teoria/Soluciones-2024/grupos2024.org")
 "** TODO %^{Grupo} %T %^g %(org-contacts-template-name)
 :ID: %(org-id-new)
 :Link:  %a   
 :Email: %(org-contacts-template-email)
 :Grp: %^{Gr1|Gr2|Gr3|Gr4|Gr6|Gr7|Gr8|Gr9|Gr10|Gr11|Gr12|Gr13}
 :Usuario1: %:fromname
 :Email1: %:fromaddress
 :Usuario2: %(my-extract-cc)
 :Email2:  %(my-extract-cc)
 :Usuario3: %(my-extract-cc)
 :Email3:  %(my-extract-cc)
 :Usuario4: %(my-extract-cc)
 :Email4: %(my-extract-cc)
 :Status:   [ ]
 :Hoja: 
 :Ej:   
 :END:")))
--8<---cut here---end--->8---

Works save the ** Problem, but the org-id-new works

Now 

--8<---cut here---start->8---
(setq org-capture-templates
  '(

("my" "Annu Grupos Ejercicios" entry (file+olp 
"~/ALLES/HGs/tex/vorlesungen/HGAnnu/Hojas-Teoria/Soluciones-2024/grupos2024.org"
 "Grupos")
 "** TODO %^{Grupo} %T %^g %(org-contacts-template-name)
 :ID: %(org-id-new)
 :Link:  %a   
 :Email: %(org-contacts-template-email)
 :Grp: %^{Gr1|Gr2|Gr3|Gr4|Gr6|Gr7|Gr8|Gr9|Gr10|Gr11|Gr12|Gr13}
 :Usuario1: %:fromname
 :Email1: %:fromaddress
 :Usuario2: %(my-extract-cc)
 :Email2:  %(my-extract-cc)
 :Usuario3: %(my-extract-cc)
 :Email3:  %(my-extract-cc)
 :Usuario4: %(my-extract-cc)
 :Email4: %(my-extract-cc)
 :Status:   [ ]
 :Hoja: 
 :Ej:   
 :END:")))

--8<---cut here---end--->8---

Works concerning the ** entry but inserts the unwanted END after 
org-id-new.

I can live with solution 1 but still wonder..

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. 



smime.p7s
Description: S/MIME cryptographic signature


Re: problems with templates and ID in properties

2024-02-04 Thread Ihor Radchenko
Uwe Brauer  writes:

>> You can try M-x debug-on-entry  org-id-new  to trigger
>> backtrace when `org-id-new' is called and see what is calling it.
>> Then, M-x cancel-debug-on-entry to disable the debugger.
>
> Here is the result 
>
> Debugger entered--entering a function:
> * org-id-new()
>   eval((org-id-new) t)
>   org-eval((org-id-new))
>   org-capture-expand-embedded-elisp()

This is coming from a template with %(org-id-new).
Is it where you are seeing the unwanted :END: inserted?

-- 
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-colview.el: [refactor] [extract function] `org-columns-move-up' & `org-columns-move-down'

2024-02-04 Thread Ihor Radchenko
Sławomir Grochowski  writes:

> It's a small refactoring - extract function - and the patch is
> self-explanatory.

Thanks!

> +(defun org-columns-move-up ()
> +  (interactive)
> ...
> +(defun org-columns-move-down ()
> +  (interactive)
> ...

May you also add docstrings?
And maybe better names would be org-columns-next/previous-line.

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



Re: problems with templates and ID in properties

2024-02-04 Thread Uwe Brauer
>>> "IR" == Ihor Radchenko  writes:

> Uwe Brauer  writes:
>>> I recommend changing your capture template to
>>> (file+olp "~/grupos2024.org" "Grupos")
>> 
>> That gives an error, as gives file+headline
>> so this part 
>> 
>> (setq org-capture-templates
>> '(
>> ("m" "Mail options")
>> ("mk" "Annu Grupos Ejercicios" entry (file+olp 
>> "~/ALLES/HGs/tex/vorlesungen/HGAnnu/Hojas-Teoria/Soluciones-2024/grupos2024.org")

> You forgot "Grupos". Should be

> (file+olp
> "~/ALLES/HGs/tex/vorlesungen/HGAnnu/Hojas-Teoria/Soluciones-2024/grupos2024.org"
> "Grupos")

Ah, ok this solves that issue

>>> Do you mean that you want IDs to be always added any time your create a
>>> heading? If so, the common method is to add `org-insert-heading-hook'.
>> 
>> That hook is empty, nevertheless and ID with an annoying END is inserted
>> in the middle of the template

> You can try M-x debug-on-entry  org-id-new  to trigger
> backtrace when `org-id-new' is called and see what is calling it.
> Then, M-x cancel-debug-on-entry to disable the debugger.

Here is the result 

Debugger entered--entering a function:
* org-id-new()
  eval((org-id-new) t)
  org-eval((org-id-new))
  org-capture-expand-embedded-elisp()
  org-capture-fill-template()
  org-capture(nil)
  funcall-interactively(org-capture nil)
  call-interactively(org-capture nil nil)
  command-execute(org-capture)




-- 
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-04 Thread Ihor Radchenko
Uwe Brauer  writes:

>> I tightened the template target location reader to produce less cryptic
>> error in similar cases.
>> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=0a58a53ed
> shall I the pull and reinstall?

You do not have to. My commit will just change the
org-capture-set-target-location: Wrong type argument: markerp, nil
to
Invalid capture target specification: ...

You still need to fix your template as I suggested.

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



[PATCH] lisp/org-colview.el: [refactor] [extract function] `org-columns-move-up' & `org-columns-move-down'

2024-02-04 Thread Sławomir Grochowski
Dear All, 

It's a small refactoring - extract function - and the patch is
self-explanatory.

Regards,
Sławomir Grochowski

>From e12fe4e911c90b8f0fc587286937d4c76cac4b5d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C5=82awomir=20Grochowski?= 
Date: Sat, 3 Feb 2024 20:50:08 +0100
Subject: [PATCH] org-colview: Extract functions `org-columns-move-up' &
 `org-columns-move-down'

* lisp/org-colview.el (org-defkey): Do not use anonymous function as a
binding.
---
 lisp/org-colview.el | 40 ++--
 1 file changed, 22 insertions(+), 18 deletions(-)

diff --git a/lisp/org-colview.el b/lisp/org-colview.el
index 81254c483..d0eed4838 100644
--- a/lisp/org-colview.el
+++ b/lisp/org-colview.el
@@ -190,24 +190,8 @@ See `org-columns-summary-types' for details.")
 (org-defkey org-columns-map "s"#'org-columns-edit-attributes)
 (org-defkey org-columns-map "\M-f" #'forward-char)
 (org-defkey org-columns-map [right]#'forward-char)
-(org-defkey org-columns-map [down]
-	(lambda () (interactive)
-	  (let ((col (current-column)))
-		(forward-line 1)
-		(while (and (org-invisible-p2) (not (eobp)))
-		  (forward-line 1))
-		(move-to-column col)
-		(if (derived-mode-p 'org-agenda-mode)
-		(org-agenda-do-context-action)
-(org-defkey org-columns-map [up]
-	(lambda () (interactive)
-	  (let ((col (current-column)))
-		(forward-line -1)
-		(while (and (org-invisible-p2) (not (bobp)))
-		  (forward-line -1))
-		(move-to-column col)
-		(if (eq major-mode 'org-agenda-mode)
-		(org-agenda-do-context-action)
+(org-defkey org-columns-map [up]   #'org-columns-move-up)
+(org-defkey org-columns-map [down] #'org-columns-move-down)
 (org-defkey org-columns-map [(shift right)] #'org-columns-next-allowed-value)
 (org-defkey org-columns-map "n" #'org-columns-next-allowed-value)
 (org-defkey org-columns-map [(shift left)] #'org-columns-previous-allowed-value)
@@ -1033,6 +1017,26 @@ details."
 (org-columns-move-right)
 (backward-char 1)))
 
+(defun org-columns-move-up ()
+  (interactive)
+  (let ((col (current-column)))
+(forward-line -1)
+(while (and (org-invisible-p2) (not (bobp)))
+  (forward-line -1))
+(move-to-column col)
+(if (eq major-mode 'org-agenda-mode)
+	(org-agenda-do-context-action
+
+(defun org-columns-move-down ()
+  (interactive)
+  (let ((col (current-column)))
+(forward-line 1)
+(while (and (org-invisible-p2) (not (eobp)))
+  (forward-line 1))
+(move-to-column col)
+(if (derived-mode-p 'org-agenda-mode)
+	(org-agenda-do-context-action
+
 (defun org-columns--move-row (&optional up)
   "Move the current table row down.
 With non-nil optional argument UP, move it up."
-- 
2.30.2



Re: problems with templates and ID in properties

2024-02-04 Thread Uwe Brauer
>>> "IR" == Ihor Radchenko  writes:

> Uwe Brauer  writes:
>> ("mk" "Annu Grupos Ejercicios" entry (file+olp 
>> "~/ALLES/HGs/tex/vorlesungen/HGAnnu/Hojas-Teoria/Soluciones-2024/grupos2024.org")
>> ...
>> Gives the error 
>> ...
>> org-capture-set-target-location: Wrong type argument: markerp, nil

> I tightened the template target location reader to produce less cryptic
> error in similar cases.
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=0a58a53ed
shall I the pull and reinstall?


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


[BUG] Prompt appears in async shell results

2024-02-04 Thread Matt
* [BUG] Prompt appears in async shell results
** Minimal reproducible example
#+begin_src emacs-lisp
(org-babel-do-load-languages 'org-babel-load-languages '((shell . t)))
#+end_src

#+begin_src sh :results output :session *test* :async t
cd /tmp
echo "hello world"
#+end_src

#+RESULTS:
: org_babel_sh_prompt> hello world

or

#+begin_src sh :results output :session *test* :async t
# comment
# comment
#+end_src

#+RESULTS:
: org_babel_sh_prompt> org_babel_sh_prompt>

or

#+begin_src sh :results output :session *test* :async t
# print message
echo \"hello world\"
#+end_src

#+RESULTS:
: org_babel_sh_prompt> "hello world"

Interestingly, this returns without the prompt:

,#+begin_src sh :results output :session *test* :async t
echo "hello"
echo "world"
#+end_src

#+RESULTS:
: hello
: world

** Test
Here's a test that checks one of the MREs:
#+begin_src emacs-lisp
(ert-deftest test-ob-shell/session-async-removes-prompt-from-results ()
  "Test that async evaluation removes prompt from results."
  (let* ((session-name 
"test-ob-shell/session-async-removes-prompt-from-results")
 (kill-buffer-query-functions nil)
 (start-time (current-time))
 (wait-time (time-add start-time 3))
 uuid-placeholder)
(org-test-with-temp-text
(concat "#+begin_src sh :session " session-name " :async t
# print message
echo \"hello world\"
,#+end_src")
  (setq uuid-placeholder (org-trim (org-babel-execute-src-block)))
  (catch 'too-long
(while (string-match uuid-placeholder (buffer-string))
  (progn
(sleep-for 0.01)
(when (time-less-p wait-time (current-time))
  (throw 'too-long (ert-fail "Took too long to get result from 
callback"))
(search-forward "#+results")
(beginning-of-line 2)
(if (should (string= ": hello world\n" (buffer-substring-no-properties 
(point) (point-max
  (kill-buffer session-name)
#+end_src

** Thoughts
A quick fix is:

#+begin_src diff
modified   lisp/ob-shell.el
@@ -289,7 +289,7 @@ See `org-babel-comint-async-indicator'.")
 (defun ob-shell-async-chunk-callback (string)
   "Filter applied to results before insertion.
 See `org-babel-comint-async-chunk-callback'."
-  (replace-regexp-in-string comint-prompt-regexp "" string))
+  (replace-regexp-in-string org-babel-sh-prompt "" string))

 (defun org-babel-sh-evaluate (session body &optional params stdin cmdline)
   "Pass BODY to the Shell process in BUFFER.
#+end_src

I'm not sure this is the best way.

There are two ways I can think to look at it: how text is passed to the process 
and what's done with it afterward.

Regarding how text is passed to the process:

Blocks without :session and :async are sent via =process-file=.  Blocks with 
:session, including those with :async, are inserted into a process buffer and 
sent to the process with =comint-send-input=.  The details differ, but I think 
the general concept holds: a chunk of text is inserted into the process buffer 
and that chunk is then sent to the process.  This is in contrast to successive 
insert-send pairs.  AFAICT, there's no major difference in how text is passed 
to the process between :session only and :session with :async.

Regarding how process results are handled:

AFAIU, =process-file= interfaces directly with the process and no terminal 
emulation is involved.  So, there's no prompt to worry about.  Blocks with only 
:session go through =org-babel-comint-with-output= which filters out the prompt 
(https://git.savannah.gnu.org/cgit/emacs/org-mode.git/tree/lisp/ob-comint.el#n110).
  Async block results go through =org-babel-comint-async-filter= which doesn't 
filter results 
(https://git.savannah.gnu.org/cgit/emacs/org-mode.git/tree/lisp/ob-comint.el#n212).

It seems to me that we should extract the filter from 
=org-babel-comint-with-output= and use it in both 
=org-babel-comint-with-output= and =org-babel-comint-async-filter=.  

Thoughts?

--
Matt Trzcinski
Emacs Org contributor (ob-shell)
Learn more about Org mode at https://orgmode.org
Support Org development at https://liberapay.com/org-mode




Re: [PATCH] lisp/org-colview.el: [refactor] replace anonymouse function with `forward-char

2024-02-04 Thread Ihor Radchenko
Sławomir Grochowski  writes:

> It's a TINYCHANGE and the patch is self-explanatory.

Thanks!
Applied, onto main, with amendments to the commit message.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=0938795fd

You don't need TINYCHANGE cookie when you already have FSF copyright
assignment.

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



Re: I'm not subscriber, but want to send a code.

2024-02-04 Thread Ihor Radchenko
Teika Kazura  writes:

> 
> [Wishitem] Show the current node name in the header line (w/ sample 
> implementation)
> ---
> Hi. The following code shows the current "node name" (outline header
> name) in the emacs header line:
> ...

Thanks for the suggestion!
Have you seen org-eldoc.el library (a part of org-contrib)?
It provides a similar functionality using eldoc-mode.

By default, eldoc-mode uses echo area to display the breadcrumbs.
However, you may customize `eldoc-display-functions' to display the
breadcrumbs in header line.

eldoc-mode allows multiline messages.

> If you like, adopt it for org-mode. Feel free to modify.

You might also be interested in https://github.com/joaotavora/breadcrumb

I believe that the proposed functionality is already covered by either
org-eldoc.el or breadcrumb.el. So, we do not need to re-implement it
within Org mode.

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



[PATCH] lisp/org-colview.el: [refactor] replace anonymouse function with `forward-char

2024-02-04 Thread Sławomir Grochowski
Dear All,

It's a TINYCHANGE and the patch is self-explanatory.

Regards,
Sławomir Grochowski
From 884e57101de6baf92d6d4e6c2c3476c7c3498185 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C5=82awomir=20Grochowski?= 
Date: Sat, 3 Feb 2024 19:30:03 +0100
Subject: [PATCH] lisp/org-colview.el: [refactor] replace anonym. function with
 `forward-char

* org-colview.el: [refactor] Replace an anonymous function with
a named function `forward-char'.

TINYCHANGE
---
 lisp/org-colview.el | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/lisp/org-colview.el b/lisp/org-colview.el
index d0af89b61..81254c483 100644
--- a/lisp/org-colview.el
+++ b/lisp/org-colview.el
@@ -188,10 +188,8 @@ See `org-columns-summary-types' for details.")
 (org-defkey org-columns-map "\M-b" #'backward-char)
 (org-defkey org-columns-map "a"#'org-columns-edit-allowed)
 (org-defkey org-columns-map "s"#'org-columns-edit-attributes)
-(org-defkey org-columns-map "\M-f"
-	(lambda () (interactive) (goto-char (1+ (point)
-(org-defkey org-columns-map [right]
-	(lambda () (interactive) (goto-char (1+ (point)
+(org-defkey org-columns-map "\M-f" #'forward-char)
+(org-defkey org-columns-map [right]#'forward-char)
 (org-defkey org-columns-map [down]
 	(lambda () (interactive)
 	  (let ((col (current-column)))
-- 
2.30.2



Re: Async Python src block behavior with :dir header property

2024-02-04 Thread Ihor Radchenko
Jack Kamm  writes:

> I updated the patch for `org-babel-comint-async-filter' to follow the
> same approach, setting default-directory based on the session buffer's
> value rather than the :dir header arg.

Thanks!
Attaching the two patches combined with some fixed to my patch.

Please check if these two patches solve the discussed bug.

>From 66bbac4207d7132ebc9f91f60384809ae556c2ef Mon Sep 17 00:00:00 2001
Message-ID: <66bbac4207d7132ebc9f91f60384809ae556c2ef.1707064153.git.yanta...@posteo.net>
From: Ihor Radchenko 
Date: Sat, 3 Feb 2024 16:47:57 +0100
Subject: [PATCH 1/2] org-babel-execute-src-block: Force :dir according to live
 session

* lisp/ob-core.el (org-babel-execute-src-block): Force eval directory
to follow live session buffer, if any.  This is consistent with what
we promise in the manual section "16.4 Environment of a Code
Block">Choosing a working directory.

Link: https://orgmode.org/list/87mssi8ht2@gmail.com
---
 lisp/ob-core.el | 19 +++
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index 1de3af6ad..fd8d06c5d 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -840,14 +840,17 @@ (defun org-babel-execute-src-block (&optional arg info params executor-type)
 		 (dir (cdr (assq :dir params)))
 		 (mkdirp (cdr (assq :mkdirp params)))
 		 (default-directory
-		   (cond
-		((not dir) default-directory)
-		((member mkdirp '("no" "nil" nil))
-		 (file-name-as-directory (expand-file-name dir)))
-		(t
-		 (let ((d (file-name-as-directory (expand-file-name dir
-		   (make-directory d 'parents)
-		   d
+		  (cond
+		   ((not dir) default-directory)
+   ((when-let ((session (cdr (assq :session params
+  (when (org-babel-comint-buffer-livep session)
+(buffer-local-value 'default-directory (get-buffer session)
+		   ((member mkdirp '("no" "nil" nil))
+		(file-name-as-directory (expand-file-name dir)))
+		   (t
+		(let ((d (file-name-as-directory (expand-file-name dir
+		  (make-directory d 'parents)
+		  d
 		 (cmd (intern (concat "org-babel-execute:" lang)))
 		 result exec-start-time)
 	(unless (fboundp cmd)
-- 
2.43.0

>From e9765a146bf27e6769a2563862d52b0efb77eb2e Mon Sep 17 00:00:00 2001
Message-ID: 
In-Reply-To: <66bbac4207d7132ebc9f91f60384809ae556c2ef.1707064153.git.yanta...@posteo.net>
References: <66bbac4207d7132ebc9f91f60384809ae556c2ef.1707064153.git.yanta...@posteo.net>
From: Jack Kamm 
Date: Wed, 31 Jan 2024 20:06:00 -0800
Subject: [PATCH 2/2] ob-comint: Make file results from async sessions respect
 :dir header

* lisp/ob-comint.el (org-babel-comint-async-filter): Set
default-directory before calling `org-babel-insert-result'

https://list.orgmode.org/875xz9o4nj.fsf@localhost/T/#t
---
 lisp/ob-comint.el | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/lisp/ob-comint.el b/lisp/ob-comint.el
index 7d258ea0e..349524701 100644
--- a/lisp/ob-comint.el
+++ b/lisp/ob-comint.el
@@ -224,6 +224,8 @@ (defun org-babel-comint-async-filter (string)
 	 (file-callback org-babel-comint-async-file-callback)
 	 (combined-string (concat org-babel-comint-async-dangling string))
 	 (new-dangling combined-string)
+ ;; Assumes comint filter called with session buffer current
+ (session-dir default-directory)
 	 ;; list of UUID's matched by `org-babel-comint-async-indicator'
 	 uuid-list)
 (with-temp-buffer
@@ -248,7 +250,8 @@ (defun org-babel-comint-async-filter (string)
 (let* ((info (org-babel-get-src-block-info))
(params (nth 2 info))
(result-params
-(cdr (assq :result-params params
+(cdr (assq :result-params params)))
+   (default-directory session-dir))
   (org-babel-insert-result
(funcall file-callback
 (nth
@@ -291,7 +294,8 @@ (defun org-babel-comint-async-filter (string)
(let* ((info (org-babel-get-src-block-info))
   (params (nth 2 info))
   (result-params
-   (cdr (assq :result-params params
+   (cdr (assq :result-params params)))
+  (default-directory session-dir))
  (org-babel-insert-result
   res-str result-params info))
    t
-- 
2.43.0


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

Re: Exporting multiple #+AUTHOR keywords

2024-02-04 Thread Max Nikulin

On 04/02/2024 22:21, Ihor Radchenko wrote:


Another option is to have a new set of keywords:
#+LATEX_AUTHOR: 
#+HTML_AUTHOR: ...

For multiple authors, we may introduce something like

#+AUTHOR: John Doe
#+AUTHOR+: Luke Skywalker


Another idea:

#+metadata:
- author ::
  - John Doe
  - Luke Skywalker
- title :: Some text

With overrides for specific backends

#+metadata: :backend latex
- author :: 

Perhaps backends may declare if they support footnotes, etc. by defining 
some backend property.





Re: Exporting multiple #+AUTHOR keywords

2024-02-04 Thread Ihor Radchenko
Juan Manuel Macías  writes:

> ... I think the basic problem is that org uses #+author, #+title, etc.
> as a single source for both the metadata strings and the exported
> format, i.e. the title, the author, the date that is printed somewhere.
>
> Perhaps the ideal would be to distinguish in some way between
> author-metadata and author-exported-format. For example something like:
>
> #+AUTHOR[John Doe and Luke Skywalker]: John Doe @@latex:\and@@ Luke
> Skywalker
>
> The optional string in square brackets would be the metadata; the rest
> would be the direct exported format. If there is no optional string, the
> value is used for both metadata and format. Could this be also a
> possible solution to the footnote problem?

Another option is to have a new set of keywords:
#+LATEX_AUTHOR: 
#+HTML_AUTHOR: ...

For multiple authors, we may introduce something like

#+AUTHOR: John Doe
#+AUTHOR+: Luke Skywalker

That should be fully backwards-compatible.

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



Re: [BUG] Unexpected result when evaluating python src block asynchronously [9.7-pre (release_9.6.17-1131-gc9ed03.dirty @ /home/yantar92/.emacs.d/straight/build/org/)]

2024-02-04 Thread Ihor Radchenko
Jack Kamm  writes:

> I think the correct solution would be for `org-babel-insert-result' to
> not insert file results (or any other special results) for async session
> blocks.  Perhaps in this case, `org-babel-insert-result' could return a
> new result type, named "async", "future", or similar.

That will not work.
`org-babel-comint-async-filter' expects a unique result to be inserted
into Org buffer, so that it can be located, and replaced by the async
evaluation output.

So, we have to insert some kind of indicator for async result.

Of course, the existing scheme of coordination between
`org-babel-insert-result' and `org-babel-comint-async-filter' is
erroneous:

1. We have the problem with :results file value discussed here
2. We have a worse problem with :results file :file foo when the result
   may not be unique
3. We have :results append/prepend completely broken because
   `org-babel-comint-async-filter' simply calls
   `org-babel-insert-result' implicitly assuming that the existing
   indicator is replaced.

The whole thing should be re-designed.

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



Re: Another low-hanging fruit

2024-02-04 Thread Ihor Radchenko
Pedro Andres Aranda Gutierrez  writes:

> Subject: [PATCH] Silent anonymous footnote creation

This is a bit confusing. Maybe something like

org-footnote-new: Add an option to create new anonymous labels

> * lisp/org-footnote.el: Add symbol anonymous to `org-footnote-auto-label'.
> With this, anonymous footnotes will be created. This is sometimes more
> useful in long texts. Mimics \footnote{} in LaTeX.

This is a reasonable addition.

Although, please fix the changelog entry to mention that
`org-footnote-new' is altered.

> --- a/lisp/org-footnote.el
> +++ b/lisp/org-footnote.el
> @@ -137,6 +137,7 @@ Possible values are:
>
>  nilPrompt the user for each label.
>  t  Create unique labels of the form [fn:1], [fn:2], etc.
> +anonymous  Create anonymous labels

This wording is confusing. No labels are actually created. Just
anonymous footnote. Please reword.

Also, this is a new feature and should thus be announced in
etc/ORG-NEWS.

Further, please consider adding a new #+STARTUP option to
`org-startup-options'. We already have some facilities to set
`org-footnote-auto-label' there: fnauto, fnprompt, etc.
If you do, you will also need to update the manual section "Summary of
In-Buffer Settings".

Finally, please add a test for the new option to `test-org-footnote/new'
in testing/lisp/test-org-footnote.el

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



Re: problems with templates and ID in properties

2024-02-04 Thread Ihor Radchenko
Uwe Brauer  writes:

> ("mk" "Annu Grupos Ejercicios" entry (file+olp 
> "~/ALLES/HGs/tex/vorlesungen/HGAnnu/Hojas-Teoria/Soluciones-2024/grupos2024.org")
> ...
> Gives the error 
> ...
> org-capture-set-target-location: Wrong type argument: markerp, nil

I tightened the template target location reader to produce less cryptic
error in similar cases.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=0a58a53ed

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



Re: problems with templates and ID in properties

2024-02-04 Thread Ihor Radchenko
Uwe Brauer  writes:

>> I recommend changing your capture template to
>> (file+olp "~/grupos2024.org" "Grupos")
>
> That gives an error, as gives file+headline
> so this part 
>
> (setq org-capture-templates
>   '(
> ("m" "Mail options")
> ("mk" "Annu Grupos Ejercicios" entry (file+olp 
> "~/ALLES/HGs/tex/vorlesungen/HGAnnu/Hojas-Teoria/Soluciones-2024/grupos2024.org")

You forgot "Grupos". Should be

(file+olp
"~/ALLES/HGs/tex/vorlesungen/HGAnnu/Hojas-Teoria/Soluciones-2024/grupos2024.org"
"Grupos")

>> Do you mean that you want IDs to be always added any time your create a
>> heading? If so, the common method is to add `org-insert-heading-hook'.
>
> That hook is empty, nevertheless and ID with an annoying END is inserted
> in the middle of the template

You can try M-x debug-on-entry  org-id-new  to trigger
backtrace when `org-id-new' is called and see what is calling it.
Then, M-x cancel-debug-on-entry to disable the debugger.

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



Re: [BUG] Unsolicited download of remote resources

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

>> Please confirm that the fix works on your side.
>
> I have tried it with this specific scenario: open such a file (not a 
> mail message with an attachment) with http: URIs. "Skip" works as 
> expected now. I am unsure if any kind of remote files is blocked.

Thanks for checking!
Released as a part of Org 9.6.18.

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



Re: [BUG] Unsolicited download of remote resources

2024-02-04 Thread Max Nikulin

On 03/02/2024 02:04, Leo Butler wrote:


When I opened your email in Gnus, I was greeted with the same
(bewildering) message. Given that Org still tried to download the
setupfile after being told not to, I think this is a majour security
hole.

This is also related to another thread concerning Org and email.
https://list.orgmode.org/orgmode/87cyteyhif.fsf@localhost/


Sorry for sending a message with this kind of attachment, but from the 
discussion of that Emacs bug I expected that almost no Gnus users should 
be affected since their media type handler is set for text/x-org while 
Thunderbird uses "Content-Type: text/org".


I would not classify this kind of issues as security ones. I am unaware 
of Org features that may make content of "#+setupfile:" more dangerous 
than the same snippet is included into attachment directly. (OK, 
antivirus might have a chance to detect something as dangerous code and 
"#+setupfile:" would bypass such protection.)


I consider it as a privacy issue. It may allow spammers to track if 
their messages are delivered successfully.


I was really surprised when I found "n" option to decline downloads 
broken. I expected it was addressed in
[PATCH] New remote resource download policy. Sun, 12 Jun 2022 22:43:07 
+0800. https://list.orgmode.org/87mteiq6ou@gmail.com

since it was risen in the earlier thread
[PATCH] Support =#+include=-ing URLs. Sun, 05 Jun 2022 22:32:30 +0800.
https://list.orgmode.org/87k09v5gap@gmail.com




Re: [BUG] Unsolicited download of remote resources

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

> However it may be unclear for users that setting `t' for 
> `org-resource-download-policy' is dangerous if they use Emacs as a mail 
> client or as a handler for opening links to .org files in browsers. I 
> would consider adding "dangerous" to the label of this option and a 
> warning to the docscring.

Would you be interested to submit a patch?

> Another my concern is an attack using an attachments with multiple 
> "#+setupfile:" keywords with remote URIs. Users will be tired declining 
> specific download requests without an option to ignore all remote 
> resources. I hope, C-g it is obvious enough and it works in gnus&Co. I 
> am unsure how to implement in Emacs an approach used e.g. in 
> Thunderbird. Remote content is blocked till an explicit user action and 
> a yellow bar with an unblock button is displayed at the top of the 
> message body pane.

I am not in favor of creating such new interface as a part of Org mode.
You can propose it to Emacs upstream. If they are interested, it is
something we may consider. However, there have been multiple discussions
about delayed prompts in the context of async ELisp evaluation - AFAIR,
such ideas were not welcome on the grounds that such prompts may be
missed by the users.

What we can do is adding a new answer - "N" aka "no for all for the
duration of current command".

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



Re: [BUG] Unsolicited download of remote resources

2024-02-04 Thread Max Nikulin

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

Max Nikulin writes:


--- 8< ---
#+setupfile: http://localhost:8000/setup-1234567890.org

test
--- >8 ---

[...]

Fixed, on bugfix.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=56748ea4e

Please confirm that the fix works on your side.


I have tried it with this specific scenario: open such a file (not a 
mail message with an attachment) with http: URIs. "Skip" works as 
expected now. I am unsure if any kind of remote files is blocked.


However it may be unclear for users that setting `t' for 
`org-resource-download-policy' is dangerous if they use Emacs as a mail 
client or as a handler for opening links to .org files in browsers. I 
would consider adding "dangerous" to the label of this option and a 
warning to the docscring.


Another my concern is an attack using an attachments with multiple 
"#+setupfile:" keywords with remote URIs. Users will be tired declining 
specific download requests without an option to ignore all remote 
resources. I hope, C-g it is obvious enough and it works in gnus&Co. I 
am unsure how to implement in Emacs an approach used e.g. in 
Thunderbird. Remote content is blocked till an explicit user action and 
a yellow bar with an unblock button is displayed at the top of the 
message body pane.






Re: [BUG]: contradictory requirements between resolving links and noweb result block

2024-02-04 Thread gerard . vermeulen



On 02.02.2024 21:12, Ihor Radchenko wrote:

gerard.vermeu...@posteo.net writes:


I want to have a kind of dynamic RESULTS: noweb block to select what
other block to put in the LaTeX  preamble on LaTeX export.
I can get it working, but in this case links to the RESULTS: noweb 
block

are not resolved.  I found no way to get the links resolved without
breaking Noweb.  See my MWE with instructions below:


May you please provide more detailed information about your MWE?
What exactly are the steps? What did you expect to happen? What
happened instead?


I have turned my MWE into two almost identical MWE's (attached,
including a diff), so that LaTeX export output shows the problem.
I start with my expectations and then I explain what contains the
LaTeX output for mwe-noweb-ok.org and mwe-links-ok.org.

* LaTeX export objectives

Noweb should work, meaning that the LaTeX output preamble should
contain (above \author) the line:
#+begin_src latex
% Should go to the LaTeX preamble above \author{}.
#+end_src

Resolving links should work, meaning that the LaTeX output should
contain (below \tableofcontents) the line
#+begin_src latex
Listing \ref{noop}, \ref{make-noweb}, and \ref{make-noweb-result}.
#+end_src
where all links have user labels.

* mwe-noweb-ok

Export of mwe-noweb-ok.org to LaTeX shows that noweb works
Noweb works, because the preamble contains:
#+begin_src latex
% Should go to the LaTeX preamble above \author{}.
#+end_src

Resolving the last link fails, because it has an org-id
#+begin_src latex
Listing \ref{noop}, \ref{make-noweb}, and \ref{orgd105392}.
#+end_src
while the caption of the linked listing has a user label.

* mwe-links-ok

Noweb fails, because the LaTeX output preamble does contain
#+begin_src latex
\usepackage{hyperref}
\author{Gerard Vermeulen}
#+end_src
without the LaTeX comment.

Resolving links works, because the LaTeX output contains
#+begin_src latex
Listing \ref{noop}, \ref{make-noweb}, and \ref{make-noweb-result}.
#+end_src

* Problem

I can find no configuration where noweb and resolving the link
to the noweb block works.

Regards -- Gerard


mwe-noweb-ok.org
Description: Binary data


mwe-links-ok.org
Description: Binary data


mwe.diff
Description: Binary data