Re: [O] evaluation issue with ocaml code (due to changes to org-babel-comint-with-output)

2015-12-16 Thread Alan Schmitt
Hello,

I finally found the issue (using the plain debugger): the call to
org-babel-comint-with-output was set to remove the echo, but the only
time there is an echo of the full body is when a single line function
has an error, and this echo is useful to show where the error is. Here
is a patch that makes sure the echo is kept.

From 59e6912e6bf769fff2f48b6c2af95bda918d0cd9 Mon Sep 17 00:00:00 2001
From: Alan Schmitt 
Date: Wed, 16 Dec 2015 21:19:23 +0100
Subject: [PATCH] ob-ocaml.el: Keep echo to display ocaml errors

* ob-ocaml.el (org-babel-execute:ocaml): call
`org-babel-comint-with-output' with nil `remove-echo' argument.
---
 lisp/ob-ocaml.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/ob-ocaml.el b/lisp/ob-ocaml.el
index 48f8aba..68ac859 100644
--- a/lisp/ob-ocaml.el
+++ b/lisp/ob-ocaml.el
@@ -66,7 +66,7 @@
  (session (org-babel-prep-session:ocaml
 		   (cdr (assoc :session params)) params))
  (raw (org-babel-comint-with-output
-		  (session org-babel-ocaml-eoe-output t full-body)
+		  (session org-babel-ocaml-eoe-output nil full-body)
 		(insert
 		 (concat
 		  (org-babel-chomp full-body) ";;\n"
-- 
2.6.4


For the record, the problem I wanted to fix.

On 2015-12-14 13:04, Alan Schmitt  writes:

>> I have found that commit f0bf77e82a3d37ba7548aa40198bc982e9875f1b breaks
>> evaluation of ocaml code. With the following init file (the
>> `package-initialize' is there for tuareg to be available):
>>
>> #+begin_src emacs-lisp
>> (add-to-list 'load-path "/Users/schmitta/projets/org-mode/lisp")
>>
>> (require 'org)
>>
>> (package-initialize)
>>
>> (org-babel-do-load-languages
>>  'org-babel-load-languages
>>  '((ocaml . t)))
>> #+end_src
>>
>> When I evaluate this block I get this result:
>>
>> #+BEGIN_SRC ocaml :results code verbatim :exports results
>> 1 + "toto";;
>> #+END_SRC
>>
>> #+results:
>> #+BEGIN_SRC ocaml
>> Characters 4-10:
>>   1 + "toto"
>>   ^^
>> Error: This expression has type string but an expression was expected of type
>>  int
>> #+END_SRC
>>
>> After commit f0bf77e82a3d37ba7548aa40198bc982e9875f1b I get this:
>>
>> #+results:
>> #+BEGIN_SRC ocaml
>> ;;
>>   ^^
>> Error: This expression has type string but an expression was expected of type
>>  int
>> #+END_SRC

Best,

Alan

-- 
OpenPGP Key ID : 040D0A3B4ED2E5C7
Athmospheric CO₂ (Updated December 13, 2015, Mauna Loa Obs.): 401.31 ppm


signature.asc
Description: PGP signature


Re: [O] proposed change of org-gnus-store-link for nnir groups

2015-12-16 Thread Nicolas Goaziou
Hello,

Thomas Alexander Gerds  writes:

> sometimes after searching for mail with notmuch, I want to save a link
> to one of the articles shown in the nnir summary. since nnir groups are
> temporary I would like org-gnus-store-link to treat nnir groups
> differently and to use the articles orginal group when creating the
> link. the following 3 lines change of org-gnus-store-link does this for
> me. if this is interesting for others maybe it could be integrated
> ... if not, I could either advice org-gnus-store-link or add a modified
> version to org-store-link-functions. comments?

Sounds good. Thank you.

>(when (eq (car (gnus-find-method-for-group gnus-newsgroup-name))
> 'nnvirtual)
>   (setq group (car (nnvirtual-map-article
> (gnus-summary-article-number)
> +  (when (eq (car (gnus-find-method-for-group gnus-newsgroup-name))
> + 'nnir)
> + (setq group  (nnir-article-group (gnus-summary-article-number

I think the above could be wrapped within a cl-case, if only to compute
(car (gnus-find-method-for-group gnus-newsgroup-name)) only once. Also,
it may require an entry in ORG-NEWS, and a proper commit message.

Would you mind sending an updated patch?


Regards,

-- 
Nicolas Goaziou



Re: [O] ret after link follows the link

2015-12-16 Thread Eric Abrahamsen
Samuel Wales  writes:

> in recent maint, it seems ret on link follows the link.  is this
> intended?  i thought we fixed that so you could do a ret after a link
> and get a newline?

Timestamps, too, which can be annoying in Capture buffers...




Re: [O] proposed change of org-gnus-store-link for nnir groups

2015-12-16 Thread Thomas Alexander Gerds

great. the updated patch is attached. for ORG-NEWS:

,
| *** Links
|  Links stored by org-gnus-store-link in nnir groups
| 
| Since gnus nnir groups are temporary, org-gnus-store-link
| now refers to the article's original group.
`

best 


Nicolas Goaziou  writes:

> Hello,
>
> Thomas Alexander Gerds  writes:
>
>> sometimes after searching for mail with notmuch, I want to save a
>> link to one of the articles shown in the nnir summary. since nnir
>> groups are temporary I would like org-gnus-store-link to treat nnir
>> groups differently and to use the articles orginal group when
>> creating the link. the following 3 lines change of
>> org-gnus-store-link does this for me. if this is interesting for
>> others maybe it could be integrated ... if not, I could either
>> advice org-gnus-store-link or add a modified version to
>> org-store-link-functions. comments?
>
> Sounds good. Thank you.
>
>>(when (eq (car (gnus-find-method-for-group
>> gnus-newsgroup-name)) 'nnvirtual) (setq group (car
>> (nnvirtual-map-article (gnus-summary-article-number) + (when (eq
>> (car (gnus-find-method-for-group gnus-newsgroup-name)) + 'nnir) +
>> (setq group (nnir-article-group (gnus-summary-article-number
>
> I think the above could be wrapped within a cl-case, if only to
> compute (car (gnus-find-method-for-group gnus-newsgroup-name)) only
> once. Also, it may require an entry in ORG-NEWS, and a proper commit
> message.
>
> Would you mind sending an updated patch?
>
> Regards,
Thomas A. Gerds -- Assoc. Prof. Department of Biostatistics
University of Copenhagen, Oester Farimagsgade 5, 1014 Copenhagen, Denmark
Office: CSS-15.2.07 (Gamle Kommunehospital)
tel: 35327914 (sec: 35327901) 

commit f56d29a57ed965029c1b5f3929f3085423e46f18
Author: Thomas Alexander Gerds 
Date:   Thu Dec 17 06:57:11 2015 +0100

org-gnus: avoid links to nnir groups

diff --git a/lisp/org-gnus.el b/lisp/org-gnus.el
index c7b46af..06ba4df 100644
--- a/lisp/org-gnus.el
+++ b/lisp/org-gnus.el
@@ -172,10 +172,12 @@ If `org-store-link' was called with a prefix arg the 
meaning of
   (subject (copy-sequence (mail-header-subject header)))
   (to (cdr (assq 'To (mail-header-extra header
   newsgroups x-no-archive desc link)
-  (when (eq (car (gnus-find-method-for-group gnus-newsgroup-name))
- 'nnvirtual)
-   (setq group (car (nnvirtual-map-article
- (gnus-summary-article-number)
+  (cl-case  (car (gnus-find-method-for-group gnus-newsgroup-name))
+   (nnvirtual 
+(setq group (car (nnvirtual-map-article
+  (gnus-summary-article-number)
+   (nnir
+(setq group (nnir-article-group (gnus-summary-article-number)
   ;; Remove text properties of subject string to avoid Emacs bug
   ;; #3506
   (set-text-properties 0 (length subject) nil subject)


[O] Remaining time in effort estimates

2015-12-16 Thread Michael Gummelt
Hi,

I set effort estimates on a list of subtasks.  I can sum those estimates as
described here: http://orgmode.org/manual/Effort-estimates.html

What I'd like to do is see the remaining effort estimate time in the
supertask.  For example, if I have a supertask with 10 subtasks, and I mark
3 of them complete, I'd like to see the sum of the 7 incomplete tasks.  The
link above shows how you can view a CLOCKSUM, but that is a different value.

Knowing how long is remaining on a supertask seems to be a fundamental
feature for project management.  Is there any solution in org mode?

Thanks,
Michael Gummelt


[O] ret after link follows the link

2015-12-16 Thread Samuel Wales
in recent maint, it seems ret on link follows the link.  is this
intended?  i thought we fixed that so you could do a ret after a link
and get a newline?



Re: [O] Converting paragraph to plain lis

2015-12-16 Thread John Kitchin
Here is a solution that works on your paragraph.

#+BEGIN_SRC emacs-lisp
(defun explode-paragraph ()
  (interactive)
  (let (start end)
;; narrow to paragraph
(backward-paragraph) (forward-line)
(setq start (point))
(forward-paragraph) (previous-line)
(setq end (point))

;; now move by sentence, insert number and \n. at the end go to beginning
;; insert a number and use C-cC-c to renumber the list.
(save-restriction
  (narrow-to-region start end)
  (goto-char (point-min))
  (while (< (point) (point-max))
(forward-sentence)
(insert "\n1. "))
  (goto-char (point-min))
  (insert "1. ")
  (org-ctrl-c-ctrl-c

(defun unfill-paragraph ()
  "Unfill paragraph at or after point."
  (interactive "*")
  (let ((fill-column most-positive-fixnum))
(fill-paragraph nil (region-active-p

(defun list-to-paragraph ()
  "Convert list at point to a paragraph."
  (interactive)
  ;; make sure we are at the beginning of the list
  (beginning-of-line)
  (let ((element (org-element-context))
contents)
(when (eq 'item (car element))
  (setq element (org-element-property :parent (org-element-context)))
  (goto-char
   (org-element-property
:begin
element)))
;; collect each sentence, minus the numbers.
(setq contents (loop for node in
 (org-element-property :structure element)
 collect
 ;; remove number and space
 (replace-regexp-in-string
  (regexp-quote (nth 2 node)) ""
  (buffer-substring (nth 0 node)
(nth 6 node)
;; replace the list, and then unfill the paragraph.
(setf (buffer-substring (org-element-property :begin element)
(- (org-element-property :end element) 1))
  (mapconcat 'identity contents ""))
(goto-char (org-element-property :begin element))
(unfill-paragraph)))
#+END_SRC

marvin doyley writes:

> Hi there,
>
> Does anybody know how to convert a paragraph to a plain list, and vice versa. 
> For example, I would like to convert
>
> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse viverra 
> consectetur euismod. Donec non tempor turpis.
>
> to
>
> 1. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
>  2.  Suspendisse viverra consectetur euismod.
> 3.  Donec non tempor turpis.
>
> In one key stroke, this would speed up my brain storming process.
>
> Thanks,
> M

--
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu



[O] Fwd: Converting paragraph to plain lis

2015-12-16 Thread Doyley, Marvin M.
Hi John,
I really appreciate this.
Cheers,
M
---





Begin forwarded message:

From: John Kitchin >
Date: December 16, 2015 at 6:38:51 AM EST
To: marvin doyley >
Cc: emacs-orgmode@gnu.org
Subject: Re: [O] Converting paragraph to plain lis

Here is a solution that works on your paragraph.

#+BEGIN_SRC emacs-lisp
(defun explode-paragraph ()
 (interactive)
 (let (start end)
   ;; narrow to paragraph
   (backward-paragraph) (forward-line)
   (setq start (point))
   (forward-paragraph) (previous-line)
   (setq end (point))

   ;; now move by sentence, insert number and \n. at the end go to beginning
   ;; insert a number and use C-cC-c to renumber the list.
   (save-restriction
 (narrow-to-region start end)
 (goto-char (point-min))
 (while (< (point) (point-max))
   (forward-sentence)
   (insert "\n1. "))
 (goto-char (point-min))
 (insert "1. ")
 (org-ctrl-c-ctrl-c

(defun unfill-paragraph ()
 "Unfill paragraph at or after point."
 (interactive "*")
 (let ((fill-column most-positive-fixnum))
   (fill-paragraph nil (region-active-p

(defun list-to-paragraph ()
 "Convert list at point to a paragraph."
 (interactive)
 ;; make sure we are at the beginning of the list
 (beginning-of-line)
 (let ((element (org-element-context))
   contents)
   (when (eq 'item (car element))
 (setq element (org-element-property :parent (org-element-context)))
 (goto-char
  (org-element-property
   :begin
   element)))
   ;; collect each sentence, minus the numbers.
   (setq contents (loop for node in
(org-element-property :structure element)
collect
;; remove number and space
(replace-regexp-in-string
 (regexp-quote (nth 2 node)) ""
 (buffer-substring (nth 0 node)
   (nth 6 node)
   ;; replace the list, and then unfill the paragraph.
   (setf (buffer-substring (org-element-property :begin element)
   (- (org-element-property :end element) 1))
 (mapconcat 'identity contents ""))
   (goto-char (org-element-property :begin element))
   (unfill-paragraph)))
#+END_SRC

marvin doyley writes:

Hi there,

Does anybody know how to convert a paragraph to a plain list, and vice versa. 
For example, I would like to convert

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse viverra 
consectetur euismod. Donec non tempor turpis.

to

1. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
2.  Suspendisse viverra consectetur euismod.
3.  Donec non tempor turpis.

In one key stroke, this would speed up my brain storming process.

Thanks,
M

--
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu



Re: [O] Converting paragraph to plain lis

2015-12-16 Thread Marcin Borkowski


On 2015-12-16, at 01:27, marvin doyley  wrote:

> Hi there,
>
> Does anybody know how to convert a paragraph to a plain list, and vice versa. 
> For example, I would like to convert 
>
> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse viverra 
> consectetur euismod. Donec non tempor turpis. 
>
> to 
>
> 1. Lorem ipsum dolor sit amet, consectetur adipiscing elit. 
>  2.  Suspendisse viverra consectetur euismod.
> 3.  Donec non tempor turpis. 
>
> In one key stroke, this would speed up my brain storming process.

1. A keyboard macro, or
2. Some elisp involving =forward-sentence=.

I don't have time to write this now (I have a lecture soon), but I might
e.g. in the afternoon, if there's still demand.

> Thanks,
> M

Hth,

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University



Re: [O] Wrapping section within LaTeX environment

2015-12-16 Thread Xavier Garrido

Hi Robert,

Le 16/12/2015 04:41, Robert Klein a écrit :

Hi

On 12/13/2015 03:00 PM, Xavier Garrido wrote:

Dear orgers,

I would like to wrap a given org section between =\begin,\end= LaTeX
environment. These sections are identified by a special tag :correction:
and to initiate the =\begin= flag I have basically no problem by using
the  org-export-filter-headline-function filter. The problem comes when
I want to close the environment i.e. when another section starts. I have
try this piece of code

#+BEGIN_SRC emacs-lisp
   (setq correction-flag nil)
   (defun cpp-correction-headline (contents backend info)
 (if (and (org-export-derived-backend-p backend 'latex)
(string-match "\\`.*correction.*\n" (downcase contents)))
 (progn
   (setq correction-flag t)
   (replace-match "begin{correction}" nil nil contents)
   )
   (when correction-flag
 (setq correction-flag nil)
 (concat "\\end{correction}" contents))
   )
 )
   (add-to-list 'org-export-filter-headline-functions
'cpp-correction-headline)
#+END_SRC


If I read this right, you are writing the \end{correction} when the
headline function is called for the /following/ headline.

Then the (when...) should be outside the (if..) (because the
string-match condition isn't valid anymore).


As far as I understand emacs-lisp, the (when ...) is within the else so 
when the string match condition is not valid. That's why I do not 
understand why this complicated filter was not working. Anyway, my 
second try was much better and easier to understand (I also apply 
suggestion from John to avoid inclusion of "correction" section title).


Thanks for having a look,
Xavier
--

  |
  |__ GARRIDO Xavier   Laboratoire de l'Accélérateur Linéaire
   /\ NEMO Université Paris-Sud 11
  /--\garr...@lal.in2p3.fr UMR 8607
  |   garr...@in2p3.fr Batiment 200
  |__ +33 1.64.46.84.2891898 Orsay Cedex, France





Re: [O] An issue with org-agenda-todo-list-sublevels

2015-12-16 Thread Marcin Borkowski


On 2015-12-16, at 02:54, Nick Dokos  wrote:

> Marcin Borkowski  writes:
>
>> On 2015-12-14, at 21:48, Nick Dokos  wrote:
>>
>>> Marcin Borkowski  writes:
>>>
> On 2015-12-12, at 09:53, Nicolas Goaziou  wrote:
>
>> You can use a dedicated function in `org-agenda-skip-function' for that
>> (e.g., ignore task if one of its parents is a done task).

 OK, so it doesn't work (probably because I'm doing something wrong...)

 I did this:

 (defun mbork/org-agenda-skip-if-parent-done ()
   "Return t if any of the parents of the current entry is a DONE
   item."
   (save-excursion
 (catch 'done
   (while (org-up-heading-safe)
(if (org-entry-is-done-p)
(throw 'done t))

 (setq org-agenda-custom-commands
   '(("n"
 "Agenda and TODOs"
 ((agenda "")
  (alltodo "" ((org-agenda-skip-function 
 #'mbork/org-agenda-skip-if-parent-done)))

 and I see this:

 and: Wrong type argument: integer-or-marker-p, t

 What may be the problem?  How do I even debug this?

>>>
>>> Are you testing it with emacs -q -l /path/to/min/org-init.el?
>>> If not, you probably should: I don't get any errors with the
>>> stuff above in my minimal org file, which leads me to suspect
>>> it's something in (the rest of) your configuration.
>>
>> Strange.  I have the same error even with emacs -q, with minimal Org
>> config - the above function and one simple agenda file, containing this:
>>
>> * DONE done
>> ** TODO todo
>>
>> Org-mode version 8.2.10 (release_8.2.10 @ 
>> /usr/local/share/emacs/25.0.50/lisp/org/)
>>
>> Any hints?
>>
>> Here's the debugger output:
>>
>> Debugger entered--Lisp error: (wrong-type-argument integer-or-marker-p t)
>>   goto-char(t)
>>   (and (setq to (or (org-agenda-skip-eval org-agenda-skip-function-global) 
>> (org-agenda-skip-eval org-agenda-skip-function))) (goto-char to))
>
> Not so strange: I probably did not hit the (throw 'done t) in your
> function. The spec says that the function has to return a position
> in the buffer:
>
> ,
> | org-agenda-skip-function is a variable defined in ‘org-agenda.el’.
> | Its value is nil
> | 
> |   This variable may be risky if used as a file-local variable.
> | 
> | Documentation:
> | Function to be called at each match during agenda construction.
> | If this function returns nil, the current match should not be skipped.
> | Otherwise, the function must return a position from where the search
> | should be continued.
> `

Stupid me.  Thanks.

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University