Re: PATCH allow explicit style= in #+cite_export: biblatex

2024-04-14 Thread Pedro Andres Aranda Gutierrez
HI, full answer...

In the original code, that section prepends "style=" in some cases. I have
stumbled across
instances where the options started with style= because they were taken
directly from LaTeX
and the generated code ended by like:
\usepackage[style=style=numeric,backend=biber]{biblatex}
for
#+cite_export: biblatex style=numeric,backend=biber
which, BTW, is something someone used the LaTeX may parse as correct.
I was just trying to cater for this case.

Best, /PA


On Sun, 14 Apr 2024 at 07:30, Pedro Andres Aranda Gutierrez <
paag...@gmail.com> wrote:

> Sorry... I was not right... You are right. I'll take a look at it again.
> /PA
>
> On Sun, 14 Apr 2024 at 07:22, Pedro Andres Aranda Gutierrez <
> paag...@gmail.com> wrote:
>
>> Hi,
>>
>> Maybe not... because style= is a keyword for the biblatex package, while
>> bibstyle or citestyle aren't.
>>
>> Best, /PA
>>
>> On Sat, 13 Apr 2024 at 16:32, Ihor Radchenko  wrote:
>>
>>> Pedro Andres Aranda Gutierrez  writes:
>>>
>>> > HI,
>>> > Attached is a small patch to allow explicitly adding style= in the
>>> biblatex export options, to increase consistency with
>>> > Customisation variables.
>>>
>>> Thanks!
>>>
>>> >  (style-options
>>> >   (cond
>>> >((null style) nil)
>>> > +  ;; allow the user to include "style=" anywhere in the style
>>> options
>>> > +  ((string-match "\\(^s\\|,s\\)tyle=" style) (list style))
>>> >((not (string-match "/" style)) (list (concat "style="
>>> style)))
>>> >(t
>>> > (list (concat "bibstyle=" (substring style nil
>>> (match-beginning 0)))
>>>
>>> If we allow style=..., may as well allow bibstyle= and citestyle=.
>>>
>>> --
>>> 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
>>
>>
>
> --
> 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
>
>

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


Post to mastodon within Org

2024-04-14 Thread Christian Barthel
Hi, some time ago, I showed a screenshot how I am using
Org-Mode to manage my mastodon status updates
(posts/toos) [1] and I got some direct messages about
sharing my elisp functions and I publicly [2] stated
that the code is not production ready, but I will
rework this.

Sorry - it took a bit too long but with that mail, I
want to share my defun's with you.  First and most
important, I do think that using [3] mastodon.el is way
better than using my elisp functions.  However, when
you're interested in a handful, very small functions to
post to mastodon, and manage them with org-mode, you
may have a look at the attached file.  Or someone is
interested in polishing things up and adding an
org-contrib package for this?


My process:

 - Use org-capture to create a new mastodon status
   update (at least, tag it with :toot:)
 - Write a message
 - add images with "attachment:/" URLs.  Those
   images will be uploaded as media and integrated
   in the status update
 - call `x/mastodon-post'
 - after success, PROPERTIES will be added like
   Mastodon ID, URL/URI and Media IDs
 - optionally, create a single-file Post with
   the org-dispatch interface (this is a custom
   export backend that is not included with this
   email, check [4] for further details how to set
   things up)

A reply to an existing mastodon post is sent when
a Mastodon_ID is found in the properties drawer one
level above.

This is what that looks like with my setup:

  

Currently, I do have one dependency (requests.el).  I
would have loved to remove this and use
url-retireve-synchronously but I were not able to
upload binary data with it.  If anyone has an idea
on that, please check out [5].


Please note: I bcc'ed to mastodon Users who replied to
the thread/direct messaged me and I was able to derive
an email address - so they get some form of follow up
notification on this.

[1] https://x.bch.at/@bch/111659014415841582
[2] https://x.bch.at/@bch/111659254718879041
[3] https://codeberg.org/martianh/mastodon.el
[4] https://orgmode.org/manual/Adding-Export-Back_002dends.html
[5] https://lists.gnu.org/archive/html/help-gnu-emacs/2024-03/msg00182.html
--
Christian Barthel



toots.el
Description: application/emacs-lisp


Re: org-clone-subtree-with-time-shift with reverse order

2024-04-14 Thread Christian Barthel
On Thursday, April 11, 2024, Ihor Radchenko wrote:

> Christian Barthel  writes:
>
>> I'd like to suggest adding a new prefix arg i.e.
>> `C-u C-u org-clone-subtree-with-item-shift' to reverse
>> the order of newly created / cloned siblings.  Would
>> that be of interest for other orgmode users?
>
> May you explain your use case a bit more?

The reason: I often use the
`org-tree-to-indirect-buffer'.  But when adding a new
sub-node with org-capture, it often was not shown
inside this indirect buffer.  Therefore, I prepended
all items with org-capture (:prepend t).  To intermix
this capturing process with the
org-clone-subtree-with-time-shift, it would have been
nice to specify the ordering.

*However* - this seems to be working with Emacs 29.3(?).
(I updated my Emacs to verify the current situation).

So I guess, this is actually no longer necessary
for my workflow and I can set :prepend to `nil'

On the other hand: There are ways to specify the
ordering like org-reverse-note-order.  Would it make
sense to have one global `org-reverse-order' that is
dealing with reversing "everything" that is somehow
dependent on ordering?

--
Christian Barthel



Re: Identical attributes id="text-table-of-contents" of div with role="doc-toc" when exporting to html when using tables of contents for multiple subheadings

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

>> div's for toc (with role="org-toc") in subheadings par 1 and par 2 get the
>> same id : text-table-of-contents :
>
> Confirmed.
> Timothy, could you take a look?
> We could probably modify the id in `org-html-toc' when SCOPE is non-nil.

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

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



Re: [BUG] bug in 'ox-man?

2024-04-14 Thread Ihor Radchenko
Greg Minshall  writes:

>> #+begin_src bash :results output :exports code :eval never-export
>>   echo 'lf "\n"'
>> #+end_src
>
> it seems that `.man` files are in troff(1) format, which uses backslash
> escapes up the wazoo (however that is spelled).  it seems that (one way)
> to getting a backslash character through troff is representing it as
> "\e".
>
> for my *particular* instance, where the backslash is in an org src
> block, the below modification to `(org-man-src-block)` may work.
>
> presumably one might have backslash sequences in example blocks, or in
> the main text, or ...?  i don't know enough to have any idea if there is
> some general mechanism that might solve all those.

See the attached tentative patch.

>From ef3fa244d1a32c2cce3616a6dffc9c3dcafd4e34 Mon Sep 17 00:00:00 2001
Message-ID: 
From: Ihor Radchenko 
Date: Sun, 14 Apr 2024 14:05:59 +0300
Subject: [PATCH] ox-man: Escape backslash characters in verbatim examples

* lisp/ox-man.el (org-man--protect-example): New helper function
protecting special escape characters inside literal examples.
(org-man-example-block):
(org-man-inline-src-block):
(org-man-src-block):
(org-man-table): Protect contents that is intended to be rendered
verbatim.

Reported-by: Greg Minshall 
Link: https://orgmode.org/list/2924644.1643637...@apollo2.minshall.org
---
 lisp/ox-man.el | 24 
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/lisp/ox-man.el b/lisp/ox-man.el
index 958740da8..cdd4fea7d 100644
--- a/lisp/ox-man.el
+++ b/lisp/ox-man.el
@@ -293,6 +293,13 @@ (defun org-man--protect-text (text)
   "Protect minus and backslash characters in string TEXT."
   (replace-regexp-in-string "-" "\\-" text nil t))
 
+(defun org-man--protect-example (text)
+  "Escape necessary characters for verbatim TEXT."
+  ;; See man groff_man_style; \e must be used to render backslash.
+  ;; Note that groff's .eo (disable backslash) and .ec (re-enable
+  ;; backslash) cannot be used as per the same man page.
+  (replace-regexp-in-string "" "\\e" text nil t))
+
 
 
 ;;; Template
@@ -400,7 +407,7 @@ (defun org-man-example-block (example-block _contents info)
   (org-man--wrap-label
example-block
(format ".RS\n.nf\n%s\n.fi\n.RE"
-   (org-export-format-code-default example-block info
+   (org-man--protect-example (org-export-format-code-default example-block info)
 
 
 ;;; Export Block
@@ -529,11 +536,11 @@ (defun org-man-inline-src-block (inline-src-block _contents info)
   (delete-file out-file)
   code-block)
   (format ".RS\n.nf\n\\fC\\m[black]%s\\m[]\\fP\n.fi\n.RE\n"
-  code
+  (org-man--protect-example code)
 
  ;; Do not use a special package: transcode it verbatim.
  (t
-  (concat ".RS\n.nf\n" "\\fC" "\n" code "\n"
+  (concat ".RS\n.nf\n" "\\fC" "\n" (org-man--protect-example code) "\n"
   "\\fP\n.fi\n.RE\n")
 
 
@@ -749,7 +756,7 @@ (defun org-man-src-block (src-block _contents info)
 contextual information."
   (if (not (plist-get info :man-source-highlight))
   (format ".RS\n.nf\n\\fC%s\\fP\n.fi\n.RE\n\n"
-	  (org-export-format-code-default src-block info))
+	  (org-man--protect-example (org-export-format-code-default src-block info)))
 (let* ((tmpdir temporary-file-directory)
 	   (in-file  (make-temp-name (expand-file-name "srchilite" tmpdir)))
 	   (out-file (make-temp-name (expand-file-name "reshilite" tmpdir)))
@@ -772,7 +779,7 @@ (defun org-man-src-block (src-block _contents info)
 	(delete-file in-file)
 	(delete-file out-file)
 	code-block)
-	(format ".RS\n.nf\n\\fC\\m[black]%s\\m[]\\fP\n.fi\n.RE" code)
+	(format ".RS\n.nf\n\\fC\\m[black]%s\\m[]\\fP\n.fi\n.RE" (org-man--protect-example code))
 
 
 ;;; Statistics Cookie
@@ -836,9 +843,10 @@ (defun org-man-table (table contents info)
 
 (format ".nf\n\\fC%s\\fP\n.fi"
 ;; Re-create table, without affiliated keywords.
-(org-trim
- (org-element-interpret-data
-  `(table nil ,@(org-element-contents table))
+(org-man--protect-example
+ (org-trim
+  (org-element-interpret-data
+   `(table nil ,@(org-element-contents table)))
;; Case 2: Standard table.
(t (org-man-table--org-table table contents info
 
-- 
2.44.0


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


[PATCH 2/2] org-capture: Allow table-line entry to start without |

2024-04-14 Thread Rens Oliemans
* lisp/org-capture.el (org-capture-place-table-line): Prepend
table-line begin ('|') if the template does not start with it.

* testing/lisp/test-org-capture.el (test-org-capture/table-line):
Verify that a template gets prepended with a '|' if it does not start
with it.
---
 lisp/org-capture.el  | 15 ---
 testing/lisp/test-org-capture.el | 10 ++
 2 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index 750778f8b..a56e75fda 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -1355,13 +1355,14 @@ may have been stored before."
 (defun org-capture-place-table-line ()
   "Place the template as a table line."
   (require 'org-table)
-  (let ((text
-(pcase (org-trim (org-capture-get :template))
-  ((pred (string-match-p org-table-border-regexp))
-   "| %?Bad template |")
-  (text (concat text "\n"
-   (table-line-pos (org-capture-get :table-line-pos))
-   beg end)
+  (let* ((template (org-trim (org-capture-get :template)))
+ (text
+ (pcase template
+   ((pred (string-match-p org-table-border-regexp))
+(concat "| " template))
+   (text (concat text "\n"
+(table-line-pos (org-capture-get :table-line-pos))
+beg end)
 (cond
  ((org-capture-get :exact-position)
   (org-with-point-at (org-capture-get :exact-position)
diff --git a/testing/lisp/test-org-capture.el b/testing/lisp/test-org-capture.el
index 9ab078193..6c13e8283 100644
--- a/testing/lisp/test-org-capture.el
+++ b/testing/lisp/test-org-capture.el
@@ -606,6 +606,16 @@
   "| 2 |" :immediate-finish t
  (org-capture nil "t"))
(buffer-string
+  ;; Prepend | when the template does not start with it
+  (should
+   (equal "| 1 |\n| 2 |\n"
+  (org-test-with-temp-text-in-file "| 1 |\n"
+(let* ((file (buffer-file-name))
+   (org-capture-templates
+`(("t" "Table" table-line (file ,file)
+   "2 |" :immediate-finish t
+  (org-capture nil "t")
+  (buffer-string)
   ;; When `:prepend' is nil, add the row at the end of the table.
   (should
(equal "| a |\n| x |\n"
-- 
2.44.0




[PATCH 1/2] org-capture: Allow entry template to start without heading

2024-04-14 Thread Rens Oliemans
* lisp/org-capture.el (org-capture-place-entry): Prepend heading to
template if the template does not yet start with a heading.

* testing/lisp/test-org-capture.el (test-org-capture/entry): Add two
tests: no error is raised when org-capture is called with a template
that does not start with a heading; and org-capture should error with
a template with a lower heading after a higher heading.

Link: https://list.orgmode.org/877chnc0lr.fsf@localhost/
---
First iteration of these patches, please let me know if anything can be 
improved, either
about the code or patches themselves (I am not used to sending patches via 
email).

 lisp/org-capture.el  |  1 +
 testing/lisp/test-org-capture.el | 17 +
 2 files changed, 18 insertions(+)

diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index da14f45c0..750778f8b 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -1198,6 +1198,7 @@ may have been stored before."
(exact-position (org-capture-get :exact-position))
(insert-here? (org-capture-get :insert-here))
(level 1))
+(unless (string-match "^*" template) (setq template (concat "* " 
template)))
 (org-capture-verify-tree template)
 (when exact-position (goto-char exact-position))
 (cond
diff --git a/testing/lisp/test-org-capture.el b/testing/lisp/test-org-capture.el
index 0ed44c6af..9ab078193 100644
--- a/testing/lisp/test-org-capture.el
+++ b/testing/lisp/test-org-capture.el
@@ -244,6 +244,23 @@
:immediate-finish t
(org-capture nil "t")
(buffer-string
+  ;; Do not raise an error on templates that do not start with a heading.
+  (should
+   (org-test-with-temp-text-in-file ""
+ (let* ((file (buffer-file-name))
+(org-capture-templates
+ `(("t" "Test" entry (file ,file) "Foo"
+:immediate-finish t
+   (org-capture nil "t"
+  ;; Raise an error on templates with a lower level heading after a
+  ;; higher level one.
+  (should-error
+   (org-test-with-temp-text-in-file ""
+ (let* ((file (buffer-file-name))
+(org-capture-templates
+ `(("t" "Test" entry (file ,file) "** X\n* Y"
+   :immediate-finish t
+   (org-capture nil "t"
   ;; With a 0 prefix argument, ignore surrounding lists.
   (should
(equal "Foo\n* X\nBar\n"
-- 
2.44.0



Re: [PATCH] lisp/org-clock.el (org-clock-sum): Rewrite regex using rx

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

> So, in the message I linked, Nicolas (the major Org mode contributor)
> was not right. I hence need to fix the parser and update Org syntax
> page. This includes fixing `org-element-clock-line-re' to account for
> CLOCK: => 1:00 syntax.

I changed the parser on main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=17072a469
and updated the syntax ref
https://git.sr.ht/~bzg/worg/commit/1c56837d

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



Re: [BUG] Org-Agenda leaves frame around [9.7-pre (release_9.6.8-785-g72bbf8.dirty @ /home/bidar/.local/private/etc/emacs/lib/org/lisp/)]

2024-04-14 Thread Ihor Radchenko
Björn Bidar  writes:

>> Fixed, on main. Alongside with other similar places.
>> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=78e9dd0c4
>
> I noticed after the change that captured links are not picked up.
>
> E.g.:
> 1. I capture a link using org-protocol
> 2. Switch to the org-buffer
> 3. C-c C-l
> 4. RET  <- frame closes however links isn't inserted into the target 
> org-buffer 

May you provide more details about how to reproduce?

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



Re: org-clone-subtree-with-time-shift with reverse order

2024-04-14 Thread Ihor Radchenko
Christian Barthel  writes:

> On the other hand: There are ways to specify the
> ordering like org-reverse-note-order.  Would it make
> sense to have one global `org-reverse-order' that is
> dealing with reversing "everything" that is somehow
> dependent on ordering?

The problem is that it is not very clear what to do when:

org-clone-subtree-with-time-shift docstring:

If the original subtree did contain time stamps with a repeater,
the following will happen:
...
- the original entry will be placed *after* all the clones, with
  repeater intact.

So, the change is not trivial.

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



Re: [PATCH 1/2] org-capture: Allow entry template to start without heading

2024-04-14 Thread Ihor Radchenko
Rens Oliemans  writes:

> * lisp/org-capture.el (org-capture-place-entry): Prepend heading to
> template if the template does not yet start with a heading.
>
> * testing/lisp/test-org-capture.el (test-org-capture/entry): Add two
> tests: no error is raised when org-capture is called with a template
> that does not start with a heading; and org-capture should error with
> a template with a lower heading after a higher heading.
>
> Link: https://list.orgmode.org/877chnc0lr.fsf@localhost/
> ---
> First iteration of these patches, please let me know if anything can be 
> improved, either
> about the code or patches themselves (I am not used to sending patches via 
> email).

Thanks!
I have improved your patches a little, fixing the regular expression
used to match headings ("^*" is not accurate, you need
org-outline-regexp-bol), and adding another test case.
See the attached.

Before I install the patches, may I know if you have FSF copyright
assignment? See https://orgmode.org/worg/org-contribute.html#copyright

>From 36639ac711f099b49900d886ad28d29abc1b29ed Mon Sep 17 00:00:00 2001
Message-ID: <36639ac711f099b49900d886ad28d29abc1b29ed.1713102029.git.yanta...@posteo.net>
From: Rens Oliemans 
Date: Sun, 14 Apr 2024 13:24:49 +0200
Subject: [PATCH v2 1/2] org-capture: Allow entry template to start without
 heading

* lisp/org-capture.el (org-capture-place-entry): Prepend heading to
template if the template does not yet start with a heading.

* testing/lisp/test-org-capture.el (test-org-capture/entry): Add two
tests: no error is raised when org-capture is called with a template
that does not start with a heading; and org-capture should error with
a template with a lower heading after a higher heading.

Link: https://list.orgmode.org/877chnc0lr.fsf@localhost/
---
 lisp/org-capture.el  |  2 ++
 testing/lisp/test-org-capture.el | 24 
 2 files changed, 26 insertions(+)

diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index da14f45c0..a95a38162 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -1198,6 +1198,8 @@ (defun org-capture-place-entry ()
 	(exact-position (org-capture-get :exact-position))
 	(insert-here? (org-capture-get :insert-here))
 	(level 1))
+(unless (string-match org-outline-regexp-bol template)
+  (setq template (concat "* " template)))
 (org-capture-verify-tree template)
 (when exact-position (goto-char exact-position))
 (cond
diff --git a/testing/lisp/test-org-capture.el b/testing/lisp/test-org-capture.el
index 0ed44c6af..4e9139c40 100644
--- a/testing/lisp/test-org-capture.el
+++ b/testing/lisp/test-org-capture.el
@@ -244,6 +244,30 @@ (ert-deftest test-org-capture/entry ()
 		:immediate-finish t
(org-capture nil "t")
(buffer-string
+  ;; Do not raise an error on templates that do not start with a heading.
+  (should
+   (org-test-with-temp-text-in-file ""
+ (let* ((file (buffer-file-name))
+(org-capture-templates
+ `(("t" "Test" entry (file ,file) "Foo"
+:immediate-finish t
+   (org-capture nil "t"
+  (should
+   (org-test-with-temp-text-in-file ""
+ (let* ((file (buffer-file-name))
+(org-capture-templates
+ `(("t" "Test" entry (file ,file) "*bold*"
+:immediate-finish t
+   (org-capture nil "t"
+  ;; Raise an error on templates with a lower level heading after a
+  ;; higher level one.
+  (should-error
+   (org-test-with-temp-text-in-file ""
+ (let* ((file (buffer-file-name))
+(org-capture-templates
+ `(("t" "Test" entry (file ,file) "** X\n* Y"
+	:immediate-finish t
+   (org-capture nil "t"
   ;; With a 0 prefix argument, ignore surrounding lists.
   (should
(equal "Foo\n* X\nBar\n"
-- 
2.44.0

>From af0b56f3338b8700bd6096e4963c95436b1a14b0 Mon Sep 17 00:00:00 2001
Message-ID: 
In-Reply-To: <36639ac711f099b49900d886ad28d29abc1b29ed.1713102029.git.yanta...@posteo.net>
References: <36639ac711f099b49900d886ad28d29abc1b29ed.1713102029.git.yanta...@posteo.net>
From: Rens Oliemans 
Date: Sun, 14 Apr 2024 13:24:51 +0200
Subject: [PATCH v2 2/2] org-capture: Allow table-line entry to start without |

* lisp/org-capture.el (org-capture-place-table-line): Prepend
table-line begin ('|') if the template does not start with it.

* testing/lisp/test-org-capture.el (test-org-capture/table-line):
Verify that a template gets prepended with a '|' if it does not start
with it.
---
 lisp/org-capture.el  | 15 ---
 testing/lisp/test-org-capture.el | 10 ++
 2 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index a95a38162..205d09da8 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -1356,13 +1356,14 @@ (defun org-capture-place-item ()
 (defun org-capture-place-table-line ()
   "Place the template as a table line."
   (require 'org-table)
-  (let ((text
-	 (pcase (

Attributes on images (was:: Experimental public branch for inline special blocks)

2024-04-14 Thread Rick Lupton
Thanks for taking the time to comment thoroughly on this which seems generally 
like it would be a good improvement.

On Tue, 9 Apr 2024, at 9:52 AM, Ihor Radchenko wrote:
> 2. Allow attaching auxiliary attributes to the on object level, as an
>equivalent of affiliated keywords on element level
>
>- For example, we should allow assigning height per-link without the
>  awkward kludge we have with special handling of
> 
>  #+attr_html: :height 300
>  [[file:image.png]] has a height of 300, but what if we want a
>  different height in [[file:another-image.png]]?
>
>  We can thus do
> 
>  #+attr_html: :height 300
>  [[file:image.png]] has a height of 300, but what if we want a
>  different height in @@[:html-height 300]{[[file:another-image.png]]}?
>
>  Note how @@{...} markup assigns attributes to objects inside - the
>  attributes should be somehow inherited.

This way of assigning a height to the image seems odd to me.  Mostly, the 
attributes specified by the inline block apply to the block, not the contents, 
so wouldn't this case be potentially surprising?

Both of these examples mean different things in HTML, and it seems like you 
might want to create either -- how would you control which was produced using 
the "@@[:html-height 300]{[[file:another-image.png]]}" syntax?





Instead, I wonder if the problem is that the way of inserting an image using a 
link itself.  If you need more control, could there be a special "img" inline 
special block which can handle additional attributes?

For example: 

@img[:height 300]{image.png} has a height of 300, and we can also have images 
with different heights and attributes like @img[:height 400 :alt "An 
image"]{another-image.png}.

Or, if using the original syntax, perhaps the attribute should be explicitly 
:img-attr or :img-height to resolve the ambiguity about which element is being 
targetted?

Rick



Re: [PATCH 1/2] org-capture: Allow entry template to start without heading

2024-04-14 Thread Rens Oliemans
Ihor Radchenko  writes:

> I have improved your patches a little, fixing the regular expression
> used to match headings ("^*" is not accurate, you need
> org-outline-regexp-bol), and adding another test case.
> See the attached.

Ah I see the difference, good catch. Thank you for the improvements!

> Before I install the patches, may I know if you have FSF copyright
> assignment? See https://orgmode.org/worg/org-contribute.html#copyright

I had not done that yet. I have just sent the form to the FSF. I will let
you know when the process is complete.

Best,
Rens



Re: Attributes on images (was:: Experimental public branch for inline special blocks)

2024-04-14 Thread Ihor Radchenko
"Rick Lupton"  writes:

>>  #+attr_html: :height 300
>>  [[file:image.png]] has a height of 300, but what if we want a
>>  different height in @@[:html-height 300]{[[file:another-image.png]]}?
>>
>>  Note how @@{...} markup assigns attributes to objects inside - the
>>  attributes should be somehow inherited.
>
> This way of assigning a height to the image seems odd to me.  Mostly, the 
> attributes specified by the inline block apply to the block, not the 
> contents, so wouldn't this case be potentially surprising?

We already have #+attr_html: :height 300 that applies to the whole
paragraph and it is not going anywhere. So, my idea is natural given the
existing convention.

And I explicitly suggested that attributes of anonymous inline blocks
@@[...]{...} will be inherited by all other markup. This is not just for
images, but in case if we want some extra configuration for other
traditional Org markup:
@@[:weight semi-bold]{All the *bold text here* will *be* semi-bold.}

Also, one may do something like

@@[:html-height 300]{This [[file:image.png]] and that
[[file:other-image.png]]}, but not third [[file:yet-another-image.png]].

> Both of these examples mean different things in HTML, and it seems like you 
> might want to create either -- how would you control which was produced using 
> the "@@[:html-height 300]{[[file:another-image.png]]}" syntax?
>
> 
>
> 

Anonymous inline markup will not at all be exported by itself. Its
purpose is to provide attributes or serve as back escape sequence.

So, I envision your examples as

@span{@@[:html-height 300]{}}

@span[:html-style height: 300]{}

> Instead, I wonder if the problem is that the way of inserting an image using 
> a link itself.  If you need more control, could there be a special "img" 
> inline special block which can handle additional attributes?
>
> For example: 
>
> Or, if using the original syntax, perhaps the attribute should be explicitly 
> :img-attr or :img-height to resolve the ambiguity about which element is 
> being targetted?

I do not have much of an opinion about the attribute names. If we need
to make them unique, that's totally fine and does not affect the overall
syntax design. I used image height simply as an illustration of the idea
of attribute inheritance. The above example with attributes for *bold*
is illustrating the same idea.

> @img[:height 300]{image.png} has a height of 300, and we can also have images 
> with different heights and attributes like @img[:height 400 :alt "An 
> image"]{another-image.png}.

This is also an option, although it allows setting attributes only for a
single image. Maybe we can modify the anonymous markup to make its
attributes be inherited by a subset of the markup inside:

@@[:parent-of link :height 300]{Only [[file:link.png]] inherits :height
attribute, but not @bold{other markup}}

This way, we can have some interesting options for ad-hoc markup like

#+inline_attr:tall: :parent-of link, latex-fragment :height 1000

@tall{All the images and latex inside will be tall: 
 \(x^2\)}

Another aspect of your example is that you implicitly suggested an
alternative link markup, which raises a more general question - should
we allow making the inline markup an alias of an existing markup?

This may require two alternative approaches:

a. Special treatment of certain inline markup names, like

   @code{verbatim code}
   @verbatim{...}
   @bold{...}
   @italic{...}
   @underline{...}
   @strikethrough{...}
   @link[...]{path}{description}

   (we need such special treatment to make sure that, for example,
   @bold{...} in Org files can still be correctly exported by export
   backends not aware about the new inline markup)

b. In addition to :export_template idea I proposed that would define
   custom *per-backend* export rules, we will need some way to define
   ad-hoc markup in terms of the more traditional Org markup:

   @code{...} == ~code~
   @bold{...} == *bold*

   or even

   @alert{...} == @bold{@italic{...}}

I personally feel that b is more powerful, but it is getting so close to
the idea of {{{macros}}} that we may confuse users.

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



[BUG] crash [9.7-pre (release_9.6.11-927-g819cd7 @ /home/minshall/.emacs.d/straight/build/org/)]

2024-04-14 Thread Greg Minshall


Remember to cover the basics, that is, what you expected to happen and
what in fact did happen.  You don't know how to make a good report?  See

 https://orgmode.org/manual/Feedback.html#Feedback

Your bug report will be posted to the Org mailing list.


i was editing a buffer, but it was in read-only mode, so i closed the
buffer and re-visited the file, then hit something like carriage return
and got the crash.

(it's possible, i suppose, that i was doing some for of "org-capture"
for that buffer?)

cheers.

-
⛔ Warning (org-element-cache): org-element--cache: Org parser error in 
sysnotes.org::2622892. Resetting.
 The error was: (error "org-element--cache: Emergency exit")
 Backtrace:
"  backtrace-to-string(nil)
  (progn (backtrace-to-string (backtrace-get-frames 'backtrace)))
  (if (and (fboundp 'backtrace-get-frames) (fboundp 'backtrace-to-string)) 
(progn (backtrace-to-string (backtrace-get-frames 'backtrace
  (format \"Org parser error in %s::%S. Resetting.\\n The error was: %S\\n 
Backtrace:\\n%S\\n Please report this to Org mode mailing list (M-x 
org-submit-bug-report).\" (buffer-name (current-buffer)) epom err (if (and 
(fboundp 'backtrace-get-frames) (fboundp 'backtrace-to-string)) (progn 
(backtrace-to-string (backtrace-get-frames 'backtrace)
  (let* ((format-string (format \"Org parser error in %s::%S. Resetting.\\n The 
error was: %S\\n Backtrace:\\n%S\\n Please report this to Org mode mailing list 
(M-x org-submit-bug-report).\" (buffer-name (current-buffer)) epom err (if (and 
(fboundp 'backtrace-get-frames) (fboundp 'backtrace-to-string)) (progn 
(backtrace-to-string (backtrace-get-frames ...)) (format-string (if (or 
(not org-element--cache-diagnostics-ring) (not (eq 'backtrace 
org-element--cache-self-verify))) format-string (prog1 (concat (format 
\"Warning(%s): \" (buffer-name ...)) format-string \"\\nBacktrace:\\n  \" 
(mapconcat #'identity (ring-elements org-element--cache-diagnostics-ring) \"\\n 
 \")) (setq org-element--cache-diagnostics-ring nil) (if (and (boundp 
'org-batch-test) org-batch-test) (error \"%s\" (concat \"org-element--cache: \" 
format-string)) (display-warning 'org-element-cache (concat 
\"org-element--cache: \" format-string
  (condition-case err (org-element--parse-to epom) ((debug error) (let* 
((format-string (format \"Org parser error in %s::%S. Resetting.\\n The error 
was: %S\\n Backtrace:\\n%S\\n Please report this to Org mode mailing list (M-x 
org-submit-bug-report).\" (buffer-name (current-buffer)) epom err (if (and ... 
...) (progn ... (format-string (if (or (not 
org-element--cache-diagnostics-ring) (not ...)) format-string (prog1 (concat 
... format-string \"\\nBacktrace:\\n  \" ...) (setq 
org-element--cache-diagnostics-ring nil) (if (and (boundp 'org-batch-test) 
org-batch-test) (error \"%s\" (concat \"org-element--cache: \" format-string)) 
(display-warning 'org-element-cache (concat \"org-element--cache: \" 
format-string (org-element-cache-reset) (org-element--parse-to epom)))
  (if cached-only (if (and (org-element--cache-active-p) (or (not 
org-element--cache-sync-requests) (< epom (aref (car 
org-element--cache-sync-requests) 1 (progn (org-element--cache-find epom))) 
(condition-case err (org-element--parse-to epom) ((debug error) (let* 
((format-string (format \"Org parser error in %s::%S. Resetting.\\n The error 
was: %S\\n Backtrace:\\n%S\\n Please report this to Org mode mailing list (M-x 
org-submit-bug-report).\" (buffer-name ...) epom err (if ... ...))) 
(format-string (if (or ... ...) format-string (prog1 ... ... (if (and 
(boundp 'org-batch-test) org-batch-test) (error \"%s\" (concat 
\"org-element--cache: \" format-string)) (display-warning 'org-element-cache 
(concat \"org-element--cache: \" format-string (org-element-cache-reset) 
(org-element--parse-to epom
  (setq element (if cached-only (if (and (org-element--cache-active-p) (or (not 
org-element--cache-sync-requests) (< epom (aref (car 
org-element--cache-sync-requests) 1 (progn (org-element--cache-find epom))) 
(condition-case err (org-element--parse-to epom) ((debug error) (let* 
((format-string (format \"Org parser error in %s::%S. Resetting.\\n The error 
was: %S\\n Backtrace:\\n%S\\n Please report this to Org mode mailing list (M-x 
org-submit-bug-report).\" ... epom err ...)) (format-string (if ... 
format-string ...))) (if (and (boundp ...) org-batch-test) (error \"%s\" 
(concat \"org-element--cache: \" format-string)) (display-warning 
'org-element-cache (concat \"org-element--cache: \" format-string 
(org-element-cache-reset) (org-element--parse-to epom)
  (let (element) (if (org-element--cache-active-p) (progn (if (not 
(save-current-buffer (set-buffer (or ... ...)) org-element--cache)) 
(org-element-cache-reset) (if cached-only nil (org-element--cache-sync 
(current-buffer) epom) (setq element (if cached-only (if (and 
(org