[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/orgalist 5b459eb 3/3: Also indent line right after the
From: |
Nicolas Goaziou |
Subject: |
[elpa] externals/orgalist 5b459eb 3/3: Also indent line right after the list |
Date: |
Fri, 4 May 2018 13:44:44 -0400 (EDT) |
branch: externals/orgalist
commit 5b459eb113d1e16a75983ed0e3308b41fc7e8978
Author: Nicolas Goaziou <address@hidden>
Commit: Nicolas Goaziou <address@hidden>
Also indent line right after the list
(orgalist--indent-line): Indent line right after the list.
---
orgalist.el | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/orgalist.el b/orgalist.el
index 789237e..2d5e531 100644
--- a/orgalist.el
+++ b/orgalist.el
@@ -546,7 +546,24 @@ This function is meant to be used as a piece of advice on
(goto-char (match-end 1))
(skip-chars-backward " \t")
(1+ (current-column)))))
- ;; Preserve current column.
+ (if (<= (current-column) (current-indentation))
+ (indent-line-to column)
+ (save-excursion (indent-line-to column)))
+ t))))
+ ;; Right after a list, indent like the first item in the list.
+ ((let ((struct? (save-excursion
+ (and (= 0 (forward-line -1))
+ (looking-at-p "[ \t]*$")
+ (progn
+ (skip-chars-backward " \r\t\n")
+ (let ((item? (orgalist--in-item-p)))
+ (and item?
+ (goto-char item?)
+ (orgalist--struct))))))))
+ (and struct?
+ (let ((column (save-excursion
+ (goto-char (org-list-get-top-point struct?))
+ (current-indentation))))
(if (<= (current-column) (current-indentation))
(indent-line-to column)
(save-excursion (indent-line-to column)))