Fix wrong-type-argument error from +org/insert-item
+org/insert-item would throw "save-excursion: Wrong type argument: listp, 1" when used from BOL on the first sub-item in a list.
This commit is contained in:
parent
c7957c9321
commit
23404980ac
1 changed files with 6 additions and 8 deletions
|
@ -146,7 +146,7 @@ wrong places)."
|
||||||
'(table table-row headline inlinetask item plain-list)
|
'(table table-row headline inlinetask item plain-list)
|
||||||
t))
|
t))
|
||||||
(type (org-element-type context)))
|
(type (org-element-type context)))
|
||||||
(cond ((eq type 'item)
|
(cond ((memq type '(item plain-list))
|
||||||
(let ((marker (org-element-property :bullet context))
|
(let ((marker (org-element-property :bullet context))
|
||||||
(pad (save-excursion
|
(pad (save-excursion
|
||||||
(back-to-indentation)
|
(back-to-indentation)
|
||||||
|
@ -157,7 +157,7 @@ wrong places)."
|
||||||
(insert (concat "\n" (make-string pad ? ) marker)))
|
(insert (concat "\n" (make-string pad ? ) marker)))
|
||||||
('above
|
('above
|
||||||
(goto-char (line-beginning-position))
|
(goto-char (line-beginning-position))
|
||||||
(insert (make-string pad ? ) marker)
|
(insert (make-string pad 32) (or marker ""))
|
||||||
(save-excursion (insert "\n")))))
|
(save-excursion (insert "\n")))))
|
||||||
(when (org-element-property :checkbox context)
|
(when (org-element-property :checkbox context)
|
||||||
(insert "[ ] ")))
|
(insert "[ ] ")))
|
||||||
|
@ -167,15 +167,13 @@ wrong places)."
|
||||||
('below (org-table-insert-row t))
|
('below (org-table-insert-row t))
|
||||||
('above (+org/table-prepend-row-or-shift-up))))
|
('above (+org/table-prepend-row-or-shift-up))))
|
||||||
|
|
||||||
((memq type '(headline inlinetask plain-list))
|
((memq type '(headline inlinetask))
|
||||||
(let* ((subcontext (org-element-context))
|
(let* ((subcontext (org-element-context))
|
||||||
(level (save-excursion
|
(level (save-excursion
|
||||||
(org-back-to-heading)
|
(org-back-to-heading)
|
||||||
(org-element-property
|
(if (eq (org-element-type subcontext) 'headline)
|
||||||
:level
|
(org-element-property :level subcontext)
|
||||||
(if (eq (org-element-type subcontext) 'headline)
|
1))))
|
||||||
subcontext
|
|
||||||
1)))))
|
|
||||||
(pcase direction
|
(pcase direction
|
||||||
('below
|
('below
|
||||||
(let ((at-eol (= (point) (1- (line-end-position)))))
|
(let ((at-eol (= (point) (1- (line-end-position)))))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue