emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: Max Rydahl Andersen <manderse@redhat.com>
Cc: Org-mode <emacs-orgmode@gnu.org>
Subject: Re: avoiding "First item of list cannot move without its subtree"
Date: Tue, 21 Feb 2017 18:35:10 +0100	[thread overview]
Message-ID: <87d1ebtpkh.fsf@nicolasgoaziou.fr> (raw)
In-Reply-To: <31A5D5FB-7629-4A6A-9727-D419A7D8096D@redhat.com> (Max Rydahl Andersen's message of "Tue, 21 Feb 2017 17:07:13 +0100")

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

Regards,

  reply	other threads:[~2017-02-21 17:35 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 [this message]
2017-02-22  7:22           ` Max Rydahl Andersen
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=87d1ebtpkh.fsf@nicolasgoaziou.fr \
    --to=mail@nicolasgoaziou.fr \
    --cc=emacs-orgmode@gnu.org \
    --cc=manderse@redhat.com \
    /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).