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: Max Rydahl Andersen
Subject: Re: [O] avoiding "First item of list cannot move without its subtree"
Date: Wed, 22 Feb 2017 08:22:15 +0100

On 21 Feb 2017, at 18:35, Nicolas Goaziou wrote:

"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)))

Thanks! I did this but still no effect ;/

What am I doing wrong ?

(add-hook 'org-shiftmetaleft-hook 
      (lambda ()
        (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))))

/max
http://about.me/maxandersen


reply via email to

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