lang/org: preserve indent on new item (M-RET)
This commit is contained in:
parent
6c3c40e41e
commit
d52ee9c3be
1 changed files with 6 additions and 3 deletions
|
@ -70,14 +70,17 @@ wrong places)."
|
||||||
t))
|
t))
|
||||||
(type (org-element-type context)))
|
(type (org-element-type context)))
|
||||||
(cond ((eq type 'item)
|
(cond ((eq type 'item)
|
||||||
(let ((marker (org-element-property :bullet context)))
|
(let ((marker (org-element-property :bullet context))
|
||||||
|
(pad (save-excursion
|
||||||
|
(back-to-indentation)
|
||||||
|
(- (point) (line-beginning-position)))))
|
||||||
(pcase direction
|
(pcase direction
|
||||||
('below
|
('below
|
||||||
(goto-char (line-end-position))
|
(goto-char (line-end-position))
|
||||||
(insert (concat "\n" marker)))
|
(insert (concat "\n" (make-string pad ? ) marker)))
|
||||||
('above
|
('above
|
||||||
(goto-char (line-beginning-position))
|
(goto-char (line-beginning-position))
|
||||||
(insert marker)
|
(insert (make-string pad ? ) marker)
|
||||||
(save-excursion (insert "\n")))))
|
(save-excursion (insert "\n")))))
|
||||||
(when (org-element-property :checkbox context)
|
(when (org-element-property :checkbox context)
|
||||||
(insert "[ ] ")))
|
(insert "[ ] ")))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue