From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: avoiding "First item of list cannot move without its subtree" Date: Tue, 21 Feb 2017 18:35:10 +0100 Message-ID: <87d1ebtpkh.fsf@nicolasgoaziou.fr> References: <2F92B854-9322-45EA-8753-A6CAA3717974@redhat.com> <87h93oygic.fsf@nicolasgoaziou.fr> <87tw7ovvkc.fsf@nicolasgoaziou.fr> <31A5D5FB-7629-4A6A-9727-D419A7D8096D@redhat.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:38867) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cgELK-0006Za-Ku for emacs-orgmode@gnu.org; Tue, 21 Feb 2017 12:35:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cgELJ-0007Yg-GJ for emacs-orgmode@gnu.org; Tue, 21 Feb 2017 12:35:14 -0500 Received: from relay3-d.mail.gandi.net ([2001:4b98:c:538::195]:41688) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cgELJ-0007XV-AT for emacs-orgmode@gnu.org; Tue, 21 Feb 2017 12:35:13 -0500 In-Reply-To: <31A5D5FB-7629-4A6A-9727-D419A7D8096D@redhat.com> (Max Rydahl Andersen's message of "Tue, 21 Feb 2017 17:07:13 +0100") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Max Rydahl Andersen Cc: Org-mode "Max Rydahl Andersen" 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,