all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [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

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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.