Re: Using a latex auxdir

2024-05-13 Thread Rustom Mody
On Tue, May 14, 2024 at 8:54 AM Rustom Mody  wrote:

> But this confuses org and I dont get C-c C-e l p generating from the old
> org file.
> I thought the mv which moves the generated tex file into the auxdir is
> confusing org.
> But removing it does not help.
>
>
Sorry I mistyped. I meant
But this confuses org and I get C-c C-e l p generating from the old org
file. (
ie I dont see the latest changes to the org file reflected in the pdf after
generation)


Using a latex auxdir

2024-05-13 Thread Rustom Mody
HI folks!

Long time!!

I wanted to keep all my latex generated files inside auxdir.
So I changed org-latex-pdf-process thus:

(setq org-latex-pdf-process
  '("latexmk -f -pdf -%latex -interaction=nonstopmode -auxdir=%oauxdir
%f"
"mv %F %oauxdir"  ))

But this confuses org and I dont get C-c C-e l p generating from the old
org file.
I thought the mv which moves the generated tex file into the auxdir is
confusing org.
But removing it does not help.

Any suggestions?


Re: [PATCH] function and symbol for headline and olp for org-capture-templates

2024-05-13 Thread Nafiz Islam
Oh dear, I shouldn't have used `atomic-chrome' to format the message in
Gmail. So here's a revised version.

Dear All,

This patch adds the option to provide function and symbol for headline and
olp for org-capture-templates.

By that, I mean you can set the org-capture-templates in the following
manner:

(org-capture-templates `(("t" "Todo" entry (file+headline ,file (lambda ()
"A")) "** H1 %?")))

(org-capture-templates `(("t" "Todo" entry (file+headline ,file
test-org-capture/entry/headline) "** H1 %?")))
Where `test-org-capture/entry/headline' is a variable/symbol.

(org-capture-templates `(("t" "Todo" entry (file+olp ,file (lambda () '("A"
"B"))) "* H1 %?")))

(org-capture-templates `(("t" "Todo" entry (file+olp ,file
test-org-capture/entry/file+olp) "* H1 %?")))
Where `test-org-capture/entry/file+olp' is a variable/symbol.

I also added a few more unit tests for the targets `file+olp' and
`file+olp+datetree' to verify my new features and existing features.

However, I just realized that the suggestion provided in
https://lists.gnu.org/archive/html/emacs-orgmode/2024-05/msg00216.html
might not work how I was hoping for. Basically, I wanted it to be possible
to search for headlines and even outline paths in the
buffer while in the function. But, by expanding outline-path before setting
the buffer (by calling outside of `org-find-olp') that
becomes infeasible.


[PATCH] function and symbol for headline and olp for org-capture-templates

2024-05-13 Thread Nafiz Islam
Dear All, This patch adds the option to provide function and symbol for
headline and olp for org-capture-templates. By that, I mean you can set the
org-capture-templates in the following manner: (org-capture-templates
`(("t" "Todo" entry (file+headline ,file (lambda () "A")) "** H1 %?")))
(org-capture-templates `(("t" "Todo" entry (file+headline ,file
test-org-capture/entry/headline) "** H1 %?"))) Where
`test-org-capture/entry/headline' is a variable/symbol.
(org-capture-templates `(("t" "Todo" entry (file+olp ,file (lambda () '("A"
"B"))) "* H1 %?"))) (org-capture-templates `(("t" "Todo" entry (file+olp
,file test-org-capture/entry/file+olp) "* H1 %?"))) Where
`test-org-capture/entry/file+olp' is a variable/symbol. I also added a few
more unit tests for the targets `file+olp' and `file+olp+datetree' to
verify my new features and existing features.
From 4757bd5531663e9c85bd54e8644c4bad40709383 Mon Sep 17 00:00:00 2001
From: Nafiz Islam 
Date: Mon, 13 May 2024 17:53:02 -0400
Subject: [PATCH] function and symbol for headline and olp for org-capture-templates

* doc/org-manual.org: add template format for the function and symbol variant
* etc/ORG-NEWS: announce the updated options
* lisp/org-capture.el (org-capture-templates): update customization type for headline and olp target
* lisp/org-capture.el (org-capture-expand-function-or-symbol): define `org-capture-expand-function-or-symbol'
* lisp/org-capture.el (org-capture-expand-headline): define `org-capture-expand-headline'
* lisp/org-capture.el (org-capture-expand-olp): define `org-capture-expand-olp'
* lisp/org-capture.el (org-capture-expand-file): update to use `org-capture-expand-function-or-symbol' to handle function and symbol
* lisp/org-capture.el (org-capture-set-target-location): use `org-capture-expand-headline' to expand headline, use `org-capture-expand-olp' to expand outline path
* testing/lisp/test-org-capture.el (test-org-capture/entry): add tests for at most three different kinds of target for `file+headline', `file+olp', and `file+olp+datetree'

---
 doc/org-manual.org   | 12 
 etc/ORG-NEWS |  7 +++
 lisp/org-capture.el  | 58 +++
 testing/lisp/test-org-capture.el | 97 
 4 files changed, 162 insertions(+), 12 deletions(-)

diff --git a/doc/org-manual.org b/doc/org-manual.org
index e3a2c9b7..5ff9c5ac 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -8030,10 +8030,18 @@ Now lets look at the elements of a template definition.  Each entry in
 
   - =(file+headline "filename" "node headline")= ::
 
+  - =(file+headline "filename" function-returning-headline)= ::
+
+  - =(file+headline "filename" symbol-containing-headline)= ::
+
 Fast configuration if the target heading is unique in the file.
 
   - =(file+olp "filename" "Level 1 heading" "Level 2" ...)= ::
 
+  - =(file+olp "filename" function-returning-outline-path)= ::
+
+  - =(file+olp "filename" symbol-containing-outline-path)= ::
+
 For non-unique headings, the full path is safer.
 
   - =(file+regexp "filename" "regexp to find location")= ::
@@ -8042,6 +8050,10 @@ Now lets look at the elements of a template definition.  Each entry in
 
   - =(file+olp+datetree "filename" [ "Level 1 heading" ...])= ::
 
+  - =(file+olp+datetree "filename" function-returning-outline-path)= ::
+
+  - =(file+olp+datetree "filename" symbol-containing-outline-path)= ::
+
 This target[fn:30] creates a heading in a date tree[fn:31] for
 today's date.  If the optional outline path is given, the tree
 will be built under the node it is pointing to, instead of at top
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 87b72ad1..13c895dc 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -720,6 +720,13 @@ any more.  Run ~org-ctags-enable~ to setup hooks and advices:
 #+end_src
 
 ** New and changed options
+
+*** New customization options for ~org-capture-templates~
+
+The variable ~org-capture-templates~ accepts a target specification
+for headline (~file+headline~) and olp (~file+old~ and
+~file+olp+datetree~) as function and symbol.
+
 *** New option controlling how Org mode sorts things ~org-sort-function~
 
 Sorting of agenda items, tables, menus, headlines, etc can now be
diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index da14f45c..8c1ff9e1 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -409,7 +409,13 @@ you can escape ambiguous cases with a backward slash, e.g., \\%i."
 (file :tag "Literal")
 (function :tag "Function")
 (variable :tag "Variable")
-(sexp :tag "Form"
+(sexp :tag "Form")))
+(olp-variants '(choice :tag "Outline path"
+   (repeat :tag "Outline path" :inline t
+   (string :tag "Headline"))
+			   (function :tag "Function")
+			   (variable :tag "Variable")
+			   (sexp :tag "Form"
 `(repeat
   (choice :value ("" "" entry (file "~/org/notes.org") "")
 	  (list :tag 

Re: org-table-row face

2024-05-13 Thread Colin Baxter
> Ihor Radchenko  writes:

> Colin Baxter  writes:
>> I read in ORG-NEWS
>> 
>> --8<---cut here---start->8---
>> Now, new ~org-table-row~ face is used on the whole table row
>> lines, including indentation and the final newline. This face, by
>> default, inherits from ~org-table~ face.
>> 
>> If the new behavior is not desired, ~org-table-row~ face can be
>> changed to inherit from ~default~ face.  --8<---cut
>> here---end--->8---
>> 
>> It most certainly is not desired, at least not by me. However, I
>> find the remedy opaque: "org-table-row face can be changed from
>> inherit from default face". What do I actually have to do to
>> achieve this?

> Set 'inherit property of the face.  For example, see 51.1.5
> Customizing Faces.

Thanks, so presumably I just use set-face-attribute.


> Would it help if I add a link to that manual page from ORG-NEWS?

Yes, thanks again.

Colin.



Re: org-table-row face

2024-05-13 Thread Ihor Radchenko
Colin Baxter  writes:

> I read in ORG-NEWS
>
> --8<---cut here---start->8---
> Now, new ~org-table-row~ face is used on the whole table row lines,
> including indentation and the final newline. This face, by default,
> inherits from ~org-table~ face.
>
> If the new behavior is not desired, ~org-table-row~ face can be
> changed to inherit from ~default~ face.
> --8<---cut here---end--->8---
>
> It most certainly is not desired, at least not by me. However, I find
> the remedy opaque: "org-table-row face can be changed from inherit from
> default face". What do I actually have to do to achieve this?

Set 'inherit property of the face.
For example, see 51.1.5 Customizing Faces.

Would it help if I add a link to that manual page from ORG-NEWS?

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



org-table-row face

2024-05-13 Thread Colin Baxter


I read in ORG-NEWS

--8<---cut here---start->8---
Now, new ~org-table-row~ face is used on the whole table row lines,
including indentation and the final newline. This face, by default,
inherits from ~org-table~ face.

If the new behavior is not desired, ~org-table-row~ face can be
changed to inherit from ~default~ face.
--8<---cut here---end--->8---

It most certainly is not desired, at least not by me. However, I find
the remedy opaque: "org-table-row face can be changed from inherit from
default face". What do I actually have to do to achieve this?

Thanks.




Re: Testing issues for Ada/SPARK support in Babel

2024-05-13 Thread Francesc Rocher
Hi Ihor,

The patch is almost finished: refactored support for Ada and SPARK, tests
and documentation of custom variables.
The only pending thing is to write the changes in the NEWS files and other
minor changes.

If you don't mind, I attach here the patch in its current state for
reviewing purposes.

BR,
-- Francesc Rocher


On Mon, May 13, 2024 at 10:08 AM Ihor Radchenko  wrote:

> Ihor Radchenko  writes:
>
> > Francesc Rocher  writes:
> >
> >> I'm starting from scratch the set of tests for Ada/SPARK support in
> Babel.
> >> I've prepared a file with the first example:
> > ...
>
> It has been a while since the last update in this thread.
> May I know if you need any help to progress on your work?
>
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at .
> Support Org development at ,
> or support my work at 
>
From 806da098552f05bd4c3af82ba54bdae8c1ad54f1 Mon Sep 17 00:00:00 2001
From: Francesc Rocher 
Date: Thu, 21 Mar 2024 08:46:33 +0100
Subject: [PATCH] Initial support for Ada/SPARK

---
 lisp/ob-ada-spark.el   | 496 +
 testing/examples/ob-ada-spark-test.org | 300 +++
 testing/lisp/test-ob-ada-spark.el  | 240 
 3 files changed, 1036 insertions(+)
 create mode 100644 lisp/ob-ada-spark.el
 create mode 100644 testing/examples/ob-ada-spark-test.org
 create mode 100644 testing/lisp/test-ob-ada-spark.el

diff --git a/lisp/ob-ada-spark.el b/lisp/ob-ada-spark.el
new file mode 100644
index 0..79f40df69
--- /dev/null
+++ b/lisp/ob-ada-spark.el
@@ -0,0 +1,496 @@
+;;; ob-ada-spark.el --- org-babel functions for Ada & SPARK -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2021-2024 Free Software Foundation, Inc.
+
+;; Author: Francesc Rocher
+;; Maintainer: Francesc Rocher
+;; Keywords: literate programming, reproducible research, Ada/SPARK
+;; URL: https://orgmode.org
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with ob-ada-spark. If not, see .
+
+;;; Commentary:
+
+;; Org-Babel support for evaluating Ada & SPARK code and proving SPARK code.
+
+;;; Requirements:
+
+;; * An Ada compiler (gnatmake)
+;; * A SPARK formal verification tool (gnatprove)
+;; * Emacs ada-mode, optional but strongly recommended, see
+;;   
+
+;;; Code:
+
+(require 'ob)
+(require 'time-stamp)
+
+(org-assert-version)
+
+(defvar org-babel-tangle-lang-exts)
+(add-to-list 'org-babel-tangle-lang-exts '("ada" . "adb"))
+
+(defvar org-babel-temporary-directory)
+
+(defvar org-babel-default-header-args:ada '((:args . nil)
+(:cflags . nil)
+(:pflags . nil)
+(:prove . nil)
+(:template . nil)
+(:unit . nil)
+(:with . nil))
+  "Ada/SPARK default header arguments.")
+
+(defconst org-babel-header-args:ada '((args . any)
+  (cflags . any)
+  (pflags . any)
+  (prove . ((nil t)))
+  (template . :any)
+  (unit . :any)
+  (with . nil))
+  "Ada/SPARK specific header arguments.")
+
+(defconst ob-ada-spark-template-var-name-format "ob-ada-spark-template:%s"
+  "Format of the name of the template variables.
+All templates must be defined in a variable with a name
+compatible with this format. The template name is only the '%s'
+part. From the source block, templates can be used in the
+':template' header with the template name.
+
+For example, the template defined in the variable
+`ob-ada-spark-template:ada-main' is used in the header of the
+source block with ':template ada-main'.")
+
+(defcustom org-babel-ada-spark-compile-command "gnatmake"
+  "Command used to compile Ada/SPARK code into an executable.
+May be either a command in the path, like gnatmake, or an
+absolute path name.
+
+If using Alire 2.x, install the default native toolchain, with
+`alr install gnat_native', and write here the path to gnatmake or
+append $HOME/.alire/bin to PATH."
+  :group 

Re: [PATCH] Ability to specify :html-head as a function

2024-05-13 Thread Ihor Radchenko


Nathan Nichols  writes:
> Here's a patch that adds the ability to specify :html-head as a function. I
> think this is a logical change because:
>
> 1. It provides a wider range of options for how to use :html-head (before
> :html-head could only be a string, now it can also be a function.)
> 2. It is consistent with the behavior of :html-preamble and
> :html-postamble, which can both either be a string or a function.

Thanks!
This addition makes sense.

> I probably did this wrong but anyway here's my attempt at a patch
> submission. Please let me know if you need any additional information or
> have any questions.
>
> Thanks,
>
> --- a/lisp/org-element.el
> +++ b/lisp/org-element.el
> @@ -5578,9 +5578,8 @@ If there is no affiliated keyword, return the empty 
> string."
>  ;; global indentation from the contents of the current element.
>  
>  (defun org-element-normalize-string (s)
> -  "Ensure string S ends with a single newline character.
> -
> -If S isn't a string return it unchanged.  If S is the empty
> +  "Return S, or evaluate to a string ending with a single newline character.
> +If S isn't a string or a function, return it unchanged.  If S is the empty
>  string, return it.  Otherwise, return a new string with a single
>  newline character at its end."
>(cond
> @@ -5589,6 +5588,21 @@ newline character at its end."
> (t (and (string-match "\\(\n[ \t]*\\)*\\'" s)
>  (replace-match "\n" nil nil s)

Please, do not remove existing functions.
Also, please do not modify org-element library when it is just for the
purposes of a single exporter. org-element library is the Org mode
parser, used by all parts of Org mode.

Instead, you can simply define a helper function inside ox-html.el.
  
> +;; Test cases for `org-element-normalize-str-or-fn'
> +(cl-assert (string= (org-element-normalize-str-or-fn (lambda (_res) 
> "abcdefg") nil) "abcdefg\n"))
> +(cl-assert (string= (org-element-normalize-str-or-fn "abcdefg") "abcdefg\n") 
> nil)
> +(cl-assert (= (org-element-normalize-str-or-fn 123 nil) 123))

Tests should go to testing/lisp/..., which see.

>  (defun org-element-normalize-contents (element  ignore-first)
>"Normalize plain text in ELEMENT's contents.
>  
> diff --git a/lisp/ox-html.el b/lisp/ox-html.el
> index ec0add65e..72a8590c4 100644
> --- a/lisp/ox-html.el
> +++ b/lisp/ox-html.el
> @@ -131,7 +131,11 @@
>  (:html-equation-reference-format "HTML_EQUATION_REFERENCE_FORMAT" nil 
> org-html-equation-reference-format t)
>  (:html-postamble nil "html-postamble" org-html-postamble)
>  (:html-preamble nil "html-preamble" org-html-preamble)
> -(:html-head "HTML_HEAD" nil org-html-head newline)
> +;; You should be able to use multiple headline properties 
> "#+EXPORT_HTML_HEAD" in a file.
> +;; The results of each occurrence will be joined by a newline to form 
> the final string
> +;; included in the  section.
> +;; TODO: Test/verify this works still. See: `org-export-options-alist'.
> +(:html-head "HTML_HEAD" "html-head" org-html-head newline)

What is the purpose of "html-head" #+options keyword addition?
Also, is TODO comment for you or for others?

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



[PATCH] Ability to specify :html-head as a function

2024-05-13 Thread Nathan Nichols
Hello org-mode users,

Here's a patch that adds the ability to specify :html-head as a function. I
think this is a logical change because:

1. It provides a wider range of options for how to use :html-head (before
:html-head could only be a string, now it can also be a function.)
2. It is consistent with the behavior of :html-preamble and
:html-postamble, which can both either be a string or a function.

I probably did this wrong but anyway here's my attempt at a patch
submission. Please let me know if you need any additional information or
have any questions.

Thanks,

-Nate
From a4c5d3e648898c91858643c27ff6d56cde7af3be Mon Sep 17 00:00:00 2001
From: Nate Nichols 
Date: Sun, 12 May 2024 19:53:09 -0400
Subject: [PATCH] Squashed commit of the following:

commit 8160b298a544642881fd10c651fd4e736517cf2f
Author: Nate Nichols 
Date:   Sun May 12 19:03:25 2024 -0400

Added ability to specify :html-head as a function
---
 lisp/org-element.el | 20 ---
 lisp/ox-html.el | 59 +++--
 2 files changed, 42 insertions(+), 37 deletions(-)

diff --git a/lisp/org-element.el b/lisp/org-element.el
index cf0982f18..63222c2cc 100644
--- a/lisp/org-element.el
+++ b/lisp/org-element.el
@@ -5578,9 +5578,8 @@ If there is no affiliated keyword, return the empty string."
 ;; global indentation from the contents of the current element.
 
 (defun org-element-normalize-string (s)
-  "Ensure string S ends with a single newline character.
-
-If S isn't a string return it unchanged.  If S is the empty
+  "Return S, or evaluate to a string ending with a single newline character.
+If S isn't a string or a function, return it unchanged.  If S is the empty
 string, return it.  Otherwise, return a new string with a single
 newline character at its end."
   (cond
@@ -5589,6 +5588,21 @@ newline character at its end."
(t (and (string-match "\\(\n[ \t]*\\)*\\'" s)
 	   (replace-match "\n" nil nil s)
 
+
+(defun org-element-normalize-str-or-fn (input  trailing)
+  "If INPUT is a string, it is passed to `org-element-normalize-string'.
+If INPUT is a function, it is applied to arguments TRAILING, and the result is
+passed to `org-element-normalize-string'."
+  (let ((s (if (functionp input) (format "%s" (apply input trailing)) input)))
+(org-element-normalize-string s)))
+
+
+;; Test cases for `org-element-normalize-str-or-fn'
+(cl-assert (string= (org-element-normalize-str-or-fn (lambda (_res) "abcdefg") nil) "abcdefg\n"))
+(cl-assert (string= (org-element-normalize-str-or-fn "abcdefg") "abcdefg\n") nil)
+(cl-assert (= (org-element-normalize-str-or-fn 123 nil) 123))
+
+
 (defun org-element-normalize-contents (element  ignore-first)
   "Normalize plain text in ELEMENT's contents.
 
diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index ec0add65e..72a8590c4 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -131,7 +131,11 @@
 (:html-equation-reference-format "HTML_EQUATION_REFERENCE_FORMAT" nil org-html-equation-reference-format t)
 (:html-postamble nil "html-postamble" org-html-postamble)
 (:html-preamble nil "html-preamble" org-html-preamble)
-(:html-head "HTML_HEAD" nil org-html-head newline)
+;; You should be able to use multiple headline properties "#+EXPORT_HTML_HEAD" in a file.
+;; The results of each occurrence will be joined by a newline to form the final string
+;; included in the  section.
+;; TODO: Test/verify this works still. See: `org-export-options-alist'.
+(:html-head "HTML_HEAD" "html-head" org-html-head newline)
 (:html-head-extra "HTML_HEAD_EXTRA" nil org-html-head-extra newline)
 (:subtitle "SUBTITLE" nil nil parse)
 (:html-head-include-default-style
@@ -1402,6 +1406,24 @@ This option can also be set on with the CREATOR keyword."
   :package-version '(Org . "8.0")
   :type '(string :tag "Creator string"))
 
+
+ Template :: Head
+
+(defcustom org-html-head ""
+  "When set to a string, include that string in the HTML header.
+When set to a function, apply this function and insert the
+returned string.  The function takes the property list of export
+options as its only argument.
+
+Setting :html-preamble in publishing projects will take
+precedence over this variable."
+  :group 'org-export-html
+  :type '(choice (const :tag "Default (empty)" "")
+ (string :tag "Fixed string")
+		 (function :tag "Function (must return a string)")))
+
+
+
  Template :: Preamble
 
 (defcustom org-html-preamble t
@@ -1525,38 +1547,7 @@ style information."
 ;;;###autoload
 (put 'org-html-head-include-default-style 'safe-local-variable 'booleanp)
 
-(defcustom org-html-head ""
-  "Org-wide head definitions for exported HTML files.
-
-This variable can contain the full HTML structure to provide a
-style, including the surrounding HTML tags.  You can consider
-including definitions for the following classes: title, todo,
-done, timestamp, timestamp-kwd, tag, target.
-
-For example, a valid value would be:
-
-   
-  

Re: [PATCH] Add support for shortdoc link type

2024-05-13 Thread Bruno Cardoso

On 2024-05-13, 18:14 +0700, Max Nikulin  wrote:

> Sorry, but did you manually edit the patch?

I didn't. I generated it again and applied without errors.

> If you wish to use `user-error' as in earlier revisions then you may use
>
>  (error (user-error "Unknown shortdoc group or malformed link: `%s'"
>  path)

Thanks, changed it.

> An alternative might be something like (feel free to ignore)
>
>(condition-case err
> ;; ...
>  (error (signal 'user-error (cdr err ; more )
>
> to preserve message generated by `shortdoc-display-group'.

The error message generated by `shortdoc-display-group' may be vague when group 
is empty ("No such documentation group "), which might be the result of a 
malformed link.

>From beceb1b17d1c019cfeb987276e5a234c8f280e6b Mon Sep 17 00:00:00 2001
From: Bruno Cardoso 
Date: Mon, 13 May 2024 09:42:19 -0300
Subject: [PATCH] Add support for shortdoc link type

ol.el: Add support for `shortdoc' link type

* lisp/ol.el (org-link--open-shortdoc org-link--store-shortdoc)
(org-link--complete-shortdoc): Add support for storing and inserting links
to `shortdoc' documentation groups for Emacs Lisp functions.
* doc/org-manual.org (External Links): Add shortdoc link type
documentation.
* etc/ORG-NEWS (=ol.el=: Support for =shortdoc= link type): Document
the new feature.
---
 doc/org-manual.org | 11 +++
 etc/ORG-NEWS   |  5 +
 lisp/ol.el | 41 +
 3 files changed, 57 insertions(+)

diff --git a/doc/org-manual.org b/doc/org-manual.org
index e3a2c9b70..c4873a79b 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -3382,6 +3382,15 @@ Here is the full set of built-in link types:
 
   Execute a shell command upon activation.
 
+- =shortdoc= ::
+
+  Link to short documentation summary for an Emacs Lisp function group.
+  Since Emacs 28, user command ~shortdoc-display-group~ shows all known
+  documentation groups.
+
+  For more information, see [[info:emacs#Name Help][Name Help]]
+  and [[info:elisp#Documentation Groups][Documentation Groups]].
+
 
 For =file:= and =id:= links, you can additionally specify a line
 number, or a text search string, separated by =::=.  In Org files, you
@@ -3423,6 +3432,8 @@ options:
 | irc| =irc:/irc.com/#emacs/bob=  |
 | help   | =help:org-store-link=  |
 | info   | =info:org#External links=  |
+| shortdoc   | =shortdoc:text-properties= |
+|| =shortdoc:text-properties::#get-pos-property=  |
 | shell  | =shell:ls *.org=   |
 | elisp  | =elisp:(find-file "Elisp.org")= (Elisp form to evaluate)   |
 || =elisp:org-agenda= (interactive Elisp command) |
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index ff58833d7..910f534ac 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -1467,6 +1467,11 @@ place the entry in the ~Misc~ category if ~TEXINFO_DIR_CATEGORY~ is missing.
 =TEXINFO_DIR_TITLE= is renamed to =TEXINFO_DIR_NAME=.
 The old name is obsolete.
 
+*** =ol.el=: Support for =shortdoc= link type
+
+Add support for storing and inserting links to =shortdoc= documentation
+groups for Emacs Lisp functions.
+
 ** New functions and changes in function arguments
 *** New optional argument =UPDATE-HEADING= for ~org-bibtex-yank~
 
diff --git a/lisp/ol.el b/lisp/ol.el
index 3d64b41b0..5468a1939 100644
--- a/lisp/ol.el
+++ b/lisp/ol.el
@@ -1582,6 +1582,47 @@ PATH is a symbol name, as a string."
  :follow #'org-link--open-help
  :store #'org-link--store-help)
 
+ "shortdoc" link type
+(when (version<= "28.0.90" emacs-version)
+  (defun org-link--open-shortdoc (path _)
+"Open a \"shortdoc\" type link.
+PATH is a group name, \"group::#function\" or \"group::search string\"."
+(string-match "\\`\\([^:]*\\)\\(?:::\\(.*\\)\\'\\)?" path)
+(let* ((group (match-string 1 path))
+   (str (match-string 2 path))
+   (fn (and str
+(eq ?# (string-to-char str))
+(intern-soft (substring str 1)
+  (condition-case nil
+  (progn
+(shortdoc-display-group group fn)
+(and str (not fn) (search-forward str nil t)))
+(error (user-error "Unknown shortdoc group or malformed link: `%s'"
+   path)
+
+  (defun org-link--store-shortdoc ( _interactive?)
+"Store \"shortdoc\" type link."
+(when (eq major-mode 'shortdoc-mode)
+  (let* ((buffer (buffer-name))
+ (group (when (string-match "*Shortdoc \\(.*\\)\\*" buffer)
+  (match-string 1 buffer
+(if (and group (assoc (intern-soft group) shortdoc--groups))
+(org-link-store-props :type 

Re: [PATCH] Fix regex for determining image width from attribute

2024-05-13 Thread Ihor Radchenko
Max Nikulin  writes:

>>> I think, it is better to avoid "is ignored" here.
>> 
>> May you convert your suggestion into a patch?
>
> See the attachment.
> From 7bc9d909867bf2f99a77d5d1554cd41e4fc664ae Mon Sep 17 00:00:00 2001
> From: Max Nikulin 
> Date: Thu, 9 May 2024 17:32:54 +0700
> Subject: [PATCH] ORG-NEWS: Reword inline image width note

Thanks!
Applied, onto main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=b4d17c062

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



Re: [PATCH] Fix regex for determining image width from attribute

2024-05-13 Thread Ihor Radchenko
Max Nikulin  writes:

> I ma afraid, the code is a bit fragile. Consider
>
> #+attr_html: :alt Image width test
> #+attr_beamer: :width \linewidth
> #+attr_latex: :width +.5\textwidth
> #+attr_md: :width 75%
> [[file:babelfish.png]]
>
> - It is really confusing that #+attr_html casts shadow on #+attr_md.

Fixed, on main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=f326cd58b

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



Re: [POLL] Should we enable or disable automatic tag alignment by default everywhere

2024-05-13 Thread Ihor Radchenko
Ihor Radchenko  writes:

> In the attached patch, I am changing all the commands in Org mode,
> including "self-insert" and "delete-backwards" to respect this option.

Given positive responses, I have applied the patch onto main.
Applied, patch.
Closed, poll.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=aa71facf6

> However, because ~org-auto-align-tags~ is disabled by default, this will
> cause breaking change - there are many more commands in Org mode that
> re-align tags unconditionally compared to the commands that do take it
> into account.
> ...

That was a mistake. org-auto-align-tags is _enabled_ by default. So, the
change will only be breaking for users who explicitly disabled
org-auto-align-tags. (see the updated news entry in the commit)

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



Re: nested blocks in org

2024-05-13 Thread Ihor Radchenko
Ihor Radchenko  writes:

> mahmood sheikh  writes:
>
>> with the given minimal example:
>> ```
>> #+begin_parent
>> #+begin_child
>> #+end_child
>> #+end_parent
>> ```
>> the code
>> ```lisp
>> (org-block-map (lambda () (message "elem: %s" (org-element-at-point
>> ```
>> goes through only the parent element and doesnt run the lambda on the
>> child block
>> the docstring of org-block-map says it iterates through src blocks but
>> it also goes through special blocks, albeit not nested ones, i
>> might've confused it for org-element-map as im not sure about the
>> later functions behavior.
>
> This is a bug in `org-block-map'.

Fixed, on main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=62356cb44

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



Re: [PATCH] Add support for shortdoc link type

2024-05-13 Thread Max Nikulin

On 11/05/2024 23:58, Bruno Cardoso wrote:

On 2024-05-10, 18:09 +0700, Max Nikulin wrote:




I haven't yet. Will be glad to.


I hope, next patch revision will be the final one, so it can be 
notification that the procedure is completed. (Rebase to main HEAD might 
be necessary.)



The attached patch is now in this format.



+++ b/lisp/ol.el
@@ -1582,7 +1582,47 @@ PATH is a symbol name, as a string."
  :follow #'org-link--open-help
  :store #'org-link--store-help)
 


Sorry, but did you manually edit the patch?

git apply /tmp/org/0001-ol-support-for-shortdoc-link-type.patch
error: patch failed: lisp/ol.el:1582
error: lisp/ol.el: patch does not apply

and I see only 6 context lines, not 7.


+  (condition-case nil
+  (progn
+(shortdoc-display-group group fn)
+(and str (not fn) (search-forward str nil t)))
+(error (message "Unknown shortdoc group or malformed link: `%s'"
+path)


If you wish to use `user-error' as in earlier revisions then you may use

(error (user-error "Unknown shortdoc group or malformed link: `%s'"
path)

An alternative might be something like (feel free to ignore)

  (condition-case err
;; ...
(error (signal 'user-error (cdr err ; more )

to preserve message generated by `shortdoc-display-group'.



Re: [Worg] Keep table of contents visible in wide viewports?

2024-05-13 Thread Ihor Radchenko
Adam Porter  writes:

> Looking at Worg now, it occurred to me that, when my browser window is 
> maximized, there's plenty of room for the table of contents to remain 
> visible alongside the content.  But it's hidden automatically, and 
> remains hidden until the user interacts with it, which seems suboptimal 
> for an intra-page table of contents.
>
> Could we modify it to keep the ToC visible when the window is wide 
> enough?  I think that would be a big usability improvement.  WDYT?

I tried

/* Show when screen is wide enough */
@media only screen and (min-width: 100em) {
 #table-of-contents #text-table-of-contents {
  display: block;}}

However, it looks distracting, IMHO. (I tried on 
https://orgmode.org/worg/org-tutorials/index.html)
If we want to display TOC all the time on wide screens, we should change
the TOC style to be more subtle. Creativity is needed.

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



Re: [POLL] Dealing with +1m/y repeaters when jumping to impossible date (should 05-31 +1m be 07-01 or 06-30?) (was: Leap-year bug with todo-cycle)

2024-05-13 Thread Ihor Radchenko
Ihor Radchenko  writes:

>> I have a TODO-entry which looks like this:
>>
>> SCHEDULED: <2024-02-29 Thu ++1y>
>>
>> When I cycle the TODO-entry with c-c c-t it becomes
>>
>> SCHEDULED: <2025-03-01 Sat ++1y>
>
> This is expected. When we try to add 1 year to 2024-02-29, it is
> 2025-02-29. However, because 02-29 does not exist in 2025, we glibc
> takes the closest existing date and adds the difference in days:
> 2025-02-28 + 1d = 2025-03-01.
>
> We apply the same logic to +1m repeaters:
>
> SCHEDULED: <2024-05-31 Fri ++1m>
> will become
> SCHEDULED: <2024-07-01 Mon ++1m>
> since 2024-06-31 does not exist.
>
>> In my opinion it should become "2025-02-28 Fri" instead.

Given the positive responses on changing the date rounding, I went ahead
and tried to implement it (see the attached; note that some tests still
need to be fixed to address the below divergence in edge cases).

However, there are still some issues remaining.
When updating timestamps repeating monthly across months with 30, 31,
and 28 days we get 

<2025-01-31 Fri +1m>
<2025-02-28 Fri +1m>
<2025-03-28 Fri +1m>
...
<2026-01-28 Wed +1m>

As you can see, because we pass through February that only has 28 days,
the timestamp tends to drift towards 28th within one year.

With the existing approach the drift would not be much better though:

<2025-01-31 Fri +1m>
<2025-03-03 Mon +1m>
<2025-03-03 Mon +1m>
...
<2026-01-03 Sat +1m>

I am wondering if we should do something with this kind of edge case.
(Not that the proposed patch is going to make things worse, but maybe
you have some ideas on what can be done, while we are at it)

>From 99e4d3c0afd438499ab55314d30a01da54b15d53 Mon Sep 17 00:00:00 2001
Message-ID: <99e4d3c0afd438499ab55314d30a01da54b15d53.1715594311.git.yanta...@posteo.net>
From: Ihor Radchenko 
Date: Mon, 13 May 2024 11:36:09 +0300
Subject: [PATCH] Make m/y repeater intervals round down from non-existing
 calendar dates

* lisp/org.el (org-repeat-round-time): New customization controlling
the new behavior.  It allows falling back to the historic rounding.
(org-time-inc): New helper function to increment date by Xm/d/w/m/y.
The new function, when `org-repeat-round-time' is non-nil, uses the
closest earlier existing calendar date when repeater units are month
or year.  Otherwise, it relies upon Emacs' rounding of non-existing
calendar dates being transferred to the next month's existing dates.
(org-timestamp-change): Use the new helper function.
(org-closest-date): Use the new helper function when computing
the expected closest repeater date.
* etc/ORG-NEWS (Repeater intervals in the units of month or year are
now computed as in many other calendar apps): Document the change.

Link: https://orgmode.org/list/87frvzodze.fsf@localhost
---
 etc/ORG-NEWS |  19 
 lisp/org.el  | 127 ---
 2 files changed, 88 insertions(+), 58 deletions(-)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 87b72ad12..8f4e51734 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -13,6 +13,25 @@ Please send Org bug reports to mailto:emacs-orgmode@gnu.org.
 
 * Version 9.7 (not released yet)
 ** Important announcements and breaking changes
+*** Repeater intervals in the units of month or year are now computed as in many other calendar apps
+
+Previously, timestamps like [2024-05-31 Fri +1m], when the next month
+does not have 31st day, were repeated to the first days of the
+following month: [2024-07-01 Mon +1m].  Same for years, when the same
+month next year does not have specified date.
+
+Now, the behavior is consistent with many common calendar apps - the
+closest /existing/ earlier date is selected: [2024-05-31 Fri +1m]
+repeats to [2024-06-30 Sun +1m].
+
+The previous behavior can be restored by customizing new option -
+~org-repeat-round-time~.
+
+Do note, however, that timestamps initially pointing to the last day
+of the month will not remain on the last day of the following months:
+[2024-05-31 Fri +1m] -> [2024-06-30 Sun +1m] -> [2024-07-30 Tue +1m]
+(not the last day anymore).
+
 *** ~org-create-file-search-functions~ can use ~org-list-store-props~ to suggest link description
 
 In Org <9.0, ~org-create-file-search-functions~ could set ~description~
diff --git a/lisp/org.el b/lisp/org.el
index 598b4ca23..81ac307cf 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -14951,7 +14951,7 @@ (defun org-diary-to-ical-string (frombuf)
 rtn))
 
 (defun org-closest-date (start current prefer)
-  "Return closest date to CURRENT starting from START.
+  "Return closest absolute date to CURRENT starting from START.
 
 CURRENT and START are both time stamps.
 
@@ -14961,12 +14961,19 @@ (defun org-closest-date (start current prefer)
 
 Only time stamps with a repeater are modified.  Any other time
 stamp stay unchanged.  In any case, return value is an absolute
-day number."
+day number.
+
+The return value is the number of days elapsed since the imaginary
+Gregorian date Sunday, December 31, 1 BC, as returned by

Re: Testing issues for Ada/SPARK support in Babel

2024-05-13 Thread Ihor Radchenko
Ihor Radchenko  writes:

> Francesc Rocher  writes:
>
>> I'm starting from scratch the set of tests for Ada/SPARK support in Babel.
>> I've prepared a file with the first example:
> ...

It has been a while since the last update in this thread.
May I know if you need any help to progress on your work?

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