emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Pedro Andres Aranda Gutierrez <paaguti@gmail.com>
To: Org Mode List <emacs-orgmode@gnu.org>,
	orgmode@tec.tecosaur.net,  Ihor Radchenko <yantar92@posteo.net>
Subject: Another low-hanging fruit
Date: Sat, 3 Feb 2024 08:19:01 +0100	[thread overview]
Message-ID: <CAO48Bk9gFWe-ro5yH8q=tQL1JH=mJOeRGiWi+ANCQuaRPhKauA@mail.gmail.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 459 bytes --]

Hi,

This is another low hanging fruit. I was a bit annoyed to have to leave an
empty label for inlined footnotes (à la LaTeX)... I don't know if this
qualifies as a TINYCHANGE...

Best, /PA
-- 
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

[-- Attachment #1.2: Type: text/html, Size: 781 bytes --]

[-- Attachment #2: 0001-Silent-anonymous-footnote-creation.patch --]
[-- Type: text/x-patch, Size: 2478 bytes --]

From 0767bccaabde21241576eaac1103e917c7649f40 Mon Sep 17 00:00:00 2001
From: "Pedro A. Aranda Gutiérrez" <paaguti@gmail.com>
Date: Sat, 3 Feb 2024 08:12:12 +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 more
useful in long texts. Mimics \footnote{} in LaTeX.

---
 lisp/org-footnote.el | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

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

 nil        Prompt the user for each label.
 t          Create unique labels of the form [fn:1], [fn:2], etc.
+anonymous  Create anonymous labels
 confirm    Like 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)
 	   (insert "[fn::]")
 	   (backward-char 1))
--
2.34.1

             reply	other threads:[~2024-02-03  7:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-03  7:19 Pedro Andres Aranda Gutierrez [this message]
2024-02-03 16:06 ` Another low-hanging fruit Ihor Radchenko
2024-02-04 13:59 ` Ihor Radchenko
     [not found]   ` <CAO48Bk-7kxHbYvbNT90QQ_3O5L23bdcQzMrqwa5bXnJjxepg-Q@mail.gmail.com>
     [not found]     ` <87cytc13ad.fsf@localhost>
2024-02-05  6:27       ` Pedro Andres Aranda Gutierrez
2024-02-05 14:41         ` 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='CAO48Bk9gFWe-ro5yH8q=tQL1JH=mJOeRGiWi+ANCQuaRPhKauA@mail.gmail.com' \
    --to=paaguti@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=orgmode@tec.tecosaur.net \
    --cc=yantar92@posteo.net \
    /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).