From: Timothy <tecosaur@gmail.com>
To: Yuu Yin <yuuyin@protonmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: org-cite: enable inserting citation (org-cite-insert) after list bullet [9.5 (9.5-7c78aca @ /home/yuu/.config/emacs/straight/build/org/)]
Date: Tue, 31 Aug 2021 18:24:57 +0800 [thread overview]
Message-ID: <87a6kxq32h.fsf@gmail.com> (raw)
In-Reply-To: <f-nnTXd9TbWTo88E8NbN4thSGH0e_Stsrb8Tu0d83eJNL0DJaEYAoq_m1zNAZmzAyGlZxJ0c-HJjJV4m8H7iLaNwzicss0hSboBbNxG0ZTE=@protonmail.com>
[-- Attachment #1: Type: text/plain, Size: 810 bytes --]
Yuu Yin <yuuyin@protonmail.com> writes:
> Invoking ~org-cite-insert~ after list bullets (e.g. ~-~ and ~1.~ )
> doesn't work.
I did a little test myself, and can confirm that it's not currently
possible to insert a citation *immediately* after a bullet and space.
This can be checked with `org-cite--allowed-p'.
Thinking about this situation, inserting citations should be fine as
long as the `point' isn't before or immediately after the bullet itself
(i.e. no space).
I've prepared a patch that fixes this (attached). This is the test case
that I'm adding:
+ ((eq type 'item)
+ (> (point) (+ (org-element-property :begin context)
+ (org-get-indentation)
+ 1)))
As this is so simple, if nobody has any comments I'll push this in a
week or so.
--
Timothy
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-oc-allow-citations-following-an-item-bullet.patch --]
[-- Type: text/x-patch, Size: 1181 bytes --]
From 8a242b6c80c2ec2b384f12c16bb9f70c2d44c9c7 Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Tue, 31 Aug 2021 19:03:19 +0800
Subject: [PATCH] oc: allow citations following an item bullet
* lisp/oc.el (org-cite--allowed-p): Expand the allowed cases to include
"item", which lets one insert a citation following a bullet, e.g. "- ".
We just have to check to make sure the citation actually is at least one
character away from the bullet.
---
lisp/oc.el | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/lisp/oc.el b/lisp/oc.el
index 5fcb9da62..7ffe37e57 100644
--- a/lisp/oc.el
+++ b/lisp/oc.el
@@ -1426,6 +1426,11 @@ (defun org-cite--allowed-p (context)
((= (point) (org-element-property :begin context)))
;; Within recursive object too, but not in a link.
((eq type 'link) nil)
+ ;; At the start of a list item is fine, as long as the bullet is unaffected.
+ ((eq type 'item)
+ (> (point) (+ (org-element-property :begin context)
+ (org-get-indentation)
+ 1)))
((eq type 'table-cell)
;; :contents-begin is not reliable on empty cells, so special
;; case it.
--
2.33.0
next prev parent reply other threads:[~2021-08-31 11:22 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-26 12:18 org-cite: enable inserting citation (org-cite-insert) after list bullet [9.5 (9.5-7c78aca @ /home/yuu/.config/emacs/straight/build/org/)] Yuu Yin
2021-08-31 10:24 ` Timothy [this message]
2021-08-31 11:41 ` Bruce D'Arcus
2021-09-01 16:05 ` Yuu Yin
2021-09-18 5:40 ` Timothy
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=87a6kxq32h.fsf@gmail.com \
--to=tecosaur@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=yuuyin@protonmail.com \
/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).