RE: bug#59882: Multiple versions of Org in load-path problem

2022-12-14 Thread Cook, Malcolm
>On a related note, is it normal that package like org-mouse.el gets
>loaded upon calling C-h f org-mouse-  completion prompt?
>org-mouse.el does not contain a single autoload cookie.

There need not be which is apparently by design:

The autoload happens as a consequence of emacs' documented feature to [Autoload 
by 
Prefix](https://www.gnu.org/software/emacs/manual/html_node/elisp/Autoload-by-Prefix.html)
 

Given that:

(equal (gethash "org-mouse-"  definition-prefixes) '("org-mouse"))





RE: Multiple versions of Org in load-path problem

2022-12-09 Thread Cook, Malcolm
> Adding this to bug #59882
> 
> "Michel Schinz"  writes:
> 
> > Just for the record, I also ran into problems when installing Org 9.6
> > using Emacs' package system on top of an older version that came with
> > Emacs. If I tried to install it as usual (M-x list-packages, then
> > install the package from there), I had errors during compilation
> > related to `org-assert-version`, and then if I restarted Emacs, I
> > would get a fatal error in an unrelated package.
> >
> > I managed to solve that problem by:
> > 1. uninstalling Org 9.6 and exiting Emacs, 2. starting Emacs with -q,
> > 3. installing Org 9.6 from there (using M-x list-packages as usual),
> > 4. restarting Emacs.
> 
> Interesting!  I tried this (essentially) and it worked for my case.  In my 
> case, I
> had a built-in Org-9.3 and I was trying to use list-packages to install 
> Org-9.6. I
> checked that using -q still added Org-9.3 to the load-path, but, since Org
> wasn't loaded, the install via list-packages worked.
> 
> The question is what's the proper way of doing this without '-q'?
> 
> > I'm not sure this is related to your problem, or whether that helps
> > (but I hope it does)...
> 
> I think it does.
> 
> Side note:
> 
> In my testing, I found a strange case where, in *scratch*, I get:
> 
> (message "%s" org-version)
> ;; Error undefined
> ;; Do 'C-h v org-version'
> (message "%s" org-version)
> 9.3
> 
> So, 'describe-variable' on org-version causes Org to be loaded?!?  [Cook, 
> Malcolm] 

Yes.  See 
https://www.gnu.org/software/emacs/manual/html_node/elisp/Autoload-by-Prefix.html

But it will NOT be autoloaded if you first:

(clrhash  definition-prefixes)

HTH & YMMV,

Malcolm

> Why do I
> have a feeling this is related to this bug?

Yeah, I'm not sure what you consider the bug to be now.  Remind me?

> 
> --
> David Masterson




RE: bug#59882: Multiple versions of Org in load-path problem

2022-12-09 Thread Cook, Malcolm
> Eli Zaretskii  writes:
> 
> >> Cc: emacs-orgmode@gnu.org, 59...@debbugs.gnu.org
> >> From: David Masterson 
> >> Date: Thu, 08 Dec 2022 13:56:03 -0800
> >>
> >> In my testing, I found a strange case where, in *scratch*, I get:
> >>
> >> (message "%s" org-version)
> >> ;; Error undefined
> >> ;; Do 'C-h v org-version'
> >> (message "%s" org-version)
> >> 9.3
> >>
> >> So, 'describe-variable' on org-version causes Org to be loaded?!?
> >
> > Why is it so surprising?  Is this the first time you see that a Help
> > command loads something to do its job?
> 
> Yes, it is surprising.  How did Emacs know to load Org to find org-version? 

This is provided for via emacs' autoload by prefix mechanism.

See:

https://www.gnu.org/software/emacs/manual/html_node/elisp/Autoload-by-Prefix.html

What you observed will NOT happen if you first run:

(clrhash  definition-prefixes)

> didn't request it to by this action.  Or did it do a package-activate-all (or
> similar) to ensure that everything was loaded?
> That would be overkill.  Sometimes the best answer is 'nil'.
> 
> --
> David Masterson




RE: Multiple versions of Org in load-path problem

2022-12-08 Thread Cook, Malcolm
>Ihor Radchenko  writes:
>
>> David Masterson  writes:
>>
>>> I went so far as to add the following to early-init.el:
>>>
>>> (if (featurep 'org) (unload-feature 'org))
>>> (add-to-list 'load-path (expand-file-name "~/.emacs.d/elpa/org-9.6")
>>> (load-library "org")
>>>
>>> The load-library still fails with the org-assert-version error.
>>
>> Indeed. It is to be expected. M-x package-install should not err here
>> though. In theory.
>
>My testing says that, in early-init.el, Org is not yet a feature, so the
>built-in Org-9.3 is not yet loaded and the first 'if' fails. Adding the
>path for Org-9.6 should put it at the front of the load-path and
>(hopefully) override Org-9.3 if it is in the load-path (I think I
>checked that). The error in the load-library is, therefore, a problem
>with Org-9.6 installed by package-install. 
>
>> I suggest you to read `org-assert-version'. It aims to catch the
>> situation above and similar.
>
>This is chicken and egg problem. I can't use 'org-assert-version'
>unless I can get Org to load.
>
>> Note, however, that installation problem is different. Or rather it
>> should be different.
>>
>>> Could it be that, when you package-install Org-9.6, it runs through a
>>> check where (I think) it compiles the package? I get a lot of warnings
>>> and 34(?) failed files. Could it be that some of the files are not
>>> built and, so, when I load-library, I'm picking up some of the wrong
>>> files from the built-in Org-9.3? Do we need to remove all versions of
>>> Org that is not the current version from the load-path at the very
>>> beginning of org.el to ensure no fall-through? Kind of a hack, but...

Hi,

I've been reading along as I've been similarly hounded in years past with org 
version changes.

It really sounds like you compiled org-9.6 with Org-9.3 already loaded.

I'd recommend reinstalling.

Here is one way to do it that is pretty safe:

> emacs -Q -batch -eval "(progn (require 'package) (package-initialize) 
 (package-refresh-contents) (package-install 'org))"

If after doing this, and running emacs, you find M-x org-version does not 
return 9.6, or you find the package assert problem, I'd try the more paranoid:
> emacs -Q -batch -eval "(progn (require 'cl-seq) (delete (car 
(cl-member "lisp/org" load-path :test  #'string-match)) load-path) (require 
'package) (package-initialize)  (package-refresh-contents) (package-install 
'org))"

And possibly consider adding to your init.el at the very top:

(require 'cl-seq) (delete (car (cl-member "lisp/org" load-path :test  
#'string-match)) load-path)

YMMV,

~ Malcolm

>>
>> Maybe. It should not. That's why I raised
>> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=59882
>> I'd like to see if Emacs devs have anything to say here.
>
>Good. I'm not used to bug reporting in Emacs, so I raised a question on
>use-package in mailto:emacs-de...@gnu.org, but they pointed me at your bug.
>I'll see if I can add anything there.
>
>-- 
>David Masterson
>




RE: [BUG] ob-R: session evaluation returns empty ouputs with Org 9.6 [9.6 ( @ /home/fsantos/.emacs.d/elpa/org-9.6/)]

2022-12-07 Thread Cook, Malcolm
>"Cook, Malcolm" <mailto:m...@stowers.org> writes:
>
>> I tried applying just the change in 
>> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=456462741 to 
>> released Org 9.6 and find that when using `:session *R*` the #+RESULTS are 
>> still empty, but when running without :session the results are provided.
>
>Could you please elaborate what you mean by "just the change"? This
>change is a fix on top of another change we included in Org 9.6.

Of course

I manually edited ob-comint.el and inserted the lines marked with a '+' from 
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=456462741 
(removing the '+') in the right place, and re-evaluated the now modified 
function definition (went to end of defun and hit C-x C-e)

Doh!  

It is a macro not a defun, so simply redefining it will not effect where it was 
used.  

My bad.

Byte-compiling and reloading ob-R.el worked.

So, answering your question revealed my error.

Thanks.

I look forward to the fix finding elpa.

Cheers,

Malcolm




RE: [BUG] ob-R: session evaluation returns empty ouputs with Org 9.6 [9.6 ( @ /home/fsantos/.emacs.d/elpa/org-9.6/)]

2022-12-06 Thread Cook, Malcolm
Hi,

I tried applying just the change in 
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=456462741 to 
released Org 9.6 and find that when using `:session *R*` the #+RESULTS are 
still empty, but when running without :session the results are provided.

Is there any diagnostic or reprex I can provide to demonstrate that it persists?

~ malcolm_c...@stowers.org
From: emacs-orgmode-bounces+mec=stowers@gnu.org 
 On Behalf Of Ihor Radchenko
Sent: Friday, December 2, 2022 12:03 AM
To: William Denton 
Cc: Frédéric Santos ; emacs-orgmode@gnu.org
Subject: Re: [BUG] ob-R: session evaluation returns empty ouputs with Org 9.6 
[9.6 ( @ /home/fsantos/.emacs.d/elpa/org-9.6/)]

Ihor Radchenko mailto:yanta...@posteo.net>> writes:

> It looks like there is something wrong with comint-prompt-regexp in R
> buffers. It somehow does not match the prompt.
>
> I will need to look further.

Fixed on bugfix.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=456462741

--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at >.
Support Org development at 
>,
or support my work at 
>


RE: [BUG] ob-R: session evaluation returns empty ouputs with Org 9.6 [9.6 ( @ /home/fsantos/.emacs.d/elpa/org-9.6/)]

2022-11-30 Thread Cook, Malcolm


>Bug confirmed by other ESS users on the mailing list:
>https://stat.ethz.ch/pipermail/ess-help/2022-November/013162.html

FWIW: confirmed here too with

GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo version 
1.15.12, Xaw3d scroll bars) of 2022-01-19
Org mode version 9.6-pre (release_9.5.5-1136-gf78dfe @ 
/home/mec/.emacs.d/org-mode/lisp/)
ess-version: 18.10.3snapshot [elpa: 20221124.756] (loaded from 
/home/mec/.emacs.d/elpa/ess-20221124.756/)

~ malcolm_c...@stowers.org




RE: [PATCH] LSP support in org-src buffers

2022-11-22 Thread Cook, Malcolm
Coming late to this discussion….

Might there be some value in considering the aims and methods of 
[Polymode](https://github.com/polymode/polymode#readme) in this regard?  There 
seems to be a significant overlap of concerns.

Just a thought.

Cheers,

Malcolm


TIP: use svglite as device in for producing plots in R/ESS code blocks

2022-11-03 Thread Cook, Malcolm
I wanted to use svglite as the driver for producing .svg plots within org.

It took a little poking around but the solution was one line:

```
(setf (alist-get  :svg org-babel-R-graphics-devices   ) '("svglite" "file"))
```

Of course it requires:

```
library(svglite)
```

...to have been called in the R session.

This greatly simplifies using org to author graphics heavy literate programming 
/ exploratory data analyses, especially in combination with
 -  
https://emacs.stackexchange.com/questions/29871/how-to-embed-svg-output-of-org-mode-src-block-as-inline-svg-in-html-export
 
 - building emacs with svg support

I mention this TIP in case anyone else is similarly inclined, and in case they 
have additional TIPs that similarly improve working with org/ESS/R/svg

Oh, and, you can set it back with:

```
(setf (alist-get  :svg org-babel-R-graphics-devices   ) '("svg" "file"))
```

... and there is probably some juju to make it buffer local 

Cheers,

Malcolm Cook


RE: org-assert-version considered harmful

2022-11-03 Thread Cook, Malcolm
>> It should not be necessary and it does not happen on my side (as you can
> >> imagine, I re-compile very often).
> >
> > Perhap's my issue stems from the particular versions of org I was upgrading 
> > between and/or (earlier) poor management of multiple contending org 
> > versions (e.g. git head v. melpa v. system).
> 
> That might be possible. Because Emacs does not properly update macro
> definitions in the already compiled files.
> 
> See https://orgmode.org/list/jwvsfkv5s7l.fsf-monnier+em...@gnu.org

That is exactly the message which suggested my workaround of inserting a `make 
clean` into my manta.  Thanks for the confirmation!
  
> 
> However, the current, more forgiving, version of org-assert-version
> should only complain when upgrading to different Org version. make clean
> is a good measure even during normal upgrades though. Because of the
> Emacs limitation.
> 
> > ```
> > cd ~/.emacs.d/org-mode && git pull && make clean && make autoloads && make 
> > PERL5LIB=
> > ```
> >
> > And then relaunch emacs, where it gets picked up due to:
> >
> > ```
> > (use-package org ;org-plus-contrib ; instead of org-mode
> > :pin manual 
> > :load-path "~/.emacs.d/org-mode/lisp"
> > ...
> > )
> > ```
> >
> > ... which occurs very early in my init file (just after bootstrapping 
> > package system and latest use-package).
> >
> > So, I've got (again) a working strategy. 
> >
> > I'm really wondering if all this is needlessly complex.
> 
> The above should be safe.
> Whatever straight.el does also work for me as long as I put Org loading
> early in my init.el.

Good to have confirmation here again.  Thanks Ihor!



RE: org-assert-version considered harmful

2022-11-02 Thread Cook, Malcolm

> > Then, when I occasionally wished to update org, I would
> >
> > `cd ~/.emacs.d/org-mode && git pull && make autoloads && make`
> >
> > Recently I started getting errors invalid-function "org-assert-version".
> >
> > Upon cursory reading of this thread I guessed that I could fix them by 
> > adding a `make clean` to my update mantra.
> 
> It should not be necessary and it does not happen on my side (as you can
> imagine, I re-compile very often).

Perhap's my issue stems from the particular versions of org I was upgrading 
between and/or (earlier) poor management of multiple contending org versions 
(e.g. git head v. melpa v. system).

> 
> Could you provide more details?

At this point, I am not seeking to reproduce the issue, but rather to ensure 
that my current practice is "best" practice, given my aim of staying current 
with head (understanding and accepting that this may bring its own 
instabilities).

So the details I can provide are probably around how I 

protect against multiple contending org versions
obtain and build org sources
load/require/use the built org sources

The very first thing in my init.el is intended to help protect against 
contending org versions:

```
(require 'cl-seq)
(delete (car (cl-member "lisp/org" load-path :test  #'string-match)) 
;; "as extra level of precaution against getting the built-in
;; org-mode, I ensure it never gets loaded" - kudos:
;; 
https://lists.gnu.org/archive/html/emacs-orgmode/2022-02/msg00130.html
load-path)
```

If I want to install the latest org from melpa, I never do this from within an 
active emacs session but rather from the (linux) command line as:

```
emacs -Q -batch -eval "(progn (require 'package) (package-initialize)  
(package-refresh-contents) (package-install 'org))"
```

But more often, I strive to stay abreast of developments, and when I see an 
issue I care about discussed as being addressed with a source code change, I go 
get it

```
cd ~/.emacs.d/org-mode && git pull && make clean && make autoloads && make 
PERL5LIB=
```

And then relaunch emacs, where it gets picked up due to:

```
(use-package org ;org-plus-contrib  ; instead of org-mode
  :pin manual 
  :load-path "~/.emacs.d/org-mode/lisp"
...
)
```

... which occurs very early in my init file (just after bootstrapping package 
system and latest use-package).

So, I've got (again) a working strategy.  

I'm really wondering if all this is needlessly complex.

Anyway, thanks for chiming in!


RE: [External] : RE: org-assert-version considered harmful

2022-10-31 Thread Cook, Malcolm
> Malcolm,
> I also ran into troubles which are similar, apparently due to mixed org-mode 
> versions; we've got to load org-mode before emacs tries to do it for us or we 
> get mixed stuff.

Thanks Daniel, yes, I understand the need to load org early, and am sure that 
my approach succeeds in doing so (without the need to re-make emacs-master).

Nonetheless, I recently found that that the addition of a  `make clean` on 
org-mode was necessary to delete the compiled .elc files in which (apparently?) 
used macros whose definition had changed in the interim.

Cheers
> 
> My resolution was to load the org-mode path first in my init.el file and then 
> require org:
> (add-to-list 'load-path "/home/dortmann/src/git-org-mode/lisp")
> (require 'org)
> And then I build with something like this:
> dortmann@ddo-linux:src$ cd ~/src/git-org-contrib/ && git pull && cd 
> ~/src/git-org-mode/ && git pull && make all && make autoloads && cd 
> ~/src/git-emacs-master/ && git pull && make all && sudo -H make install && cd 
> ..
> 
> Then only an occasional 'make bootstrap' is required in the emacs build dir.
> 
> 
> 
> On 10/31/22 09:11, Cook, Malcolm wrote:
> Hello,
>  
> I found this recent thread researching why my strategy for staying abreast 
> with org head had started failing with invalid-function "org-assert-version"
>  
> My strategy had been to build org initially with
>  
>  
>` cd ~/.emacs.d && git clone 
> https://urldefense.com/v3/__https://git.savannah.gnu.org/git/emacs/org-mode.git__;!!ACWV5N9M2RV99hQ!NJTKsXYcJrTb8d5ZN-S1HlVfATQrUIHtWtEz4qZmvjlGuMcS-6MG89rA3dDSBwxECGJw1YoNopf635M$
>  &&   cd org-mode && make autoloads && make` 
>  
> and ensure this clone of org was picked up in my "~/.emacs.d/org-mode/lisp by 
> including the following in my .init.el very early (right after bootstrapping 
> the package system and use-package):
>  
> (use-package 
>   :pin manual 
>   :load-path "~/.emacs.d/org-mode/lisp"
> )
>  
> Then, when I occasionally wished to update org, I would
>  
>`cd ~/.emacs.d/org-mode && git pull && make autoloads && make`
> 
> Recently I started getting errors invalid-function "org-assert-version".
>  
> Upon cursory reading of this thread I guessed that I could fix them by adding 
> a `make clean` to my update mantra.
>  
> It worked.
>  
> Am I advised to do otherwise?  Is there a best/better practice?
>  
> Thanks,
>  
> ~Malcolm
> 
> 


RE: org-assert-version considered harmful

2022-10-31 Thread Cook, Malcolm
Hello,

I found this recent thread researching why my strategy for staying abreast with 
org head had started failing with invalid-function "org-assert-version"

My strategy had been to build org initially with


` cd ~/.emacs.d && git clone 
https://git.savannah.gnu.org/git/emacs/org-mode.git &&   cd org-mode && make 
autoloads && make`

and ensure this clone of org was picked up in my "~/.emacs.d/org-mode/lisp by 
including the following in my .init.el very early (right after bootstrapping 
the package system and use-package):

(use-package
  :pin manual
  :load-path "~/.emacs.d/org-mode/lisp"
)

Then, when I occasionally wished to update org, I would

`cd ~/.emacs.d/org-mode && git pull && make autoloads && make`

Recently I started getting errors invalid-function "org-assert-version".

Upon cursory reading of this thread I guessed that I could fix them by adding a 
`make clean` to my update mantra.

It worked.

Am I advised to do otherwise?  Is there a best/better practice?

Thanks,

~Malcolm


RE: R code blocks in org version 9.5

2022-10-19 Thread Cook, Malcolm
> My R code blocks work fine in org 9.5. When I plot graph using base graphics 
> in session, it works fine. The problem is with lattice graphs. With below 
> header variables, code block works fine.
> 
> #+begin_src R :session *R* :results graphics file :file test.png
> library(lattice)
> print(histogram(rnorm(1)))
> #+end_src
> 
> But this does not work. Emacs hangs.
> 
> #+begin_src R :session *R* :results output graphics file :file test.png
> library(lattice)
> histogram(rnorm(1))
> #+end_src

In my hands, all combinations work with/without the `output` and with/without 
the `print`.

IMO, you should not want to include the print. 

Here is my environment:

Org mode version 9.5.2 (release_9.5.2-9-g7ba24c)

GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo
 version 1.15.12, Xaw3d scroll bars) of 2022-01-19

ESS version 18.10.3snapshot

R
sessionInfo()
R version 4.2.0 (2022-04-22)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)

Matrix products: default
BLAS:   /n/apps/CentOS7/install/r-4.2.0/lib64/R/lib/libRblas.so
LAPACK: /n/apps/CentOS7/install/r-4.2.0/lib64/R/lib/libRlapack.so

locale:
[1] C

attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base 

other attached packages:
[1] lattice_0.20-45

loaded via a namespace (and not attached):
[1] compiler_4.2.0 grid_4.2.0


RE: You can now support Org-mode through https://liberapay.com/org-mode/

2022-09-20 Thread Cook, Malcolm
Thanks for all you do – donation forthcoming!

From: Emacs-orgmode  On Behalf 
Of Bastien
Sent: Saturday, September 17, 2022 3:32 AM
To: emacs-orgmode@gnu.org
Subject: You can now support Org-mode through https://liberapay.com/org-mode/

CAUTION: This email is from an External Source. Please use proper judgment and 
caution when opening attachments, clicking links, or responding to this email.


Dear all,

We recently set up a Liberapay team for processing donations made to
Org-mode contributors:

https://liberapay.com/org-mode/

For now, the team is comprised of Ihor, Timothy (TEC) and me.

If you have a Liberapay account and are a maintainer of one of Org's
core file, please don't hesitate to join this team.

The team is also open to non-code contributors: e.g. people who spend
time answering questions on this list or enhancing Worg documentation,
all these efforts that make Org valuable to everyone.

New members are added if current members all agree on adding them.

Donations are equally shared among members -- for now this amount of
donations is 10€ per week, so don't be shy.

Thanks to Ihor for triggering this change. For more context about it,
see this thread: https://list.orgmode.org/87iloyyd1y.fsf@localhost/

--
Bastien


RE: [BUG] org-mode #+SETUPFILE not working with properties [9.5.2 (release_9.5.2-378-g98588e @ /home/eros/src/org-mode/lisp/)]

2022-04-29 Thread Cook, Malcolm
I agree.  There is no reason to think this should not work.  I have been down 
this road myself in wished it did.

From: Emacs-orgmode  On Behalf 
Of Ihor Radchenko
Sent: Thursday, April 28, 2022 9:41 AM
To: Eros Zaupa 
Cc: emacs-orgmode@gnu.org
Subject: Re: [BUG] org-mode #+SETUPFILE not working with properties [9.5.2 
(release_9.5.2-378-g98588e @ /home/eros/src/org-mode/lisp/)]

CAUTION: This email is from an External Source. Please use proper judgment and 
caution when opening attachments, clicking links, or responding to this email.


Eros Zaupa mailto:erosza...@gmail.com>> writes:

> I would like to move the properties drawer to a separate file and import it
> into the main one. To do so I'm using the `#SETUPFILE` property suggested
> [here][1], but this doesn't seem to work.

Confirmed.
Though I am not 100% sure.

Org is indeed ignoring top-level property drawer when parsing
#+SETUPFILE.

Dear All,
I think that parsing top-level property drawer is simply an omission
from the time we introduced top-level property drawers into syntax.

We may either implement this support or leave things as is and document
the current behaviour.

I would be in favour of implementing top-level drawer support in
SETUPFILE, but there might be alternative opinions. WDYT?

Dear Eros Zaupa,

> ***main.org***
>
> #+SETUPFILE: test.org
>
> #+begin_src sh
> echo ${A}
> #+end_src
>
> #+RESULTS:
>
> ***test.org***
>
> :PROPERTIES:
> :header-args:sh: :var A="this is a"
> :END:

To work around your issue, you can use keyword property syntax:

***test.org***

#+PROPERTY: header-args:sh :var A="this is a"

Best,
Ihor


RE: Unable to get current or via use-package

2022-02-10 Thread Cook, Malcolm
Hi Loris,

> > I tend to use the org-mode from the package manager, but do not do it 
> > interactively from within emacs. Instead, which when I want to refresh org, 
> > I do from the command line:
> >
> > emacs -Q -batch -eval "(progn (require 'package) (package-initialize) 
> > (package-refresh-contents) (package-install 'org))"
> 
> Is that necessary? Can't I just use the package manager to update Org
> along with any other packages? Or does the issue about not visiting and
> .org file before installing via the package manager apply to updates
> too?

AFAIK, what is necessary (though for reasons somewhat beyond my ken) is that 
org updates be installed in an environment in which no version of org has been 
loaded.  You need some approach to ensure that.  This is one such.  Agreed it 
is heavy handed, but it suffices the need.  I wish I could express the order 
dependencies in a reliable fashion with `use-package`.

It *might* be the case that execution of the following snippet early enough in 
your init file is enough for `use-package` to "get it right"(tm).  If you try 
this, let us know the outcome.

> > Also, early in my init.el, as extra level of precaution against getting the 
> > built-in org-mode, I ensure it never gets loaded:
> > (require 'cl-seq) (delete (car (cl-member "lisp/org" load-path :test 
> > #'string-match)) load-path)
> 
> Interesting, although I would generally want at least some version of
> Org even if a more recent version is installed but somehow broken.

If you can code that logic in lisp, you can conditionally execute the provided 
snipped.

/joke

But I get your point.  In my case, sometimes I want to run with a git pull from 
head of org repos rather than a package install.  At such times I wind up 
editing my init file and use the `use-package`'s :load-path and :pin directives:

   :pin manual 
   :load-path "~/.emacs.d/org-mode/lisp"
  ;; which was installed with: `cd ~/emacs.d && git clone 
https://git.savannah.gnu.org/git/emacs/org-mode.git &&   cd org-mode && make 
autoloads && make` 
  ;; and can be updated with: `cd ~/emacs.d/org-mode && git pull && make 
autoloads && make`

Point being that I have found that expressing the logic  to cover every use 
case requires me to edit my init.el and interact with the command line "out of 
band", as it were.

YMMV

~Malcolm


RE: Unable to get current or via use-package

2022-02-09 Thread Cook, Malcolm
>(use-package org
>:ensure org-contrib)

I believe `:ensure org-contrib` is no longer needed.

I tend to use the org-mode from the package manager, but do not do it 
interactively from within emacs.  Instead, which when I want to refresh org, I 
do from the command line:

emacs -Q -batch -eval "(progn (require 'package) (package-initialize) 
(package-refresh-contents) (package-install 'org))"

Also, early in my init.el, as extra level of precaution against getting the 
built-in org-mode, I ensure it never gets loaded:
(require 'cl-seq) (delete (car (cl-member "lisp/org" load-path :test 
#'string-match)) load-path)

>
>I moved the old-plus-contrig ELPA folder out the way. However, I now
>just get the built-in version of Org:
>
>Org mode version 9.3 (release_9.3 @ /usr/share/emacs/27.1/lisp/org/)
>
>Is this a problem use-package has with built-in packages, as described here
>
>https://github.com/jwiegley/use-package/issues/319
>
>? Or am I doing something wrong? Or do I just need to install via M-x
>list-packages (bearing in mind the caveat about not visiting an org file
>beforehand)?
>
>Cheers,
>
>Loris
>
>-- 
>This signature is currently under construction.
>


RE: TMIO Pre-release, request for feedback

2021-06-12 Thread Cook, Malcolm
Agreed, +1, yes yes, much appreciated, I look forward to your summaries, I 
always learn something useful….
~Malcolm


RE: org-babel not finding executables when using direnv [Was: Re: ob-sql is not finding psql when using direnv+guix]

2021-05-13 Thread Cook, Malcolm
> > > > >I am using Guix with direnv.
> > > > 
> > > > What is your shell?
> > > > 
> > > 
> > > My shell is bash, originally I was using zsh and I thought that was the 
> > > problem, so I switched to bash and still not working.
> > > 
> > > > How/When do you "hook direnv into your shell" (https://direnv.net/)?
> > > > 
> > > 
> > > In the .profile file, at login.
> > > 
> > > > > In an specific folder I am installing and using psql and postgresql 
> > > > > using direnv+guix as follows:
> > > > >use guix --manifest=cdpp-manifest.scm
> > > > >
> > > > >export PGUSER=food_user
> > > > >export PGPASSWORD=some_password
> > > > >export PGDATABASE=food
> > > > >
> > > > >layout postgres
> > > > 
> > > > When are you doing this?
> > > > 
> > > > a) in the "specific folder"'s .envrc file?
> > > > b) in an org-mode shell block that you execute prior to the sql block?
> > > > c) ??
> > > 
> > > Option (a)
> > > 
> > > 
> > > > You seem to be following [Per\-project 
> > > > Postgres](https://jamey.thesharps.us/2019/05/29/per-project-postgres/) 
> > > > but with guix instead of nix. Nice.
> > > > 
> > > 
> > > Yep, great post. direnv + guix change the way I develop software, do data 
> > > science and write lectures and papers.
> > > 
> > > > If you enter the directory and then call emacs, earthing should just 
> > > > work, no changes neede.
> > > > 
> > > 
> > > It works for almost everything (sql-buffers, python buffers, etc), except 
> > > for org-babel sql blocks.
> > > 
> > > I am using EXWM, so emacs is always on.
> > > 
> > > 
> > > > If you want to tell emacs to adopt the environment established by a 
> > > > .direnv, you probably want [direnv integration for 
> > > > emacs\.](https://github.com/wbolster/emacs-direnv)
> > > > 
> > > 
> > > emacs-direnv was my first choice, but then I changed to envrc 
> > > (https://github.com/purcell/envrc) . In both I got the error.
> > > 
> > 
> > I see. Envrc looks superior. Good to know.
> > 
> > You've covered all my bases. Shooting in the dark, I would 
> > confirm/check the following:
> > 
> 
> I have news:
> 
> It fails for python too. Using the same files as before and this block:
> 
> #+begin_src python 
> import pandas as pd
> import matplotlib.pyplot as plt
> #+end_src
> 
> It finds matplotlib, but fails to find pandas. I tried the same trick as 
> before (but with the python executable, no psql), added the line
> 
> (org-babel-python-command . ".direnv/.guix-profile/bin/python3")
> 
> but is not working. 
> 
> But if I am in shell, or in a python buffer or in a inferior-python process 
> Emacs is finding all the libraries and executables.
> 
> So, I am assumming that the problem lies in how org-babel searchs the path ...
> 
> Answers to your questions below:
> 
> 
> > How do you know that envrc is working otherwise?
> > 
> > When you switch to a direnv controlled buffer do you get any 
> > informative diagnostics in *Messages*?
> > 
> 
> Yes
> 
> > Do you get any more if you first `(setq envrc-debug t)`?
> > 
> Didn't try, Will do later
> 
> > Is this buffer in the same directory as the .direnvrc file?
> > 
> 
> Yes
> 
> > Presumably TRAMP is not in the mix in any way.
> >
> 
> No
> 
> > Variable sql-postgres-program is unchanged from default value of psql
> > 
> > What is result of
> > 
> > m-x shell-command
> > which psql
> > 
> 
> Is empty when I am not in a direnv controlled directory, the correct path 
> when I enter to those directories.
> 
> > and does it change as expected/required depending on the current active 
> > .direnvrc?
> > 
> > What happens if you eval (getenv 'psql) while in buffer governed by 
> > direnv, or alternatively
> > 
> > m-x getenv
> > psql

Ok - all this suggest that purcess/envrc processing is correctly resetting PATH 
in the emacs environment, as desired, but it is not being picked up in the 
environment which emacs consults when resolving the 'psql' to its full path.

A little sleuthing leads to `comint-exec-1 `function which sets exec-path and 
calls > start-file-process > start-process  which is documented to search 
exec-path and not PATH.

So, apparently exec-path is not being set/reset by emacs correctly (or at all).

Following up on this, it looks like it is trying, looking at these 2 code 
results in purcell/envrc https://github.com/purcell/envrc/search?q=exec-path

But, let's follow up on this, tell me, what does emacs reply when you, both 
inside & outside your direnv controlled directory, eval  `(describe-variable 
"exec-path")`, or alternatively:

c-h v exec-path

I think this will focus us on root cause

~Malcolm

> > 
> > If you `m-x shell`, does normal direnv work as expected in the created 
> > shell?
> > 
> 
> Yes, also works in vterm
> > > > >
> > > > >
> > > > >Where cdpp-manifest.scm contains the following:
> > > > >
> > > > >(specifications->manifest
> > > > >'("python"
> > > > >   "python-pandas"
> > > > >   "python-numpy"
> > > > >   "python-flask"
> > > > >   "python-graphene"
> > > > >   

RE: ob-sql is not finding psql when using direnv+guix

2021-05-12 Thread Cook, Malcolm
> > >I am using Guix with direnv.
> > 
> > What is your shell?
> > 
> 
> My shell is bash, originally I was using zsh and I thought that was the 
> problem, so I switched to bash and still not working.
> 
> > How/When do you "hook direnv into your shell" (https://direnv.net/)?
> > 
> 
> In the .profile file, at login.
> 
> > > In an specific folder I am installing and using psql and postgresql using 
> > > direnv+guix as follows:
> > >use guix --manifest=cdpp-manifest.scm
> > >
> > >export PGUSER=food_user
> > >export PGPASSWORD=some_password
> > >export PGDATABASE=food
> > >
> > >layout postgres
> > 
> > When are you doing this?
> > 
> > a) in the "specific folder"'s .envrc file?
> > b) in an org-mode shell block that you execute prior to the sql block?
> > c) ??
> 
> Option (a)
> 
> 
> > You seem to be following [Per\-project 
> > Postgres](https://jamey.thesharps.us/2019/05/29/per-project-postgres/) 
> > but with guix instead of nix. Nice.
> > 
> 
> Yep, great post. direnv + guix change the way I develop software, do data 
> science and write lectures and papers.
> 
> > If you enter the directory and then call emacs, earthing should just 
> > work, no changes neede.
> > 
> 
> It works for almost everything (sql-buffers, python buffers, etc), except for 
> org-babel sql blocks.
> 
> I am using EXWM, so emacs is always on.
> 
> 
> > If you want to tell emacs to adopt the environment established by a 
> > .direnv, you probably want [direnv integration for 
> > emacs\.](https://github.com/wbolster/emacs-direnv)
> > 
> 
> emacs-direnv was my first choice, but then I changed to envrc 
> (https://github.com/purcell/envrc) . In both I got the error.
> 

I see.  Envrc looks superior.  Good to know.

You've covered all my bases.  Shooting in the dark,  I would confirm/check the 
following:

How do you know that envrc is working otherwise?

When you switch to a direnv controlled buffer do you get any informative 
diagnostics in *Messages*?

Do you get any more if you first `(setq envrc-debug t)`?

Is this buffer in the same directory as the .direnvrc file?

Presumably TRAMP is not in the mix in any way.

Variable sql-postgres-program is unchanged from default value of psql

What is result of

m-x shell-command
which psql

and does it change as expected/required depending on the current active 
.direnvrc?

What happens if you eval (getenv 'psql) while in buffer governed by direnv, or 
alternatively

m-x getenv
psql

If you `m-x shell`, does normal direnv work as expected in the created shell?

> > I've got to try this!
> > 
> > Cheers
> > 
> 
> Please tell me how that works for you

Gotta get guix rolling again.  Hope to do this RSN.

Cheers,

~Malcolm

> 
> Thanks
> 
> - A
> 
> 
> > >
> > >
> > >Where cdpp-manifest.scm contains the following:
> > >
> > >(specifications->manifest
> > >'("python"
> > >   "python-pandas"
> > >   "python-numpy"
> > >   "python-flask"
> > >   "python-graphene"
> > >   "postgresql"
> > >   "jupyter"))
> > >
> > >I am able to use sql-mode and run queries against the database, in order 
> > >to achieve that I am using the following .dir-locals.el
> > >
> > >;;; Directory Local Variables
> > >;;; For more information see (info "(emacs) Directory Variables")
> > >
> > >
> > >((nil .
> > >  ((projectile-project-test-cmd . "pytest --color=no --failed-first 
> > >--maxfail=5")))
> > >(python-mode .
> > >  ((python-shell-buffer-name . "Python [CDPP-Inspecciones]")))
> > >
> > >(org-mode . (
> > >  (indent-tabs-mode . nil)
> > >  (org-src-preserve-indentation . t)
> > >  (org-footnote-auto-adjust . t)
> > >  (org-footnote-auto-label . t)
> > >  (ispell-local-dictionary . "spanish")
> > >  (org-export-allow-bind-keywords . t)
> > >  (org-footnote-define-inline . nil)
> > >  (org-footnote-section . "Footnotes")))
> > >
> > >(sql-mode . ((sql-connection-alist . ((mydb
> > >    (sql-product 'postgres)
> > >    (sql-database "mydb")
> > >    (sql-user "db_user")
> > >    (sql-server (expand-file-name 
> > >".direnv/postgres"))
> > >    (sql-port 5432)
> > >    )
> > >  )
> > >
> > >But If I try to use an sql org-babel block
> > >
> > >#+begin_src sql
> > >select 1;
> > >#+end_src
> > >
> > >(I am setting the connection variables in a PROPERTY)
> > >
> > >I get the error: `psql is not found`
> > >
> > >
> > >I was reading about the variable sql-postgres-program, so if I set the 
> > >following in dir-locals.el
> > >
> > >(sql-postgres-program . 
> > >"/gnu/store/f2v92bkx2vfzmkl14qxj3hlmby4dy9x0-profile/bin/psql")
> > >
> > >It works (note that psql ONLY lives inside the profile defined by 
> > >direnv+guix), 

RE: ob-sql is not finding psql when using direnv+guix

2021-05-10 Thread Cook, Malcolm
>I am using Guix with direnv.

What is your shell?

How/When do you "hook direnv into your shell" (https://direnv.net/)?

> In an specific folder I am installing and using psql and postgresql using 
> direnv+guix as follows:
>use guix --manifest=cdpp-manifest.scm
>
>export PGUSER=food_user
>export PGPASSWORD=some_password
>export PGDATABASE=food
>
>layout postgres

When are you doing this?

 a) in the "specific folder"'s .envrc file?
 b) in an org-mode shell block that you execute prior to the sql block?
 c) ??


You seem to be following [Per\-project 
Postgres](https://jamey.thesharps.us/2019/05/29/per-project-postgres/) but with 
guix instead of nix.  Nice.

If you enter the directory and then call emacs, earthing should just work, no 
changes neede.

If you want to tell emacs to adopt the environment established by a .direnv, 
you probably want [direnv integration for 
emacs\.](https://github.com/wbolster/emacs-direnv)

I've got to try this!

Cheers

>
>
>Where cdpp-manifest.scm contains the following:
>
>(specifications->manifest
>'("python"
>   "python-pandas"
>   "python-numpy"
>   "python-flask"
>   "python-graphene"
>   "postgresql"
>   "jupyter"))
>
>I am able to use sql-mode and run queries against the database, in order to 
>achieve that I am using the following .dir-locals.el
>
>;;; Directory Local Variables
>;;; For more information see (info "(emacs) Directory Variables")
>
>
>((nil .
>  ((projectile-project-test-cmd . "pytest --color=no --failed-first 
>--maxfail=5")))
>(python-mode .
>  ((python-shell-buffer-name . "Python [CDPP-Inspecciones]")))
>
>(org-mode . (
>  (indent-tabs-mode . nil)
>  (org-src-preserve-indentation . t)
>  (org-footnote-auto-adjust . t)
>  (org-footnote-auto-label . t)
>  (ispell-local-dictionary . "spanish")
>  (org-export-allow-bind-keywords . t)
>  (org-footnote-define-inline . nil)
>  (org-footnote-section . "Footnotes")))
>
>(sql-mode . ((sql-connection-alist . ((mydb
>    (sql-product 'postgres)
>    (sql-database "mydb")
>    (sql-user "db_user")
>    (sql-server (expand-file-name 
>".direnv/postgres"))
>    (sql-port 5432)
>    )
>  )
>
>But If I try to use an sql org-babel block
>
>#+begin_src sql
>select 1;
>#+end_src
>
>(I am setting the connection variables in a PROPERTY)
>
>I get the error: `psql is not found`
>
>
>I was reading about the variable sql-postgres-program, so if I set the 
>following in dir-locals.el
>
>(sql-postgres-program . 
>"/gnu/store/f2v92bkx2vfzmkl14qxj3hlmby4dy9x0-profile/bin/psql")
>
>It works (note that psql ONLY lives inside the profile defined by 
>direnv+guix), but I don't like the idea of hardcode the path.
>
>Is there a better way?
>
>Ideally I will expect that the org block will read it from the environment, 
>but is not working. 
>
>Thanks in advance
>


RE: Sharing variables between source blocks without session

2021-03-18 Thread Cook, Malcolm
Eric S Fraga  writes:
>
>> On Tuesday, 16 Mar 2021 at 09:56, Loris Bennett wrote:
>>> How can I avoid having to declare the variable 'user' for both blocks?
>>
>> I imagine you could use a property, as in
>>
>> #+property: header-args :var user=loris
>>
>> or even make it specific for the particular language.
>>
>> (untested)
>
>Thanks for point out using 'header-args;' as property. However, if I do
>the following, the variable is unset in the shell script:
>
>#+properties: header-args :var user=loris
>
>#+begin_src sh
>echo user: ${user}
>#+end_src
>
>#+RESULTS:
>: user:
>
>Is that supposed to work, or am I doing something wrong?

I am unfamiliar with using the plural form of property, as you are trying, at 
buffer-level nor do I see  documented possible here:
https://orgmode.org/manual/Property-Syntax.html#Property-Syntax

try this:

#+property: header-args:sh :var user="loris"
#+begin_src sh
echo user: ${user}
#+end_src

Important: After adding or modifying the #+property line, you will need to 
instruct org to "refresh your local setup" which I typically accomplish by 
positioning the point on that line and typing C-c C-c

>
>Cheers,
>
>Loris
>
>-- 
>This signature is currently under construction.
>


RE: state of the art in org-mode tables e.g. join, etc

2021-02-22 Thread Cook, Malcolm
Greg,

Of course, I’m not surprised by the results of your efforts.  Nice!

I myself don’t prefer the tidyverse, mainly except for ggplot, and instead find 
myself reaching for sqldf or data.tables where such benefit is needed.

YMMV,

Malcolm

From: Greg Minshall 
Sent: Monday, February 22, 2021 02:13
To: Cook, Malcolm 
Cc: John Kitchin ; Tim Cross ; 
org-mode-email 
Subject: Re: state of the art in org-mode tables e.g. join, etc

ATTENTION: This email came from an external source. Do not open attachments or 
click on links from unknown senders or unexpected emails.


Malcolm,

> Checkout what R sqldf package makes easy:

very nice!

Greg

ps -- (feeling a challenge... :) for base R, dplyr::inner_join, the
following seem to work (i apologize that i don't know how people embed
org-frags in e-mail, or how important that format might be?)

#+NAME: original
| Day | Color | Level | Quantity |
|---+---+---+--|
| Monday | Red | 30 | 11 |
| Monday | Blue | 25 | 3 |
| Tuesday | Red | 51 | 12 |
| Tuesday | Red | 45 | 15 |
| Tuesday | Blue | 33 | 18 |
| Wednesday | Red | 27 | 23 |
| Wednesday | Blue | 12 | 16 |
| Wednesday | Blue | 15 | 15 |
| Thursday | Red | 39 | 24 |
| Thursday | Red | 41 | 29 |
| Thursday | Red | 49 | 30 |
| Friday | Blue | 7 | 5 |
| Friday | Blue | 6 | 8 |
| Friday | Blue | 11 | 9 |

#+PROPERTY: header-args:R :session *R*
#+begin_src R :results none
library(dplyr)
#+end_src

#+begin_src R :var original=original :colnames yes
as.data.frame(table(Color=original$Color))
#+end_src

#+RESULTS:
| Color | Freq |
|---+--|
| Blue | 7 |
| Red | 7 |



*** join example

Example from https://github.com/tbanel/orgtbljoin

#+name: nutrition
| type | Fiber | Sugar | Protein | Carb |
|--+---+---+-+--|
| eggplant | 2.5 | 3.2 | 0.8 | 8.6 |
| tomatoe | 0.6 | 2.1 | 0.8 | 3.4 |
| onion | 1.3 | 4.4 | 1.3 | 9.0 |
| egg | 0 | 18.3 | 31.9 | 18.3 |
| rice | 0.2 | 0 | 1.5 | 16.0 |
| bread | 0.7 | 0.7 | 3.3 | 16.0 |
| orange | 3.1 | 11.9 | 1.3 | 17.6 |
| banana | 2.1 | 9.9 | 0.9 | 18.5 |
| tofu | 0.7 | 0.5 | 6.6 | 1.4 |
| nut | 2.6 | 1.3 | 4.9 | 7.2 |
| corn | 4.7 | 1.8 | 2.8 | 21.3 |


#+name: recipe
| type | quty |
|--+--|
| onion | 70 |
| tomatoe | 120 |
| eggplant | 300 |
| tofu | 100 |


#+begin_src R :var recipe=recipe :var nutrition=nutrition :colnames yes
dplyr::inner_join(nutrition, recipe)
#+end_src

#+RESULTS:
| type | Fiber | Sugar | Protein | Carb | quty |
|--+---+---+-+--+--|
| eggplant | 2.5 | 3.2 | 0.8 | 8.6 | 300 |
| tomatoe | 0.6 | 2.1 | 0.8 | 3.4 | 120 |
| onion | 1.3 | 4.4 | 1.3 | 9 | 70 |
| tofu | 0.7 | 0.5 | 6.6 | 1.4 | 100 |


RE: state of the art in org-mode tables e.g. join, etc

2021-02-21 Thread Cook, Malcolm

John,

Checkout what R sqldf package makes easy:

** aggregation example

Examples from https://github.com/tbanel/orgaggregate


#+NAME: original
| Day   | Color | Level | Quantity |
|---+---+---+--|
| Monday| Red   |30 |   11 |
| Monday| Blue  |25 |3 |
| Tuesday   | Red   |51 |   12 |
| Tuesday   | Red   |45 |   15 |
| Tuesday   | Blue  |33 |   18 |
| Wednesday | Red   |27 |   23 |
| Wednesday | Blue  |12 |   16 |
| Wednesday | Blue  |15 |   15 |
| Thursday  | Red   |39 |   24 |
| Thursday  | Red   |41 |   29 |
| Thursday  | Red   |49 |   30 |
| Friday| Blue  | 7 |5 |
| Friday| Blue  | 6 |8 |
| Friday| Blue  |11 |9 |

#+PROPERTY: header-args:R  :session *R*

#+begin_src R :results none
library(sqldf)
#+end_src


#+begin_src R :var original=original :colnames yes
sqldf('select Color, count(*) from original group by Color;')
#+end_src

#+RESULTS:
| Color | count(*) |
|---+--|
| Blue  |7 |
| Red   |7 |



** join example

Example from https://github.com/tbanel/orgtbljoin

#+name: nutrition
| type | Fiber | Sugar | Protein | Carb |
|--+---+---+-+--|
| eggplant |   2.5 |   3.2 | 0.8 |  8.6 |
| tomatoe  |   0.6 |   2.1 | 0.8 |  3.4 |
| onion|   1.3 |   4.4 | 1.3 |  9.0 |
| egg  | 0 |  18.3 |31.9 | 18.3 |
| rice |   0.2 | 0 | 1.5 | 16.0 |
| bread|   0.7 |   0.7 | 3.3 | 16.0 |
| orange   |   3.1 |  11.9 | 1.3 | 17.6 |
| banana   |   2.1 |   9.9 | 0.9 | 18.5 |
| tofu |   0.7 |   0.5 | 6.6 |  1.4 |
| nut  |   2.6 |   1.3 | 4.9 |  7.2 |
| corn |   4.7 |   1.8 | 2.8 | 21.3 |


#+name: recipe
| type | quty |
|--+--|
| onion|   70 |
| tomatoe  |  120 |
| eggplant |  300 |
| tofu |  100 |


#+begin_src R :var recipe=recipe :var nutrition=nutrition :colnames yes
sqldf('select * from recipe, nutrition where recipe.type=nutrition.type')
#+end_src

#+RESULTS:
| type | quty | type | Fiber | Sugar | Protein | Carb |
|--+--+--+---+---+-+--|
| onion|   70 | onion|   1.3 |   4.4 | 1.3 |9 |
| tomatoe  |  120 | tomatoe  |   0.6 |   2.1 | 0.8 |  3.4 |
| eggplant |  300 | eggplant |   2.5 |   3.2 | 0.8 |  8.6 |
| tofu |  100 | tofu |   0.7 |   0.5 | 6.6 |  1.4 |



This should also be possible but I cannot get it to work now:

#+begin_src R :var recipe=recipe :var nutrition=nutrition :colnames yes 
:prologue sqldf(' :epilogue ')
select * from recipe, nutrition where recipe.type=nutrition.type
#+end_src





From: Emacs-orgmode  On Behalf 
Of John Kitchin
Sent: Sunday, February 21, 2021 10:24
To: Tim Cross 
Cc: org-mode-email 
Subject: Re: state of the art in org-mode tables e.g. join, etc

ATTENTION: This email came from an external source. Do not open attachments or 
click on links from unknown senders or unexpected emails.

For fun, here is the sqlite equivalent of the Pandas example using the same 
tables as before


** aggregation example

Examples from https://github.com/tbanel/orgaggregate


#+NAME: original
| Day   | Color | Level | Quantity |
|---+---+---+--|
| Monday| Red   |30 |   11 |
| Monday| Blue  |25 |3 |
| Tuesday   | Red   |51 |   12 |
| Tuesday   | Red   |45 |   15 |
| Tuesday   | Blue  |33 |   18 |
| Wednesday | Red   |27 |   23 |
| Wednesday | Blue  |12 |   16 |
| Wednesday | Blue  |15 |   15 |
| Thursday  | Red   |39 |   24 |
| Thursday  | Red   |41 |   29 |
| Thursday  | Red   |49 |   30 |
| Friday| Blue  | 7 |5 |
| Friday| Blue  | 6 |8 |
| Friday| Blue  |11 |9 |


#+begin_src sqlite :db ":memory:" :var orgtable=original :colnames yes
drop table if exists testtable;
create table testtable(Day str, Color str, Level int, Quantity int);
.mode csv testtable
.import $orgtable testtable
select Color, count(*) from testtable group by Color;
#+end_src

#+RESULTS:
| Color | count(*) |
|---+--|
| Blue  |7 |
| Red   |7 |

** join example

Example from https://github.com/tbanel/orgtbljoin

#+name: nutrition
| type | Fiber | Sugar | Protein | Carb |
|--+---+---+-+--|
| eggplant |   2.5 |   3.2 | 0.8 |  8.6 |
| tomatoe  |   0.6 |   2.1 | 0.8 |  3.4 |
| onion|   1.3 |   4.4 | 1.3 |  9.0 |
| egg  | 0 |  18.3 |31.9 | 18.3 |
| rice |   0.2 | 0 | 1.5 | 16.0 |
| bread|   0.7 |   0.7 | 3.3 | 16.0 |
| orange   |   3.1 |  11.9 | 1.3 | 17.6 |
| banana   |   2.1 |   9.9 | 0.9 | 18.5 |
| tofu |   0.7 |   0.5 | 6.6 |  1.4 |
| nut  |   2.6 |   1.3 | 4.9 |  7.2 |
| corn |   4.7 |   1.8 | 2.8 | 21.3 |


#+name: 

RE: org 9.2.6 and org 9.1.9

2019-11-27 Thread Cook, Malcolm
Hi Stefan,



I don’t think I’ve ever seen a root-cause analysis, but I’ve seen many problems 
that are resolved by some version of a “clean build” of org.  Here are some:



- 
[[https://lists.defectivebydesign.org/archive/html/emacs-orgmode/2012-09/msg01365.html][Installing
 Org through the new http://orgmode.org ELPA]]

- 
[[https://lists.defectivebydesign.org/archive/html/emacs-orgmode/2015-08/msg00316.html][latest
 org from Elpa error: Invalid function: org-babel-header-a]]

- 
[[https://lists.defectivebydesign.org/archive/html/emacs-orgmode/2015-08/msg00318.html][Re:
 [O] wrong type argument listp... org-element-set-contents]]



That's what I got.



BTW: I now use org-plus-contrib in place of org with this mantra:



(add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/;) t)

(use-package  org ;org-plus-contrib  ; 
instead of org-mode

  :ensure org-plus-contrib ; following 
http://emacs.stackexchange.com/questions/7890/org-plus-contrib-and-org-with-require-or-use-package

)



- Cheers
Malcolm

> Here's what I do, at the shell:
>
>
>
> emacs -Q -batch -eval "(progn (require 'package) (add-to-list
> 'package-archives '(\"org\" . 
> \"http://orgmode.org/elpa/\";))
> (package-initialize) (package-refresh-contents) (package-install
> 'org-plus-contrib))"

I can't blame you for using such workarounds, but it would *really* help
if you could report the actual problems encountered (and then use the
workaround until we fix the source of the problem).


Stefan


RE: org 9.2.6 and org 9.1.9

2019-11-26 Thread Cook, Malcolm
Tim,



Yes, it is a bit of dependency hell.



Quoting myself from Re: [O] How to safely update from ver. 8.2.10 to 
8.3.x
 :





Here's what I do, at the shell:



  emacs -Q -batch -eval "(progn (require 'package) (add-to-list

'package-archives '(\"org\" . 
\"http://orgmode.org/elpa/\;;))

(package-initialize) (package-refresh-contents) (package-install

'org-plus-contrib))"



This assures that org is not already loaded when org is compiled, which I've

learned is the source of creating a mess.



Note: I use org-plus-contrib from melpa instead of org.  If you want just org,

you could simply:



  emacs -Q -batch -eval "(progn (require 'package) (package-initialize)

(package-refresh-contents) (package-install 'org-plus-contrib))"



HTH,



Malcolm



From: Emacs-orgmode  On Behalf 
Of Tim Cross
Sent: Tuesday, November 26, 2019 3:41 PM
To: Nick Dokos 
Cc: Org-mode ; Emacs developers 
Subject: Re: org 9.2.6 and org 9.1.9

CAUTION: This email was received from an External Source

There is a very important rule which must be followed wrt org-mode 
installation. It is critical that no version of org is already loaded before 
installing a new version. This can be quite tricky as many of us have org 
setups which automatically load some org functionality without explicitly 
opening an org file or agenda view (for example, you might be using an org 
add-on for email). Situation is worse if we are loading org as part of our 
init.el.

I'm also not sure that tweaking the load-path order is sufficient if your 
installing org via M-x package-install as there is a 'chicken and egg' problem 
with the initial install. If your init.el file is loading org functionality and 
you only have the built-in org version installed, that version will be loaded 
before you run package-install. Probably works if you install via your init.el 
though.

I've found the safest thing to do is only use autoload or use-package with 
deferred loading for org and whenever updating org (I use the org-plus-contrib 
package from the org elpa repo) only update immediately after a fresh restart 
of emacs and before doing anything else.  Failing to do this often results in a 
broken build as you get a set of new org elc files which contains definitions 
from two different org versions. When the versions are only different in minor 
version numbers, this mixed build may not even be noticeable, but when major 
version differences exist, you get the symptom of broken functionality, missing 
definitions or unbound symbols.

The situation is made worse by package maintainers specifying the latest org 
version rather than the version built into Emacs when the bundled version would 
be sufficient.

It took me a while to structure my init.el file such that no org functionality 
was loaded until I used something which depends on it. However, once I did, 
provided I only update org in a fresh new session, all works flawlessly. I 
found use-package package really helped with this.



On Wed, 27 Nov 2019 at 06:22, Nick Dokos 
mailto:ndo...@gmail.com>> wrote:
Jean-Christophe Helary 
mailto:jean.christophe.hel...@traduction-libre.org>>
 writes:

> org 9.1.9 is a built-in
>
> but org 9.2.6 comes as a dependency to some packages and having both 
> installed creates conflicts.
>

What conflicts are you seeing? I have the built-in 9.1.9 org that
comes with emacs but I run (close to) latest master and I see no
problems: the only thing I do is to set my load-path to point to the
right place (and make sure that that setting precedes the
/usr/local/share/emacs/27.0.50/lisp/org setting that emacs adds):

(add-to-list 'load-path (expand-file-name "~/elisp/org-mode/lisp"))

Although that has been enough for me, it's probably safer to delete
from load-path all other org entries, thereby making the built-in
version invisible to emacs - in my case, I just have the one:

   (delete "/usr/local/share/emacs/27.0.50/lisp/org" load-path)

That way, if you happen to do something like `(require 'old-org-req)'
with a requirement that is not satisfied by current org, but is
satisfied by the built-in org, you'd get an error, rather than getting
a mixed installation.

> Why does that happen ?
>
> Can't 9.2.6 override 9.1.9 ? It's not the first time I have issues
> with that situation and that's extremely confusing. What is the best
> way to solve that ?
>

I think the above should be enough (and IME it is), but maybe someone can
think of other things that might trip one up.

--
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler



--
regards,

Tim

--
Tim Cross



[O] sql code block #+BEGIN_SRC sql :tangle qry/testthis.sql :cmdline "-v this=\\'asdf\\'"

2019-09-03 Thread Cook, Malcolm


I am surprised by the level of quoting seemingly required by org-mode to pass a 
variable to psql in :cmdline



The following works:



#+PROPERTY: header-args:sql :engine postgresql :dbhost  my.host :database mydb 
:dbuser me

#+PROPERTY: header-args:sql+ :tangle no :results table :exports both

#+BEGIN_SRC sql :cmdline "-v this=\\'that\\'"

select :this as this

#+END_SRC



#+RESULTS:

| this |

|--|

| that |





However, I found no other quote/escape combination to work.  At first I 
expected to work:



:cmdline "-v this=\'asdf\'"



... but it is an error.



Is this expected and consistent with other emacs behavior?



Is there another, perhaps simpler, way to pass variables to postgresql  code 
block in org ob-sql?



Thanks,



Malcolm


[O] BUG: org-archive-subtree LOSES DATA when run on unsaved buffer

2019-04-09 Thread Cook, Malcolm
Hi,

I never use org's archiving capabilities.

So imaging my surprise when I accidently invoked org-archive-subtree from its 
key-binding and I lost a whole subtree of a new buffer which (alas) I had not 
yet saved to disk

Further alas, I was so alarmed not knowing where my content disappeared to that 
I did not think to try the obvious - undo.

What happens?  It appears that org-archive-subtree will create a symlink to a 
non-existent target and try to move the subtree there (which does not make 
sense) and does not check for errors or confirm completion.

This arguably should be addressed.

This is emacs 26.1 running org-version 9.2.3-4

In the mean time...

Still livin' in emacs + Org,

~Malcolm



Re: [O] [POLL] Should Org tempo be enabled by default? (expand templates thru e.g. "<s[TAB]")

2018-05-01 Thread Cook, Malcolm
Thanks for the re-cap.  

I'm changing my vote.

Make the change!  Change the default!  And make lots of noise advertising it 
(make more prominent https://orgmode.org/Changes.html , etc).

Someone suggested going to v10.x  Is there a case for this?

Thx of org!

 > -Original Message-
 > From: Emacs-orgmode  bounces+mec=stowers@gnu.org> On Behalf Of Nicolas Goaziou
 > Sent: Tuesday, May 01, 2018 7:36 AM
 > To: Steve Downey 
 > Cc: Bastien ; Tim Cross ; Org-
 > mode ; Jon Snader 
 > Subject: Re: [O] [POLL] Should Org tempo be enabled by default? (expand
 > templates thru e.g. " 
 > Hello,
 > 
 > Steve Downey  writes:
 > 
 > > Asking users to accept any breakage in the tool they use to get work done
 > > is a lot. Changes in UI in emacs are opt-in.
 > >
 > > Even if the change is the right thing to do.
 > 
 > I think some of you (basically, anyone thinking we should enable " TAB" by default ;)) are missing the point.
 > 
 > 
 > The first important thing to understand is that, even if we enable
 > `org-tempo' by default, next Org release /will break/ for some of us.
 > 
 > - It will break because `org-tempo' is only 99% backward-compatible.  So
 >   anyone having customizing templates is bound to change them.
 > 
 > - It will break because there are 9 other incompatible changes between
 >   9.1 and 9.2.
 > 
 > So, asking to load `org-tempo' by default just to avoid breaking users
 > set-up is a wrong argument. It will only "protect" those among us that
 > use " incompatible changes. IOW, updating Org from 9.1 to 9.2 will not be
 > smooth for everyone. No matter what `org-tempo' becomes.
 > 
 > 
 > The second important point is there is a general design issue at stake.
 > Sorry, there is no pleasure in inflicting "torture" (as I read in this
 > thread) to users.
 > 
 > Org is too big. Its (lack of) design is wrong.
 > 
 > This is not from me, but from some the Emacs developers, in particular
 > Richard Stallman. You may want to read the thread "Differences between
 > Org-Mode and Hyperbole" in emacs-devel mailing list archives for the
 > exact quote.
 > 
 > Org has to be big, because it is featureful. Yet, we cannot ignore the
 > remark. Also, that doesn't mean we cannot do anything to improve the
 > situation. Actually, there are, at least, two areas in which we can make
 > progress:
 > 
 > 1. externalize Org features that apply to other major modes, or drop
 >them if there are equivalents to them,
 > 
 > 2. re-using (external) Emacs facilities for Org mode features that are
 >not central for us.
 > 
 > Not so long ago, we provided footnotes for other modes, even though
 > "footnote.el" had been there for a long time. This clearly felt into
 > (1), so we dropped the feature. Recently, I wrote "orgalist.el", which
 > ports Org plain lists into other modes. I moved it out of Org core
 > because of (1). It is now available in GNU ELPA.
 > 
 > Expansion templates are a great thing, but this is only sugar for Org,
 > which is totally usable without them. Besides, some facilities are
 > providing it for us. This falls into (2). By design, I'm convinced we
 > should not include them. I also wish that anyone involved in this thread
 > can take a step back to see the whole picture.
 > 
 > The question is not about you using " 'org-tempo) could solve this. The question is not about breaking other
 > configurations: there always have been breakage and there will be again.
 > The question is about designing Org so it fits well -- better, at
 > least -- in the Emacs ecosystem. This means no unreasonable feature
 > overlap and enough modularity to be re-usable from other parts in Emacs.
 > 
 > 
 > Back to the current poll. It would be more efficient to think about
 > solutions to make the update less painful. In particular, how can we
 > tell users updating from ELPA about the necessary changes involved.
 > 
 > I remember that Magit experimented displaying a message the first time
 > you used a new release; you would silence it only by setting a variable.
 > I don't think this is the case anymore, so it may have failed, though.
 > We could also make the  page more
 > prominent in the summary displayed along with the package.
 > 
 > 
 > Now back to the poll.
 > 
 > Regards,
 > 
 > --
 > Nicolas Goaziou
 > 
 > P.S: Bastien, would you please stop lobbying in every other
 > communication canal out there, that's not fair ;)




Re: [O] [POLL] Should Org tempo be enabled by default? (expand templates thru e.g. "<s[TAB]")

2018-04-30 Thread Cook, Malcolm
If the poll is still open, I vote don’t change the default.

Unless I missed a prior good argument for changing it…

Or, unless, upon first invocation, org-mode guided you through or prompted you 
to changing your defaults, or at the very least, offered/insisted upon your 
reading ORG-NEWS.

Otherwise, I think Jon is spot on in his assessment of  “what’s going to 
happen” to many.


From: Emacs-orgmode  On Behalf 
Of Tim Cross
Sent: Monday, April 30, 2018 5:25 PM
To: Jon Snader 
Cc: Bastien ; Org-mode 
Subject: Re: [O] [POLL] Should Org tempo be enabled by default? (expand 
templates thru e.g. "> 
wrote:

Richard Lawrence 
> writes:
Jon Snader > writes:
I use the 

[O] info-js hijacks clicks disallowing integration with other custom click handlers

2018-03-02 Thread Cook, Malcolm
Hello,

I  am using infojs_opt while exporting to html from org-mode

I find that it “hijacks” all clicks.

This is interfering with some custom click handlers I’ve coded up for toggling 
the display of code listings when clicking on their caption.

Does anyone have a suggestion for me to get the best of both worlds?

If it helps, below is what I have in my SETUPFILE.org to provide for my desired 
handling of source code.

Thanks
~malcolm_c...@stowers.org


#+HTML_HEAD: .org-src-name {text-decoration: underline; font-style: 
italic; font-family: monospace;  border-left: 1em solid Yellow; }
#+HTML_HEAD:  
#+HTML_HEAD:   $(document).ready(function() {
#+HTML_HEAD: $('.src').hide() // start out with hidden listings (source 
code) - my clients mostly want RESULTS!!!
#+HTML_HEAD: $('.org-src-name').click(function(e){
#+HTML_HEAD// allow to individually toggles src listing by clicking 
on its #+CAPTION (ASSUMING it has one).
#+HTML_HEAD:   $(this).next('.src').slideToggle();
#+HTML_HEAD:  });
#+HTML_HEAD: $(document).keyup(function(e){
#+HTML_HEAD: switch(e.keyCode){
#+HTML_HEAD: // display/hide ALL source code listings on w/alt-w (chosen to 
not conflict with +INFOJS_OPT keybindings).
#+HTML_HEAD: case 87 : if (e.altKey) {$('.src').slideUp()} else 
{$('.src').slideDown()} ; break;
#+HTML_HEAD: }
#+HTML_HEAD: });
#+HTML_HEAD:   } );
#+HTML_HEAD:   


Re: [O] Release 9.1.2

2017-10-05 Thread Cook, Malcolm
> "Cook, Malcolm" <m...@stowers.org> writes:
 > 
 > > Should we expect to find release notes at
 > > http://orgmode.org/Changes.html or somewhere else?
 > 
 > Yes, that's the place for human readable changelogs, which we update
 > for major and minor releases, not for bugfix releases.

Ah!  Understood.  Thanks!

> And http://orgmode.org/cgit.cgi/org-mode.git/log/ gives the detailed
 > git logs.
 > 
 > HTH,

It does!

> --
 >  Bastien



Re: [O] Release 9.1.2

2017-10-05 Thread Cook, Malcolm
> Hi all,

Yay!  Thanks for org!  Always a game changer.  

Should we expect to find release notes at http://orgmode.org/Changes.html or 
somewhere else?

 > 
 > Org 9.1.2 is out.
 > 
 > Enjoy!
> 
 > --
 >  Bastien
 > 




Re: [O] is it bad to have both org and org-plus-contrib installed?

2017-04-11 Thread Cook, Malcolm
Hi,
Coming late to this fray and responding to original Subject

If you

(require 'use-package)

Then you might find the following to work, as I do:

(use-package org
  :ensure org-plus-contrib ; following 
http://emacs.stackexchange.com/questions/7890/org-plus-contrib-and-org-with-require-or-use-package
;; .. etc
)

YMMV,

Malcolm

From: Emacs-orgmode [mailto:emacs-orgmode-bounces+mec=stowers@gnu.org] On 
Behalf Of Kaushal Modi
Sent: Tuesday, April 11, 2017 5:39 PM
To: Thomas S. Dye ; Alan Schmitt 

Cc: emacs-orgmode 
Subject: Re: [O] is it bad to have both org and org-plus-contrib installed?

Hi all,

I just discovered a bug in this advice that I suggested earlier in this 
thread.. I needed to fix the order of packages in the new-ret list that is 
returned. The bug was that the order of pkgs in new-ret was flipped compared to 
that in orig-ret.. so I needed to flip it back using reverse.

So just for record, here is the fixed function:

;; http://emacs.stackexchange.com/a/26513/115
(defun modi/package-dependency-check-ignore (orig-ret)
  "Remove the `black listed packages' from ORIG-RET.

Packages listed in the let-bound `pkg-black-list' will not be auto-installed
even if they are found as dependencies.

It is known that this advice is not effective when installed packages
asynchronously using `paradox'. Below is effective on synchronous
package installations."
  (let ((pkg-black-list '(org))
new-ret
pkg-name)
(dolist (pkg-struct orig-ret)
  (setq pkg-name (package-desc-name pkg-struct))
  (if (member pkg-name pkg-black-list)
  (message (concat "Package `%s' will not be installed. "
   "See `modi/package-dependency-check-ignore'.")
   pkg-name)
(push pkg-struct new-ret)))
;; Tue Apr 11 17:48:16 EDT 2017 - kmodi
;; It's *very* critical that the order of packages stays the same in NEW-RET
;; as in ORIG-RET. The `push' command flips the order, so use `reverse'
;; to flip the order back to the original.
;;   Without this step, you will get errors like below when installing
;; packages with dependencies:
;;   Debugger entered--Lisp error: (error "Unable to activate package 
‘nim-mode’.
;;   Required package ‘flycheck-28’ is unavailable")
(setq new-ret (reverse new-ret))
new-ret))
(advice-add 'package-compute-transaction :filter-return 
#'modi/package-dependency-check-ignore)

On Tue, Jan 24, 2017 at 11:28 AM Thomas S. Dye 
> wrote:

Alan Schmitt writes:

> Thank you for the suggestion, but I use Spacemacs, which in turn uses
> paradox.
>
> Why couldn't there be an org-contrib package, depending on org? So that
> way org would not be duplicated in two packages.

I've run into the same problem with Spacemacs and would welcome a
solution.

All the best,
Tom

--
Thomas S. Dye
http://www.tsdye.com
--

Kaushal Modi


Re: [O] org-annotate/collaboration?

2017-02-10 Thread Cook, Malcolm
Alan, just wondering, what operating system and file system are you using now?



Re: [O] heading specific fast keys?

2016-12-21 Thread Cook, Malcolm


 > -Original Message-
 > From: Emacs-orgmode [mailto:emacs-orgmode-
 > bounces+mec=stowers@gnu.org] On Behalf Of John Kitchin
 > Sent: Wednesday, December 21, 2016 2:18 PM
 > To: emacs-orgmode@gnu.org
 > Subject: [O] heading specific fast keys?
 > 
 > I wondered if anyone know a straight forward way to make
 > heading-specific fast keys in org-mode.
 > 
 > The idea is if I am on a heading that is a "contact" (which means it has
 > an EMAIL property), then there would be special hot keys for it, e.g.
 > "e" would compose a message, "u" might open a URL if it had one, etc...
 > 
 > Or, on entries captured from elfeed, I could just press "b" to open the
 > entry in a browser, etc...
 > 
 > I guess there would need to be some kind of hook that looks up a keymap
 > or something on these special positions. And maybe a default map for
 > non-special headings.
 > 
 > Thoughts?

Possible synergy from one of the approaches to 
[MultipleModes](https://www.emacswiki.org/emacs?search=%22MultipleModes%22)

I use polymode in org-mode to good effect within which switches mode with code 
blocks to be language specific.

It might suggest an architecture


> 
 > --
 > 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] How to safely update from ver. 8.2.10 to 8.3.x

2016-08-22 Thread Cook, Malcolm
> > I would not trust the result from failing to drop the -Q since the -Q is 
> > what
 > prevents your init file from loading, which we are explicitly trying to avoid
 > for the sake of compiling org in a fresh environment.
 > >
 > According to [[info:emacs#Initial Options]], --batch implies -q.
 > About -q and -Q, we have:
 > 
 > ‘-q’
 > ‘--no-init-file’
 >  Do not load any initialization file (*note Init File::).  When
 >  Emacs is invoked with this option, the Customize facility does not
 >  allow options to be saved (*note Easy Customization::).  This
 >  option does not disable loading ‘site-start.el’.
 > [...]
 > ‘-Q’
 > ‘--quick’
 >  Start emacs with minimum customizations.  This is similar to using
 >  ‘-q’, ‘--no-site-file’, ‘--no-site-lisp’, and ‘--no-splash’
 >  together.  This also stops Emacs from processing X resources by
 >  setting ‘inhibit-x-resources’ to ‘t’ (*note Resources::).


Aha - thanks for the rundown. 


 > 
 > So --batch implies -q, which is enough to bypass init.el.  -Q is
 > stronger than -q: it adds ‘--no-site-file’, ‘--no-site-lisp’, and
 > ‘--no-splash’ and inibits X resources.  But AFAIK, only my init.el
 > loads Org, and not site-start.el, which is empty here, or any Lisp
 > file in a site-lisp directory.  I searched every file in
 > /usr/share/emacs/site-lisp for "org" and I didn't find any line that
 > loads Org.
 > 
 > I am an Emacs beginner though, so I may be wrong.

I'm now figuring you're right.

> 
 > --


Re: [O] How to safely update from ver. 8.2.10 to 8.3.x

2016-08-22 Thread Cook, Malcolm
> In the last command I forgot to drop the -Q.  But I guess it works either way.

I would not trust the result from failing to drop the -Q since the -Q is what 
prevents your init file from loading, which we are explicitly trying to avoid 
for the sake of compiling org in a fresh environment.

~Malcolm

 > 
 > On 22 August 2016 at 12:25, Jorge <jorge13...@gmail.com> wrote:
 > > On 15 August 2016 at 14:29, Cook, Malcolm <m...@stowers.org> wrote:
 > >>   emacs -Q -batch -eval "(progn (require 'package) (add-to-list
 > 'package-archives '(\"org\" . \"http://orgmode.org/elpa/\;))  (package-
 > initialize) (package-refresh-contents) (package-install 'org-plus-contrib))"
 > > Here I plan to drop the "-Q" (because --batch already implies -q,
 > > which I think is enough).  So my command would be
 > > emacs --batch --eval "(progn (require 'package) (add-to-list
 > > 'package-archives '(\"org\" . \"http://orgmode.org/elpa/\;))
 > > (package-initialize) (package-refresh-contents) (package-install
 > > 'org-plus-contrib))"
 > >
 > >> Note: I use org-plus-contrib from melpa instead of org.  If you want just
 > org, you could simply:
 > >>
 > >>   emacs -Q -batch -eval "(progn (require 'package) 
 > >> (package-initialize)
 > (package-refresh-contents) (package-install 'org-plus-contrib))"
 > >
 > > Would not it be
 > > emacs -Q --batch --eval "(progn (require 'package)
 > > (package-initialize) (package-refresh-contents) (package-install
 > > 'org))"
 > > ?
 > >
 > >
 > > --
 > > - I am Brazilian.  I apologize for possibly bad English and I welcome
 > > corrections.
 > > - Please adopt free formats like PDF, ODF, LaTeX, Vorbis, Opus, WebM
 > and 7z.
 > > - Free software for Android: https://f-droid.org/
 > 
 > 
 > 
 > --
 > - I am Brazilian.  I apologize for possibly bad English and I welcome
 > corrections.
 > - Please adopt free formats like PDF, ODF, LaTeX, Vorbis, Opus, WebM and
 > 7z.
 > - Free software for Android: https://f-droid.org/


Re: [O] How to safely update from ver. 8.2.10 to 8.3.x

2016-08-15 Thread Cook, Malcolm
> this weekend I got through lots of troubles, because I updated my
 > orgmode version with "manage emacs packages" menu command and
 > somehow
 > got mixed preferences.
 > 
 > Now, after a clean install, I have org mode 8.2.10 and would like to
 > update to version 8.3.x (20160808) which is shown under the menu
 > command
 > "manage emacs packages".
 > 
 > How can I do this safely, without creating a mess again?

Here's what I do, at the shell:

  emacs -Q -batch -eval "(progn (require 'package) (add-to-list 
'package-archives '(\"org\" . \"http://orgmode.org/elpa/\;))  
(package-initialize) (package-refresh-contents) (package-install 
'org-plus-contrib))"

This assures that org is not already loaded when org is compiled, which I've 
learned is the source of creating a mess.

Note: I use org-plus-contrib from melpa instead of org.  If you want just org, 
you could simply:

  emacs -Q -batch -eval "(progn (require 'package) (package-initialize) 
(package-refresh-contents) (package-install 'org-plus-contrib))"

HTH,

Malcolm

 > 
 > Thanks for all advice,
 > Maria



Re: [O] seeking good practices for writing about org using org

2016-08-04 Thread Cook, Malcolm
Hi Charles,



> On Wed, 3 Aug 2016, Cook, Malcolm wrote:

>

 > > Thanks.  Much closer.  Still some issues.  Mind taking another

> > gander  (hoping the attached jpeg of the webpage rendered comes

> > through as an attachment)

> >

> > If my emacs buffer holds...

> > --

> > #+BEGIN_SRC org :exports both :results value ascii

>

 > ...^

>

 > what is the `ascii' doing?

>

 > Can you provide a link to documentation in the manual or a

> docstring describing its function?



I cannot!  I learned this from reading the code.  In ob-org.el we find 
provision for this  as well as `html' and `latex'



(defun org-babel-execute:org (body params)

  "Execute a block of Org code with.

This function is called by `org-babel-execute-src-block'."

  (let ((result-params (split-string (or (cdr (assoc :results params)) "")))

(body (org-babel-expand-body:org

   (replace-regexp-in-string "^," "" body) params)))

(cond

 ((member "latex" result-params)

  (org-export-string-as (concat "#+Title: \n" body) 'latex t))

 ((member "html" result-params) (org-export-string-as  body 'html t))

 ((member "ascii" result-params) (org-export-string-as body 'ascii t))

 (t body)

 )))





This is all undocumented.  I think it is a 'nod in the direction' of what I am 
trying to accomplish, allowing to see as "results" the org markup transcoded 
into the markup of a backend.  See below for my hack extension on this idea.



>

 > Why don't you have 'replace' in the :results args?



Oops.  Of course.  While trying to understand all this, I had done this to 
similar effect instead:



(setq  org-babel-default-header-args:org nil) ; fix bug? NOT silent





> >

> > ,* Acknowledgments

>

 > This bit behaves as you might expect in plain text export, markdown, and

> latex export:

>

 > >  [[mailto:myw...@example.com][my wife]]

>

 > but in html it does create `  T O C  "

>

 > should create??



I though (apparently incorrectly) it was the same as `#+TOC: headlines 2' which 
does contrive to relocate a Table of Contents to that location.



> ---

>

 > Re your next post, I suggest spending some time reading

>

 > (info "(org) results")

>

 > to grasp what the various options actually do. It is probably a good idea

> to execute src blocks to see the RESULTS before you try to export them.

>

 > Reading

>

 > (info "(org) wrap")

>

 > might also help and certainly a quick breeze thru

>

 > (info "(org) Specific header arguments")

>

 > to remind yourself of what all the possibilities are is something I have

> to do from time to time.



Thanks for these suggestions.  I have had better results after doing so.



I played with extending org-babel-execute:org to allow including MULTIPLE 
transcoded markdown results using screwy variant syntax of `:results  +ascii 
+html +latex` with some success.



For example, `:results +ascii +latex' exported html which renders as:

[cid:image001.png@01D1EE68.BBAEA750]





I now think perhaps I want additional options on a source block allowing to be 
included in the exported RESULTS:

  1) transcoded markdown, appropriately escaped for the current backend

  1) the source block itself (including the #+BEGIN/END directives)  (as 
distinct from :results code, which omits the directives)



Injecting this kind of logic into org-babel-execute:org  as I did is 
mis-placing the logic and only muddles further my thinking about this.



FWIW - here is the re-definition, if you care to play with or critique it.



(defun org-babel-execute:org (body params)

  "Execute a block of Org code with.

This function is called by `org-babel-execute-src-block'."

  (let* ((result-params (split-string (or (cdr (assoc :results params)) "")))

(body (org-babel-expand-body:org

(replace-regexp-in-string "^," "" body) params))

(val (cond

   ((member "latex" result-params)

(org-export-string-as (concat "#+Title: \n" 
body) 'latex t))

   ((member "html" result-params) (org-export-string-as  
body 'html t))

   ((member "ascii" result-params) (org-export-string-as 
body 'ascii t))

   (t body)

   )))

;; HACK: output protected versions of each of latex,html,ascii,md 
transcoded markup as requested with +{latex,html,ascii,md} in header-args

(when (member "+latex"

Re: [O] seeking good practices for writing about org using org

2016-08-03 Thread Cook, Malcolm
Hi,

Additionally, if I change to

#+BEGIN_SRC org :exports both :results value html

I do not want the html rendered in the browser when I export to html.  Rather, 
I want to see the html that was created.  Actually, having the option to see 
BOTH would be ideal.

Similarly, if I change to

#+BEGIN_SRC org :exports both :results value latex

I want to see the generated latex in the browser (when I export to html) or the 
generaled latex in the pdf (when I go that route).  

I suppose my actual goal is to be able to write org, and generate a document 
which display the org (:results code), display the markup (:results value), and 
possibly optionally additionally shows (an image) of how the markup renders 
(possibly using node to render html to an image or something else to render 
latex as an image).

Any insights into straightening out this thinking much welcome

Cheers,

Malcolm



Re: [O] seeking good practices for writing about org using org

2016-08-03 Thread Cook, Malcolm
Thanks.  Much closer.  Still some issues.  Mind taking another gander  
(hoping the attached jpeg of the webpage rendered comes through as an 
attachment)

If my emacs buffer holds...
--
#+BEGIN_SRC org :exports both :results value ascii

,* Acknowledgments
  [[mailto:myw...@example.com][my wife]]

,* Chapter one

Fa la la ls

,* Chapter two

La di di

,* Finally, here is a table of contents!

,#+TOC:

#+END_SRC
--

Then exporting to html gives me a webpage with what I think are still a few 
issues:
*   I would expect the 2nd line not to display as an emacs link text.  I am 
trying to display the contents of the emacs buffer.
*   There is not table of contents.

   As in this screen shot.

Thanks for you TIPS!

 > -Original Message-
 > From: Charles C. Berry [mailto:ccbe...@ucsd.edu]
 > Sent: Wednesday, August 03, 2016 9:16 PM
 > To: Cook, Malcolm <m...@stowers.org>
 > Cc: 'emacs-orgmode@gnu.org' <emacs-orgmode@gnu.org>
 > Subject: Re: seeking good practices for writing about org using org
 >
 > On Wed, 3 Aug 2016, Cook, Malcolm wrote:
 >
 > > Hi,
 > >
 > > I am seeking good practices for writing about org using , erhm, well,
 > > org itself.  (doh!)
 > >
 > > I'd use these practices, for example, when writing examples of using
 > > org, or lessons in using org, or bug reports about org.
 > >
 > > I reached of ob-org thinking this is what it was for, and wrote the
 > > following
 > >
 > > --- (beginning of example)
 > > Here is simple org book structure with chapters and a table of
 > > contents at the end:
 > >
 > > #+BEGIN_SRC org :exports both :results value
 > >
 > > * chapter one
 > >
 > > Fa la la
 > >
 > > * chapter two
 > >
 > > La di di
 > >
 > > * table of contents
 > >
 > > #+TOC:
 > >
 > > #+END_SRC
 > > --- (end of example)
 > >
 > > My dashed expectations were that when executed and exported, this
 > would
 > > produce a block of the org source, appropriately quoted, followed be the
 > > RESULTS, being, well, the rendered org.
 > >
 > > Are your expectations the same as mine?
 > >
 >
 > No. Run `M-x org-lint RET' and you will see that this is malformed. The
 > org code needs to be escaped.
 >
 > > What do YOU do in such cases?
 >
 > Edit the src block in an edit buffer. You'll need to kill the contents of
 > that src block first, then C-c ' to open the src edit buffer, then yank, 
 > then C-c
 > '
 > again. The resulting buffer will be properly escaped.
 >
 > See (info "(org) Literal examples"), especially footnote 4.
 >
 > --
 >
 > Then specify `:results replace' to override `:results silent' which
 > `org-babel-default-header-args:org' sets.
 >
 > --
 >
 > Then the export should be what you expect.
 >
 > HTH,
 >
 > Chuck



[O] seeking good practices for writing about org using org

2016-08-03 Thread Cook, Malcolm
Hi,

I am seeking good practices for writing about org using , erhm, well, org 
itself.  (doh!)

I'd use these practices, for example, when writing examples of using org, or 
lessons in using org, or bug reports about org.

I reached of ob-org thinking this is what it was for, and wrote the following

--- (beginning of example)
Here is simple org book structure with chapters and a table of
contents at the end:

#+BEGIN_SRC org :exports both :results value

* chapter one

Fa la la

* chapter two

La di di

* table of contents

#+TOC:

#+END_SRC
--- (end of example)

My dashed expectations were that when executed and exported, this would produce 
a block of the org source, appropriately quoted, followed be the RESULTS, 
being, well, the rendered org.  

Are your expectations the same as mine?

What do YOU do in such cases? 

Are there good practices for this?

Am I off by a level in my meta-thinking?

Thanks!

Malcolm Cook - Kansas City



[O] org-html-list-of-tables ODD BEHAVIOR in producing in html export a hyperlinked table of figures to result tables

2016-08-03 Thread Cook, Malcolm
Hi,

I understand that Including in my org file:

#+TOC: tables 

Produces a list of all captioned tables in my document.

If the table lacks a caption, it does not appear in the list of tables.

Alas, they are not hyperlinked to the table unless I add a #+NAME directive.

Oddly, the #+NAME: may even be empty, and the hyperlink is created.

Further oddly, even if the #+NAME is empty, its actual value is ignored it 
is not used as the anchor.

Is all this by design?

Thanks,

Malcolm



Re: [O] Using tramp to run R source code blocks on remote server

2016-04-22 Thread Cook, Malcolm
> On Fri, 22 Apr 2016, Nick Dokos wrote:
 > 
 > > Vikas Rawal  writes:
 > >
 > >> I am trying to run R source code blocks on a remote server 
 > >> (defined in
 > my ~/.ssh/config as
 > >> cesp).
 > >>
 > >> I am facing several problems.
 > >>
 > >> 1.  The following sample block, when used with ":results value" 
 > >> does
 > not give any results.
 > >>
 > >> #+NAME: level1
 > >> #+begin_src R :results value :exports results :colnames yes 
 > >> :hline yes
 > :session cesp :dir /cesp:
 > >> /home/vikas/
 > >> c(1:5)
 > >> #+end_src
 > >>
 > >> I get the following message:
 > >>
 > >> tramp-flush-directory-property: Wrong type argument: arrayp, nil
 > >>
 > >
 > > You might also want to ping Michael Albinus on the tramp mailing list about
 > > this.
 > >
 > 
 > 
 > And contrary to what I said earlier this *is* related to compilation. Not
 > sure if this is a tramp issue for ob-comint.el issue.

I do not trust org-reload.  If I want a fresh org environment, I quit and 
restart emacs.

Also, when I am playing with effect of (re)compiling org, I don't compile it 
with org already loaded.  I compile it in a fresh emacs.

I don't trust results gained other ways.

YMMV

 > 
 > Details:
 > 
 > If I run org-reload uncompiled, C-u C-c C-x !, code like
 > 
 > #+BEGIN_SRC R :session :dir /user@remote:/userdir
 > c(3,2,6)
 > #+END_SRC
 > 
 > runs fine and produces the expected result.
 > 
 > But reloading compiled, C-c C-x !, the code produces the
 > 
 > : tramp-flush-directory-property: Wrong type argument: arrayp, nil
 > 
 > message.
 > 
 > HTH,
 > 
 > Chuck




Re: [O] Using tramp to run R source code blocks on remote server

2016-04-21 Thread Cook, Malcolm
I believe some of the inter-process communication magic depends upon i/o 
through a file that exists in /tmp on the remote host

If the remote server shares a file system with localhost (does it?), you could 
contrive for that temp file to live there (~/.emacs.d/ESS.IPC.HACK) instead.

I've been stung by similar in the past.

What version of ESS and org are you using? (meta-x org-version and meta-x 
ess-version) - this has been a bit of a moving target.  I've most recently had 
tramp/ess/org work FINE.  That is when I am editing a file on a remote host via 
tramp.  The R process starts up on the remote host (as does a shell for "#+SRC 
sh" blocks).   This _should_ work for you

~Malcolm

 > -Original Message-
 > From: Emacs-orgmode [mailto:emacs-orgmode-
 > bounces+mec=stowers@gnu.org] On Behalf Of Charles C. Berry
 > Sent: Thursday, April 21, 2016 5:05 PM
 > To: Vikas Rawal 
 > Cc: org-mode mailing list 
 > Subject: Re: [O] Using tramp to run R source code blocks on remote server
 > 
 > On Thu, 21 Apr 2016, Charles C. Berry wrote:
 > 
 > > On Thu, 21 Apr 2016, Charles C. Berry wrote:
 > >
 > >> On Thu, 21 Apr 2016, Vikas Rawal wrote:
 > >>
 > >>> I am trying to run R source code blocks on a remote server (defined in my
 > >>> ~/.ssh/config as cesp).
 > >>>
 > >>> I am facing several problems.
 > >>>
 > >>> 1.  The following sample block, when used with ":results value" does not
 > >>> give any results.
 > >>>
 > >>> #+NAME: level1
 > >>> #+begin_src R :results value :exports results :colnames yes :hline yes
 > >>> :session cesp :dir /cesp:/home/vikas/
 > >>> c(1:5)
 > >>> #+end_src
 > >>>
 > >>> I get the following message:
 > >>>
 > >>> tramp-flush-directory-property: Wrong type argument: arrayp, nil
 > >>>
 > >>
 > >> I think this is an issue with having different version of ESS on your 
 > >> local
 > >> and remote systems.
 > >>
 > >
 > > OOPS!
 > >
 > > The `different versions' issue affected my setup. But after correcting it, 
 > > I
 > > still get the error you cited above.
 > >
 > > Not sure exactly where the fault lies.
 > >
 > 
 > 
 > Maybe in `org-babel-comint-eval-invisibly-and-wait-for-file', but I am not
 > sure what/how.
 > 
 > I tried to instrument the function (C-u C-M-x on the function source) and
 > run it. And it ran without error when I stepped thru it. Then I removed
 > instrumentation with C-M-x and reran - again no error.
 > 
 > I tried removing the *.elc and restarting emacs, but that seems to make no
 > difference - the error is still there till I instrument the code.
 > 
 > Until this is sorted out, you might try the instrument/uninstrument gambit
 > as a workaround.
 > 
 > HTH,
 > 
 > Chuck
 > 




Re: [O] Table formula bug? (TBLFM line populated, but C-c = prompt is empty)

2015-11-24 Thread Cook, Malcolm
> > I just noticed that upon editing a table formula, C-u C-c C-c was updating 
> > all
 > but the first instance of formula (all but the first row).
 > >
 > > Org-mode version 8.3.2
 > >
 > > Could this be related issue?
 > 
 > If it was, I can't reproduce it with the latest pull that fixed my
 > reported issue (I'm now on Org-mode version 8.3.2
 > (release_8.3.2-342-g50359f @ /home/jwhendy/.elisp/org.git/lisp/)).
 > 
 > In my test, I used =$-1 + 2 for a column formula in row 1, populated
 > the column with C-u C-c C-c, and then changed row 3's entry to =$-1 +
 > 3. Issuing C-u C-c C-c properly updated all rows.

Hi John - thanks - must be finger trouble on my end - I can no longer reproduce 
it (but have updated org just for good measure anyway).

~Malcolm

 > 
 > 
 > John
 > 
 > >
 > >
 > >  > -Original Message-
 > >  > From: emacs-orgmode-bounces+mec=stowers@gnu.org
 > [mailto:emacs-
 > >  > orgmode-bounces+mec=stowers@gnu.org] On Behalf Of John Hendy
 > >  > Sent: Monday, November 23, 2015 5:57 PM
 > >  > To: John Hendy ; emacs-orgmode  >  > orgm...@gnu.org>
 > >  > Subject: Re: [O] Table formula bug? (TBLFM line populated, but C-c =
 > prompt
 > >  > is empty)
 > >  >
 > >  > Confirmed fixed -- thanks!
 > >  >
 > >  > John
 > >  >
 > >  > On Mon, Nov 23, 2015 at 4:24 PM, Nicolas Goaziou
 > 
 > >  > wrote:
 > >  > > Hello,
 > >  > >
 > >  > > John Hendy  writes:
 > >  > >
 > >  > >> I was just creating a table and using a formula, finding that C-c =
 > >  > >> did not bring up the formula, but acted like I was inputting one for
 > >  > >> the first time. I created a min-config and test file to see if this
 > >  > >> was something related to my setup, but it seems I can reproduce.
 > >  > >>
 > >  > >> Org-mode version 8.3.2 (release_8.3.2-338-g522ec9 @
 > >  > >> /home/jwhendy/.elisp/org.git/lisp/)
 > >  > >>
 > >  > >> #+begin_src min-config
 > >  > >> ;; set load paths
 > >  > >> ;; set load dirs and global config options
 > >  > >> (add-to-list 'load-path "~/.elisp/org.git/lisp/")
 > >  > >> (add-to-list 'load-path "~/.elisp/org.git/contrib/lisp")
 > >  > >> #+end_src
 > >  > >>
 > >  > >> Emacs started with =emacs -Q=, followed by =M-x load-file RET
 > >  > >> ~/Desktop/min-config RET=
 > >  > >>
 > >  > >> #+begin_src table-test.org
 > >  > >>
 > >  > >> * Headline
 > >  > >>
 > >  > >> | something | something else |
 > >  > >> |---+|
 > >  > >> | 1 |  3 |
 > >  > >> | 2 ||
 > >  > >> | 3 ||
 > >  > >> | 4 ||
 > >  > >> #+TBLFM: $2=1+2
 > >  > >>
 > >  > >> #+end_src
 > >  > >>
 > >  > >> I created the contents in row 1 col 2 by entering "=1+2 RET". With
 > >  > >> cursor in row 2 col 2, I press C-c = and see the attached (empty
 > >  > >> prompt for a column 2 formula). If I type in 1+2 and press return, 
 > > the
 > >  > >> TBLFM line changes to:
 > >  > >>
 > >  > >> #+TBLFM: $2=1+2::$$2=1+2
 > >  > >>
 > >  > >> If I go to row 3 and C-c = again, pressing RET to accept the default
 > >  > >> (maybe the formula is "stored" but just not displayed?), it changes 
 > > to
 > >  > >> (and nothing is put in row 3 col 2):
 > >  > >>
 > >  > >> #+TBLFM: $$2=1+2
 > >  > >>
 > >  > >> If I go to row 4 and do this one more time, pressing RET with empty
 > >  > >> formula, it leaves an empty TBLFM line under the table.
 > >  > >
 > >  > > Fixed. Thank you.
 > >  > >
 > >  > >
 > >  > > Regards,
 > >  > >
 > >  > > --
 > >  > > Nicolas Goaziou
 > >


Re: [O] Table formula bug? (TBLFM line populated, but C-c = prompt is empty)

2015-11-23 Thread Cook, Malcolm
I just noticed that upon editing a table formula, C-u C-c C-c was updating all 
but the first instance of formula (all but the first row).

Org-mode version 8.3.2

Could this be related issue?


 > -Original Message-
 > From: emacs-orgmode-bounces+mec=stowers@gnu.org [mailto:emacs-
 > orgmode-bounces+mec=stowers@gnu.org] On Behalf Of John Hendy
 > Sent: Monday, November 23, 2015 5:57 PM
 > To: John Hendy ; emacs-orgmode  orgm...@gnu.org>
 > Subject: Re: [O] Table formula bug? (TBLFM line populated, but C-c = prompt
 > is empty)
 > 
 > Confirmed fixed -- thanks!
 > 
 > John
 > 
 > On Mon, Nov 23, 2015 at 4:24 PM, Nicolas Goaziou 
 > wrote:
 > > Hello,
 > >
 > > John Hendy  writes:
 > >
 > >> I was just creating a table and using a formula, finding that C-c =
 > >> did not bring up the formula, but acted like I was inputting one for
 > >> the first time. I created a min-config and test file to see if this
 > >> was something related to my setup, but it seems I can reproduce.
 > >>
 > >> Org-mode version 8.3.2 (release_8.3.2-338-g522ec9 @
 > >> /home/jwhendy/.elisp/org.git/lisp/)
 > >>
 > >> #+begin_src min-config
 > >> ;; set load paths
 > >> ;; set load dirs and global config options
 > >> (add-to-list 'load-path "~/.elisp/org.git/lisp/")
 > >> (add-to-list 'load-path "~/.elisp/org.git/contrib/lisp")
 > >> #+end_src
 > >>
 > >> Emacs started with =emacs -Q=, followed by =M-x load-file RET
 > >> ~/Desktop/min-config RET=
 > >>
 > >> #+begin_src table-test.org
 > >>
 > >> * Headline
 > >>
 > >> | something | something else |
 > >> |---+|
 > >> | 1 |  3 |
 > >> | 2 ||
 > >> | 3 ||
 > >> | 4 ||
 > >> #+TBLFM: $2=1+2
 > >>
 > >> #+end_src
 > >>
 > >> I created the contents in row 1 col 2 by entering "=1+2 RET". With
 > >> cursor in row 2 col 2, I press C-c = and see the attached (empty
 > >> prompt for a column 2 formula). If I type in 1+2 and press return, the
 > >> TBLFM line changes to:
 > >>
 > >> #+TBLFM: $2=1+2::$$2=1+2
 > >>
 > >> If I go to row 3 and C-c = again, pressing RET to accept the default
 > >> (maybe the formula is "stored" but just not displayed?), it changes to
 > >> (and nothing is put in row 3 col 2):
 > >>
 > >> #+TBLFM: $$2=1+2
 > >>
 > >> If I go to row 4 and do this one more time, pressing RET with empty
 > >> formula, it leaves an empty TBLFM line under the table.
 > >
 > > Fixed. Thank you.
 > >
 > >
 > > Regards,
 > >
 > > --
 > > Nicolas Goaziou



Re: [O] BUG: emacs orgmode ob-R.el function org-babel-R-evaluate-session over aggressively performs "; ; cleanup extra prompts left in output" and a possible workaround

2015-11-09 Thread Cook, Malcolm
> [...]
 > > > >
 > > > [...]
 > > > >
 > > > > I've wondered if there is not a better way for Babel to share an
 > > > > interactive session with the user.  For instance, if we wanted to
 > > > > support a new form of results processing on addition to value and
 > > > > output Namely, "transcript", wherein the results of evaluating a
 > > > > source block would be a transcript of the season with statements
 > > > > interwoven with their respective outputs I suspect that this would
 > > > > not be easy extension of the current approach since it would require
 > > > > parsing the source into statements that get evaluated sequentially with
 > > > > visible results echoed into the transcript.
 > > >
 > > > You can do stuff like this using babel and some R code.
 > > >
 > > > Here is a start:
 > > >
 > 
 > [snip]
 > 
 > > Sourcing a textConnection on a :noweb interpolated block will not
 > > handle embedded quotes in the source block correctly.  Adding an
 > > assignment of a string to a variable in my-block reveals this
 > > (i.e. `b<-"asdf"`)
 > 
 > I know. That is why I said it is a 'start'. You can work around this
 > with more Babel if that is the only issue. Write a src block `good-fmt'
 > that will render the body of another block as you want it and then use
 > <> to insert it.
 > 
 > 
 > > Nor does it extend to my underspecified conception of what
 > > :transcript output would be.  I intended that :transcript would
 > > generate a colorized source blocks separated by results for
 > > statements which generated visible results.  You implementation makes
 > > the source and results undifferentiated.  My mistake for
 > > underspecifying my intention.  I think I might be able to cobble what
 > > I want using the 'evaluate' package
 > > (https://cran.rstudio.com/web/packages/evaluate/evaluate.pdf) with an
 > > output handler to format source as an R code block and results as R
 > > results block.
 > 
 > See Aaron Ecay's patches from around 08/2014. And discussions on this
 > list from about that time.  He had some of this working, but there
 > were some issues about handling remote calls, IIRC.
 > 
 > > Probably not worth the effort.  Or rather, probably
 > > already done within the knitr/rmarkdown.
 > 
 > By default knitr interlaces the code and output in a frame with
 > the output lines prefixed by '##'. The code is highlighted by default.
 > 
 > In *.Rnw this leads to a single block with a background color and
 > colorized code.
 > 
 > In *.Rhtml you get source code blocks colored per 
 > and results blocks uncolored per .
 > 
 > Using *.org via ox-ravel --> *.Rhtml via knitr --> *.html will get you
 > that far.
 > 

Indeed it does.  I have previously used ox-ravel to superb effect allowing me 
to compose R lessons as *.org and distribute as *.Rmd for use within RStudio 
server.  I must remember to remember this option!

 > Maybe customizing the classes to your taste will finish it.
 > 
 > Best,
 > 
 > Chuck
 > 
 > p.s. If you go with ox-ravel, I recommend the ravel-lang branch:
 > https://github.com/chasberry/orgmode-accessories/tree/ravel-lang 



Re: [O] BUG: emacs orgmode ob-R.el function org-babel-R-evaluate-session over aggressively performs "; ; cleanup extra prompts left in output" and a possible workaround

2015-11-09 Thread Cook, Malcolm

 > -Original Message-
 > From: Charles C. Berry [mailto:ccbe...@ucsd.edu]
 > Sent: Saturday, November 07, 2015 6:33 PM
 > To: Cook, Malcolm <m...@stowers.org>
 > Cc: emacs-orgmode@gnu.org
 > Subject: Re: BUG: emacs orgmode ob-R.el function org-babel-R-evaluate-
 > session over aggressively performs "; ; cleanup extra prompts left in output"
 > and a possible workaround
 > 
 > On Sat, 7 Nov 2015, Cook, Malcolm wrote:
 > 
 > > Thanks Chuck for setting this through.
 > >
 > [...]
 > >
 > > I've wondered if there is not a better way for Babel to share an
 > > interactive session with the user.  For instance, if we wanted to
 > > support a new form of results processing on addition to value and
 > > output Namely, "transcript", wherein the results of evaluating a
 > > source block would be a transcript of the season with statements
 > > interwoven with their respective outputs I suspect that this would
 > > not be easy extension of the current approach since it would require
 > > parsing the source into statements that get evaluated sequentially with
 > > visible results echoed into the transcript.
 > 
 > You can do stuff like this using babel and some R code.
 > 
 > Here is a start:
 > 
 > --8<---cut here---start->8---
 > #+NAME: my-block
 > #+BEGIN_SRC R :eval no
 > ls()
 > a <- 1
 > sqrt(a+2)
 > ls()
 > #+END_SRC
 > 
 > 
 > #+BEGIN_SRC R :session :noweb yes :results value raw :wrap example
 >  capture.output(
 >  source(textConnection("
 ><>
 >"),
 >echo=T,print=T))
 > #+END_SRC
 > 
 > #+RESULTS:
 > #+BEGIN_example
 > 
 > > ls()
 > [1] "a"
 > 
 > > a <- 1
 > 
 > > sqrt(a+2)
 > [1] 1.732051
 > 
 > > ls()
 > [1] "a"
 > #+END_example
 > 
 > 
 > --8<---cut here---end--->8---
 > 
 > I suppose you would want `:exports results'.

Hi Chuck,

Sourcing a textConnection on a :noweb interpolated block will not handle 
embedded quotes in the source block correctly.  Adding an assignment of a 
string to a variable in my-block reveals this (i.e. `b<-"asdf"`)

Nor does it extend to my underspecified conception of what :transcript output 
would be.  I  intended that :transcript would generate a colorized source 
blocks separated by results for statements which generated visible results.  
You implementation makes the source and results undifferentiated.   My mistake 
for underspecifying my intention.  I think I might be able to cobble what I 
want using the 'evaluate' package 
(https://cran.rstudio.com/web/packages/evaluate/evaluate.pdf) with an output 
handler to format source as an R code block and results as R results block.  
Probably not worth the effort.  Or rather, probably already done within the 
knitr/rmarkdown.

Thanks,

Malcolm

 > 
 > Best,
 > Chuck



Re: [O] BUG: emacs orgmode ob-R.el function org-babel-R-evaluate-session over aggressively performs "; ; cleanup extra prompts left in output" and a possible workaround

2015-11-07 Thread Cook, Malcolm
Thanks Chuck for setting this through.

I've never been happy at how Babel arranged the inter process communication 
with R  including the need for cleaning up the output with scary regular 
expressions like this.

Also there are some of uses of temp files that sometime cause of bugs 
especially when running R under tramp on a remote host. I'll be sure to report 
it next time I see it.

I've wondered if there is not a better way for Babel to share an interactive 
session with the user.   For instance, if we wanted to support a new form of 
results processing on addition to value and output Namely, "transcript", 
wherein the results of evaluating a source block would be a transcript of the 
season with statements interwoven with their respective outputs I suspect 
that this would not be easy extension of the current approach since it would 
require parsing the source into statements that get evaluated sequentially with 
visible results echoed into the transcript.

But I digress.

Thanks again for running with my workaround

On Nov 7, 2015 3:31 PM, "Charles C. Berry"  wrote:
On Thu, 5 Nov 2015, Nicolas Goaziou wrote:
[...]
> Would you want to provide a patch for that (and commit it while you're
> at it)?
>

Done.

Chuck


Re: [O] ox-html HOWTO? exporting #+RESULTS inside div

2015-11-06 Thread Cook, Malcolm
> > Charles, Thanks again for you suggestion.  Alas, using 'header-args
 > >:wrap org-results-container' has the unforeseen (by me) side effect
 > >of masking my use of `#+ATTR_HTML :class dataTable` on selected
 > >exported tables (which I use to allow for search/sortable/scrollable
 > >tables).  Now, the ':class dataTable' attribute is placed on the new
 > > instead of the  with undesired outcome.
 > 
 > > Do you have any thoughts on how to accomplish both my goals (apply
 > > :class table to selected results, and making ALL results be
 > > addressable using javascript.  FYI - My application is to hide all
 > > source blocks on html open.  Clicking on a source block caption
 > > shows the source.  This provides an HTML view that hides the source
 > > until desired.  My recipients of such analysis write-ups really like
 > > this.
 > 
 > [snip]
 > 
 > > # #+PROPERTY: header-args :wrap org-results-container
 > > #
 > 
 > This creates a special block and attributes on the results will apply
 > to it - not its contents.
 > 
 > What you want can be obtained by creating a different special block
 > and then applying a filter. So, wrap like this
 > 
 > #+PROPERTY: header-args :wrap org-results-container-to-filter
 > 
 > and add a filter to `org-export-filter-special-block-functions' that
 > strips the 'to-filter' and adds the `dataTable' where it is needed.

Hi Charles - ok - you've got me looking at ox aspects I've not yet explored 
good!

If I understand your suggestion, the filter you propose would need to somehow 
"know" which tables I desire to be adorned with `class :dataTable`.

How do you reckon I might declare that?

Upon reflection, I wonder if following source block header syntax might rather 
be considered "in the spirit of things" and worthy of implementation:

#+begin_src R :exports value table :prefix '#+attr_html :class 
dataTable'

which would be interpreted by ob-sbe (somehow) to emit and
#+attr_html :class dataTable
Immediately prior to the #+results, all of which might be further :wrapped.

Or am I putting the cart before the horse?

Reminder (in part to self): my goal is two-fold 
 (a) declare to the ox-html exporter a :class (i.e. dataTable) to adorn 
selected exported results tables
 (b) have a means of addressing the exported html results of a code block 
allowing to conditionally hide or expose it (i.e. toggle exposure when user 
click on the export source code.  This is what "> #+PROPERTY: header-args :wrap 
org-results-container" provided for me, except that the introduction of the new 
 was blocking my means of doing (a)

Cheers,

Malcolm

 > 
 > HTH,
 > 
 > Chuck



Re: [O] ox-html HOWTO? exporting #+RESULTS inside div

2015-11-04 Thread Cook, Malcolm
Charles,

Thanks again for you suggestion.

Alas, using 'header-args :wrap org-results-container' has the unforeseen (by 
me) side effect of masking my use of `#+ATTR_HTML :class dataTable` on selected 
exported tables (which I use to allow for search/sortable/scrollable tables).  

Now, the ':class dataTable' attribute is placed on the new  instead of the 
 with undesired outcome.

Do you have any thoughts on how to accomplish both my goals (apply :class table 
to selected results, and making ALL results be addressable using javascript.  
FYI - My application is to hide all source blocks on html open.  Clicking on a 
source block caption shows the source.  This provides an HTML view that hides 
the source until desired.  My recipients of such analysis write-ups really like 
this.

Thanks,
Malcolm

PS: as an Example of the issue, the following exports the table with :class of 
dataTable.  However, when I uncomment the :wrap directive, and re-eval the 
block, and export, then :class is now on the div...


#+HTML_HEAD: http://code.jquery.com/jquery-1.11.2.min.js&quot</a>;>
#+HTML_HEAD: http://cdn.datatables.net/1.10.9/css/jquery.dataTables.min.css;>
#+HTML_HEAD: http://cdn.datatables.net/1.10.9/js/jquery.dataTables.js&quot</a>;>
#
# #+PROPERTY: header-args :wrap org-results-container
#
#+CAPTION: Contrive to display mtcars
#+BEGIN_SRC R :exports both :results value :colnames yes 
mtcars
#+END_SRC
#+ATTR_HTML: :class dataTable 
#+RESULTS:
|  mpg | cyl |  disp |  hp | drat |wt |  qsec | vs | am | gear | carb |
|--+-+---+-+--+---+---+++--+--|
|   21 |   6 |   160 | 110 |  3.9 |  2.62 | 16.46 |  0 |  1 |4 |4 |
|   21 |   6 |   160 | 110 |  3.9 | 2.875 | 17.02 |  0 |  1 |4 |4 |
| 22.8 |   4 |   108 |  93 | 3.85 |  2.32 | 18.61 |  1 |  1 |4 |1 |
| 21.4 |   6 |   258 | 110 | 3.08 | 3.215 | 19.44 |  1 |  0 |3 |1 |
| 18.7 |   8 |   360 | 175 | 3.15 |  3.44 | 17.02 |  0 |  0 |3 |2 |
| 18.1 |   6 |   225 | 105 | 2.76 |  3.46 | 20.22 |  1 |  0 |3 |1 |
| 14.3 |   8 |   360 | 245 | 3.21 |  3.57 | 15.84 |  0 |  0 |3 |4 |
| 24.4 |   4 | 146.7 |  62 | 3.69 |  3.19 |20 |  1 |  0 |4 |2 |
| 22.8 |   4 | 140.8 |  95 | 3.92 |  3.15 |  22.9 |  1 |  0 |4 |2 |
| 19.2 |   6 | 167.6 | 123 | 3.92 |  3.44 |  18.3 |  1 |  0 |4 |4 |
| 17.8 |   6 | 167.6 | 123 | 3.92 |  3.44 |  18.9 |  1 |  0 |4 |4 |
| 16.4 |   8 | 275.8 | 180 | 3.07 |  4.07 |  17.4 |  0 |  0 |3 |3 |
| 17.3 |   8 | 275.8 | 180 | 3.07 |  3.73 |  17.6 |  0 |  0 |3 |3 |
| 15.2 |   8 | 275.8 | 180 | 3.07 |  3.78 |18 |  0 |  0 |3 |3 |
| 10.4 |   8 |   472 | 205 | 2.93 |  5.25 | 17.98 |  0 |  0 |3 |4 |
| 10.4 |   8 |   460 | 215 |3 | 5.424 | 17.82 |  0 |  0 |3 |4 |
| 14.7 |   8 |   440 | 230 | 3.23 | 5.345 | 17.42 |  0 |  0 |3 |4 |
| 32.4 |   4 |  78.7 |  66 | 4.08 |   2.2 | 19.47 |  1 |  1 |4 |1 |
| 30.4 |   4 |  75.7 |  52 | 4.93 | 1.615 | 18.52 |  1 |  1 |4 |2 |
| 33.9 |   4 |  71.1 |  65 | 4.22 | 1.835 |  19.9 |  1 |  1 |4 |1 |
| 21.5 |   4 | 120.1 |  97 |  3.7 | 2.465 | 20.01 |  1 |  0 |3 |1 |
| 15.5 |   8 |   318 | 150 | 2.76 |  3.52 | 16.87 |  0 |  0 |3 |2 |
| 15.2 |   8 |   304 | 150 | 3.15 | 3.435 |  17.3 |  0 |  0 |3 |2 |
| 13.3 |   8 |   350 | 245 | 3.73 |  3.84 | 15.41 |  0 |  0 |3 |4 |
| 19.2 |   8 |   400 | 175 | 3.08 | 3.845 | 17.05 |  0 |  0 |3 |2 |
| 27.3 |   4 |79 |  66 | 4.08 | 1.935 |  18.9 |  1 |  1 |4 |1 |
|   26 |   4 | 120.3 |  91 | 4.43 |  2.14 |  16.7 |  0 |  1 |5 |2 |
| 30.4 |   4 |  95.1 | 113 | 3.77 | 1.513 |  16.9 |  1 |  1 |5 |2 |
| 15.8 |   8 |   351 | 264 | 4.22 |  3.17 |  14.5 |  0 |  1 |5 |4 |
| 19.7 |   6 |   145 | 175 | 3.62 |  2.77 |  15.5 |  0 |  1 |5 |6 |
|   15 |   8 |   301 | 335 | 3.54 |  3.57 |  14.6 |  0 |  1 |5 |8 |
| 21.4 |   4 |   121 | 109 | 4.11 |  2.78 |  18.6 |  1 |  1 |4 |2 |



 > -Original Message-
 > From: emacs-orgmode-bounces+mec=stowers@gnu.org [mailto:emacs-
 > orgmode-bounces+mec=stowers....@gnu.org] On Behalf Of Cook, Malcolm
 > Sent: Thursday, October 22, 2015 1:14 AM
 > To: Charles C. Berry <ccbe...@ucsd.edu>
 > Cc: emacs-orgmode@gnu.org
 > Subject: Re: [O] ox-html HOWTO? exporting #+RESULTS inside div
 > 
 > Charles,
 > 
 > Excellent - that is precisely what I needed.
 > 
 > Additionally, I can avoid having to include the :wrap keyword on every header
 > by specifying a single  buffer-wide  header arguments, such as
 > 
 > #+PROPERTY: header-args :wrap org-results-container
 > 
 > Thanks,
 > 
 > ~ malcolm_c...@stowers.org
 > 
 > ____
 > From: Charles C. Berry <ccbe...@ucsd.edu>
 > Sent: Wednesday, October 21, 2015 9:18 PM
 > To: Cook, 

Re: [O] pdflatex not found?

2015-10-27 Thread Cook, Malcolm
> 
 > John Kitchin  writes:
 > 
 > > This reminds me that I think I have this problem unless I open Emacs from a
 > > command line.
 > 
 > Yup - this is one way of circumvent the problem: by starting emacs from
 > the command line.

And, just to chime in late in the conversation, if your emacs was installed as 
an mac application using, say, http://emacsformacosx.com/ then you can start it 
from the command line as:

open -a /Applications/path/to/emacs

and get the environment variables you expect...

 > 
 > 
 > >
 > > On Tuesday, October 27, 2015, Nick Dokos  wrote:
 > >
 > >> Fatma Başak Aydemir > writes:
 > >>
 > >> > I do not know the reasons but I had the same problem in the past on OS 
 > >> > X.
 > >> >
 > >> > exec-path-from-shell package is a nice solution for that.
 > >> >
 > >> > https://github.com/purcell/exec-path-from-shell
 > >> >
 > >>
 > >> Just the need for a package like that indicates that something is badly
 > >> broken on OS X, I think. To be fair, it's a mess on Linux as well, but
 > >> it is possible to make sure that variables you define (and export) in
 > >> your .profile get propagated to applications started by the DE/WM. In my
 > >> current installation (Fedora 21), that is done by
 > >> /etc/X11/xinit/xinitrc-common, which does this:
 > >>
 > >> [ -r $HOME/.profile ] && . $HOME/.profile
 > >>
 > >> Maybe OS X has a "hidden" mechanism like this?
 > >>
 > >> > 27/10/15 14:43 tarihinde Peter Davis yazdı:
 > >> >> Rainer M Krug > writes:
 > >> >>
 > >> >>> Envoyé de mon iPhone
 > >> >>>
 > >>  Le 27 oct. 2015 à 01:14, Nick Dokos  >
 > >> a écrit :
 > >> 
 > >>  Peter Davis > writes:
 > >> 
 > >> > Nick Dokos > writes:
 > >>  ...
 > >>  Yes, probably, but if I can get people to submit backtraces when
 > >> getting
 > >>  an error, we can cut down the email volume by a factor of 2.43
 > >> (making up
 > >>  fictitious data to bolster my case...) In all seriousness, at least 
 > >>  it
 > >>  shows that you are not going down some strange path.
 > >> >> I think the actual number is more like 2.17, but let's not quibble.
 > >> >>
 > >>  What happens if you say M-x shell-command RET pdflatex RET?
 > >> >> Not found.
 > >> >>
 > >>  Somebody suggested running "which pdflatex" in your shell - what
 > does
 > >>  that say?
 > >> >> Still not found. However, adding it to ~/.tcshrc seems to fix the
 > >> >> problem. That makes sense, but leaves two questions:
 > >> >>
 > >> >> 1) Why am I able to run pdflatex (without specifying the path) just
 > >> >> from the shell running in a terminal window?
 > >> >>
 > >> >> 2) What's the point of defining the emacs exec-path, since I needed
 > >> >> to define the shell's PATH variable anyway?
 > >> >>
 > >>
 > >> FWIW, I never define exec-path explicitly: it is set from my $PATH when
 > >> emacs starts.
 > >>
 > >> --
 > >> Nick
 > >>
 > >>
 > >>
 > >>
 > 
 > --
 > Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology,
 > UCT), Dipl. Phys. (Germany)
 > 
 > Centre of Excellence for Invasion Biology
 > Stellenbosch University
 > South Africa
 > 
 > Tel :   +33 - (0)9 53 10 27 44
 > Cell:   +33 - (0)6 85 62 59 98
 > Fax :   +33 - (0)9 58 10 27 44
 > 
 > Fax (D):+49 - (0)3 21 21 25 22 44
 > 
 > email:  rai...@krugs.de
 > 
 > Skype:  RMkrug
 > 
 > PGP: 0x0F52F982


Re: [O] ox-html HOWTO? exporting #+RESULTS inside div

2015-10-22 Thread Cook, Malcolm
Charles, 

Excellent - that is precisely what I needed.

Additionally, I can avoid having to include the :wrap keyword on every header 
by specifying a single  buffer-wide  header arguments, such as

#+PROPERTY: header-args :wrap org-results-container

Thanks,

~ malcolm_c...@stowers.org


From: Charles C. Berry <ccbe...@ucsd.edu>
Sent: Wednesday, October 21, 2015 9:18 PM
To: Cook, Malcolm
Cc: emacs-orgmode@gnu.org
Subject: Re: ox-html HOWTO? exporting #+RESULTS inside div

On Wed, 21 Oct 2015, Cook, Malcolm wrote:

> Hi,
>
> I would like to contrive for the contents of results blocks to be
> embedded in a new div with a common class of org-results-container.

Try this:

--8<---cut here---start->8---
#+BEGIN_SRC shell :exports both :wrap org-results-container
echo "org results here"
#+END_SRC
--8<---cut here---end--->8---

which html export renders as

--8<---cut here---start->8---


org results here



--8<---cut here---end--->8---

You can add a special-block filter if the  ...  is unwanted.

HTH,

Chuck


[O] ox-html HOWTO? exporting #+RESULTS inside div

2015-10-21 Thread Cook, Malcolm
Hi,

I would like to contrive for the contents of results blocks to be embedded in a 
new div with a common class of org-results-container.

Can this be accomplished through configuring ox-html somehow?  Or must I 
contrive to modify ox-html.el source? Or is this "Just A Bad Idea" (tm).

My use case is to be able to be able to hide all (or selected) results blocks 
using javascript in service of an html presentation used as a tutorial where 
RESULTS are revealed when clicking on, say, the previous source code block.

Thanks,

Malcolm Cook





Re: [O] HowTo? have R :sessions in org mode invoke a specific R

2015-10-16 Thread Cook, Malcolm
Replying on an old thread:

> >>On Mon, Nov 4, 2013 at 11:22 AM, Cook, Malcolm <m...@stowers.org>
 > wrote:
 > >  >> I wish to lock an org buffer to a particular installation of R so that 
 > > all
 > code blocks use it.
 > >  >>
 > >  >> I found that I could not, for instance, write `:session R-3.0.1`.
 > >  >>
 > >  >> Is there some best way for me to accomplish this?
 > >  >>
 > >  >> Perhaps some way of setting inferior-R-program-name to a buffer local
 > value?
 > >  >
 > >  >I'm no good at in-buffer variables, but this one looks of interest:
 > >  >org-babel-R-command
 > >
 > > Indeed, John,  that is the variable I would like to have respected
 > > when I
 > >
 > > (setq-local inferior-R-program-name "R-3.0.1")
 > >
 > >
 > > But, alas it is not.
 > >
 > > Any other takers?
 > >
 > > Thanks!
 > 
 > I think you got it backwards: if you are trying to use org-babel to evaluate 
 > an R
 > code block, then the variable you should set is org-babel-R-command as John
 > indicated. Setting inferior-R-program-name to something does not tell
 > anything to org-babel. To use your term, org-babel does not respect inferior-
 > R-program-name; the only thing it knows is org-babel-R-command. Only ESS
 > respects inferior-R-program-name, but you are not using ESS here. So have
 > you tried
 > 
 >  (setq-local org-babel-R-command "R-3.0.1 --slave --no-save")

Yes!  Indeed!  And, Thanks!  

And... I don't even need to remember to eval the setq statement if I include in 
my org the following works everytime

# Local Variables:
# org-babel-R-command: "R-3.0.1 --slave --no-save"
# End:

Or put it as first line in the file:

# -*- org-babel-R-command: "R-3.0.1 --slave --no-save"-*-

Cheers,

Malcolm

 > 
 > in your org-mode buffer where you are evaluating your R code?
 > The options are guesses based on the current setting. Untested since I know
 > virtually nothing about R.
 > 
 > Nick
 > 




Re: [O] BUG: emacs orgmode ob-R.el function org-babel-R-evaluate-session over aggressively performs "; ; cleanup extra prompts left in output" and a possible workaround

2015-10-08 Thread Cook, Malcolm
> On Thu, 1 Oct 2015, Cook, Malcolm wrote:
 > 
 > >>> I am not sure what the best solution is, but, in my hands using
 > > > > Org-mode version 8.3.2-elpa org-20150929 the reg-expt used to
 > > > > "cleanup extra prompts left in output" is over-aggressive and will
 > > > > trim session :output at lines consisting exclusively of blanks and
 > > > > periods such as produced when printing a BioConductor 'Views'
 > > > > object which wants to appear as
 > > >
 > 
 > [snip]
 > 
 > >>> I offer as a possible workaround the following:
 > > > >
 > > > > So far, I have had good success having removed provision for
 > > > > allowing
 > > > leading whitespace by changing the regexp
 > > > org-babel-R-evaluate-session from
 > > > >  "^\\([ ]*[>+\\.][ ]?\\)+\\([[0-9]+\\|[ ]\\)"
 > > > > to
 > > > >  "^\\([>+\\.][ ]?\\)+\\([[0-9]+\\|[ ]\\)"
 > > > >
 > > > > But I don't know all the test cases so, YMMV
 > 
 > I have traced this back to its source, and the culprit appears to be me.
 > 
 > See
 >commit dc92eaa08d89e4bc9556f868ae65633196157a8d
 >Author: Eric Schulte <schulte.e...@gmail.com>
 >Date:   Wed Jul 28 08:05:30 2010 -0600
 > and subsequent modifications.
 > 
 > I believe the leading blank(s) in the regex were copied from ess, but 
 > nowadays
 > I only see this in code in ess-traceback.el that is commented out.
 > 
 > So I guess there would be no harm in pushing the latter regex.


Hi Chuck.  Thanks for the history lesson, and taking this on in the first 
place.  Yay!~Malcolm

 > 
 > Chuck



[O] BUG: emacs orgmode ob-R.el function org-babel-R-evaluate-session over aggressively performs "; ; cleanup extra prompts left in output" and a possible workaround

2015-10-01 Thread Cook, Malcolm
Hello ,

I am not sure what the best solution is, but, in my hands using Org-mode 
version 8.3.2-elpa org-20150929 the reg-expt  used to "cleanup extra prompts 
left in output" is over-aggressive and will trim session :output at lines 
consisting exclusively of blanks and periods such as produced when printing a 
BioConductor 'Views' object which wants to appear as

#+RESULTS:
#+begin_example
  Views on a 23011544-letter DNAString subject
subject: 
CGACAATGCACGACAGAGGAAGCAGAACAGATATTTAGATTGCCTCTCACTCTCCCATATTATAGGGAGAAATATGATCGCGTATGCGAGAGTAGTGCCAACATATTGTGCTCTTTGATTGGCAACCCTGGTGGCGGATGAACGAGATGATAATATATTCAAGTTGCCGCTAATCAGAAATAAATTCATTGCAACGTTAAATACAGCACAATATATGATCGCGTATGCGAGAGTAGTGCCAACATATTGTGCTAATGAGTGCCTCTCGTTCTCTGTCTTATA...TATCTTTCAAAGATGACACTAGCAATGCGTTAACCCAAATAATGATTTCCCTAAATCCTTCCGTAAATATTAACTGGCTCCACCCAAATTTCGGTCATTAAATAATCAGTTGCCACAACTAATTGTCTGTGGAATGTCATATCTCGATGAGCTCATAATTAAATTTACAATCAAACTGTGTTCGAGAGCTAACATTTGGCATATTTGCAAAGATGAACCTTTCAAA
views:
 start  end width
  [1]   344766   344773 8 [CATGAGGC]
  [2]   563564   563571 8 [CATGAGGC]
  [3]   641027   641034 8 [CATGAGGC]
  [4]   656168   656175 8 [CATGAGGC]
  [5]   709112   709119 8 [CATGAGGC]
  ...  ...  ...   ... ...
[141] 22209984 22209991 8 [CATGAGGC]
[142] 22371543 22371550 8 [CATGAGGC]
[143] 22554991 22554998 8 [CATGAGGC]
[144] 22618578 22618585 8 [CATGAGGC]
[145] 22897728 22897735 8 [CATGAGGC]
#+end_example

But alas rather appears as:

#+RESULTS:
#+begin_example
  ...  ...  ...   ... ...
[141] 22209984 22209991 8 [CATGAGGC]
[142] 22371543 22371550 8 [CATGAGGC]
[143] 22554991 22554998 8 [CATGAGGC]
[144] 22618578 22618585 8 [CATGAGGC]
[145] 22897728 22897735 8 [CATGAGGC]
#+end_example


I offer as a possible workaround the following:

So far, I have had good success having removed provision for allowing leading 
whitespace by changing the regexp  org-babel-R-evaluate-session  from
  "^\\([ ]*[>+\\.][ ]?\\)+\\([[0-9]+\\|[ ]\\)"
 to
  "^\\([>+\\.][ ]?\\)+\\([[0-9]+\\|[ ]\\)"

But I don't know all the test cases so, YMMV

HTH,

~Malcolm (who, FWIW, has never really liked the way ob-R communicated with the 
inferior R session in the first place)



Re: [O] BUG: emacs orgmode ob-R.el function org-babel-R-evaluate-session over aggressively performs "; ; cleanup extra prompts left in output" and a possible workaround

2015-10-01 Thread Cook, Malcolm
> > I am not sure what the best solution is, but, in my hands using
 > > Org-mode version 8.3.2-elpa org-20150929 the reg-expt used to "cleanup
 > > extra prompts left in output" is over-aggressive and will trim session
 > > :output at lines consisting exclusively of blanks and periods such as
 > > produced when printing a BioConductor 'Views' object which wants to
 > > appear as
 > 
 > I'd try (for example):
 > 
 > #+BEGIN_SRC R :results value raw drawer :session
 > require(GenomicRanges)
 > capture.output(show(GRanges(seqnames=rep("a",100),
 >  IRanges(start=1:100,width=1),strand=rep("*",100
 > #+END_SRC

Thanks for the thought, but, I'm trying to engage in "literate programming" for 
which in my opinion I should not have to re-write my code (using capture.output 
and show) to get the output of evaluation captured.

We're I to sweave my code I would get all this un-wanted cruft.

I think org-bable-R-evaluate-FOO should be handling all this for us.

 > rather than messing with the regexp.

Hmm not sure I understand your preference here.   I'm providing an example 
of some that should "just work", but does not.   I too prefer not to mess with 
the regexp other than to identify it as the source of the issue.  Perhaps the 
"real solution" is to recode org-bable-R-evaluate-FOO.

> > I offer as a possible workaround the following:
 > >
 > > So far, I have had good success having removed provision for allowing
 > leading whitespace by changing the regexp  org-babel-R-evaluate-session
 > from
 > >  "^\\([ ]*[>+\\.][ ]?\\)+\\([[0-9]+\\|[ ]\\)"
 > > to
 > >  "^\\([>+\\.][ ]?\\)+\\([[0-9]+\\|[ ]\\)"
 > >
 > > But I don't know all the test cases so, YMMV
 > 
 > Just guessing that the things that `(setq ess-eval-visibly nil)' generates 
 > (e.g., +
 > + + + + > ) won't behave using your version.
 > 

In fact it does behave.  I tried it.  I think that ess-eval-visibly effects how 
ob-R interacts with the ess session.

 > HTH,

I wish it did ;)  Thanks for your efforts.

 > 
 > Chuck



Re: [O] html export list of figures

2015-09-24 Thread Cook, Malcolm
Hi,
> I am not aware of anything in html for this. In latex, org is just passing the
 > baton to Latex to generate the list of tables/figures. For HTML, you will
 > probably have to generate the code yourself.
 > 
 > In org-ref I provide a list-of-tables and list-of-figures link, which has 
 > the latex
 > export code you show, but it is also clickable and generates an org buffer 
 > with
 > a clickable list of tables or figures. See:
 > 
 > https://github.com/jkitchin/org-ref/blob/master/org-ref.el#L932
 > 
 > while there is no html export code there, the clicking functions lay out how 
 > to
 > get the information. I guess you would need one more detail of putting some
 > kind of anchor or something on the tables/figures so you could click on the 
 > list
 > and jump to the table. it might get you stated anyway.

Great John, thanks, I will see what I can add.  Is this package part of any 
library available via that package manager?

 > 
 > Cook, Malcolm writes:
 > 
 > > Hi,
 > >
 > > I see know what to generate a list of figures to appear in my html
 > > export in addition to my current
 > >
 > >   #+TOC: listings
 > >   #+TOC: tables
 > >
 > > Exporting latex provides
 > >
 > >   #+LATEX: \listoffigures
 > >
 > > To complement
 > >
 > >   #+LATEX: \tableofcontents
 > >   #+LATEX: \listoftables
 > >
 > > But I see nothing analogous for HTML
 > >
 > > Am I missing something?
 > >
 > > Thanks,
 > >
 > > Malcolm Cook
 > 
 > --
 > 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] html export list of figures

2015-09-23 Thread Cook, Malcolm
Hi,

I see know what to generate a list of figures to appear in my html export in 
addition to my current

#+TOC: listings
#+TOC: tables

Exporting latex provides 

#+LATEX: \listoffigures

To complement

#+LATEX: \tableofcontents
#+LATEX: \listoftables

But I see nothing analogous for HTML

Am I missing something?

Thanks,

Malcolm Cook




Re: [O] remote R session

2015-08-11 Thread Cook, Malcolm
Using ESS, If you are editing a org file file via tramp, editing an R src code 
block should “just work” to start the attached R session remotely.  I do it all 
the time.

Try this: make sure you do NOT have a local R session already and edit your 
source block….


From: emacs-orgmode-bounces+mec=stowers@gnu.org 
[mailto:emacs-orgmode-bounces+mec=stowers@gnu.org] On Behalf Of Zhihao Ding
Sent: Tuesday, August 11, 2015 11:04 AM
To: emacs-orgmode@gnu.org
Subject: [O] remote R session

Hi there,

I was wondering how to automatically fire up a remote R session when editing 
source code in babel source code block? I'd like to have everything on server 
and be able to play with it including making plots. Currently I do tangle to a 
file on server first and then use tramp to access it.  Although I get a remote 
R session, the problem is that I'll be working on a generated copy. Any ways to 
make improve this ?

Thanks,
Zhihao


Re: [O] Babel error on init with 8.3.1

2015-08-10 Thread Cook, Malcolm
When you “ updated org through the package manager in Emacs,” I believe you 
need to make sure org has not been loaded at all.

My practice is to exec `emacs –Q`, immediately update with package manager, 
then quit and restart emacs without the –Q.

Let us know….

From: emacs-orgmode-bounces+mec=stowers@gnu.org 
[mailto:emacs-orgmode-bounces+mec=stowers@gnu.org] On Behalf Of Ryan 
Schuetzler
Sent: Friday, August 07, 2015 9:41 AM
To: emacs-orgmode@gnu.org
Subject: [O] Babel error on init with 8.3.1

On startup with the latest 8.3 release I now get an error:

  Invalid function: org-babel-header-args-safe-fn

I updated org through the package manager in Emacs, and I'm using it on Windows 
10. Below is my full org configuration, but I've found that when I comment out 
the following section of my init, I don't receive any errors:

(add-hook 'org-babel-after-execute-hook 'bh/display-inline-images 'append)

(setq org-babel-results-keyword results)

(defun bh/display-inline-images ()
  (condition-case nil
  (org-display-inline-images)
(error nil)))

(org-babel-do-load-languages
 (quote org-babel-load-languages)
 (quote ((emacs-lisp . t)
  (latex . t)
  (R . t)
  (dot . t)
  (python . t)
  (org . t

(setq org-confirm-babel-evaluate nil)

FULL Config:

Emacs  : GNU Emacs 25.0.50.1 (x86_64-w64-mingw32)
 of 2015-07-11 on KAEL
Package: Org-mode version 8.3.1 (8.3.1-elpa @ 
c:/Users/Ryan/dotfiles/.emacs.d/elpa/org-20150805/)

current state:
==
(setq
 org-export-backends '(ascii html icalendar latex md odt)
 org-agenda-tags-todo-honor-ignore-options t
 org-tab-first-hook '(org-hide-block-toggle-maybe 
org-babel-hide-result-toggle-maybe org-babel-header-arg-expand)
 org-babel-results-keyword results
 org-speed-command-hook '(org-speed-command-default-hook 
org-babel-speed-command-hook)
 org-occur-hook '(org-first-headline-recenter)
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-confirm-shell-link-function 'yes-or-no-p
 org-agenda-exporter-settings '((ps-number-of-columns 1) (ps-landscape-mode t) 
(htmlize-output-type (quote cc)))
 org-agenda-custom-commands '((N Notes tags NOTE

((org-agenda-overriding-header Notes) (org-tags-match-list-sublevels t)))

   (h Habits tags-todo STYLE=\habit\

((org-agenda-overriding-header Habits)

  (org-agenda-sorting-strategy (quote (todo-state-down effort-up 
category-keep

)

   (  Agenda

((agenda  nil)

  (tags REFILE

  ((org-agenda-overriding-header Tasks to Refile)

   (org-tags-match-list-sublevels nil))

  )

  (tags-todo -CANCELLED/!

  ((org-agenda-overriding-header Stuck Projects)

   (org-agenda-skip-function (quote bh/skip-non-stuck-projects))

   (org-agenda-sorting-strategy (quote (category-keep

  )

  (tags-todo -HOLD-CANCELLED/!

  ((org-agenda-overriding-header Projects)

   (org-agenda-skip-function (quote bh/skip-non-projects))

   (org-tags-match-list-sublevels (quote indented))

   (org-agenda-sorting-strategy (quote (category-keep

  )
 

[O] Link to http://orgmode.org/build-org-pkg.txt is 404 in http://orgmode.org/elpa.html

2015-08-10 Thread Cook, Malcolm
Link to http://orgmode.org/build-org-pkg.txt is 404 in 
http://orgmode.org/elpa.html

~Malcolm




Re: [O] Babel error on init with 8.3.1

2015-08-10 Thread Cook, Malcolm
Hi – here is my more detailed variation that just got upvoted at stackoverflow  
for resolving essentially the same problem:

http://stackoverflow.com/questions/31855904/emacs-sees-the-directory-with-the-new-org-mode-version-but-loads-the-old-versio



From: emacs-orgmode-bounces+mec=stowers@gnu.org 
[mailto:emacs-orgmode-bounces+mec=stowers@gnu.org] On Behalf Of Cook, 
Malcolm
Sent: Monday, August 10, 2015 9:32 AM
To: 'Ryan Schuetzler' rsch...@gmail.com; emacs-orgmode@gnu.org
Subject: Re: [O] Babel error on init with 8.3.1

When you “ updated org through the package manager in Emacs,” I believe you 
need to make sure org has not been loaded at all.

My practice is to exec `emacs –Q`, immediately update with package manager, 
then quit and restart emacs without the –Q.

Let us know….

From: 
emacs-orgmode-bounces+mec=stowers@gnu.orgmailto:emacs-orgmode-bounces+mec=stowers@gnu.org
 [mailto:emacs-orgmode-bounces+mec=stowers@gnu.org] On Behalf Of Ryan 
Schuetzler
Sent: Friday, August 07, 2015 9:41 AM
To: emacs-orgmode@gnu.orgmailto:emacs-orgmode@gnu.org
Subject: [O] Babel error on init with 8.3.1

On startup with the latest 8.3 release I now get an error:

  Invalid function: org-babel-header-args-safe-fn

I updated org through the package manager in Emacs, and I'm using it on Windows 
10. Below is my full org configuration, but I've found that when I comment out 
the following section of my init, I don't receive any errors:

(add-hook 'org-babel-after-execute-hook 'bh/display-inline-images 'append)

(setq org-babel-results-keyword results)

(defun bh/display-inline-images ()
  (condition-case nil
  (org-display-inline-images)
(error nil)))

(org-babel-do-load-languages
 (quote org-babel-load-languages)
 (quote ((emacs-lisp . t)
  (latex . t)
  (R . t)
  (dot . t)
  (python . t)
  (org . t

(setq org-confirm-babel-evaluate nil)

FULL Config:

Emacs  : GNU Emacs 25.0.50.1 (x86_64-w64-mingw32)
 of 2015-07-11 on KAEL
Package: Org-mode version 8.3.1 (8.3.1-elpa @ 
c:/Users/Ryan/dotfiles/.emacs.d/elpa/org-20150805/)

current state:
==
(setq
 org-export-backends '(ascii html icalendar latex md odt)
 org-agenda-tags-todo-honor-ignore-options t
 org-tab-first-hook '(org-hide-block-toggle-maybe 
org-babel-hide-result-toggle-maybe org-babel-header-arg-expand)
 org-babel-results-keyword results
 org-speed-command-hook '(org-speed-command-default-hook 
org-babel-speed-command-hook)
 org-occur-hook '(org-first-headline-recenter)
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-confirm-shell-link-function 'yes-or-no-p
 org-agenda-exporter-settings '((ps-number-of-columns 1) (ps-landscape-mode t) 
(htmlize-output-type (quote cc)))
 org-agenda-custom-commands '((N Notes tags NOTE

((org-agenda-overriding-header Notes) (org-tags-match-list-sublevels t)))

   (h Habits tags-todo STYLE=\habit\

((org-agenda-overriding-header Habits)

  (org-agenda-sorting-strategy (quote (todo-state-down effort-up 
category-keep

)

   (  Agenda

((agenda  nil)

  (tags REFILE

  ((org-agenda-overriding-header Tasks to Refile)

   (org-tags-match-list-sublevels nil))

  )

  (tags-todo -CANCELLED/!

  ((org-agenda-overriding-header Stuck Projects)

   (org-agenda-skip-function (quote bh/skip-non-stuck-projects))

   (org-agenda-sorting-strategy (quote (category-keep

  )

  (tags-todo -HOLD-CANCELLED

Re: [O] eval source blocks in a subtree when opening file

2015-08-07 Thread Cook, Malcolm
  On Tue, 4 Aug 2015, Tamas Papp wrote:
  
   I would like to do the following: whenever I open the file in Emacs,
   I would like to eval all the source blocks under the heading Setup.
  
   I have found org-babel-execute-subtree, but I cannot figure out how
   to call it on the subtree Setup from a local eval.
  
   Name the first block in the subtree start setup (say).
  
   Then
  
   # Local Variables:
   # eval: (org-babel-goto-named-src-block start setup) # eval:
   (org-babel-execute-subtree) # End:
  
  Thanks! I found that I can also assign an ID to the section, and then use
  
  # eval: (progn (org-id-goto ...some-id...) (org-babel-execute-subtree))
  
  It looks like I need the progn for it to work reliably (don't know why).
  
  I am wondering if it would be possible to break a line in Local Variables, 
  but
  
  # eval: (progn (org-id-goto ...some-id...) \
  #  (org-babel-execute-subtree))
  
  didn't work.
  
[Cook, Malcolm] 

Ditch the line continuation character.  This works in my hands with emacs 
24.4.1 to set foo to bar:

# Local Variables:
# eval: (setq foo
#   bar)
# End:



  Best,
  
  Tamas




Re: [O] orgmode and R?

2015-08-03 Thread Cook, Malcolm
It is possible to send a org table to R as a data.frame, which could edit it, 
add columns, and produce a new data.frame which, with :results value, will be 
understood by org as an table.


 -Original Message-
 From: emacs-orgmode-bounces+mec=stowers@gnu.org [mailto:emacs-
 orgmode-bounces+mec=stowers@gnu.org] On Behalf Of John Kitchin
 Sent: Monday, August 03, 2015 3:06 PM
 To: Allen S. Rout a...@ufl.edu
 Cc: emacs-orgmode@gnu.org
 Subject: Re: [O] orgmode and R?
 
 I think the question was about using R in table formulas, not just using R in
 src-block.
 
 As far as I know it is possible to use emacs-lisp pretty directly, but not 
 other
 languages in the table formulas.
 
 Allen S. Rout writes:
 
  On 08/03/2015 12:51 PM, Jude DaShiell wrote:
  Can the orgmode spreadsheet access R either directly or indirectly
  through maybe babel?  If this is possible, do any tutorials exist
  with some worked examples?  I have R and emacs-R-mode installed so I
  can access R from emacs at least.
 
 
  Yes.
 
  http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-R.html
 
  is the first hit on org-mode R from google.
 
  There is extensive art on the topic.
 
 
  - Allen S. Rout
 
 --
 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] capture htmlwidgets for export - a pattern in search of a new :results type???

2015-07-28 Thread Cook, Malcolm
 On Tue, 28 Jul 2015, Cook, Malcolm wrote:
 
  I have been playing with exporting htmlwidgets [1] generated in R code-
 blocks.
 
 
 [snip: proposal for new :results format to accomodate repetitive codes]
 
 
 
  Perhaps there is  a better or more useful abstraction.
 
  Or a better workaround than simply following the pattern when needed
 (which is not too hard anyway).
 
  Any ideas along these lines?
 
 See
 
   (info (org) Noweb reference syntax)
 
 for one way to handle repetitive codes.
 
 Alternately, header args :var, :post, :prologue and/or :epilogue could be used
 to crystallize your code.

Excellent!  Glad to be directed to these.  The combination of all of them gets 
me over the fence:

#+name: iframe
#+begin_src sh :var it= :var height=700px :var width=700px :results 
output :exports none
   printf iframe src=%s height=%s width=%s  $it $height $width
#+end_src

#+header: :prologue {file=d3heatmap_widget.html; saveWidget({
#+header: :epilogue },file) ;file}
#+BEGIN_SRC R :session *R* :results html :exports both :post 
iframe(it=*this*,height=800px width=800px)
library(htmlwidgets)
library(d3heatmap)
d3heatmap(mtcars, scale=column, colors=Greens)
#+END_SRC

#+RESULTS:
#+BEGIN_HTML
iframe src=d3heatmap_widget.html height=800px width=700px 
#+END_HTML


I don't really care for all the verbosity of the header, but the effect is 
perfect.  The code block does not contain ANY extra org-mode export-specific 
cruft.

TH,

Malcolm

 
 One other alternative is to write an R function that creates the extra markup.
 
 HTH,
 
 Chuck



[O] capture htmlwidgets for export - a pattern in search of a new :results type???

2015-07-28 Thread Cook, Malcolm
I have been playing with exporting htmlwidgets [1] generated in R code-blocks.

[1] http://www.htmlwidgets.org/  and

Here is a worked example that exports to html

#+BEGIN_SRC R :session *R* :exports both :results html 
library(htmlwidgets)
library(d3heatmap)
widget-d3heatmap(mtcars, scale=column, colors=Blues)
saveWidget(widget,'d3heatmap_widget.html')
print('iframe height=700px width=700px 
src=./d3heatmap_widget.html/iframe')
#+END_SRC
#+RESULTS:
#+BEGIN_HTML
iframe height=700px width=700px src=./d3heatmap_widget.html/iframe
#+END_HTML

After doing a few of these, a pattern emerges:  using ':results html' in the 
code bock header, and the last 2 lines of:
saveWidget(...)
print('iframe ... ')

I think this pattern motivates considering developing support for htmlwidget 
as a new :results type (in addition to 'raw, org, html, latex, code, pp, 
drawer') 

It could be used in combination with :file and understood by the R/org glue 
and exporters.

Allowing to write, instead of the above, something like:

#+BEGIN_SRC R :session *R* :exports both :file d3heatmap_widget.html 
:results htmlwidget :height 700 :width 700
library(htmlwidgets)
library(d3heatmap)
d3heatmap(mtcars, scale=column, colors=Blues)
#+END_SRC
#+RESULTS:
file: d3heatmap_widget.html

The org-to-R glue would have to behave somewhat similarly to how graphics are 
currently handled, however, instead of printing the value to the :file, the 
value would need to be saveWidget-ed.

And, similar to image handling, the exported value would be in-lined into the 
html, wrapped in an iframe (I presume).

Perhaps there is  a better or more useful abstraction.

Or a better workaround than simply following the pattern when needed (which is 
not too hard anyway).

Any ideas along these lines?

Thanks

Malcolm Cook
m...@stowers.org




Re: [O] Capture-like browser plugin?

2015-07-23 Thread Cook, Malcolm
 Frequently when I'm doing a Web search and find pages I like, I want to save
 a link to the page, along with the title and perhaps a few notes. Something
 like org-mode's capture would be great, but I'd like to initiate it from a
 browser. I imaging hitting a plugin button on the the browser's toolbar to
 open emacs via emacsclient, and essentially do a capture with the link and
 whatever text I care to enter.
 
 Has anyone seen or heard of or written something like this?

Sure.

Depending on your web browser, there are plugins to populate the clipboard with 
a link formatted according to a template variously as plain text, markdown, 
html, media-wiki, or (with configuration) org-mode.  

I use chrome and am happy with Create Link 
https://chrome.google.com/webstore/detail/create-link/gcmghdmnkfdbncmnmlkkglmnnhagajbm?hl=en-US

Firefox similarly has Make Link: 
https://addons.mozilla.org/en-US/firefox/addon/make-link/

~Malcolm

 
 Thanks!
 -pd




Re: [O] Recently emacs hangs on startup due to ESS

2015-05-28 Thread Cook, Malcolm
 On Thu, May 28, 2015 at 5:07 PM, Cook, Malcolm m...@stowers.org
 wrote:
  I would install latest ess fresh.
 
 I wondered about that as well, so I tried that prior to posting here.
 Sorry, I should have listed my version, which is now 15.03-1.
 
  What version of emacs?  The package manager is a moving target these
 days.
 
 GNU Emacs 24.5.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.16.2)
 (installed via Arch Linux standard package)
 
  Try to use the package manager to interactively install the latest
 
  - emacs -Q
  following:
  http://melpa.org/?utm_source=dlvr.itutm_medium=twitter#/getting-
 star
  ted
  - putting this in the buffer
 
  (require 'package) ;; You might already have this line (add-to-list
  'package-archives
   '(melpa . http://melpa.org/packages/;) t) (when (
  emacs-major-version 24)
;; For important compatibility libraries like cl-lib
(add-to-list 'package-archives '(gnu .
  http://elpa.gnu.org/packages/;)))
  (package-initialize) ;; You might already have this line
 
 
 I could do this, though I've sort of decided to steer away from packages and
 just manage things manually via my ~/.elisp/site-lisp folder. Would this have
 an affect? My process was to simply download the .zip of ESS, and unpack to
 ~/.elisp/site-lisp/ess (after deleting the old version). This way, my .emacs 
 can
 continue to point to ~/.elisp/site-lisp/ess/lisp regardless of what version I
 have.
 
 If manual vs. [m]elpa would make a difference, I suppose I could give the
 above a whirl.
 

Well, you'll get everything compiled if you use the package manager.  Worth it 
just for that!  There are other ways to get those files byte-compiled, but the 
package manager is probably the best.

Also, the package manager can help you discover when updates exist to ALL your 
eamcs packages.  Worth learning for that.

OTOH, as I said, it has been in flux lately and is still a moving target.

BTW, when did you last update emacs?

And, does (require 'ess-site) ALL BY ITSELF generate your error?

~Malcolm


 
 Best regards,
 John
 
 
 
  - M-x eval-region on the above lines
 
 
  Then, M-x list-packages and install it by positioning the cursor on the line
 mentioning the ess package from melpa and typing I.
 
  The type x to execute your decision, and confirm with yes.
 
  Now, delete or move/hide your old ess bits and restart emacs.
 
  Did it work?
 
  -Original Message-
  From: emacs-orgmode-bounces+mec=stowers@gnu.org
 [mailto:emacs-
  orgmode-bounces+mec=stowers@gnu.org] On Behalf Of John Hendy
  Sent: Thursday, May 28, 2015 2:51 PM
  To: emacs-orgmode
  Subject: [O] Recently emacs hangs on startup due to ESS
 
  Over the past couple of weeks, I've been having some issues with
  emacs hanging on startup. I usually kill the process, but
  inadvertently left it in the background today, noting much later that
  it ended up starting. I played with commenting out various parts of
  my config until I narrowed things down to the line:
 
  (require 'ess-site)
 
  the message buffer displays enabling speedbar support for a
  reeeaaally long time before it eventually starts up.
 
  I tried debug-on-signal and eval-expression-debug-on-error... I'm not
  sure what is supposed to happen with debug options, but no debug
  buffer pops up. The only lines that appear relevant in *Messages* are:
 
  ad-handle-definition: `ess-indent-command' got redefined
  ad-handle-definition: `ess-eval-line-and-step' got redefined
 
  How might I diagnose this further?. I'm not familiar with chasing
  down Emacs issues other than narrowing it down to a config file option.
 
  I can reproduce this with:
  - emacs -Q
  - putting this in the buffer
 
  (add-to-list 'load-path /path/to/ess/lisp) (require 'ess-site)
 
  - M-x eval-region on the above two lines
 
 
  Thanks for any suggestions,
  John
 


Re: [O] Recently emacs hangs on startup due to ESS

2015-05-28 Thread Cook, Malcolm
I would install latest ess fresh.

What version of emacs?  The package manager is a moving target these days.

Try to use the package manager to interactively install the latest 

 - emacs -Q
 following: 
 http://melpa.org/?utm_source=dlvr.itutm_medium=twitter#/getting-started
 - putting this in the buffer

(require 'package) ;; You might already have this line
(add-to-list 'package-archives
 '(melpa . http://melpa.org/packages/;) t)
(when ( emacs-major-version 24)
  ;; For important compatibility libraries like cl-lib
  (add-to-list 'package-archives '(gnu . http://elpa.gnu.org/packages/;)))
(package-initialize) ;; You might already have this line


 
 - M-x eval-region on the above lines


Then, M-x list-packages and install it by positioning the cursor on the line 
mentioning the ess package from melpa and typing I.

The type x to execute your decision, and confirm with yes.

Now, delete or move/hide your old ess bits and restart emacs.

Did it work?

 -Original Message-
 From: emacs-orgmode-bounces+mec=stowers@gnu.org [mailto:emacs-
 orgmode-bounces+mec=stowers@gnu.org] On Behalf Of John Hendy
 Sent: Thursday, May 28, 2015 2:51 PM
 To: emacs-orgmode
 Subject: [O] Recently emacs hangs on startup due to ESS
 
 Over the past couple of weeks, I've been having some issues with emacs
 hanging on startup. I usually kill the process, but inadvertently left it in 
 the
 background today, noting much later that it ended up starting. I played with
 commenting out various parts of my config until I narrowed things down to
 the line:
 
 (require 'ess-site)
 
 the message buffer displays enabling speedbar support for a reeeaaally
 long time before it eventually starts up.
 
 I tried debug-on-signal and eval-expression-debug-on-error... I'm not sure
 what is supposed to happen with debug options, but no debug buffer pops
 up. The only lines that appear relevant in *Messages* are:
 
 ad-handle-definition: `ess-indent-command' got redefined
 ad-handle-definition: `ess-eval-line-and-step' got redefined
 
 How might I diagnose this further?. I'm not familiar with chasing down Emacs
 issues other than narrowing it down to a config file option.
 
 I can reproduce this with:
 - emacs -Q
 - putting this in the buffer
 
 (add-to-list 'load-path /path/to/ess/lisp) (require 'ess-site)
 
 - M-x eval-region on the above two lines
 
 
 Thanks for any suggestions,
 John



Re: [O] Recently emacs hangs on startup due to ESS

2015-05-28 Thread Cook, Malcolm
John, still recommend you try fresh ess, compiled via package manager.  Also, 
update any packages needing updated.  Maybe speedbar?

I'm dry,

Best,

Malcolm

 -Original Message-
 From: John Hendy [mailto:jw.he...@gmail.com]
 Sent: Thursday, May 28, 2015 6:24 PM
 To: Cook, Malcolm
 Cc: emacs-orgmode
 Subject: Re: [O] Recently emacs hangs on startup due to ESS
 
 On Thu, May 28, 2015 at 5:38 PM, Cook, Malcolm m...@stowers.org
 wrote:
  On Thu, May 28, 2015 at 5:07 PM, Cook, Malcolm m...@stowers.org
  wrote:
   I would install latest ess fresh.
 
  I wondered about that as well, so I tried that prior to posting here.
  Sorry, I should have listed my version, which is now 15.03-1.
 
   What version of emacs?  The package manager is a moving target
   these
  days.
 
  GNU Emacs 24.5.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.16.2)
  (installed via Arch Linux standard package)
 
   Try to use the package manager to interactively install the latest
  
   - emacs -Q
   following:
  
 http://melpa.org/?utm_source=dlvr.itutm_medium=twitter#/getting-
  star
   ted
   - putting this in the buffer
  
   (require 'package) ;; You might already have this line (add-to-list
   'package-archives
'(melpa . http://melpa.org/packages/;) t) (when (
   emacs-major-version 24)
 ;; For important compatibility libraries like cl-lib
 (add-to-list 'package-archives '(gnu .
   http://elpa.gnu.org/packages/;)))
   (package-initialize) ;; You might already have this line
  
 
  I could do this, though I've sort of decided to steer away from
  packages and just manage things manually via my ~/.elisp/site-lisp
  folder. Would this have an affect? My process was to simply download
  the .zip of ESS, and unpack to ~/.elisp/site-lisp/ess (after deleting
  the old version). This way, my .emacs can continue to point to
  ~/.elisp/site-lisp/ess/lisp regardless of what version I have.
 
  If manual vs. [m]elpa would make a difference, I suppose I could give
  the above a whirl.
 
 
  Well, you'll get everything compiled if you use the package manager.
 Worth it just for that!  There are other ways to get those files 
 byte-compiled,
 but the package manager is probably the best.
 
 ESS is sounding like compilation is optional, and I never have.
 - http://ess.r-project.org/Manual/ess.html#Installation
 
 
  Also, the package manager can help you discover when updates exist to
 ALL your eamcs packages.  Worth learning for that.
 
 Definitely. I may look into that. I pretty much just use Org and R, so not 
 super
 worried about it, but I really don't know enough to understand what other
 packages ship with emacs that I could/should be updating!
 
 
  OTOH, as I said, it has been in flux lately and is still a moving target.
 
  BTW, when did you last update emacs?
 
 $ grep emacs /var/log/pacman.log
 
 [2014-06-14 20:49] [PACMAN] upgraded emacs (24.3-6 - 24.3-7)
 [2014-10-23 10:28] [PACMAN] upgraded emacs (24.3-7 - 24.4-1)
 [2015-01-19 01:36] [ALPM] upgraded emacs (24.4-1 - 24.4-2)
 [2015-04-20 13:14] [ALPM] upgraded emacs (24.4-2 - 24.5-1)
 
 
  And, does (require 'ess-site) ALL BY ITSELF generate your error?
 
 
 Yup, see the original email:
 
 #+begin_quote
 
 I can reproduce this with:
 - emacs -Q
 - putting this in the buffer
 
 (add-to-list 'load-path /path/to/ess/lisp) (require 'ess-site)
 
 - M-x eval-region on the above two lines
 
 #+end_quote
 
 
 Thanks for the assistance!
 John
 
  ~Malcolm
 
 
 
  Best regards,
  John
 
  
  
   - M-x eval-region on the above lines
  
  
   Then, M-x list-packages and install it by positioning the cursor on
   the line
  mentioning the ess package from melpa and typing I.
  
   The type x to execute your decision, and confirm with yes.
  
   Now, delete or move/hide your old ess bits and restart emacs.
  
   Did it work?
  
   -Original Message-
   From: emacs-orgmode-bounces+mec=stowers@gnu.org
  [mailto:emacs-
   orgmode-bounces+mec=stowers@gnu.org] On Behalf Of John
 Hendy
   Sent: Thursday, May 28, 2015 2:51 PM
   To: emacs-orgmode
   Subject: [O] Recently emacs hangs on startup due to ESS
  
   Over the past couple of weeks, I've been having some issues with
   emacs hanging on startup. I usually kill the process, but
   inadvertently left it in the background today, noting much later
   that it ended up starting. I played with commenting out various
   parts of my config until I narrowed things down to the line:
  
   (require 'ess-site)
  
   the message buffer displays enabling speedbar support for a
   reeeaaally long time before it eventually starts up.
  
   I tried debug-on-signal and eval-expression-debug-on-error... I'm
   not sure what is supposed to happen with debug options, but no
   debug buffer pops up. The only lines that appear relevant in
 *Messages* are:
  
   ad-handle-definition: `ess-indent-command' got redefined
   ad-handle-definition: `ess-eval-line-and-step' got redefined
  
   How might I diagnose this further?. I'm

Re: [O] Recently emacs hangs on startup due to ESS

2015-05-28 Thread Cook, Malcolm
John, 

Glad you're cooking with ESS.  Gonna hafta chalk your WTF moment up to some 
butterfly in Kamchatka.  Or was it Saskatchewan? 

BTW, since you said you use org-mode, please note, when you get next perform a 
fresh install of org-mode, regardless of the  means (package manager, git pull, 
stork brought it, whatevs), make sure  it is compiled, and in a fresh boot of 
emacs unsullied by current (and soon to be ancien regime) org-mode.  In other 
words, run  `emacs -Q` as you do, and install the new org WITHOUT  LOADING THE 
EXISTING ORG.You have been warned!

~ malcolm_c...@stowers.org


From: John Hendy jw.he...@gmail.com
Sent: Thursday, May 28, 2015 11:15 PM
To: Cook, Malcolm
Cc: emacs-orgmode
Subject: Re: [O] Recently emacs hangs on startup due to ESS

On Thu, May 28, 2015 at 6:34 PM, Cook, Malcolm m...@stowers.org wrote:
 John, still recommend you try fresh ess, compiled via package manager.  Also, 
 update any packages needing updated.  Maybe speedbar?

So, I followed your nice ELPA instructions, and things worked. Then I
wondered if it was compilation related, so I did that in my manually
downloaded ESS dir and re-enabled my default load path (instead of
ELPA), and no emacs hang. Then I run make clean, no hang. Then I do
the emacs -Q method in my original email... hang. Then make again, no
hang. Then make clean. No hang.

I also played with ess-speedbar-use-p in case it's an issue with that,
but at this point I feel like I can't reproducibly cause it to hang
anymore so I don't know what in the world is going on.

Definite wtf moment for me!


Thanks for all of your input/suggestions!
John


 I'm dry,

 Best,

 Malcolm

 -Original Message-
 From: John Hendy [mailto:jw.he...@gmail.com]
 Sent: Thursday, May 28, 2015 6:24 PM
 To: Cook, Malcolm
 Cc: emacs-orgmode
 Subject: Re: [O] Recently emacs hangs on startup due to ESS

 On Thu, May 28, 2015 at 5:38 PM, Cook, Malcolm m...@stowers.org
 wrote:
  On Thu, May 28, 2015 at 5:07 PM, Cook, Malcolm m...@stowers.org
  wrote:
   I would install latest ess fresh.
 
  I wondered about that as well, so I tried that prior to posting here.
  Sorry, I should have listed my version, which is now 15.03-1.
 
   What version of emacs?  The package manager is a moving target
   these
  days.
 
  GNU Emacs 24.5.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.16.2)
  (installed via Arch Linux standard package)
 
   Try to use the package manager to interactively install the latest
  
   - emacs -Q
   following:
  
 http://melpa.org/?utm_source=dlvr.itutm_medium=twitter#/getting-
  star
   ted
   - putting this in the buffer
  
   (require 'package) ;; You might already have this line (add-to-list
   'package-archives
'(melpa . http://melpa.org/packages/;) t) (when (
   emacs-major-version 24)
 ;; For important compatibility libraries like cl-lib
 (add-to-list 'package-archives '(gnu .
   http://elpa.gnu.org/packages/;)))
   (package-initialize) ;; You might already have this line
  
 
  I could do this, though I've sort of decided to steer away from
  packages and just manage things manually via my ~/.elisp/site-lisp
  folder. Would this have an affect? My process was to simply download
  the .zip of ESS, and unpack to ~/.elisp/site-lisp/ess (after deleting
  the old version). This way, my .emacs can continue to point to
  ~/.elisp/site-lisp/ess/lisp regardless of what version I have.
 
  If manual vs. [m]elpa would make a difference, I suppose I could give
  the above a whirl.
 
 
  Well, you'll get everything compiled if you use the package manager.
 Worth it just for that!  There are other ways to get those files 
 byte-compiled,
 but the package manager is probably the best.

 ESS is sounding like compilation is optional, and I never have.
 - http://ess.r-project.org/Manual/ess.html#Installation

 
  Also, the package manager can help you discover when updates exist to
 ALL your eamcs packages.  Worth learning for that.

 Definitely. I may look into that. I pretty much just use Org and R, so not 
 super
 worried about it, but I really don't know enough to understand what other
 packages ship with emacs that I could/should be updating!

 
  OTOH, as I said, it has been in flux lately and is still a moving target.
 
  BTW, when did you last update emacs?

 $ grep emacs /var/log/pacman.log

 [2014-06-14 20:49] [PACMAN] upgraded emacs (24.3-6 - 24.3-7)
 [2014-10-23 10:28] [PACMAN] upgraded emacs (24.3-7 - 24.4-1)
 [2015-01-19 01:36] [ALPM] upgraded emacs (24.4-1 - 24.4-2)
 [2015-04-20 13:14] [ALPM] upgraded emacs (24.4-2 - 24.5-1)

 
  And, does (require 'ess-site) ALL BY ITSELF generate your error?
 

 Yup, see the original email:

 #+begin_quote

 I can reproduce this with:
 - emacs -Q
 - putting this in the buffer

 (add-to-list 'load-path /path/to/ess/lisp) (require 'ess-site)

 - M-x eval-region on the above two lines

 #+end_quote


 Thanks for the assistance!
 John

  ~Malcolm
 
 
 
  Best

Re: [O] [PATCH] WAS Re: Bug: problem w/ R code blocks [8.3beta (release_8.3beta-362-ga92789 at /usr/local/share/emacs/site-lisp/org/)]

2014-12-09 Thread Cook, Malcolm
Hi, 

On this old subject, I too finally confirm the pushed patch addresses the issue 
- and - thanks.

 -Original Message-
 From: emacs-orgmode-bounces+mec=stowers@gnu.org 
 [mailto:emacs-orgmode-bounces+mec=stowers@gnu.org] On
 Behalf Of Aaron Ecay
 Sent: Friday, October 10, 2014 11:37 AM
 To: Henrik Singmann; emacs-orgmode@gnu.org
 Subject: Re: [O] [PATCH] WAS Re: Bug: problem w/ R code blocks [8.3beta 
 (release_8.3beta-362-ga92789 at
 /usr/local/share/emacs/site-lisp/org/)]
 
 Hi Henrik,
 
 2014ko urriak 10an, Henrik Singmann-ek idatzi zuen:
 
  Hi Aaron,
 
  This patch also solves the problem for me. No more .ess.eval not
  found!
 
 Thanks for testing.  I’ve pushed the patch to the master branch.
 
 --
 Aaron Ecay



Re: [O] sortable columns in html tables

2014-09-30 Thread Cook, Malcolm
Hi,

The syntax for much of this has changed since that post.

Instead of
#+style:
you will want
#+HTML_HEAD:

And, attaching a class to an exported html table is handled differently too.

Instead of 
#+attr_html: class=sortable
you want
#+attr_html: :class sortable

Such declarations also work for exported tables if placed between code blocks 
that export tables and the result tables (i.e. immediately after the 
`#+end_src`)

Also, if you want ALL tables to have a class of sortable, you _can_ eval the 
following

(plist-put org-html-table-default-attributes :class sortable)

i.e. by putting it in your emacs init.el 

Or, on a per-buffer basis, which is probably better,  you can put this in your 
.org file

#+BIND: org-html-table-default-attributes (:border 2 :cellspacing 0 
:cellpadding 6 :rules groups :frame hsides  :class sortable)

By the way, I don't use sortable, I use dataTable, but the method for getting 
the class attribute on the html table is the same.

~malcolm_cook

 -Original Message-
 From: emacs-orgmode-bounces+mec=stowers@gnu.org 
 [mailto:emacs-orgmode-bounces+mec=stowers@gnu.org] On
 Behalf Of Michael Brand
 Sent: Tuesday, September 30, 2014 1:12 PM
 To: David Arroyo Menendez
 Cc: Org Mode
 Subject: Re: [O] sortable columns in html tables
 
 Hi David
 
 On Tue, Sep 30, 2014 at 1:44 AM, David Arroyo Menendez davi...@gnu.org 
 wrote:
  How can I make sortable columns in tables? I would be useful to edit or
  export to html.
 
  Some experiences?
 
  Thanks!
 
 As I understand you this pointer might be of interest:
 http://lists.gnu.org/archive/html/emacs-orgmode/2012-11/msg00809.html
 
 Michael



Re: [O] [PATCH] WAS Re: Bug: problem w/ R code blocks [8.3beta (release_8.3beta-362-ga92789 at /usr/local/share/emacs/site-lisp/org/)]

2014-09-18 Thread Cook, Malcolm
Hi,

Hmm, I spoke too soon the problem is only partially fixed by this patch...

Trying to work with in org-mode with R code blocks attached to persistent 
sessions (i.e. adding ':session myRsession' to the code block header ) makes 
things start to break again, at least in my hands.

I'm going to wait till things settle down before trying to upgrade ESS again.

Thanks for the patch anyway.

Cheers,

Malcolm

 -Original Message-
 From: Cook, Malcolm
 Sent: Wednesday, September 17, 2014 6:14 PM
 To: 'Rainer M Krug'; 'Charles Berry'
 Cc: 'emacs-orgmode@gnu.org'
 Subject: RE: [O] [PATCH] WAS Re: Bug: problem w/ R code blocks [8.3beta 
 (release_8.3beta-362-ga92789 at
 /usr/local/share/emacs/site-lisp/org/)]
 
 Hiya,
 
 Likewise - same problem here is fixed with injection of patch.
 
 Thanks!
 
 ~ malcolm_cook
 
 
  -Original Message-
  From: emacs-orgmode-bounces+mec=stowers@gnu.org 
  [mailto:emacs-orgmode-bounces+mec=stowers@gnu.org] On
  Behalf Of Rainer M Krug
  Sent: Wednesday, September 17, 2014 2:26 AM
  To: Charles Berry
  Cc: emacs-orgmode@gnu.org
  Subject: Re: [O] [PATCH] WAS Re: Bug: problem w/ R code blocks [8.3beta 
  (release_8.3beta-362-ga92789 at
  /usr/local/share/emacs/site-lisp/org/)]
  
  Rainer M Krug rai...@krugs.de writes:
  
  Using it, error is gone.
  
  Rainer
  
   Charles Berry ccbe...@ucsd.edu writes:
  
   Charles Berry ccberry at ucsd.edu writes:
  
  
   Rainer M Krug Rainer at krugs.de writes:
  
   
Thanks - you came before me. I get the same error but managed to work
around.
   
This is likely caused by the upgrade of ess,
  
   Likely.
  
   But it may not be an ESS problem per se.
  
   M-x R starts a process that runs asynchronously. In interactive use 
   there
   is no issue (barring something in .First() that slows the startup for
   a very long time).
  
   But, ...
  
   If the  (rename-buffer ...) in org-babel-R-initiate-session
   runs before all the setup that ESS performs in the process buffer is
   complete, chaos can result.
  
   Not sure what the best way is to fix this.
  
  
   OK. Looks like (ess-wait-for-process) fixes this. Here is a patch.
  
   Thanks.
  
   Haven't tried it yet, but I can't imagine any downside of this
   patch. Could this be committed?
  
   Rainer
  
  
   Chuck
   ==
  
   From 89472012d80ce9ad4c8722f304c0d29327efa1fc Mon Sep 17 00:00:00 2001
   From: chasberry ccbe...@ucsd.edu
   Date: Tue, 16 Sep 2014 19:57:59 -0700
   Subject: [PATCH] lisp/ob-R.el: use `ess-wait-for-process' to assure clean
session startup
  
   * lisp/ob-R.el (org-babel-R-initiate-session): Make sure that (R) has
   finished before `rename-buffer' is run.
  
   TINYCHANGE
   ---
lisp/ob-R.el | 3 +++
1 file changed, 3 insertions(+)
  
   diff --git a/lisp/ob-R.el b/lisp/ob-R.el
   index 41b943c..7575acf 100644
   --- a/lisp/ob-R.el
   +++ b/lisp/ob-R.el
   @@ -35,6 +35,8 @@
(declare-function inferior-ess-send-input ext:ess-inf ())
(declare-function ess-make-buffer-current ext:ess-inf ())
(declare-function ess-eval-buffer ext:ess-inf (vis))
   +(declare-function ess-wait-for-process ext:ess-inf
   +  (optional proc sec-prompt wait force-redisplay))
(declare-function org-number-sequence org-compat (from optional to 
   inc))
(declare-function org-remove-if-not org (predicate seq))
(declare-function org-every org (pred seq))
   @@ -262,6 +264,7 @@ This function is called by 
   `org-babel-execute-src-block'.
;; Session buffer exists, but with dead process
(set-buffer session))
  (require 'ess) (R)
   +  (ess-wait-for-process)
  (rename-buffer
   (if (bufferp session)
   (buffer-name session)
  
  --
  Rainer M. Krug
  email: Raineratkrugsdotde
  PGP: 0x0F52F982



Re: [O] [PATCH] WAS Re: Bug: problem w/ R code blocks [8.3beta (release_8.3beta-362-ga92789 at /usr/local/share/emacs/site-lisp/org/)]

2014-09-17 Thread Cook, Malcolm
Hiya,

Likewise - same problem here is fixed with injection of patch.  

Thanks!

~ malcolm_cook


 -Original Message-
 From: emacs-orgmode-bounces+mec=stowers@gnu.org 
 [mailto:emacs-orgmode-bounces+mec=stowers@gnu.org] On
 Behalf Of Rainer M Krug
 Sent: Wednesday, September 17, 2014 2:26 AM
 To: Charles Berry
 Cc: emacs-orgmode@gnu.org
 Subject: Re: [O] [PATCH] WAS Re: Bug: problem w/ R code blocks [8.3beta 
 (release_8.3beta-362-ga92789 at
 /usr/local/share/emacs/site-lisp/org/)]
 
 Rainer M Krug rai...@krugs.de writes:
 
 Using it, error is gone.
 
 Rainer
 
  Charles Berry ccbe...@ucsd.edu writes:
 
  Charles Berry ccberry at ucsd.edu writes:
 
 
  Rainer M Krug Rainer at krugs.de writes:
 
  
   Thanks - you came before me. I get the same error but managed to work
   around.
  
   This is likely caused by the upgrade of ess,
 
  Likely.
 
  But it may not be an ESS problem per se.
 
  M-x R starts a process that runs asynchronously. In interactive use there
  is no issue (barring something in .First() that slows the startup for
  a very long time).
 
  But, ...
 
  If the  (rename-buffer ...) in org-babel-R-initiate-session
  runs before all the setup that ESS performs in the process buffer is
  complete, chaos can result.
 
  Not sure what the best way is to fix this.
 
 
  OK. Looks like (ess-wait-for-process) fixes this. Here is a patch.
 
  Thanks.
 
  Haven't tried it yet, but I can't imagine any downside of this
  patch. Could this be committed?
 
  Rainer
 
 
  Chuck
  ==
 
  From 89472012d80ce9ad4c8722f304c0d29327efa1fc Mon Sep 17 00:00:00 2001
  From: chasberry ccbe...@ucsd.edu
  Date: Tue, 16 Sep 2014 19:57:59 -0700
  Subject: [PATCH] lisp/ob-R.el: use `ess-wait-for-process' to assure clean
   session startup
 
  * lisp/ob-R.el (org-babel-R-initiate-session): Make sure that (R) has
  finished before `rename-buffer' is run.
 
  TINYCHANGE
  ---
   lisp/ob-R.el | 3 +++
   1 file changed, 3 insertions(+)
 
  diff --git a/lisp/ob-R.el b/lisp/ob-R.el
  index 41b943c..7575acf 100644
  --- a/lisp/ob-R.el
  +++ b/lisp/ob-R.el
  @@ -35,6 +35,8 @@
   (declare-function inferior-ess-send-input ext:ess-inf ())
   (declare-function ess-make-buffer-current ext:ess-inf ())
   (declare-function ess-eval-buffer ext:ess-inf (vis))
  +(declare-function ess-wait-for-process ext:ess-inf
  +(optional proc sec-prompt wait force-redisplay))
   (declare-function org-number-sequence org-compat (from optional to 
  inc))
   (declare-function org-remove-if-not org (predicate seq))
   (declare-function org-every org (pred seq))
  @@ -262,6 +264,7 @@ This function is called by 
  `org-babel-execute-src-block'.
 ;; Session buffer exists, but with dead process
 (set-buffer session))
   (require 'ess) (R)
  +(ess-wait-for-process)
   (rename-buffer
(if (bufferp session)
(buffer-name session)
 
 --
 Rainer M. Krug
 email: Raineratkrugsdotde
 PGP: 0x0F52F982



[O] HowTo? have R :sessions in org mode invoke a specific R

2013-11-04 Thread Cook, Malcolm
I wish to lock an org buffer to a particular installation of R so that all code 
blocks use it.

I found that I could not, for instance, write `:session R-3.0.1`.

Is there some best way for me to accomplish this?

Perhaps some way of setting inferior-R-program-name to a buffer local value?

Thanks!

~Malcolm




Re: [O] make new links show as figures?

2013-10-31 Thread Cook, Malcolm

  So it turns out that this is a REALLY simple patch (two characters):
 
  +++ b/lisp/org.el
  @@ -18853,7 +18853,7 @@ BEG and END default to the buffer boundaries.
  (widen)
  (setq beg (or beg (point-min)) end (or end (point-max)))
  (goto-char beg)
  -   (let ((re (concat
  \\[\\[\\(\\(file:\\)\\|\\([./~]\\)\\)\\([^]\n]+?
  +   (let ((re (concat
  \\[.*\\[\\(\\(file:\\)\\|\\([./~]\\)\\)\\([^]\n]+?
  (substring (org-image-file-name-regexp) 0 -2)
  \\)\\] (if include-linked  \\])))
  (case-fold-search t)
 
  This seems to work in all cases I can think of (see test file below).
  Let me know if this works for you and i will apply to master when i
  get home and have git push access.
 
  I tried it on some files with images as links, and it works
  great. Thanks a lot!
[Cook, Malcolm] 

Hi - I'm trying to follow this thread but having a challenge.  Can you please 
summarize/repeat the original intended effect of this change  

~Malcolm


 
 So, I've done some testing of the export functions (html and latex
 only) and found the following behaviors with this patch:
 
 - HTML
 - image in description only displayed if the protocol (file:) is
 included.
 - LaTeX
 - same, required file: protocol in description
 - additionally, pdflatex \includgraphics barfs on any path w/ a
 =./= path prefix -- this is true for the current implmenation as
 well.
 
 Changing the regexp for in-buffer image expansion to mimic the export
 behavior is difficult at best. I think the inconsistency is
 acceptable, and I will documentment the behavior in the
 `org-display-inline-images' docstring.
 
 The latex breakage on paths beginning with =./= should perhaps be
 addressed in the latex exporter, but this is orthogonal to the
 current issue.
 
 If there is no objection, I will push a fix tonight or tomorrow.
 
 rick
 



Re: [O] how to handle svg files when exporting orgmode to html and pdf?

2013-10-29 Thread Cook, Malcolm
Hi Aaron,

 Can I re-open this thread to discuss two new issues I now experience with 
 emacs 24.3.1 and orgmode version 8.2.1 in the handling of
 svg = tex = pdf ?
 
  Here goes:
 
  1) If the plot has text in it which contains a percent character (%),
  then we fail due to https://bugs.launchpad.net/inkscape/+bug/857231
 
 It sounds from
 https://bugs.launchpad.net/inkscape/+bug/719320/comments/3 as though
 inkscape makes a deliberate effort to support LaTeX markup in their
 pdf+latex output.  So it’s not surprising that % is a problem.
 
It’s unfortunate from the perspective of having a single SVG file that
 works in both HTML and LaTeX, but I don’t know if that is an argument
 that will cut ice with them.  I don’t know what org can/should do to
 patch around inkscape’s design decisions.

Indeed!  So, I made a suggestion to 'fix' (?) Inkscape here:

https://bugs.launchpad.net/inkscape/+bug/719320

Let's see if I get any traction on that!


 Certainly the svg LaTeX package could be patched to use inkscape’s pdf
 export, instead of the pdf+latex one.  This would lose the nice fonts
 that running the text through latex nets you, but get rid of the %
 annoyances.
 
 
  2) If the :file is in a sub-directory  (for example, `:file
  fig/mtcars.svg`), even though both ./fig/mtcars.pdf_tex  and
  ./fig/mtcars.pdf are created, the reference to the .pdf in the
  .pdf_tex  is not interpreted relative to the subdirectory, but rather
  to the parent, and so the .pdf is not found.
 
 Have you looked at the \graphicspath macro from the graphics package?
 http://www.tex.ac.uk/cgi-bin/texfaq2html?label=graphicspath.  You may
 be able to get things to work by adding \graphicspath{{fig/}} (note the
 double braces) to your document.  \setsvg{svgpath=fig/} from the svg
 package may also/additionally be needed.
 

Excellent!  Adding to the top of my emacs .org file the following allowed it to 
work.  

#+LATEX_HEADER: \graphicspath{{fig/}}

Much better workaround.  But still a workaround?

~ Malcolm


 Aaron
 
 PS Maybe org should be generating the \includesvg command relative to
 the graphicspath or svgpath – I’m not sure.  But let us know if setting
 those variables works at all, and if so we can think about adding
 support to org.
 
 --
 Aaron Ecay


Re: [O] how to handle svg files when exporting orgmode to html and pdf?

2013-10-28 Thread Cook, Malcolm
Thomas, Suvayu, Aaron, Nick, Eric, Carsten, Phil, et al,

Hi again!

Can I re-open this thread to discuss two new issues I now experience with emacs 
24.3.1 and orgmode version 8.2.1 in the handling of svg = tex = pdf ?

Here goes:

1) If the plot has text in it which contains a percent character (%), then we 
fail due to https://bugs.launchpad.net/inkscape/+bug/857231

2) If the :file is in a sub-directory  (for example, `:file fig/mtcars.svg`), 
even though both ./fig/mtcars.pdf_tex  and ./fig/mtcars.pdf are created, the 
reference to the .pdf in the .pdf_tex  is not interpreted relative to the 
subdirectory, but rather to the parent, and so the .pdf is not found.

The workaround for (1) is to not use '%' as a label on my plots.

The workaround for (2) is to not put my figures in a './fig/' subdirectory.

I suppose the fix for (1) is to get the inkscape export 'fixed' to (optionally) 
escape the labels, and to take the option.  Thoughts?

I suppose the fix for (2) is somewhere in the org code.  Any takers?

Or, any other fixes suggested?

Thanks!

Malcolm



 -Original Message-
 From: emacs-orgmode-bounces+mec=stowers@gnu.org 
 [mailto:emacs-orgmode-bounces+mec=stowers@gnu.org] On
 Behalf Of Cook, Malcolm
 Sent: Friday, August 09, 2013 4:01 PM
 To: 'Malcolm Cook'; 'emacs-orgmode@gnu.org'; 'Nick Dokos'; 'Suvayu Ali'; 
 'Eric Schulte'; 'Vincent Beffara'; 'Thomas S. Dye';
 'phil...@cern.ch'; 'Charles Berry'; 'Aaron Ecay'
 Subject: Re: [O] how to handle svg files when exporting orgmode to html and 
 pdf?
 
 Thomas, Suvayu, Aaron, Nick, Eric, Carsten, Phil, et al,
 
 Thanks for all your help.
 
 I am now satisfied with approach for exporting images to inline html and 
 inline latex=pdf.
 
 In my hands, the following code block will produce in-line images in html and 
 be included in exported pdf.
 
 #+LATEX_HEADER: \usepackage{svg}
 #+begin_src R :results  graphics output :exports both :file mtcars.svg
 with(mtcars,plot(wt, mpg))
 #+end_src
 
 I am using:
   Emacs 24.3.1
   Suvayus orgmode export filter:
 
 (defun my-svg-graphics (contents backend info)
   (when (eq backend 'latex)
   (replace-regexp-in-string \\`includegraphics.+\\({.+\.svg}\\)
includesvg\1 contents))
 )
 (add-to-list 'org-export-filter-link-functions 'my-svg-graphics)
 
 * svg latex package v1.0 2004/11/05
 
  * customize the emacs variable `org-latex-pdf-process` to include
 '--shell-escape' (following advice in
 http://orgmode.org/worg/org-dependencies.html, which outlines some
 other options)
 
 * customize org-export-html-inline-image-extensions to include  svg
 
  * upgrade to inkscape version 0.48.+ (which is more recent than our
 centOS repos proffered, but, hey) since the --export-latex switch that
 svg.sty depends upon is not implemented till this version
 
 * upgrade org-mode version 8.0.7-377 built from git pull yesterday
 
 I think I've covered all the pieces.
 
 I have not explored how/whether any options passed to includegraphics are 
 interpreted by includesvg.
 
 Now, if I could get .svg images to display inline in my emacs buffer.  The 
 following is not respected, at least in my hands.
   '(org-export-latex-inline-image-extensions (quote (pdf jpeg jpg 
  png ps eps svg)))
 Any takers?
 
 
 ~ Malcolm
 
 
 
  -Original Message-
  From: emacs-orgmode-bounces+mec=stowers@gnu.org 
  [mailto:emacs-orgmode-bounces+mec=stowers@gnu.org] On
  Behalf Of Malcolm Cook
  Sent: Thursday, August 08, 2013 9:05 PM
  To: Malcolm Cook; emacs-orgmode@gnu.org; Nick Dokos
  Subject: Re: [O] how to handle svg files when exporting orgmode to html and 
  pdf?
  
  Aaron,
  
  Thanks for staying with me on this.
  
  I'm not sure what you're suggesting.
  
  Nonetheless, I just updated org from `git clone 
  git://orgmode.org/org-mode.git`
  
  So, now I'm got org-version  release_8.0.7-377-gef2d47.dirty.
  
  Are you suggesting that  with this patch.svg created with exporting
  graphics :file should now display in the emacs buffer when I toggle
  display of inline images?  I wish they would.  They do not, despite my
  adding svg to org-export-latex-inline-image-extensions.
  
  Are you suggesting that such a .svg created by org code block would be
  appear in the pdf created when I export to latex - pdf?  I wish that
  also... that's what I've been trying to accomplish.
  
  Thanks!,
  
  
  Malcolm
  
  
  PS - I see you are/were in PA in linguistics.   My first job after my
  masters in AI from U Mass was at CMU's psych dept as a lisp programmer
  for John Anderson's intelligent tutoring systems.  I then went on in
  computational linguistics a bit, working on a marcus parser based
  natural language processing system at wang labs.  Ages ago.  Now I'm
  in computational biology.  The one commonality through it all?  Emacs!
  --
  Malcolm Cook
  h - 913.642.5257
  c - 913.226.1542
  w - 816.926.4449
  
  
  On Thu, Aug 8, 2013 at 4:34 PM, Aaron Ecay aarone...@gmail.com wrote:
   Hi

Re: [O] example filter for code blocks?

2013-09-26 Thread Cook, Malcolm
Check out `org-export-filter-src-block-functions'.  It shouldn't be too
 hard to add a custom filter to that list which may be used to process
 all code block bodies during latex export.

Somewhat off-topic, but, thanks for pointing out this variable Eric  I've 
been wanting an approach that would wrap all exported code in some kind of 
folded mode (maybe a jquery accordion).  Initially the html document by default 
would display only exported 'results'.  The user could choose to display the 
code behind any result with a single click (keyboard interactivity would be 
even better).  Do you think that this is the right 'hook' to apply such?  Have 
you seen this already done better somewhere?

~ Malcolm Cook


 Best,
 
 --
 Eric Schulte
 https://cs.unm.edu/~eschulte
 PGP: 0x614CA05D




Re: [O] how to handle svg files when exporting orgmode to html and pdf?

2013-08-10 Thread Cook, Malcolm
Thomas, Suvayu, Aaron, Nick, Eric, Carsten, Phil, et al,

Thanks for all your help.

I am now satisfied with approach for exporting images to inline html and inline 
latex=pdf.

In my hands, the following code block will produce in-line images in html and 
be included in exported pdf.

#+LATEX_HEADER: \usepackage{svg}
#+begin_src R :results  graphics output :exports both :file mtcars.svg
with(mtcars,plot(wt, mpg))
#+end_src 

I am using:
Emacs 24.3.1
Suvayus orgmode export filter:

(defun my-svg-graphics (contents backend info)
  (when (eq backend 'latex)
  (replace-regexp-in-string \\`includegraphics.+\\({.+\.svg}\\)
   includesvg\1 contents))
)
(add-to-list 'org-export-filter-link-functions 'my-svg-graphics)

* svg latex package v1.0 2004/11/05

 * customize the emacs variable `org-latex-pdf-process` to include
'--shell-escape' (following advice in
http://orgmode.org/worg/org-dependencies.html, which outlines some
other options)

* customize org-export-html-inline-image-extensions to include  svg 

 * upgrade to inkscape version 0.48.+ (which is more recent than our
centOS repos proffered, but, hey) since the --export-latex switch that
svg.sty depends upon is not implemented till this version

* upgrade org-mode version 8.0.7-377 built from git pull yesterday

I think I've covered all the pieces.

I have not explored how/whether any options passed to includegraphics are 
interpreted by includesvg.

Now, if I could get .svg images to display inline in my emacs buffer.  The 
following is not respected, at least in my hands.  
'(org-export-latex-inline-image-extensions (quote (pdf jpeg jpg 
png ps eps svg)))
Any takers?


~ Malcolm



 -Original Message-
 From: emacs-orgmode-bounces+mec=stowers@gnu.org 
 [mailto:emacs-orgmode-bounces+mec=stowers@gnu.org] On
 Behalf Of Malcolm Cook
 Sent: Thursday, August 08, 2013 9:05 PM
 To: Malcolm Cook; emacs-orgmode@gnu.org; Nick Dokos
 Subject: Re: [O] how to handle svg files when exporting orgmode to html and 
 pdf?
 
 Aaron,
 
 Thanks for staying with me on this.
 
 I'm not sure what you're suggesting.
 
 Nonetheless, I just updated org from `git clone 
 git://orgmode.org/org-mode.git`
 
 So, now I'm got org-version  release_8.0.7-377-gef2d47.dirty.
 
 Are you suggesting that  with this patch.svg created with exporting
 graphics :file should now display in the emacs buffer when I toggle
 display of inline images?  I wish they would.  They do not, despite my
 adding svg to org-export-latex-inline-image-extensions.
 
 Are you suggesting that such a .svg created by org code block would be
 appear in the pdf created when I export to latex - pdf?  I wish that
 also... that's what I've been trying to accomplish.
 
 Thanks!,
 
 
 Malcolm
 
 
 PS - I see you are/were in PA in linguistics.   My first job after my
 masters in AI from U Mass was at CMU's psych dept as a lisp programmer
 for John Anderson's intelligent tutoring systems.  I then went on in
 computational linguistics a bit, working on a marcus parser based
 natural language processing system at wang labs.  Ages ago.  Now I'm
 in computational biology.  The one commonality through it all?  Emacs!
 --
 Malcolm Cook
 h - 913.642.5257
 c - 913.226.1542
 w - 816.926.4449
 
 
 On Thu, Aug 8, 2013 at 4:34 PM, Aaron Ecay aarone...@gmail.com wrote:
  Hi Malcom,
 
  There is a patch that was added to the master branch of the org git
  repository on Jul 27, which turns this from a link into a real inclusion
  of the image.  So, it will only work as intended if you are using a git
  checkout from after that date.
 
  My apologies, I should have made this more prominent in my earlier
  mails.
 
  --
  Aaron Ecay




Re: [O] how to handle svg files when exporting orgmode to html and pdf?

2013-08-08 Thread Cook, Malcolm
In case of difficulties like this, I produce the tex file (C-c C-e l l)
 and then I process it by hand:
 
  pdflatex --shell-escape foo.tex
 
 Separates concerns nicely.

I will try your approach - thanks - I agree

 
  Sleuthing, I see the output .tex file includes the following lines:
 
  \usepackage{svg}
  ...
  \includegraphics[width=.9\linewidth]{mtcars.png}
  @@backend:\includesvg{mtcars}
 
 
 This looks wrong. You probably want @@latex:\includesvg{mtcars}@@ in
 your org file. In any case, the output in the tex file should be just
 
   \includesvg{mtcars}
 
 Also, not sure how the \includegraphics is produced (are you evaluating a
 source block?) 

Yes

 but it should probably not be there, otherwise you are
 going to get two images in your PDF.

I was going to conditionally suppress it depending on value of ox-backend.

If I can get this whole gamish to work for me at all

~Malcolm

 
 --
 Nick
 




Re: [O] import R data frame into org-mode table

2013-07-30 Thread Cook, Malcolm

  Indeed, thanks, and, my worked out example follows using emacs 2.18.9 and 
  org-mode version 8.0.6
 
 
 2.18.9?

oops, that was the GTK_ Version number.  My emacs is 24.3.1.

 #+LATEX: \listoftables
  #+LaTeX_HEADER: \usepackage{longtable}
  #+name: longtabletest
  #+CAPTION: test of longtable caption
  #+begin_src R :results value :colnames yes
  data.frame(num=1:260,alpha=rep(LETTERS,10))
  #+end_src
 
  #+RESULTS:
  #+attr_latex: :environment longtable
  | num | alpha |
  |-+---|
  |   1 | A |
  |   2 | B |
  ...
 
 Does this really produce a table caption for you when you export to
 latex?
 And does the attr_latex line stay there at the top of the table
 when the code block is evaluated?  

Yes and Yes.  At least, I swear it worked in my hands yesterday, but today the 
answer is No and No.  !!  I can't explain what has changed.

 For me, the answers are no and
 no. 
 I have to rewrite it as follows in order for it to work:
 
  #+begin_src R :results value :colnames yes
  data.frame(num=1:260,alpha=rep(LETTERS,10))
  #+end_src
 
  #+CAPTION: test of longtable caption
  #+attr_latex: :environment longtable
  #+RESULTS:
  | num | alpha |
  |-+---|
  |   1 | A |
  |   2 | B |

In my hands, both the #+CAPTION and the #+att_latex as you place them are 
deleted upon source block evaluation. 

Are you sure your placement works for you?

Summary: In my hands today, there is no placement of them that both survives 
source block re-evaluation and works.  And, they can both be placed immediately 
above or below the #+RESULTS: line and are respected on export.

(However, another funny interaction, the caption of the longtable has multiple 
entries, one for each page, in my #+LATEX: \listoftables )

H

 
 --
 Nick
 
 




Re: [O] import R data frame into org-mode table

2013-07-29 Thread Cook, Malcolm
Hi Andreas,
 
 On 17 July 2013 23:09, Andreas Leha andreas.l...@med.uni-goettingen.de 
 wrote:
 
  Definitely there is:
 
  --8---cut here---start-8---
  #+begin_src R :results table :colnames yes
read.csv('test.csv')
  #+end_src
 
  #+results:
  | X | Variant | Xaxis | N |   mean |   sd |   se |
  |---+-+---+---++--+--|
  | 1 | line1   |10 | 5 | 111.11 | 9.33 | 3.11 |
  | 1 | line1   |20 | 5 | 112.11 | 9.13 | 3.14 |
  | 1 | line1   |30 | 5 | 113.11 | 9.43 |  3.1 |
  | 1 | line2   |10 | 5 | 101.11 | 8.33 | 2.11 |
  | 1 | line2   |20 | 5 | 100.11 | 8.13 | 2.12 |
  | 1 | line2   |30 | 5 | 108.11 | 8.03 |  2.1 |
 
  --8---cut here---end---8---
 
 Great. I've gone ahead and done this. There are two additional requirements:
 1) My table needs a caption. Will #+CAPTION: just above the
 #+BEGIN_SRC just work? 

Yes

 Even better, a label, allowing me to also cross
 reference it.
 2) My table is too long for 1 page. It spans multiple pages
 vertically. According to this StackOverflow answer
 http://stackoverflow.com/a/2896850/1526266 , I should instead use
 longtable, not tabular. Is there a way to coerce your above snippet to
 use longtable, instead of tabular which is the default.
 

Looks like your answer is here: 
http://orgmode.org/manual/Tables-in-LaTeX-export.html

 Thanks!
 
 --
 Rob




Re: [O] import R data frame into org-mode table

2013-07-29 Thread Cook, Malcolm
-Original Message-
 From: John Hendy [mailto:jw.he...@gmail.com]
 Sent: Monday, July 29, 2013 11:03 AM
 To: Cook, Malcolm
 Cc: Rob Stewart; Andreas Leha; emacs-orgmode@gnu.org
 Subject: Re: [O] import R data frame into org-mode table
 
 On Mon, Jul 29, 2013 at 10:35 AM, Cook, Malcolm m...@stowers.org wrote:
 Hi Andreas,
   
   On 17 July 2013 23:09, Andreas Leha andreas.l...@med.uni-goettingen.de 
  wrote:
   
Definitely there is:
   
--8---cut here---start-8---
#+begin_src R :results table :colnames yes
  read.csv('test.csv')
#+end_src
   
#+results:
| X | Variant | Xaxis | N |   mean |   sd |   se |
|---+-+---+---++--+--|
| 1 | line1   |10 | 5 | 111.11 | 9.33 | 3.11 |
| 1 | line1   |20 | 5 | 112.11 | 9.13 | 3.14 |
| 1 | line1   |30 | 5 | 113.11 | 9.43 |  3.1 |
| 1 | line2   |10 | 5 | 101.11 | 8.33 | 2.11 |
| 1 | line2   |20 | 5 | 100.11 | 8.13 | 2.12 |
| 1 | line2   |30 | 5 | 108.11 | 8.03 |  2.1 |
   
--8---cut here---end---8---
   
   Great. I've gone ahead and done this. There are two additional 
  requirements:
   1) My table needs a caption. Will #+CAPTION: just above the
   #+BEGIN_SRC just work?
 
  Yes
 
  Even better, a label, allowing me to also cross
   reference it.
   2) My table is too long for 1 page. It spans multiple pages
   vertically. According to this StackOverflow answer
   http://stackoverflow.com/a/2896850/1526266 , I should instead use
   longtable, not tabular. Is there a way to coerce your above snippet to
   use longtable, instead of tabular which is the default.
   
 
  Looks like your answer is here: 
  http://orgmode.org/manual/Tables-in-LaTeX-export.html
 
 Sort of. Depends on the Org-mode version, and someone will have to
 chime in on the updated status of various parts of the manual. For 8+,
 I believe the syntax is different:
 
 #+attr_latex: :environment longtable
 
 Also, there have been many threads in the past about how to add
 #+attr_latex lines to results output (mostly graphics/files)
 successfully. If you simply take the above and add =#+attr_latex:
 stuff= above the =#+results= line, babel won't recognize it and will
 just create a new results block. If those on this email are already
 well aware of this... my apologies for being redundant, but it causes
 enough confusion that I figured I'd leave another bread crumb trail :)
 Here's an example of a time that came up on the list:
 - http://lists.gnu.org/archive/html/emacs-orgmode/2012-07/msg00237.html
 
 You need to use any attributes (that includes #+begin/end_center, and
 any #+attr_backend lines) *in combination with* a named source block.
 So the full solution should look something like this:
 
 #+name: export-table
 #+begin_src R :results table :colnames yes
 read.csv('test.csv')
 #+end_src
 
 #+RESULTS: export-table
 #+attr_latex: :environment longtable
 | | |
[Cook, Malcolm] 

Indeed, thanks, and, my worked out example follows using emacs 2.18.9 and 
org-mode version 8.0.6

#+LATEX: \listoftables  

 
#+LaTeX_HEADER: \usepackage{longtable}  

 
#+name: longtabletest   

 
#+CAPTION: test of longtable caption

 
#+begin_src R :results value :colnames yes  

 
data.frame(num=1:260,alpha=rep(LETTERS,10)) 

 
#+end_src

Re: [O] Switch for exported file types when evaluating code blocks

2013-07-19 Thread Cook, Malcolm
Great Example, Nick, Thanks, will push on with this approach

~ malcolm_c...@stowers.org


From: emacs-orgmode-bounces+mec=stowers@gnu.org 
[emacs-orgmode-bounces+mec=stowers@gnu.org] on behalf of Nick Dokos 
[ndo...@gmail.com]
Sent: Thursday, July 18, 2013 8:02 PM
To: emacs-orgmode@gnu.org
Subject: Re: [O] Switch for exported file types when evaluating code blocks

Cook, Malcolm m...@stowers.org writes:

 Hi Nick, I'm not sure how to use this ctan package in concert with
 orgmode's export to tex-pdf.


Here's a simplfied example of what I did with it. The source block uses
dot to produce an SVG file for illustration - if you already have one
then you can ignore it:

--8---cut here---start-8---
#+LATEX_HEADER: \usepackage{svg}

* foo

#+name: foo
#+BEGIN_SRC dot :file foo.svg :exports results :results none
digraph foo {
  a - b
}
#+END_SRC

#+BEGIN_LaTeX
\includesvg{foo}
#+END_LaTeX
--8---cut here---end---8---

 Perhaps there is a way to use orgmode's export filtering capability to
 swap in a up-to-date png when exporting to tex

PNG is a raster format whereas SVG is a vector format. I was trying to
produce some slides and I did use PNG at first because it's easier to
fit into the pdflatex workflow. But when I made the slides full screen,
the PNG got fuzzy. Sticking with SVG got rid of the fuzzies for me.


 Hmmm

 Anyone?

 Thx!

  -Original Message-
  From: emacs-orgmode-bounces+mec=stowers@gnu.org 
 [mailto:emacs-orgmode-bounces+mec=stowers@gnu.org] On
  Behalf Of Nick Dokos
  Sent: Wednesday, July 17, 2013 11:02 PM
  To: emacs-orgmode@gnu.org
  Subject: Re: [O] Switch for exported file types when evaluating code blocks
  
  Suvayu Ali fatkasuvayu+li...@gmail.com writes:
  
   Hello again Malcolm,
  
   On Thu, Jul 18, 2013 at 12:45:36AM +, Cook, Malcolm wrote:
  
   I tend to work with org-export-babel-evaluate set to nil.  Thus, my
   code blocks are not evaled in the context of an export.  Thus at
   eval time there is no way of knowing what the eventual backend is
   going to be.
  
   I think I need an approach that auto converts svg to png 
 on-demand/on-the-fly during export.
  
   In that case just use another source block with shell source.  In that
   block you can call inkscape to do the conversion.  For an example, see
   here:
   
 http://ctan.mirrorcatalogs.com/info/svg-inkscape/InkscapePDFLaTeX.pdf#subsubsection.2.3.1
  
  
  OT for the OP (say that three times fast!) but maybe of some use to 
 somebody:
  
  For SVG, there is a latex package that is an evolutionary offshoot of
  the above link. It does the inkscape dance so you don't have to:
  
 http://www.tex.ac.uk/ctan/graphics/svg/
  
  --
  Nick
  




--
Nick





Re: [O] Switch for exported file types when evaluating code blocks

2013-07-19 Thread Cook, Malcolm
Suvayu,

This is splendid news!  I will try it immediately upon return from gone 
fishin in a week...

 (erhm, that is, right after I figure out haw to migrate my orgmode SETUPFILE 
to comport with new export backend I just upgraded to my fancy TOC and 
org-export-html-table-tag javascript have gone missin)

Future is looking bright!,

~ malcolm_c...@stowers.org


From: emacs-orgmode-bounces+mec=stowers@gnu.org 
[emacs-orgmode-bounces+mec=stowers@gnu.org] on behalf of Suvayu Ali 
[fatkasuvayu+li...@gmail.com]
Sent: Friday, July 19, 2013 5:23 AM
To: emacs-orgmode@gnu.org
Subject: Re: [O] Switch for exported file types when evaluating code blocks

On Thu, Jul 18, 2013 at 09:02:41PM -0400, Nick Dokos wrote:

 #+BEGIN_LaTeX
 \includesvg{foo}
 #+END_LaTeX

I believe even this can be integrated with Org using a filter.  How
about something like this:

(defun my-svg-graphics (contents backend info)
  (when (eq backend 'latex)
(replace-regexp-in-string \\`includegraphics.+\\({.+\.svg}\\)
   includesvg\1 contents)))

(add-to-list 'org-export-filter-link-functions 'my-svg-graphics)

Of course the above ignores the options since I do not know if
\includesvg takes the same options.  But that is a detail that can be
fixed by changing the regexp.

What do you think?


--
Suvayu

Open source is the future. It sets us free.




Re: [O] Switch for exported file types when evaluating code blocks

2013-07-18 Thread Cook, Malcolm
Hi Nick,  I'm not sure how to use this ctan package in concert with orgmode's 
export to tex-pdf.  

Perhaps there is a way to use orgmode's export filtering capability to swap in 
a up-to-date png when exporting to tex

Hmmm

Anyone?

Thx!

 -Original Message-
 From: emacs-orgmode-bounces+mec=stowers@gnu.org 
 [mailto:emacs-orgmode-bounces+mec=stowers@gnu.org] On
 Behalf Of Nick Dokos
 Sent: Wednesday, July 17, 2013 11:02 PM
 To: emacs-orgmode@gnu.org
 Subject: Re: [O] Switch for exported file types when evaluating code blocks
 
 Suvayu Ali fatkasuvayu+li...@gmail.com writes:
 
  Hello again Malcolm,
 
  On Thu, Jul 18, 2013 at 12:45:36AM +, Cook, Malcolm wrote:
 
  I tend to work with org-export-babel-evaluate set to nil.  Thus, my
  code blocks are not evaled in the context of an export.  Thus at
  eval time there is no way of knowing what the eventual backend is
  going to be.
 
  I think I need an approach that auto converts svg to png 
  on-demand/on-the-fly during export.
 
  In that case just use another source block with shell source.  In that
  block you can call inkscape to do the conversion.  For an example, see
  here:
  http://ctan.mirrorcatalogs.com/info/svg-inkscape/InkscapePDFLaTeX.pdf#subsubsection.2.3.1
 
 
 OT for the OP (say that three times fast!) but maybe of some use to somebody:
 
 For SVG, there is a latex package that is an evolutionary offshoot of
 the above link. It does the inkscape dance so you don't have to:
 
http://www.tex.ac.uk/ctan/graphics/svg/
 
 --
 Nick
 




Re: [O] Switch for exported file types when evaluating code blocks

2013-07-17 Thread Cook, Malcolm
I want graphics files which are exported by evaluated code blocks to be
 generated in a format best suited to their intended use.  For HTML I
 want either PNG or SVG.  For LaTeX/PDF I almost always want PDF.  For
 inline viewing in emacs I want either PNG or SVG.
 
 To that end I went a'googling and found this idea:
 
   
  http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-LaTeX.html#sec-4-3
 
 It doesn't work with my copies[1] of emacs and org-mode but I was able
 to adapt it.  I suck at elisp so this is probably more an accomplishment
 to me than it appears to most of you!
 
 In any case, here is a short org document based on the one I found above
 in worg which shows what I ended up with:
 
 
 * COMMENT setup
 #+begin_src emacs-lisp :results silent
   (defmacro by-backend (rest body)
 `(case (if (boundp 'backend) backend nil) ,@body))
 #+end_src
 
 * A graph
 #+header: :file (by-backend (html graph.png) (latex graph.pdf) (t 
 graph.svg))
 #+header: :export results
 #+begin_src dot
 digraph Name {
 tail - head;
 }
 #+end_src
[Cook, Malcolm] 

Brett,

Thanks for posting your findings.  They almost help me.

I am looking for a solution to a similar problem.

I tend to work with org-export-babel-evaluate set to nil.  Thus, my code blocks 
are not evaled in the context of an export.  Thus at eval time there is no way 
of knowing what the eventual backend is going to be.

I think I need an approach that auto converts svg to png on-demand/on-the-fly 
during export.

Has anyone come across a variation on this that works as I am suggesting?

Thanks!




Re: [O] BUG? table output despite #+begin_src sh :results verbatim

2013-01-28 Thread Cook, Malcolm
Eric,

Mucho Kudos indeed I had an old patch to org-babel-execute:sh tucked 
away masking your released version.

'nuff said, except

Thanks, again, very much,

Mea culpa,

~Malcolm


 .-Original Message-
 .From: Eric Schulte [mailto:schulte.e...@gmail.com]
 .Sent: Saturday, January 26, 2013 1:37 PM
 .To: Cook, Malcolm
 .Cc: 'Thomas S. Dye'; Blanchette, Marco; 'emacs-orgmode@gnu.org'
 .Subject: Re: [O] BUG? table output despite #+begin_src sh :results verbatim
 .
 .Cook, Malcolm m...@stowers.org writes:
 .
 . THanks Thomas, I see we are running same version of org
 .
 . Has anyone else reading this got an idea what would cause org to
 . table-ize shell output despite a `:results verbatim` in the source
 . block header?
 .
 . Thanks!
 .
 .
 .Hi Malcolm,
 .
 .Try starting emacs without any of your personalized configuration loaded
 .using the -Q option.  If the problem disappears, then it is due to
 .something in your personal config.
 .
 .If you still experience the problem you may want to ensure that you
 .aren't using `org-babel-execute-src-block' from an old version of
 .Org-mode by executing the following from your scratch buffer
 .
 .;; emacs-lisp
 .(when (require 'find-func)
 .  (find-function 'org-babel-execute-src-block))
 .
 .and then ensuring that the file is in the current Org-mode installation
 .directory.
 .
 .Cheers,
 .
 .
 . ~Malcolm
 .
 .
 .  .-Original Message-
 .  .From: Thomas S. Dye [mailto:t...@tsdye.com]
 .  .Sent: Friday, January 25, 2013 2:31 PM
 .  .To: Cook, Malcolm
 .  .Cc: 'emacs-orgmode@gnu.org'
 .  .Subject: Re: BUG? table output despite #+begin_src sh :results verbatim
 .  .
 .  .Cook, Malcolm m...@stowers.org writes:
 .  .
 .  . Thomas,
 .  .
 .  . Thanks for checking.
 .  .
 .  . What does
 .  .
 .  . meta-x org-version
 .  .
 .  . tell you
 .  .
 .  . ??
 .  .
 .  .Org-mode version 7.9.3d (release_7.9.3d-830-g780b45 @ 
/Users/dk/.emacs.d/src/org-mode/lisp/)
 .  .
 .  .--
 .  .T.S. Dye  Colleagues, Archaeologists
 .  .735 Bishop St, Suite 315, Honolulu, HI 96813
 .  .Tel: 808-529-0866, Fax: 808-529-0884
 .  .http://www.tsdye.com
 .
 .
 .--
 .Eric Schulte
 .http://cs.unm.edu/~eschulte



[O] BUG? table output despite #+begin_src sh :results verbatim

2013-01-25 Thread Cook, Malcolm
Hi,

In org 7.9.3d, under Gnu emacs 24.2.1 / linux:

I find that org-mode is tablizing shell output despite require 'verbatim' 
results.

#+begin_src sh :results  verbatim
  echo 1
  echo 2
  echo 3
#+end_src

#+results:
| 1 |
| 2 |
| 3 |


The same happens if I used 'scalar' in place of verbatim.

I see that :results processing is somewhat happening, as evidenced by using 
:results org , as below.

#+begin_src sh :results   org
  echo 1
  echo 2
  echo 3
#+end_src

#+results:
#+BEGIN_SRC org
| 1 |
| 2 |
| 3 |
#+END_SRC

Any tips/workarounds/upgrades needed?

Malcolm Cook
Computational Biology - Stowers Institute for Medical Research





Re: [O] BUG? table output despite #+begin_src sh :results verbatim

2013-01-25 Thread Cook, Malcolm
Thomas,

Thanks for checking.

What does 

meta-x org-version

tell you

??

~Malcolm


 .-Original Message-
 .From: Thomas S. Dye [mailto:t...@tsdye.com]
 .Sent: Friday, January 25, 2013 1:44 PM
 .To: Cook, Malcolm
 .Cc: 'emacs-orgmode@gnu.org'
 .Subject: Re: BUG? table output despite #+begin_src sh :results verbatim
 .
 .Aloha Malcolm,
 .
 .Cook, Malcolm m...@stowers.org writes:
 .
 . Hi,
 .
 . In org 7.9.3d, under Gnu emacs 24.2.1 / linux:
 .
 . I find that org-mode is tablizing shell output despite require
 . verbatim' results.
 .
 . #+begin_src sh :results  verbatim
 .   echo 1
 .   echo 2
 .   echo 3
 . #+end_src
 .
 . #+results:
 . | 1 |
 . | 2 |
 . | 3 |
 .
 .Hmm, I get this:
 .
 .#+begin_src sh :results  verbatim
 .  echo 1
 .  echo 2
 .  echo 3
 .#+end_src
 .
 .#+results:
 .: 1
 .: 2
 .: 3
 .
 .#+begin_src sh :results  scalar
 .  echo 1
 .  echo 2
 .  echo 3
 .#+end_src
 .
 .#+results:
 .: 1
 .: 2
 .: 3
 .
 .#+begin_src sh :results  table
 .  echo 1
 .  echo 2
 .  echo 3
 .#+end_src
 .
 .#+results:
 .| 1 |
 .| 2 |
 .| 3 |
 .
 .#+begin_src sh :results  list
 .  echo 1
 .  echo 2
 .  echo 3
 .#+end_src
 .
 .#+results:
 .- (1)
 .- (2)
 .- (3)
 .
 .#+begin_src sh :results org
 .  echo 1
 .  echo 2
 .  echo 3
 .#+end_src
 .
 .#+results:
 .#+BEGIN_SRC org
 .| 1 |
 .| 2 |
 .| 3 |
 .#+END_SRC
 .
 .Not sure why our results differ, though.
 .
 .Tom
 .
 .--
 .Thomas S. Dye
 .http://www.tsdye.com



Re: [O] BUG? table output despite #+begin_src sh :results verbatim

2013-01-25 Thread Cook, Malcolm
THanks Thomas, I see we are running same version of org

Has anyone else reading this got an idea what would cause org to table-ize 
shell output despite a `:results verbatim` in the source block header?

Thanks!

~Malcolm


 .-Original Message-
 .From: Thomas S. Dye [mailto:t...@tsdye.com]
 .Sent: Friday, January 25, 2013 2:31 PM
 .To: Cook, Malcolm
 .Cc: 'emacs-orgmode@gnu.org'
 .Subject: Re: BUG? table output despite #+begin_src sh :results verbatim
 .
 .Cook, Malcolm m...@stowers.org writes:
 .
 . Thomas,
 .
 . Thanks for checking.
 .
 . What does
 .
 . meta-x org-version
 .
 . tell you
 .
 . ??
 .
 .Org-mode version 7.9.3d (release_7.9.3d-830-g780b45 @ 
/Users/dk/.emacs.d/src/org-mode/lisp/)
 .
 .--
 .T.S. Dye  Colleagues, Archaeologists
 .735 Bishop St, Suite 315, Honolulu, HI 96813
 .Tel: 808-529-0866, Fax: 808-529-0884
 .http://www.tsdye.com



[O] HOWTO?: export without (re)eval-ing src blocks (was? disable automatic source block evaluation but allow manual)

2011-09-16 Thread Cook, Malcolm
I would like to be able to export a buffer as HTML, LaTex, what-have-you 
without having to re-evaluate any source blocks, and without having to modify 
the :eval tag in any source header blocks.

Is there any way to accomplish this via hooks, flags, appropriate function 
calls?

I think my concerns run similarly to those discussed in 
http://lists.gnu.org/archive/html/emacs-orgmode/2010-12/msg00827.html and so 
have cc:ed its discussants except my hope is to find a way of de-coupling 
export form evaluation.

Cheers   Thanks!

Malcolm Cook



Re: [O] HOWTO?: export without (re)eval-ing src blocks (was? disable automatic source block evaluation but allow manual)

2011-09-16 Thread Cook, Malcolm
Nick,

Exactly what I needed, thanks, somehow missed that

And this advice is what I needed to do next: 
http://lists.gnu.org/archive/html/emacs-orgmode/2011-06/msg00034.html


~Malcolm


-Original Message-
From: nicholas.do...@hp.com [mailto:nicholas.do...@hp.com] 
Sent: Friday, September 16, 2011 12:01 PM
To: Cook, Malcolm
Cc: 'emacs-orgmode@gnu.org'; 'andreas.l...@med.uni-goettingen.de'; 
nicholas.do...@hp.com
Subject: Re: [O] HOWTO?: export without (re)eval-ing src blocks (was? disable 
automatic source block evaluation but allow manual)

[forgot to cc: the list]

Cook, Malcolm m...@stowers.org wrote:

 I would like to be able to export a buffer as HTML, LaTex,
 what-have-you without having to re-evaluate any source blocks, and
 without having to modify the :eval tag in any source header blocks.
 
 Is there any way to accomplish this via hooks, flags, appropriate
 function calls?
 ... 

Maybe this:

,
| org-export-babel-evaluate is a variable defined in `ob-exp.el'.
| Its value is t
| 
|   This variable is safe as a file local variable if its value
|   satisfies the predicate `(lambda (x) (eq x nil))'.
| 
| Documentation:
| Switch controlling code evaluation during export.
| When set to nil no code will be evaluated as part of the export
| process.
`

Nick



  1   2   >