* [PATCH] Alphabetical ordered lists @ 2010-07-29 20:27 Nathaniel Flath 2010-07-29 21:07 ` Nick Dokos ` (2 more replies) 0 siblings, 3 replies; 41+ messages in thread From: Nathaniel Flath @ 2010-07-29 20:27 UTC (permalink / raw) To: emacs-orgmode [-- Attachment #1: Type: text/plain, Size: 276 bytes --] Hello all, One thing that had been bugging me was the inability to have an ordered list of the form: a. Item 1 b. Item 2 c. Item 3 The following patch enables this, with lists going from a-z and A-Z. Let me know if there are any issues with it. Thanks, Nathaniel Flath [-- Attachment #2: alpha-lists.patch --] [-- Type: application/octet-stream, Size: 2610 bytes --] diff --git a/lisp/org-list.el b/lisp/org-list.el old mode 100644 new mode 100755 index cdfd2c5..61e1e88 --- a/lisp/org-list.el +++ b/lisp/org-list.el @@ -227,11 +227,11 @@ If GENERAL is non-nil, return the general regexp independent of the value of `org-plain-list-ordered-item-terminator'." (cond ((or general (eq org-plain-list-ordered-item-terminator t)) - "\\([ \t]*\\([-+]\\|\\([0-9]+[.)]\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)") + "\\([ \t]*\\([-+]\\|\\([0-9A-Za-z]+[.)]\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)") ((= org-plain-list-ordered-item-terminator ?.) - "\\([ \t]*\\([-+]\\|\\([0-9]+\\.\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)") + "\\([ \t]*\\([-+]\\|\\([0-9A-Za-z]+\\.\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)") ((= org-plain-list-ordered-item-terminator ?\)) - "\\([ \t]*\\([-+]\\|\\([0-9]+)\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)") + "\\([ \t]*\\([-+]\\|\\([0-9A-Za-z]+)\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)") (t (error "Invalid value of `org-plain-list-ordered-item-terminator'")))) (defun org-at-item-p () @@ -298,7 +298,7 @@ Return t when things worked, nil when we are not in an item." (cond ((and (org-at-item-p) (<= (point) eow)) ;; before the bullet - (beginning-of-line 1) + (beginning-of-line ) (open-line (if blank 2 1))) ((<= (point) eow) (beginning-of-line 1)) @@ -864,14 +864,13 @@ with something like \"1.\" or \"2)\"." ;; find where this list begins (org-beginning-of-item-list) (setq bobp (bobp)) - (looking-at "[ \t]*[0-9]+\\([.)]\\)") - (setq fmt (concat "%d" (or (match-string 1) "."))) - (save-excursion - (goto-char (match-end 0)) - (if (looking-at "[ \t]*\\[@start:\\([0-9]+\\)") - (setq n (1- (string-to-number (match-string 1)))))) - (beginning-of-line 0) - ;; walk forward and replace these numbers + (looking-at "[ \t]*\\([0-9A-Za-z]+\\)\\([.)]\\)") + (let* ((n (if (string-equal (match-string 1) "1") 0 (1- ?a))) + (fmt (if (= n 0) + (concat "%d" (or (match-string 2) ".")) + (concat "%c" (or (match-string 2) "."))))) + (beginning-of-line 0) + ;; walk forward and replace these numbers (catch 'exit (while t (catch 'next @@ -890,7 +889,8 @@ with something like \"1.\" or \"2)\"." (org-shift-item-indentation delta) (if (= (org-current-line) line) (setq col (+ col delta)))))) (org-goto-line line) - (org-move-to-column col))) + (org-move-to-column col)))) + (defvar org-suppress-item-indentation) ; dynamically scoped parameter (defun org-fix-bullet-type (&optional force-bullet) [-- Attachment #3: Type: text/plain, Size: 201 bytes --] _______________________________________________ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode ^ permalink raw reply related [flat|nested] 41+ messages in thread
* Re: [PATCH] Alphabetical ordered lists 2010-07-29 20:27 [PATCH] Alphabetical ordered lists Nathaniel Flath @ 2010-07-29 21:07 ` Nick Dokos 2010-08-01 18:33 ` David Maus 2010-08-02 9:31 ` Nicolas Goaziou 2010-08-27 8:11 ` Carsten Dominik 2 siblings, 1 reply; 41+ messages in thread From: Nick Dokos @ 2010-07-29 21:07 UTC (permalink / raw) To: Nathaniel Flath; +Cc: nicholas.dokos, emacs-orgmode Nathaniel Flath <flat0103@gmail.com> wrote: > Hello all, > > One thing that had been bugging me was the inability to have an > ordered list of the form: > > a. Item 1 > b. Item 2 > c. Item 3 > > The following patch enables this, with lists going from a-z and A-Z. > Let me know if there are any issues with it. > I think patches with MIME type application/octet-stream will not make it into the patchwork server. Please resend the patch with MIME type set to one of the following: text/plain text/x-patch text/x-diff as David indicated in http://thread.gmane.org/gmane.emacs.orgmode/25513/focus=25560 I think just including the patch in the mail message also works. Thanks, Nick ^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: [PATCH] Alphabetical ordered lists 2010-07-29 21:07 ` Nick Dokos @ 2010-08-01 18:33 ` David Maus 0 siblings, 0 replies; 41+ messages in thread From: David Maus @ 2010-08-01 18:33 UTC (permalink / raw) To: nicholas.dokos; +Cc: emacs-orgmode [-- Attachment #1.1.1: Type: text/plain, Size: 748 bytes --] Nick Dokos wrote: >Nathaniel Flath <flat0103@gmail.com> wrote: >> Hello all, >> >> One thing that had been bugging me was the inability to have an >> ordered list of the form: >> >> a. Item 1 >> b. Item 2 >> c. Item 3 >> >> The following patch enables this, with lists going from a-z and A-Z. >> Let me know if there are any issues with it. >> >I think patches with MIME type application/octet-stream will not make it >into the patchwork server. Please resend the patch with MIME type set to >one of the following: Right, application/octet-stream isn't catched (for good reasons). So here's the patch properly attachet as text/plain. Best, -- David -- OpenPGP... 0x99ADB83B5A4478E6 Jabber.... dmjena@jabber.org Email..... dmaus@ictsoc.de [-- Attachment #1.1.2: alpha-lists.patch --] [-- Type: text/plain, Size: 2610 bytes --] diff --git a/lisp/org-list.el b/lisp/org-list.el old mode 100644 new mode 100755 index cdfd2c5..61e1e88 --- a/lisp/org-list.el +++ b/lisp/org-list.el @@ -227,11 +227,11 @@ If GENERAL is non-nil, return the general regexp independent of the value of `org-plain-list-ordered-item-terminator'." (cond ((or general (eq org-plain-list-ordered-item-terminator t)) - "\\([ \t]*\\([-+]\\|\\([0-9]+[.)]\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)") + "\\([ \t]*\\([-+]\\|\\([0-9A-Za-z]+[.)]\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)") ((= org-plain-list-ordered-item-terminator ?.) - "\\([ \t]*\\([-+]\\|\\([0-9]+\\.\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)") + "\\([ \t]*\\([-+]\\|\\([0-9A-Za-z]+\\.\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)") ((= org-plain-list-ordered-item-terminator ?\)) - "\\([ \t]*\\([-+]\\|\\([0-9]+)\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)") + "\\([ \t]*\\([-+]\\|\\([0-9A-Za-z]+)\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)") (t (error "Invalid value of `org-plain-list-ordered-item-terminator'")))) (defun org-at-item-p () @@ -298,7 +298,7 @@ Return t when things worked, nil when we are not in an item." (cond ((and (org-at-item-p) (<= (point) eow)) ;; before the bullet - (beginning-of-line 1) + (beginning-of-line ) (open-line (if blank 2 1))) ((<= (point) eow) (beginning-of-line 1)) @@ -864,14 +864,13 @@ with something like \"1.\" or \"2)\"." ;; find where this list begins (org-beginning-of-item-list) (setq bobp (bobp)) - (looking-at "[ \t]*[0-9]+\\([.)]\\)") - (setq fmt (concat "%d" (or (match-string 1) "."))) - (save-excursion - (goto-char (match-end 0)) - (if (looking-at "[ \t]*\\[@start:\\([0-9]+\\)") - (setq n (1- (string-to-number (match-string 1)))))) - (beginning-of-line 0) - ;; walk forward and replace these numbers + (looking-at "[ \t]*\\([0-9A-Za-z]+\\)\\([.)]\\)") + (let* ((n (if (string-equal (match-string 1) "1") 0 (1- ?a))) + (fmt (if (= n 0) + (concat "%d" (or (match-string 2) ".")) + (concat "%c" (or (match-string 2) "."))))) + (beginning-of-line 0) + ;; walk forward and replace these numbers (catch 'exit (while t (catch 'next @@ -890,7 +889,8 @@ with something like \"1.\" or \"2)\"." (org-shift-item-indentation delta) (if (= (org-current-line) line) (setq col (+ col delta)))))) (org-goto-line line) - (org-move-to-column col))) + (org-move-to-column col)))) + (defvar org-suppress-item-indentation) ; dynamically scoped parameter (defun org-fix-bullet-type (&optional force-bullet) [-- Attachment #1.2: Type: application/pgp-signature, Size: 230 bytes --] [-- Attachment #2: Type: text/plain, Size: 201 bytes --] _______________________________________________ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode ^ permalink raw reply related [flat|nested] 41+ messages in thread
* Re: [PATCH] Alphabetical ordered lists 2010-07-29 20:27 [PATCH] Alphabetical ordered lists Nathaniel Flath 2010-07-29 21:07 ` Nick Dokos @ 2010-08-02 9:31 ` Nicolas Goaziou 2010-08-27 8:11 ` Carsten Dominik 2 siblings, 0 replies; 41+ messages in thread From: Nicolas Goaziou @ 2010-08-02 9:31 UTC (permalink / raw) To: Nathaniel Flath; +Cc: emacs-orgmode Hello, >>>>> Nathaniel Flath writes: > One thing that had been bugging me was the inability to have an > ordered list of the form: > a. Item 1 > b. Item 2 > c. Item 3 > The following patch enables this, with lists going from a-z and A-Z. > Let me know if there are any issues with it. If I understand well your patch, I see a couple of issues with it, that should not be hard to correct. - you removed the code allowing to use [@start:number] in a list; - even if you recognize a. and A. lists, you only reorder from a. to z. (bullet start is 1- ?a, not 1- ?A); - what happens when user wants to insert the 27th item in his alphabetically ordered list ? In other words you should have a function to increment such list from z. to aa. Regards, -- Nicolas ^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: [PATCH] Alphabetical ordered lists 2010-07-29 20:27 [PATCH] Alphabetical ordered lists Nathaniel Flath 2010-07-29 21:07 ` Nick Dokos 2010-08-02 9:31 ` Nicolas Goaziou @ 2010-08-27 8:11 ` Carsten Dominik 2010-08-27 10:53 ` Bernt Hansen 2 siblings, 1 reply; 41+ messages in thread From: Carsten Dominik @ 2010-08-27 8:11 UTC (permalink / raw) To: Nathaniel Flath; +Cc: emacs-orgmode On Jul 29, 2010, at 10:27 PM, Nathaniel Flath wrote: > Hello all, > > One thing that had been bugging me was the inability to have an > ordered list of the form: > > a. Item 1 > b. Item 2 > c. Item 3 > > The following patch enables this, with lists going from a-z and A-Z. > Let me know if there are any issues with it. Hi, I am not really sure we need these. They cause problems when lists get really long - also you patch does not further than "z", after that I get "{". Furthermore the export backends implement their own numbering rules anyway. So it seems to me that we do not need this addition. Any other votes here? - Carsten ^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: [PATCH] Alphabetical ordered lists 2010-08-27 8:11 ` Carsten Dominik @ 2010-08-27 10:53 ` Bernt Hansen 2010-08-27 12:44 ` Jacob Mitchell 0 siblings, 1 reply; 41+ messages in thread From: Bernt Hansen @ 2010-08-27 10:53 UTC (permalink / raw) To: Carsten Dominik; +Cc: emacs-orgmode Carsten Dominik <carsten.dominik@gmail.com> writes: > On Jul 29, 2010, at 10:27 PM, Nathaniel Flath wrote: > >> Hello all, >> >> One thing that had been bugging me was the inability to have an >> ordered list of the form: >> >> a. Item 1 >> b. Item 2 >> c. Item 3 >> >> The following patch enables this, with lists going from a-z and A-Z. >> Let me know if there are any issues with it. > > Hi, > > I am not really sure we need these. They cause problems when lists get > really long - also you patch does not further than "z", after that I > get "{". > > Furthermore the export backends implement their own numbering > rules anyway. So it seems to me that we do not need this addition. > > Any other votes here? I'm not currently missing this feature. I think it definitely would have to handle more entries if this was to be included in org-mode. Maybe going something like a. b. ... z. aa. ab. ... az. ba. bb. ... zz. ... and if you really need more entries than that (unlikely) you can do aaa. aab. ... and just keep going indefinitely. -Bernt ^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: Re: [PATCH] Alphabetical ordered lists 2010-08-27 10:53 ` Bernt Hansen @ 2010-08-27 12:44 ` Jacob Mitchell 2010-08-27 13:01 ` Nathaniel Flath 0 siblings, 1 reply; 41+ messages in thread From: Jacob Mitchell @ 2010-08-27 12:44 UTC (permalink / raw) To: Bernt Hansen; +Cc: emacs-orgmode, Carsten Dominik [-- Attachment #1.1: Type: text/plain, Size: 2121 bytes --] On Fri, Aug 27, 2010 at 6:53 AM, Bernt Hansen <bernt@norang.ca> wrote: > Carsten Dominik <carsten.dominik@gmail.com> writes: > > > On Jul 29, 2010, at 10:27 PM, Nathaniel Flath wrote: > > > >> Hello all, > >> > >> One thing that had been bugging me was the inability to have an > >> ordered list of the form: > >> > >> a. Item 1 > >> b. Item 2 > >> c. Item 3 > >> > >> The following patch enables this, with lists going from a-z and A-Z. > >> Let me know if there are any issues with it. > > > > Hi, > > > > I am not really sure we need these. They cause problems when lists get > > really long - also you patch does not further than "z", after that I > > get "{". > > > > Furthermore the export backends implement their own numbering > > rules anyway. So it seems to me that we do not need this addition. > > > > Any other votes here? > > I'm not currently missing this feature. I think it definitely would > have to handle more entries if this was to be included in org-mode. > I agree, that would be nice. > > Maybe going something like > > a. > b. > ... > z. > aa. > ab. > ... > az. > ba. > bb. > ... > zz. > ... and if you really need more entries than that (unlikely) you can > do > aaa. > aab. > ... > and just keep going indefinitely. > As a practical matter we should consider whether it's worth making a non-terminating sequence that can be handled by the exporters. LaTeX's enumerate package doesn't like going beyond (z): \documentclass[letterpaper]{article} \usepackage{enumerate} \begin{document} \begin{enumerate}[(z)] \item ... \end{document} The items beyond the 26th are mapped to "()". Of course there are going to be ways around these issues, but the question is whether it's desirable enough to implement and maintain that. Either way is fine with me--I'm new on the mailing list and haven't done any development for org-mode yet. -Jake > > -Bernt > > _______________________________________________ > Emacs-orgmode mailing list > Please use `Reply All' to send replies to the list. > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode > [-- Attachment #1.2: Type: text/html, Size: 3425 bytes --] [-- Attachment #2: Type: text/plain, Size: 201 bytes --] _______________________________________________ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode ^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: Re: [PATCH] Alphabetical ordered lists 2010-08-27 12:44 ` Jacob Mitchell @ 2010-08-27 13:01 ` Nathaniel Flath 2010-09-18 7:43 ` Nathaniel Flath 0 siblings, 1 reply; 41+ messages in thread From: Nathaniel Flath @ 2010-08-27 13:01 UTC (permalink / raw) To: Jacob Mitchell; +Cc: Bernt Hansen, emacs-orgmode, Carsten Dominik I was going to fix the issues described in the first reply - not enough items in particular - and resubmit soon. I got a bit distracted by finals. I'll see if I can figure out the export problem, as well. Thanks, Nathaniel Flath On Fri, Aug 27, 2010 at 5:44 AM, Jacob Mitchell <jacob.d.mitchell@gmail.com> wrote: > > > On Fri, Aug 27, 2010 at 6:53 AM, Bernt Hansen <bernt@norang.ca> wrote: >> >> Carsten Dominik <carsten.dominik@gmail.com> writes: >> >> > On Jul 29, 2010, at 10:27 PM, Nathaniel Flath wrote: >> > >> >> Hello all, >> >> >> >> One thing that had been bugging me was the inability to have an >> >> ordered list of the form: >> >> >> >> a. Item 1 >> >> b. Item 2 >> >> c. Item 3 >> >> >> >> The following patch enables this, with lists going from a-z and A-Z. >> >> Let me know if there are any issues with it. >> > >> > Hi, >> > >> > I am not really sure we need these. They cause problems when lists get >> > really long - also you patch does not further than "z", after that I >> > get "{". >> > >> > Furthermore the export backends implement their own numbering >> > rules anyway. So it seems to me that we do not need this addition. >> > >> > Any other votes here? >> >> I'm not currently missing this feature. I think it definitely would >> have to handle more entries if this was to be included in org-mode. > > I agree, that would be nice. > >> >> Maybe going something like >> >> a. >> b. >> ... >> z. >> aa. >> ab. >> ... >> az. >> ba. >> bb. >> ... >> zz. >> ... and if you really need more entries than that (unlikely) you can >> do >> aaa. >> aab. >> ... >> and just keep going indefinitely. > > As a practical matter we should consider whether it's worth making a > non-terminating sequence that can be handled by the exporters. LaTeX's > enumerate package doesn't like going beyond (z): > > \documentclass[letterpaper]{article} > \usepackage{enumerate} > > \begin{document} > \begin{enumerate}[(z)] > \item > ... > \end{document} > > The items beyond the 26th are mapped to "()". > > Of course there are going to be ways around these issues, but the question > is whether it's desirable enough to implement and maintain that. Either way > is fine with me--I'm new on the mailing list and haven't done any > development for org-mode yet. > > -Jake >> >> -Bernt >> >> _______________________________________________ >> Emacs-orgmode mailing list >> Please use `Reply All' to send replies to the list. >> Emacs-orgmode@gnu.org >> http://lists.gnu.org/mailman/listinfo/emacs-orgmode > > > _______________________________________________ > Emacs-orgmode mailing list > Please use `Reply All' to send replies to the list. > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode > > ^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: Re: [PATCH] Alphabetical ordered lists 2010-08-27 13:01 ` Nathaniel Flath @ 2010-09-18 7:43 ` Nathaniel Flath 2010-09-21 12:48 ` Carsten Dominik 0 siblings, 1 reply; 41+ messages in thread From: Nathaniel Flath @ 2010-09-18 7:43 UTC (permalink / raw) To: Jacob Mitchell; +Cc: Bernt Hansen, emacs-orgmode, Carsten Dominik [-- Attachment #1: Type: text/plain, Size: 10125 bytes --] Hey, I gave another shot at this, now that my computer is no longer dead. I believe it fixes the issues described earlier - let me know of any feedback. (Also - I don't know how to get GMail to attach this as anything other than application/octet-stream, so the text is in the message as well. Nathaniel Flath Attachment: diff --git a/lisp/org-list.el b/lisp/org-list.el index d9fc24e..88d5a9b 100644 --- a/lisp/org-list.el +++ b/lisp/org-list.el @@ -287,14 +287,14 @@ It depends on `org-empty-line-terminates-plain-lists'." "Return the correct regular expression for plain lists. If GENERAL is non-nil, return the general regexp independent of the value of `org-plain-list-ordered-item-terminator'." - (cond - ((or general (eq org-plain-list-ordered-item-terminator t)) - "\\([ \t]*\\([-+]\\|\\([0-9]+[.)]\\)\\)\\|[ \t]+\\*\\)\\([ \t]+\\|$\\)") - ((= org-plain-list-ordered-item-terminator ?.) - "\\([ \t]*\\([-+]\\|\\([0-9]+\\.\\)\\)\\|[ \t]+\\*\\)\\([ \t]+\\|$\\)") +(cond + ((or general (eq org-plain-list-ordered-item-terminator t)) + "\\([ \t]*\\([-+]\\|\\([0-9A-Za-z]+[.)]\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)") + ((= org-plain-list-ordered-item-terminator ?.) + "\\([ \t]*\\([-+]\\|\\([0-9A-Za-z]+\\.\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)") ((= org-plain-list-ordered-item-terminator ?\)) - "\\([ \t]*\\([-+]\\|\\([0-9]+)\\)\\)\\|[ \t]+\\*\\)\\([ \t]+\\|$\\)") - (t (error "Invalid value of `org-plain-list-ordered-item-terminator'")))) + "\\([ \t]*\\([-+]\\|\\([0-9A-Za-z]+)\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)") + (t (error "Invalid value of `org-plain-list-ordered-item-terminator'")))) (defconst org-item-beginning-re (concat "^" (org-item-re)) "Regexp matching the beginning of a plain list item.") @@ -530,7 +530,7 @@ List ending is determined by the indentation of text. See (save-excursion (goto-char (match-end 0)) ;; Ignore counter if any - (when (looking-at "\\(?:\\[@\\(?:start:\\)?[0-9]+\\][ \t]*\\)?") + (when (looking-at "\\(?:\\[@\\(?:start:\\)?[0-9A-Za-z]+\\][ \t]*\\)?") (goto-char (match-end 0))) (looking-at regexp)))) @@ -1135,11 +1135,11 @@ bullet string and bullet counter, if any." (list (point-at-bol) (org-get-indentation) (progn - (looking-at "^[ \t]*\\([-+*0-9.)]+[ \t]+\\)") + (looking-at "^[ \t]*\\([-+*0-9A-Za-z.)]+[ \t]+\\)") (match-string 1)) (progn (goto-char (match-end 0)) - (and (looking-at "\\[@\\(?:start:\\)?\\([0-9]+\\)\\]") + (and (looking-at "\\[@\\(?:start:\\)?\\([0-9A-Za-z]+\\)\\]") (match-string 1)))))) (defun org-list-struct (begin end top bottom &optional outdent) @@ -1259,8 +1259,10 @@ This function modifies STRUCT." (let ((counter (nth 3 item)) (bullet (org-list-bullet-string (nth 2 item)))) (cond - ((and (string-match "[0-9]+" bullet) counter) + ((and (string-match "[0-9A-Za-z]+" bullet) counter) (replace-match counter nil nil bullet)) + ((string-match "[A-Za-z]+" bullet) + (replace-match "a" nil nil bullet)) ((string-match "[0-9]+" bullet) (replace-match "1" nil nil bullet)) (t bullet))))) @@ -1268,7 +1270,7 @@ This function modifies STRUCT." (setcdr item (list (nth 1 item) bullet (nth 3 item))))) (get-bul (lambda (item bullet) (let* ((counter (nth 3 item))) - (if (and counter (string-match "[0-9]+" bullet)) + (if (and counter (string-match "[0-9A-Za-z]+" bullet)) (replace-match counter nil nil bullet) bullet)))) (fix-bul @@ -1582,13 +1584,50 @@ It determines the number of whitespaces to append by looking at " "))) nil nil bullet 1))) +(defun org-increment-string (str cap) + "Increments str (a->a, b->b, z->aa, aa->ab etc). If cap is non-nil, then + the letters are capitalized." + (let ((res (org-convert-num-to-alpha-str + (1+ (org-convert-alpha-str-to-num str 1 (length str) cap)) cap)) + (z (if cap ?Z ?z)) + (b (if cap ?B ?b)) + (a (if cap ?A ?a))) + (if (and(= (string-to-char str) z) + (= (string-to-char res) b)) + (concat (if cap "A" "a") (substring res 1)) + (concat (make-string (- (length str) (length res)) a) res)))) + +(defun org-convert-alpha-str-to-num (str n pos cap) + "Converts the substring consisting of locations pos to pos-n to a + numeric representation." + (let ((a (if cap ?A ?a))) + (if (= pos 1) (* (- (string-to-char str) a) n) + (+ (* (- (nth (1- pos) (string-to-list str)) a) n) + (org-convert-alpha-str-to-num str (* 26 n) (1- pos) cap))))) + +(defun org-convert-num-to-alpha-str (n cap) + "Converts the number n to a alphabetical, base-26 representation." + (if (= n 0) "" + (concat (org-convert-num-to-alpha-str (/ n 26) cap) + (string (+ (if cap ?A ?a) (% n 26)))))) + (defun org-list-inc-bullet-maybe (bullet) "Increment BULLET if applicable." - (if (string-match "[0-9]+" bullet) + (let ((case-fold-search nil)) + (cond + ((string-match "[0-9]+" bullet) (replace-match (number-to-string (1+ (string-to-number (match-string 0 bullet)))) - nil nil bullet) - bullet)) + nil nil bullet)) + ((string-match "[a-z]+" bullet) + (replace-match + (org-increment-string (match-string 0 bullet) nil) + nil nil bullet)) + ((string-match "[A-Z]+" bullet) + (replace-match + (org-increment-string (match-string 0 bullet) t) + nil nil bullet)) + (t bullet)))) (defun org-list-repair (&optional force-bullet top bottom) "Make sure all items are correctly indented, with the right bullet. @@ -1980,7 +2019,7 @@ compare entries." (goto-char (org-end-of-item-before-blank end)))) (value-to-sort (lambda () - (when (looking-at "[ \t]*[-+*0-9.)]+\\([ \t]+\\[[- X]\\]\\)?[ \t]+") + (when (looking-at "[ \t]*[-+*0-9A-Za-z.)]+\\([ \t]+\\[[- X]\\]\\)?[ \t]+") (cond ((= dcst ?n) (string-to-number (buffer-substring (match-end 0) @@ -2028,7 +2067,7 @@ sublevels as a list of strings." (while (org-search-forward-unenclosed org-item-beginning-re end t) (save-excursion (beginning-of-line) - (setq ltype (cond ((looking-at-p "^[ \t]*[0-9]") 'ordered) + (setq ltype (cond ((looking-at-p "^[ \t]*[0-9A-Za-z]") 'ordered) ((org-at-item-description-p) 'descriptive) (t 'unordered)))) (let* ((indent1 (org-get-indentation)) @@ -2037,7 +2076,7 @@ sublevels as a list of strings." (org-end-of-item-or-at-child end)))) (nextindent (if (= (point) end) 0 (org-get-indentation))) (item (if (string-match - "^\\(?:\\[@\\(?:start:\\)?[0-9]+\\][ \t]*\\)?\\[\\([xX ]\\)\\]" + "^\\(?:\\[@\\(?:start:\\)?[0-9A-Za-z]+\\][ \t]*\\)?\\[\\([xX ]\\)\\]" item) (replace-match (if (equal (match-string 1 item) " ") "CBOFF" On Fri, Aug 27, 2010 at 6:01 AM, Nathaniel Flath <flat0103@gmail.com> wrote: > I was going to fix the issues described in the first reply - not > enough items in particular - and resubmit soon. I got a bit > distracted by finals. I'll see if I can figure out the export > problem, as well. > > Thanks, > Nathaniel Flath > > On Fri, Aug 27, 2010 at 5:44 AM, Jacob Mitchell > <jacob.d.mitchell@gmail.com> wrote: >> >> >> On Fri, Aug 27, 2010 at 6:53 AM, Bernt Hansen <bernt@norang.ca> wrote: >>> >>> Carsten Dominik <carsten.dominik@gmail.com> writes: >>> >>> > On Jul 29, 2010, at 10:27 PM, Nathaniel Flath wrote: >>> > >>> >> Hello all, >>> >> >>> >> One thing that had been bugging me was the inability to have an >>> >> ordered list of the form: >>> >> >>> >> a. Item 1 >>> >> b. Item 2 >>> >> c. Item 3 >>> >> >>> >> The following patch enables this, with lists going from a-z and A-Z. >>> >> Let me know if there are any issues with it. >>> > >>> > Hi, >>> > >>> > I am not really sure we need these. They cause problems when lists get >>> > really long - also you patch does not further than "z", after that I >>> > get "{". >>> > >>> > Furthermore the export backends implement their own numbering >>> > rules anyway. So it seems to me that we do not need this addition. >>> > >>> > Any other votes here? >>> >>> I'm not currently missing this feature. I think it definitely would >>> have to handle more entries if this was to be included in org-mode. >> >> I agree, that would be nice. >> >>> >>> Maybe going something like >>> >>> a. >>> b. >>> ... >>> z. >>> aa. >>> ab. >>> ... >>> az. >>> ba. >>> bb. >>> ... >>> zz. >>> ... and if you really need more entries than that (unlikely) you can >>> do >>> aaa. >>> aab. >>> ... >>> and just keep going indefinitely. >> >> As a practical matter we should consider whether it's worth making a >> non-terminating sequence that can be handled by the exporters. LaTeX's >> enumerate package doesn't like going beyond (z): >> >> \documentclass[letterpaper]{article} >> \usepackage{enumerate} >> >> \begin{document} >> \begin{enumerate}[(z)] >> \item >> ... >> \end{document} >> >> The items beyond the 26th are mapped to "()". >> >> Of course there are going to be ways around these issues, but the question >> is whether it's desirable enough to implement and maintain that. Either way >> is fine with me--I'm new on the mailing list and haven't done any >> development for org-mode yet. >> >> -Jake >>> >>> -Bernt >>> >>> _______________________________________________ >>> Emacs-orgmode mailing list >>> Please use `Reply All' to send replies to the list. >>> Emacs-orgmode@gnu.org >>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode >> >> >> _______________________________________________ >> Emacs-orgmode mailing list >> Please use `Reply All' to send replies to the list. >> Emacs-orgmode@gnu.org >> http://lists.gnu.org/mailman/listinfo/emacs-orgmode >> >> > [-- Attachment #2: ordered-list.patch --] [-- Type: application/octet-stream, Size: 6732 bytes --] diff --git a/lisp/org-list.el b/lisp/org-list.el index d9fc24e..88d5a9b 100644 --- a/lisp/org-list.el +++ b/lisp/org-list.el @@ -287,14 +287,14 @@ It depends on `org-empty-line-terminates-plain-lists'." "Return the correct regular expression for plain lists. If GENERAL is non-nil, return the general regexp independent of the value of `org-plain-list-ordered-item-terminator'." - (cond - ((or general (eq org-plain-list-ordered-item-terminator t)) - "\\([ \t]*\\([-+]\\|\\([0-9]+[.)]\\)\\)\\|[ \t]+\\*\\)\\([ \t]+\\|$\\)") - ((= org-plain-list-ordered-item-terminator ?.) - "\\([ \t]*\\([-+]\\|\\([0-9]+\\.\\)\\)\\|[ \t]+\\*\\)\\([ \t]+\\|$\\)") +(cond + ((or general (eq org-plain-list-ordered-item-terminator t)) + "\\([ \t]*\\([-+]\\|\\([0-9A-Za-z]+[.)]\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)") + ((= org-plain-list-ordered-item-terminator ?.) + "\\([ \t]*\\([-+]\\|\\([0-9A-Za-z]+\\.\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)") ((= org-plain-list-ordered-item-terminator ?\)) - "\\([ \t]*\\([-+]\\|\\([0-9]+)\\)\\)\\|[ \t]+\\*\\)\\([ \t]+\\|$\\)") - (t (error "Invalid value of `org-plain-list-ordered-item-terminator'")))) + "\\([ \t]*\\([-+]\\|\\([0-9A-Za-z]+)\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)") + (t (error "Invalid value of `org-plain-list-ordered-item-terminator'")))) (defconst org-item-beginning-re (concat "^" (org-item-re)) "Regexp matching the beginning of a plain list item.") @@ -530,7 +530,7 @@ List ending is determined by the indentation of text. See (save-excursion (goto-char (match-end 0)) ;; Ignore counter if any - (when (looking-at "\\(?:\\[@\\(?:start:\\)?[0-9]+\\][ \t]*\\)?") + (when (looking-at "\\(?:\\[@\\(?:start:\\)?[0-9A-Za-z]+\\][ \t]*\\)?") (goto-char (match-end 0))) (looking-at regexp)))) @@ -1135,11 +1135,11 @@ bullet string and bullet counter, if any." (list (point-at-bol) (org-get-indentation) (progn - (looking-at "^[ \t]*\\([-+*0-9.)]+[ \t]+\\)") + (looking-at "^[ \t]*\\([-+*0-9A-Za-z.)]+[ \t]+\\)") (match-string 1)) (progn (goto-char (match-end 0)) - (and (looking-at "\\[@\\(?:start:\\)?\\([0-9]+\\)\\]") + (and (looking-at "\\[@\\(?:start:\\)?\\([0-9A-Za-z]+\\)\\]") (match-string 1)))))) (defun org-list-struct (begin end top bottom &optional outdent) @@ -1259,8 +1259,10 @@ This function modifies STRUCT." (let ((counter (nth 3 item)) (bullet (org-list-bullet-string (nth 2 item)))) (cond - ((and (string-match "[0-9]+" bullet) counter) + ((and (string-match "[0-9A-Za-z]+" bullet) counter) (replace-match counter nil nil bullet)) + ((string-match "[A-Za-z]+" bullet) + (replace-match "a" nil nil bullet)) ((string-match "[0-9]+" bullet) (replace-match "1" nil nil bullet)) (t bullet))))) @@ -1268,7 +1270,7 @@ This function modifies STRUCT." (setcdr item (list (nth 1 item) bullet (nth 3 item))))) (get-bul (lambda (item bullet) (let* ((counter (nth 3 item))) - (if (and counter (string-match "[0-9]+" bullet)) + (if (and counter (string-match "[0-9A-Za-z]+" bullet)) (replace-match counter nil nil bullet) bullet)))) (fix-bul @@ -1582,13 +1584,50 @@ It determines the number of whitespaces to append by looking at " "))) nil nil bullet 1))) +(defun org-increment-string (str cap) + "Increments str (a->a, b->b, z->aa, aa->ab etc). If cap is non-nil, then + the letters are capitalized." + (let ((res (org-convert-num-to-alpha-str + (1+ (org-convert-alpha-str-to-num str 1 (length str) cap)) cap)) + (z (if cap ?Z ?z)) + (b (if cap ?B ?b)) + (a (if cap ?A ?a))) + (if (and(= (string-to-char str) z) + (= (string-to-char res) b)) + (concat (if cap "A" "a") (substring res 1)) + (concat (make-string (- (length str) (length res)) a) res)))) + +(defun org-convert-alpha-str-to-num (str n pos cap) + "Converts the substring consisting of locations pos to pos-n to a + numeric representation." + (let ((a (if cap ?A ?a))) + (if (= pos 1) (* (- (string-to-char str) a) n) + (+ (* (- (nth (1- pos) (string-to-list str)) a) n) + (org-convert-alpha-str-to-num str (* 26 n) (1- pos) cap))))) + +(defun org-convert-num-to-alpha-str (n cap) + "Converts the number n to a alphabetical, base-26 representation." + (if (= n 0) "" + (concat (org-convert-num-to-alpha-str (/ n 26) cap) + (string (+ (if cap ?A ?a) (% n 26)))))) + (defun org-list-inc-bullet-maybe (bullet) "Increment BULLET if applicable." - (if (string-match "[0-9]+" bullet) + (let ((case-fold-search nil)) + (cond + ((string-match "[0-9]+" bullet) (replace-match (number-to-string (1+ (string-to-number (match-string 0 bullet)))) - nil nil bullet) - bullet)) + nil nil bullet)) + ((string-match "[a-z]+" bullet) + (replace-match + (org-increment-string (match-string 0 bullet) nil) + nil nil bullet)) + ((string-match "[A-Z]+" bullet) + (replace-match + (org-increment-string (match-string 0 bullet) t) + nil nil bullet)) + (t bullet)))) (defun org-list-repair (&optional force-bullet top bottom) "Make sure all items are correctly indented, with the right bullet. @@ -1980,7 +2019,7 @@ compare entries." (goto-char (org-end-of-item-before-blank end)))) (value-to-sort (lambda () - (when (looking-at "[ \t]*[-+*0-9.)]+\\([ \t]+\\[[- X]\\]\\)?[ \t]+") + (when (looking-at "[ \t]*[-+*0-9A-Za-z.)]+\\([ \t]+\\[[- X]\\]\\)?[ \t]+") (cond ((= dcst ?n) (string-to-number (buffer-substring (match-end 0) @@ -2028,7 +2067,7 @@ sublevels as a list of strings." (while (org-search-forward-unenclosed org-item-beginning-re end t) (save-excursion (beginning-of-line) - (setq ltype (cond ((looking-at-p "^[ \t]*[0-9]") 'ordered) + (setq ltype (cond ((looking-at-p "^[ \t]*[0-9A-Za-z]") 'ordered) ((org-at-item-description-p) 'descriptive) (t 'unordered)))) (let* ((indent1 (org-get-indentation)) @@ -2037,7 +2076,7 @@ sublevels as a list of strings." (org-end-of-item-or-at-child end)))) (nextindent (if (= (point) end) 0 (org-get-indentation))) (item (if (string-match - "^\\(?:\\[@\\(?:start:\\)?[0-9]+\\][ \t]*\\)?\\[\\([xX ]\\)\\]" + "^\\(?:\\[@\\(?:start:\\)?[0-9A-Za-z]+\\][ \t]*\\)?\\[\\([xX ]\\)\\]" item) (replace-match (if (equal (match-string 1 item) " ") "CBOFF" [-- Attachment #3: Type: text/plain, Size: 201 bytes --] _______________________________________________ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode ^ permalink raw reply related [flat|nested] 41+ messages in thread
* Re: Re: [PATCH] Alphabetical ordered lists 2010-09-18 7:43 ` Nathaniel Flath @ 2010-09-21 12:48 ` Carsten Dominik 2010-09-21 16:46 ` Nicolas Goaziou 2010-09-26 17:36 ` Nicolas Goaziou 0 siblings, 2 replies; 41+ messages in thread From: Carsten Dominik @ 2010-09-21 12:48 UTC (permalink / raw) To: Nathaniel Flath; +Cc: Bernt Hansen, Jacob Mitchell, emacs-orgmode Hi everyone, I would like to know if there are more people interested in this, and if there are people who are willing to test this patch, to make sure nothing breaks. Nicolas, can you in particular please take a look at this - I believe you earlier said that you saw problems with it. Thanks! - Carsten On Sep 18, 2010, at 9:43 AM, Nathaniel Flath wrote: > Hey, > I gave another shot at this, now that my computer is no longer dead. > I believe it fixes the issues described earlier - let me know of any > feedback. > (Also - I don't know how to get GMail to attach this as anything other > than application/octet-stream, so the text is in the message as well. > Nathaniel Flath > > > Attachment: > > diff --git a/lisp/org-list.el b/lisp/org-list.el > index d9fc24e..88d5a9b 100644 > --- a/lisp/org-list.el > +++ b/lisp/org-list.el > @@ -287,14 +287,14 @@ It depends on `org-empty-line-terminates-plain- > lists'." > "Return the correct regular expression for plain lists. > If GENERAL is non-nil, return the general regexp independent of the > value > of `org-plain-list-ordered-item-terminator'." > - (cond > - ((or general (eq org-plain-list-ordered-item-terminator t)) > - "\\([ \t]*\\([-+]\\|\\([0-9]+[.)]\\)\\)\\|[ \t]+\\*\\)\\([ \t]+\ > \|$\\)") > - ((= org-plain-list-ordered-item-terminator ?.) > - "\\([ \t]*\\([-+]\\|\\([0-9]+\\.\\)\\)\\|[ \t]+\\*\\)\\([ \t]+\ > \|$\\)") > +(cond > + ((or general (eq org-plain-list-ordered-item-terminator t)) > + "\\([ \t]*\\([-+]\\|\\([0-9A-Za-z]+[.)]\\)\\)\\|[ \t]+\\*\\)\\( \ > \|$\\)") > + ((= org-plain-list-ordered-item-terminator ?.) > + "\\([ \t]*\\([-+]\\|\\([0-9A-Za-z]+\\.\\)\\)\\|[ \t]+\\*\\)\\( \ > \|$\\)") > ((= org-plain-list-ordered-item-terminator ?\)) > - "\\([ \t]*\\([-+]\\|\\([0-9]+)\\)\\)\\|[ \t]+\\*\\)\\([ \t]+\\|$ > \\)") > - (t (error "Invalid value of `org-plain-list-ordered-item- > terminator'")))) > + "\\([ \t]*\\([-+]\\|\\([0-9A-Za-z]+)\\)\\)\\|[ \t]+\\*\\)\\( \\| > $\\)") > + (t (error "Invalid value of `org-plain-list-ordered-item- > terminator'")))) > > (defconst org-item-beginning-re (concat "^" (org-item-re)) > "Regexp matching the beginning of a plain list item.") > @@ -530,7 +530,7 @@ List ending is determined by the indentation of > text. See > (save-excursion > (goto-char (match-end 0)) > ;; Ignore counter if any > - (when (looking-at "\\(?:\\[@\\(?:start:\\)?[0-9]+\\][ \t]*\ > \)?") > + (when (looking-at "\\(?:\\[@\\(?:start:\\)?[0-9A-Za-z]+\\] > [ \t]*\\)?") > (goto-char (match-end 0))) > (looking-at regexp)))) > > @@ -1135,11 +1135,11 @@ bullet string and bullet counter, if any." > (list (point-at-bol) > (org-get-indentation) > (progn > - (looking-at "^[ \t]*\\([-+*0-9.)]+[ \t]+\\)") > + (looking-at "^[ \t]*\\([-+*0-9A-Za-z.)]+[ \t]+\\)") > (match-string 1)) > (progn > (goto-char (match-end 0)) > - (and (looking-at "\\[@\\(?:start:\\)?\\([0-9]+\\)\\]") > + (and (looking-at "\\[@\\(?:start:\\)?\\([0-9A-Za-z]+\\)\ > \]") > (match-string 1)))))) > > (defun org-list-struct (begin end top bottom &optional outdent) > @@ -1259,8 +1259,10 @@ This function modifies STRUCT." > (let ((counter (nth 3 item)) > (bullet (org-list-bullet-string (nth 2 item)))) > (cond > - ((and (string-match "[0-9]+" bullet) counter) > + ((and (string-match "[0-9A-Za-z]+" bullet) counter) > (replace-match counter nil nil bullet)) > + ((string-match "[A-Za-z]+" bullet) > + (replace-match "a" nil nil bullet)) > ((string-match "[0-9]+" bullet) > (replace-match "1" nil nil bullet)) > (t bullet))))) > @@ -1268,7 +1270,7 @@ This function modifies STRUCT." > (setcdr item (list (nth 1 item) bullet (nth 3 item))))) > (get-bul (lambda (item bullet) > (let* ((counter (nth 3 item))) > - (if (and counter (string-match "[0-9]+" bullet)) > + (if (and counter (string-match "[0-9A-Za-z]+" bullet)) > (replace-match counter nil nil bullet) > bullet)))) > (fix-bul > @@ -1582,13 +1584,50 @@ It determines the number of whitespaces to > append by looking at > " "))) > nil nil bullet 1))) > > +(defun org-increment-string (str cap) > + "Increments str (a->a, b->b, z->aa, aa->ab etc). If cap is non- > nil, then > + the letters are capitalized." > + (let ((res (org-convert-num-to-alpha-str > + (1+ (org-convert-alpha-str-to-num str 1 (length str) cap)) > cap)) > + (z (if cap ?Z ?z)) > + (b (if cap ?B ?b)) > + (a (if cap ?A ?a))) > + (if (and(= (string-to-char str) z) > + (= (string-to-char res) b)) > + (concat (if cap "A" "a") (substring res 1)) > + (concat (make-string (- (length str) (length res)) a) res)))) > + > +(defun org-convert-alpha-str-to-num (str n pos cap) > + "Converts the substring consisting of locations pos to pos-n to a > + numeric representation." > + (let ((a (if cap ?A ?a))) > + (if (= pos 1) (* (- (string-to-char str) a) n) > + (+ (* (- (nth (1- pos) (string-to-list str)) a) n) > + (org-convert-alpha-str-to-num str (* 26 n) (1- pos) cap))))) > + > +(defun org-convert-num-to-alpha-str (n cap) > + "Converts the number n to a alphabetical, base-26 representation." > + (if (= n 0) "" > + (concat (org-convert-num-to-alpha-str (/ n 26) cap) > + (string (+ (if cap ?A ?a) (% n 26)))))) > + > (defun org-list-inc-bullet-maybe (bullet) > "Increment BULLET if applicable." > - (if (string-match "[0-9]+" bullet) > + (let ((case-fold-search nil)) > + (cond > + ((string-match "[0-9]+" bullet) > (replace-match > (number-to-string (1+ (string-to-number (match-string 0 > bullet)))) > - nil nil bullet) > - bullet)) > + nil nil bullet)) > + ((string-match "[a-z]+" bullet) > + (replace-match > + (org-increment-string (match-string 0 bullet) nil) > + nil nil bullet)) > + ((string-match "[A-Z]+" bullet) > + (replace-match > + (org-increment-string (match-string 0 bullet) t) > + nil nil bullet)) > + (t bullet)))) > > (defun org-list-repair (&optional force-bullet top bottom) > "Make sure all items are correctly indented, with the right bullet. > @@ -1980,7 +2019,7 @@ compare entries." > (goto-char (org-end-of-item-before-blank end)))) > (value-to-sort > (lambda () > - (when (looking-at "[ \t]*[-+*0-9.)]+\\([ \t]+\\[[- X]\\]\\)?[ \t] > +") > + (when (looking-at "[ \t]*[-+*0-9A-Za-z.)]+\\([ \t]+\\[[- X]\\]\\)? > [ \t]+") > (cond > ((= dcst ?n) > (string-to-number (buffer-substring (match-end 0) > @@ -2028,7 +2067,7 @@ sublevels as a list of strings." > (while (org-search-forward-unenclosed org-item-beginning-re end t) > (save-excursion > (beginning-of-line) > - (setq ltype (cond ((looking-at-p "^[ \t]*[0-9]") 'ordered) > + (setq ltype (cond ((looking-at-p "^[ \t]*[0-9A-Za-z]") 'ordered) > ((org-at-item-description-p) 'descriptive) > (t 'unordered)))) > (let* ((indent1 (org-get-indentation)) > @@ -2037,7 +2076,7 @@ sublevels as a list of strings." > (org-end-of-item-or-at-child end)))) > (nextindent (if (= (point) end) 0 (org-get-indentation))) > (item (if (string-match > - "^\\(?:\\[@\\(?:start:\\)?[0-9]+\\][ \t]*\\)?\\[\\([xX ]\\)\\]" > + "^\\(?:\\[@\\(?:start:\\)?[0-9A-Za-z]+\\][ \t]*\\)?\\[\\([xX ]\\) > \\]" > item) > (replace-match (if (equal (match-string 1 item) " ") > "CBOFF" > > > On Fri, Aug 27, 2010 at 6:01 AM, Nathaniel Flath > <flat0103@gmail.com> wrote: >> I was going to fix the issues described in the first reply - not >> enough items in particular - and resubmit soon. I got a bit >> distracted by finals. I'll see if I can figure out the export >> problem, as well. >> >> Thanks, >> Nathaniel Flath >> >> On Fri, Aug 27, 2010 at 5:44 AM, Jacob Mitchell >> <jacob.d.mitchell@gmail.com> wrote: >>> >>> >>> On Fri, Aug 27, 2010 at 6:53 AM, Bernt Hansen <bernt@norang.ca> >>> wrote: >>>> >>>> Carsten Dominik <carsten.dominik@gmail.com> writes: >>>> >>>>> On Jul 29, 2010, at 10:27 PM, Nathaniel Flath wrote: >>>>> >>>>>> Hello all, >>>>>> >>>>>> One thing that had been bugging me was the inability to have an >>>>>> ordered list of the form: >>>>>> >>>>>> a. Item 1 >>>>>> b. Item 2 >>>>>> c. Item 3 >>>>>> >>>>>> The following patch enables this, with lists going from a-z and >>>>>> A-Z. >>>>>> Let me know if there are any issues with it. >>>>> >>>>> Hi, >>>>> >>>>> I am not really sure we need these. They cause problems when >>>>> lists get >>>>> really long - also you patch does not further than "z", after >>>>> that I >>>>> get "{". >>>>> >>>>> Furthermore the export backends implement their own numbering >>>>> rules anyway. So it seems to me that we do not need this >>>>> addition. >>>>> >>>>> Any other votes here? >>>> >>>> I'm not currently missing this feature. I think it definitely >>>> would >>>> have to handle more entries if this was to be included in org-mode. >>> >>> I agree, that would be nice. >>> >>>> >>>> Maybe going something like >>>> >>>> a. >>>> b. >>>> ... >>>> z. >>>> aa. >>>> ab. >>>> ... >>>> az. >>>> ba. >>>> bb. >>>> ... >>>> zz. >>>> ... and if you really need more entries than that (unlikely) you >>>> can >>>> do >>>> aaa. >>>> aab. >>>> ... >>>> and just keep going indefinitely. >>> >>> As a practical matter we should consider whether it's worth making a >>> non-terminating sequence that can be handled by the exporters. >>> LaTeX's >>> enumerate package doesn't like going beyond (z): >>> >>> \documentclass[letterpaper]{article} >>> \usepackage{enumerate} >>> >>> \begin{document} >>> \begin{enumerate}[(z)] >>> \item >>> ... >>> \end{document} >>> >>> The items beyond the 26th are mapped to "()". >>> >>> Of course there are going to be ways around these issues, but the >>> question >>> is whether it's desirable enough to implement and maintain that. >>> Either way >>> is fine with me--I'm new on the mailing list and haven't done any >>> development for org-mode yet. >>> >>> -Jake >>>> >>>> -Bernt >>>> >>>> _______________________________________________ >>>> Emacs-orgmode mailing list >>>> Please use `Reply All' to send replies to the list. >>>> Emacs-orgmode@gnu.org >>>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode >>> >>> >>> _______________________________________________ >>> Emacs-orgmode mailing list >>> Please use `Reply All' to send replies to the list. >>> Emacs-orgmode@gnu.org >>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode >>> >>> >> > <ordered-list.patch> - Carsten ^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: Re: [PATCH] Alphabetical ordered lists 2010-09-21 12:48 ` Carsten Dominik @ 2010-09-21 16:46 ` Nicolas Goaziou 2010-09-26 17:36 ` Nicolas Goaziou 1 sibling, 0 replies; 41+ messages in thread From: Nicolas Goaziou @ 2010-09-21 16:46 UTC (permalink / raw) To: Carsten Dominik; +Cc: Bernt Hansen, emacs-orgmode, Jacob Mitchell Hello, >>>>> Carsten Dominik writes: > Nicolas, can you in particular please take a look at this - I > believe you earlier said that you saw problems with it. Sure, I will have a look at it on Sunday. But before testing it, there is, by design, one thing that seems dangerous to me. Let's consider the following text: This is a sentence in a not so short paragraph, ending where it should not. What is this line supposed to mean for Org? If this is a recognized as a list, wouldn't this line get wrongly indented? Regards, -- Nicolas ^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: Re: [PATCH] Alphabetical ordered lists 2010-09-21 12:48 ` Carsten Dominik 2010-09-21 16:46 ` Nicolas Goaziou @ 2010-09-26 17:36 ` Nicolas Goaziou 2010-09-26 22:16 ` Nathaniel Flath 1 sibling, 1 reply; 41+ messages in thread From: Nicolas Goaziou @ 2010-09-26 17:36 UTC (permalink / raw) To: Carsten Dominik; +Cc: Bernt Hansen, emacs-orgmode, Jacob Mitchell Hello, I've tried the patch today. There are still some easily-fixed glitches (like letters not included in org-cycle-list-bullet, or bullets allowing mixed text and numbers). But, there is apparently one major drawback, as I said in a previous post. If the line starts with a word followed by a dot or a parenthesis, Org will see a bullet there. This is bad news because the following line will be indented, or a M-RET will delete the word, replacing it with a) or a. Regards, -- Nicolas ^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: Re: [PATCH] Alphabetical ordered lists 2010-09-26 17:36 ` Nicolas Goaziou @ 2010-09-26 22:16 ` Nathaniel Flath 2010-09-27 6:55 ` Nicolas Goaziou 0 siblings, 1 reply; 41+ messages in thread From: Nathaniel Flath @ 2010-09-26 22:16 UTC (permalink / raw) To: Nicolas Goaziou Cc: Bernt Hansen, Jacob Mitchell, emacs-orgmode, Carsten Dominik > But, there is apparently one major drawback, as I said in a previous > post. If the line starts with a word followed by a dot or a > parenthesis, Org will see a bullet there. This is bad news because the > following line will be indented, or a M-RET will delete the word, > replacing it with a) or a. > > Regards, > > -- Nicolas > Yes, this happens - it's not something that comes up during my normal usage, so I didn't notice. Can you think of a way to determine if this is the case vs. a list is actually wanted? Thanks, Nathaniel Flath ^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: Re: [PATCH] Alphabetical ordered lists 2010-09-26 22:16 ` Nathaniel Flath @ 2010-09-27 6:55 ` Nicolas Goaziou 2010-09-28 16:12 ` Carsten Dominik 0 siblings, 1 reply; 41+ messages in thread From: Nicolas Goaziou @ 2010-09-27 6:55 UTC (permalink / raw) To: Nathaniel Flath Cc: Bernt Hansen, Jacob Mitchell, emacs-orgmode, Carsten Dominik >>>>> Nathaniel Flath writes: >> But, there is apparently one major drawback, as I said in a >> previous post. If the line starts with a word followed by a dot or >> a parenthesis, Org will see a bullet there. This is bad news >> because the following line will be indented, or a M-RET will delete >> the word, replacing it with a) or a. > Yes, this happens - it's not something that comes up during my > normal usage, so I didn't notice. Can you think of a way to > determine if this is the case vs. a list is actually wanted? Unfortunately, I can't see anything clean. This is tricky because lists are the closest construct to raw text. -- Nicolas ^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: Re: [PATCH] Alphabetical ordered lists 2010-09-27 6:55 ` Nicolas Goaziou @ 2010-09-28 16:12 ` Carsten Dominik 2010-09-29 15:49 ` Carsten Dominik 0 siblings, 1 reply; 41+ messages in thread From: Carsten Dominik @ 2010-09-28 16:12 UTC (permalink / raw) To: Nicolas Goaziou; +Cc: Bernt Hansen, emacs-orgmode, Jacob Mitchell On Sep 27, 2010, at 8:55 AM, Nicolas Goaziou wrote: >>>>>> Nathaniel Flath writes: > >>> But, there is apparently one major drawback, as I said in a >>> previous post. If the line starts with a word followed by a dot or >>> a parenthesis, Org will see a bullet there. This is bad news >>> because the following line will be indented, or a M-RET will delete >>> the word, replacing it with a) or a. > >> Yes, this happens - it's not something that comes up during my >> normal usage, so I didn't notice. Can you think of a way to >> determine if this is the case vs. a list is actually wanted? > > Unfortunately, I can't see anything clean. This is tricky because > lists are the closest construct to raw text. My feeling is that we should not apply this patch. I see how it might be nice to have such lists - but confusion is rather likely in this case. - Carsten ^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: Re: [PATCH] Alphabetical ordered lists 2010-09-28 16:12 ` Carsten Dominik @ 2010-09-29 15:49 ` Carsten Dominik 2010-09-29 16:50 ` Nathaniel Flath 2010-09-29 17:46 ` Nicolas Goaziou 0 siblings, 2 replies; 41+ messages in thread From: Carsten Dominik @ 2010-09-29 15:49 UTC (permalink / raw) To: Carsten Dominik Cc: Bernt Hansen, emacs-orgmode, Nicolas Goaziou, Jacob Mitchell On Sep 28, 2010, at 6:12 PM, Carsten Dominik wrote: > > On Sep 27, 2010, at 8:55 AM, Nicolas Goaziou wrote: > >>>>>>> Nathaniel Flath writes: >> >>>> But, there is apparently one major drawback, as I said in a >>>> previous post. If the line starts with a word followed by a dot or >>>> a parenthesis, Org will see a bullet there. This is bad news >>>> because the following line will be indented, or a M-RET will delete >>>> the word, replacing it with a) or a. >> >>> Yes, this happens - it's not something that comes up during my >>> normal usage, so I didn't notice. Can you think of a way to >>> determine if this is the case vs. a list is actually wanted? >> >> Unfortunately, I can't see anything clean. This is tricky because >> lists are the closest construct to raw text. > > My feeling is that we should not apply this patch. I see how it > might be > nice to have such lists - but confusion is rather likely in > this case. Or, alternatively, put it in with an option to turn it on (default off, I think). And maybe we should after all limit it to a single character to avoid confusion. Yes, I do realise that I asked for several characters - but I am learning... - Carsten > > - Carsten > ^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: Re: [PATCH] Alphabetical ordered lists 2010-09-29 15:49 ` Carsten Dominik @ 2010-09-29 16:50 ` Nathaniel Flath 2010-09-29 17:46 ` Nicolas Goaziou 1 sibling, 0 replies; 41+ messages in thread From: Nathaniel Flath @ 2010-09-29 16:50 UTC (permalink / raw) To: Carsten Dominik Cc: Bernt Hansen, Jacob Mitchell, emacs-orgmode, Nicolas Goaziou I'd be fine with either (or both) of these, and can code it up once we decide. I find it unlikely that I'd use an alphabetical list of size more than 26, which is why I only had one character to begin with. Thanks, Nathaniel Flath On Wed, Sep 29, 2010 at 8:49 AM, Carsten Dominik <carsten.dominik@gmail.com> wrote: > > Or, alternatively, put it in with an option to turn it on (default off, I > think). > And maybe we should after all limit it to a single character to avoid > confusion. > Yes, I do realise that I asked for several characters - but I am learning... > > - Carsten > > >> >> - Carsten >> > > ^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: Re: [PATCH] Alphabetical ordered lists 2010-09-29 15:49 ` Carsten Dominik 2010-09-29 16:50 ` Nathaniel Flath @ 2010-09-29 17:46 ` Nicolas Goaziou 2010-10-01 1:13 ` Nathaniel Flath 1 sibling, 1 reply; 41+ messages in thread From: Nicolas Goaziou @ 2010-09-29 17:46 UTC (permalink / raw) To: Carsten Dominik; +Cc: Bernt Hansen, emacs-orgmode, Jacob Mitchell Hello, >>>>> Carsten Dominik writes: > Or, alternatively, put it in with an option to turn it on (default > off, I think). And maybe we should after all limit it to a single > character to avoid confusion. Yes, I do realise that I asked for > several characters - but I am learning... What will then happen if the user is cycling bullets in a 100+ items list and hits alphabetic bullets? Besides undoing that move, there's nothing much that could be done then. Further cycling would become impossible. One idea would be to count items before cycling, and skipping alphabetic bullets for lists above 26 items. It has to be carefully implemented, as it could get very heavy on computations with large lists. Also, inserting new items in an alphabetical list should check if the 27th item has been reached and change bullets back to numbers if needed. I'm sure there are others subtleties that I can't think of right now. Regards, -- Nicolas ^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: Re: [PATCH] Alphabetical ordered lists 2010-09-29 17:46 ` Nicolas Goaziou @ 2010-10-01 1:13 ` Nathaniel Flath 2010-10-04 8:33 ` Carsten Dominik 0 siblings, 1 reply; 41+ messages in thread From: Nathaniel Flath @ 2010-10-01 1:13 UTC (permalink / raw) To: Nicolas Goaziou Cc: Bernt Hansen, Jacob Mitchell, emacs-orgmode, Carsten Dominik Carsten, If you think this is acceptable I'll start working on it. Thanks, Nathaniel Flath On Wed, Sep 29, 2010 at 10:46 AM, Nicolas Goaziou <n.goaziou@gmail.com> wrote: > Hello, > >>>>>> Carsten Dominik writes: > >> Or, alternatively, put it in with an option to turn it on (default >> off, I think). And maybe we should after all limit it to a single >> character to avoid confusion. Yes, I do realise that I asked for >> several characters - but I am learning... > > What will then happen if the user is cycling bullets in a 100+ items > list and hits alphabetic bullets? Besides undoing that move, there's > nothing much that could be done then. Further cycling would become > impossible. > > One idea would be to count items before cycling, and skipping > alphabetic bullets for lists above 26 items. It has to be carefully > implemented, as it could get very heavy on computations with large > lists. > > Also, inserting new items in an alphabetical list should check if the > 27th item has been reached and change bullets back to numbers if > needed. > > I'm sure there are others subtleties that I can't think of right now. > > Regards, > > -- Nicolas > ^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: Re: [PATCH] Alphabetical ordered lists 2010-10-01 1:13 ` Nathaniel Flath @ 2010-10-04 8:33 ` Carsten Dominik 2010-10-04 17:18 ` Nicolas Goaziou 0 siblings, 1 reply; 41+ messages in thread From: Carsten Dominik @ 2010-10-04 8:33 UTC (permalink / raw) To: Nathaniel Flath Cc: Bernt Hansen, Jacob Mitchell, emacs-orgmode, Nicolas Goaziou On Oct 1, 2010, at 3:13 AM, Nathaniel Flath wrote: > Carsten, > If you think this is acceptable I'll start working on it. > > Thanks, > Nathaniel Flath > > On Wed, Sep 29, 2010 at 10:46 AM, Nicolas Goaziou > <n.goaziou@gmail.com> wrote: >> Hello, >> >>>>>>> Carsten Dominik writes: >> >>> Or, alternatively, put it in with an option to turn it on (default >>> off, I think). And maybe we should after all limit it to a single >>> character to avoid confusion. Yes, I do realise that I asked for >>> several characters - but I am learning... >> >> What will then happen if the user is cycling bullets in a 100+ items >> list and hits alphabetic bullets? Besides undoing that move, there's >> nothing much that could be done then. Further cycling would become >> impossible. I think it would be appropriate in this case to simply throw an error and let the user clean up with undo. >> >> One idea would be to count items before cycling, and skipping >> alphabetic bullets for lists above 26 items. It has to be carefully >> implemented, as it could get very heavy on computations with large >> lists. We do not want that I agree. >> >> Also, inserting new items in an alphabetical list should check if the >> 27th item has been reached and change bullets back to numbers if >> needed. Again we could simply throw an error here and let the user handle the cleanup. >> >> I'm sure there are others subtleties that I can't think of right now. Nicolas, would you *object* against a patch by Nathaniel that implements this? You are Mr lists now, so your green light will be needed. Kind regards - Carsten ^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: Re: [PATCH] Alphabetical ordered lists 2010-10-04 8:33 ` Carsten Dominik @ 2010-10-04 17:18 ` Nicolas Goaziou 2010-10-05 0:07 ` Sebastian Rose 2010-10-05 7:40 ` Carsten Dominik 0 siblings, 2 replies; 41+ messages in thread From: Nicolas Goaziou @ 2010-10-04 17:18 UTC (permalink / raw) To: Carsten Dominik; +Cc: Bernt Hansen, emacs-orgmode, Jacob Mitchell >>>>> Carsten Dominik writes: > I think it would be appropriate in this case to simply throw an > error and let the user clean up with undo. Certainly, but this still means that any 27+ items list will never be able to complete a full bullet cycle as the user will have to undo each time alphabetical bullets are reached. It could perhaps start again at letter 'a'... > Nicolas, would you *object* against a patch by Nathaniel that > implements this? You are Mr lists now, so your green light will be > needed. I wouldn't object against it as some people are finding it useful and as it won't be turned on by default (if I remember correctly). But I can't help thinking this could lead to unexpected results in some cases (admittedly less than when alpha bullets could be any size long). Regards, -- Ni^W Mr lists ^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: Re: [PATCH] Alphabetical ordered lists 2010-10-04 17:18 ` Nicolas Goaziou @ 2010-10-05 0:07 ` Sebastian Rose 2010-10-05 0:21 ` Nathaniel Flath 2010-10-05 7:40 ` Carsten Dominik 1 sibling, 1 reply; 41+ messages in thread From: Sebastian Rose @ 2010-10-05 0:07 UTC (permalink / raw) To: Nicolas Goaziou Cc: Bernt Hansen, Jacob Mitchell, emacs-orgmode, Carsten Dominik Sorry for not following this thread closely. But from what I read, I thought it might be better to have a _command_ to sort existing lists alphabetically? That way, there is nothing that has to be "turned on" globally, that could intefere with Org mode's syntax. Excuse me, if that's of topic or already discussed. Sebastian ^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: Re: [PATCH] Alphabetical ordered lists 2010-10-05 0:07 ` Sebastian Rose @ 2010-10-05 0:21 ` Nathaniel Flath 0 siblings, 0 replies; 41+ messages in thread From: Nathaniel Flath @ 2010-10-05 0:21 UTC (permalink / raw) To: Sebastian Rose Cc: Bernt Hansen, Jacob Mitchell, emacs-orgmode, Nicolas Goaziou, Carsten Dominik I don't think this is what I had in mind. What you suggest seems to apply for bulleted lists, and sorting the titles of those alphabetically. I'm trying to implement lists of the form: a. Item 1 b. Item 2 c. Item 3 That work the same as lists like: 1. Item 1 2. Item 2 3. Item 3 Correct me if I'm misinterpreting you. Thanks, Nathaniel Flath On Mon, Oct 4, 2010 at 5:07 PM, Sebastian Rose <sebastian_rose@gmx.de> wrote: > > Sorry for not following this thread closely. > > But from what I read, I thought it might be better to have a _command_ > to sort existing lists alphabetically? > > That way, there is nothing that has to be "turned on" globally, that > could intefere with Org mode's syntax. > > > Excuse me, if that's of topic or already discussed. > > > Sebastian > > _______________________________________________ > Emacs-orgmode mailing list > Please use `Reply All' to send replies to the list. > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode > ^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: Re: [PATCH] Alphabetical ordered lists 2010-10-04 17:18 ` Nicolas Goaziou 2010-10-05 0:07 ` Sebastian Rose @ 2010-10-05 7:40 ` Carsten Dominik 2010-10-21 4:44 ` Nathaniel Flath 1 sibling, 1 reply; 41+ messages in thread From: Carsten Dominik @ 2010-10-05 7:40 UTC (permalink / raw) To: Nicolas Goaziou, Nathaniel Flath Cc: Bernt Hansen, Jacob Mitchell, org-mode List On Oct 4, 2010, at 7:18 PM, Nicolas Goaziou wrote: >>>>>> Carsten Dominik writes: > >> I think it would be appropriate in this case to simply throw an >> error and let the user clean up with undo. > > Certainly, but this still means that any 27+ items list will never be > able to complete a full bullet cycle as the user will have to undo > each time alphabetical bullets are reached. It could perhaps start > again at letter 'a'... Ok, we could force the list to become numbered when someone tries to cycle it into a,b,... THis does not mean that you'd have to count in advance, you could simply try the renumbering and when stepping over z throw an exception that will force the list to move to the next state which would be numbers. > >> Nicolas, would you *object* against a patch by Nathaniel that >> implements this? You are Mr lists now, so your green light will be >> needed. > > I wouldn't object against it as some people are finding it useful and > as it won't be turned on by default (if I remember correctly). Yes, we sould not turn it on by default because it might bahave strange under some circumstances. > > But I can't help thinking this could lead to unexpected results in > some cases (admittedly less than when alpha bullets could be any size > long). It definitely will. Here is an alternative idea. Nathaniel, what do you think about this: We could keep the numbering as we have it in the Org file, but introduce something like [@a] in the first item that will convert the numbering into a,b,... upon export to ASCII, HTML, maybe even LaTeX (even though I think LaTeX demands some consistency here and prefers to have the global setup decide how lists work). Hell, we could even use [@A] for capitals and [@i] and [@I] for roman numbering :) - Carsten ^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: Re: [PATCH] Alphabetical ordered lists 2010-10-05 7:40 ` Carsten Dominik @ 2010-10-21 4:44 ` Nathaniel Flath 2010-10-22 5:30 ` Nathaniel Flath 0 siblings, 1 reply; 41+ messages in thread From: Nathaniel Flath @ 2010-10-21 4:44 UTC (permalink / raw) To: Carsten Dominik Cc: Bernt Hansen, Jacob Mitchell, org-mode List, Nicolas Goaziou > >> >> But I can't help thinking this could lead to unexpected results in >> some cases (admittedly less than when alpha bullets could be any size >> long). > > It definitely will. > > Here is an alternative idea. Nathaniel, what do you > think about this: We could keep the numbering as we > have it in the Org file, but introduce something like [@a] > in the first item that will convert the numbering > into a,b,... upon export to ASCII, HTML, maybe even LaTeX > (even though I think LaTeX demands some consistency here > and prefers to have the global setup decide how lists work). > Hell, we could even use [@A] for capitals and [@i] and [@I] > for roman numbering :) > > - Carsten > Sorry for the late response - got swamped with work for a bit. I'd much prefer the approach I've been going with, mostly since I don't usually export my notes and mostly view them in org-mode. I'll work on the patch tonight - should send a patch either later tonight or tomorow. Thanks, Nathaniel Flath ^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: Re: [PATCH] Alphabetical ordered lists 2010-10-21 4:44 ` Nathaniel Flath @ 2010-10-22 5:30 ` Nathaniel Flath 2010-10-22 8:13 ` Carsten Dominik 2010-10-26 8:21 ` Nicolas Goaziou 0 siblings, 2 replies; 41+ messages in thread From: Nathaniel Flath @ 2010-10-22 5:30 UTC (permalink / raw) To: Carsten Dominik Cc: Bernt Hansen, Jacob Mitchell, org-mode List, Nicolas Goaziou [-- Attachment #1: Type: text/plain, Size: 1248 bytes --] I think I've fixed the issues brought up with this new patch. Please let me know what you think. On Wed, Oct 20, 2010 at 9:44 PM, Nathaniel Flath <flat0103@gmail.com> wrote: >> >>> >>> But I can't help thinking this could lead to unexpected results in >>> some cases (admittedly less than when alpha bullets could be any size >>> long). >> >> It definitely will. >> >> Here is an alternative idea. Nathaniel, what do you >> think about this: We could keep the numbering as we >> have it in the Org file, but introduce something like [@a] >> in the first item that will convert the numbering >> into a,b,... upon export to ASCII, HTML, maybe even LaTeX >> (even though I think LaTeX demands some consistency here >> and prefers to have the global setup decide how lists work). >> Hell, we could even use [@A] for capitals and [@i] and [@I] >> for roman numbering :) >> >> - Carsten >> > > Sorry for the late response - got swamped with work for a bit. > > I'd much prefer the approach I've been going with, mostly since I > don't usually export my notes and mostly view them in org-mode. I'll > work on the patch tonight - should send a patch either later tonight > or tomorow. > > Thanks, > Nathaniel Flath > [-- Attachment #2: ordered-list.patch --] [-- Type: application/octet-stream, Size: 9246 bytes --] diff --git a/lisp/org-list.el b/lisp/org-list.el index d9fc24e..6942eed 100644 --- a/lisp/org-list.el +++ b/lisp/org-list.el @@ -240,6 +240,11 @@ with the word \"recursive\" in the value." :group 'org-plain-lists :type 'boolean) +(defcustom org-alphabetical-lists nil + "Non-nil means alphabetical lists are activated." + :group 'org-plain-lists + :type 'boolean) + (defcustom org-description-max-indent 20 "Maximum indentation for the second line of a description list. When the indentation would be larger than this, it will become @@ -288,13 +293,13 @@ It depends on `org-empty-line-terminates-plain-lists'." If GENERAL is non-nil, return the general regexp independent of the value of `org-plain-list-ordered-item-terminator'." (cond - ((or general (eq org-plain-list-ordered-item-terminator t)) - "\\([ \t]*\\([-+]\\|\\([0-9]+[.)]\\)\\)\\|[ \t]+\\*\\)\\([ \t]+\\|$\\)") - ((= org-plain-list-ordered-item-terminator ?.) - "\\([ \t]*\\([-+]\\|\\([0-9]+\\.\\)\\)\\|[ \t]+\\*\\)\\([ \t]+\\|$\\)") - ((= org-plain-list-ordered-item-terminator ?\)) - "\\([ \t]*\\([-+]\\|\\([0-9]+)\\)\\)\\|[ \t]+\\*\\)\\([ \t]+\\|$\\)") - (t (error "Invalid value of `org-plain-list-ordered-item-terminator'")))) + ((or general (eq org-plain-list-ordered-item-terminator t)) + "\\([ \t]*\\([-+]\\|\\(\\([0-9]+\\|[A-Za-z]\\)[.)]\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)") + ((= org-plain-list-ordered-item-terminator ?.) + "\\([ \t]*\\([-+]\\|\\(\\([0-9]+\\|[A-Za-z]\\)\\.\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)") + ((= org-plain-list-ordered-item-terminator ?\)) + "\\([ \t]*\\([-+]\\|\\(\\([0-9]+\\|[A-Za-z]\\))\\)\\)\\|[ \t]+\\*\\)\\([ \t]+\\|$\\)") + (t (error "Invalid value of `org-plain-list-ordered-item-terminator'")))) (defconst org-item-beginning-re (concat "^" (org-item-re)) "Regexp matching the beginning of a plain list item.") @@ -530,8 +535,8 @@ List ending is determined by the indentation of text. See (save-excursion (goto-char (match-end 0)) ;; Ignore counter if any - (when (looking-at "\\(?:\\[@\\(?:start:\\)?[0-9]+\\][ \t]*\\)?") - (goto-char (match-end 0))) + (when (looking-at "\\(?:\\[@\\(?:start:\\)?\\(?:[0-9]+\\|[A-Za-z]\\)\\][ \t]*\\)?") + (goto-char (match-end 0))) (looking-at regexp)))) (defun org-list-get-item-same-level (search-fun pos limit pre-move) @@ -1135,11 +1140,11 @@ bullet string and bullet counter, if any." (list (point-at-bol) (org-get-indentation) (progn - (looking-at "^[ \t]*\\([-+*0-9.)]+[ \t]+\\)") + (looking-at "^[ \t]*\\([-+*0-9A-Za-z.)]+[ \t]+\\)") (match-string 1)) (progn (goto-char (match-end 0)) - (and (looking-at "\\[@\\(?:start:\\)?\\([0-9]+\\)\\]") + (and (looking-at "\\[@\\(?:start:\\)?\\([0-9A-Za-z]+\\)\\]") (match-string 1)))))) (defun org-list-struct (begin end top bottom &optional outdent) @@ -1259,16 +1264,20 @@ This function modifies STRUCT." (let ((counter (nth 3 item)) (bullet (org-list-bullet-string (nth 2 item)))) (cond - ((and (string-match "[0-9]+" bullet) counter) + ((and (string-match "[0-9A-Za-z]+" bullet) counter) (replace-match counter nil nil bullet)) ((string-match "[0-9]+" bullet) (replace-match "1" nil nil bullet)) + ((and (string-match "[A-Za-z]" bullet) (> 28 (length struct))) + (replace-match "a" nil nil bullet)) + ((string-match "[A-Za-z]" bullet) + (replace-match "1" nil nil bullet)) (t bullet))))) (set-bul (lambda (item bullet) (setcdr item (list (nth 1 item) bullet (nth 3 item))))) (get-bul (lambda (item bullet) (let* ((counter (nth 3 item))) - (if (and counter (string-match "[0-9]+" bullet)) + (if (and counter (string-match "[0-9A-Za-z]+" bullet)) (replace-match counter nil nil bullet) bullet)))) (fix-bul @@ -1582,13 +1591,50 @@ It determines the number of whitespaces to append by looking at " "))) nil nil bullet 1))) +(defun org-increment-string (str cap) + "Increments str (a->a, b->b, z->aa, aa->ab etc). If cap is non-nil, then + the letters are capitalized." + (let ((res (org-convert-num-to-alpha-str + (1+ (org-convert-alpha-str-to-num str 1 (length str) cap)) cap)) + (z (if cap ?Z ?z)) + (b (if cap ?B ?b)) + (a (if cap ?A ?a))) + (if (and(= (string-to-char str) z) + (= (string-to-char res) b)) + (concat (if cap "A" "a") (substring res 1)) + (concat (make-string (- (length str) (length res)) a) res)))) + +(defun org-convert-alpha-str-to-num (str n pos cap) + "Converts the substring consisting of locations pos to pos-n to a + numeric representation." + (let ((a (if cap ?A ?a))) + (if (= pos 1) (* (- (string-to-char str) a) n) + (+ (* (- (nth (1- pos) (string-to-list str)) a) n) + (org-convert-alpha-str-to-num str (* 26 n) (1- pos) cap))))) + +(defun org-convert-num-to-alpha-str (n cap) + "Converts the number n to a alphabetical, base-26 representation." + (if (= n 0) "" + (concat (org-convert-num-to-alpha-str (/ n 26) cap) + (string (+ (if cap ?A ?a) (% n 26)))))) + (defun org-list-inc-bullet-maybe (bullet) "Increment BULLET if applicable." - (if (string-match "[0-9]+" bullet) + (let ((case-fold-search nil)) + (cond + ((string-match "[0-9]+" bullet) (replace-match (number-to-string (1+ (string-to-number (match-string 0 bullet)))) - nil nil bullet) - bullet)) + nil nil bullet)) + ((string-match "[a-z]" bullet) + (replace-match + (org-increment-string (match-string 0 bullet) nil) + nil nil bullet)) + ((string-match "[A-Z]" bullet) + (replace-match + (org-increment-string (match-string 0 bullet) t) + nil nil bullet)) + (t bullet)))) (defun org-list-repair (&optional force-bullet top bottom) "Make sure all items are correctly indented, with the right bullet. @@ -1629,14 +1675,29 @@ If WHICH is a valid string, use that as the new bullet. If WHICH is an integer, 0 means `-', 1 means `+' etc. If WHICH is 'previous, cycle backwards." (interactive "P") - (let* ((top (org-list-top-point)) + (let* ((top (org-list-top-point)) + (alpha-possible (save-excursion + (goto-char (org-list-top-point)) + (and org-alphabetical-lists + (let ((retn 1)) + (condition-case nil + (progn (while (< retn 27) + (org-next-item) + (setq retn (1+ retn)) + nil)) + (error t)))))) (bullet (save-excursion (goto-char (org-get-beginning-of-list top)) (org-get-bullet))) - (current (cond - ((string-match "\\." bullet) "1.") - ((string-match ")" bullet) "1)") - (t bullet))) + (current (let ((case-fold-search nil)) + (cond + ((string-match "[0-9]+\\." bullet) "1.") + ((string-match "[0-9]+)" bullet) "1)") + ((string-match "[a-z]\\." bullet) "a.") + ((string-match "[a-z])" bullet) "a)") + ((string-match "[A-Z]\\." bullet) "A.") + ((string-match "[A-Z])" bullet) "A)") + (t bullet)))) (bullet-rule-p (cdr (assq 'bullet org-list-automatic-rules))) (bullet-list (append '("-" "+" ) ;; *-bullets are not allowed at column 0 @@ -1645,10 +1706,22 @@ is an integer, 0 means `-', 1 means `+' etc. If WHICH is ;; Description items cannot be numbered (unless (and bullet-rule-p (or (eq org-plain-list-ordered-item-terminator ?.) - (org-at-item-description-p))) '("1)")) + (org-at-item-description-p))) + '("1)")) (unless (and bullet-rule-p (or (eq org-plain-list-ordered-item-terminator ?\)) - (org-at-item-description-p))) '("1.")))) + (org-at-item-description-p))) + '("1.")) + (when (and org-alphabetical-lists alpha-possible) + (append + (unless (and bullet-rule-p + (or (eq org-plain-list-ordered-item-terminator ?.) + (org-at-item-description-p))) + '("A)" "a)")) + (unless (and bullet-rule-p + (or (eq org-plain-list-ordered-item-terminator ?\)) + (org-at-item-description-p))) + '("A." "a.")))))) (len (length bullet-list)) (item-index (- len (length (member current bullet-list)))) (get-value (lambda (index) (nth (mod index len) bullet-list))) @@ -2028,7 +2101,7 @@ sublevels as a list of strings." (while (org-search-forward-unenclosed org-item-beginning-re end t) (save-excursion (beginning-of-line) - (setq ltype (cond ((looking-at-p "^[ \t]*[0-9]") 'ordered) + (setq ltype (cond ((looking-at-p "^[ \t]*[0-9A-Za-z]+") 'ordered) ((org-at-item-description-p) 'descriptive) (t 'unordered)))) (let* ((indent1 (org-get-indentation)) @@ -2037,7 +2110,7 @@ sublevels as a list of strings." (org-end-of-item-or-at-child end)))) (nextindent (if (= (point) end) 0 (org-get-indentation))) (item (if (string-match - "^\\(?:\\[@\\(?:start:\\)?[0-9]+\\][ \t]*\\)?\\[\\([xX ]\\)\\]" + "^\\(?:\\[@\\(?:start:\\)?[0-9A-Za-z]+\\][ \t]*\\)?\\[\\([xX ]\\)\\]" item) (replace-match (if (equal (match-string 1 item) " ") "CBOFF" [-- Attachment #3: Type: text/plain, Size: 201 bytes --] _______________________________________________ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode ^ permalink raw reply related [flat|nested] 41+ messages in thread
* Re: Re: [PATCH] Alphabetical ordered lists 2010-10-22 5:30 ` Nathaniel Flath @ 2010-10-22 8:13 ` Carsten Dominik 2010-10-23 1:04 ` Nathaniel Flath 2010-10-26 8:21 ` Nicolas Goaziou 1 sibling, 1 reply; 41+ messages in thread From: Carsten Dominik @ 2010-10-22 8:13 UTC (permalink / raw) To: Nathaniel Flath Cc: Bernt Hansen, Jacob Mitchell, org-mode List, Nicolas Goaziou Hi Nathaniel, I get "patch does not apply". Can you please update the patch to the current git master? Thanks - Carsten On Oct 22, 2010, at 7:30 AM, Nathaniel Flath wrote: > I think I've fixed the issues brought up with this new patch. Please > let me know what you think. > > On Wed, Oct 20, 2010 at 9:44 PM, Nathaniel Flath > <flat0103@gmail.com> wrote: >>> >>>> >>>> But I can't help thinking this could lead to unexpected results in >>>> some cases (admittedly less than when alpha bullets could be any >>>> size >>>> long). >>> >>> It definitely will. >>> >>> Here is an alternative idea. Nathaniel, what do you >>> think about this: We could keep the numbering as we >>> have it in the Org file, but introduce something like [@a] >>> in the first item that will convert the numbering >>> into a,b,... upon export to ASCII, HTML, maybe even LaTeX >>> (even though I think LaTeX demands some consistency here >>> and prefers to have the global setup decide how lists work). >>> Hell, we could even use [@A] for capitals and [@i] and [@I] >>> for roman numbering :) >>> >>> - Carsten >>> >> >> Sorry for the late response - got swamped with work for a bit. >> >> I'd much prefer the approach I've been going with, mostly since I >> don't usually export my notes and mostly view them in org-mode. I'll >> work on the patch tonight - should send a patch either later tonight >> or tomorow. >> >> Thanks, >> Nathaniel Flath >> > <ordered-list.patch> - Carsten ^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: Re: [PATCH] Alphabetical ordered lists 2010-10-22 8:13 ` Carsten Dominik @ 2010-10-23 1:04 ` Nathaniel Flath 0 siblings, 0 replies; 41+ messages in thread From: Nathaniel Flath @ 2010-10-23 1:04 UTC (permalink / raw) To: Carsten Dominik Cc: Bernt Hansen, Jacob Mitchell, org-mode List, Nicolas Goaziou [-- Attachment #1: Type: text/plain, Size: 1739 bytes --] Sorry about that - patch attached. Thanks, Nathaniel Flath On Fri, Oct 22, 2010 at 1:13 AM, Carsten Dominik <carsten.dominik@gmail.com> wrote: > Hi Nathaniel, > > I get "patch does not apply". Can you please update the patch to the > current git master? > > Thanks > > - Carsten > > > On Oct 22, 2010, at 7:30 AM, Nathaniel Flath wrote: > >> I think I've fixed the issues brought up with this new patch. Please >> let me know what you think. >> >> On Wed, Oct 20, 2010 at 9:44 PM, Nathaniel Flath <flat0103@gmail.com> >> wrote: >>>> >>>>> >>>>> But I can't help thinking this could lead to unexpected results in >>>>> some cases (admittedly less than when alpha bullets could be any size >>>>> long). >>>> >>>> It definitely will. >>>> >>>> Here is an alternative idea. Nathaniel, what do you >>>> think about this: We could keep the numbering as we >>>> have it in the Org file, but introduce something like [@a] >>>> in the first item that will convert the numbering >>>> into a,b,... upon export to ASCII, HTML, maybe even LaTeX >>>> (even though I think LaTeX demands some consistency here >>>> and prefers to have the global setup decide how lists work). >>>> Hell, we could even use [@A] for capitals and [@i] and [@I] >>>> for roman numbering :) >>>> >>>> - Carsten >>>> >>> >>> Sorry for the late response - got swamped with work for a bit. >>> >>> I'd much prefer the approach I've been going with, mostly since I >>> don't usually export my notes and mostly view them in org-mode. I'll >>> work on the patch tonight - should send a patch either later tonight >>> or tomorow. >>> >>> Thanks, >>> Nathaniel Flath >>> >> <ordered-list.patch> > > - Carsten > > > > [-- Attachment #2: org-list.patch --] [-- Type: application/octet-stream, Size: 12463 bytes --] *** org-mode/lisp/org-list.el Fri Oct 22 18:02:46 2010 --- src/org-mode/lisp/org-list.el Thu Oct 21 22:28:04 2010 *************** *** 240,245 **** --- 240,250 ---- :group 'org-plain-lists :type 'boolean) + (defcustom org-alphabetical-lists nil + "Non-nil means alphabetical lists are activated." + :group 'org-plain-lists + :type 'boolean) + (defcustom org-description-max-indent 20 "Maximum indentation for the second line of a description list. When the indentation would be larger than this, it will become *************** *** 288,300 **** If GENERAL is non-nil, return the general regexp independent of the value of `org-plain-list-ordered-item-terminator'." (cond ! ((or general (eq org-plain-list-ordered-item-terminator t)) ! "\\([ \t]*\\([-+]\\|\\([0-9]+[.)]\\)\\)\\|[ \t]+\\*\\)\\([ \t]+\\|$\\)") ! ((= org-plain-list-ordered-item-terminator ?.) ! "\\([ \t]*\\([-+]\\|\\([0-9]+\\.\\)\\)\\|[ \t]+\\*\\)\\([ \t]+\\|$\\)") ! ((= org-plain-list-ordered-item-terminator ?\)) ! "\\([ \t]*\\([-+]\\|\\([0-9]+)\\)\\)\\|[ \t]+\\*\\)\\([ \t]+\\|$\\)") ! (t (error "Invalid value of `org-plain-list-ordered-item-terminator'")))) (defconst org-item-beginning-re (concat "^" (org-item-re)) "Regexp matching the beginning of a plain list item.") --- 293,305 ---- If GENERAL is non-nil, return the general regexp independent of the value of `org-plain-list-ordered-item-terminator'." (cond ! ((or general (eq org-plain-list-ordered-item-terminator t)) ! "\\([ \t]*\\([-+]\\|\\(\\([0-9]+\\|[A-Za-z]\\)[.)]\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)") ! ((= org-plain-list-ordered-item-terminator ?.) ! "\\([ \t]*\\([-+]\\|\\(\\([0-9]+\\|[A-Za-z]\\)\\.\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)") ! ((= org-plain-list-ordered-item-terminator ?\)) ! "\\([ \t]*\\([-+]\\|\\(\\([0-9]+\\|[A-Za-z]\\))\\)\\)\\|[ \t]+\\*\\)\\([ \t]+\\|$\\)") ! (t (error "Invalid value of `org-plain-list-ordered-item-terminator'")))) (defconst org-item-beginning-re (concat "^" (org-item-re)) "Regexp matching the beginning of a plain list item.") *************** *** 530,537 **** (save-excursion (goto-char (match-end 0)) ;; Ignore counter if any ! (when (looking-at "\\(?:\\[@\\(?:start:\\)?[0-9]+\\][ \t]*\\)?") ! (goto-char (match-end 0))) (looking-at regexp)))) (defun org-list-get-item-same-level (search-fun pos limit pre-move) --- 535,542 ---- (save-excursion (goto-char (match-end 0)) ;; Ignore counter if any ! (when (looking-at "\\(?:\\[@\\(?:start:\\)?\\(?:[0-9]+\\|[A-Za-z]\\)\\][ \t]*\\)?") ! (goto-char (match-end 0))) (looking-at regexp)))) (defun org-list-get-item-same-level (search-fun pos limit pre-move) *************** *** 1135,1145 **** (list (point-at-bol) (org-get-indentation) (progn ! (looking-at "^[ \t]*\\([-+*0-9.)]+[ \t]+\\)") (match-string 1)) (progn (goto-char (match-end 0)) ! (and (looking-at "\\[@\\(?:start:\\)?\\([0-9]+\\)\\]") (match-string 1)))))) (defun org-list-struct (begin end top bottom &optional outdent) --- 1140,1150 ---- (list (point-at-bol) (org-get-indentation) (progn ! (looking-at "^[ \t]*\\([-+*0-9A-Za-z.)]+[ \t]+\\)") (match-string 1)) (progn (goto-char (match-end 0)) ! (and (looking-at "\\[@\\(?:start:\\)?\\([0-9A-Za-z]+\\)\\]") (match-string 1)))))) (defun org-list-struct (begin end top bottom &optional outdent) *************** *** 1259,1274 **** (let ((counter (nth 3 item)) (bullet (org-list-bullet-string (nth 2 item)))) (cond ! ((and (string-match "[0-9]+" bullet) counter) (replace-match counter nil nil bullet)) ((string-match "[0-9]+" bullet) (replace-match "1" nil nil bullet)) (t bullet))))) (set-bul (lambda (item bullet) (setcdr item (list (nth 1 item) bullet (nth 3 item))))) (get-bul (lambda (item bullet) (let* ((counter (nth 3 item))) ! (if (and counter (string-match "[0-9]+" bullet)) (replace-match counter nil nil bullet) bullet)))) (fix-bul --- 1264,1283 ---- (let ((counter (nth 3 item)) (bullet (org-list-bullet-string (nth 2 item)))) (cond ! ((and (string-match "[0-9A-Za-z]+" bullet) counter) (replace-match counter nil nil bullet)) ((string-match "[0-9]+" bullet) (replace-match "1" nil nil bullet)) + ((and (string-match "[A-Za-z]" bullet) (> 28 (length struct))) + (replace-match "a" nil nil bullet)) + ((string-match "[A-Za-z]" bullet) + (replace-match "1" nil nil bullet)) (t bullet))))) (set-bul (lambda (item bullet) (setcdr item (list (nth 1 item) bullet (nth 3 item))))) (get-bul (lambda (item bullet) (let* ((counter (nth 3 item))) ! (if (and counter (string-match "[0-9A-Za-z]+" bullet)) (replace-match counter nil nil bullet) bullet)))) (fix-bul *************** *** 1582,1594 **** " "))) nil nil bullet 1))) (defun org-list-inc-bullet-maybe (bullet) "Increment BULLET if applicable." ! (if (string-match "[0-9]+" bullet) (replace-match (number-to-string (1+ (string-to-number (match-string 0 bullet)))) ! nil nil bullet) ! bullet)) (defun org-list-repair (&optional force-bullet top bottom) "Make sure all items are correctly indented, with the right bullet. --- 1591,1640 ---- " "))) nil nil bullet 1))) + (defun org-increment-string (str cap) + "Increments str (a->a, b->b, z->aa, aa->ab etc). If cap is non-nil, then + the letters are capitalized." + (let ((res (org-convert-num-to-alpha-str + (1+ (org-convert-alpha-str-to-num str 1 (length str) cap)) cap)) + (z (if cap ?Z ?z)) + (b (if cap ?B ?b)) + (a (if cap ?A ?a))) + (if (and(= (string-to-char str) z) + (= (string-to-char res) b)) + (concat (if cap "A" "a") (substring res 1)) + (concat (make-string (- (length str) (length res)) a) res)))) + + (defun org-convert-alpha-str-to-num (str n pos cap) + "Converts the substring consisting of locations pos to pos-n to a + numeric representation." + (let ((a (if cap ?A ?a))) + (if (= pos 1) (* (- (string-to-char str) a) n) + (+ (* (- (nth (1- pos) (string-to-list str)) a) n) + (org-convert-alpha-str-to-num str (* 26 n) (1- pos) cap))))) + + (defun org-convert-num-to-alpha-str (n cap) + "Converts the number n to a alphabetical, base-26 representation." + (if (= n 0) "" + (concat (org-convert-num-to-alpha-str (/ n 26) cap) + (string (+ (if cap ?A ?a) (% n 26)))))) + (defun org-list-inc-bullet-maybe (bullet) "Increment BULLET if applicable." ! (let ((case-fold-search nil)) ! (cond ! ((string-match "[0-9]+" bullet) (replace-match (number-to-string (1+ (string-to-number (match-string 0 bullet)))) ! nil nil bullet)) ! ((string-match "[a-z]" bullet) ! (replace-match ! (org-increment-string (match-string 0 bullet) nil) ! nil nil bullet)) ! ((string-match "[A-Z]" bullet) ! (replace-match ! (org-increment-string (match-string 0 bullet) t) ! nil nil bullet)) ! (t bullet)))) (defun org-list-repair (&optional force-bullet top bottom) "Make sure all items are correctly indented, with the right bullet. *************** *** 1629,1642 **** is an integer, 0 means `-', 1 means `+' etc. If WHICH is 'previous, cycle backwards." (interactive "P") ! (let* ((top (org-list-top-point)) (bullet (save-excursion (goto-char (org-get-beginning-of-list top)) (org-get-bullet))) ! (current (cond ! ((string-match "\\." bullet) "1.") ! ((string-match ")" bullet) "1)") ! (t bullet))) (bullet-rule-p (cdr (assq 'bullet org-list-automatic-rules))) (bullet-list (append '("-" "+" ) ;; *-bullets are not allowed at column 0 --- 1675,1703 ---- is an integer, 0 means `-', 1 means `+' etc. If WHICH is 'previous, cycle backwards." (interactive "P") ! (let* ((top (org-list-top-point)) ! (alpha-possible (save-excursion ! (goto-char (org-list-top-point)) ! (and org-alphabetical-lists ! (let ((retn 1)) ! (condition-case nil ! (progn (while (< retn 27) ! (org-next-item) ! (setq retn (1+ retn)) ! nil)) ! (error t)))))) (bullet (save-excursion (goto-char (org-get-beginning-of-list top)) (org-get-bullet))) ! (current (let ((case-fold-search nil)) ! (cond ! ((string-match "[0-9]+\\." bullet) "1.") ! ((string-match "[0-9]+)" bullet) "1)") ! ((string-match "[a-z]\\." bullet) "a.") ! ((string-match "[a-z])" bullet) "a)") ! ((string-match "[A-Z]\\." bullet) "A.") ! ((string-match "[A-Z])" bullet) "A)") ! (t bullet)))) (bullet-rule-p (cdr (assq 'bullet org-list-automatic-rules))) (bullet-list (append '("-" "+" ) ;; *-bullets are not allowed at column 0 *************** *** 1644,1654 **** (looking-at "\\S-")) '("*")) ;; Description items cannot be numbered (unless (and bullet-rule-p (or (eq org-plain-list-ordered-item-terminator ?\)) (org-at-item-description-p))) '("1.")) ! (unless (and bullet-rule-p ! (or (eq org-plain-list-ordered-item-terminator ?.) ! (org-at-item-description-p))) '("1)")))) (len (length bullet-list)) (item-index (- len (length (member current bullet-list)))) (get-value (lambda (index) (nth (mod index len) bullet-list))) --- 1705,1725 ---- (looking-at "\\S-")) '("*")) ;; Description items cannot be numbered (unless (and bullet-rule-p + (or (eq org-plain-list-ordered-item-terminator ?.) + (org-at-item-description-p))) '("1)")) + (unless (and bullet-rule-p (or (eq org-plain-list-ordered-item-terminator ?\)) (org-at-item-description-p))) '("1.")) ! (when (and org-alphabetical-lists alpha-possible) ! (append ! (unless (and bullet-rule-p ! (or (eq org-plain-list-ordered-item-terminator ?.) ! (org-at-item-description-p))) ! '("A)" "a)")) ! (unless (and bullet-rule-p ! (or (eq org-plain-list-ordered-item-terminator ?\)) ! (org-at-item-description-p))) ! '("A." "a.")))))) (len (length bullet-list)) (item-index (- len (length (member current bullet-list)))) (get-value (lambda (index) (nth (mod index len) bullet-list))) *************** *** 2028,2034 **** (while (org-search-forward-unenclosed org-item-beginning-re end t) (save-excursion (beginning-of-line) ! (setq ltype (cond ((looking-at-p "^[ \t]*[0-9]") 'ordered) ((org-at-item-description-p) 'descriptive) (t 'unordered)))) (let* ((indent1 (org-get-indentation)) --- 2099,2105 ---- (while (org-search-forward-unenclosed org-item-beginning-re end t) (save-excursion (beginning-of-line) ! (setq ltype (cond ((looking-at-p "^[ \t]*[0-9A-Za-z]+") 'ordered) ((org-at-item-description-p) 'descriptive) (t 'unordered)))) (let* ((indent1 (org-get-indentation)) *************** *** 2037,2043 **** (org-end-of-item-or-at-child end)))) (nextindent (if (= (point) end) 0 (org-get-indentation))) (item (if (string-match ! "^\\(?:\\[@\\(?:start:\\)?[0-9]+\\][ \t]*\\)?\\[\\([xX ]\\)\\]" item) (replace-match (if (equal (match-string 1 item) " ") "CBOFF" --- 2108,2114 ---- (org-end-of-item-or-at-child end)))) (nextindent (if (= (point) end) 0 (org-get-indentation))) (item (if (string-match ! "^\\(?:\\[@\\(?:start:\\)?[0-9A-Za-z]+\\][ \t]*\\)?\\[\\([xX ]\\)\\]" item) (replace-match (if (equal (match-string 1 item) " ") "CBOFF" [-- Attachment #3: Type: text/plain, Size: 201 bytes --] _______________________________________________ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode ^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: Re: [PATCH] Alphabetical ordered lists 2010-10-22 5:30 ` Nathaniel Flath 2010-10-22 8:13 ` Carsten Dominik @ 2010-10-26 8:21 ` Nicolas Goaziou 2010-10-26 8:23 ` Carsten Dominik 1 sibling, 1 reply; 41+ messages in thread From: Nicolas Goaziou @ 2010-10-26 8:21 UTC (permalink / raw) To: Nathaniel Flath Cc: Bernt Hansen, Jacob Mitchell, org-mode List, Carsten Dominik Hello, >>>>> Nathaniel Flath writes: > I think I've fixed the issues brought up with this new patch. Please > let me know what you think. I've noticed a couple of glitches. First, you are using (> 28 (length struct)) to know when to replace letters by numbers. But (length struct) doesn't always match list length, so it will lead to errors when outdenting items. For example, try outdenting, with its subtree, the item marked with "<<<" in the list below: a) etsiun b) etsiun c) etsiun d) etisun e) etsiun f) etsiun g) etsiun h) etsiun i) etisun j) etsiun k) etsiun l) etsiun m) etsiun n) etsiun a) Outdent me and my children ! <<< a) tersiu b) etsiru c) estiur d) etsnriu e) etsiun f) etiune g) etuirsnet b) etsiun o) etsiun p) etsiun q) etsiun r) etsiun s) etsiun All the lists will be numbered although they could keep alphabetical bullets. Another (lesser) problem is coming from the regexp chosen for bullets, that is "[0-9A-Za-z]+". I would suggest something alike "\\(\\(?:[0-9]\\)+\\|[A-Za-z]\\)". At the moment, you can set counter to [@a4] and break you list when applying it. Regards, -- Nicolas ^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: Re: [PATCH] Alphabetical ordered lists 2010-10-26 8:21 ` Nicolas Goaziou @ 2010-10-26 8:23 ` Carsten Dominik 2010-10-28 7:17 ` Nathaniel Flath 0 siblings, 1 reply; 41+ messages in thread From: Carsten Dominik @ 2010-10-26 8:23 UTC (permalink / raw) To: Nicolas Goaziou; +Cc: Bernt Hansen, org-mode List, Jacob Mitchell On Oct 26, 2010, at 10:21 AM, Nicolas Goaziou wrote: > Hello, > >>>>>> Nathaniel Flath writes: > >> I think I've fixed the issues brought up with this new patch. Please >> let me know what you think. > > I've noticed a couple of glitches. > > First, you are using > > (> 28 (length struct)) > > to know when to replace letters by numbers. But (length struct) > doesn't always match list length, so it will lead to errors when > outdenting items. > > For example, try outdenting, with its subtree, the item marked with > "<<<" in the list below: > > a) etsiun > b) etsiun > c) etsiun > d) etisun > e) etsiun > f) etsiun > g) etsiun > h) etsiun > i) etisun > j) etsiun > k) etsiun > l) etsiun > m) etsiun > n) etsiun > a) Outdent me and my children ! <<< > a) tersiu > b) etsiru > c) estiur > d) etsnriu > e) etsiun > f) etiune > g) etuirsnet > b) etsiun > o) etsiun > p) etsiun > q) etsiun > r) etsiun > s) etsiun > > All the lists will be numbered although they could keep alphabetical > bullets. > > Another (lesser) problem is coming from the regexp chosen for bullets, > that is "[0-9A-Za-z]+". I would suggest something alike > "\\(\\(?:[0-9]\\)+\\|[A-Za-z]\\)". At the moment, you can set counter > to [@a4] and break you list when applying it. Also, even when the alpha lists are turned off, typing a) and pressing M-RET will show that a) is seen as a list bullet. Thanks for your work, we are getting closer to an acceptable patch. - Carsten > > Regards, > > -- Nicolas - Carsten ^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: Re: [PATCH] Alphabetical ordered lists 2010-10-26 8:23 ` Carsten Dominik @ 2010-10-28 7:17 ` Nathaniel Flath 2010-11-11 7:16 ` Nathaniel Flath 0 siblings, 1 reply; 41+ messages in thread From: Nathaniel Flath @ 2010-10-28 7:17 UTC (permalink / raw) To: Carsten Dominik Cc: Bernt Hansen, Jacob Mitchell, org-mode List, Nicolas Goaziou [-- Attachment #1: Type: text/plain, Size: 1910 bytes --] New patch fixing these issues is attached. Let me know of any other problems. On Tue, Oct 26, 2010 at 1:23 AM, Carsten Dominik <carsten.dominik@gmail.com> wrote: > > On Oct 26, 2010, at 10:21 AM, Nicolas Goaziou wrote: > >> Hello, >> >>>>>>> Nathaniel Flath writes: >> >>> I think I've fixed the issues brought up with this new patch. Please >>> let me know what you think. >> >> I've noticed a couple of glitches. >> >> First, you are using >> >> (> 28 (length struct)) >> >> to know when to replace letters by numbers. But (length struct) >> doesn't always match list length, so it will lead to errors when >> outdenting items. >> >> For example, try outdenting, with its subtree, the item marked with >> "<<<" in the list below: >> >> a) etsiun >> b) etsiun >> c) etsiun >> d) etisun >> e) etsiun >> f) etsiun >> g) etsiun >> h) etsiun >> i) etisun >> j) etsiun >> k) etsiun >> l) etsiun >> m) etsiun >> n) etsiun >> a) Outdent me and my children ! <<< >> a) tersiu >> b) etsiru >> c) estiur >> d) etsnriu >> e) etsiun >> f) etiune >> g) etuirsnet >> b) etsiun >> o) etsiun >> p) etsiun >> q) etsiun >> r) etsiun >> s) etsiun >> >> All the lists will be numbered although they could keep alphabetical >> bullets. >> >> Another (lesser) problem is coming from the regexp chosen for bullets, >> that is "[0-9A-Za-z]+". I would suggest something alike >> "\\(\\(?:[0-9]\\)+\\|[A-Za-z]\\)". At the moment, you can set counter >> to [@a4] and break you list when applying it. > > > Also, even when the alpha lists are turned off, typing > > a) > > and pressing M-RET will show that a) is seen as a list bullet. > > Thanks for your work, we are getting closer to an acceptable patch. > > - Carsten > >> >> Regards, >> >> -- Nicolas > > - Carsten > > > > [-- Attachment #2: ordered-list.patch --] [-- Type: application/octet-stream, Size: 16742 bytes --] --- ../org-mode/lisp/org-list.el Thu Oct 28 00:12:17 2010 +++ org-mode/lisp/org-list.el Thu Oct 28 00:12:05 2010 @@ -240,6 +240,11 @@ :group 'org-plain-lists :type 'boolean) +(defcustom org-alphabetical-lists nil + "Non-nil means alphabetical lists are activated." + :group 'org-plain-lists + :type 'boolean) + (defcustom org-description-max-indent 20 "Maximum indentation for the second line of a description list. When the indentation would be larger than this, it will become @@ -288,16 +293,23 @@ If GENERAL is non-nil, return the general regexp independent of the value of `org-plain-list-ordered-item-terminator'." (cond + ((and org-alphabetical-lists (or general (eq org-plain-list-ordered-item-terminator t))) + "\\([ \t]*\\([-+]\\|\\(\\([0-9]+\\|[A-Za-z]\\)[.)]\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)") + ((and org-alphabetical-lists (= org-plain-list-ordered-item-terminator ?.)) + "\\([ \t]*\\([-+]\\|\\(\\([0-9]+\\|[A-Za-z]\\)\\.\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)") + ((and org-alphabetical-lists (= org-plain-list-ordered-item-terminator ?\))) + "\\([ \t]*\\([-+]\\|\\(\\([0-9]+\\|[A-Za-z]\\))\\)\\)\\|[ \t]+\\*\\)\\([ \t]+\\|$\\)") ((or general (eq org-plain-list-ordered-item-terminator t)) - "\\([ \t]*\\([-+]\\|\\([0-9]+[.)]\\)\\)\\|[ \t]+\\*\\)\\([ \t]+\\|$\\)") + "\\([ \t]*\\([-+]\\|\\(\\([0-9]+\\)[.)]\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)") ((= org-plain-list-ordered-item-terminator ?.) - "\\([ \t]*\\([-+]\\|\\([0-9]+\\.\\)\\)\\|[ \t]+\\*\\)\\([ \t]+\\|$\\)") + "\\([ \t]*\\([-+]\\|\\(\\([0-9]+)\\.\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)") ((= org-plain-list-ordered-item-terminator ?\)) - "\\([ \t]*\\([-+]\\|\\([0-9]+)\\)\\)\\|[ \t]+\\*\\)\\([ \t]+\\|$\\)") + "\\([ \t]*\\([-+]\\|\\(\\([0-9]+\\))\\)\\)\\|[ \t]+\\*\\)\\([ \t]+\\|$\\)") (t (error "Invalid value of `org-plain-list-ordered-item-terminator'")))) -(defconst org-item-beginning-re (concat "^" (org-item-re)) - "Regexp matching the beginning of a plain list item.") +(defun org-item-beginning-re () + "Regexp matching the beginning of a plain list item." + (concat "^" (org-item-re))) (defun org-list-ending-between (min max &optional firstp) "Find the position of a list ending between MIN and MAX, or nil. @@ -385,7 +397,7 @@ ;; Ensure there is at least an item above (up-item-p (save-excursion (org-search-backward-unenclosed - org-item-beginning-re limit t)))) + (org-item-beginning-re) limit t)))) (and up-item-p (catch 'exit (while t @@ -413,7 +425,7 @@ ;; `org-item-re'. (last-item-start (save-excursion (org-search-backward-unenclosed - org-item-beginning-re limit t))) + (org-item-beginning-re) limit t))) (list-ender (org-list-ending-between last-item-start actual-pos))) ;; We are in a list when we are on an item line or when we can @@ -433,7 +445,7 @@ ;; Otherwise, go back to the heading above or bob. (goto-char (or (org-list-ending-between limit pos) limit)) ;; From there, search down our list. - (org-search-forward-unenclosed org-item-beginning-re pos t) + (org-search-forward-unenclosed (org-item-beginning-re) pos t) (point-at-bol)))) (defun org-list-bottom-point-with-regexp (limit) @@ -530,7 +542,7 @@ (save-excursion (goto-char (match-end 0)) ;; Ignore counter if any - (when (looking-at "\\(?:\\[@\\(?:start:\\)?[0-9]+\\][ \t]*\\)?") + (when (looking-at "\\(?:\\[@\\(?:start:\\)?\\(?:[0-9]+\\|[A-Za-z]\\)\\][ \t]*\\)?") (goto-char (match-end 0))) (looking-at regexp)))) @@ -545,7 +557,7 @@ ;; We don't want to match the current line. (funcall pre-move) ;; Skip any sublist on the way - (while (and (funcall search-fun org-item-beginning-re limit t) + (while (and (funcall search-fun (org-item-beginning-re) limit t) (> (org-get-indentation) ind))) (when (and (/= (point-at-bol) start) ; Have we moved ? (= (org-get-indentation) ind)) @@ -606,7 +618,7 @@ (goto-char pos) ;; Is point in a special block? (when (org-in-regexps-block-p - "^[ \t]*#\\+\\(begin\\|BEGIN\\)_\\([a-zA-Z0-9_]+\\)" + "^[ \t]*#\\+\\(begin\\|BEGIN\\)_\\(\\(?:[a-zA-Z]\\|[0-9_]+\\)\\)" '(concat "^[ \t]*#\\+\\(end\\|END\\)_" (match-string 2))) (if (not (cdr (assq 'insert org-list-automatic-rules))) ;; Rule in `org-list-automatic-rules' forbids insertion. @@ -704,7 +716,7 @@ (cond ((and regionp (goto-char rbeg) - (not (org-search-forward-unenclosed org-item-beginning-re rend t))) + (not (org-search-forward-unenclosed (org-item-beginning-re) rend t))) (error "No item in region")) ((not (org-at-item-p)) (error "Not on an item")) @@ -802,13 +814,13 @@ (save-excursion (beginning-of-line) (let ((ind (org-get-indentation))) - (or (not (org-search-backward-unenclosed org-item-beginning-re top t)) + (or (not (org-search-backward-unenclosed (org-item-beginning-re) top t)) (< (org-get-indentation) ind))))) (defun org-at-item-p () "Is point in a line starting a hand-formatted item?" (save-excursion - (beginning-of-line) (looking-at org-item-beginning-re))) + (beginning-of-line) (looking-at (org-item-beginning-re)))) (defun org-at-item-bullet-p () "Is point at the bullet of a plain list item?" @@ -907,7 +919,7 @@ (save-excursion ;; possibly match current line (end-of-line) - (org-search-backward-unenclosed org-item-beginning-re nil t) + (org-search-backward-unenclosed (org-item-beginning-re) nil t) (point-at-bol))) (defun org-beginning-of-item () @@ -943,7 +955,7 @@ (let ((ind (org-get-indentation))) (while (and (/= (point) bottom) (>= (org-get-indentation) ind)) - (org-search-forward-unenclosed org-item-beginning-re bottom 'move)) + (org-search-forward-unenclosed (org-item-beginning-re) bottom 'move)) (if (= (point) bottom) bottom (point-at-bol))))) (defun org-end-of-item-list () @@ -973,7 +985,7 @@ BOTTOM is the position at list ending." (end-of-line) (goto-char - (if (org-search-forward-unenclosed org-item-beginning-re bottom t) + (if (org-search-forward-unenclosed (org-item-beginning-re) bottom t) (point-at-bol) (org-get-end-of-item bottom)))) @@ -1135,11 +1147,11 @@ (list (point-at-bol) (org-get-indentation) (progn - (looking-at "^[ \t]*\\([-+*0-9.)]+[ \t]+\\)") + (looking-at "^[ \t]*\\([-+*0-9A-Za-z.)]+[ \t]+\\)") (match-string 1)) (progn (goto-char (match-end 0)) - (and (looking-at "\\[@\\(?:start:\\)?\\([0-9]+\\)\\]") + (and (looking-at "\\[@\\(?:start:\\)?\\(\\(?:[0-9]+\\|[A-Za-z]\\)\\)\\]") (match-string 1)))))) (defun org-list-struct (begin end top bottom &optional outdent) @@ -1168,7 +1180,7 @@ (goto-char begin) ;; Find beginning of most outdented list (min list) (while (and (org-search-backward-unenclosed - org-item-beginning-re top t) + (org-item-beginning-re) top t) (>= (org-get-indentation) ind-min)) (setq pre-list (cons (org-list-struct-assoc-at-point) pre-list))) @@ -1182,7 +1194,7 @@ (goto-char end) (end-of-line) (while (and (org-search-forward-unenclosed - org-item-beginning-re bottom 'move) + (org-item-beginning-re) bottom 'move) (>= (org-get-indentation) ind-min)) (setq post-list (cons (org-list-struct-assoc-at-point) post-list))) @@ -1191,13 +1203,13 @@ (when (and (= (caar pre-list) 0) (< (point) bottom)) (beginning-of-line) (while (org-search-forward-unenclosed - org-item-beginning-re bottom t) + (org-item-beginning-re) bottom t) (setq post-list (cons (org-list-struct-assoc-at-point) post-list)))) (append pre-list struct (reverse post-list)))))) ;; Here we start: first get the core zone... (goto-char end) - (while (org-search-backward-unenclosed org-item-beginning-re begin t) + (while (org-search-backward-unenclosed (org-item-beginning-re) begin t) (setq struct (cons (org-list-struct-assoc-at-point) struct))) ;; ... then, extend it to make it a structure... (let ((extended (funcall extend struct))) @@ -1259,16 +1271,21 @@ (let ((counter (nth 3 item)) (bullet (org-list-bullet-string (nth 2 item)))) (cond - ((and (string-match "[0-9]+" bullet) counter) + ((and (string-match "[0-9]+\\|[A-Za-z]" bullet) counter) (replace-match counter nil nil bullet)) ((string-match "[0-9]+" bullet) (replace-match "1" nil nil bullet)) + ((and (save-excursion (goto-char (nth 0 item)) (org-list-can-be-alphabetical)) + (string-match "[A-Za-z]" bullet)) + (replace-match "a" nil nil bullet)) + ((string-match "[A-Za-z]" bullet) + (replace-match "1" nil nil bullet)) (t bullet))))) (set-bul (lambda (item bullet) (setcdr item (list (nth 1 item) bullet (nth 3 item))))) (get-bul (lambda (item bullet) (let* ((counter (nth 3 item))) - (if (and counter (string-match "[0-9]+" bullet)) + (if (and counter (string-match "[0-9]+\\|[A-Za-z]" bullet)) (replace-match counter nil nil bullet) bullet)))) (fix-bul @@ -1582,13 +1599,63 @@ " "))) nil nil bullet 1))) +(defun org-increment-string (str cap) + "Increments str (a->a, b->b, z->aa, aa->ab etc). If cap is non-nil, then + the letters are capitalized." + (let ((res (org-convert-num-to-alpha-str + (1+ (org-convert-alpha-str-to-num str 1 (length str) cap)) cap)) + (z (if cap ?Z ?z)) + (b (if cap ?B ?b)) + (a (if cap ?A ?a))) + (if (and(= (string-to-char str) z) + (= (string-to-char res) b)) + (concat (if cap "A" "a") (substring res 1)) + (concat (make-string (- (length str) (length res)) a) res)))) + +(defun org-convert-alpha-str-to-num (str n pos cap) + "Converts the substring consisting of locations pos to pos-n to a + numeric representation." + (let ((a (if cap ?A ?a))) + (if (= pos 1) (* (- (string-to-char str) a) n) + (+ (* (- (nth (1- pos) (string-to-list str)) a) n) + (org-convert-alpha-str-to-num str (* 26 n) (1- pos) cap))))) + +(defun org-convert-num-to-alpha-str (n cap) + "Converts the number n to a alphabetical, base-26 representation." + (if (= n 0) "" + (concat (org-convert-num-to-alpha-str (/ n 26) cap) + (string (+ (if cap ?A ?a) (% n 26)))))) + +(defun org-list-can-be-alphabetical () + "Returns t if the list has only 26 elements." + (save-excursion + (goto-char (org-beginning-of-item-list)) + (and org-alphabetical-lists + (let ((retn 1)) + (condition-case nil + (progn (while (< retn 27) + (org-next-item) + (setq retn (1+ retn)) + nil)) + (error t)))))) + (defun org-list-inc-bullet-maybe (bullet) "Increment BULLET if applicable." - (if (string-match "[0-9]+" bullet) + (let ((case-fold-search nil)) + (cond + ((string-match "[0-9]+" bullet) (replace-match (number-to-string (1+ (string-to-number (match-string 0 bullet)))) - nil nil bullet) - bullet)) + nil nil bullet)) + ((string-match "[a-z]" bullet) + (replace-match + (org-increment-string (match-string 0 bullet) nil) + nil nil bullet)) + ((string-match "[A-Z]" bullet) + (replace-match + (org-increment-string (match-string 0 bullet) t) + nil nil bullet)) + (t bullet)))) (defun org-list-repair (&optional force-bullet top bottom) "Make sure all items are correctly indented, with the right bullet. @@ -1633,10 +1700,15 @@ (bullet (save-excursion (goto-char (org-get-beginning-of-list top)) (org-get-bullet))) - (current (cond - ((string-match "\\." bullet) "1.") - ((string-match ")" bullet) "1)") - (t bullet))) + (current (let ((case-fold-search nil)) + (cond + ((string-match "[0-9]+\\." bullet) "1.") + ((string-match "[0-9]+)" bullet) "1)") + ((string-match "[a-z]\\." bullet) "a.") + ((string-match "[a-z])" bullet) "a)") + ((string-match "[A-Z]\\." bullet) "A.") + ((string-match "[A-Z])" bullet) "A)") + (t bullet)))) (bullet-rule-p (cdr (assq 'bullet org-list-automatic-rules))) (bullet-list (append '("-" "+" ) ;; *-bullets are not allowed at column 0 @@ -1644,11 +1716,21 @@ (looking-at "\\S-")) '("*")) ;; Description items cannot be numbered (unless (and bullet-rule-p + (or (eq org-plain-list-ordered-item-terminator ?.) + (org-at-item-description-p))) '("1)")) + (unless (and bullet-rule-p (or (eq org-plain-list-ordered-item-terminator ?\)) (org-at-item-description-p))) '("1.")) + (when (and org-alphabetical-lists (org-list-can-be-alphabetical)) + (append (unless (and bullet-rule-p (or (eq org-plain-list-ordered-item-terminator ?.) - (org-at-item-description-p))) '("1)")))) + (org-at-item-description-p))) + '("A)" "a)")) + (unless (and bullet-rule-p + (or (eq org-plain-list-ordered-item-terminator ?\)) + (org-at-item-description-p))) + '("A." "a.")))))) (len (length bullet-list)) (item-index (- len (length (member current bullet-list)))) (get-value (lambda (index) (nth (mod index len) bullet-list))) @@ -1684,7 +1766,7 @@ (rend (region-end))) (save-excursion (goto-char rbeg) - (if (org-search-forward-unenclosed org-item-beginning-re rend 'move) + (if (org-search-forward-unenclosed (org-item-beginning-re) rend 'move) (list (point-at-bol) rend nil) (error "No item in region"))))) ((org-on-heading-p) @@ -1696,7 +1778,7 @@ (goto-char limit) (org-search-backward-unenclosed ":END:" pos 'move) (org-search-forward-unenclosed - org-item-beginning-re limit 'move) + (org-item-beginning-re) limit 'move) (list (point) limit nil)))) ((org-at-item-p) (list (point-at-bol) (1+ (point-at-eol)) t)) @@ -1744,7 +1826,7 @@ (goto-char beg) (while (< (point) end) (funcall act-on-item ref-presence ref-status) - (org-search-forward-unenclosed org-item-beginning-re end 'move))) + (org-search-forward-unenclosed (org-item-beginning-re) end 'move))) (org-update-checkbox-count-maybe))) (defun org-reset-checkbox-state-subtree () @@ -1853,7 +1935,7 @@ (goto-char (or (org-get-next-item (point) lim) lim)) (end-of-line) (when (org-search-forward-unenclosed - org-item-beginning-re lim t) + (org-item-beginning-re) lim t) (beginning-of-line))) (setq next-ind (org-get-indentation))))) (goto-char continue-from) @@ -2025,10 +2107,10 @@ (let* ((start (goto-char (org-list-top-point))) (end (org-list-bottom-point)) output itemsep ltype) - (while (org-search-forward-unenclosed org-item-beginning-re end t) + (while (org-search-forward-unenclosed (org-item-beginning-re) end t) (save-excursion (beginning-of-line) - (setq ltype (cond ((looking-at-p "^[ \t]*[0-9]") 'ordered) + (setq ltype (cond ((looking-at-p "^[ \t]*\\([0-9]+\\|[A-Za-z]\\)") 'ordered) ((org-at-item-description-p) 'descriptive) (t 'unordered)))) (let* ((indent1 (org-get-indentation)) @@ -2037,7 +2119,7 @@ (org-end-of-item-or-at-child end)))) (nextindent (if (= (point) end) 0 (org-get-indentation))) (item (if (string-match - "^\\(?:\\[@\\(?:start:\\)?[0-9]+\\][ \t]*\\)?\\[\\([xX ]\\)\\]" + "^\\(?:\\[@\\(?:start:\\)?\\(?:[0-9]+\\|[A-Za-z]\\)\\][ \t]*\\)?\\[\\([xX ]\\)\\]" item) (replace-match (if (equal (match-string 1 item) " ") "CBOFF" @@ -2122,7 +2204,7 @@ (top-point (progn (re-search-backward "#\\+ORGLST" nil t) - (re-search-forward org-item-beginning-re bottom-point t) + (re-search-forward (org-item-beginning-re) bottom-point t) (match-beginning 0))) (list (save-restriction (narrow-to-region top-point bottom-point) [-- Attachment #3: Type: text/plain, Size: 201 bytes --] _______________________________________________ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode ^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: Re: [PATCH] Alphabetical ordered lists 2010-10-28 7:17 ` Nathaniel Flath @ 2010-11-11 7:16 ` Nathaniel Flath 2010-11-11 8:57 ` Nicolas Goaziou 2010-11-13 15:16 ` Nicolas Goaziou 0 siblings, 2 replies; 41+ messages in thread From: Nathaniel Flath @ 2010-11-11 7:16 UTC (permalink / raw) To: Carsten Dominik Cc: Bernt Hansen, Jacob Mitchell, org-mode List, Nicolas Goaziou Are there any further issues? Thanks, Nathaniel Flath On Thu, Oct 28, 2010 at 12:17 AM, Nathaniel Flath <flat0103@gmail.com> wrote: > New patch fixing these issues is attached. > > Let me know of any other problems. > > On Tue, Oct 26, 2010 at 1:23 AM, Carsten Dominik > <carsten.dominik@gmail.com> wrote: >> >> On Oct 26, 2010, at 10:21 AM, Nicolas Goaziou wrote: >> >>> Hello, >>> >>>>>>>> Nathaniel Flath writes: >>> >>>> I think I've fixed the issues brought up with this new patch. Please >>>> let me know what you think. >>> >>> I've noticed a couple of glitches. >>> >>> First, you are using >>> >>> (> 28 (length struct)) >>> >>> to know when to replace letters by numbers. But (length struct) >>> doesn't always match list length, so it will lead to errors when >>> outdenting items. >>> >>> For example, try outdenting, with its subtree, the item marked with >>> "<<<" in the list below: >>> >>> a) etsiun >>> b) etsiun >>> c) etsiun >>> d) etisun >>> e) etsiun >>> f) etsiun >>> g) etsiun >>> h) etsiun >>> i) etisun >>> j) etsiun >>> k) etsiun >>> l) etsiun >>> m) etsiun >>> n) etsiun >>> a) Outdent me and my children ! <<< >>> a) tersiu >>> b) etsiru >>> c) estiur >>> d) etsnriu >>> e) etsiun >>> f) etiune >>> g) etuirsnet >>> b) etsiun >>> o) etsiun >>> p) etsiun >>> q) etsiun >>> r) etsiun >>> s) etsiun >>> >>> All the lists will be numbered although they could keep alphabetical >>> bullets. >>> >>> Another (lesser) problem is coming from the regexp chosen for bullets, >>> that is "[0-9A-Za-z]+". I would suggest something alike >>> "\\(\\(?:[0-9]\\)+\\|[A-Za-z]\\)". At the moment, you can set counter >>> to [@a4] and break you list when applying it. >> >> >> Also, even when the alpha lists are turned off, typing >> >> a) >> >> and pressing M-RET will show that a) is seen as a list bullet. >> >> Thanks for your work, we are getting closer to an acceptable patch. >> >> - Carsten >> >>> >>> Regards, >>> >>> -- Nicolas >> >> - Carsten >> >> >> >> > ^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: Re: [PATCH] Alphabetical ordered lists 2010-11-11 7:16 ` Nathaniel Flath @ 2010-11-11 8:57 ` Nicolas Goaziou 2010-11-13 15:16 ` Nicolas Goaziou 1 sibling, 0 replies; 41+ messages in thread From: Nicolas Goaziou @ 2010-11-11 8:57 UTC (permalink / raw) To: Nathaniel Flath Cc: Bernt Hansen, Jacob Mitchell, org-mode List, Carsten Dominik Hello, >>>>> Nathaniel Flath writes: > Are there any further issues? Thanks, Nathaniel Flath I've quick checked your patch and it looks like it is doing its job. Two things to note, though: 1. I strongly recommend that `org-list-can-be-alphabetical' should make use of non-interactive forms instead of interactive ones. In other words, you should use `org-get-beginning-of-list' and `org-get-next-item' instead of `org-beginning-of-item-list' and `org-next-item'. You can see my note about it in org-list.el at line 856. If you have the structure of the list, `caadr' on it (or an equivalent if you don't like cl.el) will give you a valid top item needed by non-interactive forms. 2. Your patch doesn't apply to current git head, you should correct the conflict. Regards, -- Nicolas ^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: Re: [PATCH] Alphabetical ordered lists 2010-11-11 7:16 ` Nathaniel Flath 2010-11-11 8:57 ` Nicolas Goaziou @ 2010-11-13 15:16 ` Nicolas Goaziou 2010-11-22 4:45 ` Nathaniel Flath 1 sibling, 1 reply; 41+ messages in thread From: Nicolas Goaziou @ 2010-11-13 15:16 UTC (permalink / raw) To: Nathaniel Flath Cc: Bernt Hansen, Jacob Mitchell, org-mode List, Carsten Dominik Hello, >>>>> Nathaniel Flath writes: > Are there any further issues? Also, as you changed `org-item-beginning-re' into a function, there are a few places outside org-list.el that need to be modified accordingly. And exporters (mainly HTML and DocBook) should be aware of alphabetical bullets. Regards, -- Nicolas ^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: Re: [PATCH] Alphabetical ordered lists 2010-11-13 15:16 ` Nicolas Goaziou @ 2010-11-22 4:45 ` Nathaniel Flath 2010-11-22 13:37 ` Bernt Hansen 2010-11-22 18:37 ` Nicolas Goaziou 0 siblings, 2 replies; 41+ messages in thread From: Nathaniel Flath @ 2010-11-22 4:45 UTC (permalink / raw) To: Nicolas Goaziou Cc: Bernt Hansen, Jacob Mitchell, org-mode List, Carsten Dominik [-- Attachment #1: Type: text/plain, Size: 668 bytes --] I think I've fixed these, although I'm not an expert in the exporting. Let me know if there's anything else, or if I screwed up anything when trying to figure out how to make a git patch(looks like it worked, though.) Thanks, Nathaniel Flath On Sat, Nov 13, 2010 at 7:16 AM, Nicolas Goaziou <n.goaziou@gmail.com> wrote: > Hello, > >>>>>> Nathaniel Flath writes: > >> Are there any further issues? > > Also, as you changed `org-item-beginning-re' into a function, there > are a few places outside org-list.el that need to be modified > accordingly. > > And exporters (mainly HTML and DocBook) should be aware of > alphabetical bullets. > > Regards, > > -- Nicolas > [-- Attachment #2: 0001-Squashed-commit-of-the-following.patch --] [-- Type: application/octet-stream, Size: 30427 bytes --] From 3b46feec08ec4c93f098dbdc6a4590f95afc0e68 Mon Sep 17 00:00:00 2001 From: unknown <nflath@.(none)> Date: Sun, 21 Nov 2010 20:40:02 -0800 Subject: [PATCH] Squashed commit of the following: commit 7e9c81b27591c010cc0b6b016ee0e669ef5a304c Author: unknown <nflath@.(none)> Date: Sun Nov 21 20:01:42 2010 -0800 New version of alpha lists commit b3fd5cc57b7f1bd62ee1f5e0d8a1cf57ca14cfc2 Author: unknown <nflath@.(none)> Date: Thu Oct 21 22:28:44 2010 -0700 foo2 commit 00279a9b53b75baf1e3e13fc0bf0926421dddd25 Author: unknown <nflath@.(none)> Date: Thu Oct 21 22:27:01 2010 -0700 foo Fixup alphabetical lists patch --- lisp/org-capture.el | 4 +- lisp/org-docbook.el | 31 ++++--- lisp/org-exp.el | 2 +- lisp/org-html.el | 24 ++++-- lisp/org-latex.el | 2 +- lisp/org-list.el | 266 ++++++++++++++++++++++++++++++++++----------------- 6 files changed, 217 insertions(+), 112 deletions(-) diff --git a/lisp/org-capture.el b/lisp/org-capture.el index 2abe5c7..f2e8235 100644 --- a/lisp/org-capture.el +++ b/lisp/org-capture.el @@ -773,14 +773,14 @@ already gone." (if (org-capture-get :prepend) (progn (goto-char beg) - (if (org-search-forward-unenclosed org-item-beginning-re end t) + (if (org-search-forward-unenclosed (org-item-beginning-re) end t) (progn (goto-char (match-beginning 0)) (setq ind (org-get-indentation))) (goto-char end) (setq ind 0))) (goto-char end) - (if (org-search-backward-unenclosed org-item-beginning-re beg t) + (if (org-search-backward-unenclosed (org-item-beginning-re) beg t) (progn (setq ind (org-get-indentation)) (org-end-of-item)) diff --git a/lisp/org-docbook.el b/lisp/org-docbook.el index 7d90ec3..2b21022 100644 --- a/lisp/org-docbook.el +++ b/lisp/org-docbook.el @@ -1,5 +1,5 @@ ;;; org-docbook.el --- DocBook exporter for org-mode -;; +; ;; Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc. ;; ;; Emacs Lisp Archive Entry @@ -1012,14 +1012,15 @@ publishing directory." ;; Normal lines (when (string-match (cond - ((eq llt t) "^\\([ \t]*\\)\\(\\([-+*] \\)\\|\\([0-9]+[.)]\\) \\)?\\( *[^ \t\n\r]\\|[ \t]*$\\)") - ((= llt ?.) "^\\([ \t]*\\)\\(\\([-+*] \\)\\|\\([0-9]+\\.\\) \\)?\\( *[^ \t\n\r]\\|[ \t]*$\\)") - ((= llt ?\)) "^\\([ \t]*\\)\\(\\([-+*] \\)\\|\\([0-9]+)\\) \\)?\\( *[^ \t\n\r]\\|[ \t]*$\\)") + ((eq llt t) "^\\([ \t]*\\)\\(\\([-+*] \\)\\|\\(\\(?:[0-9]+\\|[a-zA-Z]\\)[.)]\\) \\)?\\( *[^ \t\n\r]\\|[ \t]*$\\)") + ((= llt ?.) "^\\([ \t]*\\)\\(\\([-+*] \\)\\|\\(\\(?:[0-9]+\\|[a-zA-Z]\\)\\.\\) \\)?\\( *[^ \t\n\r]\\|[ \t]*$\\)") + ((= llt ?\)) "^\\([ \t]*\\)\\(\\([-+*] \\)\\|\\(\\(?:[0-9]+\\|[a-zA-Z]\\))\\) \\)?\\( *[^ \t\n\r]\\|[ \t]*$\\)") (t (error "Invalid value of `org-plain-list-ordered-item-terminator'"))) line) (setq ind (or (get-text-property 0 'original-indentation line) (org-get-string-indentation line)) item-type (if (match-beginning 4) "o" "u") + ordered-type (match-string 2 line) starter (if (match-beginning 2) (substring (match-string 2 line) 0 -1)) line (substring line (match-beginning 5)) @@ -1040,16 +1041,18 @@ publishing directory." (org-export-docbook-close-para-maybe) (insert (cond ((equal item-type "u") "<itemizedlist>\n<listitem>\n") - ((and (equal item-type "o") item-number) - ;; Check for a specific start number. If it - ;; is specified, we use the ``override'' - ;; attribute of element <listitem> to pass the - ;; info to DocBook. We could also use the - ;; ``startingnumber'' attribute of element - ;; <orderedlist>, but the former works on both - ;; DocBook 5.0 and prior versions. - (format "<orderedlist>\n<listitem override=\"%s\">\n" item-number)) - ((equal item-type "o") "<orderedlist>\n<listitem>\n") + ((equal item-type "o") + (progn + (message ordered-type) + (concat "<orderedlist numeration=\"" + (cond + ((not starter) "arabic") + ((string-match "[0-9]+[.)]" ordered-type) "arabic") + ((string-match "[A-Z][.)]" ordered-type) "upperalpha") + ((string-match "[a-z][.)]" ordered-type) "loweralpha")) + "\">\n<listitem" + (if item-number (concat " override=\"" item-number "\">\n") + ">\n")))) ((equal item-type "d") (format "<variablelist>\n<varlistentry><term>%s</term><listitem>\n" item-tag)))) ;; For DocBook, we need to open a para right after tag diff --git a/lisp/org-exp.el b/lisp/org-exp.el index 08c0ac6..e510806 100644 --- a/lisp/org-exp.el +++ b/lisp/org-exp.el @@ -1664,7 +1664,7 @@ These special cookies will later be interpreted by the backend. (let ((process-buffer (lambda (end-list-marker) (goto-char (point-min)) - (while (org-search-forward-unenclosed org-item-beginning-re nil t) + (while (org-search-forward-unenclosed (org-item-beginning-re) nil t) (goto-char (org-list-bottom-point)) (when (and (not (eq org-list-ending-method 'indent)) (looking-at (org-list-end-re))) diff --git a/lisp/org-html.el b/lisp/org-html.el index d1fe06d..e4129eb 100644 --- a/lisp/org-html.el +++ b/lisp/org-html.el @@ -1551,20 +1551,21 @@ lang=\"%s\" xml:lang=\"%s\"> ;; Normal lines (when (string-match (cond - ((eq llt t) "^\\([ \t]*\\)\\(\\([-+*] \\)\\|\\([0-9]+[.)]\\) \\)?\\( *[^ \t\n\r]\\|[ \t]*$\\)") - ((= llt ?.) "^\\([ \t]*\\)\\(\\([-+*] \\)\\|\\([0-9]+\\.\\) \\)?\\( *[^ \t\n\r]\\|[ \t]*$\\)") - ((= llt ?\)) "^\\([ \t]*\\)\\(\\([-+*] \\)\\|\\([0-9]+)\\) \\)?\\( *[^ \t\n\r]\\|[ \t]*$\\)") + ((eq llt t) "^\\([ \t]*\\)\\(\\([-+*] \\)\\|\\(\\(?:[0-9]+\\|[a-zA-Z]\\)[.)]\\) \\)?\\( *[^ \t\n\r]\\|[ \t]*$\\)") + ((= llt ?.) "^\\([ \t]*\\)\\(\\([-+*] \\)\\|\\(\\(?:[0-9]+\\|[a-zA-Z]\\)\\.\\) \\)?\\( *[^ \t\n\r]\\|[ \t]*$\\)") + ((= llt ?\)) "^\\([ \t]*\\)\\(\\([-+*] \\)\\|\\(\\(?:[0-9]+\\|[a-zA-Z]\\))\\) \\)?\\( *[^ \t\n\r]\\|[ \t]*$\\)") (t (error "Invalid value of `org-plain-list-ordered-item-terminator'"))) line) (setq ind (or (get-text-property 0 'original-indentation line) (org-get-string-indentation line)) item-type (if (match-beginning 4) "o" "u") + ordered-type (match-string 2 line) starter (if (match-beginning 2) (substring (match-string 2 line) 0 -1)) line (substring line (match-beginning 5)) item-number nil item-tag nil) - (if (string-match "\\[@\\(?:start:\\)?\\([0-9]+\\)\\][ \t]?" line) + (if (string-match "\\[@\\(?:start:\\)?\\([0-9]+\\|[a-zA-Z]\\)\\][ \t]?" line) (setq item-number (match-string 1 line) line (replace-match "" t t line))) (if (and starter (string-match "\\(.*?\\) ::[ \t]*" line)) @@ -1579,9 +1580,18 @@ lang=\"%s\" xml:lang=\"%s\"> (org-close-par-maybe) (insert (cond ((equal item-type "u") "<ul>\n<li>\n") - ((and (equal item-type "o") item-number) - (format "<ol>\n<li value=\"%s\">\n" item-number)) - ((equal item-type "o") "<ol>\n<li>\n") + ((equal item-type "o") + (progn + (message ordered-type) + (concat "<ol type=\"" + (cond + ((not starter) "1") + ((string-match "[0-9]+[.)]" ordered-type) "1") + ((string-match "[A-Z][.)]" ordered-type) "A") + ((string-match "[a-z][.)]" ordered-type) "a")) + "\"><li" + (if item-number (concat" value=\"" item-number "\">\n") + ">\n")))) ((equal item-type "d") (format "<dl>\n<dt>%s</dt><dd>\n" item-tag)))) (push item-type local-list-type) diff --git a/lisp/org-latex.el b/lisp/org-latex.el index 91bf380..61523ca 100644 --- a/lisp/org-latex.el +++ b/lisp/org-latex.el @@ -2370,7 +2370,7 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER." "Convert plain text lists in current buffer into LaTeX lists." (let (res) (goto-char (point-min)) - (while (org-search-forward-unenclosed org-item-beginning-re nil t) + (while (org-search-forward-unenclosed (org-item-beginning-re) nil t) (beginning-of-line) (setq res (org-list-to-latex (org-list-parse-list t) org-export-latex-list-parameters)) diff --git a/lisp/org-list.el b/lisp/org-list.el index 2290b4a..dbe2576 100644 --- a/lisp/org-list.el +++ b/lisp/org-list.el @@ -221,16 +221,16 @@ indent when non-nil, indenting or outdenting list top-item insert when non-nil, trying to insert an item inside a block will insert it right before the block instead of throwing an error." - :group 'org-plain-lists - :type '(alist :tag "Sets of rules" - :key-type - (choice - (const :tag "Bullet" bullet) - (const :tag "Checkbox" checkbox) - (const :tag "Indent" indent) - (const :tag "Insert" insert)) - :value-type - (boolean :tag "Activate" :value t))) + :group 'org-plain-lists + :type '(alist :tag "Sets of rules" + :key-type + (choice + (const :tag "Bullet" bullet) + (const :tag "Checkbox" checkbox) + (const :tag "Indent" indent) + (const :tag "Insert" insert)) + :value-type + (boolean :tag "Activate" :value t))) (defcustom org-hierarchical-checkbox-statistics t "Non-nil means checkbox statistics counts only the state of direct children. @@ -240,6 +240,11 @@ with the word \"recursive\" in the value." :group 'org-plain-lists :type 'boolean) +(defcustom org-alphabetical-lists nil + "Non-nil means alphabetical lists are activated." + :group 'org-plain-lists + :type 'boolean) + (defcustom org-description-max-indent 20 "Maximum indentation for the second line of a description list. When the indentation would be larger than this, it will become @@ -288,16 +293,23 @@ It depends on `org-empty-line-terminates-plain-lists'." If GENERAL is non-nil, return the general regexp independent of the value of `org-plain-list-ordered-item-terminator'." (cond + ((and org-alphabetical-lists (or general (eq org-plain-list-ordered-item-terminator t))) + "\\([ \t]*\\([-+]\\|\\(\\([0-9]+\\|[A-Za-z]\\)[.)]\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)") + ((and org-alphabetical-lists (= org-plain-list-ordered-item-terminator ?.)) + "\\([ \t]*\\([-+]\\|\\(\\([0-9]+\\|[A-Za-z]\\)\\.\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)") + ((and org-alphabetical-lists (= org-plain-list-ordered-item-terminator ?\))) + "\\([ \t]*\\([-+]\\|\\(\\([0-9]+\\|[A-Za-z]\\))\\)\\)\\|[ \t]+\\*\\)\\([ \t]+\\|$\\)") ((or general (eq org-plain-list-ordered-item-terminator t)) - "\\([ \t]*\\([-+]\\|\\([0-9]+[.)]\\)\\)\\|[ \t]+\\*\\)\\([ \t]+\\|$\\)") + "\\([ \t]*\\([-+]\\|\\(\\([0-9]+\\)[.)]\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)") ((= org-plain-list-ordered-item-terminator ?.) - "\\([ \t]*\\([-+]\\|\\([0-9]+\\.\\)\\)\\|[ \t]+\\*\\)\\([ \t]+\\|$\\)") + "\\([ \t]*\\([-+]\\|\\(\\([0-9]+)\\.\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)") ((= org-plain-list-ordered-item-terminator ?\)) - "\\([ \t]*\\([-+]\\|\\([0-9]+)\\)\\)\\|[ \t]+\\*\\)\\([ \t]+\\|$\\)") + "\\([ \t]*\\([-+]\\|\\(\\([0-9]+\\))\\)\\)\\|[ \t]+\\*\\)\\([ \t]+\\|$\\)") (t (error "Invalid value of `org-plain-list-ordered-item-terminator'")))) -(defconst org-item-beginning-re (concat "^" (org-item-re)) - "Regexp matching the beginning of a plain list item.") +(defun org-item-beginning-re () + "Regexp matching the beginning of a plain list item." + (concat "^" (org-item-re))) (defun org-list-ending-between (min max &optional firstp) "Find the position of a list ending between MIN and MAX, or nil. @@ -327,11 +339,11 @@ stopping at LIMIT." (save-match-data (let ((case-fold-search t) (boundary (if (eq search 're-search-forward) 3 5))) - (when (save-excursion - (and (funcall search "^[ \t]*#\\+\\(begin\\|end\\)_" limit t) - (= (length (match-string 1)) boundary))) - ;; We're in a block: get out of it - (goto-char (match-beginning 0)))))) + (when (save-excursion + (and (funcall search "^[ \t]*#\\+\\(begin\\|end\\)_" limit t) + (= (length (match-string 1)) boundary))) + ;; We're in a block: get out of it + (goto-char (match-beginning 0)))))) (defun org-list-search-unenclosed-generic (search re bound noerr) "Search a string outside blocks and protected places. @@ -385,7 +397,7 @@ indented than the previous item within LIMIT." ;; Ensure there is at least an item above (up-item-p (save-excursion (org-search-backward-unenclosed - org-item-beginning-re limit t)))) + (org-item-beginning-re) limit t)))) (and up-item-p (catch 'exit (while t @@ -413,7 +425,7 @@ Argument LIMIT specifies the upper-bound of the search." ;; `org-item-re'. (last-item-start (save-excursion (org-search-backward-unenclosed - org-item-beginning-re limit t))) + (org-item-beginning-re) limit t))) (list-ender (org-list-ending-between last-item-start actual-pos))) ;; We are in a list when we are on an item line or when we can @@ -433,7 +445,7 @@ List ending is determined by regexp. See ;; Otherwise, go back to the heading above or bob. (goto-char (or (org-list-ending-between limit pos) limit)) ;; From there, search down our list. - (org-search-forward-unenclosed org-item-beginning-re pos t) + (org-search-forward-unenclosed (org-item-beginning-re) pos t) (point-at-bol)))) (defun org-list-bottom-point-with-regexp (limit) @@ -530,8 +542,8 @@ List ending is determined by the indentation of text. See (save-excursion (goto-char (match-end 0)) ;; Ignore counter if any - (when (looking-at "\\(?:\\[@\\(?:start:\\)?[0-9]+\\][ \t]*\\)?") - (goto-char (match-end 0))) + (when (looking-at "\\(?:\\[@\\(?:start:\\)?\\(?:[0-9]+\\|[A-Za-z]\\)\\][ \t]*\\)?") + (goto-char (match-end 0))) (looking-at regexp)))) (defun org-list-get-item-same-level (search-fun pos limit pre-move) @@ -545,7 +557,7 @@ uses PRE-MOVE before search. Return nil if no item was found." ;; We don't want to match the current line. (funcall pre-move) ;; Skip any sublist on the way - (while (and (funcall search-fun org-item-beginning-re limit t) + (while (and (funcall search-fun (org-item-beginning-re) limit t) (> (org-get-indentation) ind))) (when (and (/= (point-at-bol) start) ; Have we moved ? (= (org-get-indentation) ind)) @@ -606,7 +618,7 @@ function ends." (goto-char pos) ;; Is point in a special block? (when (org-in-regexps-block-p - "^[ \t]*#\\+\\(begin\\|BEGIN\\)_\\([a-zA-Z0-9_]+\\)" + "^[ \t]*#\\+\\(begin\\|BEGIN\\)_\\(\\(?:[a-zA-Z]\\|[0-9_]+\\)\\)" '(concat "^[ \t]*#\\+\\(end\\|END\\)_" (match-string 2))) (if (not (cdr (assq 'insert org-list-automatic-rules))) ;; Rule in `org-list-automatic-rules' forbids insertion. @@ -649,9 +661,9 @@ function ends." (org-list-exchange-items (org-get-item-beginning) (org-get-next-item (point) bottom) bottom) - ;; recompute next-item: last sexp modified list - (goto-char (org-get-next-item (point) bottom)) - (org-move-to-column col))) + ;; recompute next-item: last sexp modified list + (goto-char (org-get-next-item (point) bottom)) + (org-move-to-column col))) ;; checkbox update might modify bottom point, so use a ;; marker here (setq bottom (copy-marker bottom)) @@ -704,7 +716,7 @@ Return t if successful." (cond ((and regionp (goto-char rbeg) - (not (org-search-forward-unenclosed org-item-beginning-re rend t))) + (not (org-search-forward-unenclosed (org-item-beginning-re) rend t))) (error "No item in region")) ((not (org-at-item-p)) (error "Not on an item")) @@ -802,13 +814,13 @@ TOP is the position of list's top-item." (save-excursion (beginning-of-line) (let ((ind (org-get-indentation))) - (or (not (org-search-backward-unenclosed org-item-beginning-re top t)) + (or (not (org-search-backward-unenclosed (org-item-beginning-re) top t)) (< (org-get-indentation) ind))))) (defun org-at-item-p () "Is point in a line starting a hand-formatted item?" (save-excursion - (beginning-of-line) (looking-at org-item-beginning-re))) + (beginning-of-line) (looking-at (org-item-beginning-re)))) (defun org-at-item-bullet-p () "Is point at the bullet of a plain list item?" @@ -907,7 +919,7 @@ Assume point is in a list." (save-excursion ;; possibly match current line (end-of-line) - (org-search-backward-unenclosed org-item-beginning-re nil t) + (org-search-backward-unenclosed (org-item-beginning-re) nil t) (point-at-bol))) (defun org-beginning-of-item () @@ -943,7 +955,7 @@ BOTTOM is the position at list ending." (let ((ind (org-get-indentation))) (while (and (/= (point) bottom) (>= (org-get-indentation) ind)) - (org-search-forward-unenclosed org-item-beginning-re bottom 'move)) + (org-search-forward-unenclosed (org-item-beginning-re) bottom 'move)) (if (= (point) bottom) bottom (point-at-bol))))) (defun org-end-of-item-list () @@ -973,7 +985,7 @@ If the cursor is not in an item, throw an error." BOTTOM is the position at list ending." (end-of-line) (goto-char - (if (org-search-forward-unenclosed org-item-beginning-re bottom t) + (if (org-search-forward-unenclosed (org-item-beginning-re) bottom t) (point-at-bol) (org-get-end-of-item bottom)))) @@ -1135,11 +1147,11 @@ bullet string and bullet counter, if any." (list (point-at-bol) (org-get-indentation) (progn - (looking-at "^[ \t]*\\([-+*0-9.)]+[ \t]+\\)") + (looking-at "^[ \t]*\\([-+*0-9A-Za-z.)]+[ \t]+\\)") (match-string 1)) (progn (goto-char (match-end 0)) - (and (looking-at "\\[@\\(?:start:\\)?\\([0-9]+\\)\\]") + (and (looking-at "\\[@\\(?:start:\\)?\\(\\(?:[0-9]+\\|[A-Za-z]\\)\\)\\]") (match-string 1)))))) (defun org-list-struct (begin end top bottom &optional outdent) @@ -1168,7 +1180,7 @@ change is an outdent." (goto-char begin) ;; Find beginning of most outdented list (min list) (while (and (org-search-backward-unenclosed - org-item-beginning-re top t) + (org-item-beginning-re) top t) (>= (org-get-indentation) ind-min)) (setq pre-list (cons (org-list-struct-assoc-at-point) pre-list))) @@ -1182,7 +1194,7 @@ change is an outdent." (goto-char end) (end-of-line) (while (and (org-search-forward-unenclosed - org-item-beginning-re bottom 'move) + (org-item-beginning-re) bottom 'move) (>= (org-get-indentation) ind-min)) (setq post-list (cons (org-list-struct-assoc-at-point) post-list))) @@ -1191,13 +1203,13 @@ change is an outdent." (when (and (= (caar pre-list) 0) (< (point) bottom)) (beginning-of-line) (while (org-search-forward-unenclosed - org-item-beginning-re bottom t) + (org-item-beginning-re) bottom t) (setq post-list (cons (org-list-struct-assoc-at-point) post-list)))) (append pre-list struct (reverse post-list)))))) ;; Here we start: first get the core zone... (goto-char end) - (while (org-search-backward-unenclosed org-item-beginning-re begin t) + (while (org-search-backward-unenclosed (org-item-beginning-re) begin t) (setq struct (cons (org-list-struct-assoc-at-point) struct))) ;; ... then, extend it to make it a structure... (let ((extended (funcall extend struct))) @@ -1259,16 +1271,22 @@ This function modifies STRUCT." (let ((counter (nth 3 item)) (bullet (org-list-bullet-string (nth 2 item)))) (cond - ((and (string-match "[0-9]+" bullet) counter) + ((and (string-match "[0-9]+\\|[A-Za-z]" bullet) counter) (replace-match counter nil nil bullet)) ((string-match "[0-9]+" bullet) (replace-match "1" nil nil bullet)) + ((and (save-excursion (goto-char (nth 0 item)) + (org-list-can-be-alphabetical (caadr struct))) + (string-match "[A-Za-z]" bullet)) + (replace-match "a" nil nil bullet)) + ((string-match "[A-Za-z]" bullet) + (replace-match "1" nil nil bullet)) (t bullet))))) (set-bul (lambda (item bullet) (setcdr item (list (nth 1 item) bullet (nth 3 item))))) (get-bul (lambda (item bullet) (let* ((counter (nth 3 item))) - (if (and counter (string-match "[0-9]+" bullet)) + (if (and counter (string-match "[0-9]+\\|[A-Za-z]" bullet)) (replace-match counter nil nil bullet) bullet)))) (fix-bul @@ -1582,13 +1600,63 @@ It determines the number of whitespaces to append by looking at " "))) nil nil bullet 1))) +(defun org-increment-string (str cap) + "Increments str (a->a, b->b, z->aa, aa->ab etc). If cap is non-nil, then + the letters are capitalized." + (let ((res (org-convert-num-to-alpha-str + (1+ (org-convert-alpha-str-to-num str 1 (length str) cap)) cap)) + (z (if cap ?Z ?z)) + (b (if cap ?B ?b)) + (a (if cap ?A ?a))) + (if (and(= (string-to-char str) z) + (= (string-to-char res) b)) + (concat (if cap "A" "a") (substring res 1)) + (concat (make-string (- (length str) (length res)) a) res)))) + +(defun org-convert-alpha-str-to-num (str n pos cap) + "Converts the substring consisting of locations pos to pos-n to a + numeric representation." + (let ((a (if cap ?A ?a))) + (if (= pos 1) (* (- (string-to-char str) a) n) + (+ (* (- (nth (1- pos) (string-to-list str)) a) n) + (org-convert-alpha-str-to-num str (* 26 n) (1- pos) cap))))) + +(defun org-convert-num-to-alpha-str (n cap) + "Converts the number n to a alphabetical, base-26 representation." + (if (= n 0) "" + (concat (org-convert-num-to-alpha-str (/ n 26) cap) + (string (+ (if cap ?A ?a) (% n 26)))))) + +(defun org-list-can-be-alphabetical (item) + "Returns t if the list has only 26 elements." + (save-excursion + (goto-char (org-get-beginning-of-list item)) + (and org-alphabetical-lists + (let ((retn 1)) + (while (and + (< retn 27) + (org-get-next-item (point) (point-max))) + (setq retn (1+ retn)) + (goto-char (org-get-next-item (point) (point-max)))) + (<= retn 26))))) + (defun org-list-inc-bullet-maybe (bullet) "Increment BULLET if applicable." - (if (string-match "[0-9]+" bullet) + (let ((case-fold-search nil)) + (cond + ((string-match "[0-9]+" bullet) (replace-match (number-to-string (1+ (string-to-number (match-string 0 bullet)))) - nil nil bullet) - bullet)) + nil nil bullet)) + ((string-match "[a-z]" bullet) + (replace-match + (org-increment-string (match-string 0 bullet) nil) + nil nil bullet)) + ((string-match "[A-Z]" bullet) + (replace-match + (org-increment-string (match-string 0 bullet) t) + nil nil bullet)) + (t bullet)))) (defun org-list-repair (&optional force-bullet top bottom) "Make sure all items are correctly indented, with the right bullet. @@ -1629,36 +1697,60 @@ If WHICH is a valid string, use that as the new bullet. If WHICH is an integer, 0 means `-', 1 means `+' etc. If WHICH is 'previous, cycle backwards." (interactive "P") - (save-excursion - (let* ((top (org-list-top-point)) - (bullet (progn - (goto-char (org-get-beginning-of-list top)) - (org-get-bullet))) - (current (cond - ((string-match "\\." bullet) "1.") - ((string-match ")" bullet) "1)") - (t bullet))) - (bullet-rule-p (cdr (assq 'bullet org-list-automatic-rules))) - (bullet-list (append '("-" "+" ) - ;; *-bullets are not allowed at column 0 - (unless (and bullet-rule-p - (looking-at "\\S-")) '("*")) - ;; Description items cannot be numbered - (unless (and bullet-rule-p - (or (eq org-plain-list-ordered-item-terminator ?\)) - (org-at-item-description-p))) '("1.")) - (unless (and bullet-rule-p - (or (eq org-plain-list-ordered-item-terminator ?.) - (org-at-item-description-p))) '("1)")))) - (len (length bullet-list)) - (item-index (- len (length (member current bullet-list)))) - (get-value (lambda (index) (nth (mod index len) bullet-list))) - (new (cond - ((member which bullet-list) which) - ((numberp which) (funcall get-value which)) - ((eq 'previous which) (funcall get-value (1- item-index))) - (t (funcall get-value (1+ item-index)))))) - (org-list-repair new top)))) + (let* ((top (org-list-top-point)) + (alpha-possible (save-excursion + (goto-char (org-list-top-point)) + (and org-alphabetical-lists + (let ((retn 1)) + (condition-case nil + (progn (while (< retn 27) + (org-next-item) + (setq retn (1+ retn)) + nil)) + (error t)))))) + (bullet (save-excursion + (goto-char (org-get-beginning-of-list top)) + (org-get-bullet))) + (current (let ((case-fold-search nil)) + (cond + ((string-match "[0-9]+\\." bullet) "1.") + ((string-match "[0-9]+)" bullet) "1)") + ((string-match "[a-z]\\." bullet) "a.") + ((string-match "[a-z])" bullet) "a)") + ((string-match "[A-Z]\\." bullet) "A.") + ((string-match "[A-Z])" bullet) "A)") + (t bullet)))) + (bullet-rule-p (cdr (assq 'bullet org-list-automatic-rules))) + (bullet-list (append '("-" "+" ) + ;; *-bullets are not allowed at column 0 + (unless (and bullet-rule-p + (looking-at "\\S-")) '("*")) + ;; Description items cannot be numbered + (unless (and bullet-rule-p + (or (eq org-plain-list-ordered-item-terminator ?.) + (org-at-item-description-p))) '("1)")) + (unless (and bullet-rule-p + (or (eq org-plain-list-ordered-item-terminator ?\)) + (org-at-item-description-p))) '("1.")) + (when (and org-alphabetical-lists (org-list-can-be-alphabetical)) + (append + (unless (and bullet-rule-p + (or (eq org-plain-list-ordered-item-terminator ?.) + (org-at-item-description-p))) + '("A)" "a)")) + (unless (and bullet-rule-p + (or (eq org-plain-list-ordered-item-terminator ?\)) + (org-at-item-description-p))) + '("A." "a.")))))) + (len (length bullet-list)) + (item-index (- len (length (member current bullet-list)))) + (get-value (lambda (index) (nth (mod index len) bullet-list))) + (new (cond + ((member which bullet-list) which) + ((numberp which) (funcall get-value which)) + ((eq 'previous which) (funcall get-value (1- item-index))) + (t (funcall get-value (1+ item-index)))))) + (org-list-repair new top))) ;;; Checkboxes @@ -1685,7 +1777,7 @@ in subtree, ignoring drawers." (rend (region-end))) (save-excursion (goto-char rbeg) - (if (org-search-forward-unenclosed org-item-beginning-re rend 'move) + (if (org-search-forward-unenclosed (org-item-beginning-re) rend 'move) (list (point-at-bol) rend nil) (error "No item in region"))))) ((org-on-heading-p) @@ -1697,7 +1789,7 @@ in subtree, ignoring drawers." (goto-char limit) (org-search-backward-unenclosed ":END:" pos 'move) (org-search-forward-unenclosed - org-item-beginning-re limit 'move) + (org-item-beginning-re) limit 'move) (list (point) limit nil)))) ((org-at-item-p) (list (point-at-bol) (1+ (point-at-eol)) t)) @@ -1745,7 +1837,7 @@ in subtree, ignoring drawers." (goto-char beg) (while (< (point) end) (funcall act-on-item ref-presence ref-status) - (org-search-forward-unenclosed org-item-beginning-re end 'move))) + (org-search-forward-unenclosed (org-item-beginning-re) end 'move))) (org-update-checkbox-count-maybe))) (defun org-reset-checkbox-state-subtree () @@ -1854,7 +1946,7 @@ the whole buffer." (goto-char (or (org-get-next-item (point) lim) lim)) (end-of-line) (when (org-search-forward-unenclosed - org-item-beginning-re lim t) + (org-item-beginning-re) lim t) (beginning-of-line))) (setq next-ind (org-get-indentation))))) (goto-char continue-from) @@ -1880,8 +1972,8 @@ the whole buffer." (goto-char continue-from))) (unless (and all (outline-next-heading)) (throw 'exit nil)))) (when (interactive-p) - (message "Checkbox statistics updated %s (%d places)" - (if all "in entire file" "in current outline entry") cstat))))) + (message "Checkbox statistics updated %s (%d places)" + (if all "in entire file" "in current outline entry") cstat))))) (defun org-get-checkbox-statistics-face () "Select the face for checkbox statistics. @@ -2027,10 +2119,10 @@ sublevels as a list of strings." (let* ((start (goto-char (org-list-top-point))) (end (org-list-bottom-point)) output itemsep ltype) - (while (org-search-forward-unenclosed org-item-beginning-re end t) + (while (org-search-forward-unenclosed (org-item-beginning-re) end t) (save-excursion (beginning-of-line) - (setq ltype (cond ((org-looking-at-p "^[ \t]*[0-9]") 'ordered) + (setq ltype (cond ((ogr-looking-at-p "^[ \t]*\\([0-9]+\\|[A-Za-z]\\)") 'ordered) ((org-at-item-description-p) 'descriptive) (t 'unordered)))) (let* ((indent1 (org-get-indentation)) @@ -2039,7 +2131,7 @@ sublevels as a list of strings." (org-end-of-item-or-at-child end)))) (nextindent (if (= (point) end) 0 (org-get-indentation))) (item (if (string-match - "^\\(?:\\[@\\(?:start:\\)?[0-9]+\\][ \t]*\\)?\\[\\([xX ]\\)\\]" + "^\\(?:\\[@\\(?:start:\\)?\\(?:[0-9]+\\|[A-Za-z]\\)\\][ \t]*\\)?\\[\\([xX ]\\)\\]" item) (replace-match (if (equal (match-string 1 item) " ") "CBOFF" @@ -2124,7 +2216,7 @@ this list." (top-point (progn (re-search-backward "#\\+ORGLST" nil t) - (re-search-forward org-item-beginning-re bottom-point t) + (re-search-forward (org-item-beginning-re) bottom-point t) (match-beginning 0))) (list (save-restriction (narrow-to-region top-point bottom-point) -- 1.7.2.3.msysgit.0 [-- Attachment #3: Type: text/plain, Size: 201 bytes --] _______________________________________________ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode ^ permalink raw reply related [flat|nested] 41+ messages in thread
* Re: Re: [PATCH] Alphabetical ordered lists 2010-11-22 4:45 ` Nathaniel Flath @ 2010-11-22 13:37 ` Bernt Hansen 2010-11-22 18:37 ` Nicolas Goaziou 1 sibling, 0 replies; 41+ messages in thread From: Bernt Hansen @ 2010-11-22 13:37 UTC (permalink / raw) To: Nathaniel Flath Cc: org-mode List, Jacob Mitchell, Nicolas Goaziou, Carsten Dominik Nathaniel Flath <flat0103@gmail.com> writes: > Let me know if there's anything else, or if I screwed up anything > when trying to figure out how to make a git patch(looks like it > worked, though.) > > From 3b46feec08ec4c93f098dbdc6a4590f95afc0e68 Mon Sep 17 00:00:00 2001 > From: unknown <nflath@.(none)> > Date: Sun, 21 Nov 2010 20:40:02 -0800 > Subject: [PATCH] Squashed commit of the following: > > commit 7e9c81b27591c010cc0b6b016ee0e669ef5a304c > Author: unknown <nflath@.(none)> > Date: Sun Nov 21 20:01:42 2010 -0800 > > New version of alpha lists > > commit b3fd5cc57b7f1bd62ee1f5e0d8a1cf57ca14cfc2 > Author: unknown <nflath@.(none)> > Date: Thu Oct 21 22:28:44 2010 -0700 > > foo2 > > commit 00279a9b53b75baf1e3e13fc0bf0926421dddd25 > Author: unknown <nflath@.(none)> > Date: Thu Oct 21 22:27:01 2010 -0700 > > foo > > Fixup alphabetical lists patch > --- > lisp/org-capture.el | 4 +- Hi Nathaniel. There are a few issues with the commit message in this patch. 1. Invalid email address 2. A list of commits with useless information in it (foo, foo2) 3. Summary line (Squashed commot of the following:) really isn't useful on it's own The subject line (line 1 of the commit message) should be standalone and concisely state what the commit is for -- so you don't have to read the rest unless that interests you. The body of the commit message is for detailed descriptions of the change. You should delete the other squashed commit info since it is not useful. Describing what exactly you fixed up in the description would be preferable to 'fixed alphabetical lists patch'. 6 months from now nobody (including you) will know what you fixed without actually reading the patch details. Regards, Bernt ^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: Re: [PATCH] Alphabetical ordered lists 2010-11-22 4:45 ` Nathaniel Flath 2010-11-22 13:37 ` Bernt Hansen @ 2010-11-22 18:37 ` Nicolas Goaziou 2010-11-27 4:39 ` Nathaniel Flath 1 sibling, 1 reply; 41+ messages in thread From: Nicolas Goaziou @ 2010-11-22 18:37 UTC (permalink / raw) To: Nathaniel Flath Cc: Bernt Hansen, Jacob Mitchell, org-mode List, Carsten Dominik Hello, >>>>> Nathaniel Flath writes: > although I'm not an expert in the exporting. Let me know if there's > anything else, or if I screwed up anything when trying to figure out > how to make a git patch(looks like it worked, though.) I looked at your patch and here is what I've noticed so far: - There's a bug in `org-cycle-list-bullet' where org-list-can-be-alphabetical is called with argument missing. - In `org-cycle-list-bullet', variable `top' stores list top point, make use of it instead of recomputing it. - There's a typo in `org-list-parse-list' (ogr-looking-at-p instead of org-looking-at-p) - Some parts of the patch are only white-space changes (for example a change in `org-list-automatic-rules' but there are others). You shouldn't include them, as it is not the purpose of the patch. It doesn't help understanding your patch either. - Why did you remove all code comments about lists in org-docbook.el? - This is not a bug but are you sure you want to make org-item-beginning-re a function? I understand that it permits an user changing the value of `org-alphabetical-lists' to avoid reloading Org, but it looks like syntax overweight to me. I mean, anyone wanting to look for a list item will have to remember that it must do a re-search on a function and not a string. Hoping that helps, Regards, -- Nicolas ^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: Re: [PATCH] Alphabetical ordered lists 2010-11-22 18:37 ` Nicolas Goaziou @ 2010-11-27 4:39 ` Nathaniel Flath 2010-12-11 2:41 ` Nathaniel Flath 0 siblings, 1 reply; 41+ messages in thread From: Nathaniel Flath @ 2010-11-27 4:39 UTC (permalink / raw) To: Nicolas Goaziou Cc: Bernt Hansen, Jacob Mitchell, org-mode List, Carsten Dominik I'm working on your comments, should have another patch in the next day or so. The only thing I had issue with was the comment about org-item-beginning-re: I prefer it as a function for the reasons you mention, but I'm not particularly attached to this. Does anyone else have an opinion? Thanks, Nathaniel Flath On Mon, Nov 22, 2010 at 10:37 AM, Nicolas Goaziou <n.goaziou@gmail.com> wrote: > Hello, > >>>>>> Nathaniel Flath writes: > >> although I'm not an expert in the exporting. Let me know if there's >> anything else, or if I screwed up anything when trying to figure out >> how to make a git patch(looks like it worked, though.) > > I looked at your patch and here is what I've noticed so far: > > > - There's a bug in `org-cycle-list-bullet' where > org-list-can-be-alphabetical is called with argument missing. > > - In `org-cycle-list-bullet', variable `top' stores list top point, > make use of it instead of recomputing it. > > - There's a typo in `org-list-parse-list' (ogr-looking-at-p instead of > org-looking-at-p) > > - Some parts of the patch are only white-space changes (for example a > change in `org-list-automatic-rules' but there are others). You > shouldn't include them, as it is not the purpose of the patch. > > It doesn't help understanding your patch either. > > - Why did you remove all code comments about lists in org-docbook.el? > > - This is not a bug but are you sure you want to make > org-item-beginning-re a function? I understand that it permits an > user changing the value of `org-alphabetical-lists' to avoid > reloading Org, but it looks like syntax overweight to me. > > I mean, anyone wanting to look for a list item will have to remember > that it must do a re-search on a function and not a string. > > > Hoping that helps, > > Regards, > > -- Nicolas > ^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: Re: [PATCH] Alphabetical ordered lists 2010-11-27 4:39 ` Nathaniel Flath @ 2010-12-11 2:41 ` Nathaniel Flath 2010-12-20 18:25 ` Nicolas Goaziou 0 siblings, 1 reply; 41+ messages in thread From: Nathaniel Flath @ 2010-12-11 2:41 UTC (permalink / raw) To: Nicolas Goaziou Cc: Bernt Hansen, Jacob Mitchell, org-mode List, Carsten Dominik [-- Attachment #1: Type: text/plain, Size: 2192 bytes --] Sory for the long delay - I got caught up in other work. A patchaddressing the sisues brought up is attached. Let me know of anything else. Thanks, Nathaniel Flath On Fri, Nov 26, 2010 at 8:39 PM, Nathaniel Flath <flat0103@gmail.com> wrote: > I'm working on your comments, should have another patch in the next day or so. > > The only thing I had issue with was the comment about > org-item-beginning-re: I prefer it as a function for the reasons you > mention, but I'm not particularly attached to this. Does anyone else > have an opinion? > > Thanks, > Nathaniel Flath > > On Mon, Nov 22, 2010 at 10:37 AM, Nicolas Goaziou <n.goaziou@gmail.com> wrote: >> Hello, >> >>>>>>> Nathaniel Flath writes: >> >>> although I'm not an expert in the exporting. Let me know if there's >>> anything else, or if I screwed up anything when trying to figure out >>> how to make a git patch(looks like it worked, though.) >> >> I looked at your patch and here is what I've noticed so far: >> >> >> - There's a bug in `org-cycle-list-bullet' where >> org-list-can-be-alphabetical is called with argument missing. >> >> - In `org-cycle-list-bullet', variable `top' stores list top point, >> make use of it instead of recomputing it. >> >> - There's a typo in `org-list-parse-list' (ogr-looking-at-p instead of >> org-looking-at-p) >> >> - Some parts of the patch are only white-space changes (for example a >> change in `org-list-automatic-rules' but there are others). You >> shouldn't include them, as it is not the purpose of the patch. >> >> It doesn't help understanding your patch either. >> >> - Why did you remove all code comments about lists in org-docbook.el? >> >> - This is not a bug but are you sure you want to make >> org-item-beginning-re a function? I understand that it permits an >> user changing the value of `org-alphabetical-lists' to avoid >> reloading Org, but it looks like syntax overweight to me. >> >> I mean, anyone wanting to look for a list item will have to remember >> that it must do a re-search on a function and not a string. >> >> >> Hoping that helps, >> >> Regards, >> >> -- Nicolas >> > [-- Attachment #2: 0001-Added-support-for-alphabetical-patches-to-org-list.patch --] [-- Type: application/octet-stream, Size: 26430 bytes --] From c588035305f6e516f2b395b26eca3429cae36e65 Mon Sep 17 00:00:00 2001 From: Nathaniel Falth <flat0103@gmail.com> Date: Wed, 8 Dec 2010 00:24:12 -0800 Subject: [PATCH] Added support for alphabetical patches to org-list. Support can be enabled with the 'org-alphabetical-lists' variable, and the numeration goes from 'a' to 'z'. The latex, html, and docbook exporters have been updated to use these. --- lisp/org-capture.el | 4 +- lisp/org-docbook.el | 24 +++++-- lisp/org-exp.el | 2 +- lisp/org-html.el | 24 +++++-- lisp/org-latex.el | 2 +- lisp/org-list.el | 180 ++++++++++++++++++++++++++++++++++++++------------- 6 files changed, 174 insertions(+), 62 deletions(-) diff --git a/lisp/org-capture.el b/lisp/org-capture.el index 6819c18..d463562 100644 --- a/lisp/org-capture.el +++ b/lisp/org-capture.el @@ -804,14 +804,14 @@ already gone. Any prefix argument will be passed to the refile comand." (if (org-capture-get :prepend) (progn (goto-char beg) - (if (org-search-forward-unenclosed org-item-beginning-re end t) + (if (org-search-forward-unenclosed (org-item-beginning-re) end t) (progn (goto-char (match-beginning 0)) (setq ind (org-get-indentation))) (goto-char end) (setq ind 0))) (goto-char end) - (if (org-search-backward-unenclosed org-item-beginning-re beg t) + (if (org-search-backward-unenclosed (org-item-beginning-re) beg t) (progn (setq ind (org-get-indentation)) (org-end-of-item)) diff --git a/lisp/org-docbook.el b/lisp/org-docbook.el index 7d90ec3..40ace14 100644 --- a/lisp/org-docbook.el +++ b/lisp/org-docbook.el @@ -1,5 +1,5 @@ ;;; org-docbook.el --- DocBook exporter for org-mode -;; +;yes ;; Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc. ;; ;; Emacs Lisp Archive Entry @@ -1012,14 +1012,15 @@ publishing directory." ;; Normal lines (when (string-match (cond - ((eq llt t) "^\\([ \t]*\\)\\(\\([-+*] \\)\\|\\([0-9]+[.)]\\) \\)?\\( *[^ \t\n\r]\\|[ \t]*$\\)") - ((= llt ?.) "^\\([ \t]*\\)\\(\\([-+*] \\)\\|\\([0-9]+\\.\\) \\)?\\( *[^ \t\n\r]\\|[ \t]*$\\)") - ((= llt ?\)) "^\\([ \t]*\\)\\(\\([-+*] \\)\\|\\([0-9]+)\\) \\)?\\( *[^ \t\n\r]\\|[ \t]*$\\)") + ((eq llt t) "^\\([ \t]*\\)\\(\\([-+*] \\)\\|\\(\\(?:[0-9]+\\|[a-zA-Z]\\)[.)]\\) \\)?\\( *[^ \t\n\r]\\|[ \t]*$\\)") + ((= llt ?.) "^\\([ \t]*\\)\\(\\([-+*] \\)\\|\\(\\(?:[0-9]+\\|[a-zA-Z]\\)\\.\\) \\)?\\( *[^ \t\n\r]\\|[ \t]*$\\)") + ((= llt ?\)) "^\\([ \t]*\\)\\(\\([-+*] \\)\\|\\(\\(?:[0-9]+\\|[a-zA-Z]\\))\\) \\)?\\( *[^ \t\n\r]\\|[ \t]*$\\)") (t (error "Invalid value of `org-plain-list-ordered-item-terminator'"))) line) (setq ind (or (get-text-property 0 'original-indentation line) (org-get-string-indentation line)) item-type (if (match-beginning 4) "o" "u") + ordered-type (match-string 2 line) starter (if (match-beginning 2) (substring (match-string 2 line) 0 -1)) line (substring line (match-beginning 5)) @@ -1040,7 +1041,7 @@ publishing directory." (org-export-docbook-close-para-maybe) (insert (cond ((equal item-type "u") "<itemizedlist>\n<listitem>\n") - ((and (equal item-type "o") item-number) + ((equal item-type "o") ;; Check for a specific start number. If it ;; is specified, we use the ``override'' ;; attribute of element <listitem> to pass the @@ -1048,8 +1049,17 @@ publishing directory." ;; ``startingnumber'' attribute of element ;; <orderedlist>, but the former works on both ;; DocBook 5.0 and prior versions. - (format "<orderedlist>\n<listitem override=\"%s\">\n" item-number)) - ((equal item-type "o") "<orderedlist>\n<listitem>\n") + (progn + (message ordered-type) + (concat "<orderedlist numeration=\"" + (cond + ((not starter) "arabic") + ((string-match "[0-9]+[.)]" ordered-type) "arabic") + ((string-match "[A-Z][.)]" ordered-type) "upperalpha") + ((string-match "[a-z][.)]" ordered-type) "loweralpha")) + "\">\n<listitem" + (if item-number (concat " override=\"" item-number "\">\n") + ">\n")))) ((equal item-type "d") (format "<variablelist>\n<varlistentry><term>%s</term><listitem>\n" item-tag)))) ;; For DocBook, we need to open a para right after tag diff --git a/lisp/org-exp.el b/lisp/org-exp.el index 2aadacc..18b5071 100644 --- a/lisp/org-exp.el +++ b/lisp/org-exp.el @@ -1664,7 +1664,7 @@ These special cookies will later be interpreted by the backend. (let ((process-buffer (lambda (end-list-marker) (goto-char (point-min)) - (while (org-search-forward-unenclosed org-item-beginning-re nil t) + (while (org-search-forward-unenclosed (org-item-beginning-re) nil t) (goto-char (org-list-bottom-point)) (when (and (not (eq org-list-ending-method 'indent)) (looking-at (org-list-end-re))) diff --git a/lisp/org-html.el b/lisp/org-html.el index d1fe06d..e4129eb 100644 --- a/lisp/org-html.el +++ b/lisp/org-html.el @@ -1551,20 +1551,21 @@ lang=\"%s\" xml:lang=\"%s\"> ;; Normal lines (when (string-match (cond - ((eq llt t) "^\\([ \t]*\\)\\(\\([-+*] \\)\\|\\([0-9]+[.)]\\) \\)?\\( *[^ \t\n\r]\\|[ \t]*$\\)") - ((= llt ?.) "^\\([ \t]*\\)\\(\\([-+*] \\)\\|\\([0-9]+\\.\\) \\)?\\( *[^ \t\n\r]\\|[ \t]*$\\)") - ((= llt ?\)) "^\\([ \t]*\\)\\(\\([-+*] \\)\\|\\([0-9]+)\\) \\)?\\( *[^ \t\n\r]\\|[ \t]*$\\)") + ((eq llt t) "^\\([ \t]*\\)\\(\\([-+*] \\)\\|\\(\\(?:[0-9]+\\|[a-zA-Z]\\)[.)]\\) \\)?\\( *[^ \t\n\r]\\|[ \t]*$\\)") + ((= llt ?.) "^\\([ \t]*\\)\\(\\([-+*] \\)\\|\\(\\(?:[0-9]+\\|[a-zA-Z]\\)\\.\\) \\)?\\( *[^ \t\n\r]\\|[ \t]*$\\)") + ((= llt ?\)) "^\\([ \t]*\\)\\(\\([-+*] \\)\\|\\(\\(?:[0-9]+\\|[a-zA-Z]\\))\\) \\)?\\( *[^ \t\n\r]\\|[ \t]*$\\)") (t (error "Invalid value of `org-plain-list-ordered-item-terminator'"))) line) (setq ind (or (get-text-property 0 'original-indentation line) (org-get-string-indentation line)) item-type (if (match-beginning 4) "o" "u") + ordered-type (match-string 2 line) starter (if (match-beginning 2) (substring (match-string 2 line) 0 -1)) line (substring line (match-beginning 5)) item-number nil item-tag nil) - (if (string-match "\\[@\\(?:start:\\)?\\([0-9]+\\)\\][ \t]?" line) + (if (string-match "\\[@\\(?:start:\\)?\\([0-9]+\\|[a-zA-Z]\\)\\][ \t]?" line) (setq item-number (match-string 1 line) line (replace-match "" t t line))) (if (and starter (string-match "\\(.*?\\) ::[ \t]*" line)) @@ -1579,9 +1580,18 @@ lang=\"%s\" xml:lang=\"%s\"> (org-close-par-maybe) (insert (cond ((equal item-type "u") "<ul>\n<li>\n") - ((and (equal item-type "o") item-number) - (format "<ol>\n<li value=\"%s\">\n" item-number)) - ((equal item-type "o") "<ol>\n<li>\n") + ((equal item-type "o") + (progn + (message ordered-type) + (concat "<ol type=\"" + (cond + ((not starter) "1") + ((string-match "[0-9]+[.)]" ordered-type) "1") + ((string-match "[A-Z][.)]" ordered-type) "A") + ((string-match "[a-z][.)]" ordered-type) "a")) + "\"><li" + (if item-number (concat" value=\"" item-number "\">\n") + ">\n")))) ((equal item-type "d") (format "<dl>\n<dt>%s</dt><dd>\n" item-tag)))) (push item-type local-list-type) diff --git a/lisp/org-latex.el b/lisp/org-latex.el index 966c3b7..6370727 100644 --- a/lisp/org-latex.el +++ b/lisp/org-latex.el @@ -2370,7 +2370,7 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER." "Convert plain text lists in current buffer into LaTeX lists." (let (res) (goto-char (point-min)) - (while (org-search-forward-unenclosed org-item-beginning-re nil t) + (while (org-search-forward-unenclosed (org-item-beginning-re) nil t) (beginning-of-line) (setq res (org-list-to-latex (org-list-parse-list t) org-export-latex-list-parameters)) diff --git a/lisp/org-list.el b/lisp/org-list.el index abbaa5f..77f9146 100644 --- a/lisp/org-list.el +++ b/lisp/org-list.el @@ -240,6 +240,11 @@ with the word \"recursive\" in the value." :group 'org-plain-lists :type 'boolean) +(defcustom org-alphabetical-lists nil + "Non-nil means alphabetical lists are activated." + :group 'org-plain-lists + :type 'boolean) + (defcustom org-description-max-indent 20 "Maximum indentation for the second line of a description list. When the indentation would be larger than this, it will become @@ -288,16 +293,23 @@ It depends on `org-empty-line-terminates-plain-lists'." If GENERAL is non-nil, return the general regexp independent of the value of `org-plain-list-ordered-item-terminator'." (cond + ((and org-alphabetical-lists (or general (eq org-plain-list-ordered-item-terminator t))) + "\\([ \t]*\\([-+]\\|\\(\\([0-9]+\\|[A-Za-z]\\)[.)]\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)") + ((and org-alphabetical-lists (= org-plain-list-ordered-item-terminator ?.)) + "\\([ \t]*\\([-+]\\|\\(\\([0-9]+\\|[A-Za-z]\\)\\.\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)") + ((and org-alphabetical-lists (= org-plain-list-ordered-item-terminator ?\))) + "\\([ \t]*\\([-+]\\|\\(\\([0-9]+\\|[A-Za-z]\\))\\)\\)\\|[ \t]+\\*\\)\\([ \t]+\\|$\\)") ((or general (eq org-plain-list-ordered-item-terminator t)) - "\\([ \t]*\\([-+]\\|\\([0-9]+[.)]\\)\\)\\|[ \t]+\\*\\)\\([ \t]+\\|$\\)") + "\\([ \t]*\\([-+]\\|\\(\\([0-9]+\\)[.)]\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)") ((= org-plain-list-ordered-item-terminator ?.) - "\\([ \t]*\\([-+]\\|\\([0-9]+\\.\\)\\)\\|[ \t]+\\*\\)\\([ \t]+\\|$\\)") + "\\([ \t]*\\([-+]\\|\\(\\([0-9]+)\\.\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)") ((= org-plain-list-ordered-item-terminator ?\)) - "\\([ \t]*\\([-+]\\|\\([0-9]+)\\)\\)\\|[ \t]+\\*\\)\\([ \t]+\\|$\\)") + "\\([ \t]*\\([-+]\\|\\(\\([0-9]+\\))\\)\\)\\|[ \t]+\\*\\)\\([ \t]+\\|$\\)") (t (error "Invalid value of `org-plain-list-ordered-item-terminator'")))) -(defconst org-item-beginning-re (concat "^" (org-item-re)) - "Regexp matching the beginning of a plain list item.") +(defun org-item-beginning-re () + "Regexp matching the beginning of a plain list item." + (concat "^" (org-item-re))) (defun org-list-ending-between (min max &optional firstp) "Find the position of a list ending between MIN and MAX, or nil. @@ -385,7 +397,7 @@ indented than the previous item within LIMIT." ;; Ensure there is at least an item above (up-item-p (save-excursion (org-search-backward-unenclosed - org-item-beginning-re limit t)))) + (org-item-beginning-re) limit t)))) (and up-item-p (catch 'exit (while t @@ -413,7 +425,7 @@ Argument LIMIT specifies the upper-bound of the search." ;; `org-item-re'. (last-item-start (save-excursion (org-search-backward-unenclosed - org-item-beginning-re limit t))) + (org-item-beginning-re) limit t))) (list-ender (org-list-ending-between last-item-start actual-pos))) ;; We are in a list when we are on an item line or when we can @@ -433,7 +445,7 @@ List ending is determined by regexp. See ;; Otherwise, go back to the heading above or bob. (goto-char (or (org-list-ending-between limit pos) limit)) ;; From there, search down our list. - (org-search-forward-unenclosed org-item-beginning-re pos t) + (org-search-forward-unenclosed (org-item-beginning-re) pos t) (point-at-bol)))) (defun org-list-bottom-point-with-regexp (limit) @@ -534,7 +546,7 @@ List ending is determined by the indentation of text. See (save-excursion (goto-char (match-end 0)) ;; Ignore counter if any - (when (looking-at "\\(?:\\[@\\(?:start:\\)?[0-9]+\\][ \t]*\\)?") + (when (looking-at "\\(?:\\[@\\(?:start:\\)?\\(?:[0-9]+\\|[A-Za-z]\\)\\][ \t]*\\)?") (goto-char (match-end 0))) (looking-at regexp)))) @@ -549,7 +561,7 @@ uses PRE-MOVE before search. Return nil if no item was found." ;; We don't want to match the current line. (funcall pre-move) ;; Skip any sublist on the way - (while (and (funcall search-fun org-item-beginning-re limit t) + (while (and (funcall search-fun (org-item-beginning-re) limit t) (> (org-get-indentation) ind))) (when (and (/= (point-at-bol) start) ; Have we moved ? (= (org-get-indentation) ind)) @@ -610,7 +622,7 @@ function ends." (goto-char pos) ;; Is point in a special block? (when (org-in-regexps-block-p - "^[ \t]*#\\+\\(begin\\|BEGIN\\)_\\([a-zA-Z0-9_]+\\)" + "^[ \t]*#\\+\\(begin\\|BEGIN\\)_\\(\\(?:[a-zA-Z]\\|[0-9_]+\\)\\)" '(concat "^[ \t]*#\\+\\(end\\|END\\)_" (match-string 2))) (if (not (cdr (assq 'insert org-list-automatic-rules))) ;; Rule in `org-list-automatic-rules' forbids insertion. @@ -708,7 +720,7 @@ Return t if successful." (cond ((and regionp (goto-char rbeg) - (not (org-search-forward-unenclosed org-item-beginning-re rend t))) + (not (org-search-forward-unenclosed (org-item-beginning-re) rend t))) (error "No item in region")) ((not (org-at-item-p)) (error "Not on an item")) @@ -806,13 +818,13 @@ TOP is the position of list's top-item." (save-excursion (beginning-of-line) (let ((ind (org-get-indentation))) - (or (not (org-search-backward-unenclosed org-item-beginning-re top t)) + (or (not (org-search-backward-unenclosed (org-item-beginning-re) top t)) (< (org-get-indentation) ind))))) (defun org-at-item-p () "Is point in a line starting a hand-formatted item?" (save-excursion - (beginning-of-line) (looking-at org-item-beginning-re))) + (beginning-of-line) (looking-at (org-item-beginning-re)))) (defun org-at-item-bullet-p () "Is point at the bullet of a plain list item?" @@ -911,7 +923,7 @@ Assume point is in a list." (save-excursion ;; possibly match current line (end-of-line) - (org-search-backward-unenclosed org-item-beginning-re nil t) + (org-search-backward-unenclosed (org-item-beginning-re) nil t) (point-at-bol))) (defun org-beginning-of-item () @@ -947,7 +959,7 @@ BOTTOM is the position at list ending." (let ((ind (org-get-indentation))) (while (and (/= (point) bottom) (>= (org-get-indentation) ind)) - (org-search-forward-unenclosed org-item-beginning-re bottom 'move)) + (org-search-forward-unenclosed (org-item-beginning-re) bottom 'move)) (if (= (point) bottom) bottom (point-at-bol))))) (defun org-end-of-item-list () @@ -977,7 +989,7 @@ If the cursor is not in an item, throw an error." BOTTOM is the position at list ending." (end-of-line) (goto-char - (if (org-search-forward-unenclosed org-item-beginning-re bottom t) + (if (org-search-forward-unenclosed (org-item-beginning-re) bottom t) (point-at-bol) (org-get-end-of-item bottom)))) @@ -1139,11 +1151,11 @@ bullet string and bullet counter, if any." (list (point-at-bol) (org-get-indentation) (progn - (looking-at "^[ \t]*\\([-+*0-9.)]+[ \t]+\\)") + (looking-at "^[ \t]*\\([-+*0-9A-Za-z.)]+[ \t]+\\)") (match-string 1)) (progn (goto-char (match-end 0)) - (and (looking-at "\\[@\\(?:start:\\)?\\([0-9]+\\)\\]") + (and (looking-at "\\[@\\(?:start:\\)?\\(\\(?:[0-9]+\\|[A-Za-z]\\)\\)\\]") (match-string 1)))))) (defun org-list-struct (begin end top bottom &optional outdent) @@ -1172,7 +1184,7 @@ change is an outdent." (goto-char begin) ;; Find beginning of most outdented list (min list) (while (and (org-search-backward-unenclosed - org-item-beginning-re top t) + (org-item-beginning-re) top t) (>= (org-get-indentation) ind-min)) (setq pre-list (cons (org-list-struct-assoc-at-point) pre-list))) @@ -1186,7 +1198,7 @@ change is an outdent." (goto-char end) (end-of-line) (while (and (org-search-forward-unenclosed - org-item-beginning-re bottom 'move) + (org-item-beginning-re) bottom 'move) (>= (org-get-indentation) ind-min)) (setq post-list (cons (org-list-struct-assoc-at-point) post-list))) @@ -1195,13 +1207,13 @@ change is an outdent." (when (and (= (caar pre-list) 0) (< (point) bottom)) (beginning-of-line) (while (org-search-forward-unenclosed - org-item-beginning-re bottom t) + (org-item-beginning-re) bottom t) (setq post-list (cons (org-list-struct-assoc-at-point) post-list)))) (append pre-list struct (reverse post-list)))))) ;; Here we start: first get the core zone... (goto-char end) - (while (org-search-backward-unenclosed org-item-beginning-re begin t) + (while (org-search-backward-unenclosed (org-item-beginning-re) begin t) (setq struct (cons (org-list-struct-assoc-at-point) struct))) ;; ... then, extend it to make it a structure... (let ((extended (funcall extend struct))) @@ -1263,16 +1275,22 @@ This function modifies STRUCT." (let ((counter (nth 3 item)) (bullet (org-list-bullet-string (nth 2 item)))) (cond - ((and (string-match "[0-9]+" bullet) counter) + ((and (string-match "[0-9]+\\|[A-Za-z]" bullet) counter) (replace-match counter nil nil bullet)) ((string-match "[0-9]+" bullet) (replace-match "1" nil nil bullet)) + ((and (save-excursion (goto-char (nth 0 item)) + (org-list-can-be-alphabetical (caadr struct))) + (string-match "[A-Za-z]" bullet)) + (replace-match "a" nil nil bullet)) + ((string-match "[A-Za-z]" bullet) + (replace-match "1" nil nil bullet)) (t bullet))))) (set-bul (lambda (item bullet) (setcdr item (list (nth 1 item) bullet (nth 3 item))))) (get-bul (lambda (item bullet) (let* ((counter (nth 3 item))) - (if (and counter (string-match "[0-9]+" bullet)) + (if (and counter (string-match "[0-9]+\\|[A-Za-z]" bullet)) (replace-match counter nil nil bullet) bullet)))) (fix-bul @@ -1586,13 +1604,63 @@ It determines the number of whitespaces to append by looking at " "))) nil nil bullet 1))) +(defun org-increment-string (str cap) + "Increments str (a->a, b->b, z->aa, aa->ab etc). If cap is non-nil, then + the letters are capitalized." + (let ((res (org-convert-num-to-alpha-str + (1+ (org-convert-alpha-str-to-num str 1 (length str) cap)) cap)) + (z (if cap ?Z ?z)) + (b (if cap ?B ?b)) + (a (if cap ?A ?a))) + (if (and(= (string-to-char str) z) + (= (string-to-char res) b)) + (concat (if cap "A" "a") (substring res 1)) + (concat (make-string (- (length str) (length res)) a) res)))) + +(defun org-convert-alpha-str-to-num (str n pos cap) + "Converts the substring consisting of locations pos to pos-n to a + numeric representation." + (let ((a (if cap ?A ?a))) + (if (= pos 1) (* (- (string-to-char str) a) n) + (+ (* (- (nth (1- pos) (string-to-list str)) a) n) + (org-convert-alpha-str-to-num str (* 26 n) (1- pos) cap))))) + +(defun org-convert-num-to-alpha-str (n cap) + "Converts the number n to a alphabetical, base-26 representation." + (if (= n 0) "" + (concat (org-convert-num-to-alpha-str (/ n 26) cap) + (string (+ (if cap ?A ?a) (% n 26)))))) + +(defun org-list-can-be-alphabetical (item) + "Returns t if the list has only 26 elements." + (save-excursion + (goto-char (org-get-beginning-of-list item)) + (and org-alphabetical-lists + (let ((retn 1)) + (while (and + (< retn 27) + (org-get-next-item (point) (point-max))) + (setq retn (1+ retn)) + (goto-char (org-get-next-item (point) (point-max)))) + (<= retn 26))))) + (defun org-list-inc-bullet-maybe (bullet) "Increment BULLET if applicable." - (if (string-match "[0-9]+" bullet) + (let ((case-fold-search nil)) + (cond + ((string-match "[0-9]+" bullet) (replace-match (number-to-string (1+ (string-to-number (match-string 0 bullet)))) - nil nil bullet) - bullet)) + nil nil bullet)) + ((string-match "[a-z]" bullet) + (replace-match + (org-increment-string (match-string 0 bullet) nil) + nil nil bullet)) + ((string-match "[A-Z]" bullet) + (replace-match + (org-increment-string (match-string 0 bullet) t) + nil nil bullet)) + (t bullet)))) (defun org-list-repair (&optional force-bullet top bottom) "Make sure all items are correctly indented, with the right bullet. @@ -1633,15 +1701,29 @@ If WHICH is a valid string, use that as the new bullet. If WHICH is an integer, 0 means `-', 1 means `+' etc. If WHICH is 'previous, cycle backwards." (interactive "P") - (save-excursion (let* ((top (org-list-top-point)) - (bullet (progn + (alpha-possible (save-excursion + (goto-char top) + (and org-alphabetical-lists + (let ((retn 1)) + (condition-case nil + (progn (while (< retn 27) + (org-next-item) + (setq retn (1+ retn)) + nil)) + (error t)))))) + (bullet (save-excursion (goto-char (org-get-beginning-of-list top)) (org-get-bullet))) - (current (cond - ((string-match "\\." bullet) "1.") - ((string-match ")" bullet) "1)") - (t bullet))) + (current (let ((case-fold-search nil)) + (cond + ((string-match "[0-9]+\\." bullet) "1.") + ((string-match "[0-9]+)" bullet) "1)") + ((string-match "[a-z]\\." bullet) "a.") + ((string-match "[a-z])" bullet) "a)") + ((string-match "[A-Z]\\." bullet) "A.") + ((string-match "[A-Z])" bullet) "A)") + (t bullet)))) (bullet-rule-p (cdr (assq 'bullet org-list-automatic-rules))) (bullet-list (append '("-" "+" ) ;; *-bullets are not allowed at column 0 @@ -1649,11 +1731,21 @@ is an integer, 0 means `-', 1 means `+' etc. If WHICH is (looking-at "\\S-")) '("*")) ;; Description items cannot be numbered (unless (and bullet-rule-p + (or (eq org-plain-list-ordered-item-terminator ?.) + (org-at-item-description-p))) '("1)")) + (unless (and bullet-rule-p (or (eq org-plain-list-ordered-item-terminator ?\)) (org-at-item-description-p))) '("1.")) + (when (and org-alphabetical-lists alpha-possible) + (append (unless (and bullet-rule-p (or (eq org-plain-list-ordered-item-terminator ?.) - (org-at-item-description-p))) '("1)")))) + (org-at-item-description-p))) + '("A)" "a)")) + (unless (and bullet-rule-p + (or (eq org-plain-list-ordered-item-terminator ?\)) + (org-at-item-description-p))) + '("A." "a.")))))) (len (length bullet-list)) (item-index (- len (length (member current bullet-list)))) (get-value (lambda (index) (nth (mod index len) bullet-list))) @@ -1662,7 +1754,7 @@ is an integer, 0 means `-', 1 means `+' etc. If WHICH is ((numberp which) (funcall get-value which)) ((eq 'previous which) (funcall get-value (1- item-index))) (t (funcall get-value (1+ item-index)))))) - (org-list-repair new top)))) + (org-list-repair new top))) ;;; Checkboxes @@ -1689,7 +1781,7 @@ in subtree, ignoring drawers." (rend (region-end))) (save-excursion (goto-char rbeg) - (if (org-search-forward-unenclosed org-item-beginning-re rend 'move) + (if (org-search-forward-unenclosed (org-item-beginning-re) rend 'move) (list (point-at-bol) rend nil) (error "No item in region"))))) ((org-on-heading-p) @@ -1701,7 +1793,7 @@ in subtree, ignoring drawers." (goto-char limit) (org-search-backward-unenclosed ":END:" pos 'move) (org-search-forward-unenclosed - org-item-beginning-re limit 'move) + (org-item-beginning-re) limit 'move) (list (point) limit nil)))) ((org-at-item-p) (list (point-at-bol) (1+ (point-at-eol)) t)) @@ -1749,7 +1841,7 @@ in subtree, ignoring drawers." (goto-char beg) (while (< (point) end) (funcall act-on-item ref-presence ref-status) - (org-search-forward-unenclosed org-item-beginning-re end 'move))) + (org-search-forward-unenclosed (org-item-beginning-re) end 'move))) (org-update-checkbox-count-maybe))) (defun org-reset-checkbox-state-subtree () @@ -1858,7 +1950,7 @@ the whole buffer." (goto-char (or (org-get-next-item (point) lim) lim)) (end-of-line) (when (org-search-forward-unenclosed - org-item-beginning-re lim t) + (org-item-beginning-re) lim t) (beginning-of-line))) (setq next-ind (org-get-indentation))))) (goto-char continue-from) @@ -2031,10 +2123,10 @@ sublevels as a list of strings." (let* ((start (goto-char (org-list-top-point))) (end (org-list-bottom-point)) output itemsep ltype) - (while (org-search-forward-unenclosed org-item-beginning-re end t) + (while (org-search-forward-unenclosed (org-item-beginning-re) end t) (save-excursion (beginning-of-line) - (setq ltype (cond ((org-looking-at-p "^[ \t]*[0-9]") 'ordered) + (setq ltype (cond ((org-looking-at-p "^[ \t]*\\([0-9]+\\|[A-Za-z]\\)") 'ordered) ((org-at-item-description-p) 'descriptive) (t 'unordered)))) (let* ((indent1 (org-get-indentation)) @@ -2043,7 +2135,7 @@ sublevels as a list of strings." (org-end-of-item-or-at-child end)))) (nextindent (if (= (point) end) 0 (org-get-indentation))) (item (if (string-match - "^\\(?:\\[@\\(?:start:\\)?[0-9]+\\][ \t]*\\)?\\[\\([xX ]\\)\\]" + "^\\(?:\\[@\\(?:start:\\)?\\(?:[0-9]+\\|[A-Za-z]\\)\\][ \t]*\\)?\\[\\([xX ]\\)\\]" item) (replace-match (if (equal (match-string 1 item) " ") "CBOFF" @@ -2128,7 +2220,7 @@ this list." (top-point (progn (re-search-backward "#\\+ORGLST" nil t) - (re-search-forward org-item-beginning-re bottom-point t) + (re-search-forward (org-item-beginning-re) bottom-point t) (match-beginning 0))) (list (save-restriction (narrow-to-region top-point bottom-point) -- 1.7.2.3.msysgit.0 [-- Attachment #3: Type: text/plain, Size: 201 bytes --] _______________________________________________ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode ^ permalink raw reply related [flat|nested] 41+ messages in thread
* Re: Re: [PATCH] Alphabetical ordered lists 2010-12-11 2:41 ` Nathaniel Flath @ 2010-12-20 18:25 ` Nicolas Goaziou 2011-01-12 20:05 ` Nathaniel Flath 0 siblings, 1 reply; 41+ messages in thread From: Nicolas Goaziou @ 2010-12-20 18:25 UTC (permalink / raw) To: Nathaniel Flath Cc: Bernt Hansen, Jacob Mitchell, org-mode List, Carsten Dominik Hello, >>>>> Nathaniel Flath writes: > Sory for the long delay - I got caught up in other work. A > patchaddressing the sisues brought up is attached. I've had a look at your patch. I think the modifications to HTML and DocBook exporters are nice. It could be possible to do the same thing in LaTeX, but it would require yet another package (enumitem) by default. Anyway, here are the code comments : - in your patch, you should try to list modifications to the functions, and which functions were created. For example : * org-list.el (org-alphabetical-lists): new variable (org-cycle-list-bullet): added "A)" "a)" "A." and "a." to the list of bullets in cycle. None of them is allowed in a description list. - The "yes" at the beginning of org-docbook.el should be removed - I advise against using (org-next-item) programmatically. It means you compute the structure associated to the list for each item in the list. I left a note about this circa line 847 in org-list.el - There's a bug with the following situation : A) test B) tersi C) teirsu D) tersiu E) tesiu F) teisru G) etisu - sub-item 1 - sub-item 2 - sub-item 3 - sub-item 4 H) tesinu I) tesinru J) etnrsiu K) tesriun L) etnsiu M) estinu N) etsniu O) etsinu P) tesnu Q) etsinu R) etsiun S) etsnriu T) etsnriu U) etsinu V) etsiu W) etinrsu X) last item If you outdent sub-items 2 to 4 at the same time (with a region), bullet of the last item will become "AA)" and will not be recognized as a list item anymore. - There's also a bug with counters: * [0/0] Counter A. [X] first box B. [X] second box These boxes are not counted when bullets are literals (try C-c #). HTH, Regards, -- Nicolas ^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: Re: [PATCH] Alphabetical ordered lists 2010-12-20 18:25 ` Nicolas Goaziou @ 2011-01-12 20:05 ` Nathaniel Flath 0 siblings, 0 replies; 41+ messages in thread From: Nathaniel Flath @ 2011-01-12 20:05 UTC (permalink / raw) To: Nicolas Goaziou Cc: Bernt Hansen, Jacob Mitchell, org-mode List, Carsten Dominik [-- Attachment #1: Type: text/plain, Size: 2075 bytes --] Updated patch attached. Thanks, Nathaniel Flath On Mon, Dec 20, 2010 at 10:25 AM, Nicolas Goaziou <n.goaziou@gmail.com> wrote: > Hello, > >>>>>> Nathaniel Flath writes: > >> Sory for the long delay - I got caught up in other work. A >> patchaddressing the sisues brought up is attached. > > I've had a look at your patch. > > I think the modifications to HTML and DocBook exporters are nice. It > could be possible to do the same thing in LaTeX, but it would require > yet another package (enumitem) by default. Anyway, here are the code > comments : > > - in your patch, you should try to list modifications to the > functions, and which functions were created. For example : > > * org-list.el (org-alphabetical-lists): new variable > (org-cycle-list-bullet): added "A)" "a)" "A." and "a." to the list > of bullets in cycle. None of them is allowed in a description list. > > - The "yes" at the beginning of org-docbook.el should be removed > > - I advise against using (org-next-item) programmatically. It means > you compute the structure associated to the list for each item in > the list. I left a note about this circa line 847 in org-list.el > > - There's a bug with the following situation : > > A) test > B) tersi > C) teirsu > D) tersiu > E) tesiu > F) teisru > G) etisu > - sub-item 1 > - sub-item 2 > - sub-item 3 > - sub-item 4 > H) tesinu > I) tesinru > J) etnrsiu > K) tesriun > L) etnsiu > M) estinu > N) etsniu > O) etsinu > P) tesnu > Q) etsinu > R) etsiun > S) etsnriu > T) etsnriu > U) etsinu > V) etsiu > W) etinrsu > X) last item > > If you outdent sub-items 2 to 4 at the same time (with a region), > bullet of the last item will become "AA)" and will not be recognized > as a list item anymore. > > - There's also a bug with counters: > > * [0/0] Counter > > A. [X] first box > B. [X] second box > > These boxes are not counted when bullets are literals (try C-c #). > > > HTH, > > Regards, > > -- Nicolas > [-- Attachment #2: 0001-Added-support-for-alphabetical-patches-to-org-list.patch --] [-- Type: application/octet-stream, Size: 33155 bytes --] From 11a5b944d6475f150333502a15ede70ce71807af Mon Sep 17 00:00:00 2001 From: Nathaniel Flath <flat0103@gmail.com> Date: Wed, 12 Jan 2011 11:52:32 -0800 Subject: [PATCH] Added support for alphabetical patches to org-list. Support can be enabled with the 'org-alphabetical-lists' variable, and the numeration goes from 'a' to 'z'. The latex, html, and docbook exporters have been updated to use these. * org-capture.el: (org-capture-place-item): changed use of variable org-item-beginning-re to be a function call. * org-docbook.el: (org-export-as-docbook): changed to export alphabetical lists * org-exp.el: (org-export-mark-list-ending): changed variable use of org-item-beginning-re to be function call. * org-html.el: (org-export-as-html): changed to export alphabetical lists * org-latex.el: (org-export-latex-lists): changed variable use of org-item-beginning-re to be a function call. * org-list.el: org-alphabetical-lists: new variable to control whether to use alphabetical lists(defaults nil) (org-item-re): converted to use correct regex for alphabetical lists if enabled (org-item-beginning-re): converted from a variable to a function (org-list-in-item-p-with-indent), (org-toggle-checkbox),(org-list-in-item-p-with-regexp), (org-list-top-point-with-regexp), (org-list-struct), (org-list-get-item-same-level), (org-get-item-beginning), (org-end-of-item-or-at-child), (org-list-first-item-p), (org-list-indent-item-generic): converted use of org-item-beginning-re to a function (org-list-at-regexp-after-bullet-p), (org-update-checkbox-count), (org-list-parse-list), (org-list-insert-item-generic), org-list-struct-assoc-at-point), (org-list-struct-fix-bul): corrected regexp to allow for alphabetical lists (org-increment-string), (org--convert-alpha-str-to-num), (org-convert-num-toalpha-str): new functions used to increment a bullet in an alphabetical list (org-list-can-be-alphabetical): new function that returns 't' if a list can be alphabetical( <27 items) (org-list-bullet-inc-maybe): modified to support alphabetical bullets as well as numeric ones (org-cycle-list-bullet): modified to also cycle into both capital and lowercas alphabetical bullets, if possible --- lisp/org-capture.el | 4 +- lisp/org-docbook.el | 21 +++- lisp/org-exp.el | 2 +- lisp/org-html.el | 24 ++++-- lisp/org-latex.el | 2 +- lisp/org-list.el | 262 +++++++++++++++++++++++++++++++++------------------ 6 files changed, 208 insertions(+), 107 deletions(-) diff --git a/lisp/org-capture.el b/lisp/org-capture.el index a28c3b8..462f3c9 100644 --- a/lisp/org-capture.el +++ b/lisp/org-capture.el @@ -815,14 +815,14 @@ already gone. Any prefix argument will be passed to the refile comand." (if (org-capture-get :prepend) (progn (goto-char beg) - (if (org-search-forward-unenclosed org-item-beginning-re end t) + (if (org-search-forward-unenclosed (org-item-beginning-re) end t) (progn (goto-char (match-beginning 0)) (setq ind (org-get-indentation))) (goto-char end) (setq ind 0))) (goto-char end) - (if (org-search-backward-unenclosed org-item-beginning-re beg t) + (if (org-search-backward-unenclosed (org-item-beginning-re) beg t) (progn (setq ind (org-get-indentation)) (org-end-of-item)) diff --git a/lisp/org-docbook.el b/lisp/org-docbook.el index ed835b0..a636dba 100644 --- a/lisp/org-docbook.el +++ b/lisp/org-docbook.el @@ -1012,14 +1012,15 @@ publishing directory." ;; Normal lines (when (string-match (cond - ((eq llt t) "^\\([ \t]*\\)\\(\\([-+*] \\)\\|\\([0-9]+[.)]\\) \\)?\\( *[^ \t\n\r]\\|[ \t]*$\\)") - ((= llt ?.) "^\\([ \t]*\\)\\(\\([-+*] \\)\\|\\([0-9]+\\.\\) \\)?\\( *[^ \t\n\r]\\|[ \t]*$\\)") - ((= llt ?\)) "^\\([ \t]*\\)\\(\\([-+*] \\)\\|\\([0-9]+)\\) \\)?\\( *[^ \t\n\r]\\|[ \t]*$\\)") + ((eq llt t) "^\\([ \t]*\\)\\(\\([-+*] \\)\\|\\(\\(?:[0-9]+\\|[a-zA-Z]\\)[.)]\\) \\)?\\( *[^ \t\n\r]\\|[ \t]*$\\)") + ((= llt ?.) "^\\([ \t]*\\)\\(\\([-+*] \\)\\|\\(\\(?:[0-9]+\\|[a-zA-Z]\\)\\.\\) \\)?\\( *[^ \t\n\r]\\|[ \t]*$\\)") + ((= llt ?\)) "^\\([ \t]*\\)\\(\\([-+*] \\)\\|\\(\\(?:[0-9]+\\|[a-zA-Z]\\))\\) \\)?\\( *[^ \t\n\r]\\|[ \t]*$\\)") (t (error "Invalid value of `org-plain-list-ordered-item-terminator'"))) line) (setq ind (or (get-text-property 0 'original-indentation line) (org-get-string-indentation line)) item-type (if (match-beginning 4) "o" "u") + ordered-type (match-string 2 line) starter (if (match-beginning 2) (substring (match-string 2 line) 0 -1)) line (substring line (match-beginning 5)) @@ -1040,7 +1041,7 @@ publishing directory." (org-export-docbook-close-para-maybe) (insert (cond ((equal item-type "u") "<itemizedlist>\n<listitem>\n") - ((and (equal item-type "o") item-number) + ((equal item-type "o") ;; Check for a specific start number. If it ;; is specified, we use the ``override'' ;; attribute of element <listitem> to pass the @@ -1048,8 +1049,16 @@ publishing directory." ;; ``startingnumber'' attribute of element ;; <orderedlist>, but the former works on both ;; DocBook 5.0 and prior versions. - (format "<orderedlist>\n<listitem override=\"%s\">\n" item-number)) - ((equal item-type "o") "<orderedlist>\n<listitem>\n") + (progn + (concat "<orderedlist numeration=\"" + (cond + ((not starter) "arabic") + ((string-match "[0-9]+[.)]" ordered-type) "arabic") + ((string-match "[A-Z][.)]" ordered-type) "upperalpha") + ((string-match "[a-z][.)]" ordered-type) "loweralpha")) + "\">\n<listitem" + (if item-number (concat " override=\"" item-number "\">\n") + ">\n")))) ((equal item-type "d") (format "<variablelist>\n<varlistentry><term>%s</term><listitem>\n" item-tag)))) ;; For DocBook, we need to open a para right after tag diff --git a/lisp/org-exp.el b/lisp/org-exp.el index 3d466fa..680587b 100644 --- a/lisp/org-exp.el +++ b/lisp/org-exp.el @@ -1664,7 +1664,7 @@ These special cookies will later be interpreted by the backend. (let ((process-buffer (lambda (end-list-marker) (goto-char (point-min)) - (while (org-search-forward-unenclosed org-item-beginning-re nil t) + (while (org-search-forward-unenclosed (org-item-beginning-re) nil t) (goto-char (org-list-bottom-point)) (when (and (not (eq org-list-ending-method 'indent)) (looking-at (org-list-end-re))) diff --git a/lisp/org-html.el b/lisp/org-html.el index 312e716..be1d760 100644 --- a/lisp/org-html.el +++ b/lisp/org-html.el @@ -1553,20 +1553,21 @@ lang=\"%s\" xml:lang=\"%s\"> ;; Normal lines (when (string-match (cond - ((eq llt t) "^\\([ \t]*\\)\\(\\([-+*] \\)\\|\\([0-9]+[.)]\\) \\)?\\( *[^ \t\n\r]\\|[ \t]*$\\)") - ((= llt ?.) "^\\([ \t]*\\)\\(\\([-+*] \\)\\|\\([0-9]+\\.\\) \\)?\\( *[^ \t\n\r]\\|[ \t]*$\\)") - ((= llt ?\)) "^\\([ \t]*\\)\\(\\([-+*] \\)\\|\\([0-9]+)\\) \\)?\\( *[^ \t\n\r]\\|[ \t]*$\\)") + ((eq llt t) "^\\([ \t]*\\)\\(\\([-+*] \\)\\|\\(\\(?:[0-9]+\\|[a-zA-Z]\\)[.)]\\) \\)?\\( *[^ \t\n\r]\\|[ \t]*$\\)") + ((= llt ?.) "^\\([ \t]*\\)\\(\\([-+*] \\)\\|\\(\\(?:[0-9]+\\|[a-zA-Z]\\)\\.\\) \\)?\\( *[^ \t\n\r]\\|[ \t]*$\\)") + ((= llt ?\)) "^\\([ \t]*\\)\\(\\([-+*] \\)\\|\\(\\(?:[0-9]+\\|[a-zA-Z]\\))\\) \\)?\\( *[^ \t\n\r]\\|[ \t]*$\\)") (t (error "Invalid value of `org-plain-list-ordered-item-terminator'"))) line) (setq ind (or (get-text-property 0 'original-indentation line) (org-get-string-indentation line)) item-type (if (match-beginning 4) "o" "u") + ordered-type (match-string 2 line) starter (if (match-beginning 2) (substring (match-string 2 line) 0 -1)) line (substring line (match-beginning 5)) item-number nil item-tag nil) - (if (string-match "\\[@\\(?:start:\\)?\\([0-9]+\\)\\][ \t]?" line) + (if (string-match "\\[@\\(?:start:\\)?\\([0-9]+\\|[a-zA-Z]\\)\\][ \t]?" line) (setq item-number (match-string 1 line) line (replace-match "" t t line))) (if (and starter (string-match "\\(.*?\\) ::[ \t]*" line)) @@ -1581,9 +1582,18 @@ lang=\"%s\" xml:lang=\"%s\"> (org-close-par-maybe) (insert (cond ((equal item-type "u") "<ul>\n<li>\n") - ((and (equal item-type "o") item-number) - (format "<ol>\n<li value=\"%s\">\n" item-number)) - ((equal item-type "o") "<ol>\n<li>\n") + ((equal item-type "o") + (progn + (message ordered-type) + (concat "<ol type=\"" + (cond + ((not starter) "1") + ((string-match "[0-9]+[.)]" ordered-type) "1") + ((string-match "[A-Z][.)]" ordered-type) "A") + ((string-match "[a-z][.)]" ordered-type) "a")) + "\"><li" + (if item-number (concat" value=\"" item-number "\">\n") + ">\n")))) ((equal item-type "d") (format "<dl>\n<dt>%s</dt><dd>\n" item-tag)))) (push item-type local-list-type) diff --git a/lisp/org-latex.el b/lisp/org-latex.el index 4085d6e..58feede 100644 --- a/lisp/org-latex.el +++ b/lisp/org-latex.el @@ -2385,7 +2385,7 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER." "Convert plain text lists in current buffer into LaTeX lists." (let (res) (goto-char (point-min)) - (while (org-search-forward-unenclosed org-item-beginning-re nil t) + (while (org-search-forward-unenclosed (org-item-beginning-re) nil t) (beginning-of-line) (setq res (org-list-to-latex (org-list-parse-list t) org-export-latex-list-parameters)) diff --git a/lisp/org-list.el b/lisp/org-list.el index bc8e7bd..b4eb60d 100644 --- a/lisp/org-list.el +++ b/lisp/org-list.el @@ -221,16 +221,16 @@ indent when non-nil, indenting or outdenting list top-item insert when non-nil, trying to insert an item inside a block will insert it right before the block instead of throwing an error." - :group 'org-plain-lists - :type '(alist :tag "Sets of rules" - :key-type - (choice - (const :tag "Bullet" bullet) - (const :tag "Checkbox" checkbox) - (const :tag "Indent" indent) - (const :tag "Insert" insert)) - :value-type - (boolean :tag "Activate" :value t))) + :group 'org-plain-lists + :type '(alist :tag "Sets of rules" + :key-type + (choice + (const :tag "Bullet" bullet) + (const :tag "Checkbox" checkbox) + (const :tag "Indent" indent) + (const :tag "Insert" insert)) + :value-type + (boolean :tag "Activate" :value t))) (defcustom org-hierarchical-checkbox-statistics t "Non-nil means checkbox statistics counts only the state of direct children. @@ -240,6 +240,11 @@ with the word \"recursive\" in the value." :group 'org-plain-lists :type 'boolean) +(defcustom org-alphabetical-lists nil + "Non-nil means alphabetical lists are activated." + :group 'org-plain-lists + :type 'boolean) + (defcustom org-description-max-indent 20 "Maximum indentation for the second line of a description list. When the indentation would be larger than this, it will become @@ -288,16 +293,23 @@ It depends on `org-empty-line-terminates-plain-lists'." If GENERAL is non-nil, return the general regexp independent of the value of `org-plain-list-ordered-item-terminator'." (cond + ((and org-alphabetical-lists (or general (eq org-plain-list-ordered-item-terminator t))) + "\\([ \t]*\\([-+]\\|\\(\\([0-9]+\\|[A-Za-z]\\)[.)]\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)") + ((and org-alphabetical-lists (= org-plain-list-ordered-item-terminator ?.)) + "\\([ \t]*\\([-+]\\|\\(\\([0-9]+\\|[A-Za-z]\\)\\.\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)") + ((and org-alphabetical-lists (= org-plain-list-ordered-item-terminator ?\))) + "\\([ \t]*\\([-+]\\|\\(\\([0-9]+\\|[A-Za-z]\\))\\)\\)\\|[ \t]+\\*\\)\\([ \t]+\\|$\\)") ((or general (eq org-plain-list-ordered-item-terminator t)) - "\\([ \t]*\\([-+]\\|\\([0-9]+[.)]\\)\\)\\|[ \t]+\\*\\)\\([ \t]+\\|$\\)") + "\\([ \t]*\\([-+]\\|\\(\\([0-9]+\\)[.)]\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)") ((= org-plain-list-ordered-item-terminator ?.) - "\\([ \t]*\\([-+]\\|\\([0-9]+\\.\\)\\)\\|[ \t]+\\*\\)\\([ \t]+\\|$\\)") + "\\([ \t]*\\([-+]\\|\\(\\([0-9]+)\\.\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)") ((= org-plain-list-ordered-item-terminator ?\)) - "\\([ \t]*\\([-+]\\|\\([0-9]+)\\)\\)\\|[ \t]+\\*\\)\\([ \t]+\\|$\\)") + "\\([ \t]*\\([-+]\\|\\(\\([0-9]+\\))\\)\\)\\|[ \t]+\\*\\)\\([ \t]+\\|$\\)") (t (error "Invalid value of `org-plain-list-ordered-item-terminator'")))) -(defconst org-item-beginning-re (concat "^" (org-item-re)) - "Regexp matching the beginning of a plain list item.") +(defun org-item-beginning-re () + "Regexp matching the beginning of a plain list item." + (concat "^" (org-item-re))) (defun org-list-ending-between (min max &optional firstp) "Find the position of a list ending between MIN and MAX, or nil. @@ -327,11 +339,11 @@ stopping at LIMIT." (save-match-data (let ((case-fold-search t) (boundary (if (eq search 're-search-forward) 3 5))) - (when (save-excursion - (and (funcall search "^[ \t]*#\\+\\(begin\\|end\\)_" limit t) - (= (length (match-string 1)) boundary))) - ;; We're in a block: get out of it - (goto-char (match-beginning 0)))))) + (when (save-excursion + (and (funcall search "^[ \t]*#\\+\\(begin\\|end\\)_" limit t) + (= (length (match-string 1)) boundary))) + ;; We're in a block: get out of it + (goto-char (match-beginning 0)))))) (defun org-list-search-unenclosed-generic (search re bound noerr) "Search a string outside blocks and protected places. @@ -385,7 +397,7 @@ indented than the previous item within LIMIT." ;; Ensure there is at least an item above (up-item-p (save-excursion (org-search-backward-unenclosed - org-item-beginning-re limit t)))) + (org-item-beginning-re) limit t)))) (and up-item-p (catch 'exit (while t @@ -413,7 +425,7 @@ Argument LIMIT specifies the upper-bound of the search." ;; `org-item-re'. (last-item-start (save-excursion (org-search-backward-unenclosed - org-item-beginning-re limit t))) + (org-item-beginning-re) limit t))) (list-ender (org-list-ending-between last-item-start actual-pos))) ;; We are in a list when we are on an item line or when we can @@ -433,7 +445,7 @@ List ending is determined by regexp. See ;; Otherwise, go back to the heading above or bob. (goto-char (or (org-list-ending-between limit pos) limit)) ;; From there, search down our list. - (org-search-forward-unenclosed org-item-beginning-re pos t) + (org-search-forward-unenclosed (org-item-beginning-re) pos t) (point-at-bol)))) (defun org-list-bottom-point-with-regexp (limit) @@ -536,8 +548,8 @@ List ending is determined by the indentation of text. See (save-excursion (goto-char (match-end 0)) ;; Ignore counter if any - (when (looking-at "\\(?:\\[@\\(?:start:\\)?[0-9]+\\][ \t]*\\)?") - (goto-char (match-end 0))) + (when (looking-at "\\(?:\\[@\\(?:start:\\)?\\(?:[0-9]+\\|[A-Za-z]\\)\\][ \t]*\\)?") + (goto-char (match-end 0))) (looking-at regexp)))) (defun org-list-get-item-same-level (search-fun pos limit pre-move) @@ -551,7 +563,7 @@ uses PRE-MOVE before search. Return nil if no item was found." ;; We don't want to match the current line. (funcall pre-move) ;; Skip any sublist on the way - (while (and (funcall search-fun org-item-beginning-re limit t) + (while (and (funcall search-fun (org-item-beginning-re) limit t) (> (org-get-indentation) ind))) (when (and (/= (point-at-bol) start) ; Have we moved ? (= (org-get-indentation) ind)) @@ -612,7 +624,7 @@ function ends." (goto-char pos) ;; Is point in a special block? (when (org-in-regexps-block-p - "^[ \t]*#\\+\\(begin\\|BEGIN\\)_\\([a-zA-Z0-9_]+\\)" + "^[ \t]*#\\+\\(begin\\|BEGIN\\)_\\(\\(?:[a-zA-Z]\\|[0-9_]+\\)\\)" '(concat "^[ \t]*#\\+\\(end\\|END\\)_" (match-string 2))) (if (not (cdr (assq 'insert org-list-automatic-rules))) ;; Rule in `org-list-automatic-rules' forbids insertion. @@ -655,9 +667,9 @@ function ends." (org-list-exchange-items (org-get-item-beginning) (org-get-next-item (point) bottom) bottom) - ;; recompute next-item: last sexp modified list - (goto-char (org-get-next-item (point) bottom)) - (org-move-to-column col))) + ;; recompute next-item: last sexp modified list + (goto-char (org-get-next-item (point) bottom)) + (org-move-to-column col))) ;; checkbox update might modify bottom point, so use a ;; marker here (setq bottom (copy-marker bottom)) @@ -710,7 +722,7 @@ Return t if successful." (cond ((and regionp (goto-char rbeg) - (not (org-search-forward-unenclosed org-item-beginning-re rend t))) + (not (org-search-forward-unenclosed (org-item-beginning-re) rend t))) (error "No item in region")) ((not (org-at-item-p)) (error "Not on an item")) @@ -808,13 +820,13 @@ TOP is the position of list's top-item." (save-excursion (beginning-of-line) (let ((ind (org-get-indentation))) - (or (not (org-search-backward-unenclosed org-item-beginning-re top t)) + (or (not (org-search-backward-unenclosed (org-item-beginning-re) top t)) (< (org-get-indentation) ind))))) (defun org-at-item-p () "Is point in a line starting a hand-formatted item?" (save-excursion - (beginning-of-line) (looking-at org-item-beginning-re))) + (beginning-of-line) (looking-at (org-item-beginning-re)))) (defun org-at-item-bullet-p () "Is point at the bullet of a plain list item?" @@ -913,7 +925,7 @@ Assume point is in a list." (save-excursion ;; possibly match current line (end-of-line) - (org-search-backward-unenclosed org-item-beginning-re nil t) + (org-search-backward-unenclosed (org-item-beginning-re) nil t) (point-at-bol))) (defun org-beginning-of-item () @@ -949,7 +961,7 @@ BOTTOM is the position at list ending." (let ((ind (org-get-indentation))) (while (and (/= (point) bottom) (>= (org-get-indentation) ind)) - (org-search-forward-unenclosed org-item-beginning-re bottom 'move)) + (org-search-forward-unenclosed (org-item-beginning-re) bottom 'move)) (if (= (point) bottom) bottom (point-at-bol))))) (defun org-end-of-item-list () @@ -979,7 +991,7 @@ If the cursor is not in an item, throw an error." BOTTOM is the position at list ending." (end-of-line) (goto-char - (if (org-search-forward-unenclosed org-item-beginning-re bottom t) + (if (org-search-forward-unenclosed (org-item-beginning-re) bottom t) (point-at-bol) (org-get-end-of-item bottom)))) @@ -1141,11 +1153,11 @@ bullet string and bullet counter, if any." (list (point-at-bol) (org-get-indentation) (progn - (looking-at "^[ \t]*\\([-+*0-9.)]+[ \t]+\\)") + (looking-at "^[ \t]*\\([-+*0-9A-Za-z.)]+[ \t]+\\)") (match-string 1)) (progn (goto-char (match-end 0)) - (and (looking-at "\\[@\\(?:start:\\)?\\([0-9]+\\)\\]") + (and (looking-at "\\[@\\(?:start:\\)?\\(\\(?:[0-9]+\\|[A-Za-z]\\)\\)\\]") (match-string 1)))))) (defun org-list-struct (begin end top bottom &optional outdent) @@ -1174,7 +1186,7 @@ change is an outdent." (goto-char begin) ;; Find beginning of most outdented list (min list) (while (and (org-search-backward-unenclosed - org-item-beginning-re top t) + (org-item-beginning-re) top t) (>= (org-get-indentation) ind-min)) (setq pre-list (cons (org-list-struct-assoc-at-point) pre-list))) @@ -1188,7 +1200,7 @@ change is an outdent." (goto-char end) (end-of-line) (while (and (org-search-forward-unenclosed - org-item-beginning-re bottom 'move) + (org-item-beginning-re) bottom 'move) (>= (org-get-indentation) ind-min)) (setq post-list (cons (org-list-struct-assoc-at-point) post-list))) @@ -1197,13 +1209,13 @@ change is an outdent." (when (and (= (caar pre-list) 0) (< (point) bottom)) (beginning-of-line) (while (org-search-forward-unenclosed - org-item-beginning-re bottom t) + (org-item-beginning-re) bottom t) (setq post-list (cons (org-list-struct-assoc-at-point) post-list)))) (append pre-list struct (reverse post-list)))))) ;; Here we start: first get the core zone... (goto-char end) - (while (org-search-backward-unenclosed org-item-beginning-re begin t) + (while (org-search-backward-unenclosed (org-item-beginning-re) begin t) (setq struct (cons (org-list-struct-assoc-at-point) struct))) ;; ... then, extend it to make it a structure... (let ((extended (funcall extend struct))) @@ -1247,7 +1259,7 @@ STRUCT is the list's structure looked up." "Return parent association of ITEM in STRUCT or nil. ORIGINS is the alist of parents. See `org-list-struct-origins'." (let* ((parent-pos (cdr (assq (car item) origins)))) - (when (> parent-pos 0) (assq parent-pos struct)))) + (when (and parent-pos (> parent-pos 0)) (assq parent-pos struct)))) (defun org-list-struct-get-child (item struct) "Return child association of ITEM in STRUCT or nil." @@ -1260,21 +1272,27 @@ ORIGINS is the alist of parents. See `org-list-struct-origins'." ORIGINS is the alist of parents. See `org-list-struct-origins'. This function modifies STRUCT." + (let* (acc (init-bul (lambda (item) (let ((counter (nth 3 item)) (bullet (org-list-bullet-string (nth 2 item)))) (cond - ((and (string-match "[0-9]+" bullet) counter) + ((and (string-match "[0-9]+\\|[A-Za-z]" bullet) counter) (replace-match counter nil nil bullet)) ((string-match "[0-9]+" bullet) (replace-match "1" nil nil bullet)) + ((and (org-list-can-be-alphabetical origins) + (string-match "[A-Za-z]" bullet)) + (replace-match "a" nil nil bullet)) + ((string-match "[A-Za-z]" bullet) + (replace-match "1" nil nil bullet)) (t bullet))))) (set-bul (lambda (item bullet) (setcdr item (list (nth 1 item) bullet (nth 3 item))))) (get-bul (lambda (item bullet) (let* ((counter (nth 3 item))) - (if (and counter (string-match "[0-9]+" bullet)) + (if (and counter (string-match "[0-9]+\\|[A-Za-z]" bullet)) (replace-match counter nil nil bullet) bullet)))) (fix-bul @@ -1588,13 +1606,60 @@ It determines the number of whitespaces to append by looking at " "))) nil nil bullet 1))) +(defun org-increment-string (str cap) + "Increments str (a->a, b->b, z->aa, aa->ab etc). If cap is non-nil, then + the letters are capitalized." + (let ((res (org-convert-num-to-alpha-str + (1+ (org-convert-alpha-str-to-num str 1 (length str) cap)) cap)) + (z (if cap ?Z ?z)) + (b (if cap ?B ?b)) + (a (if cap ?A ?a))) + (if (and(= (string-to-char str) z) + (= (string-to-char res) b)) + (concat (if cap "A" "a") (substring res 1)) + (concat (make-string (- (length str) (length res)) a) res)))) + +(defun org-convert-alpha-str-to-num (str n pos cap) + "Converts the substring consisting of locations pos to pos-n to a + numeric representation." + (let ((a (if cap ?A ?a))) + (if (= pos 1) (* (- (string-to-char str) a) n) + (+ (* (- (nth (1- pos) (string-to-list str)) a) n) + (org-convert-alpha-str-to-num str (* 26 n) (1- pos) cap))))) + +(defun org-convert-num-to-alpha-str (n cap) + "Converts the number n to a alphabetical, base-26 representation." + (if (= n 0) "" + (concat (org-convert-num-to-alpha-str (/ n 26) cap) + (string (+ (if cap ?A ?a) (% n 26)))))) + +(defun org-list-can-be-alphabetical (origins) + "Returns t if the list has only 26 elements." + (let ((retn 1) + (tmp origins)) + (while (and (cdr tmp) (< retn 28)) + (when (= 0 (cdr (car tmp))) + (setq retn (1+ retn))) + (setq tmp (cdr tmp))) + (< retn 28))) + (defun org-list-inc-bullet-maybe (bullet) "Increment BULLET if applicable." - (if (string-match "[0-9]+" bullet) + (let ((case-fold-search nil)) + (cond + ((string-match "[0-9]+" bullet) (replace-match (number-to-string (1+ (string-to-number (match-string 0 bullet)))) - nil nil bullet) - bullet)) + nil nil bullet)) + ((string-match "[a-z]" bullet) + (replace-match + (org-increment-string (match-string 0 bullet) nil) + nil nil bullet)) + ((string-match "[A-Z]" bullet) + (replace-match + (org-increment-string (match-string 0 bullet) t) + nil nil bullet)) + (t bullet)))) (defun org-list-repair (&optional force-bullet top bottom) "Make sure all items are correctly indented, with the right bullet. @@ -1635,36 +1700,52 @@ If WHICH is a valid string, use that as the new bullet. If WHICH is an integer, 0 means `-', 1 means `+' etc. If WHICH is 'previous, cycle backwards." (interactive "P") - (save-excursion - (let* ((top (org-list-top-point)) - (bullet (progn - (goto-char (org-get-beginning-of-list top)) - (org-get-bullet))) - (current (cond - ((string-match "\\." bullet) "1.") - ((string-match ")" bullet) "1)") - (t bullet))) - (bullet-rule-p (cdr (assq 'bullet org-list-automatic-rules))) - (bullet-list (append '("-" "+" ) - ;; *-bullets are not allowed at column 0 - (unless (and bullet-rule-p - (looking-at "\\S-")) '("*")) - ;; Description items cannot be numbered - (unless (and bullet-rule-p - (or (eq org-plain-list-ordered-item-terminator ?\)) - (org-at-item-description-p))) '("1.")) - (unless (and bullet-rule-p - (or (eq org-plain-list-ordered-item-terminator ?.) - (org-at-item-description-p))) '("1)")))) - (len (length bullet-list)) - (item-index (- len (length (member current bullet-list)))) - (get-value (lambda (index) (nth (mod index len) bullet-list))) - (new (cond - ((member which bullet-list) which) - ((numberp which) (funcall get-value which)) - ((eq 'previous which) (funcall get-value (1- item-index))) - (t (funcall get-value (1+ item-index)))))) - (org-list-repair new top)))) + (let* ((top (org-list-top-point)) + (list (progn (save-excursion (goto-char top) (org-list-parse-list)))) + (alpha-possible (org-list-can-be-alphabetical (org-list-struct-origins list))) + (bullet (save-excursion + (goto-char (org-get-beginning-of-list top)) + (org-get-bullet))) + (current (let ((case-fold-search nil)) + (cond + ((string-match "[0-9]+\\." bullet) "1.") + ((string-match "[0-9]+)" bullet) "1)") + ((string-match "[a-z]\\." bullet) "a.") + ((string-match "[a-z])" bullet) "a)") + ((string-match "[A-Z]\\." bullet) "A.") + ((string-match "[A-Z])" bullet) "A)") + (t bullet)))) + (bullet-rule-p (cdr (assq 'bullet org-list-automatic-rules))) + (bullet-list (append '("-" "+" ) + ;; *-bullets are not allowed at column 0 + (unless (and bullet-rule-p + (looking-at "\\S-")) '("*")) + ;; Description items cannot be numbered + (unless (and bullet-rule-p + (or (eq org-plain-list-ordered-item-terminator ?.) + (org-at-item-description-p))) '("1)")) + (unless (and bullet-rule-p + (or (eq org-plain-list-ordered-item-terminator ?\)) + (org-at-item-description-p))) '("1.")) + (when (and org-alphabetical-lists alpha-possible) + (append + (unless (and bullet-rule-p + (or (eq org-plain-list-ordered-item-terminator ?.) + (org-at-item-description-p))) + '("A)" "a)")) + (unless (and bullet-rule-p + (or (eq org-plain-list-ordered-item-terminator ?\)) + (org-at-item-description-p))) + '("A." "a.")))))) + (len (length bullet-list)) + (item-index (- len (length (member current bullet-list)))) + (get-value (lambda (index) (nth (mod index len) bullet-list))) + (new (cond + ((member which bullet-list) which) + ((numberp which) (funcall get-value which)) + ((eq 'previous which) (funcall get-value (1- item-index))) + (t (funcall get-value (1+ item-index)))))) + (org-list-repair new top))) ;;; Checkboxes @@ -1691,7 +1772,7 @@ in subtree, ignoring drawers." (rend (region-end))) (save-excursion (goto-char rbeg) - (if (org-search-forward-unenclosed org-item-beginning-re rend 'move) + (if (org-search-forward-unenclosed (org-item-beginning-re) rend 'move) (list (point-at-bol) rend nil) (error "No item in region"))))) ((org-on-heading-p) @@ -1703,7 +1784,7 @@ in subtree, ignoring drawers." (goto-char limit) (org-search-backward-unenclosed ":END:" pos 'move) (org-search-forward-unenclosed - org-item-beginning-re limit 'move) + (org-item-beginning-re) limit 'move) (list (point) limit nil)))) ((org-at-item-p) (list (point-at-bol) (1+ (point-at-eol)) t)) @@ -1751,7 +1832,7 @@ in subtree, ignoring drawers." (goto-char beg) (while (< (point) end) (funcall act-on-item ref-presence ref-status) - (org-search-forward-unenclosed org-item-beginning-re end 'move))) + (org-search-forward-unenclosed (org-item-beginning-re) end 'move))) (org-update-checkbox-count-maybe))) (defun org-reset-checkbox-state-subtree () @@ -1782,6 +1863,7 @@ information.") (org-update-checkbox-count)) (run-hooks 'org-checkbox-statistics-hook)) + (defun org-update-checkbox-count (&optional all) "Update the checkbox statistics in the current section. This will find all statistic cookies like [57%] and [6/12] and update them @@ -1798,8 +1880,8 @@ the whole buffer." (error (point-min)))) (end (copy-marker (save-excursion (outline-next-heading) (point)))) - (re-cookie "\\(\\(\\[[0-9]*%\\]\\)\\|\\(\\[[0-9]*/[0-9]*\\]\\)\\)") - (re-box "^[ \t]*\\([-+*]\\|[0-9]+[.)]\\)[ \t]+\\(?:\\[@\\(?:start:\\)?[0-9]+\\][ \t]*\\)?\\(\\[[- X]\\]\\)") + (re-cookie "\\(\\(\\[0-9]*%\\]\\)\\|\\(\\[[0-9]*/[0-9]*\\]\\)\\)") + (re-box "^[ \t]*\\([-+*]\\|\\(?:[0-9]+\\|[A-Za-z]\\)[.)]\\)[ \t]+\\(?:\\[@\\(?:start:\\)?\\(?:[0-9]+\\|[A-Za-z]\\)\\][ \t]*\\)?\\(\\[[- X]\\]\\)") beg-cookie end-cookie is-percent c-on c-off lim new curr-ind next-ind continue-from startsearch list-beg list-end (recursive @@ -1860,7 +1942,7 @@ the whole buffer." (goto-char (or (org-get-next-item (point) lim) lim)) (end-of-line) (when (org-search-forward-unenclosed - org-item-beginning-re lim t) + (org-item-beginning-re) lim t) (beginning-of-line))) (setq next-ind (org-get-indentation))))) (goto-char continue-from) @@ -1886,8 +1968,8 @@ the whole buffer." (goto-char continue-from))) (unless (and all (outline-next-heading)) (throw 'exit nil)))) (when (interactive-p) - (message "Checkbox statistics updated %s (%d places)" - (if all "in entire file" "in current outline entry") cstat))))) + (message "Checkbox statistics updated %s (%d places)" + (if all "in entire file" "in current outline entry") cstat))))) (defun org-get-checkbox-statistics-face () "Select the face for checkbox statistics. @@ -2033,10 +2115,10 @@ sublevels as a list of strings." (let* ((start (goto-char (org-list-top-point))) (end (org-list-bottom-point)) output itemsep ltype) - (while (org-search-forward-unenclosed org-item-beginning-re end t) + (while (org-search-forward-unenclosed (org-item-beginning-re) end t) (save-excursion (beginning-of-line) - (setq ltype (cond ((org-looking-at-p "^[ \t]*[0-9]") 'ordered) + (setq ltype (cond ((org-looking-at-p "^[ \t]*\\([0-9]+\\|[A-Za-z]\\)") 'ordered) ((org-at-item-description-p) 'descriptive) (t 'unordered)))) (let* ((indent1 (org-get-indentation)) @@ -2045,7 +2127,7 @@ sublevels as a list of strings." (org-end-of-item-or-at-child end)))) (nextindent (if (= (point) end) 0 (org-get-indentation))) (item (if (string-match - "^\\(?:\\[@\\(?:start:\\)?[0-9]+\\][ \t]*\\)?\\[\\([xX ]\\)\\]" + "^\\(?:\\[@\\(?:start:\\)?\\(?:[0-9]+\\|[A-Za-z]\\)\\][ \t]*\\)?\\[\\([xX ]\\)\\]" item) (replace-match (if (equal (match-string 1 item) " ") "CBOFF" @@ -2130,7 +2212,7 @@ this list." (top-point (progn (re-search-backward "#\\+ORGLST" nil t) - (re-search-forward org-item-beginning-re bottom-point t) + (re-search-forward (org-item-beginning-re) bottom-point t) (match-beginning 0))) (list (save-restriction (narrow-to-region top-point bottom-point) -- 1.7.2.3.msysgit.0 [-- Attachment #3: Type: text/plain, Size: 201 bytes --] _______________________________________________ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode ^ permalink raw reply related [flat|nested] 41+ messages in thread
end of thread, other threads:[~2011-01-12 20:05 UTC | newest] Thread overview: 41+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2010-07-29 20:27 [PATCH] Alphabetical ordered lists Nathaniel Flath 2010-07-29 21:07 ` Nick Dokos 2010-08-01 18:33 ` David Maus 2010-08-02 9:31 ` Nicolas Goaziou 2010-08-27 8:11 ` Carsten Dominik 2010-08-27 10:53 ` Bernt Hansen 2010-08-27 12:44 ` Jacob Mitchell 2010-08-27 13:01 ` Nathaniel Flath 2010-09-18 7:43 ` Nathaniel Flath 2010-09-21 12:48 ` Carsten Dominik 2010-09-21 16:46 ` Nicolas Goaziou 2010-09-26 17:36 ` Nicolas Goaziou 2010-09-26 22:16 ` Nathaniel Flath 2010-09-27 6:55 ` Nicolas Goaziou 2010-09-28 16:12 ` Carsten Dominik 2010-09-29 15:49 ` Carsten Dominik 2010-09-29 16:50 ` Nathaniel Flath 2010-09-29 17:46 ` Nicolas Goaziou 2010-10-01 1:13 ` Nathaniel Flath 2010-10-04 8:33 ` Carsten Dominik 2010-10-04 17:18 ` Nicolas Goaziou 2010-10-05 0:07 ` Sebastian Rose 2010-10-05 0:21 ` Nathaniel Flath 2010-10-05 7:40 ` Carsten Dominik 2010-10-21 4:44 ` Nathaniel Flath 2010-10-22 5:30 ` Nathaniel Flath 2010-10-22 8:13 ` Carsten Dominik 2010-10-23 1:04 ` Nathaniel Flath 2010-10-26 8:21 ` Nicolas Goaziou 2010-10-26 8:23 ` Carsten Dominik 2010-10-28 7:17 ` Nathaniel Flath 2010-11-11 7:16 ` Nathaniel Flath 2010-11-11 8:57 ` Nicolas Goaziou 2010-11-13 15:16 ` Nicolas Goaziou 2010-11-22 4:45 ` Nathaniel Flath 2010-11-22 13:37 ` Bernt Hansen 2010-11-22 18:37 ` Nicolas Goaziou 2010-11-27 4:39 ` Nathaniel Flath 2010-12-11 2:41 ` Nathaniel Flath 2010-12-20 18:25 ` Nicolas Goaziou 2011-01-12 20:05 ` Nathaniel Flath
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).