emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nathaniel Flath <flat0103@gmail.com>
To: emacs-orgmode@gnu.org
Subject: [PATCH] Alphabetical ordered lists
Date: Thu, 29 Jul 2010 15:27:46 -0500	[thread overview]
Message-ID: <AANLkTimGVyxJfkxdBWOTipo_PD3mfHHsEL_mMX2jgmb9@mail.gmail.com> (raw)

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

             reply	other threads:[~2010-07-29 20:30 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-29 20:27 Nathaniel Flath [this message]
2010-07-29 21:07 ` [PATCH] Alphabetical ordered lists 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AANLkTimGVyxJfkxdBWOTipo_PD3mfHHsEL_mMX2jgmb9@mail.gmail.com \
    --to=flat0103@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).