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 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 > wrote: >> >> >> On Fri, Aug 27, 2010 at 6:53 AM, Bernt Hansen wrote: >>> >>> Carsten Dominik 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 >> >> >