Re: [O] ob-python newline & indentation behavior

2017-11-20 Thread Kyle Meyer
Jack Kamm  writes:

> In response to this:
>
>> I can't think of a good solution, though.  Stepping back a bit, I think
>> it's unfortunate that python blocks handle ":results value" differently
>> depending on whether the block is hooked up to a session or not.  For
>> non-sessions, you have to use return.  Using the same approach
>> (org-babel-python-wrapper-method) for ":session :results value", we
>> could then get the return value reliably, but the problem with this
>> approach is that any variables defined in a ":results value" block
>> wouldn't be defined in the session after executing the block because the
>> code is wrapped in a function.
>
> How about if we used the "globals()" and "locals()" functions in Python?
>
> Something like this at the end of the wrapper block, before return:
>
> for k, v in locals().items():
> globals()[k] = v

Hmm, placing that code "before return" is a problem.  Like with
non-session ":results value" blocks, the user would be responsible for
inserting the return (or even multiple return's), so we can't know where
to insert the above code without parsing the block :/

> Another bug with the current approach is that it breaks if common idioms
> like "for _ in range(10)" are used. ("_" is used to inspect the last output
> of the shell, an obscure feature I hadn't known about until now).

Right.  Also, IIRC the built-in interactive python and ipython treat
multiline blocks differently.  With

if True:
"ipython ignores my existence"

the built-in shell binds "_" to the string's value, but ipython doesn't.

-- 
Kyle



Re: [O] Potential bug: embedded dot fails on require ob-graphviz-dot

2017-11-20 Thread Eric Thomas
Charles,

I just started using dot in org-mode (and I love it). Had no problems at
all so far.

Here are my specs:

* Emacs 25.3.1
* Org 9.1.2
* Here is my .init file

* Here is an example of dot in action in orgmode


Maybe you can glean something from this that helps.

Cheers

> --
>
> Message: 2
> Date: Sat, 18 Nov 2017 12:57:34 -0700
> From: "Charles R (Charlie) Martin" 
> To: emacs-orgmode@gnu.org
> Subject: [O] Potential bug: embedded dot fails on require
> ob-graphviz-dot
> Message-ID:
> 
> Content-Type: text/plain; charset="utf-8"
>
> I'm trying to use `dot` inside `org-mode` and having no luck, because when
> I evaluate
>
> (org-babel-do-load-languages
>  'org-babel-load-languages
>  '((dot . t)))
>
> it tries to require `ob-graphviz-dot` -- unsuccessfully.
>
> Debugger entered--Lisp error: (file-error "Cannot open load file" "No
> such file or directory" "ob-graphviz-dot")
>   require(ob-graphviz-dot)
>
> I can't find `ob-graphviz-dot` anywhere.
> -- next part --
> An HTML attachment was scrubbed...
> URL: <
http://lists.gnu.org/archive/html/emacs-orgmode/attachments/20171118/81009c69/attachment.html
>
>


[O] Bug: ordered property blocks grandchildren [9.1.3 (9.1.3-elpaplus @ ~/.emacs.d/elpa/org-plus-contrib-20171116/)]

2017-11-20 Thread Allen Li
Create a file tmp.org with contents

* TODO parent
  :PROPERTIES:
  :ORDERED:  t
  :END:
** TODO child1
** TODO child2
*** TODO grandchild1
*** TODO grandchild2

1. emacs -Q
2. M-: (setq org-enforce-todo-dependencies t) RET
3. C-x C-f tmp.org RET
4. Move point to grandchild2
5. C-c C-t

user-error: TODO state change from TODO to DONE blocked (by "TODO child1")

The documentation emphasizes that ORDERED is not inherited.  The
behavior that I would expect is that child1 blocks child2, but it should
not block grandchild1 or grandchild2.

However, I think the current behavior is also reasonable under some
workflows.  I’m creating a bug to track opinions, if one behavior is
significantly more desired than the other, or if an option to control
this behavior would be welcome.

Emacs  : GNU Emacs 25.2.50.1 (x86_64-pc-linux-gnu, GTK+ Version
3.22.11), modified by Debian
Package: Org mode version 9.1.3 (9.1.3-elpaplus @
/usr/local/google/home/ayatane/.emacs.d/elpa/org-plus-contrib-20171116/)



Re: [O] ob-python newline & indentation behavior

2017-11-20 Thread Jack Kamm
Hi Kyle,

In response to this:

I can't think of a good solution, though.  Stepping back a bit, I think
> it's unfortunate that python blocks handle ":results value" differently
> depending on whether the block is hooked up to a session or not.  For
> non-sessions, you have to use return.  Using the same approach
> (org-babel-python-wrapper-method) for ":session :results value", we
> could then get the return value reliably, but the problem with this
> approach is that any variables defined in a ":results value" block
> wouldn't be defined in the session after executing the block because the
> code is wrapped in a function.
>

How about if we used the "globals()" and "locals()" functions in Python?

Something like this at the end of the wrapper block, before return:

for k, v in locals().items():
globals()[k] = v


I think this would work a lot better than the current approach.

Another bug with the current approach is that it breaks if common idioms
like "for _ in range(10)" are used. ("_" is used to inspect the last output
of the shell, an obscure feature I hadn't known about until now).

Thanks for reviewing my suggested changes. Might be a few days until I can
submit a new patch but I will incorporate your other suggestions. Waiting
for the FSF forms anyways.

Jack


[O] [PATCH] make org-comment-dwim comment headings if on a heading

2017-11-20 Thread Alex Branham
This patch changes the behavior of `org-comment-dwim' so that if point is on a 
heading, it will toggle the heading.

Alex

>From 655cd7afdfdf28797052952eae0c4e87cd86f445 Mon Sep 17 00:00:00 2001
From: Alex Branham 
Date: Mon, 20 Nov 2017 15:12:34 -0600
Subject: [PATCH] Make org-comment-dwim comment headings if point is at heading

* listp/org.el (org-comment-dwim): If point is on heading, call
  org-toggle-comment.
---
 lisp/org.el | 13 +
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index f873f1021..25fa3a533 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -22817,11 +22817,16 @@ strictly within a source block, use appropriate 
comment syntax."
(forward-line)
 
 (defun org-comment-dwim (_arg)
-  "Call `comment-dwim' within a source edit buffer if needed."
+  "Call the comment command you mean.
+
+Calls `org-toggle-comment' if on a heading, otherwise call
+`comment-dwim' (within a source edit buffer if needed)."
   (interactive "*P")
-  (if (org-in-src-block-p)
-  (org-babel-do-in-edit-buffer (call-interactively 'comment-dwim))
-(call-interactively 'comment-dwim)))
+  (cond ((org-at-heading-p)
+(call-interactively #'org-toggle-comment))
+   ((org-in-src-block-p)
+(org-babel-do-in-edit-buffer (call-interactively #'comment-dwim)))
+   (t (call-interactively #'comment-dwim
 
 
 ;;; Timestamps API
-- 
2.15.0



>From 43fd460accf071e1c69df5fcbbcce0e4943563f2 Mon Sep 17 00:00:00 2001
From: Alex Branham 
Date: Mon, 20 Nov 2017 15:08:09 -0600
Subject: [PATCH] Make org-comment-dwim check if on a heading

* lisp/org.el (org-comment-dwim): if on a heading, comment the heading
---
 lisp/org.el | 13 +
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index f873f1021..81bc9278f 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -22817,11 +22817,16 @@ strictly within a source block, use appropriate comment syntax."
 		(forward-line)
 
 (defun org-comment-dwim (_arg)
-  "Call `comment-dwim' within a source edit buffer if needed."
+  "Call the comment command you mean.
+
+Calls `org-toggle-comment' if on a heading, otherwise call
+`comment-dwim' (within a source edit buffer if needed)."
   (interactive "*P")
-  (if (org-in-src-block-p)
-  (org-babel-do-in-edit-buffer (call-interactively 'comment-dwim))
-(call-interactively 'comment-dwim)))
+  (cond ((org-on-heading-p)
+	 (call-interactively #'org-toggle-comment))
+	((org-in-src-block-p)
+	 (org-babel-do-in-edit-buffer (call-interactively #'comment-dwim)))
+	(t (call-interactively #'comment-dwim
 
 
 ;;; Timestamps API
-- 
2.15.0



Re: [O] Public TODO agendas

2017-11-20 Thread Tim Cross

I don't think tramp will work in this way, at least not without some
sort of special client running on the remote http server and
modifications to tramp to work with that client. The HTTP protocol will
not easily fit with tramp - in fact, it is such a big 'disconnect'
between tramp and http, you really would be trying to push a round peg
into a square hole. It would be far easier to use other built-in bits of
Emacs functionality along with some sort of remote http service agent to
satisfy this use case (assuming you want bi-directional updates
i.e. pull down an org file, update and push back up - just pulling down
the file and appending it would be easy enough, but going the other way
adds a lot of additional complexity). 

Perhaps this is more something which could fit in with mobile org
efforts?

Tim



Eric S Fraga  writes:

> On Monday, 20 Nov 2017 at 21:13, numbch...@gmail.com wrote:
>> I have similar function requirement. Based on your TRAMP method, I think
>> remote file are just can be transported through any protocols like HTTP,
>> for example remote file like http://example.org/test.org can be downloaded,
>> then append to org-agenda files list. This is just an rough idea.
>
> I am not sure this is possible.  If I try http: as the protocol, tramp
> tells me that only localhost is allowed.  Maybe I do not have tramp
> configured properly?


-- 
Tim Cross



Re: [O] Org emphasis markers inside src blocks causes incorrect fontification

2017-11-20 Thread Kaushal Modi
On Fri, Nov 17, 2017 at 6:30 PM Nicolas Goaziou 
wrote:

>
> You may want to test the following rules and report if it fits your use
> case.
>

That patch works great! Thanks!
-- 

Kaushal Modi


Re: [O] function for inserting a block

2017-11-20 Thread Eric Abrahamsen
Rasmus  writes:

> Hi Eric,
>
>
>> It incorporates Rasmus' org-tempo.el file, with modifications, and
>> Thomas' suggestion to re-instate `org-try-structure-completion', and,
>> erm, stardiviner's request to honor
>> `org-babel-uppercase-example-markers'.
>>
>> Remaining issues:
>>
>> 1. The "org-include" tempo template doesn't work, for reasons I don't
>>understand (I've never used tempo before). Nothing happens when I hit
>>.
>> 2. Now it seems like there should be completion when prompting for a
>>string key. Feature creep! But likely worthwhile feature creep.
>> 3. I've rather rashly renamed the relevant customization options
>>`org-structure-block-alist' (for blocks added via
>>`org-insert-structure-template') and `org-structure-keyword-alist'
>>(for keywords insertable via the tempo system). Perhaps this was a
>>bad idea. If it's not a bad idea, maybe
>>`org-insert-structure-template' should be renamed `org-insert-block'
>>or something like that.
>> 3. Docs need to be updated.
>
> I will have a look at org-tempo and try to figure out why it isn’t
> working.  As it would probably warrant changes to ORG-NEWS and maybe the
> manual I will do it in a separate commit if people find it useful.

Thanks! NEWS and the manual will have to be updated, yes. But I still
think this whole change should go in at once, because we'll need to
coordinate the shift from char keys to string keys in both
`org-structure-block-alist' and `org-structure-keyword-alist' (or
whatever those end up getting named).

Eric




Re: [O] function for inserting a block

2017-11-20 Thread Rasmus
Hi Eric,


> It incorporates Rasmus' org-tempo.el file, with modifications, and
> Thomas' suggestion to re-instate `org-try-structure-completion', and,
> erm, stardiviner's request to honor
> `org-babel-uppercase-example-markers'.
>
> Remaining issues:
>
> 1. The "org-include" tempo template doesn't work, for reasons I don't
>understand (I've never used tempo before). Nothing happens when I hit
>.
> 2. Now it seems like there should be completion when prompting for a
>string key. Feature creep! But likely worthwhile feature creep.
> 3. I've rather rashly renamed the relevant customization options
>`org-structure-block-alist' (for blocks added via
>`org-insert-structure-template') and `org-structure-keyword-alist'
>(for keywords insertable via the tempo system). Perhaps this was a
>bad idea. If it's not a bad idea, maybe
>`org-insert-structure-template' should be renamed `org-insert-block'
>or something like that.
> 3. Docs need to be updated.

I will have a look at org-tempo and try to figure out why it isn’t
working.  As it would probably warrant changes to ORG-NEWS and maybe the
manual I will do it in a separate commit if people find it useful.

Rasmus
-- 
Hvor meget poesi tror De kommer ud af et glas isvand?




Re: [O] Bug: #+INCLUDE: :only-contents not recognized [9.1.2 (9.1.2-37-g3f8d67-elpa @ /home/data1/protected/.emacs.d/elpa/org-20171113/)]]

2017-11-20 Thread Rasmus
Jean Louis  writes:

> I can see that if I use:
>
> #+INCLUDE: "~/Documents/Org/With-Ease.org" :only-contents t
>
> that the #+TITLE variable is then included in the
> main file, and is concatenated to the main
> title. I am exporting "visible only" and that is
> happening. 
>
> That is not expected.
>
> If I try to export with subtree from a section, I
> do not get the #+TITLE of included file shown in
> ASCII export.
>
> Do I need to do something to avoid the title being
> exported wrongly?

I am not sure there is a well specified meaning for :only-contents when
you do not select an element.  :only-content refers to the content of an
element (try ‘org-element-at-point’ on a heading and check
:contents-begin).

Ways to archive what you want would be to select the right element or use
:lines "2-" to skip the title, if it’s on line 1.

Hope it helps.

Rasmus

-- 
Dung makes an excellent fertilizer




Re: [O] Public TODO agendas

2017-11-20 Thread Eric S Fraga
On Monday, 20 Nov 2017 at 21:13, numbch...@gmail.com wrote:
> I have similar function requirement. Based on your TRAMP method, I think
> remote file are just can be transported through any protocols like HTTP,
> for example remote file like http://example.org/test.org can be downloaded,
> then append to org-agenda files list. This is just an rough idea.

I am not sure this is possible.  If I try http: as the protocol, tramp
tells me that only localhost is allowed.  Maybe I do not have tramp
configured properly?

-- 
: Eric S Fraga via Emacs 27.0.50, Org release_9.1.3-162-gde289d


signature.asc
Description: PGP signature


Re: [O] Public TODO agendas

2017-11-20 Thread numbch...@gmail.com
I have similar function requirement. Based on your TRAMP method, I think
remote file are just can be transported through any protocols like HTTP,
for example remote file like http://example.org/test.org can be downloaded,
then append to org-agenda files list. This is just an rough idea.

[stardiviner] GPG key ID: 47C32433
IRC(freeenode): stardiviner Twitter:  @numbchild
Key fingerprint = 9BAA 92BC CDDD B9EF 3B36  CB99 B8C4 B8E5 47C3 2433
Blog: http://stardiviner.github.io/

On Mon, Nov 20, 2017 at 3:54 AM, Eric S Fraga  wrote:

> On Sunday, 19 Nov 2017 at 11:10, David Arroyo Menendez wrote:
> > Hello Colin,
> >
> > org-secretary seems designed to manage teams. I want read agendas of
> > org-mode users, friends ... In Barcelona Supercomputing Center all
> > people is sharing the agendas to stimulate to the people to collaborate
> > in good ideas, I like this methodology, but I prefer use org-mode. Many
> > people in org-mode is connected with the science or creative
> > programming, perhaps is a good idea share the agenda between us.
>
> I guess one approach could be to make specific agenda files available on
> a remote server and use tramp syntax to add these files to the
> org-agenda-files variable?  (untested)  Of course, this would be limited
> to those access methods defined for tramp, i.e. ssh in practice, which
> might be quite limiting.
>
> A more general approach would be to export your agenda to Google's
> calendar or equivalent and share that and import any shared calendar
> using an ical access to these.  This is possible (my wife and I share our
> calendars that way) but not purely org.
>
>
> --
> : Eric S Fraga via Emacs 27.0.50, Org release_9.1.3-162-gde289d
>


Re: [O] Deadline warning period, and property to override it

2017-11-20 Thread James Harkins
 On Mon, 20 Nov 2017 15:50:58 +0800 Eric S Fraga  wrote 
 
> On Sunday, 19 Nov 2017 at 10:54, James Harkins wrote: 
> > 2. Is there a property to override the warning period for specific 
> > headlines? For example, if I have a project due on a certain date, a 
> > two-week warning makes sense. But, for paying the rent, a two-week 
> > warning means that I see the warning for half the month, which is a 
> > bit too much. I'd like to make that one 7 days. 
>  
> you can specify the warning time directly in the time stamp.  See 
> example in the info manual (section 8.3: deadlines and scheduling). 

Perfect on both questions, thanks!

I overlooked the "-time" specifier, probably because it's in a longer paragraph 
with other points. Thanks for pointing me to the place where I should look 
closer.

hjh