From: "Max Rydahl Andersen" <manderse@redhat.com>
To: Nicolas Goaziou <mail@nicolasgoaziou.fr>
Cc: Org-mode <emacs-orgmode@gnu.org>
Subject: Re: avoiding "First item of list cannot move without its subtree"
Date: Wed, 22 Feb 2017 08:22:15 +0100 [thread overview]
Message-ID: <627E7E70-7578-4B73-A6A7-2ABFAD907AFB@redhat.com> (raw)
In-Reply-To: <87d1ebtpkh.fsf@nicolasgoaziou.fr>
[-- Attachment #1: Type: text/plain, Size: 1713 bytes --]
On 21 Feb 2017, at 18:35, Nicolas Goaziou wrote:
> "Max Rydahl Andersen" <manderse@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
[-- Attachment #2: Type: text/html, Size: 2959 bytes --]
next prev parent reply other threads:[~2017-02-22 7:22 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-20 12:58 avoiding "First item of list cannot move without its subtree" Max Rydahl Andersen
2017-02-20 16:27 ` Nicolas Goaziou
2017-02-20 21:35 ` Max Rydahl Andersen
2017-02-21 7:42 ` Nicolas Goaziou
2017-02-21 16:07 ` Max Rydahl Andersen
2017-02-21 17:35 ` Nicolas Goaziou
2017-02-22 7:22 ` Max Rydahl Andersen [this message]
2017-02-22 11:04 ` Nicolas Goaziou
2017-02-23 7:36 ` Max Rydahl Andersen
2017-02-23 11:41 ` Nicolas Goaziou
2017-02-23 12:50 ` Max Rydahl Andersen
2017-02-23 13:07 ` Nicolas Goaziou
2017-02-28 11:31 ` Max Rydahl Andersen
[not found] <cabe8a30ab4e4a79a7d100b0d07093d6@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
2017-02-20 16:32 ` Eric S Fraga
2017-02-20 21:40 ` Max Rydahl Andersen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=627E7E70-7578-4B73-A6A7-2ABFAD907AFB@redhat.com \
--to=manderse@redhat.com \
--cc=emacs-orgmode@gnu.org \
--cc=mail@nicolasgoaziou.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).