summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <n.goaziou@gmail.com>2010-07-20 12:36:01 +0200
committerNicolas Goaziou <n.goaziou@gmail.com>2010-09-01 19:05:49 +0200
commit0bac5c248bccbb2179c6ae2704ef85b3387ac477 (patch)
treed33fa6afd6c7bd9df28724a665d35c766a2af0f8
parent3a084384f4f83e32cb4d16d67ee0b98624248535 (diff)
downloadorg-mode-0bac5c248bccbb2179c6ae2704ef85b3387ac477.tar.gz
Forgot to handle 'previous argument in `org-cycle-list-bullet'.
* org-list.el (org-cycle-list-bullet): Put back support for 'previous argument.
-rw-r--r--lisp/org-list.el15
1 files changed, 8 insertions, 7 deletions
diff --git a/lisp/org-list.el b/lisp/org-list.el
index c0c7767..7abc415 100644
--- a/lisp/org-list.el
+++ b/lisp/org-list.el
@@ -975,12 +975,13 @@ doing the renumbering."
(defun org-cycle-list-bullet (&optional which)
"Cycle through the different itemize/enumerate bullets.
-This cycle the entire list level through nnthe sequence:
+This cycle the entire list level through the sequence:
`-' -> `+' -> `*' -> `1.' -> `1)'
If WHICH is a valid string, use that as the new bullet. If WHICH
-is an integer, 0 means `-', 1 means `+' etc."
+is an integer, 0 means `-', 1 means `+' etc. If WHICH is
+'previous, cycle backwards."
(interactive "P")
(org-preserve-lc
(let* ((bullet (progn (org-beginning-of-item-list)
@@ -994,13 +995,13 @@ is an integer, 0 means `-', 1 means `+' etc."
(unless (looking-at "\\S-") '("*"))
;; Description items cannot be numbered
(unless (org-at-description-p) '("1." "1)"))))
- (item-pos (member current bullet-list))
+ (len (length bullet-list))
+ (item-pos (or (and (numberp which) which)
+ (- len (length (member current bullet-list)))))
(new (cond
- ((and (numberp which)
- (nth (mod which (length bullet-list)) bullet-list)))
((member which bullet-list) which)
- ((and item-pos (cdr item-pos)) (cadr item-pos))
- (t "-"))))
+ ((eq 'previous which) (nth (mod (1- item-pos) len) bullet-list))
+ (t (nth (mod (1+ item-pos) len) bullet-list)))))
(org-fix-bullet-type new))))
;;; Checkboxes