emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] avoiding "First item of list cannot move without its subtree"


From: Nicolas Goaziou
Subject: Re: [O] avoiding "First item of list cannot move without its subtree"
Date: Tue, 21 Feb 2017 18:35:10 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)

"Max Rydahl Andersen" <address@hidden> writes:

> Any pointers on how to do this ?
>
> I tried this but no luck to get hooked in:
>
> ```
> (defadvice org-fix-list-indent
>     (around org-list-indent-item-generic)
>   "Advise list indention to trigger creation of star instead"
>   (message "DO MAGIC!")
>   (ad-do-it)
> )
> ```
>
> But with this "DO MAGIC!" does not show up.

The function to advice is `org-shiftmetaleft', not
`org-fix-list-indent'.

Anyway, you can also add something like the following to
`org-shiftmetaleft-hook':

  (defun my-shiftmetaleft ()
    (interactive)
    (let* ((element (org-element-at-point))
           (list-parent (org-element-lineage element '(item plain-list) t)))
      (when (and list-parent
                 (= (line-beginning-position)
                    (org-element-property :post-affiliated element)))
        (call-interactively
         (if (org-element-lineage list-parent '(item)) ;not at top level
             #'org-outdent-item-tree
           #'org-ctrl-c-star))
        t)))
      

Regards,



reply via email to

[Prev in Thread] Current Thread [Next in Thread]