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

"Max Rydahl Andersen" <mande...@redhat.com> 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