[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/orgalist 75e33f5 1/2: orgalist: Only cycle indentation
From: |
Nicolas Goaziou |
Subject: |
[elpa] externals/orgalist 75e33f5 1/2: orgalist: Only cycle indentation on empty items |
Date: |
Mon, 30 Apr 2018 15:46:52 -0400 (EDT) |
branch: externals/orgalist
commit 75e33f580680693f48046a98082d279639f86755
Author: Nicolas Goaziou <address@hidden>
Commit: Nicolas Goaziou <address@hidden>
orgalist: Only cycle indentation on empty items
* orgalist.el (orgalist--while-at-empty-item): New function.
(orgalist--maybe-cycle-indentation): Use new function.
Elsewhere, fallback to standard TAB behavior.
---
orgalist.el | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/orgalist.el b/orgalist.el
index ee24bec..d9b4464 100644
--- a/orgalist.el
+++ b/orgalist.el
@@ -499,6 +499,16 @@ can periodically check changes to variable
‘auto-fill-function’."
"Return CMD when point is at a list item."
(when (orgalist--at-item-p) cmd))
+(defun orgalist--while-at-empty-item (cmd)
+ "Return CMD when point is at a list item."
+ (when (and (orgalist--at-item-p)
+ (save-excursion
+ (beginning-of-line)
+ (re-search-forward orgalist--item-re)
+ (skip-chars-forward " \t")
+ (eolp)))
+ cmd))
+
(defun orgalist--while-in-item (cmd)
"Return CMD when point is in a list item."
(when (orgalist--in-item-p) cmd))
@@ -540,7 +550,8 @@ can periodically check changes to variable
‘auto-fill-function’."
'(menu-item "" orgalist-cycle-bullet :filter orgalist--while-at-item))
(defconst orgalist--maybe-cycle-indentation
- '(menu-item "" orgalist-cycle-indentation :filter orgalist--while-at-item))
+ '(menu-item "" orgalist-cycle-indentation
+ :filter orgalist--while-at-empty-item))
(defconst orgalist--maybe-check
'(menu-item "" orgalist-check-item :filter orgalist--while-at-item))