emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <n.goaziou@gmail.com>
To: Anthony Lander <anthonylander@yahoo.com>
Cc: emacs-orgmode Mode <emacs-orgmode@gnu.org>
Subject: Re: [patch] struggling with simple indentation
Date: Tue, 26 Oct 2010 23:43:58 +0200	[thread overview]
Message-ID: <87mxq0r5nl.wl%n.goaziou@gmail.com> (raw)
In-Reply-To: <E8C8B310-7C7B-4083-9A73-DD37C9874B91@yahoo.com>




[-- Attachment #2: Type: text/plain, Size: 832 bytes --]

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


[-- Attachment #3: 0001-indentation-lines-outside-of-drawers-ignore-indentat.patch --]
[-- Type: text/plain, Size: 1945 bytes --]

From 8aa0a33e36be4593ad605d9a3c283942a275e580 Mon Sep 17 00:00:00 2001
From: Nicolas Goaziou <n.goaziou@gmail.com>
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


[-- Attachment #4: Type: text/plain, Size: 201 bytes --]

_______________________________________________
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

      reply	other threads:[~2010-10-26 21:44 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-25 12:35 struggling with simple indentation Rainer Stengele
2010-10-25 17:06 ` Nicolas Goaziou
2010-10-26  8:45   ` Rainer Stengele
2010-10-26  9:05     ` Nicolas Goaziou
2010-10-26  9:06     ` Nicolas Goaziou
2010-10-26 10:09       ` Rainer Stengele
2010-10-26 10:58         ` Nicolas Goaziou
2010-10-26 12:25           ` Carsten Dominik
2010-10-26 13:12             ` Nicolas Goaziou
2010-10-26 15:10           ` Re: struggling with simple indentation (possible bug) Anthony Lander
2010-10-26 21:43             ` Nicolas Goaziou [this message]

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=87mxq0r5nl.wl%n.goaziou@gmail.com \
    --to=n.goaziou@gmail.com \
    --cc=anthonylander@yahoo.com \
    --cc=emacs-orgmode@gnu.org \
    /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).