emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@posteo.net>
To: "M. ‘quintus’ Gülker" <post+orgmodeml@guelker.eu>
Cc: Nicolas Goaziou <mail@nicolasgoaziou.fr>,  emacs-orgmode@gnu.org
Subject: [RFC PATCH] Re: [bug] Macro in citation not expanded
Date: Tue, 18 Oct 2022 04:31:40 +0000	[thread overview]
Message-ID: <87k04xhhw3.fsf@localhost> (raw)
In-Reply-To: <87tu425pla.fsf@guelker.eu>

[-- Attachment #1: Type: text/plain, Size: 903 bytes --]

M. ‘quintus’ Gülker <post+orgmodeml@guelker.eu> writes:

>> It sounds reasonable to allow macros inside citation references.
>> Maybe we also want to allow other things. Maybe simply allow all objects
>> but other citations, line-breaks, and table-cells?
>
> I have no strong opinion on this. I certainly do not need tables inside
> citations. If it is easy to just permit everything except what you
> named, I would say just allow it. Maybe someone has use for it. Maybe
> footnotes inside [cite:] construct should also not be allowed, at least
> for footnote-based styles.

See the attached WIP patch.
Note that I also removed link as our tests explicitly test against
having links inside citation references.

However, I can see how links can be useful in prefix/suffix...
I am wondering what was the rationale behind disallowing so many objects
inside citation references.


[-- Attachment #2: 0001-org-element-Allow-more-objects-inside-citations.patch --]
[-- Type: text/x-patch, Size: 1887 bytes --]

From aa3fac7248aa1201bbf92d492dcd5c79f8d0a544 Mon Sep 17 00:00:00 2001
Message-Id: <aa3fac7248aa1201bbf92d492dcd5c79f8d0a544.1666067320.git.yantar92@posteo.net>
From: Ihor Radchenko <yantar92@posteo.net>
Date: Tue, 18 Oct 2022 12:22:56 +0800
Subject: [PATCH] org-element: Allow more objects inside citations
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* lisp/org-element.el (org-element-object-restrictions): Allow all but
citation, citation-reference, line-break, table-cell, link and
footnote-reference objects inside citations.

Reported-by: M. ‘quintus’ Gülker <post+orgmodeml@guelker.eu>
Link: https://orgmode.org/list/87tu425pla.fsf@guelker.eu
---
 lisp/org-element.el | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/lisp/org-element.el b/lisp/org-element.el
index 7b26e877e..7aac00087 100644
--- a/lisp/org-element.el
+++ b/lisp/org-element.el
@@ -401,10 +401,14 @@ (defconst org-element-object-restrictions
 			     subscript superscript underline verbatim))
 	 (standard-set
 	  (remq 'citation-reference (remq 'table-cell org-element-all-objects)))
-	 (standard-set-no-line-break (remq 'line-break standard-set)))
+	 (standard-set-no-line-break (remq 'line-break standard-set))
+         (standard-set-for-citations (seq-difference
+                                      standard-set-no-line-break
+                                      '( citation citation-reference
+                                         footnote-reference link))))
     `((bold ,@standard-set)
       (citation citation-reference)
-      (citation-reference ,@minimal-set)
+      (citation-reference ,@standard-set-for-citations)
       (footnote-reference ,@standard-set)
       (headline ,@standard-set-no-line-break)
       (inlinetask ,@standard-set-no-line-break)
-- 
2.35.1


[-- Attachment #3: Type: text/plain, Size: 224 bytes --]


-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>

  reply	other threads:[~2022-10-18  4:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-16  9:07 [bug] Macro in citation not expanded M. ‘quintus’ Gülker
2022-10-16  9:32 ` Ihor Radchenko
2022-10-17 17:11   ` M. ‘quintus’ Gülker
2022-10-18  4:31     ` Ihor Radchenko [this message]
2022-11-11 20:50       ` [RFC PATCH] " M. ‘quintus’ Gülker
2022-11-13  4:12         ` Ihor Radchenko
2024-01-24 11:30       ` Ihor Radchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87k04xhhw3.fsf@localhost \
    --to=yantar92@posteo.net \
    --cc=emacs-orgmode@gnu.org \
    --cc=mail@nicolasgoaziou.fr \
    --cc=post+orgmodeml@guelker.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).