emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: David Maus <dmaus@ictsoc.de>
To: nicholas.dokos@hp.com
Cc: emacs-orgmode@gnu.org
Subject: Re: [PATCH] Alphabetical ordered lists
Date: Sun, 01 Aug 2010 20:33:53 +0200	[thread overview]
Message-ID: <87zkx6dvxq.wl%dmaus@ictsoc.de> (raw)
In-Reply-To: <14514.1280437636@alphaville.usa.hp.com>


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

  reply	other threads:[~2010-08-01 18:34 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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=87zkx6dvxq.wl%dmaus@ictsoc.de \
    --to=dmaus@ictsoc.de \
    --cc=emacs-orgmode@gnu.org \
    --cc=nicholas.dokos@hp.com \
    /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).