summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <n.goaziou@gmail.com>2010-07-19 12:39:06 +0200
committerNicolas Goaziou <n.goaziou@gmail.com>2010-09-01 19:05:48 +0200
commit85868125c240b4fe6095c767fdd6cf51dccfdd34 (patch)
tree61e3502e73c180a78381c4d021dd30cab1f62c68
parent8597bb25ee4baecf99d355ab382a2021c8877278 (diff)
downloadorg-mode-85868125c240b4fe6095c767fdd6cf51dccfdd34.tar.gz
Fix cycling indentation.
-rw-r--r--lisp/org-list.el20
1 files changed, 10 insertions, 10 deletions
diff --git a/lisp/org-list.el b/lisp/org-list.el
index 7b2adb8..6345e77 100644
--- a/lisp/org-list.el
+++ b/lisp/org-list.el
@@ -731,16 +731,14 @@ invisible."
(unless (org-bound-and-true-p org-suppress-item-indentation)
(save-excursion
(let ((beg (point-at-bol))
- (end (progn (org-end-of-item) (point)))
- i)
- (goto-char end)
+ (end (org-end-of-item)))
(beginning-of-line 0)
(while (> (point) beg)
(when (looking-at "[ \t]*\\S-")
;; this is not an empty line
- (setq i (org-get-indentation))
- (if (and (> i 0) (> (setq i (+ i delta)) 0))
- (indent-line-to i)))
+ (let ((i (org-get-indentation)))
+ (when (and (> i 0) (> (+ i delta) 0))
+ (indent-line-to (+ i delta)))))
(beginning-of-line 0))))))
@@ -795,10 +793,12 @@ If NO-SUBTREE is set, only indent the item itself, not its children."
delta (if (> arg 0)
(if ind-down (- ind-down ind) 2)
(if ind-up (- ind-up ind) -2)))
- (if (and (< (+ delta ind) origin-ind)
- ;; verify we're not at the top level item
- (/= (point-at-bol) (org-list-top-point)))
- (error "Cannot outdent beyond top level item"))
+ (cond
+ ((< (+ delta ind) 0) (error "Cannot outdent beyond margin"))
+ ((and (< (+ delta ind) origin-ind)
+ ;; verify we're not at the top level item
+ (/= (point-at-bol) (org-list-top-point)))
+ (error "Cannot outdent beyond top level item")))
(while (< (point) end)
(beginning-of-line)
(skip-chars-forward " \t") (setq ind1 (current-column))