emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] New option to create unique, random labels for footnotes.
@ 2011-03-11 13:50 Matt Lundin
  2011-03-17  8:25 ` [Accepted] " Bastien Guerry
  2011-03-17  8:26 ` [PATCH] " Bastien
  0 siblings, 2 replies; 4+ messages in thread
From: Matt Lundin @ 2011-03-11 13:50 UTC (permalink / raw)
  To: Org Mode

* lisp/org-footnote.el: (org-footnote-auto-label): New random option
* lisp/org-footnote.el: (org-footnote-new): Create random footnote
  labels with unique ids
---
 lisp/org-footnote.el |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/lisp/org-footnote.el b/lisp/org-footnote.el
index 2ce6668..9dbd6be 100644
--- a/lisp/org-footnote.el
+++ b/lisp/org-footnote.el
@@ -113,12 +113,14 @@ t          create unique labels of the form [fn:1], [fn:2], ...
 confirm    like t, but let the user edit the created value.  In particular,
            the label can be removed from the minibuffer, to create
            an anonymous footnote.
+random	   Automatically generate a unique, random label.
 plain      Automatically create plain number labels like [1]"
   :group 'org-footnote
   :type '(choice
 	  (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 a random label" random)
 	  (const :tag "Create automatic [N]" plain)))
 
 (defcustom org-footnote-auto-adjust nil
@@ -253,16 +255,22 @@ This command prompts for a label.  If this is a label referencing an
 existing label, only insert the label.  If the footnote label is empty
 or new, let the user edit the definition of the footnote."
   (interactive)
-  (let* ((labels (org-footnote-all-labels))
+  (let* ((labels (and (not (equal org-footnote-auto-label 'random))
+		      (org-footnote-all-labels)))
 	 (propose (org-footnote-unique-label labels))
 	 (label
-	  (if (member org-footnote-auto-label '(t plain))
-	      propose
+	  (cond 
+	   ((member org-footnote-auto-label '(t plain))
+	    propose)
+	   ((equal org-footnote-auto-label 'random)
+	    (require 'org-id)
+	    (substring (org-id-uuid) 0 8))
+	   (t
 	    (completing-read
 	     "Label (leave empty for anonymous): "
 	     (mapcar 'list labels) nil nil
 	     (if (eq org-footnote-auto-label 'confirm) propose nil)
-	     'org-footnote-label-history))))
+	     'org-footnote-label-history)))))
     (setq label (org-footnote-normalize-label label))
     (cond
      ((equal label "")
-- 
1.7.4.1

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

* [Accepted] New option to create unique, random labels for footnotes.
  2011-03-11 13:50 [PATCH] New option to create unique, random labels for footnotes Matt Lundin
@ 2011-03-17  8:25 ` Bastien Guerry
  2011-03-17 12:35   ` Scot Becker
  2011-03-17  8:26 ` [PATCH] " Bastien
  1 sibling, 1 reply; 4+ messages in thread
From: Bastien Guerry @ 2011-03-17  8:25 UTC (permalink / raw)
  To: emacs-orgmode

Patch 680 (http://patchwork.newartisans.com/patch/680/) is now "Accepted".

Maintainer comment: none

This relates to the following submission:

http://mid.gmane.org/%3C87y64ji2hj.fsf%40fastmail.fm%3E

Here is the original message containing the patch:

> Content-Type: text/plain; charset="utf-8"
> MIME-Version: 1.0
> Content-Transfer-Encoding: 7bit
> Subject: [O] New option to create unique, random labels for footnotes.
> Date: Fri, 11 Mar 2011 18:50:59 -0000
> From: Matt Lundin <mdl@imapmail.org>
> X-Patchwork-Id: 680
> Message-Id: <87y64ji2hj.fsf@fastmail.fm>
> To: Org Mode <emacs-orgmode@gnu.org>
> 
> * lisp/org-footnote.el: (org-footnote-auto-label): New random option
> * lisp/org-footnote.el: (org-footnote-new): Create random footnote
>   labels with unique ids
> 
> ---
> lisp/org-footnote.el |   16 ++++++++++++----
>  1 files changed, 12 insertions(+), 4 deletions(-)
> 
> diff --git a/lisp/org-footnote.el b/lisp/org-footnote.el
> index 2ce6668..9dbd6be 100644
> --- a/lisp/org-footnote.el
> +++ b/lisp/org-footnote.el
> @@ -113,12 +113,14 @@ t          create unique labels of the form [fn:1], [fn:2], ...
>  confirm    like t, but let the user edit the created value.  In particular,
>             the label can be removed from the minibuffer, to create
>             an anonymous footnote.
> +random	   Automatically generate a unique, random label.
>  plain      Automatically create plain number labels like [1]"
>    :group 'org-footnote
>    :type '(choice
>  	  (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 a random label" random)
>  	  (const :tag "Create automatic [N]" plain)))
>  
>  (defcustom org-footnote-auto-adjust nil
> @@ -253,16 +255,22 @@ This command prompts for a label.  If this is a label referencing an
>  existing label, only insert the label.  If the footnote label is empty
>  or new, let the user edit the definition of the footnote."
>    (interactive)
> -  (let* ((labels (org-footnote-all-labels))
> +  (let* ((labels (and (not (equal org-footnote-auto-label 'random))
> +		      (org-footnote-all-labels)))
>  	 (propose (org-footnote-unique-label labels))
>  	 (label
> -	  (if (member org-footnote-auto-label '(t plain))
> -	      propose
> +	  (cond 
> +	   ((member org-footnote-auto-label '(t plain))
> +	    propose)
> +	   ((equal org-footnote-auto-label 'random)
> +	    (require 'org-id)
> +	    (substring (org-id-uuid) 0 8))
> +	   (t
>  	    (completing-read
>  	     "Label (leave empty for anonymous): "
>  	     (mapcar 'list labels) nil nil
>  	     (if (eq org-footnote-auto-label 'confirm) propose nil)
> -	     'org-footnote-label-history))))
> +	     'org-footnote-label-history)))))
>      (setq label (org-footnote-normalize-label label))
>      (cond
>       ((equal label "")
> 

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

* Re: [PATCH] New option to create unique, random labels for footnotes.
  2011-03-11 13:50 [PATCH] New option to create unique, random labels for footnotes Matt Lundin
  2011-03-17  8:25 ` [Accepted] " Bastien Guerry
@ 2011-03-17  8:26 ` Bastien
  1 sibling, 0 replies; 4+ messages in thread
From: Bastien @ 2011-03-17  8:26 UTC (permalink / raw)
  To: Matt Lundin; +Cc: Org Mode

Hi Matt,

thanks for this set of patch -- I applied them.

-- 
 Bastien

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

* Re: [Accepted] New option to create unique, random labels for footnotes.
  2011-03-17  8:25 ` [Accepted] " Bastien Guerry
@ 2011-03-17 12:35   ` Scot Becker
  0 siblings, 0 replies; 4+ messages in thread
From: Scot Becker @ 2011-03-17 12:35 UTC (permalink / raw)
  To: Bastien Guerry; +Cc: emacs-orgmode

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

I like this, Matt!

On Thu, Mar 17, 2011 at 8:25 AM, Bastien Guerry <bzg@altern.org> wrote:

> Patch 680 (http://patchwork.newartisans.com/patch/680/) is now "Accepted".
>
> Maintainer comment: none
>
> This relates to the following submission:
>
> http://mid.gmane.org/%3C87y64ji2hj.fsf%40fastmail.fm%3E
>
> Here is the original message containing the patch:
>
> > Content-Type: text/plain; charset="utf-8"
> > MIME-Version: 1.0
> > Content-Transfer-Encoding: 7bit
> > Subject: [O] New option to create unique, random labels for footnotes.
> > Date: Fri, 11 Mar 2011 18:50:59 -0000
> > From: Matt Lundin <mdl@imapmail.org>
> > X-Patchwork-Id: 680
> > Message-Id: <87y64ji2hj.fsf@fastmail.fm>
> > To: Org Mode <emacs-orgmode@gnu.org>
> >
> > * lisp/org-footnote.el: (org-footnote-auto-label): New random option
> > * lisp/org-footnote.el: (org-footnote-new): Create random footnote
> >   labels with unique ids
> >
> > ---
> > lisp/org-footnote.el |   16 ++++++++++++----
> >  1 files changed, 12 insertions(+), 4 deletions(-)
> >
> > diff --git a/lisp/org-footnote.el b/lisp/org-footnote.el
> > index 2ce6668..9dbd6be 100644
> > --- a/lisp/org-footnote.el
> > +++ b/lisp/org-footnote.el
> > @@ -113,12 +113,14 @@ t          create unique labels of the form [fn:1],
> [fn:2], ...
> >  confirm    like t, but let the user edit the created value.  In
> particular,
> >             the label can be removed from the minibuffer, to create
> >             an anonymous footnote.
> > +random          Automatically generate a unique, random label.
> >  plain      Automatically create plain number labels like [1]"
> >    :group 'org-footnote
> >    :type '(choice
> >         (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 a random label" random)
> >         (const :tag "Create automatic [N]" plain)))
> >
> >  (defcustom org-footnote-auto-adjust nil
> > @@ -253,16 +255,22 @@ This command prompts for a label.  If this is a
> label referencing an
> >  existing label, only insert the label.  If the footnote label is empty
> >  or new, let the user edit the definition of the footnote."
> >    (interactive)
> > -  (let* ((labels (org-footnote-all-labels))
> > +  (let* ((labels (and (not (equal org-footnote-auto-label 'random))
> > +                   (org-footnote-all-labels)))
> >        (propose (org-footnote-unique-label labels))
> >        (label
> > -       (if (member org-footnote-auto-label '(t plain))
> > -           propose
> > +       (cond
> > +        ((member org-footnote-auto-label '(t plain))
> > +         propose)
> > +        ((equal org-footnote-auto-label 'random)
> > +         (require 'org-id)
> > +         (substring (org-id-uuid) 0 8))
> > +        (t
> >           (completing-read
> >            "Label (leave empty for anonymous): "
> >            (mapcar 'list labels) nil nil
> >            (if (eq org-footnote-auto-label 'confirm) propose nil)
> > -          'org-footnote-label-history))))
> > +          'org-footnote-label-history)))))
> >      (setq label (org-footnote-normalize-label label))
> >      (cond
> >       ((equal label "")
> >
>
>

[-- Attachment #2: Type: text/html, Size: 4377 bytes --]

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

end of thread, other threads:[~2011-03-17 12:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-11 13:50 [PATCH] New option to create unique, random labels for footnotes Matt Lundin
2011-03-17  8:25 ` [Accepted] " Bastien Guerry
2011-03-17 12:35   ` Scot Becker
2011-03-17  8:26 ` [PATCH] " Bastien

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