Re: [O] show only top level TODO in agenda and ignore sub level TODOS in agenda?

2016-12-27 Thread Xebar Saram
Thanks all for the ideas, i will try them over the next few days

best

Z

On Tue, Dec 27, 2016 at 12:36 PM, Marcin Borkowski  wrote:

> ש
> > On Thursday, 22 Dec 2016 at 13:01, Xebar Saram wrote:
> >> Hi all
> >>
> >> i recently had some projects where i would define the overall project
> >> as a TODO and then add some more sub headers with TODOS. the problem
> >> is that i dont want to see all these sub TODOS in the agenda. For
> >> example:
> >>
> >> * TODO start writing paper
> >> ** TODO  collect data
> >> ** TODO  add refernces
> >
> > [...]
> >
> >> is there a property drawer/other trick to achieve this?
> >
> > I don't know but I can suggest using checkboxes for this?
> > info:(org) Checkboxes
> > They work well and are appropriate for when you have sub-tasks for a
> > single task.
>
> How about
>
> (setq org-agenda-todo-list-sublevels nil)
>
> ?
>
> Hth,
>
> --
> Marcin Borkowski
>
>


Re: [O] Passing an image reference to source code block

2016-12-27 Thread Nick Dokos
shripad sinari  writes:

> Thanks for the suggestion. The proposed solution does not work since
> the recent org versions generate their own labels and the label
> value cannot be predetermined.

C-h v org-latex-prefer-user-labels RET

-- 
Nick




Re: [O] [Away message] Re: Passing an image reference to source code block

2016-12-27 Thread shripad sinari
Thanks John,
Setting the variable org-latex-prefer-user-labels to "t" solves the issue.

Regards,

Shripad
Tucson, AZ

On Tue, Dec 27, 2016 at 11:42 AM, John Kitchin 
wrote:

> Set a variable like org-latex-prefer-user-labels to t. I am away from my
> computer to look up the actual name but it is something like that.
>
> On Tue, Dec 27, 2016 at 11:12 AM John Kitchin 
> wrote:
>
>> I am traveling with limited access to email. I will be back in the office
>> on Jan 2, 2017.
>> John
>>
>>
>> --
>> John
>>
>> ---
>> Professor John Kitchin
>> Doherty Hall A207F
>> Department of Chemical Engineering
>> Carnegie Mellon University
>> Pittsburgh, PA 15213
>> 412-268-7803 <(412)%20268-7803>
>> @johnkitchin
>> http://kitchingroup.cheme.cmu.edu
>>
>>
>>
>>
>>


Re: [O] Referring to an Org Babel variable in the invocation arguments to another Org Babel code block

2016-12-27 Thread Zack Piper
Hi Charles,

I think I found precisely the issue I'm having.

When I use your example, and adjust it slightly:


#+NAME: block-1
#+BEGIN_SRC shell :var x="X"
echo ">>>" $x "<<<"
#+END_SRC


#+BEGIN_SRC shell :var c="test" y=block-1(c)
echo $y
#+END_SRC

#+RESULTS:
: >>> $c <<<


I added a reference to an argument defined within the same block.

I get the aforementioned error:

org-babel-ref-resolve: Reference ‘c’ not found in this buffer

Thanks!
Zack



Re: [O] Passing an image reference to source code block

2016-12-27 Thread shripad sinari
Hello John,
Thanks for the suggestion. The proposed solution does not work since the
recent org versions generate their own labels and the label value cannot be
predetermined. See the LaTeX code generated by the above example with your
suggestion included:

x-x

\section{Section name}
\label{sec:org62816be}
some text
\begin{figure}[htbp]
\centering
\includegraphics[width=.9\linewidth]{img.jpg}
\caption{\label{fig:org43b3d3f}
Fig Caption}
\end{figure}
some reference to figure \ref{fig:org43b3d3f}
\section{other section}
\label{sec:org1e9d137}
reference to Section \ref{sec:org62816be}

% latex table generated in R 3.3.1 by xtable 1.8-2 package
% Tue Dec 27 10:56:43 2016
\begin{table}[ht]
\centering
\begin{tabular}{rrr}
  \hline
 & Time & demand \\
  \hline
1 & 1.00 & 8.30 \\
  2 & 2.00 & 10.30 \\
  3 & 3.00 & 19.00 \\
  4 & 4.00 & 16.00 \\
  5 & 5.00 & 15.60 \\
  6 & 7.00 & 19.80 \\
   \hline
\end{tabular}
\caption{Link the image \ref{fig:image} to this table}
\end{table}
\end{document}


x-x

the difference is the image is labelled "fig:org43b3d3f" and not
"fig:image".

Is there a way to solve this using CUSTOM_ID? Or is there a very different
approach to the way such table should be generated and then org-caption
should be used?

Any pointers are appreciated.

I believe this is common requirement in scientific writing which is what I
do most often. I use orgmode to write papers. Till org version 8.2.10 at
least I had a workaround in the following sense:

x-x

* Section name
some text
#+CAPTION: Fig Caption
#+LABEL: fig:image
[[file:img.jpg]]
some reference to figure [[fig:image]]
* other section
reference to Section [[Section name]]

#+BEGIN_SRC R :session *sample* default :exports results :results output
latex :tangle yes :var plot="ref{fig:image}"
  library(xtable)
  print(xtable(BOD
 , caption = paste("Link the image", plot,"to this table")))
#+END_SRC

x-x

which produced the following latex code:

x-x

\begin{document}

\maketitle
\tableofcontents

\section{Section name}
\label{sec-1}
some text
\begin{figure}[htb]
\centering
\includegraphics[width=.9\linewidth]{img.jpg}
\caption{\label{fig:image}Fig Caption}
\end{figure}
some reference to figure \ref{fig:image}
\section{other section}
\label{sec-2}
reference to Section \ref{sec-1}

 % latex table generated in R 3.3.1 by xtable 1.8-2 package
% Tue Dec 27 11:08:40 2016
\begin{table}[ht]
\centering
\begin{tabular}{rrr}
  \hline
 & Time & demand \\
  \hline
1 & 1.00 & 8.30 \\
  2 & 2.00 & 10.30 \\
  3 & 3.00 & 19.00 \\
  4 & 4.00 & 16.00 \\
  5 & 5.00 & 15.60 \\
  6 & 7.00 & 19.80 \\
   \hline
\end{tabular}
\caption{Link the image \ref{fig:image} to this table}
\end{table}
% Emacs 24.5.1 (Org mode 8.2.10)
\end{document}


x-x


This code compiles to the desired document.

Thanks and regards,


Shripad
Tucson, AZ

On Tue, Dec 27, 2016 at 9:05 AM, John Kitchin 
wrote:

> Can you pass \ref{fig:image} in? I think that is what you would do in
> Latex.
>
>
> On Mon, Dec 26, 2016 at 7:00 PM shripad sinari 
> wrote:
>
>> Hello all,
>> I would like to know if there is a way to pass a reference for a figure
>> to a source block as in the following example:
>>
>> x---x---
>>
>> * Section name
>>
>> some text
>> #+CAPTION: Fig Caption
>> #+NAME: fig:image
>> [[file:img.jpg]]
>> some reference to figure [[fig:image]]
>>
>> * other section
>> reference to Section [[Section name]]
>>
>> #+BEGIN_SRC R :session *sample* default :exports results :results output
>> latex :tangle yes :var plot=[[fig:image]]
>>   library(xtable)
>>   print(xtable(BOD
>>  , caption = paste("Link the image", plot,"to this table")))
>> #+END_SRC
>>
>>
>> x---x---
>>
>> I would like the caption of the table to point to the image, at the point
>> where the word "plot" is located, in LaTeX export of the org file.
>>
>> Any help or other workarounds are appreciated. I am using org version
>> 9.0.3 in GNU Emacs 24.5.1.
>>
>> Thanks for your help and regards,
>>
>> Shripad
>> Tucson, AZ
>>
>>
>>
>>
>>


Re: [O] bug in orgmode parsing of results

2016-12-27 Thread Charles C. Berry

On Tue, 27 Dec 2016, daimrod wrote:


Hi,

I've found what I think is a bug in orgmode parsing.
When the following file is parsed :

* Test
#+BEGIN_SRC emacs-lisp :exports results :results raw drawer
(format "- Test2")
#+END_SRC

#+RESULTS:
:RESULTS:
- Test2
:END:



[snip]



That is, it generates a DRAWER, which seems correct.

However, when the following file is parsed :

* Test
#+BEGIN_SRC emacs-lisp :exports results :results raw drawer
(format "* Test2")
#+END_SRC

#+RESULTS:
:RESULTS:
* Test2
:END:



[deleted]


That is, it generates a PARAGRAPH which seems incorrect.

WDYT?



What I think is that you should run org-lint on your document. It will say 
something like this (but with different line numbers):


  Line Trust Warning
 2 low   Forbidden combination in header ":results": raw, drawer
12 low   Forbidden combination in header ":results": raw, drawer
17 low   Possible incomplete drawer ":RESULTS:"

The last one should catch your eye.

If you want to generate results that have lines that start with `*' you 
need to protect them. A good way to do this is to wrap them in a src block 
or export block like this:


#+BEGIN_SRC emacs-lisp :exports results :wrap export latex
(format "* Test2")
#+END_SRC

HTH,

Chuck



Re: [O] bug in orgmode parsing of results

2016-12-27 Thread Nicolas Goaziou
Hello,

daimrod  writes:

> #+RESULTS:
> :RESULTS:
> * Test2
> :END:
>
[...]

> (paragraph
>  (:begin 98 :end 119 :contents-begin 109 :contents-end 119 :post-blank 0
> :post-affiliated 109 :results
>  (\"\")
>  :parent #2)
>  #(\":RESULTS:\\n\" 0 10
>(:parent #3)))
>
> That is, it generates a PARAGRAPH which seems incorrect.

The parser is correct. A drawer cannot contain a headline.

Regards,


-- 
Nicolas Goaziou



Re: [O] Referring to an Org Babel variable in the invocation arguments to another Org Babel code block

2016-12-27 Thread Charles C. Berry

On Tue, 27 Dec 2016, Zack Piper wrote:


Hi all,

Hopefully the below can explain better:


[deleted]

This is a workable idiom. C-c C-c on the second block produces the
output shown.


#+NAME: block-1
#+BEGIN_SRC shell :var x="X" 
echo ">>>" $x "<<<"

#+END_SRC


#+BEGIN_SRC shell :var y=block-1("input to this block")
echo $y
#+END_SRC

#+RESULTS:
: >>> input to this block <<<

HTH,

Chuck




Re: [O] Passing an image reference to source code block

2016-12-27 Thread John Kitchin
Can you pass \ref{fig:image} in? I think that is what you would do in
Latex.


On Mon, Dec 26, 2016 at 7:00 PM shripad sinari 
wrote:

> Hello all,
> I would like to know if there is a way to pass a reference for a figure to
> a source block as in the following example:
>
> x---x---
>
> * Section name
>
> some text
> #+CAPTION: Fig Caption
> #+NAME: fig:image
> [[file:img.jpg]]
> some reference to figure [[fig:image]]
>
> * other section
> reference to Section [[Section name]]
>
> #+BEGIN_SRC R :session *sample* default :exports results :results output
> latex :tangle yes :var plot=[[fig:image]]
>   library(xtable)
>   print(xtable(BOD
>  , caption = paste("Link the image", plot,"to this table")))
> #+END_SRC
>
>
> x---x---
>
> I would like the caption of the table to point to the image, at the point
> where the word "plot" is located, in LaTeX export of the org file.
>
> Any help or other workarounds are appreciated. I am using org version
> 9.0.3 in GNU Emacs 24.5.1.
>
> Thanks for your help and regards,
>
> Shripad
> Tucson, AZ
>
>
>
>
>


[O] [PATCH] Update ob-ruby for inf-ruby 2.5

2016-12-27 Thread Rick Frankel
inf-ruby (melpa stable) has recently been updated to v2.5. The library has
been significantly re-factored, and `run-ruby` no longer accepts `nil` has
the command name. The following patch updates ob-ruby so that it continues
to work w/ inf-ruby v2.5. It should still (untested) work with the previous
version (2.4).


rick

>From aa836b45487e61de6e74b6edde3c07ab5b885eb8 Mon Sep 17 00:00:00 2001
From: Rick Frankel 
Date: Mon, 26 Dec 2016 15:00:32 -0500
Subject: [PATCH] Update ob-ruby for inf-ruby 2.5

 * lisp/ob-ruby.el (org-babel-ruby-initiate-session): `run-ruby` has
   very different semantics in inf-ruby 2.5. Set ruby command to the
   default which used to be set by `run-ruby` and try and find already
   existing buffer before invocation.
---
 lisp/ob-ruby.el | 12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/lisp/ob-ruby.el b/lisp/ob-ruby.el
index 6415f354b..e510fc753 100644
--- a/lisp/ob-ruby.el
+++ b/lisp/ob-ruby.el
@@ -150,12 +150,16 @@ If there is not a current inferior-process-buffer in 
SESSION
 then create one.  Return the initialized session."
   (unless (string= session "none")
 (require 'inf-ruby)
-(let ((session-buffer (save-window-excursion
-   (run-ruby nil session) (current-buffer
+(let* ((cmd (cdr (assoc inf-ruby-default-implementation
+   inf-ruby-implementations)))
+  (buffer (get-buffer (format "*%s*" session)))
+  (session-buffer (or buffer (save-window-excursion
+   (run-ruby cmd session)
+   (current-buffer)
   (if (org-babel-comint-buffer-livep session-buffer)
  (progn (sit-for .25) session-buffer)
-(sit-for .5)
-(org-babel-ruby-initiate-session session)
+   (sit-for .5)
+   (org-babel-ruby-initiate-session session)
 
 (defvar org-babel-ruby-eoe-indicator ":org_babel_ruby_eoe"
   "String to indicate that evaluation has completed.")
-- 
2.11.0



Re: [O] use-package with ox-latex

2016-12-27 Thread Stig Brautaset

Dushyant Juneja  writes:

> Hi all,
>
> I was trying to wrap ox-latex in a use-package configuration. My
> use-package statement is super simple:
>
> (use-package ox-latex
> :defer t)

ox-latex is part of org, which ships with Emacs. You should be able to
just use:

,
| (require 'ox-latex)
`

Alternatively:

,
| (use-package org
|   :config
|   (require 'ox-latex))
`

Finally, if you prefer org-plus-contrib you can do:

,
| (use-package org
|   :ensure org-plus-contrib
|   :config
|   (require 'ox-latex))
`

Hope this helps!

Stig



[O] bug in orgmode parsing of results

2016-12-27 Thread daimrod
Hi,

I've found what I think is a bug in orgmode parsing.
When the following file is parsed :

* Test
#+BEGIN_SRC emacs-lisp :exports results :results raw drawer
(format "- Test2")
#+END_SRC

#+RESULTS:
:RESULTS:
- Test2
:END:

The truncated result of `org-element-parse-buffer' is :
(src-block
 (:language \"emacs-lisp\" :switches nil :parameters \":exports results
:results raw drawer\" :begin 8 :end 98 :number-lines nil
:preserve-indent nil :retain-labels t :use-labels t :label-fmt nil
:value \"(format \\\"- Test2\\\")\\n\" :post-blank 1 :post-affiliated 8
:parent #2))
(drawer
 (:begin 98 :end 133 :drawer-name \"RESULTS\" :contents-begin 119
:contents-end 127 :post-blank 0 :post-affiliated 109 :results
 (\"\")
 :parent #2))

That is, it generates a DRAWER, which seems correct.

However, when the following file is parsed :

* Test
#+BEGIN_SRC emacs-lisp :exports results :results raw drawer
(format "* Test2")
#+END_SRC

#+RESULTS:
:RESULTS:
* Test2
:END:

The (truncated) result of `org-element-parse-buffer' is :
(src-block
 (:language \"emacs-lisp\" :switches nil :parameters \":exports results
:results raw drawer\" :begin 8 :end 98 :number-lines nil
:preserve-indent nil :retain-labels t :use-labels t :label-fmt nil
:value \"(format \\\"* Test2\\\")\\n\" :post-blank 1 :post-affiliated 8
:parent #2))
(paragraph
 (:begin 98 :end 119 :contents-begin 109 :contents-end 119 :post-blank 0
:post-affiliated 109 :results
 (\"\")
 :parent #2)
 #(\":RESULTS:\\n\" 0 10
   (:parent #3)))

That is, it generates a PARAGRAPH which seems incorrect.

WDYT?



signature.asc
Description: OpenPGP digital signature


[O] Referring to an Org Babel variable in the invocation arguments to another Org Babel code block

2016-12-27 Thread Zack Piper
Hi all,

Hopefully the below can explain better:

#+NAME: abc
#+BEGIN_SRC shell :noweb yes :var a="b" :results output
echo <>
1
EOF
#+END_SRC

#+RESULTS: def
: 


Pressing `C-c C-c' on the second block returns:


org-babel-ref-resolve: Reference ‘c’ not found in this buffer


Org version: 9.0.3


Thanks!

-- 
Zack Piper  System administrator
https://apertron.net



[O] use-package with ox-latex

2016-12-27 Thread Dushyant Juneja
Hi all,

I was trying to wrap ox-latex in a use-package configuration. My
use-package statement is super simple:

(use-package ox-latex
:defer t)

However, emacs cribs on this at startup as follows:

package-compute-transaction: Package ‘ox-latex-’ is unavailable

Any ideas of what could be going wrong here? I have seen many people use
use-package for ox-latex, so I do not understand why this should happen now.

As an initial check, I did see that ox-latex is not available as a package
in package-list-packages output. It is available via find-library command
in my org-installation, though.

Thanks for the help in advance!

Dushyant


Re: [O] show only top level TODO in agenda and ignore sub level TODOS in agenda?

2016-12-27 Thread Marcin Borkowski

On 2016-12-23, at 12:47, Eric S Fraga  wrote:

> On Thursday, 22 Dec 2016 at 13:01, Xebar Saram wrote:
>> Hi all
>>
>> i recently had some projects where i would define the overall project
>> as a TODO and then add some more sub headers with TODOS. the problem
>> is that i dont want to see all these sub TODOS in the agenda. For
>> example:
>>
>> * TODO start writing paper
>> ** TODO  collect data
>> ** TODO  add refernces
>
> [...]
>
>> is there a property drawer/other trick to achieve this?
>
> I don't know but I can suggest using checkboxes for this?
> info:(org) Checkboxes
> They work well and are appropriate for when you have sub-tasks for a
> single task.

How about

(setq org-agenda-todo-list-sublevels nil)

?

Hth,

-- 
Marcin Borkowski



[O] [PATCH] Tag visibility fixup after setting them

2016-12-27 Thread Alexey Lebedeff

Hi folks,

This fixes bug where you sometimes can't immediately see tags that were
just set. And to reveal them you need to go through global visibility
cycle.

Best,
Alexey

>From d81f5be08c83fb31adfd36dc97dcf92268c898ed Mon Sep 17 00:00:00 2001
From: Alexey Lebedeff 
Date: Sun, 25 Dec 2016 13:24:04 +0300
Subject: [PATCH] Reveal tags after setting them

Sometimes freshly added tags can be sucked into invisible outline
region (denoted by ellipsis) - and to see them you need to do the full
global visibilty cycle.
---
 lisp/org.el  | 11 ++-
 testing/lisp/test-org.el | 18 ++
 2 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/lisp/org.el b/lisp/org.el
index 3ddd80b..4d6ba75 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -8003,6 +8003,15 @@ unconditionally."
 (org-N-empty-lines-before-current (if blank? 1 0))
   (run-hooks 'org-insert-heading-hook))
 
+(defun org-insert-visible-text ( args)
+  "Inserts arguments at point and makes them visible in outline.
+
+When text is being inserted on the invisible region boundary, it
+can be inadvertently sucked into invisibility."
+  (let* ((before-point (point)))
+(apply #'insert args)
+(outline-flag-region before-point (point) nil)))
+
 (defun org-N-empty-lines-before-current (N)
   "Make the number of empty lines before current exactly N.
 So this will delete or add empty lines."
@@ -15096,7 +15105,7 @@ When JUST-ALIGN is non-nil, only align tags."
 	  ;; white spaces.
 	  (end-of-line)
 	  (if (not (equal tags ""))
-		  (insert " " tags)
+		  (org-insert-visible-text " " tags)
 		(skip-chars-backward " \t")
 		(delete-region (point) (line-end-position)
 	  ;; Align tags, if any.  Fix tags column if `org-indent-mode'
diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el
index bbd0c0b..d60364a 100644
--- a/testing/lisp/test-org.el
+++ b/testing/lisp/test-org.el
@@ -5130,6 +5130,24 @@ Paragraph"
   (should-not
(org-test-with-temp-text "Paragraph" (org-hide-block-toggle-maybe
 
+(ert-deftest test-org/fast-tag-selection ()
+  "Test `org-fast-tag-selection'."
+  ;; Tags set via fast-tag-selection should be visible afterwards
+  (should
+   (let ((org-tag-alist '(("NEXT" . ?n)))
+	 (org-fast-tag-selection-single-key t))
+ (cl-letf (((symbol-function 'read-char-exclusive) (lambda () ?n))
+	   ((symbol-function 'window-width) (lambda ( args) 100)))
+   (org-test-with-temp-text "* Headline\nAnd its content\n* And another headline\n\nWith some content"
+	 ;; Show only headlines
+	 (org-content)
+	 ;; Set NEXT tag on current entry
+	 (org-set-tags nil nil)
+	 ;; Move point to that NEXT tag
+	 (search-forward "NEXT") (backward-word)
+	 ;; And it should be visible (i.e. no overlays)
+	 (not (overlays-at (point
+
 (ert-deftest test-org/show-set-visibility ()
   "Test `org-show-set-visibility' specifications."
   ;; Do not throw an error before first heading.
-- 
2.10.0