From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: [patch] struggling with simple indentation Date: Tue, 26 Oct 2010 23:43:58 +0200 Message-ID: <87mxq0r5nl.wl%n.goaziou@gmail.com> References: Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: multipart/mixed; boundary="Multipart_Tue_Oct_26_23:43:56_2010-1" Return-path: Received: from [140.186.70.92] (port=47990 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PArJM-0000Wh-FP for emacs-orgmode@gnu.org; Tue, 26 Oct 2010 17:44:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PArJK-00019a-IB for emacs-orgmode@gnu.org; Tue, 26 Oct 2010 17:44:04 -0400 Received: from mail-wy0-f169.google.com ([74.125.82.169]:57195) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PArJK-00019Q-Dw for emacs-orgmode@gnu.org; Tue, 26 Oct 2010 17:44:02 -0400 Received: by wyf23 with SMTP id 23so5443148wyf.0 for ; Tue, 26 Oct 2010 14:44:01 -0700 (PDT) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Anthony Lander Cc: emacs-orgmode Mode <87zku2qk1i.wl%n.goaziou@gmail.com> <4CC6953F.7060600@diplan.de> <87tyk9qq5i.wl%n.goaziou@gmail.com> <4CC6A8CE.2080804@diplan.de> <87r5fdqkyh.wl%n.goaziou@gmail.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) Emacs/23.2 Mule/6.0 (HANACHIRUSATO) --Multipart_Tue_Oct_26_23:43:56_2010-1 Content-Type: text/plain; charset=US-ASCII Hello, >>>>> Anthony Lander writes: > With regards to the discussion below, if I set > org-list-ending-method to 'regex The correct value is 'regexp. > it seems to get confused if there is a drawer between the headline > and the first line of text, so pressing TAB with the cursor at the > vertical bar in this example: ----> 8------- > ** Headline > :PROPERTIES: > :FOO: Bar > :END: > | ----> 8------- > Does not indent to the position under the "H" in the headline. The > TAB key silently does nothing. Same effect with the properties > drawer folded. Is it possible to indent correctly, ignoring the > drawer? Actually, this has nothing to do with the value of org-list-ending-method, but I think you are right, indentation should ignore drawers. Here is a patch to do so. Does it work for you ? Regards, -- Nicolas --Multipart_Tue_Oct_26_23:43:56_2010-1 Content-Type: text/plain; type=patch; charset=US-ASCII Content-Disposition: attachment; filename="0001-indentation-lines-outside-of-drawers-ignore-indentat.patch" Content-Transfer-Encoding: 7bit >From 8aa0a33e36be4593ad605d9a3c283942a275e580 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Tue, 26 Oct 2010 23:34:49 +0200 Subject: [PATCH] indentation: lines outside of drawers ignore indentation of drawers * org.el (org-indent-line-function): Ignore drawers above the current line when indenting --- lisp/org.el | 13 ++++++------- 1 files changed, 6 insertions(+), 7 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index c4c64ee..edc0b74 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -18704,7 +18704,7 @@ which make use of the date at the cursor." (beginning-of-line 0) (while (and (not (bobp)) ;; skip comments, verbatim, empty lines, tables, - ;; inline tasks + ;; inline tasks, and lists (or (looking-at "[ \t]*[\n:#|]") (and (org-in-item-p) (goto-char (org-list-top-point))) (and (not inline-task-p) @@ -18714,8 +18714,11 @@ which make use of the date at the cursor." (not (looking-at org-drawer-regexp))) (beginning-of-line 0)) (cond - ;; There was an heading above. - ((looking-at "\\*+[ \t]+") + ;; There was an heading or the end of a drawer above. + ((or (looking-at "\\*+[ \t]+") + (and (looking-at "[ \t]*:END:") + (ignore-errors (org-back-to-heading 'invisible-ok)) + (looking-at "\\*+[ \t]+"))) (if (not org-adapt-indentation) (setq column 0) (goto-char (match-end 0)) @@ -18724,10 +18727,6 @@ which make use of the date at the cursor." ((looking-at org-drawer-regexp) (goto-char (1- (match-beginning 1))) (setq column (current-column))) - ;; The drawer had ended: indent like its :END: line. - ((looking-at "\\([ \t]*\\):END:") - (goto-char (match-end 1)) - (setq column (current-column))) ;; Else, nothing noticeable found: get indentation and go on. (t (setq column (org-get-indentation)))))) (goto-char pos) -- 1.7.3.2 --Multipart_Tue_Oct_26_23:43:56_2010-1 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode --Multipart_Tue_Oct_26_23:43:56_2010-1--