[O] How to use helm to get suggestion for tags in org-mode?

2014-12-22 Thread jenia.ivlev
Hello:

This is probably a question for the helm channel but maybe someone here knows.

When I leave a tag for a node in org-mode, I press C-c C-c on that node
and helm provides me with suggestions for tags. But when I want to put 
a second tag there, and press C-c C-c, helm doesnt provide me with 
suggestions. Instead, on the text-bar on the bottom, it says :bash: 
for example, if that was the orginal tag I left put there. However, 
I want helm to provide me with suggestions of other tags I used elsewhere. 
Therefore I erase :bash: in the text-bar on the bottom and helm provides me with
all the previously entered tags but if I choose one of them,
the original tag is erased.
   
So how do I use helm together with org-mode tags in such a way as for
helm to provide me with suggestions regarding the available tags?

Thanks in advnance for your kind help.
Jenia




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

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

> Eric Abrahamsen  writes:
>
>> jenia.iv...@gmail.com (jenia.ivlev) writes:
>>
>>> Eric Abrahamsen  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". 
> Thanks very much, its a useful comamnd. But how to I make appear the
> actual notes? You know the ones that you take my typing C-c C-z?

Right, that's the difference with what I'm working on now -- it would
show the most recent item in the log drawer, whatever it was. That's not
possible right now. The question is, do we want another version of the
logging view, or a simple command that just flashes up the most recent
note for the entry under point?

>> 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
>
> Thanks again Eric.




[O] How to make appear the "note taken" in the calendar?

2014-12-22 Thread jenia.ivlev

Hello. 

How do I make appear the "note taken" in the agenda?
Like for example, if in a org-file, I press C-c C-z under a node, this
command will create a new note for that node. How do I make such notes
appear in the calendar?

In contrast, "state changes" of an org-node, like going from TODO to
DONE, appears in the calendar if you press "C-u l".

So again, how do you make appear, in the calendar, the notes-taken in an
org file?

Thanks in advance.





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

2014-12-22 Thread jenia.ivlev
Eric Abrahamsen  writes:

> jenia.iv...@gmail.com (jenia.ivlev) writes:
>
>> Eric Abrahamsen  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". 
Thanks very much, its a useful comamnd. But how to I make appear the
actual notes? You know the ones that you take my typing C-c C-z?
> 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

Thanks again Eric.




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

2014-12-22 Thread Rasmus
Hi,

Nicolas Goaziou  writes:

> Rasmus  writes:
>
 * Foo
 [1] foo

 * Bar
 Baz[1]
>>>
>>> I'm not sure to understand. Would you mind elaborating?
>>
>> If I have #+INCLUDE: "example-above.org::*Bar" then point-min of the
>> include area will be pushed forward by four since the definition of [1] is
>> changed to fn:1-1 or something like that.  So min-marker should be a
>> marker.  Or I'm misunderstanding something.
>
> No, you're right. However, this raises a question: why are we modifying
> definition at all? We are only interested in its new label, which we can
> get without modifying buffer (i.e. if definition is within range, modify
> it, otherwise, compute new label and store its definition).

We modify buffer because that's what we want to do when including whole
files.

The routines /could/ be split up, I just deemed it "not worth the
trouble".  Operations on the table are of course limited to when it's
needed.  Buffer-editing is not.  It's simple to wrap it in an if-statement
if you think it's worth it, e.g. performance-wise.  I'd only need to move
the catching of new-label back to the footnote-reference.

>> +(org-with-wide-buffer
>> + (let* ((definition (org-footnote-get-definition label))
>> +(beginning (line-beginning-position)))

> There's one potential problem here: `org-footnote-get-definition' may
> return a nil value if there is no matching definition for label. Maybe
> throw an error?

Ox already throws an error when a footnote is not found in
org-export-get-footnote-definition which is why I didn't add this.  But I
guess it would be friendly to add another error here stating which *file*
is missing a footnote and I added this now.

> Also, BEGINNING should refer to (nth 1 definition) since you're not
> using `org-footnote-goto-definition' and therefore, not moving point.

Indeed.  Thanks.

> I think you can push once the issues above are fixed. Thank you for the
> work.

Cool.  I think the #+INCLUDE-keyword is quite a bit better in 8.3 now and.
Thanks for all the help on this series of patches (I think four in total)!

—Rasmus

-- 
However beautiful the theory, you should occasionally look at the evidence




Re: [O] [bug] Effort and column view

2014-12-22 Thread Nicolas Goaziou
Hello,

Myles English  writes:

> I am sending this again because it doesn't show up on Gmane.
>
> Myles English writes:
>
>> Hello,
>>
>> I reported a possible bug a couple of weeks ago and since then I have
>> notice related bugs in todays HEAD (that may have existed before).
>
> That bug was reported here:
> http://article.gmane.org/gmane.emacs.orgmode/93312/match=myles
>
>> 1) The column view of TODO items only shows the total Effort at the
>> top and the Effort for the last item,
>>
>> 2) The column view of the org-agenda (restricted to current buffer with
>> '<', get list of todos with 't') only shows the Effort for the last item
>> and the total Effort at the top shows the same value as for the last
>> item
>>
>> 3) Narrowing by tag (the original possible bug reported) shows similar
>> behaviour as above

I saw the bug report, but didn't find time to investigate yet. Could you
git bisect in order to know if some commit changed that recently?


Regards,

-- 
Nicolas Goaziou



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

2014-12-22 Thread Nicolas Goaziou
Rasmus  writes:

>>> * Foo
>>> [1] foo
>>>
>>> * Bar
>>> Baz[1]
>>
>> I'm not sure to understand. Would you mind elaborating?
>
> If I have #+INCLUDE: "example-above.org::*Bar" then point-min of the
> include area will be pushed forward by four since the definition of [1] is
> changed to fn:1-1 or something like that.  So min-marker should be a
> marker.  Or I'm misunderstanding something.

No, you're right. However, this raises a question: why are we modifying
definition at all? We are only interested in its new label, which we can
get without modifying buffer (i.e. if definition is within range, modify
it, otherwise, compute new label and store its definition).

Anyway, it doesn't matter much. The marker is fine, indeed.

> Since it's soon Christmas, so I could perhaps accommodate.

I ensure you I have mostly been kind all year long.

> + (org-with-wide-buffer
> +  (let* ((definition (org-footnote-get-definition label))
> + (beginning (line-beginning-position)))

There's one potential problem here: `org-footnote-get-definition' may
return a nil value if there is no matching definition for label. Maybe
throw an error?

Also, BEGINNING should refer to (nth 1 definition) since you're not
using `org-footnote-goto-definition' and therefore, not moving point.

I think you can push once the issues above are fixed. Thank you for the
work.


Regards,



[O] [bug] Effort and column view

2014-12-22 Thread Myles English

I am sending this again because it doesn't show up on Gmane.

Myles English writes:

> Hello,
>
> I reported a possible bug a couple of weeks ago and since then I have
> notice related bugs in todays HEAD (that may have existed before).

That bug was reported here:
http://article.gmane.org/gmane.emacs.orgmode/93312/match=myles

> 1) The column view of TODO items only shows the total Effort at the
> top and the Effort for the last item,
>
> 2) The column view of the org-agenda (restricted to current buffer with
> '<', get list of todos with 't') only shows the Effort for the last item
> and the total Effort at the top shows the same value as for the last
> item
>
> 3) Narrowing by tag (the original possible bug reported) shows similar
> behaviour as above
>
> Myles




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

2014-12-22 Thread Rasmus
Hi,

I fixed the nitpicks, but no major changes.

Nicolas Goaziou  writes:

> Pleonasm.
>
> Note that the regexp can match even if not at a footnote reference [...]:

Fair enough.

> In a thousand years, scholars might debate over the secret meaning
> behind these symbols.

Let's hope so!  In the meantime i will let the user shoot herself in the
foot at specify wrong labels.

>>> This marker is not necessary since you're not going to add contents
>>> before (point-min) anyway. A plain number is enough.
>>
>> I might if I include *Bar here:
>>
>> * Foo
>> [1] foo
>>
>> * Bar
>> Baz[1]
>
> I'm not sure to understand. Would you mind elaborating?

If I have #+INCLUDE: "example-above.org::*Bar" then point-min of the
include area will be pushed forward by four since the definition of [1] is
changed to fn:1-1 or something like that.  So min-marker should be a
marker.  Or I'm misunderstanding something.

> The more I look at it, the more I'm seduced by
>
>   (unless included
>   (org-with-wide-buffer
>(goto-char (point-max))
>(maphash (lambda (ref def) (insert (format "\n[%s] %s\n" ref def)))
> footnotes)))
>
> I'm really nitpicking, tho.

Since it's soon Christmas, so I could perhaps accommodate.

>>  ;; Append ID to all footnote references and definitions, so they
>>  ;; become file specific and cannot collide with footnotes in other
>>  ;; included files.
>> +;; Further, collect relevant footnotes outside of LINES.
>
> You can include it in the previous paragraph, or insert a blank comment
> line, as it wouldn't survive a M-q.

Let's M-q it then.

>> +(goto-char (1+ (org-element-property :begin reference)))
>> +(when label
>
> Shouldn't these two lines be inverted?

Sure that's prettier.

Cheers,
Rasmus

-- 
ツ
>From 2382ee420c97a801560dff3e9bea343bca83dc13 Mon Sep 17 00:00:00 2001
From: rasmus 
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  | 94 +++--
 testing/lisp/test-ox.el | 32 +++--
 2 files changed, 97 insertions(+), 29 deletions(-)

diff --git a/lisp/ox.el b/lisp/ox.el
index 9d9e794..60f06cc 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 recursion.  Optional argument DIR is the current
 working directory.  It is used to properly resolve relative
-paths."
+paths.  Optional argument FOOTNOTES is a hash-table used for
+storing and resolving footnotes.  It is created automatically."
   (let ((case-fold-search t)
 	(file-prefix (make-hash-table :test #'equal))
-	(current-prefix 0))
+	(current-prefix 0)
+	(footnotes (or footnotes (make-hash-table :test #'equal
 (goto-char (point-min))
+;; Expand INCLUDE keywords.
 (while (re-search-forward "^[ \t]*#\\+INCLUDE:" nil t)
   (let ((element (save-match-data (org-element-at-point
 	(when (eq (org-element-type element) 'keyword)
@@ -3155,15 +3158,23 @@ paths."
 			   file location only-contents lines)
 			lines)))
 		 (org-mode)
-		 (insert
-		  (org-export--prepare-file-contents
-		   file lines ind minlevel
-		   (or (gethash file file-prefix)
-			   (puthash file (incf current-prefix) file-prefix)
+ (insert (org-export--prepare-file-contents
+			  file lines ind minlevel
+			  (or (gethash file file-prefix)
+  (puthash file (incf current-prefix) file-prefix))
+			  footnotes)))
 		   (org-export-expand-include-keyword
 		(cons (list file lines) included)
-		(file-name-directory file))
-		   (buffer-string)
+		(file-name-directory file)
+		footnotes)
+		   (buffer-string)
+	  ;; Expand footnotes after all files have been
+	  ;; included.  Footnotes are stored at end of buffer.
+	  (unless included
+		(org-with-wide-buffer
+		 (goto-char (point-max))
+		 (maphash (lambda (ref def) (insert (format "\n[%s] %s\n" ref def)))
+			  footnotes)))
 
 (defun org-export--inclusion-absolute-lines (file location only-contents lines)
   "Resolve absolute lines for an included file with file-link.
@@ -3227,8 +3238,8 @@ Return a string of lines to be

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

2014-12-22 Thread Nicolas Goaziou
Thanks for the update.

Rasmus  writes:

> I see.  I disagree that it's more since it's directly inside a loop over
> org-footnote-re.  So if we are not at a footnote-{reference,definition}
> it's probably a bug in the regexp.

Pleonasm.

Note that the regexp can match even if not at a footnote reference:

  #+begin_example
  int x = k[1]
  #+end_example

>> [fn: ref with space]
>
> While your comment excels in preciseness the terseness makes it hard to
> appreciate its depth.  In my org-installation "[fn: ref with space]" is
> not a valid footnote.

Actually, I wanted to say it wasn't valid, then changed my mind, and
eventually forgot to remove it from my mail.

In a thousand years, scholars might debate over the secret meaning
behind these symbols.

>> This marker is not necessary since you're not going to add contents
>> before (point-min) anyway. A plain number is enough.
>
> I might if I include *Bar here:
>
> * Foo
> [1] foo
>
> * Bar
> Baz[1]

I'm not sure to understand. Would you mind elaborating?

> +   (unless included
> + (org-with-wide-buffer
> +  (goto-char (point-max))
> +  (unless (bolp) (insert "\n"))
> +  (maphash (lambda (ref def) (insert (format "[%s] %s\n" ref 
> def)))
> +   footnotes)))

The more I look at it, the more I'm seduced by

  (unless included
(org-with-wide-buffer
 (goto-char (point-max))
 (maphash (lambda (ref def) (insert (format "\n[%s] %s\n" ref def)))
  footnotes)))

I'm really nitpicking, tho.

>  ;; Append ID to all footnote references and definitions, so they
>  ;; become file specific and cannot collide with footnotes in other
>  ;; included files.
> +;; Further, collect relevant footnotes outside of LINES.

You can include it in the previous paragraph, or insert a blank comment
line, as it wouldn't survive a M-q.

> + (goto-char (1+ (org-element-property :begin reference)))
> + (when label

Shouldn't these two lines be inverted?

> +  (let* ((definition (org-footnote-get-definition label))
> + (beginning (copy-marker (nth 1 definition

Actually, BEGINNING doesn't need to be a marker either: you always
modify buffer after it.


Regards,



[O] Sticky agendas not redone when using org-agenda-(set|remove)-restriction-lock

2014-12-22 Thread Nikolai Weibull
Hi!

It seems that agendas created when org-agenda-sticky-mode is t aren’t
automatically redone when calling
org-agenda-(set|remove)-restriction-lock.  The reason is that
(org-agenda-maybe-redo) checks whether there’s a window displaying a
buffer named org-agenda-buffer-name.  Org-agenda-buffer-name is, for
some reason, not set to the (buffer-name) for these sticky agendas
(which get the key that was selected as a suffix, for example, “*Org
Agenda(p)*”).

I don’t know whether there’s a reason for this, but it seems like it’s
a bug.  Either org-agenda-buffer-name isn’t being set correctly or
(org-agenda-maybe-redo) should be using (buffer-name) instead of
org-agenda-buffer-name.

If there’s a reason for this, I’d really like to know what it is, so
that I can begin to try to remember to press g whenever I’ve updated
the restriction lock.

Thanks!



[O] PROPERTY inheritance at the file level, and picking up all items

2014-12-22 Thread Subhan Michael Tindall
I'm trying to set up a buffer-wide property value for my project files.
Currently I have a level-1 header like this:

* project
:PROPERTIES:
:project_name: this_projects_name
:END:

I know this can be inherited by sub project, but I have many more level-1 
headers
* level1 header
** sub header

I can't seem to find a way to set up the property :project_name: to be a 
file-level or buffer-level property that is inherited and visible in custom 
agendas.
I've tried several variants including a level-0 property drawer and using 
#+PROPERTY :project_name project_name


(setq org-columns-default-format "%10CATEGORY %30ITEM %TODO %PRIORITY 
%20project_name %LastWorked(Last Worked On) %LastWorked(Hours Ago){@min} %FILE")

Custom agenda command:
("Z" "Last Worked skip" ((alltodo "" ((org-agenda-skip-function (lambda nil 
(org-agenda-skip-entry-if (quote notregexp) "\\:LastWorked\\:")))
(org-agenda-sticky nil)
(org-agenda-view-columns-initially t)  <<

[O] 63 failures for org-test-run-all-tests in an Emacs GUI

2014-12-22 Thread Sebastien Vauban
Hello,

I just ran `org-test-run-all-tests' in my active WinNT Emacs session
(with Org-mode release_8.3beta-677-g0497e3), and was surprised by the
high number of failures:

--8<---cut here---start->8---
Selector: "\\(org\\|ob\\)"
Passed:  332
Failed:  63 (53 unexpected)
Skipped: 0
Total:   395/395

Started at:   2014-12-22 16:34:06+0100
Finished.
Finished at:  2014-12-22 16:34:42+0100

FFF.FFF...ff..FF.F.F.FF..FF...F.F.FF...F..F.F...F.F...F..F...FFFFF..F..F...F...

F ob-emacs-lisp/commented-last-block-line
(user-error "C-c C-c can do nothing useful at this location")

F ob-emacs-lisp/commented-last-block-line-no-var
(user-error "C-c C-c can do nothing useful at this location")

F ob-emacs-lisp/commented-last-block-line-with-var
(user-error "C-c C-c can do nothing useful at this location")

F ob-exp/noweb-on-export
Noweb header arguments export correctly.
(ert-test-failed
 ((should
   (equal
'("(message \"expanded1\")" "(message \"expanded2\")" ";; 
noweb-1-yes-start\n  (message \"expanded1\")\n  (message \"expanded1\")" ";; 
noweb-no-start\n  <>" ";; noweb-2-yes-start\n  (message 
\"expanded2\")\n  (message \"expanded2\")" ";; 
noweb-tangle-start\n<>\n<>")
(org-test-at-id "eb1f6498-5bd9-45e0-9c56-50717053e7b7"
  (org-narrow-to-subtree)
  (org-element-map ... ... ...
  :form
  (equal
   ("(message \"expanded1\")" "(message \"expanded2\")" ";; 
noweb-1-yes-start\n  (message \"expanded1\")\n  (message \"expanded1\")" ";; 
noweb-no-start\n  <>" ";; noweb-2-yes-start\n  (message 
\"expanded2\")\n  (message \"expanded2\")" ";; 
noweb-tangle-start\n<>\n<>")
   ("(message \"expanded1\")" "(message \"expanded2\")" ";; 
noweb-1-yes-start\n(message \"expanded1\")\n(message \"expanded1\")" 
";; noweb-no-start\n  <>" ";; noweb-2-yes-start\n(message 
\"expanded2\")\n(message \"expanded2\")" ";; noweb-tangle-start\n  
<>\n  <>"))
  :value nil :explanation
  (list-elt 2
(arrays-of-different-length 68 72 ";; noweb-1-yes-start\n  
(message \"expanded1\")\n  (message \"expanded1\")" ";; noweb-1-yes-start\n
(message \"expanded1\")\n(message \"expanded1\")" first-mismatch-at 23

F ob-exp/noweb-on-export-with-exports-results
Noweb header arguments export correctly using :exports results.
(error "<>could not be resolved (see 
`org-babel-noweb-error-langs')")

F ob-tangle/continued-code-blocks-w-noweb-ref
Test that the :noweb-ref header argument is used correctly.
(ert-test-failed
 ((should
   (re-search-forward
(regexp-quote tangled)
nil t))
  :form
  (re-search-forward "df|sed '1d'|awk '{print \\$5 \" \" \\$6}'|sort -n 
|tail -1|awk '{print \\$2}'" nil t)
  :value nil))

F test-ob-exp/org-babel-exp-src-blocks/w-no-headers2
Testing export without any headlines in the org-mode file.
(user-error "Abort")

F test-ob-python/colnames-no-header-argument-again
(ert-test-failed
 ((should
   (equal
'(... ... ...)
(org-babel-execute-src-block)))
  :form
  (equal
   (("a*")
("b*")
("c*"))
   "")
  :value nil :explanation
  (different-types
   (("a*")
("b*")
("c*"))
   "")))

F test-ob-python/colnames-yes-header-argument-again
(ert-test-failed
 ((should
   (equal
'(... hline ... ...)
(org-babel-execute-src-block)))
  :form
  (equal
   (("a")
hline
("b*")
("c*"))
   "")
  :value nil :explanation
  (different-types
   (("a")
hline
("b*")
("c*"))
   "")))

F test-ob/blocks-with-spaces
Test expansion of blocks followed by blank lines.
(ert-test-failed
 ((should
   (equal "#+BEGIN_SRC emacs-lisp\n(+ 1 2)\n#+END_SRC\n\n#+RESULTS:\n: 
3\n\n\n"
  (org-test-with-temp-text "#+BEGIN_SRC emacs-lisp\n(+ 1 
2)\n#+END_SRC\n\n\n"
(org-babel-execute-src-block)
(buffer-string
  :form
  (equal "#+BEGIN_SRC emacs-lisp\n(+ 1 2)\n#+END_SRC\n\n#+RESULTS:\n: 
3\n\n\n" "#+BEGIN_SRC emacs-lisp\n(+ 1 2)\n#+END_SRC\n\n#+results:\n: 3\n\n\n")
  :value nil :explanation
  (array-elt 44
 (different-atoms
  (82 "#x52" "?R")
  (114 "#x72" "?r")

F test-ob/commented-last-block-line-no-var
(user-error "C-c C-c can do nothing useful at this location")

F test-ob/commented-last-block-line-with-var
(user-error "C-c C-c can do nothing useful at this location")

F test-ob/noweb-expansion-1
(ert-test-failed
   

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

2014-12-22 Thread Sebastien Vauban
Hello,

Nicolas Goaziou wrote:
> Daniel Clemente  writes:
>> El Sat, 13 Dec 2014 15:10:32 +0100 Nicolas Goaziou va escriure:
>>>
>>> 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.

Regarding CLOCK lines, I guess we all agree it's not user-input, but
data managed by Org, right?

>>> 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.
>
> This is subjective.

I agree this is probably suggestive, but *I* also find it clearer to
have the indentation different for:

- user-inputted text
- Org-managed stuff (such as clock line, timestamps or property drawers)

Note that I wrote timestamps instead of planning info because I also
would find it clearer to get:

>>  Some text
>>  [2014-12-14 Sun 18:55]

than

>>  Some text
>> [2014-12-14 Sun 18:55]

(when one wants to insert the timestamp in a captured note or task)

> Again, I suggest to sync indentation of planning info and all adjacent
> drawers. Nothing smarter.

Including the LOGBOOK, then?  That would already fulfill several above
cases IIUC -- not the timestamp one, though.

Best regards,
  Seb

-- 
Sebastien Vauban




[O] Drupal Orgmode Project Released

2014-12-22 Thread David Arroyo Menendez

Hello,

I'm happy to announce that Drupal Orgmode has been released in
https://www.drupal.org/project/orgmode as official drupal project.

Thanks to everyone.



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

2014-12-22 Thread Rasmus
Hi,

Thanks again!

Nicolas Goaziou  writes:

>> 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 ⋯)?
>
> It is. Binding between the symbol and the marker disappears with the
> `let', but the marker still exists. It cannot be GC'ed unless it is set
> to nil.
>
> It is not terribly important here as we're working in a temporary buffer
> anyway, so the marker will ultimately disappear at the end of the export
> process. However, it's a good habit to have.

Thanks for the explanation.

>> 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.
>
> I wasn't clear. The check is important. The minor issue is that you bind
> LABEL and FOOTNOTE-TYPE too early, before making sure you are at
> a footnote reference. It would be more logical to do
>
>   (let ((object (org-element-context)))
> (when (eq (org-element-type object) 'footnote-reference)
>   (let ((footnote-type (org-element-property :type object))
> (label (org-element-property :label object)))
> ...)))

I see.  I disagree that it's more since it's directly inside a loop over
org-footnote-re.  So if we are not at a footnote-{reference,definition}
it's probably a bug in the regexp. 

>> 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?
>
> [fn: ref with space]

While your comment excels in preciseness the terseness makes it hard to
appreciate its depth.  In my org-installation "[fn: ref with space]" is
not a valid footnote.

>> +  (when (and (not included) (> (hash-table-count footnotes) 0))
>> +(org-with-wide-buffer
>> + (goto-char (point-max))
>> + (unless (bolp) (insert "\n"))
>> + (maphash (lambda (ref def) (insert (format "[%s] %s\n" ref 
>> def)))
>> +  footnotes)))
>
>   (unless included ...)
>
> is sufficient. No need to check for table emptiness (although it doesn't
> cost much): maphash will simply do nothing.

Thanks.  It's not necessary anymore.

>> +  (let ((marker-min (point-min-marker))
>
> This marker is not necessary since you're not going to add contents
> before (point-min) anyway. A plain number is enough.

I might if I include *Bar here:

* Foo
[1] foo

* Bar
Baz[1]



>> +(goto-char (point-min))
>> +(while (re-search-forward org-footnote-re nil t)
>> +  (let* ((reference (org-element-context))
>> + (label (org-element-property :label reference))
>> + (digit-label (and label (org-string-match-p "\\`[0-9]+\\'" 
>> label
>> +(when (eq (org-element-type reference) 'footnote-reference)
>
> See above about order of bindings.

Adopted and commented on above.

>> +  (goto-char (1+ (org-element-property :begin reference)))
>> +  (when label
>> +(let ((new-label
>> +   (buffer-substring-no-properties
>> +(point)
>> +(progn (if digit-label (insert (format "fn:%d-" id))
>> + (forward-char 3)
>> + (insert (format "%d-" id)))
>> +   (1- (search-forward "]"))
>
>> +  (unless (eq (org-element-property :type reference) 'inline)
>
> A comment about what we're going to do would be nice.

Comments are added.

—Rasmus

-- 
I feel emotional landscapes they puzzle me
>From d1e02f19e20341a650164f7bfb9aea97465225e1 Mon Sep 17 00:00:00 2001
From: rasmus 
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  | 94 +++--
 testing/lisp/test-ox.el | 32 +++--
 2 files changed, 98 insertions(+), 28 deletions(-)

diff --git a/lisp/ox.el b/lisp/ox.el
index 9d9e794..6f3888b 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 al

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

2014-12-22 Thread Nicolas Goaziou
Daniel Clemente  writes:

> El Sat, 13 Dec 2014 15:10:32 +0100 Nicolas Goaziou va escriure:
>>
>> 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.

It matters here. You want to control indentation of what is handled by
Org.

>> 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.

This is subjective.

> 2) violating the rule you said: new lines should be indented at the
> same level as the element above.

It doesn't. Headline has level 0 indentation (per
`org-adapt-indentation'), so are properties drawer and paragraph.

>   I want no change at all? No, my proposal is to move planning info in the
> top and not move the things below it.

As explained already in this thread, the problem is not about planning
info, but about regular drawers.

>   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

See: this is not about planning info.

Again, it is not desirable to decide to move an element by its type
because it could alter structure of the document. In the following
example, demoting headline would move the clock drawer within the list,
which was not intended initially.

  * Headline
- something
:CLOCK:
...
:END:

Elements can only be moved by their location. Hence, planning info and
properties drawer can be freely indented, not because of their type, but
because their location prevent them from altering the structure of the
section.

>   "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 don't mind the name, but I need to find a proper definition for it.

>   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.

I think the default is fine. Your use-case doesn't look like a default
one.

>> Another option would be to have another option to indent only planning
>> info, properties drawer, and every drawer located right after it, à la
>> `org-log-state-notes-insert-after-drawers'. At least, it couldn't break
>> structure.
>>
>   Interesting. Yes, you could indent until (org-log-beginning).
>   That would exclude notes, which are more akin to text than to drawers.
> Users who want to force indent notes could switch to a full indentation
> that shifts everything including contents.

No. `org-log-beginning' is not a good idea. It can be located before,
after, or even in the middle of CLOCK lines.

Again, I suggest to sync indentation of planning info and all adjacent
drawers. Nothing smarter.


Regards,



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

2014-12-22 Thread Nicolas Goaziou
Rasmus  writes:

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

Thanks. Another round of comments follows.

> 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 ⋯)?

It is. Binding between the symbol and the marker disappears with the
`let', but the marker still exists. It cannot be GC'ed unless it is set
to nil.

It is not terribly important here as we're working in a temporary buffer
anyway, so the marker will ultimately disappear at the end of the export
process. However, it's a good habit to have.

>>> +   (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.

I wasn't clear. The check is important. The minor issue is that you bind
LABEL and FOOTNOTE-TYPE too early, before making sure you are at
a footnote reference. It would be more logical to do

  (let ((object (org-element-context)))
(when (eq (org-element-type object) 'footnote-reference)
  (let ((footnote-type (org-element-property :type object))
(label (org-element-property :label object)))
...)))

> 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?

[fn: ref with space]

> * test-ox.el (test-org-export/expand-include): Add test for INCLUDE with 
> :lines and footnotes.

Line is too long.

> +   (when (and (not included) (> (hash-table-count footnotes) 0))
> + (org-with-wide-buffer
> +  (goto-char (point-max))
> +  (unless (bolp) (insert "\n"))
> +  (maphash (lambda (ref def) (insert (format "[%s] %s\n" ref 
> def)))
> +   footnotes)))

  (unless included ...)

is sufficient. No need to check for table emptiness (although it doesn't
cost much): maphash will simply do nothing. If

  (unless (bolp) (insert "\n"))

bothers you, you can drop it and use

  (lambda (ref def) (insert (format "\n[%s] %s\n" ref def)))

in the maphash instead.

> +  (let ((marker-min (point-min-marker))

This marker is not necessary since you're not going to add contents
before (point-min) anyway. A plain number is enough.

> + (marker-max (point-max-marker)))

As explained above, don't forget

  (set-marker marker-max nil)

at the end of the `let'.

> + (goto-char (point-min))
> + (while (re-search-forward org-footnote-re nil t)
> +   (let* ((reference (org-element-context))
> +  (label (org-element-property :label reference))
> +  (digit-label (and label (org-string-match-p "\\`[0-9]+\\'" 
> label
> + (when (eq (org-element-type reference) 'footnote-reference)

See above about order of bindings.

> +   (goto-char (1+ (org-element-property :begin reference)))
> +   (when label
> + (let ((new-label
> +(buffer-substring-no-properties
> + (point)
> + (progn (if digit-label (insert (format "fn:%d-" id))
> +  (forward-char 3)
> +  (insert (format "%d-" id)))
> +(1- (search-forward "]"))

> +   (unless (eq (org-element-property :type reference) 'inline)

A comment about what we're going to do would be nice.

> + (org-with-wide-buffer
> +  (let* ((definition (org-footnote-get-definition label))
> + (beginning (set-marker (make-marker) (nth 1 
> definition

Nitpick:

  (beginning (copy-marker (nth 1 definition)))
  
> +(goto-char (1+ beginning))
> +(if digit-label (insert (format "fn:%d-" id))
> +  (forward-char 3)
> +  (insert (format "%d-" id)))
> +(when (or (< beginning marker-min) (> beginning 
> marker-max))
> +  (puthash new-label (nth 3 definition)
> +   footnotes

  (set-marker beginning nil)


Regards,


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

2014-12-22 Thread Rasmus
Hi,

t...@evon.thierry-pelle.eu (Thierry Pellé) writes:

Thanks for the patch.  In addition to Aaron's comments I think there's a typo.

> 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.
  ^  "the state" or "states".  Also state of what?
 Computations?
 Maybe "where computations and variables are preserved", or
 something like that...
> All code blocks sharing the same name are exectuted by the same interpreter 
> process.  By default, a session is not started.

—Rasmus

-- 
Dobbelt-A




Re: [O] org-agenda-todo-ignore-timestamp vs org-agenda-todo-ignore-with-date

2014-12-22 Thread Sebastien Vauban
Hello Marcin,

Marcin Borkowski wrote:
> I vaguely remember asking about this some time ago, but could not find
> that thread.

Here is the thread you're looking for:

http://lists.gnu.org/archive/html/emacs-orgmode/2014-08/msg00798.html

(thanks G G in Gnus).

Best regards,
  Seb

-- 
Sebastien Vauban



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

2014-12-22 Thread Nicolas Goaziou
Rasmus  writes:

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

Thanks. Two minor comments follow.

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

Bug-fix I'd say. There was an attempt to do it (see MINLEVEL binding),
but it was incorrect.

> +;; Add :minlevel to all include words that no explicitly have one.

Please update this comment, as it is no longer valid (property instead
of :minlevel). In particular, it would be nice to describe how we
use :org-include-induced-level.

>  (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))

Properties are usually keywords, not plain symbols. Also, for single
properties, `put-text-property' is slightly more lightweight.

(put-text-property (line-beginning-position) (line-end-position) 
   :org-include-induced-level
   (1+ (org-reduced-level (or (org-current-level) 0

> +  (get-text-property (point) 
> 'org-include-induced-level

As a consequence:

  (get-text-property (point) :org-include-induced-level)

You can push the patch once this is fixed.


Regards,