Re: [O] How to specify output file for org-latex-export-to-pdf

2014-12-21 Thread Guido Van Hoecke
Hi Charlie,

On 21 December 2014 at 01:11, Charles Millar mill...@verizon.net wrote:

 Is this what you are looking for

 ** subtree heading
 :PROPERTIES:
 :EXPORT_FILE_NAME: path/to/filename
 :END:

 See the last paragraph in Org Manual Section 12.3

 ​Thanks Charlie.

This worked as soon as I realised I had to output the top heading as the
current subtree.​


​Have a nice day,

Guido​


[O] [PATCH] Proposal for «session» documentation

2014-12-21 Thread Thierry Pellé
Hi,
  I added description for empty names and used the suggestion of Aaron.

Hope it's not too frenchy ;-)


diff --git a/doc/org.texi b/doc/org.texi
index 3612bba..72ad0d9 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -15559,8 +15559,8 @@ execution.
 @subsubsection @code{:session}
 @cindex @code{:session}, src header argument
 
-The @code{:session} header argument starts a session for an interpreted
-language where state is preserved.  By default, a session is not started.
+The @code{:session} header argument starts a (possibly named) session for an 
interpreted
+language where state is preserved.  All code blocks sharing the same name are 
exectuted by the same interpreter process.  By default, a session is not 
started.
 
 @itemize @bullet
 @item @code{none}
@@ -15568,9 +15568,10 @@ The default.  Each block is evaluated in its own 
session.  The session is
 not preserved after the evaluation.
 @item @code{other}
 Any other string passed to the @code{:session} header argument will give the
-session a name.  All blocks with the same session name share the same
-session.  Using different session name enables concurrent sessions (even for
-the same interpreted language).  E.g., @code{:session mysession}.
+session a name.  If the given name is empty, the session is named as the
+language used in the block.  All blocks with the same session name share the
+same session.  Using different session name enables concurrent sessions (even
+for the same interpreted language).  E.g., @code{:session mysession}.
 @end itemize
 
 @node noweb



Re: [O] #+BEGIN_SRC mail and org-src-fontify-natively

2014-12-21 Thread Andrea Rossetti
Nicolas Goaziou m...@nicolasgoaziou.fr writes:

 Hello,

 Andrea Rossetti andrea.rosse...@gmail.com writes:
   when I start emacs -Q and do the following recipe:

 1) open the test file prova.org (see attach)
 2) confirm at the file-local variable prompt, by typing y
 3) quit with C-x C-c 

 then Emacs unexpectedly asks for a confirm to save the
 modified buffer org-src-fontify:mail-mode, even if I took care
 to avoid any editing between steps 2) and 3).

 I cannot reproduce it on development branch. It may have been fixed.

  Hello Nicolas and everyone else reading. Sorry for the late reply, it
took some time and edebugging for me to understand the problem.

  1) in summary: it was a mail-mode fault, not Org's. Or better:
 it was my fault, not knowing in depth mail-mode.

  2) in detail: when you create a #+BLOCK_SRC mail and fontify it with
 M-x org-src-fontify-block RET, a buffer is created with name
  org-src-fontify:mail-mode (notice the initial space character).
 This buffer usually have a buffer-local variable
 `buffer-offer-save' set to nil, but mail-mode forces it to t. That
 doesn't seem a wrong workflow: you don't accidentally lose the mail
 you just composed.

  3) lesson learnt: you can't fontify whatever you want in a SRC block.
 Some modes work perfectly, some don't, some almost work (like
 mail-mode).

  4) future plans: I'm now curious and I'll probably try fontification
 of whatever mode I can think of (M-x apropos RET -mode$ RET) :)

Thanks for your time and attention, kindest regards.

Andrea



Re: [O] [bug, patch, ox] INCLUDE and footnotes

2014-12-21 Thread Nicolas Goaziou
Rasmus ras...@gmx.us writes:

 Thanks for the notes.  Hopefully patch one if good now.

Thanks. Some comments follow.

 * ox.el (org-export--prepare-file-contents): Preserve footnotes
 when using the LINES argument.  New optional argument FOOTNOTES.
  (org-export-expand-include-keyword): New optional argument
  FOOTNOTES.
 * test-ox.el: Add test for INCLUDE with :lines and footnotes.

Please name the test modified.

 + (include-re ^[ \t]*#\\+INCLUDE:))

Why do you need it since you only use this regexp once in the function?

 +;; Expand footnotes after all files have been
 +;; included.  Footnotes are stored in an
 +;; `org-footnote-section' if that variable is
 +;; non-nil.  Otherwise they are stored close to the definition.

Don't bother about `org-footnote-section'. Even if the variable is
non-nil, footnote definitions are allowed everywhere. So in any case,
the very end of the master document is an appropriate location.

Also, inserting definitions close to the reference is wrong, as
explained in this thread (it could break structure around reference,
e.g., a plain list).

 +   (when (and (not included) ( (hash-table-count footnotes) 0))
 + (org-with-wide-buffer
 +  (goto-char (point-min))
 +  (if org-footnote-section
 +  (progn
 +(or (search-forward-regexp
 + (concat ^\\*[ \t]+
 + (regexp-quote org-footnote-section)
 + [ \t]*$)
 + nil t)
 +(and
 + (goto-char (point-max))
 + (insert (format * %s org-footnote-section
 +(insert \n)
 +(maphash (lambda (ref def)
 +   (insert (format [%s] %s ref def) \n))
 + footnotes))
 +;; `org-footnote-section' is nil.  Insert definitions close 
 to references.
 +(maphash (lambda (ref def)
 +   (save-excursion
 + (search-forward (format [%s] ref))
 + (org-footnote-create-definition ref)
 + (insert def \n)))
 + footnotes

IOW, I think

  (org-with-wide-buffer
   (goto-char (point-max))
   (unless (bolp) (insert \n))
   (maphash (lambda (label definition) (insert [ label ]  definition \n))
footnotes))

is enough.

 +  (let* ((lines (and lines (split-string lines -)))
 +  (lbeg (and lines (string-to-number (car lines
 +  (lend (and lines (string-to-number (cadr lines)

This is not needed. `point-min' and `point-max' refer to the boundaries
of the area to be included. It avoids relying on the expensive
`line-number-at-pos' function later.

Moreover, I suggest store (point-max) as a marker since you are going to
modify contents of the buffer (e.g., adding ID to labels).

 + (goto-char (point-min))
 + (while (re-search-forward org-footnote-re nil t)
 +   (let* ((reference (org-element-context))
 +  (type (org-element-type reference))
 +  (footnote-type (org-element-property :type reference))
 +  (label (org-element-property :label reference)))
 + (when (eq type 'footnote-reference)

The order is confusing here. First you check if you're really at
a footnote reference, then you bind LABEL and FOOTNOTE-TYPE. Actually,
the latter doesn't even need to bound since you use it only once.

 +   (goto-char (org-element-property :begin reference))
 +   (when label
 + (forward-char 4)
 + (insert (format %d- id))

This looks wrong. Labels can be 1, fn:label or even fn: in
anonymous footnotes. You need to check if label matches \\`[0-9]+\\',
in which case prepending fn: is also necessary.

 + (and (not (eq footnote-type 'inline))

   (unless (eq footnote-type 'inline) ...)

or

  (when (eq (org-element-property :type reference) 'standard) ...)

 +  (org-with-wide-buffer
 +   (org-footnote-goto-definition label)
 +   (beginning-of-line)
 +   (org-skip-whitespace)

Footnote definitions start at column 0. Skipping white spaces is not
needed.

 +   (forward-char 4)
 +   (insert (format %d- id))

Dangerous. See above.

 +   (let ((definition (org-element-context)))
 + (when (and lines
 +(or ( lend (line-number-at-pos
 + (org-element-property
 +  :contents-begin definition)))
 +( lbeg (line-number-at-pos
 + (org-element-property
 + 

Re: [O] [bug, patch, ox] INCLUDE and footnotes

2014-12-21 Thread Nicolas Goaziou
Rasmus ras...@gmx.us writes:

 Here's a new version of the second patch with tests.

Thanks. Some comments follow.

 The recognition regexp is still not great, but the idea of the regexp
 is to only act on includes where there's no :minlevel already and no
 plain words (most obviously src and example, but any block really)
 when disregarding :key value pairs.

This is not necessary. Even if :minlevel is used on these include
keywords, its value is ignored when inserting contents of the file.

 * ox.el (org-export-expand-include-keyword): Guess :minlevel if
 missing and relevant.
 * test-ox.el: Tests for automatic :minlevel.

Pleas name test modified.

 +;; Add :minlevel to all include words that no explicitly have one.
 +(save-excursion

No need for that.

 +  (while (re-search-forward
 +   (concat include-re [ \t]* \\(?:\.+?\\\|[^ \t]+\\)[ \t]* 
 \\(.*\\)$)
 +   nil t)

  (re-search-forward include-re nil t)

is enough.

 + (let ((matched (match-string 1)))
 +   (unless (or (string-match-p :minlevel matched)
 +   ;; matched a normal word
 +   (string-match \\(?:^\\|[ \t]+\\)\\(\\w\\)
 + (replace-regexp-in-string \\(^\\|[ 
 t]+\\):\\w+[ \t]+\\w+ 
 +   matched)))

  (unless (search-forward :minlevel (line-end-position) t) ...)

 + (goto-char (line-end-position))

aka (end-of-line)

 + (insert (format  :minlevel %d
 + (1+ (org-with-wide-buffer
 +  (if (search-backward-regexp org-heading-regexp 
 nil t)
 +  (length (match-string 1))
 +0)

  (insert (format  :minlevel %d (1+ (org-outline-level


Regards,



Re: [O] [bug, patch, ox] INCLUDE and footnotes

2014-12-21 Thread Rasmus
Hi,

Thanks for the comments.  I've attached a new version.

Nicolas Goaziou m...@nicolasgoaziou.fr writes:

 The recognition regexp is still not great, but the idea of the regexp
 is to only act on includes where there's no :minlevel already and no
 plain words (most obviously src and example, but any block really)
 when disregarding :key value pairs.

 This is not necessary. Even if :minlevel is used on these include
 keywords, its value is ignored when inserting contents of the file.

It's not neural to the org export buffer, though it's probably neutral to
the *exported* document.

E.g.

(org-test-with-temp-text
(format #+INCLUDE: \%s/examples/include2.org\ src emacs-lisp 
org-test-dir)
  (org-export-expand-include-keyword)
  (buffer-string))
  
=

#+BEGIN_src emacs-lisp :minlevel 1
Success!
#+END_src


Which is turn is passed to babel (which also seems to ignoring it).  I
cannot easily condition on src (without using the previous complex regexp)
since the file ~/my src folder/FILE is not totally unlikely...

If you are happy with the alteration, which might only be manifested in
slightly uglier tests then we can go with the simpler solution.

Note, for blocks the minlevel is not inserted:

(org-test-with-temp-text
(format #+INCLUDE: \%s/examples/include2.org\ foo org-test-dir)
  (org-export-expand-include-keyword)
  (buffer-string))
  
= 

#+BEGIN_foo
Success!
#+END_foo


 +  (while (re-search-forward
 +  (concat include-re [ \t]* \\(?:\.+?\\\|[^ \t]+\\)[ \t]* 
 \\(.*\\)$)
 +  nil t)

   (re-search-forward include-re nil t)

 is enough.

The regexp was motivated by the above concerns.

 +(insert (format  :minlevel %d
 +(1+ (org-with-wide-buffer
 + (if (search-backward-regexp org-heading-regexp 
 nil t)
 + (length (match-string 1))
 +   0)
   (insert (format  :minlevel %d (1+ (org-outline-level

But this if the buffer is narrowed this would not work correctly in
getting the right level.  But it probably does not matter for export.

See this test for my initial reasoning:

  (should
   (org-test-with-temp-text
   (format * h1\npoint#+INCLUDE: \%s/examples/include.org::#ah\ 
org-test-dir)
 (org-narrow-to-element)
 (org-export-expand-include-keyword)
 (goto-char (point-min))
 (eq 2 (org-element-property :level (org-element-at-point)

This is changed now.

—Rasmus

-- 
Enough with the bla bla!
From b7112471b3e4b5334d98caf528e1e687232dee2f Mon Sep 17 00:00:00 2001
From: Rasmus ras...@gmx.us
Date: Thu, 18 Dec 2014 16:48:49 +0100
Subject: [PATCH 2/2] ox.el: Guess the :minlevel for INCLUDE-keywords

* ox.el (org-export-expand-include-keyword): Guess :minlevel if
missing and relevant.
* test-ox.el (org-export-expand-include-keyword): Tests for automatic :minlevel.
---
 lisp/ox.el  |  6 ++
 testing/lisp/test-ox.el | 41 +++--
 2 files changed, 45 insertions(+), 2 deletions(-)

diff --git a/lisp/ox.el b/lisp/ox.el
index 99c4e9b..b65cea0 100644
--- a/lisp/ox.el
+++ b/lisp/ox.el
@@ -3065,8 +3065,14 @@ storing and resolving footnotes.  It is created automatically.
 	(current-prefix 0)
 	(footnotes (or footnotes (make-hash-table :test #'equal)))
 	(include-re ^[ \t]*#\\+INCLUDE:))
+;; Add :minlevel to all include words that no explicitly have one.
 (goto-char (point-min))
+(while (re-search-forward include-re nil t)
+  (unless (search-forward-regexp [ \t]+:minlevel\\ (line-end-position) t)
+	(end-of-line)
+	(insert (format  :minlevel %d (1+ (org-outline-level))
 ;; Expand INCLUDE keywords.
+(goto-char (point-min))
 (while (re-search-forward include-re nil t)
   (let ((element (save-match-data (org-element-at-point
 	(when (eq (org-element-type element) 'keyword)
diff --git a/testing/lisp/test-ox.el b/testing/lisp/test-ox.el
index 140c0a8..794de1f 100644
--- a/testing/lisp/test-ox.el
+++ b/testing/lisp/test-ox.el
@@ -854,7 +854,7 @@ text
   ;; Inclusion within a src-block.
   (should
(equal
-#+BEGIN_SRC emacs-lisp\n(+ 2 1)\n#+END_SRC\n
+#+BEGIN_SRC emacs-lisp :minlevel 1\n(+ 2 1)\n#+END_SRC\n
 (org-test-with-temp-text
  (format
   #+INCLUDE: \%s/examples/include.org\ :lines \4-5\ SRC emacs-lisp
@@ -1045,7 +1045,44 @@ baz
 (org-test-with-temp-text
 	(format #+INCLUDE: \%s/examples/include.org::#dh\ :only-contents t org-test-dir)
   (org-export-expand-include-keyword)
-  (buffer-string)
+  (buffer-string
+  ;; Adjacent INCLUDE-keywords should have the same :minlevel if unspecified.
+  (should
+   (org-every (lambda (level) (zerop (1- level)))
+	  (org-test-with-temp-text
+		  (concat
+		   (format #+INCLUDE: \%s/examples/include.org::#ah\\n org-test-dir)
+		   (format #+INCLUDE: \%s/examples/include.org::*Heading\ org-test-dir))
+		(org-export-expand-include-keyword)

Re: [O] [bug, patch, ox] INCLUDE and footnotes

2014-12-21 Thread Nicolas Goaziou
Rasmus ras...@gmx.us writes:

 Thanks for the comments.  I've attached a new version.

Thanks.

 Nicolas Goaziou m...@nicolasgoaziou.fr writes:

 This is not necessary. Even if :minlevel is used on these include
 keywords, its value is ignored when inserting contents of the file.

 It's not neural to the org export buffer, though it's probably neutral to
 the *exported* document.

 E.g.

 (org-test-with-temp-text
   (format #+INCLUDE: \%s/examples/include2.org\ src emacs-lisp 
 org-test-dir)
   (org-export-expand-include-keyword)
   (buffer-string))
   
 =

 #+BEGIN_src emacs-lisp :minlevel 1
 Success!
 #+END_src
 

 Which is turn is passed to babel (which also seems to ignoring it).  I
 cannot easily condition on src (without using the previous complex regexp)
 since the file ~/my src folder/FILE is not totally unlikely...

Indeed. This is not pretty. I forgot about that feature.

I suggest to do it differently, then. We first process every include
keyword in the document, but simply add a text property (e.g.
`org-include-level') over them specifying

  (1+ (org-reduced-level (or (org-current-level) 0)))

as their value.

Later, instead of

  (minlevel
   (and (not env)
(if (string-match :minlevel +\\([0-9]+\\) value)
(prog1 (string-to-number (match-string 1 value))
  (setq value (replace-match  nil nil value)))
  (let ((cur (org-current-level)))
(if cur (1+ (org-reduced-level cur)) 1)

we can use

  (minlevel
   (and (not env)
(if (string-match :minlevel +\\([0-9]+\\) value)
(prog1 (string-to-number (match-string 1 value))
  (setq value (replace-match  nil nil value)))
  (get-text-property (point) 'org-include-level

Include lines are not modified and this variable only applies to Org
documents. WDYT?


Regards,



Re: [O] [bug, patch, ox] INCLUDE and footnotes

2014-12-21 Thread Rasmus
Nicolas Goaziou m...@nicolasgoaziou.fr writes:

 I suggest to do it differently, then. We first process every include
 keyword in the document, but simply add a text property (e.g.
 `org-include-level') over them specifying
 [...] 
 Include lines are not modified and this variable only applies to Org
 documents. WDYT?

That's a nice solution.  Implemented in attached patch.

Should this be added to ORG-NEWS?  Is a feature or a bug-fix?

Thanks,
Rasmus

-- 
Vote for proprietary math!
From 1fa88054255e66922ea9e2cd61310461901ac6ee Mon Sep 17 00:00:00 2001
From: Rasmus ras...@gmx.us
Date: Thu, 18 Dec 2014 16:48:49 +0100
Subject: [PATCH 2/2] ox.el: Guess the :minlevel for INCLUDE-keywords

* ox.el (org-export-expand-include-keyword): Guess :minlevel for
included Org documents if missing.
* test-ox.el (org-export-expand-include-keyword): Tests for automatic :minlevel.
---
 lisp/ox.el  | 14 ++
 testing/lisp/test-ox.el | 39 ++-
 2 files changed, 48 insertions(+), 5 deletions(-)

diff --git a/lisp/ox.el b/lisp/ox.el
index 11b9a29..11426fb 100644
--- a/lisp/ox.el
+++ b/lisp/ox.el
@@ -3063,10 +3063,17 @@ storing and resolving footnotes.  It is created automatically.
   (let ((case-fold-search t)
 	(file-prefix (make-hash-table :test #'equal))
 	(current-prefix 0)
-	(footnotes (or footnotes (make-hash-table :test #'equal
+	(footnotes (or footnotes (make-hash-table :test #'equal)))
+	(include-re ^[ \t]*#\\+INCLUDE:))
+;; Add :minlevel to all include words that no explicitly have one.
 (goto-char (point-min))
+(while (re-search-forward include-re nil t)
+  (add-text-properties (line-beginning-position) (line-end-position)
+			   `(org-include-induced-level
+			 ,(1+ (org-reduced-level (or (org-current-level) 0))
 ;; Expand INCLUDE keywords.
-(while (re-search-forward ^[ \t]*#\\+INCLUDE: nil t)
+(goto-char (point-min))
+(while (re-search-forward include-re nil t)
   (let ((element (save-match-data (org-element-at-point
 	(when (eq (org-element-type element) 'keyword)
 	  (beginning-of-line)
@@ -3111,8 +3118,7 @@ storing and resolving footnotes.  It is created automatically.
 		   (if (string-match :minlevel +\\([0-9]+\\) value)
 			   (prog1 (string-to-number (match-string 1 value))
 			 (setq value (replace-match  nil nil value)))
-			 (let ((cur (org-current-level)))
-			   (if cur (1+ (org-reduced-level cur)) 1)
+			 (get-text-property (point) 'org-include-induced-level
 		 (src-args (and (eq env 'literal)
 (match-string 1 value)))
 		 (block (and (string-match (\\S-+\\)\\ value)
diff --git a/testing/lisp/test-ox.el b/testing/lisp/test-ox.el
index 37e2e23..91f9eab 100644
--- a/testing/lisp/test-ox.el
+++ b/testing/lisp/test-ox.el
@@ -1003,7 +1003,44 @@ Footnotes[fn:2], foot[fn:test], digit only[3], and [fn:inline:anonymous footnote
 (org-test-with-temp-text
 	(format #+INCLUDE: \%s/examples/include.org::#dh\ :only-contents t org-test-dir)
   (org-export-expand-include-keyword)
-  (buffer-string)
+  (buffer-string
+  ;; Adjacent INCLUDE-keywords should have the same :minlevel if unspecified.
+  (should
+   (org-every (lambda (level) (zerop (1- level)))
+	  (org-test-with-temp-text
+		  (concat
+		   (format #+INCLUDE: \%s/examples/include.org::#ah\\n org-test-dir)
+		   (format #+INCLUDE: \%s/examples/include.org::*Heading\ org-test-dir))
+		(org-export-expand-include-keyword)
+		(org-element-map (org-element-parse-buffer) 'headline
+		  (lambda (head) (org-element-property :level head))
+  ;; INCLUDE does not insert induced :minlevel for src-blocks.
+  (should-not
+   (equal
+(org-test-with-temp-text
+	(format #+INCLUDE: \%s/examples/include2.org\ src emacs-lisp org-test-dir)
+  (org-export-expand-include-keyword)
+  (buffer-string))
+(org-test-with-temp-text
+	(format #+INCLUDE: \%s/examples/include2.org\ src emacs-lisp :minlevel 1 org-test-dir)
+  (org-export-expand-include-keyword)
+  (buffer-string
+  ;; INCLUDE assigns the relative :minlevel conditional on narrowing.
+  (should
+   (org-test-with-temp-text
+   (format * h1\npoint#+INCLUDE: \%s/examples/include.org::#ah\ org-test-dir)
+ (org-narrow-to-element)
+ (org-export-expand-include-keyword)
+ (goto-char (point-min))
+ (eq 1 (org-element-property :level (org-element-at-point)
+  ;; If :minlevel is present do not alter it.
+  (should
+   (org-test-with-temp-text
+   (format * h1\npoint#+INCLUDE: \%s/examples/include.org::#ah\ :minlevel 3 org-test-dir)
+ (org-narrow-to-element)
+ (org-export-expand-include-keyword)
+ (goto-char (point-min))
+ (eq 3 (org-element-property :level (org-element-at-point))
 
 (ert-deftest test-org-export/expand-macro ()
   Test macro expansion in an Org buffer.
-- 
2.2.1



Re: [O] [bug, patch, ox] INCLUDE and footnotes

2014-12-21 Thread Rasmus
Hi,

Thanks for the comments.  I managed to make the patch less complicated.

Nicolas Goaziou m...@nicolasgoaziou.fr writes:

 +  (let* ((lines (and lines (split-string lines -)))
 + (lbeg (and lines (string-to-number (car lines
 + (lend (and lines (string-to-number (cadr lines)

 This is not needed. `point-min' and `point-max' refer to the boundaries
 of the area to be included. It avoids relying on the expensive
 `line-number-at-pos' function later.

 Moreover, I suggest store (point-max) as a marker since you are going to
 modify contents of the buffer (e.g., adding ID to labels).

I did not know markers but they seem perfect in this case.  The manual
mentions setting markers to nil after use.  I guess it's not necessary
here since they are in a (let ⋯)?

 +(goto-char (point-min))
 +(while (re-search-forward org-footnote-re nil t)
 +  (let* ((reference (org-element-context))
 + (type (org-element-type reference))
 + (footnote-type (org-element-property :type reference))
 + (label (org-element-property :label reference)))
 +(when (eq type 'footnote-reference)

 The order is confusing here. First you check if you're really at
 a footnote reference, then you bind LABEL and FOOTNOTE-TYPE. Actually,
 the latter doesn't even need to bound since you use it only once.

I check if I'm at a footnote reference 'cause I never want to deal with a
footnote-*definition* directly.  AFAIK org-footnote-re matches both.  It
seems a footnote-reference can never be at the beginning of line, but I
would still prefer a more explicit test through org-element.

 +  (goto-char (org-element-property :begin reference))
 +  (when label
 +(forward-char 4)
 +(insert (format %d- id))

 This looks wrong. Labels can be 1, fn:label or even fn: in
 anonymous footnotes. You need to check if label matches \\`[0-9]+\\',
 in which case prepending fn: is also necessary.

Ah, that explains the \\`[0-9]+\\' that always confused me.

 +  (let ((definition (org-element-context)))
 +(when (and lines
 +   (or ( lend (line-number-at-pos
 +(org-element-property
 + :contents-begin definition)))
 +   ( lbeg (line-number-at-pos
 +(org-element-property
 + :contents-begin definition)
 +  (puthash (org-element-property :label definition)
 +   (org-element-normalize-string
 +(buffer-substring
 + (org-element-property
 +  :contents-begin definition)
 + (org-element-property
 +  :contents-end definition)))
 +   footnotes)))

 You don't need this part. Basically move to the definition of the
 current reference in a wide buffer. If you're not within narrowed
 boundaries stored before, put it in the hash table. Otherwise, skip it.
 It doesn't require `org-element-context' or `line-number-at-pos'.

OK.  I do it in a differently now, relying on org-footnote-get-definition.
Or do you have something more low-level in mind?  

The only bug *I'm aware of* is that it will pick up the wrong new-label
for footnote for something like [fn:ref with space].  But this is anyway
not a proper label, I think.  Is that OK?

Thanks,
Rasmus

-- 
Sådan en god dansk lagereddike kan man slet ikke bruge mere
From 36bde4b87a1b3405ab80867d66b074722a251837 Mon Sep 17 00:00:00 2001
From: rasmus ras...@gmx.us
Date: Tue, 9 Dec 2014 12:40:52 +0100
Subject: [PATCH 1/2] ox.el: Fix footnote-bug in #+INCLUDE-keyword

* ox.el (org-export--prepare-file-contents): Preserve footnotes
when using the LINES argument.  New optional argument FOOTNOTES.
 (org-export-expand-include-keyword): New optional argument
 FOOTNOTES.
* test-ox.el (test-org-export/expand-include): Add test for INCLUDE with :lines and footnotes.
---
 lisp/ox.el  | 82 ++---
 testing/lisp/test-ox.el | 32 +--
 2 files changed, 87 insertions(+), 27 deletions(-)

diff --git a/lisp/ox.el b/lisp/ox.el
index 9d9e794..11b9a29 100644
--- a/lisp/ox.el
+++ b/lisp/ox.el
@@ -3052,17 +3052,20 @@ locally for the subtree through node properties.
 		   (car key)
 		   (if (org-string-nw-p val) (format  %s val) 
 
-(defun org-export-expand-include-keyword (optional included dir)
+(defun org-export-expand-include-keyword (optional included dir footnotes)
   Expand every include keyword in buffer.
 Optional argument INCLUDED is a list of included file names along
 with their line restriction, when appropriate.  It is used to
 avoid infinite 

Re: [O] How do you show the entires in the logbook drawer in the agenda

2014-12-21 Thread jenia.ivlev

Eric Abrahamsen e...@ericabrahamsen.net writes:

 jenia.iv...@gmail.com (jenia.ivlev) writes:

 Hello.

 I thought that the entires in the logbook drawer - entered pressing `C-c
 C-z` in orgmode - would show up in the agenda, pressing `C-c a a`, but
 they do not. 
 Is possible to somehow list those notes in the agenda?

 Thanks in advnace for your kind help.

 Nice timing! If you hang on for just a couple of days, there ought to be
 a command like this available to you -- we're working it out in another
 thread.

 Eric




Hello.


I decided to go to the org-mode repository
(http://orgmode.org/w/org-mode.git) and I wanted to checkout the
changes that you and your collaborators did. But i can't find a tag or 
branch with your changes in it. 

I want to do this because I though of reading them and patching my 
existing org-mode program and that way learn how to do some emacs programming.

Can you please tell me what commits should I start looking at to find
the commits that you and your teammates did to enable the drawer
entries with a [timestamp] in them to appear in the agenda logging-view ?

Thanks in advance.
Jenia




Re: [O] How do you show the entires in the logbook drawer in the agenda

2014-12-21 Thread Eric Abrahamsen
jenia.iv...@gmail.com (jenia.ivlev) writes:

 Eric Abrahamsen e...@ericabrahamsen.net writes:

 jenia.iv...@gmail.com (jenia.ivlev) writes:

 Hello.

 I thought that the entires in the logbook drawer - entered pressing `C-c
 C-z` in orgmode - would show up in the agenda, pressing `C-c a a`, but
 they do not. 
 Is possible to somehow list those notes in the agenda?

 Thanks in advnace for your kind help.

 Nice timing! If you hang on for just a couple of days, there ought to be
 a command like this available to you -- we're working it out in another
 thread.

 Eric




 Hello.


 I decided to go to the org-mode repository
 (http://orgmode.org/w/org-mode.git) and I wanted to checkout the
 changes that you and your collaborators did. But i can't find a tag or 
 branch with your changes in it. 

That's because no commits have been made yet! There was a small bug to
fix first, and then... well one only has so much time for coding. I do
hope to get to it tonight.

 I want to do this because I though of reading them and patching my 
 existing org-mode program and that way learn how to do some emacs programming.

Oh man, you shouldn't be reading my patches to learn elisp programming!
At least, not until Nicolas has fixed them up.

 Can you please tell me what commits should I start looking at to find
 the commits that you and your teammates did to enable the drawer
 entries with a [timestamp] in them to appear in the agenda logging-view ?

To be clear, what I'm working on is quite simple: a single command to
flash up the most recent log note in the minibuffer. Do I understand you
right that what you'd like is to use the logging view (l in the
agenda), and then see all the notes?

Hmmm, I just went and tried it, using the C-u prefix argument to show
state notes as well as done and clock. This actually already does
a lot of what I was after! Conceptually, it's presently aimed at past
events, not current states, but I'll bet I can either expand the
logging-view to provide a current version, or at least steal some of
the code.

Of course, that means this might take me a little longer...

Eric




Re: [O] [PATCH] Proposal for «session» documentation

2014-12-21 Thread Aaron Ecay
Hi Thierry,

Juts a two comments and one question.

2014ko abenudak 21an, Thierry Pellé-ek idatzi zuen:
 
 Hi,
   I added description for empty names and used the suggestion of Aaron.
 
 Hope it's not too frenchy ;-)
 
 
 diff --git a/doc/org.texi b/doc/org.texi
 index 3612bba..72ad0d9 100644
 --- a/doc/org.texi
 +++ b/doc/org.texi
 @@ -15559,8 +15559,8 @@ execution.
  @subsubsection @code{:session}
  @cindex @code{:session}, src header argument
  
 -The @code{:session} header argument starts a session for an interpreted
 -language where state is preserved.  By default, a session is not started.
 +The @code{:session} header argument starts a (possibly named) session for an 
 interpreted
 +language where state is preserved.  All code blocks sharing the same name 
 are exectuted by the same interpreter process.  By default, a session is not 
 started.
  
  @itemize @bullet
  @item @code{none}
 @@ -15568,9 +15568,10 @@ The default.  Each block is evaluated in its own 
 session.  The session is
  not preserved after the evaluation.
  @item @code{other}
  Any other string passed to the @code{:session} header argument will give the
 -session a name.  All blocks with the same session name share the same
 -session.  Using different session name enables concurrent sessions (even for
 -the same interpreted language).  E.g., @code{:session mysession}.
 +session a name.  If the given name is empty, the session is named as the

“according to” instead of “as”

 +language used in the block.  All blocks with the same session name share the
 +same session.  Using different session name enables concurrent sessions (even
 +for the same interpreted language).  E.g., @code{:session mysession}.

I would move the “e.g.” directly after the sentence which ends “give the
session a name.”

Can you send a patch generated with “git format-patch”?  This way you
can write and include a commit message.  The procedure is described
here: http://orgmode.org/worg/org-contribute.html#unnumbered-4.

Thanks,

-- 
Aaron Ecay



[O] Fwd: demoting a heading inserts spaces in column-0 text

2014-12-21 Thread Daniel Clemente
(I'm resending this old e-mail because it seems it didn't get to the list,
according to Gmane).

El Sat, 13 Dec 2014 15:10:32 +0100 Nicolas Goaziou va escriure:

  Users who type can do a simpler distinction:
1. things you type yourself
2. things that appear/change/disappear after invoking org functions
(C-something, S-something, M-something). E.g.: the words SCHEDULED,
TODO, CLOCK, PROPERTIES, EFFORT, checkboxes [ ], timestamps, ...
 
I speak for myself, but I expect class 1 not to be changed by org,
  and class 2 to be handled only by org (I can always edit manually, but
  I shouldn't need to do it). I know that you can actually type
  everything in class 2, but you shouldn't NEED to.
Any other opinions are welcome.

 You are free to make any distinction you want. Unfortunately, Org does
 a different one. In particular, as you noticed, there are some areas
 where things are not as clear. For example, Org cannot be sure that
 a given drawer wasn't inserted manually, so altering its indentation may
 or may not be a good choice.

  Does it matter in practice? If the user manually inserts things that are
normally handled by org, they can be also handled by org. Lckily you don't
need to remember whether it was manually inputted or not.


Indentation is for me as important as the other letters I type. I
don't want it changed.
It's a personal preference. Emacs respects it to great extents.

 I understand. Simply set `org-adapt-indentation' to nil.

Maybe I should clarify that I see the text inside my org files as
  a tree of knowledge. The position inside the tree of a particular item
  does not affect how I write the text (e.g. how many indentation
  spaces). I can move nodes freely from one place to another and I have
  no indentations to fix. Tree structure and item content are
  disconnected.
If you really need other sources, you can see how tree operations in
  other contexts don't modify the contents of each node:
 
http://pythonhosted.org/ete2/tutorial/tutorial_trees.html#concatenating-trees
I wouldn't want titles, clocks, IDs, indentations, properties,
priorities etc. changed when the tree structure changes.
Maybe other people think the same; you can survey the list.

 So, what's wrong with `org-adapt-indentation' set to nil?

  This. By default (tested on emacs -Q), when you have this tree:

 Some text
Hi

  ...and you clock in, you get:

 Some text
CLOCK: [2014-12-14 Sun 18:55]--[2014-12-14 Sun 18:57] =  0:02
Hi

Same with properties:
 e
:PROPERTIES:
:ou:   22
:END:
Text

  That is 1) uglier than the default. 2) violating the rule you said: new
lines should be indented at the same level as the element above.



That's similar to a not-so-bad old behaviour. But it's still a bit
better (it avoids the problem described in
http://permalink.gmane.org/gmane.emacs.orgmode/92450)

 The problem described there is different: the OP wants some changes when
 tree structure is modified (e.g., planning info moved). You claim to
 want no change at all, which is easier, and already implemented.


  I want no change at all? No, my proposal is to move planning info in the
top and not move the things below it. Therefore I called it partial
indentation, as opposed to t (always indent) or nil (never indent).
  Sorry for the examples I sent in my first e-mail (
http://lists.gnu.org/archive/html/emacs-orgmode/2014-12/msg00091.html), it
seems that some e-mail program has reformatted the spaces (or maybe I sent
TABs instead of spaces) and the indentation doesn't make sense. I should
have switched spaces to something else.

  I'll try again. An underscore means a space:

  Before demoting:

** some
___:CLOCK:
___CLOCK: [2013-11-12 Sel 10:45]--[2013-11-12 Sel 11:40] =  0:55
___:END:
Text

   What I expect after demoting:

*** some
:CLOCK:
CLOCK: [2013-11-12 Sel 10:45]--[2013-11-12 Sel 11:40] =  0:55
:END:
Text



  Ok, make it:
 
  2. With org-adapt-indentation = 'partial, new lines added by org
  (:CLOCK: drawer, CLOCK lines etc) are indented at the same level as
  the element above.

 This is better, but there is still the hack about text at column 0.

 Also, this only makes sense if these lines are also moved when headline
 is promoted or demoted. But, then, contents will change along with tree,
 which you don't like, and it could break section structure (some lines
 being moved and not others), which cannot happen currently.

  Some lines moved and others not makes sense for a partial indentation.
You can call it 'only-top so that it's clear which lines are updated.

  I think the default behaviour should be not to change indentation,
because org-mode can be used in combination with other modes. E.g. I'm
using org-mode in beancount files (a ledger program), and lines need to
start in column 0.

 Another option would be to have another option to indent only planning
 info, properties drawer, and every drawer located right after it, à la