[O] Python with org-mode

2019-03-29 Thread Lawrence Bottorff
I've seen many "start using Python" parades, but what is the best way to
use Python with org-mode, i.e., in babel source blocks? I'm on U18.10,
which comes with standard 2 (2.7.15+) and 3 (3.6.7). But then I keep
hearing about Anaconda. Your opinions, experiences, please.

LB


[O] [PATCH] Make org-babel-result-end work with :wrap keyword

2019-03-29 Thread Bosché Aurélien
It seems that the :wrap header argument and the append option to 
the

:results header argument are incompatible in source blocks.

The reason is that `org-babel-result-end` does not find the end of 
the results when :wrap is used and this is due to `org-babel-result-end` only 
looking for blocks of type among `(drawer example-block export-block fixed-width item plain-list 
src-block table)` while the :wrap header argument produces blocks 
of type `special-block`. Appending `special-block` to the previous list seems to work.


It has already been discussed in this thread
http://lists.gnu.org/archive/html/emacs-orgmode/2018-10/threads.html#00393
which ends in a patch request that AFAIK has never been sent.

Below is a patch. I also added some precisions in the docs 
concerning the raw option to the :results header argument (I am 
not a native speaker so do not hesitate to change my wording). I 
tried those changes on the master branch (commit a9d3eaa9f) and no 
new errors showed up during the ERT tests (4 tests failed but 
already failed without this fix). I also tried exporting to html 
and latex and it seemed to work fine here.


>From 3a7beadcc2a1d9e8d7b7f520f4caa992b2b1e6c2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Aur=C3=A9lien=20Bosch=C3=A9?= 
Date: Thu, 28 Mar 2019 17:25:15 +0100
Subject: [PATCH 1/2] Make org-babel-result-end work with :wrap keyword

---
 lisp/ob-core.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index 7591e99ca..6f99ca6f2 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -2486,7 +2486,7 @@ in the buffer."
 	   (if (memq (org-element-type element)
 		 ;; Possible results types.
 		 '(drawer example-block export-block fixed-width item
-			  plain-list src-block table))
+			  plain-list src-block table special-block))
 	   (save-excursion
 		 (goto-char (min (point-max) ;for narrowed buffers
  (org-element-property :end element)))
-- 
2.21.0

>From a424317301c738e5d9d0325b594ff31be664d41c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Aur=C3=A9lien=20Bosch=C3=A9?= 
Date: Fri, 29 Mar 2019 07:46:42 +0100
Subject: [PATCH 2/2] Docs: specify that raw option does not delimit the
 results

---
 doc/org-manual.org | 27 ++-
 1 file changed, 18 insertions(+), 9 deletions(-)

diff --git a/doc/org-manual.org b/doc/org-manual.org
index b818b4bae..d006c5b73 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -17275,8 +17275,10 @@ follows from the type specified above.
 
 - =raw= ::
 
-  Interpreted as raw Org mode.  Inserted directly into the buffer.
-  Aligned if it is a table.  Usage example: =:results value raw=.
+  Interpreted as raw Org mode. Inserted directly into the buffer.
+  Aligned if it is a table. No delimiters are added to mark the end of
+  the raw output so options like =replace=, =append= and =prepend=
+  won't work as intended. Usage example: =:results value raw=.  
 
 #+cindex: @samp{wrap}, header argument
 The =wrap= header argument unconditionnally marks the results block by
@@ -17286,14 +17288,14 @@ specified, Org wraps the results in a =#+BEGIN_results=
 value listed above.  E.g.,
 
 #+begin_example
-,#+BEGIN_SRC emacs-lisp :results html :wrap EXPORT markdown
-"Welcome back to the 90's"
-,#+END_SRC
+  ,#+BEGIN_SRC emacs-lisp :results html :wrap EXPORT markdown
+  "Welcome back to the 90's"
+  ,#+END_SRC
 
-,#+RESULTS:
-,#+BEGIN_EXPORT markdown
-Welcome back to the 90's
-,#+END_EXPORT
+  ,#+RESULTS:
+  ,#+BEGIN_EXPORT markdown
+  Welcome back to the 90's
+  ,#+END_EXPORT
 #+end_example
 
 *** Handling
@@ -17325,6 +17327,13 @@ Handling options after collecting the results.
   Does not remove previous results.  Usage example: =:results output
   prepend=.
 
+Options =replace=, =append= and =prepend= need to find the end of the
+previously inserted results and so won't work as intended if the =raw=
+option to the =results= header argument was in force. In this case
+consider using the =:wrap= header argument.
+
+Handling options after collecting the results.
+
 *** Post-processing
 :PROPERTIES:
 :UNNUMBERED: notoc
-- 
2.21.0



<#secure method=pgpmime mode=sign>
--
Bosché Aurélien


[O] Interaction of Agenda with DEADLINE & SCHEDULED

2019-03-29 Thread Stephan Fabel
When creating a custom agenda view, it is often desirable to express a
relationship between a given task and meaningful dates, such as DEADLINE
and SCHEDULED. It seems that with org-mode, and especially in the agenda
view, it is not (yet?) possible to express that.

For example, how would one create a custom agenda view that

- shows all accomplished tasks within the DEADLINE last week
- shows all accomplished tasks that missed the DEADLINE last week

Then does the same for the coming week, i.e.

- show all tasks which are due in the next week, i.e., within the
  DEADLINE
- show all tasks which are overdue

Ideally, the interaction could even be more informational, so for
example, analysis of the available work time next week (assuming 40
hours for example) vs. the total estimated effort of all of the above
tasks, helping to answer the question of whether all tasks are even
achievable given the amount of available work time.

Another potential -and very valuable- analysis could be a recommendation
of order given DEADLINE, priority and effort over a period of time, for
example the next week. What should one do first, then second, etc. to
maximize output over a given period of time?

I have been looking for a discussion of these type of questions in the
documentation, worg and other places like EmacsWiki and haven't really
found anything.

Thanks for any pointers,

Stephan






Re: [O] Smart archiving of subtrees with parent headlines

2019-03-29 Thread Ken Mankoff


On 2019-03-29 at 03:23 +0100, Mark Edgington  wrote...
> But it sounds like you're saying that it won't work with the latest
> git versions?

elpa, not git. But yes, this code is expecting and calling functions no longer 
in the core code.

  -k.