emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <n.goaziou@gmail.com>
To: Eric S Fraga <e.fraga@ucl.ac.uk>
Cc: Eric S Fraga <ucecesf@ucl.ac.uk>,
	org-mode mailing list <emacs-orgmode@gnu.org>,
	Carsten Dominik <carsten.dominik@gmail.com>
Subject: Re: full production use of org-mode: time to say thanks again!
Date: Mon, 11 Oct 2010 08:34:53 +0200	[thread overview]
Message-ID: <871v7xz182.wl%n.goaziou@gmail.com> (raw)
In-Reply-To: <87bp720vwy.wl%ucecesf@ucl.ac.uk>

[-- Attachment #1: Type: text/plain, Size: 291 bytes --]

Hello,

Could you try the following patch and tell me if it fixes your issue?

As a side note (to maintainers), the second patch isn't really needed,
but I thought, while I was at it, that it would make sense
(`org-inlinetask-min-level' doesn't need to be a boolean).

Regards,

-- Nicolas


[-- Attachment #2: 0001-Fix-indentation-of-text-after-an-inline-task.patch --]
[-- Type: text/plain, Size: 3467 bytes --]

From ab4b86b56654887be564d0519dd9e4407d9fc732 Mon Sep 17 00:00:00 2001
From: Nicolas Goaziou <n.goaziou@gmail.com>
Date: Mon, 11 Oct 2010 08:10:31 +0200
Subject: [PATCH 1/2] Fix indentation of text after an inline task.

* org.el (org-indent-line-function): Conditionnaly indent text inside
  and outside indented tasks. Also skip any list above point.
* org-inlinetask.el (org-inlinetask-in-task-p): new function.
---
 lisp/org-inlinetask.el |   16 ++++++++++++++++
 lisp/org.el            |   21 ++++++++++-----------
 2 files changed, 26 insertions(+), 11 deletions(-)

diff --git a/lisp/org-inlinetask.el b/lisp/org-inlinetask.el
index fce515d..e18dce8 100644
--- a/lisp/org-inlinetask.el
+++ b/lisp/org-inlinetask.el
@@ -129,6 +129,22 @@ If prefix arg NO-STATE is set, ignore `org-inlinetask-defaut-state'."
   (end-of-line -1))
 (define-key org-mode-map "\C-c\C-xt" 'org-inlinetask-insert-task)
 
+(defun org-inlinetask-in-task-p ()
+  "Return true if point is inside an inline task."
+  (save-excursion
+    (let* ((nstars (if org-odd-levels-only
+		       (1- (* 2 (or org-inlinetask-min-level 200)))
+		     (or org-inlinetask-min-level 200)))
+	   (stars-re (concat "^\\(?:\\*\\{"
+			     (format "%d" (- nstars 1))
+			     ",\\}\\)[ \t]+"))
+	   (task-beg-re (concat stars-re "\\(?:.*\\)"))
+	   (task-end-re (concat stars-re "\\(?:END\\|end\\)")))
+      (beginning-of-line)
+      (or (looking-at task-beg-re)
+	  (and (re-search-forward "^\\*+[ \t]+" nil t)
+	       (progn (beginning-of-line) (looking-at task-end-re)))))))
+
 (defvar htmlp)  ; dynamically scoped into the next function
 (defvar latexp) ; dynamically scoped into the next function
 (defun org-inlinetask-export-handler ()
diff --git a/lisp/org.el b/lisp/org.el
index a80286f..d9e26e9 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -18601,6 +18601,8 @@ which make use of the date at the cursor."
 	 (itemp (org-at-item-p))
 	 (case-fold-search t)
 	 (org-drawer-regexp (or org-drawer-regexp "\000"))
+	 (inline-task-p (and (featurep 'org-inlinetask)
+			     (org-inlinetask-in-task-p)))
 	 column bpos bcol tpos tcol bullet btype bullet-type)
     ;; Find the previous relevant line
     (beginning-of-line 1)
@@ -18656,7 +18658,14 @@ which make use of the date at the cursor."
      ;; what to do.
      (t
       (beginning-of-line 0)
-      (while (and (not (bobp)) (looking-at "[ \t]*[\n:#|]")
+      (while (and (not (bobp))
+		  ;; skip comments, verbatim, empty lines, tables,
+		  ;; inline tasks
+		  (or (looking-at "[ \t]*[\n:#|]")
+		      (and (org-in-item-p) (goto-char (org-list-top-point)))
+		      (and (not inline-task-p)
+			   (featurep 'org-inlinetask)
+			   (org-inlinetask-in-task-p)))
       		  (not (looking-at "[ \t]*:END:"))
       		  (not (looking-at org-drawer-regexp)))
       	(beginning-of-line 0))
@@ -18675,16 +18684,6 @@ which make use of the date at the cursor."
        ((looking-at "\\([ \t]*\\):END:")
 	(goto-char (match-end 1))
 	(setq column (current-column)))
-       ;; There was a list that since ended: indent relatively to
-       ;; current heading.
-       ((org-in-item-p)
-	(outline-previous-heading)
-	(if (and org-adapt-indentation
-		 (looking-at "\\*+[ \t]+"))
-	    (progn
-	      (goto-char (match-end 0))
-	      (setq column (current-column)))
-	  (setq column 0)))
        ;; Else, nothing noticeable found: get indentation and go on.
        (t (setq column (org-get-indentation))))))
     (goto-char pos)
-- 
1.7.3.1


[-- Attachment #3: 0002-inlinetask-Make-org-inlinetask-min-level-an-integer-.patch --]
[-- Type: text/plain, Size: 3753 bytes --]

From 89caeaa34fb2e76626954226e51f29590ecaba91 Mon Sep 17 00:00:00 2001
From: Nicolas Goaziou <n.goaziou@gmail.com>
Date: Mon, 11 Oct 2010 08:25:53 +0200
Subject: [PATCH 2/2] inlinetask: Make `org-inlinetask-min-level' an integer instead of a boolean.

* org-footnote.el (org-footnote-normalize): Remove unnecessary check
  for org-inlinetask-min-level.
* org-inlinetask.el (org-inlinetask-min-level): Variable is now of
  type integer.
* org-inlinetask.el (org-inlinetask-in-task-p): Remove unnecessary check
  for org-inlinetask-min-level.
* org-inlinetask.el (org-inlinetask-export-handler): Remove unnecessary check
  for org-inlinetask-min-level.
* org-inlinetask.el (org-inlinetask-fontify): Remove unnecessary check
  for org-inlinetask-min-level.
---
 lisp/org-footnote.el   |    1 -
 lisp/org-inlinetask.el |   14 +++++++-------
 lisp/org.el            |    1 -
 3 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/lisp/org-footnote.el b/lisp/org-footnote.el
index 36fcfb2..55c7665 100644
--- a/lisp/org-footnote.el
+++ b/lisp/org-footnote.el
@@ -358,7 +358,6 @@ referenced sequence."
   ;; This is based on Paul's function, but rewritten.
   (let* ((limit-level
 	  (and (boundp 'org-inlinetask-min-level)
-	       org-inlinetask-min-level
 	       (1- org-inlinetask-min-level)))
 	 (nstars (and limit-level
 		      (if org-odd-levels-only
diff --git a/lisp/org-inlinetask.el b/lisp/org-inlinetask.el
index e18dce8..54b997e 100644
--- a/lisp/org-inlinetask.el
+++ b/lisp/org-inlinetask.el
@@ -90,7 +90,7 @@ or to a number smaller than this one.  In fact, when `org-cycle-max-level' is
 not set, it will be assumed to be one less than the value of smaller than
 the value of this variable."
   :group 'org-inlinetask
-  :type 'boolean)
+  :type 'integer)
 
 (defcustom org-inlinetask-export t
   "Non-nil means export inline tasks.
@@ -133,8 +133,8 @@ If prefix arg NO-STATE is set, ignore `org-inlinetask-defaut-state'."
   "Return true if point is inside an inline task."
   (save-excursion
     (let* ((nstars (if org-odd-levels-only
-		       (1- (* 2 (or org-inlinetask-min-level 200)))
-		     (or org-inlinetask-min-level 200)))
+		       (1- (* 2 org-inlinetask-min-level))
+		     org-inlinetask-min-level))
 	   (stars-re (concat "^\\(?:\\*\\{"
 			     (format "%d" (- nstars 1))
 			     ",\\}\\)[ \t]+"))
@@ -152,8 +152,8 @@ If prefix arg NO-STATE is set, ignore `org-inlinetask-defaut-state'."
 Either remove headline and meta data, or do special formatting."
   (goto-char (point-min))
   (let* ((nstars (if org-odd-levels-only
-		     (1- (* 2 (or org-inlinetask-min-level 200)))
-		   (or org-inlinetask-min-level 200)))
+		     (1- (* 2 org-inlinetask-min-level))
+		   org-inlinetask-min-level))
 	 (re1 (format "^\\(\\*\\{%d,\\}\\) .*\n" nstars))
 	 (re2 (concat "^[ \t]*" org-keyword-time-regexp))
 	 headline beg end stars content indent)
@@ -226,8 +226,8 @@ Either remove headline and meta data, or do special formatting."
 (defun org-inlinetask-fontify (limit)
   "Fontify the inline tasks."
   (let* ((nstars (if org-odd-levels-only
-		     (1- (* 2 (or org-inlinetask-min-level 200)))
-		   (or org-inlinetask-min-level 200)))
+		     (1- (* 2 org-inlinetask-min-level))
+		   org-inlinetask-min-level))
 	 (re (concat "^\\(\\*\\)\\(\\*\\{"
 		    (format "%d" (- nstars 3))
 		    ",\\}\\)\\(\\*\\* .*\\)")))
diff --git a/lisp/org.el b/lisp/org.el
index d9e26e9..b6805cc 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -5768,7 +5768,6 @@ in special contexts.
     (let* ((limit-level
 	    (or org-cycle-max-level
 		(and (boundp 'org-inlinetask-min-level)
-		     org-inlinetask-min-level
 		     (1- org-inlinetask-min-level))))
 	   (nstars (and limit-level
 		      (if org-odd-levels-only
-- 
1.7.3.1


[-- 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-11  6:35 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-09 10:46 full production use of org-mode: time to say thanks again! Eric S Fraga
2010-10-09 15:26 ` Carsten Dominik
2010-10-09 17:00   ` Nicolas Goaziou
2010-10-10 18:01     ` Eric S Fraga
2010-10-11  6:34       ` Nicolas Goaziou [this message]
2010-10-11  8:04         ` Carsten Dominik
2010-10-11 11:15           ` Paul Mead
2010-10-11 15:12           ` Nicolas Goaziou
2010-10-11 15:16           ` Nicolas Goaziou
2010-10-11 15:37           ` Eric S Fraga
2010-10-14  8:32           ` Carsten Dominik
2010-10-11 15:33         ` indenting after inline task (was Re: full production use of org-mode: time to say thanks again!) Eric S Fraga
2010-10-14  8:16         ` full production use of org-mode: time to say thanks again! Carsten Dominik
2010-10-10 17:56   ` Eric S Fraga
2010-10-11  8:01     ` Carsten Dominik
2010-10-11  9:01       ` Eric S Fraga
2010-10-09 16:48 ` Christian Moe
2010-10-09 17:15   ` Nick Dokos
2010-10-09 19:03     ` Christian Moe
2010-10-11 19:33       ` Jeff Horn
2010-10-12  8:04         ` Carsten Dominik
2010-10-12  8:08         ` Eric S Fraga
2010-10-19  8:27         ` Sébastien Vauban
2010-10-20  2:45           ` Jeff Horn
2010-10-20  8:01             ` Sébastien Vauban

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=871v7xz182.wl%n.goaziou@gmail.com \
    --to=n.goaziou@gmail.com \
    --cc=carsten.dominik@gmail.com \
    --cc=e.fraga@ucl.ac.uk \
    --cc=emacs-orgmode@gnu.org \
    --cc=ucecesf@ucl.ac.uk \
    /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).