emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Another low-hanging fruit
@ 2024-02-03  7:19 Pedro Andres Aranda Gutierrez
  2024-02-03 16:06 ` Ihor Radchenko
  2024-02-04 13:59 ` Ihor Radchenko
  0 siblings, 2 replies; 5+ messages in thread
From: Pedro Andres Aranda Gutierrez @ 2024-02-03  7:19 UTC (permalink / raw)
  To: Org Mode List, orgmode, Ihor Radchenko


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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-02-05 15:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-03  7:19 Another low-hanging fruit Pedro Andres Aranda Gutierrez
2024-02-03 16:06 ` 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

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