+(defvar org-tab-ind-state) ; defined in org.el
+(defun org-cycle-item-indentation ()
+ (let ((org-suppress-item-indentation t)
+ (org-adapt-indentation nil))
+ (cond
+ ((and (looking-at "[ \t]*$")
+ (looking-back "^\\([ \t]*\\)\\([-+*]\\|[0-9]+[).]\\)[ \t]+"))
+ (setq this-command 'org-cycle-item-indentation)
+ (if (eq last-command 'org-cycle-item-indentation)
+ (condition-case nil
+ (progn (org-outdent-item 1)
+ (if (equal org-tab-ind-state (org-get-indentation))
+ (org-outdent-item 1))
+ (end-of-line 1))
+ (error
+ (progn
+ (while (< (org-get-indentation) org-tab-ind-state)
+ (progn (org-indent-item 1) (end-of-line 1)))
+ (setq this-command 'org-cycle))))
+ (setq org-tab-ind-state (org-get-indentation))
+ (org-indent-item 1))
+ t))))
+