[O] clickable text in org-mode not working

2012-11-12 Thread John Kitchin
It appears that one cannot define "clickable" text in org-mode. I was
trying to make some text in an org-file respond to different types of
clicking. I know that links provide some functionality for this, but
out of curiosity I wanted to see what else I could do.

If I run the following code on a buffer in text-mode, the first four
characters in the buffer turn blue with a white background, they turn
a light green when the mouse is over them, and finally a message box
pops up when I click on the characters.

(let ((map (make-sparse-keymap)))
 (define-key map (kbd "")
'(lambda() (interactive) (message-box "it works!")))
 (add-text-properties 1 5 `(keymap, map
font-lock-face (:foreground "blue"
:background "white")
mouse-face highlight)))

If I switch to org-mode, the clickability and mouse highlighting go
away. They also do not appear when I run the function in an
org-buffer.

Does anyone know if there is a feature in org-mode that turns this
off, or if there is a way to get the clickability to work? Is it
related to having links that are clickable?

Thanks,

John

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



Re: [O] clickable text in org-mode not working (Sebastien Vauban)

2012-11-13 Thread John Kitchin
I was just learning about programming interactive features into emacs
buffers, and something that worked in one major mode did not work in
org-mode. I have narrowed it down to an effect of font-lock-mode. When
that is off, the mouse-clicking works fine, when it is on, the font
syntax highlighting works fine, but not the clicking in org-mode.

In terms of usage, I could see this as a way to automatically make
"links" out of different words, or in a related application to overlay
tooltips on specific words without having to markup the org-file. In
essence, moving some markup to a lisp file that is run before opening
the org-file.

I am familiar with `org-add-link-type' and have used that to do some
pretty cool things, as well as the elisp and shell links. With the
clickable text code I described, you can actually do different things
with different mouse clicks, including different mouse buttons, and
presumably on mouse button up events. It is not obvious that can be
done with `org-add-link-type'; you get the same behavior with any
mouse button click. I havent advanced to a point where I could get
emacs-lisp to tell me which mouse event occurred on clicking on a
link. That seems possible though.

j

> Message: 34
> Date: Tue, 13 Nov 2012 09:50:19 +0100
> From: "Sebastien Vauban" 
> To: emacs-orgmode@gnu.org
> Subject: Re: [O] clickable text in org-mode not working
> Message-ID: <80haot999w@somewhere.org>
> Content-Type: text/plain
>
> Hello John,
>
> John Kitchin wrote:
>> It appears that one cannot define "clickable" text in org-mode. I was
>> trying to make some text in an org-file respond to different types of
>> clicking. I know that links provide some functionality for this, but
>> out of curiosity I wanted to see what else I could do.
>>
>> If I run the following code on a buffer in text-mode, the first four
>> characters in the buffer turn blue with a white background, they turn
>> a light green when the mouse is over them, and finally a message box
>> pops up when I click on the characters.
>>
>> (let ((map (make-sparse-keymap)))
>>  (define-key map (kbd "")
>> '(lambda() (interactive) (message-box "it works!")))
>>  (add-text-properties 1 5 `(keymap, map
>> font-lock-face (:foreground "blue"
>> :background "white")
>> mouse-face highlight)))
>>
>> If I switch to org-mode, the clickability and mouse highlighting go
>> away. They also do not appear when I run the function in an
>> org-buffer.
>>
>> Does anyone know if there is a feature in org-mode that turns this
>> off, or if there is a way to get the clickability to work? Is it
>> related to having links that are clickable?
>
> I'm not sure to understand your use case -- why do you want clickable text in
> the first place (other than links)?
>
> But, did you look at `org-add-link-type' which does allow some kind of
> powerful stuff (mainly for export, but can maybe be diverted from its original
> purpose)?
>
> I guess you also are aware of the elisp and shell links you can already put in
> any Org file, as clickable "buttons"?
>
> Best regards,
>   Seb
>
> --
> Sebastien Vauban
>
>
>
>



Re: [O] using a table from one org-file as a variable in a code block in another org-file

2012-11-26 Thread John Kitchin
That is pretty awesome! Thanks!

John

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



On Mon, Nov 26, 2012 at 12:32 PM, Eric Schulte  wrote:
> John Kitchin  writes:
>
>> Hi everyone,
>>
>> I have been using tables as variables for codeblocks on an org-file, e.g.
>> #+tblname: class-data
>> | user  | oxide | xc |
>> | jkitchin  | TiO2  | LDA|
>> ...
>>
>> #+BEGIN_SRC python :var data=class-data
>> from pylab import *
>> import numpy as np
>>
>> vol = [x[1]  if x[1] != '' else np.nan for x in data]
>> B = [x[2] if x[2] != '' else np.nan for x in data  ]
>>
>> scatter(vol, B)
>> xlabel('Volume ($\AA^3$)')
>> ylabel('Bulk modulus (GPa)')
>> title('All polymorphs of all oxides for all functionals')
>> show()
>> #+END_SRC
>>
>> This is a fantastic feature, since I can have some code that is
>> expensive to run create the table, but then have analysis code that is
>> quick, since it only reads the table.
>>
>> But, sometimes the tables are defined in other org-files.  Is there a
>> way to specify a table from another org-file in the variable header?
>>
>> Something like this would be pretty handy:
>>
>> :var ./org-file.org::class-data
>>
>> Especially if I could click on it, and have it open the other org-file
>> with point at the table!
>>
>> Any thoughts? Thanks,
>>
>
> Hi John,
>
> This feature does exist, and your guess at the syntax is almost correct.
> To reference a variable named foo1 in a file named foo.org you would use
> the following syntax, ":var data=foo.org:foo1".
>
> See the attached foo.org and bar.org files for an example (in order to
> work they must be in the same directory).
>
> I'll make a note to mention this functionality in the documentation.
>
> Best,
>
>
>
>>
>> John
>>
>> ---
>> John Kitchin
>> Associate Professor
>> Doherty Hall A207F
>> Department of Chemical Engineering
>> Carnegie Mellon University
>> Pittsburgh, PA 15213
>> 412-268-7803
>> http://kitchingroup.cheme.cmu.edu
>>
>
> --
> Eric Schulte
> http://cs.unm.edu/~eschulte
>



[O] inline TODO?

2012-12-14 Thread John Kitchin
Is there a way to have a TODO item in an org-file that is not in a
headline and that shows up in the agenda?

I have been using org-mode to write papers, and often in the middle of
a section I want to make a TODO item, right where something needs to
be done, and I do not want to make a new heading there as it changes
the overall organization (even though it is temporary and will be
removed).  Something like this would be great:

#+TODO: finish this section DEADLINE: <2012-12-14 Fri>


At the moment I can search for these lines, but it would be nice if
they showed up in the agenda. Is there any way to do this that I am
overlooking?

Thanks,

j


Here is a simple usage for example.


* introduction

Lots of text. blah blah
#+TODO: finish this section DEADLINE: <2012-12-14 Fri>

end of introductory text that is still in the introduction section.

* Methods
yadayadaya.

** TODO I do not like this because subsequent text is in a subsection

we used this method to do that.

* Conclusions
The end.

John

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



Re: [O] inline TODO?

2012-12-14 Thread John Kitchin
That is exactly what I wanted! Thanks.

John

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



On Fri, Dec 14, 2012 at 10:27 AM, Rainer M Krug  wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> On 14/12/12 15:53, John Kitchin wrote:
>> Is there a way to have a TODO item in an org-file that is not in a headline 
>> and that shows up
>> in the agenda?
> Hi
>
> Look for inline tasks:
> http://stackoverflow.com/questions/11718401/how-to-use-todo-tags-in-org-mode-without-defining-
> headlines
>
> Does this help?
>
> Never used them, but always wanted to...
>
> Cheers,
>
> Rainer
>
>>
>> I have been using org-mode to write papers, and often in the middle of a 
>> section I want to make
>> a TODO item, right where something needs to be done, and I do not want to 
>> make a new heading
>> there as it changes the overall organization (even though it is temporary 
>> and will be removed).
>> Something like this would be great:
>>
>> #+TODO: finish this section DEADLINE: <2012-12-14 Fri>
>>
>>
>> At the moment I can search for these lines, but it would be nice if they 
>> showed up in the
>> agenda. Is there any way to do this that I am overlooking?
>>
>> Thanks,
>>
>> j
>>
>>
>> Here is a simple usage for example.
>>
>>
>> * introduction
>>
>> Lots of text. blah blah #+TODO: finish this section DEADLINE: <2012-12-14 
>> Fri>
>>
>> end of introductory text that is still in the introduction section.
>>
>> * Methods yadayadaya.
>>
>> ** TODO I do not like this because subsequent text is in a subsection
>>
>> we used this method to do that.
>>
>> * Conclusions The end.
>>
>> John
>>
>> --- John Kitchin Associate Professor Doherty 
>> Hall A207F
>> Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 
>> 15213
>> 412-268-7803 http://kitchingroup.cheme.cmu.edu
>>
>>
>
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.11 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://www.enigmail.net/
>
> iEYEARECAAYFAlDLRW0ACgkQoYgNqgF2egq3zgCfUH2ZKnpcoJ9BQOv4TpzGNMNQ
> QhwAn2wALy9ARN7Iwb4Mw1/zcqkEsMLZ
> =8JN0
> -END PGP SIGNATURE-



[O] org-ref in action

2014-06-24 Thread John Kitchin
Hello everyone,

org-ref has basically stabilized. You can get the latest code at
https://github.com/jkitchin/jmax/blob/master/org-ref.org.

I made a little screen capture video here to show you what it does:
https://www.youtube.com/watch?v=JyvpSVl4_dg

Try it out, if it looks interesting, and let me know if you find any
bugs!

Thanks,

-- 
---
John Kitchin




Re: [O] org-ref in action

2014-06-26 Thread John Kitchin
Some features could be merged, but there is an important difference in that
org-ref uses bibtex as the backend database, and reftex for searching, and
org-bibtex uses org-mode headings as the backend database, and tag/property
searches (I think).  It is like the difference between org-contacts and
bbdb. They both serve similar needs, but with different data sources, and
different ways to think about it.

We might be able to figure out a way to specify a "backend" that would
allow the independent features to work in both though.

John

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



On Thu, Jun 26, 2014 at 8:21 AM, Fabrice Popineau <
fabrice.popin...@supelec.fr> wrote:

>
> +1 for org-bibtex (and ox-bibtex) that I'm using for a couple of years.
>
> But org-ref seems to go further (video is convincing).
> It would be really nice to merge org-ref and org-bibtex before they split
> too far apart.
> Wishful thinking from me because I don't see that I'm in position to do it.
>
> Fabrice
>
>
> 2014-06-26 3:10 GMT+02:00 Matt Lundin :
>
> Eric Schulte  writes:
>>
>> >
>> > This is a lot of useful functionality, and very nicely presented.
>> >
>> > Did you happen to try the built in bibtex support in Org-mode core and
>> > contrib?  And if so, is there a reason that you implemented this all
>> > independently?
>> >
>> > I think part of the problem with existing Org-mode bibtex support is
>> > that no-one knows it exists.
>>
>> Well, you can count on one big fan of org-bibtex.el here! (Though I must
>> admit that I have not used ox-bibtex.el.)
>>
>> > To help address this I threw up a very quick-and-dirty screen cast
>> > demonstrating some of Org's existing bibtex functionality.
>> >
>> > https://vimeo.com/99167082
>>
>> Thanks! Over the years, I've particularly appreciated the way
>> org-bibtex.el makes it easy to keep bib data together with notes/todos.
>> Both org-bibtex-read and org-bibtex-yank have become indispensable to my
>> own workflow.
>>
>> Best,
>> Matt
>>
>>
>
>
> --
> Fabrice Popineau
> -
> SUPELEC
> Département Informatique
> 3, rue Joliot Curie
> 91192 Gif/Yvette Cedex
> Tel direct : +33 (0) 169851950
> Standard : +33 (0) 169851212
> --
>
>


Re: [O] org-ref in action

2014-06-27 Thread John Kitchin
You may find some information here:
https://github.com/jkitchin/jmax/tree/master/examples that is helpful to
you. i have collected some examples for various journals we have published
in with orgmode there. The jmax repo is what my group currently uses for
this purpose. It may not be what you want to do, but there are a lot of
good ideas in it (imho of course ;)

John

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



On Fri, Jun 27, 2014 at 12:27 AM, Xebar Saram  wrote:

> Hi all
>
> off topic a bit again. im an academic (asst. prof) in Epidemiology and
> have been using org-mode for about a year now. i love using org but im
> really not very technical at all. it has always been a dream for me to
> ditch word and move over to Latex and even better orgmode to write my
> scientific publications, writing my CV etc.
> The problem is i cant really find a good "for dummies" guide on how to
> really get started. again im really not technical so i always give up
> really fast on this.
>
> Do you guys think i should give it a shot (again not very technical :))
> and if so what would be the steps/guides to follow? perhaps start by
> drafting a CV since thats perhaps easier?
>
> kind regards
>
> Z.
>
>
>
>
>
>
> On Thu, Jun 26, 2014 at 9:44 PM, Matt Lundin  wrote:
>
>> Alan Schmitt  writes:
>>
>> > On 2014-06-26 16:39, Matt Lundin  writes:
>> >
>> >> By contrast, ox-bibtex.el runs citations through bibtex2html, which is
>> >> pretty much limited to the "old-fashioned" bibtex formats.
>> >
>> > What would be required for bibtex2html to take biblatex input? I thought
>> > the backend format was similar or the same (as you can tell, I know
>> > nothing of biblatex).
>>
>> I don't think this is possible without some major
>> hacking/conversion/filtering. Biblatex has many more entry types and
>> fields than bibtex. I've found that most of the older bibtex utils
>> (bibtools, bibtex2html) choke on my biblatex files.
>>
>> Even if biblatex2html did read biblatex data, its output, I believe, is
>> limited to bibtex styles, which cannot handle more complex formats. Many
>> scientific journals require bibtex formats. But many humanities
>> disciplines have more complicated bibliographical requirements that
>> bibtex cannot handle.
>>
>> Best,
>> Matt
>>
>>
>


Re: [O] org-ref in action

2014-06-29 Thread John Kitchin
with org-ref

[[cite:tony-2010][page n]]

exports as

\cite[page n]{tony-2010}

and


[[cite:tony-2010][text before link::text after link]]

exports as

\cite[text before link][text after link]{tony-2010}


John

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



On Sun, Jun 29, 2014 at 6:18 AM, Joseph Vidal-Rosset <
joseph.vidal.ros...@gmail.com> wrote:

> Hi John, hello the list,
>
> My question is very simple and it is not unrevelevant vis-à-vis this
> thread, therefore I keep  the same thread.
>
> What  need is to get either  the usual citation format  (often in plain
> style) \cite{one-reference-paper-year} or this one with a mentioned page:
> \cite[page n]{one-reference-paper-year}.
>
> My problem with cite: org-mode format is that I am not able to get the
> second format. Ideally , I want to click on the reference and just to add
> the quoted page.
>
> I do not doubt that this is easy to get in org-mode, but I'm wasting my
> time to find how... if it is possible to get it with org-ref  or via
> another tool, many thanks in advance.
>
> Best regards
>
> Jo.
> ​
>


Re: [O] An Org centric research lab: Goodbye MS word, excel, and powerpoint

2014-07-09 Thread John Kitchin
That is great! Congratulations, and thanks for sharing. I have also
converted my group into an org-centric group.  Did you find many
challenges in implementing this in your group?

"Doyley, Marvin M."  writes:

> Dear All,
>
> Here is a link to a manuscript my research group produced completely with org
> http://medicalimaging.spiedigitallibrary.org/issue.aspx. 
>
> For the last 6 years, I have used org mainly for teaching (beamer),
> productivity, outlining ideas, and note taking. Inspired by John
> Kitchin's 2013 Scipy talk, I tried to encourage members of my research
> group to use Org. Since the gentle approach didn't work, I made it 
> mandatory requirement that all junior members must generate
> manuscripts in org, and now I am seeing the fruits of this decision--- we are 
> now a org-centric  research group :)
>
> I would like to thank  Carsten and all the other contributors for creating 
> such
> an awesome research tool. 
>
> Cheers,
> M
>

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



Re: [O] emails written in Org Mode

2014-07-09 Thread John Kitchin

Can't you just change your buffer mode to org-mode, compose, change back
to message-mode and send? Did you want to do more than that?

I played around with using a heading with properties to send an
email. Basically the heading is the subject, you set some properties
about TO, CC, etc... and the heading content is the body. You just put
your cursor in the heading and run M-x email-heading. You can see the
code here https://github.com/jkitchin/jmax/blob/master/email.el#L31

and

https://github.com/jkitchin/jmax/blob/master/email.el#L35

It saves some details in properties, like when it was sent, etc... It is
occasionally useful to me.


Ken Mankoff  writes:

> Hi Thorsten,  On a recent thread you wrote: 
>
>> ... *outorg-edit-buffer* (where I write my message-mode email in
>> full
>> org-mode).
>
> I already write emails in emacs. I'm interested in being able to compose
> emails using Org Mode. I see you use gnus. I use mu4e[1]. I wonder if
> your setup is gnus-specific or might work with other emacs mail
> clients. Will you provide some information about this?
>
> Thanks,
>
>  -k.
>
> [1] http://www.djcbsoftware.nl/code/mu/mu4e.html
>
>

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



Re: [O] An Org centric research lab: Goodbye MS word, excel, and powerpoint

2014-07-10 Thread John Kitchin
Matlab is "free" for us too, but it does not work in org-babel on
windows. it works ok on linux, but not as well as python. Plus, we use
python for all our research, and most importantly, I like it better ;)

"Doyley, Marvin M."  writes:

> Thanks John,
>
> The biggest challenge has been getting my team to use emacs, and
> appreciate its power. A few of the students are now comfortable with
> it, but most are still novices, even the computationally savvy members
> of my team. For now I am forcing everybody to use org as a latex
> replacement no babel or beamer yet. However, In the fall I will
> mandate that all data analysis (matlab babel) should be included with
> all manuscripts. I notice that you prefer to use python rather than
> matlab. Is there a reason for this ? Matlab is free at my institution
> so cost is not an issue.
>
> I welcome any advise or tips you may have 
>
> Best Wishes,
>
> M
>
>
> On Jul 9, 2014, at 3:08 PM, John Kitchin  wrote:
>
>> That is great! Congratulations, and thanks for sharing. I have also
>> converted my group into an org-centric group.  Did you find many
>> challenges in implementing this in your group?
>> 
>> "Doyley, Marvin M."  writes:
>> 
>>> Dear All,
>>> 
>>> Here is a link to a manuscript my research group produced completely with 
>>> org
>>> https://urldefense.proofpoint.com/v1/url?u=http://medicalimaging.spiedigitallibrary.org/issue.aspx&k=p4Ly7qpEBiYPBVenR9G2iQ%3D%3D%0A&r=Fwb4ac3v7AhcQoTcqa9wemihF49yp0vUvrJ%2BiX5Re4w%3D%0A&m=rV9Ve%2BKzfjY9BDOqxI1YYuowCcKG%2BP5hNOX3zMZtRDA%3D%0A&s=f6e37fd82613c5c7a791b1df10042b390be86728522e227f9316ec27d12c08c1.
>>> 
>>> For the last 6 years, I have used org mainly for teaching (beamer),
>>> productivity, outlining ideas, and note taking. Inspired by John
>>> Kitchin's 2013 Scipy talk, I tried to encourage members of my research
>>> group to use Org. Since the gentle approach didn't work, I made it 
>>> mandatory requirement that all junior members must generate
>>> manuscripts in org, and now I am seeing the fruits of this decision--- we 
>>> are now a org-centric  research group :)
>>> 
>>> I would like to thank  Carsten and all the other contributors for creating 
>>> such
>>> an awesome research tool. 
>>> 
>>> Cheers,
>>> M
>>> 
>> 
>> -- 
>> ---
>> John Kitchin
>> Professor
>> Doherty Hall A207F
>> Department of Chemical Engineering
>> Carnegie Mellon University
>> Pittsburgh, PA 15213
>> 412-268-7803
>> https://urldefense.proofpoint.com/v1/url?u=http://kitchingroup.cheme.cmu.edu/&k=p4Ly7qpEBiYPBVenR9G2iQ%3D%3D%0A&r=Fwb4ac3v7AhcQoTcqa9wemihF49yp0vUvrJ%2BiX5Re4w%3D%0A&m=rV9Ve%2BKzfjY9BDOqxI1YYuowCcKG%2BP5hNOX3zMZtRDA%3D%0A&s=c42f68beb01d6c32f1ce25775cb9df73f29f6198e9a3dc71beb1514a293e1533
>
>
>

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



Re: [O] How to call org-display-inline-images so that after a graphviz block is evaluated the image is refreshed?

2014-07-14 Thread John Kitchin
That is a nice tip!
-- 
---
John Kitchin
Professor
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
http://kitchingroup.cheme.cmu.edu



[O] proposal to make C-c C-c not remove latex overlays

2014-07-14 Thread John Kitchin
I am using org-mode files with equations and code blocks in lectures,
and it is problematic that C-c C-c removes the equation overlays when
running a code block. First, you have to press C-c C-c twice to run the
block, since the first one gets rid of the equations, but then you have
run C-c C-x C-l to get the equations back! and the cycle repeats
throughout a lecture.

I would prefer that the equations stay untouched, and that the code
blocks run without modifying them. 

I think the best behavior would be for C-c C-x C-l to toggle the
equations, and to remove the C-c C-c behavior for latex overlays
completely. But it would be ok if this was done by a C-c C-c hook
function, so that a user could remove the latex overlay without touching
the org-code.

Maybe a new function like this:

#+BEGIN_SRC emacs-lisp
(defun org-toggle-latex-overlays (arg)
  "Toggle LaTeX fragments."
  (interactive "P")
  (if org-latex-fragment-image-overlays
  (org-remove-latex-fragment-image-overlays)
(org-preview-latex-fragment arg)))
#+END_SRC

 could be added. Any thoughts?



-- 
-------
John Kitchin
Professor




Re: [O] key collision for auto completion

2014-07-14 Thread John Kitchin
I turned off flymode minor mode, and it looks like M-tab (on windows
Esc-tab) is bound to (pcomplete &optional INTERACTIVELY)

That seems to do some expansion of the special symbols.


Shiyuan  writes:

> Hi all, 
> According to the manual :
> http://orgmode.org/manual/Special-symbols.html , M-tab would perform
> auto complete in org mode for special symbols. However, it looks like
> that the key is shadowed by flyspell-auto-correct-word on my emacs and
> I need to rebind the key. I digged into the org.el file but failed to
> locate the code for key binding. Any pointer or hints are appreciated.
> In particular, what command is M-tab supposed to be bound to for auto
> completion for the special symbols? Thanks. 
>
> Shiyuan 
>

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



Re: [O] emails written in Org Mode

2014-07-14 Thread John Kitchin
I usually do this kind of tracking with a link to the email instead. It
is not automated communication between email and org, and it is not that
complicated, but it does what I need, when I need it.

Esben Stien  writes:

> Esben Stien  writes:
>
>> Do you have any means to bring replies and such back into the org file?
>
> This seems like it could be a really good thing. 
>
> To be able to move the discussion to the relevant org file and then
> structure it and prioritize/schedule from there. 
>
> It seems a lot better than to have all these different discussions
> inside gnus, so I'd really like to try this. 

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



Re: [O] proposal to make C-c C-c not remove latex overlays

2014-07-15 Thread John Kitchin
I actually love C-c C-c to run code blocks! Maybe I should just bind it
to f5 or something, I am just so used to C-cC-c now!

Grant Rettke  writes:

> On Mon, Jul 14, 2014 at 7:33 PM, Aaron Ecay  wrote:
>> The first is to use the C-c C-v C-e binding to execute source blocks
>> rather than C-c C-c.
>
> Like this?
>
> (setq org-babel-no-eval-on-ctrl-c-ctrl-c +1)
>
>

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



Re: [O] proposal to make C-c C-c not remove latex overlays

2014-07-15 Thread John Kitchin
Aaron Ecay  writes:

Thanks for the advice idea, that is a nice one. It doesn't work for me
like this though:

#+BEGIN_SRC emacs-lisp
(defadvice org-ctrl-c-ctrl-c (around latex-overlays)
  "ignore latex overlays in C-cC-c"
  (let ((org-latex-fragment-image-overlays nil))
ad-do-it))
#+END_SRC

maybe because that is a buffer local variable?

> Hi John,
>
> 2014ko uztailak 14an, John Kitchin-ek idatzi zuen:
>> 
>> I am using org-mode files with equations and code blocks in lectures,
>> and it is problematic that C-c C-c removes the equation overlays when
>> running a code block. First, you have to press C-c C-c twice to run the
>> block, since the first one gets rid of the equations, but then you have
>> run C-c C-x C-l to get the equations back! and the cycle repeats
>> throughout a lecture.
>> 
>> I would prefer that the equations stay untouched, and that the code
>> blocks run without modifying them. 
>> 
>> I think the best behavior would be for C-c C-x C-l to toggle the
>> equations, and to remove the C-c C-c behavior for latex overlays
>> completely. But it would be ok if this was done by a C-c C-c hook
>> function, so that a user could remove the latex overlay without touching
>> the org-code.
>> 
>> Maybe a new function like this:
>> 
>> #+BEGIN_SRC emacs-lisp
>> (defun org-toggle-latex-overlays (arg)
>>   "Toggle LaTeX fragments."
>>   (interactive "P")
>>   (if org-latex-fragment-image-overlays
>>   (org-remove-latex-fragment-image-overlays)
>> (org-preview-latex-fragment arg)))
>> #+END_SRC
>> 
>>  could be added. Any thoughts?
>
> I don’t have a comment on the substance of the proposal, but rather two
> suggestions for workarounds.
>
> The first is to use the C-c C-v C-e binding to execute source blocks
> rather than C-c C-c.
>
> The second is to let-bind ‘org-latex-fragment-image-overlays’ to nil
> in an advice around the ‘org-ctrl-c-ctrl-c’ function, allowing you to
> still use the more convenient C-c C-c binding.

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



Re: [O] proposal to make C-c C-c not remove latex overlays

2014-07-16 Thread John Kitchin
That is nice. For those of us using windows sometimes, you can kind of
get super and hyper keys (see
http://ergoemacs.org/emacs/emacs_hyper_super_keys.html). Although,
without also using autohotkey, your super keys are limited because
windows uses some of them (e.g.s-e launches explorer). H-e works fine.

Grant Rettke  writes:

> C-c C-v C-e might seem like a lot but it nice to have control and be
> sure when code is getting evaluated.
>
> That said, I do have a more obvious one using "super" which is indeed, super:
>
> (local-set-key (kbd "s-t") 'org-babel-tangle)
> (local-set-key (kbd "s-e") 'org-babel-execute-maybe)
> Grant Rettke | ACM, ASA, FSF, IEEE, SIAM
> g...@wisdomandwonder.com | http://www.wisdomandwonder.com/
> “Wisdom begins in wonder.” --Socrates
> ((λ (x) (x x)) (λ (x) (x x)))
> “Life has become immeasurably better since I have been forced to stop
> taking it seriously.” --Thompson
>
>
> On Tue, Jul 15, 2014 at 4:00 PM, John Kitchin  wrote:
>> I actually love C-c C-c to run code blocks! Maybe I should just bind it
>> to f5 or something, I am just so used to C-cC-c now!
>>
>> Grant Rettke  writes:
>>
>>> On Mon, Jul 14, 2014 at 7:33 PM, Aaron Ecay  wrote:
>>>> The first is to use the C-c C-v C-e binding to execute source blocks
>>>> rather than C-c C-c.
>>>
>>> Like this?
>>>
>>> (setq org-babel-no-eval-on-ctrl-c-ctrl-c +1)
>>>
>>>
>>
>> --
>> ---
>> John Kitchin
>> Professor
>> Doherty Hall A207F
>> Department of Chemical Engineering
>> Carnegie Mellon University
>> Pittsburgh, PA 15213
>> 412-268-7803
>> http://kitchingroup.cheme.cmu.edu
>
>

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



Re: [O] proposal to make C-c C-c not remove latex overlays

2014-07-16 Thread John Kitchin
DOH! thanks, that is exactly what I forgot to do. This works fine after
you activate it! Thanks.

Nick Dokos  writes:

> John Kitchin  writes:
>
>> Aaron Ecay  writes:
>>
>> Thanks for the advice idea, that is a nice one. It doesn't work for me
>> like this though:
>>
>> #+BEGIN_SRC emacs-lisp
>> (defadvice org-ctrl-c-ctrl-c (around latex-overlays)
>>   "ignore latex overlays in C-cC-c"
>>   (let ((org-latex-fragment-image-overlays nil))
>> ad-do-it))
>> #+END_SRC
>>
>> maybe because that is a buffer local variable?
>>
>
> You probably forgot to activate it:
>
> (ad-activate 'org-ctrl-c-ctrl-c)

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



Re: [O] proposal to make C-c C-c not remove latex overlays

2014-07-16 Thread John Kitchin
I favor the toggling behavior. There is an org-ctrl-c-ctrl-c-hook
variable that can always have functions in it that keep the current
behavior, but that can be removed if they are not desired.

John

Nick Dokos  writes:

> Andreas Leha  writes:
>
>> Hi all,
>>
>> John Kitchin  writes:
>>
>>> I am using org-mode files with equations and code blocks in lectures,
>>> and it is problematic that C-c C-c removes the equation overlays when
>>> running a code block. First, you have to press C-c C-c twice to run the
>>> block, since the first one gets rid of the equations, but then you have
>>> run C-c C-x C-l to get the equations back! and the cycle repeats
>>> throughout a lecture.
>>>
>>> I would prefer that the equations stay untouched, and that the code
>>> blocks run without modifying them. 
>>>
>>> I think the best behavior would be for C-c C-x C-l to toggle the
>>> equations, and to remove the C-c C-c behavior for latex overlays
>>> completely.
>>
>> Since this thread focusses on work arounds and local customizations so
>> far, let me just say, that I completely agree here.  What is the
>> reasoning behind the current key binding?  Is there any benefit over
>> using the same key binding to toggle the state?
>>
>
> I'm inclined to agree too: I imagine it would be very annoying after
> a while.
>
> There are three things that C-c C-c currently undoes in an ad-hoc
> fashion. The first cond clause in the function looks like this:
>
> ,
> |((or (and (boundp 'org-clock-overlays) org-clock-overlays)
> | org-occur-highlights
> | org-latex-fragment-image-overlays)
> | (and (boundp 'org-clock-overlays) (org-clock-remove-overlays))
> | (org-remove-occur-highlights)
> | (org-remove-latex-fragment-image-overlays)
> | (message "Temporary highlights/overlays removed from current buffer"))
> `
>
> So if there are clock overlays or occur highlights or latex fragment
> image overlays, they are undone and the function is finished. This seems
> like a separate issue from the main thrust of what C-c C-c does (and it
> does a lot), so my inclination would be to suggest that each of the
> above conditions be togglable, using the standard keybinding for each
> (C-c C-x C-l for latex fragment image overlay toggling, C-c C-x C-d for
> clock display - occur highlights only happen from org-goto with the "/"
> keybinding, but there is no org-global keybinding I believe).
>
> However there is a variable that modifies that behavior:
>
> ,
> | org-remove-highlights-with-change is a variable defined in `org.el'.
> | Its value is t
> | 
> | Documentation:
> | Non-nil means any change to the buffer will remove temporary highlights.
> | Such highlights are created by `org-occur' and `org-clock-display'.
> | When nil, `C-c C-c needs to be used to get rid of the highlights.
> | The highlights created by `org-preview-latex-fragment' always need
> | `C-c C-c' to be removed.
> `
>
> If most of us leave that variable's value at default, the ad-hoc-kery
> probably does not raise its head except for latex fragments. If that's
> the case, then getting rid of just latex fragment undoing in
> org-ctrl-c-ctrl-c and toggling with C-c C-x C-l is probably the best
> solution. It probably would be a good idea to make the handling of clock
> overlays similar as well and make C-c C-x C-d toggle the clock overlay
> state (I'd be inclined to take that out of org-ctrl-c-ctrl-c as well,
> since I suspect that almost nobody uses it, given the variable above and
> its default value - but that's only a hunch).  That would leave only
> occur highlights to be undone by org-ctrl-c-ctrl-c - which is ugly but
> the function is a kitchen-sink kind of function anyway, so that's
> probably OK.
>
> Alternatively, make org-ctrl-c-ctrl-c undo these things as it does
> today, but only with a triple prefix arg (which afaict is not used
> today).
>
> As Nicolas would say, WDYT?

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



Re: [O] What is the best in-Emacs presentation mode for org-files today?

2014-07-28 Thread John Kitchin
I agree with org-mode. Check out
https://www.youtube.com/watch?v=JZ8RK-R9O_g, which is an illustration of
some code I adapted from Sacha Chua. At the top of
https://github.com/jkitchin/jmax/blob/master/org-show.org you can find
some links to other presentation tools in Emacs.

Bastien  writes:

> Hi Grant,
>
> Grant Rettke  writes:
>
>> What are you opinions on the best mode for doing:
>> 1. Presentations inside of Emacs
>> 2. Using all the options available for org mode while in the presentation
>
> ... org-mode.
>
> I've found out that tweaking the font size and navigating through
> an Emacs buffer is often good enough for presentations.

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



Re: [O] A gentle introduction to Emacs & Org-mode?

2014-07-28 Thread John Kitchin
This page has some links to some videos that you might find helpful:
http://kitchingroup.cheme.cmu.edu/blog/2014/07/12/Org-mode-is-awesome/. Some
are more gentle than others ;)

Bastien  writes:

> Hi Marcin,
>
> Marcin Borkowski  writes:
>
>> Also, is prelude or Emacs Starter Kit a good idea?
>
> My very personal stand on this is that prelude and Starter kit
> are good options when someone wants to discover Emacs, but can
> sometimes get in the way: if something goes wrong, you are not
> sure who to blame, the modified setup or Emacs.
>
>> I understand this is opinion-based, but maybe someone has some
>> experience *teaching* Emacs and Org-mode?)
>
> My "teaching/helping" IRL experience is that people start with
> a Starter Kit because they are afraid of the Beast, sometimes
> for no good reasons.  It's better to simply play by the rules:
> that way, when something goes wrong, the odds are greater to
> understand what and why.
>
> As for a gentle introduction with a wide scope on E&Om, I don't
> think there is such a thing... sadly.
>
> Good luck to your friend!

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



Re: [O] What is the best in-Emacs presentation mode for org-files today?

2014-07-29 Thread John Kitchin
Thorsten Jolitz  writes:
yes, you should be able to use org-babel-tangle to extract the .el
file. Sorry for leaving that detail out!

> Nicolas Richard  writes:
>
>> Thorsten Jolitz  writes:
>>
>>> John Kitchin  writes:
>>>
>>> Hi John, 
>>>
>>>> I agree with org-mode. Check out
>>>> https://www.youtube.com/watch?v=JZ8RK-R9O_g, which is an illustration of
>>>> some code I adapted from Sacha Chua. At the top of
>>>> https://github.com/jkitchin/jmax/blob/master/org-show.org you can find
>>>> some links to other presentation tools in Emacs.
>>>
>>> this looks very nice, but how do I get it?
>>
>> Just from the name of the files (org-show.org and org-show.el) and the
>> fact that this is Org mode, I would say you should tangle the org file
>> to get the .el file !
>
> Ah yes, there is actually a final node in this file containing the
> org-show source-code (with a :tangle yes header), did not see that,
> looked like just the presentation. Thx for the hint.

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



Re: [O] A gentle introduction to Emacs & Org-mode?

2014-07-29 Thread John Kitchin
jorge.a.alf...@gmail.com (Jorge A. Alfaro-Murillo) writes:

thanks for point that out, I have fixed them now I think. That must be
from some link escaping in the translation of org to html I guess. 


> Thanks John,
>
> The links to the other videos are broken. I think that the addresses
> have %3D instead of an equal sign (=).
>
> Best,
>
> Jorge.
>
>
>
>

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



Re: [O] Writing .el files for org in org?

2014-07-29 Thread John Kitchin
Ok, I am giving it a shot. Here is my setup:

;;; org path
(defvar org-load-path
  (list (file-name-as-directory
 (expand-file-name "org" starter-kit-dir)))
  "List of directories to find org-files that
  `org-babel-load-file' can load code from")

(defun org-require (feature)
  "Load a FEATURE from an org-file.
FEATURE is a symbol, and it is loaded from an org-file by the name of
FEATURE.org, that is in the `org-load-path'. The FEATURE is loaded from
`org-babel-load-file'."
  (let ((org-file (concat (symbol-name feature) ".org"))
(path))

;; find the org-file
(catch 'result
  (loop for dir in org-load-path do
(when (file-exists-p
   (setq path
 (expand-file-name
  org-file
  dir)))
  (throw 'result path
(let ((default-directory (file-name-directory path)))
  (org-babel-load-file path

(org-require 'org-ref)
(org-require 'doi-utils)
(org-require 'org-show)


In the only directory I define in org-load-path, I put org-show.org,
org-ref.org, and doi-utils.org, and the code above is in an init file. When
I load emacs, for these files, so far, it works great. They are simple
files that only tangle to one .el file so far.



John

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



On Sun, Jul 27, 2014 at 5:50 PM, Bastien  wrote:

> Hi John and Rainer,
>
> Rainer M Krug  writes:
>
> >> What if we created a new directory in the repository called "org" which
> >> contains these kinds of files?  It would be analogous to the "lisp"
> >> directory. I don't think we need to have both ob-R.org and ob-R.el in
> the
> >> repository.
> >
> > I think that would be a very good idea for certain modules like your
> > org-ref and ob-R I am working on.
>
> Maybe you could use such a "load-flow" for a while, see if it is
> robust enough, and if so, we could move on and have it in the repo?
>
> My gut feeling is that it will bring some issues, so experimenting
> before would be nice.
>
> --
>  Bastien
>


Re: [O] Where is the git master branch?

2014-07-30 Thread John Kitchin
After you have the repo, run this to get on the master branch.

> git checkout master

and

> git checkout maint

to get back to maint.



Nicolas Richard  writes:

> Sharon Kimble  writes:
>> If "git clone git://orgmode.org/org-mode.git" gets the development
>> branch of org-mode, what is the git command to get the master branch
>> please? I've been looking on http://orgmode.org/ but can't see any
>> reference for it.
>
> The 'master' branch is the development/unstable branch. The stable
> branch is called 'maint'.

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



Re: [O] [RFC] Rewrite `org-entry-properties' using parser

2014-08-03 Thread John Kitchin
I have used the following approaches in the past:

Lisp lists, and use read later to get them.
* Some heading
  :PROPERTIES:
  :SUBJECT:  '(subject1 subject2 subject3)
  :END:

#+BEGIN_SRC emacs-lisp 
(read (org-entry-get (point) "SUBJECT"))
#+END_SRC

#+RESULTS:
| quote | (subject1 subject2 subject3) |


* Second heading 
  :PROPERTIES:
  :SUBJECT:  subject1 subject2 subject3
  :END:

delimited strings. You have to split them them yourself later if you
are using the properties in code. You can delimit on spaces, commas, etc... 
depending on your subjects.

#+BEGIN_SRC emacs-lisp
(split-string (org-entry-get (point) "SUBJECT"))
#+END_SRC

#+RESULTS:
| subject1 | subject2 | subject3 |

They are both pretty flexible.

Erik Hetzner  writes:

> At Fri, 01 Aug 2014 01:21:47 +0200,
> Thorsten Jolitz wrote:
>> 
>> Hi List,
>> 
>> here is my first take of rewriting `org-entry-properties'.
>> 
>> The existing function predates the new parser and some Org variables,
>> and thus does the parsing and the property classification itself. The
>> new version leaves parsing to the parser and property classification
>> (mostly) to existing Org variables, resulting in much simpler code. 
>>
>> […]
>
> Hi Thorsten,
>
> This doesn’t directly related to this work, but I have been trying to
> come up with a workflow for using org-mode for research and have had
> trouble with the fact that user properties cannot be multi-valued. So
> if a user wants to assign subjects to an entry, they need to figure
> some way to assign multiple subjects.
>
> There are workarounds, but it would be helpful if user properties
> could be multivalued. I don’t know if this is feasible given the
> current codebase; when I looked into it, it seemed pretty difficult.
>
> best, Erik

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



Re: [O] org-ref in action

2014-08-05 Thread John Kitchin
Hi, it got moved in a re-organization to
https://github.com/jkitchin/jmax/blob/master/org/org-ref.org.

Sorry for the inconvenience!

Xebar Saram  writes:

> Hi all
>
> the github link seems dead, anyone knows where one could get and try
> org-ref from?
>
> z
>
> On Mon, Jun 30, 2014 at 2:27 PM, Joseph Vidal-Rosset
>  wrote:
>
> Thanks Eric, it works now, with the latest version of org-mode. 
> 
> Best wishes
> 
> Jo. 
> 
> 
> 
> 
> 2014-06-30 12:22 GMT+02:00 Eric Schulte :
> 
> 
> 
> > Thanns to the default cite action, I get for example in my
> org file:
> >
> > [[cite:(119–136)johansson36:_minim_formal]]
> >
> > and it creates no reference at al, because via the export I
> get:
> >
> > \cite{(119–136)johansson36:_minim_formal}
> >
> 
> 
> Using the latest version of Org-mode from the git repository,
> this is a
> very new feature and requires usage of the git version of
> Org-mode, I am
> seeing the desired behavior. After simply requiring ox-bibtex,
> the
> following
> 
> * H1
> [[cite:(119–136)johansson36:_minim_formal]]
> 
> exports to
> 
> \begin{document}
> 
> \maketitle
> \tableofcontents
> 
> \section{H1}
> \label{sec-1}~\cite[119–136]{johansson36:_minim_formal}
> % Emacs 24.4.50.2 (Org mode beta_8.3)
> \end{document}
> 
> As expected.
> 
> I hope this helps,
> Eric
> 
>     
> 
> --
> Eric Schulte
> https://cs.unm.edu/~eschulte
> PGP: 0x614CA05D (see https://u.fsf.org/yw)
> 
>
> 
>
>

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



Re: [O] org-ref in action

2014-08-06 Thread John Kitchin
I am not familiar with jabref, but assuming it stores the entries in a
regular bibtex format, and you have the bibtex file open in emacs, with the
cursor on the entry you want to make a heading for, you run
M-x org-ref-open-bibtex-notes.

That creates something like an org-bibtex heading in your
org-ref-bibliography-notes file, but it is probably a little different. I
haven't used org-bibtex, and I didn't try to make it exactly the same. If
you try it and tell me what is missing, I can make it be more like
org-bibtex. The format there is not critical to me.

John

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



On Wed, Aug 6, 2014 at 6:54 AM, Xebar Saram  wrote:

> Thanks John
>
> No worries :) ive installed it and its working great.
>
> in a related question, does anyone use it with jabef?
>
> the reason im asking is that im very new to this and wonder about a
> possible workflow to export a bib citation from jabref to org and create an
> org header (per reference). so far it seems like org-ref will only insert
> something like
> cite:REF
> I have played around with org-bibtex and seem to remember there was a
> org-bibtex yank function that created a header in org from the bib citation
> in clipboard, can org-ref do something similar?
>
> sorry for the neewb questions
>
> z
>
>
>
>
>
> On Wed, Aug 6, 2014 at 12:08 AM, John Kitchin 
> wrote:
>
>> Hi, it got moved in a re-organization to
>> https://github.com/jkitchin/jmax/blob/master/org/org-ref.org.
>>
>> Sorry for the inconvenience!
>>
>> Xebar Saram  writes:
>>
>> > Hi all
>> >
>> > the github link seems dead, anyone knows where one could get and try
>> > org-ref from?
>> >
>> > z
>> >
>> > On Mon, Jun 30, 2014 at 2:27 PM, Joseph Vidal-Rosset
>> >  wrote:
>> >
>> > Thanks Eric, it works now, with the latest version of org-mode.
>> >
>> > Best wishes
>> >
>> > Jo.
>> >
>> >
>> >
>> >
>> > 2014-06-30 12:22 GMT+02:00 Eric Schulte :
>> >
>> >
>> >
>> > > Thanns to the default cite action, I get for example in my
>> > org file:
>> > >
>> > > [[cite:(119–136)johansson36:_minim_formal]]
>> > >
>> > > and it creates no reference at al, because via the export I
>> > get:
>> > >
>> > > \cite{(119–136)johansson36:_minim_formal}
>> > >
>> >
>> >
>> > Using the latest version of Org-mode from the git repository,
>> > this is a
>> > very new feature and requires usage of the git version of
>> > Org-mode, I am
>> > seeing the desired behavior. After simply requiring ox-bibtex,
>> > the
>> > following
>> >
>> > * H1
>> > [[cite:(119–136)johansson36:_minim_formal]]
>> >
>> > exports to
>> >
>> > \begin{document}
>> >
>> > \maketitle
>> > \tableofcontents
>> >
>> > \section{H1}
>> > \label{sec-1}~\cite[119–136]{johansson36:_minim_formal}
>> > % Emacs 24.4.50.2 (Org mode beta_8.3)
>> > \end{document}
>> >
>> > As expected.
>> >
>> > I hope this helps,
>> > Eric
>> >
>> >
>> >
>> > --
>> > Eric Schulte
>> > https://cs.unm.edu/~eschulte
>> > PGP: 0x614CA05D (see https://u.fsf.org/yw)
>> >
>> >
>> >
>> >
>> >
>>
>> --
>> ---
>> John Kitchin
>> Professor
>> Doherty Hall A207F
>> Department of Chemical Engineering
>> Carnegie Mellon University
>> Pittsburgh, PA 15213
>> 412-268-7803
>> http://kitchingroup.cheme.cmu.edu
>>
>
>


Re: [O] Large numbers of named variables in Babel

2014-08-06 Thread John Kitchin
Brett Witty  writes:

This is close to what you want I think.

#+TBLNAME: stats
| STR | 13 |
| DEX | 12 |
| CON | 11 |


#+BEGIN_SRC python :results value :var data=stats
d = dict(data)
return d['DEX'] + d['CON']
#+END_SRC

#+RESULTS:
: 23


> Hi,
>
> I'm trying to write my RPG adventures in org-mode and would like to
> bring character sheets into that fold. Is there a way in Babel to have
> a vast number of named variables that I can feed into source blocks?
> Are macros the way to achieve this?
>
> As an example, I'd like something like a big (hidden) table:
> #+NAME: stats
> | STR | 13 |
> | DEX | 12 |
> | CON | 11 |
>
> and then later I can use that like:
> #+NAME: AC
> #+begin_src python :var dex=table[DEX] :var armour=table[ARMOUR]
> return dex + armour
> #+end_src
>
> I know I can make explicit cell references, but it'd be neat to just
> use keys for values.
>
> Cheers,
>
> BrettW
>

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



[O] org-8 manual on Amazon!

2014-08-07 Thread John Kitchin
I saw on twitter today the org mode 8 manual is available on Amazon
today: http://www.amazon.com/dp/9881327709/. It looks like it covers Org 8.2.

-- 
---
John Kitchin
http://kitchingroup.cheme.cmu.edu




Re: [O] Manipulating Dates Automatically in a Headline

2014-08-13 Thread John Kitchin
Matt Price  writes:

I have not done that exactly, but here is some code that does manipulate
timestamps:
http://kitchingroup.cheme.cmu.edu/blog/2014/02/05/Add-time-to-a-deadline/

It is not quite what you want, but it might be a good start.


> It's been a couple of days so I'll try restate this question more
> clearly.  I'm hoping it's possible to do something like this:
>
> * Week one (<2014-09-09>)
> * Week two (EVALUATE A LISP EXPRESSION THAT INSERTS A TIMESTAMP ONE
> WEEK LATER THAN LAST TIMESTAMP FOUND IN BUFFER)
>
> I don't have much experience with babel so I'm not sure how to do
> this, but if it's possible I would love some hints.  Thanks as always,
>
> Matt
>
>
> On Mon, Aug 11, 2014 at 2:20 PM, Matt Price  wrote:
>> Hi Everyone,
>>
>> I've asked this before, but that was a year or two ago and am hoping
>> someone has an idea now, perhaps involving babel or something.
>>
>> every year at this time I rewrite a set of syllabi. I do a lot of
>> moving htings around while i'm oding it, and at the end I have to
>> enter a whole bunch of dates somewhat laboriously.  I have headlines
>> that look about like either like this:
>>
>> -
>> * Outline
>> ** Week 1: Topic Title (<2013-09-10>)
>> Longish Description
>> *** Reading
>> - Article 1
>> - Article 2
>> *** Lab
>> *** Notes
>> ---
>>
>> or like this:
>> --
>> * Outline
>> ** Week 1: <2013-09-09>
>> *** Seminar: Technology and Society  (<2013-09-10>)
>> *** Reading
>> - Article 1
>> - Article 2
>> *** Plenary: Global Citizenship (<2013-09-13>)
>> 
>>
>> I would like to replace the timestamps with code that dynamically
>> generates timestamps based on the value either in the last sibling
>> headline, or the parent headline.  It seems to me this ought to be
>> possible, but I'm not at all sure how to do it.  i would really
>> appreciate any guidance.  thanks!
>>
>> Matt
>
>

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



Re: [O] How to represent this in Org-mode

2014-08-13 Thread John Kitchin
Marcin Borkowski  writes:

Are you hoping to have some properties on headlines that define the
dependencies, and then export the org-file to some format that has these
dependencies as links to those sections?

I am teaching a course this fall and I am actually using org-mode as the
format of the notes (students will be reading them in Emacs). So, I will
just be putting links to org-files directly into them, and in places
where I want to remind them of previous material. I wrote up each
"lecture" in a separate file, and provide the order in a separate table
of contents file.

If you plan to export the org files, I would use org-id links in a
section at the top of each file that indicate which previous material
should be mastered. These should export as links in html or latex.

> Dnia 2014-08-13, o godz. 14:46:41
> Pascal Fleury  napisał(a):
>
>> Maybe this will help:
>> http://orgmode.org/worg/org-contrib/org-depend.html
>> 
>> --paf
>
> Thanks, but not really.  My problem is not about /TODO/ dependencies -
> I may as well actually /write/ the project in a totally different
> order.  What I want to specify is the order of /studying/ that stuff,
> which finally might be turned into links to the prerequisites in each
> module or something like that.
>
> Thanks anyway,

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



[O] exporting org to org with link transforms?

2014-08-13 Thread John Kitchin
I was playing around with an idea for inserting bibliographies into an
exported org file. I thought I could specify a format for the 'org
backend that would convert the links like this:

cite:some-key  ->  [[#some-key]]

bibliography:test.bib ->

* Bibliography
** authors - title
 :PROPERTIES:
 :CUSTOM_ID: some-key
 :END:

so, for example the formatting part of the bibliography link looks like:

(lambda (keyword desc format)
 (cond
  ((eq format 'org) (org-ref-get-org-bibliography))
  ((eq format 'ascii) (org-ref-get-ascii-bibliography))
  ((eq format 'html) (org-ref-get-html-bibliography))
  ((eq format 'latex)
 ;; write out the latex bibliography command
   (format "\\bibliography{%s}"
 (replace-regexp-in-string  "\\.bib" "" keyword)


where (org-ref-get-org-bibliography) returns a string that I want.  
  
What I get right now is no change in the links at all in an org-export
buffer for org or ascii. The html and latex work fine.

Should the org and ascii export work like I expect? Thanks,

-- 
---
John Kitchin
http://kitchingroup.cheme.cmu.edu




[O] org-babel with Matlab on windows?

2014-08-13 Thread John Kitchin
Is anyone using Matlab with org-babel on Windows successfully? If so,
how did you do it?


-- 
---
John Kitchin
http://kitchingroup.cheme.cmu.edu




Re: [O] Manipulating Dates Automatically in a Headline

2014-08-14 Thread John Kitchin
Matt Price  writes:


I think this is approximately what you want:

#+BEGIN_SRC emacs-lisp 
(defun insert-ts+1w ()
  "Insert a timestamp at point that is one week later than the
last timestamp found in the buffer."
  (interactive)
  (let ((last-ts (car (last (org-element-map (org-element-parse-buffer) 
'timestamp
  (lambda (timestamp)
(org-element-property :raw-value 
timestamp)))
(insert last-ts)
(backward-char 2)
(org-timestamp-change +7 'day)
))
#+END_SRC

It is an interactive command you can run with M-x insert-ts+1w at the
point you want to insert the new headline.

> It's been a couple of days so I'll try restate this question more
> clearly.  I'm hoping it's possible to do something like this:
>
> * Week one (<2014-09-09>)
> * Week two (EVALUATE A LISP EXPRESSION THAT INSERTS A TIMESTAMP ONE
> WEEK LATER THAN LAST TIMESTAMP FOUND IN BUFFER)
>
> I don't have much experience with babel so I'm not sure how to do
> this, but if it's possible I would love some hints.  Thanks as always,
>
> Matt
>
>
> On Mon, Aug 11, 2014 at 2:20 PM, Matt Price  wrote:
>> Hi Everyone,
>>
>> I've asked this before, but that was a year or two ago and am hoping
>> someone has an idea now, perhaps involving babel or something.
>>
>> every year at this time I rewrite a set of syllabi. I do a lot of
>> moving htings around while i'm oding it, and at the end I have to
>> enter a whole bunch of dates somewhat laboriously.  I have headlines
>> that look about like either like this:
>>
>> -
>> * Outline
>> ** Week 1: Topic Title (<2013-09-10>)
>> Longish Description
>> *** Reading
>> - Article 1
>> - Article 2
>> *** Lab
>> *** Notes
>> ---
>>
>> or like this:
>> --
>> * Outline
>> ** Week 1: <2013-09-09>
>> *** Seminar: Technology and Society  (<2013-09-10>)
>> *** Reading
>> - Article 1
>> - Article 2
>> *** Plenary: Global Citizenship (<2013-09-13>)
>> 
>>
>> I would like to replace the timestamps with code that dynamically
>> generates timestamps based on the value either in the last sibling
>> headline, or the parent headline.  It seems to me this ought to be
>> possible, but I'm not at all sure how to do it.  i would really
>> appreciate any guidance.  thanks!
>>
>> Matt
>
>

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



Re: [O] How can I calculate the "age" of a headline?

2014-08-19 Thread John Kitchin

I think this does what you want. I do not know if it would be easy to
get in a tabular agenda view though.

* Calculate age of this headline

#+BEGIN_SRC emacs-lisp
(org-narrow-to-subtree)
(org-time-stamp-to-now
 (car
  (cl-sort (org-element-map (org-element-parse-buffer) 'headline
 (lambda (headline)
   (org-element-property
:raw-value
(org-element-property :deadline headline
   'org-time<)))
#+END_SRC

#+RESULTS:
: -14



** task 1
   DEADLINE: <2014-08-12 Tue>


** task 2
   DEADLINE: <2014-08-05 Tue>

M  writes:

> In my task lists, I'm working with scheduled and deadline dates.
> However, it would also often be very interesting, how "old" a task is, how
> long it is lurking around on my lists..
>
> Therefore it would be interesting to find the oldest timestamp below this
> heading and calculate the difference in days to today.
>
> Is that possible with org-mode already?
> Could I display this information in a tabular agenda view in a column?
>
> Kind regards
>
> Martin
>
>
>
>

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



[O] bug in org-babel emacs-lisp output?

2014-08-22 Thread John Kitchin

I have noticed a possible bug in the output of src blocks, especially
for emacs-lisp blocks.

This block works fine.

#+BEGIN_SRC emacs-lisp :results raw
'(nil ("a" . "b"))
#+END_SRC

#+RESULTS:
(nil (a . b))


This block however, gives me an error that is due to nil being the first
element of the list.

#+BEGIN_SRC emacs-lisp
'(nil ("a" . "b"))
#+END_SRC



#+RESULTS:

gives this error:
org-babel-insert-result: Args out of range: #, 0, 1

A traceback shows:
Debugger entered--Lisp error: (args-out-of-range # 0 1)
  orgtbl-to-orgtbl((nil ("a" . "b")) (:fmt (lambda (cell) (format "%s" cell
  org-babel-insert-result((nil ("a" . "b")) ("value" "replace") ("emacs-lisp" 
"'(nil (\"a\" . \"b\"))" ((:comments . "") (:shebang . "") (:cache . "no") 
(:padline . "") (:noweb . "no") (:tangle . "no") (:exports . "code") (:results 
. "replace value") (:session . "none") (:hlines . "yes") (:colnames . "no") 
(:result-type . value) (:result-params "value" "replace") (:rowname-names) 
(:colname-names)) "" nil 0 #) nil 0 "emacs-lisp")
  org-babel-execute-src-block(nil)
  org-babel-execute-src-block-maybe()
  org-babel-execute-maybe()
  org-babel-execute-safely-maybe()
  run-hook-with-args-until-success(org-babel-execute-safely-maybe)
  org-ctrl-c-ctrl-c(nil)
  funcall-interactively(org-ctrl-c-ctrl-c nil)
  call-interactively(org-ctrl-c-ctrl-c nil nil)
  command-execute(org-ctrl-c-ctrl-c)


Another example that fails:
#+BEGIN_SRC emacs-lisp :results value
'('(nil nil) ("a" . "b"))
#+END_SRC


orgtbl-format-line: Wrong type argument: listp, "b"

But, this works
#+BEGIN_SRC emacs-lisp :results value
'((nil . "c") ("a" . "b"))
#+END_SRC



#+RESULTS:
| (nil . c) | (a . b) |

It seems like the issue is that the output does not go into a table too
well, and the error is a formatting one. Maybe this error should be
caught, and a default of raw should be output when a table cannot be
made? right now my workaround is specifying the :results raw when I hit
these situations, but it doesn't seem right.


-- 
---
John Kitchin
http://kitchingroup.cheme.cmu.edu




[O] org-project or something like it?

2014-08-23 Thread John Kitchin
Hi all,

I have been mulling an idea in my mind on using a set of org-files as a
research notebook. We basically already do this, but what I was thinking
is how to define this set as a "project" or "notebook" that would have
its own (temporarily defined) set of org-agenda-files, with some
functionality like jumping to the most recent timestamp, or generating
an overall timeline, table of contents, etc... You would use a minor-mode to 
temporarily
set the org-agenda-files, for example.

does anything like this already exist? I am not to familiar with other
project-based tools, e.g. projectile. It seems to have some good
capabilities for project navigation, but not the org-capabilities I am
thinking of.

Is anyone already doing anything that sounds like this? Thanks,


-- 
-------
John Kitchin
Professor




Re: [O] org-ref "no key found"

2014-08-29 Thread John Kitchin
"Julian M. Burgos"  writes:

If you click on the bibliography link to open the file, and then go back
to your org-file, do the cite links work?

I suspect the notes problem is related to the no key found problem.

> Hello everyone,
>
> I am playing around with Joh Kitchin's excellent org-ref, and I am
> having a few issues.  In my .emacs file I have set up the values for the
> org-ref-bibliography-notes, org-ref-default-bibliography, and
> org-ref-pdf-directory.
>
> With this I can access my .bib database and use org-ref-insert-cite link
> to add a citation link with no problems.  But when I press enter on the
> cite link, I get the following message:
>
> no key found
>  (No key found) (p)df (u)rl (n)otes (q) quit
>
> If I press "p" I get the pdf file, but if I press "n" I get the
> following message: 
>
> "Wrong type argument: stringp, nil".
>
> Any ideas how to solve this?
>
> Many thanks,
>
> Julian

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



Re: [O] org-ref "no key found"

2014-08-30 Thread John Kitchin
that is odd. this means org-ref is not finding the key you clicked
on. could you send me a small example that reproduces your problem (an
org-file and the bib file)?

"Julian M. Burgos"  writes:

> Hi John, 
>
> No, they still do not work even after I click on the bibliography link
> and get my .bib file opened.
>
> Julian
>
> John Kitchin writes:
>
>> "Julian M. Burgos"  writes:
>>
>> If you click on the bibliography link to open the file, and then go back
>> to your org-file, do the cite links work?
>>
>> I suspect the notes problem is related to the no key found problem.
>>
>>> Hello everyone,
>>>
>>> I am playing around with Joh Kitchin's excellent org-ref, and I am
>>> having a few issues.  In my .emacs file I have set up the values for the
>>> org-ref-bibliography-notes, org-ref-default-bibliography, and
>>> org-ref-pdf-directory.
>>>
>>> With this I can access my .bib database and use org-ref-insert-cite link
>>> to add a citation link with no problems.  But when I press enter on the
>>> cite link, I get the following message:
>>>
>>> no key found
>>>  (No key found) (p)df (u)rl (n)otes (q) quit
>>>
>>> If I press "p" I get the pdf file, but if I press "n" I get the
>>> following message: 
>>>
>>> "Wrong type argument: stringp, nil".
>>>
>>> Any ideas how to solve this?
>>>
>>> Many thanks,
>>>
>>> Julian

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



[O] progress indicator for code blocks?

2014-08-30 Thread John Kitchin
Hi all,
I am using org-mode in a class, and some students wondered if it was
possible for there to be a progress bar of some kind while a code block
is running. Right now Emacs just appears to lock up and there is no
indication anything is happening, especially the first time we run a
python block.

I found make-progress-reporter and tried something like this::
#+BEGIN_SRC emacs-lisp
(defadvice org-babel-execute-src-block (around progress nil activate)
  (let ((pr (make-progress-reporter "Running")))
ad-do-it
(progress-reporter-done pr)))
#+END_SRC

but there is no way to update it, so it doesn't quite do anything
useful.

What I would really like is an hourglass or some spinning thing. Does
anyone know how to get that (in a cross-platform way)?

-- 
-------
John Kitchin
http://kitchingroup.cheme.cmu.edu




Re: [O] progress indicator for code blocks?

2014-08-31 Thread John Kitchin
John Kitchin  writes:

I am currently using this bit of advice to change the color of code
blocks while they are being executed so there is a visual hint something
is happening.

;; give us some hint we are running
(defadvice org-babel-execute-src-block (around progress nil activate)
  (set-face-attribute
   'org-block-background nil :background "LightSteelBlue")
  (message "Running your code block")
  ad-do-it
  (set-face-attribute 'org-block-background nil :background "gray")
  (message "Done with code block"))


> Hi all,
> I am using org-mode in a class, and some students wondered if it was
> possible for there to be a progress bar of some kind while a code block
> is running. Right now Emacs just appears to lock up and there is no
> indication anything is happening, especially the first time we run a
> python block.
>
> I found make-progress-reporter and tried something like this::
>
> #+BEGIN_SRC emacs-lisp
> (defadvice org-babel-execute-src-block (around progress nil activate)
>   (let ((pr (make-progress-reporter "Running")))
> ad-do-it
> (progress-reporter-done pr)))
> #+END_SRC
>
> but there is no way to update it, so it doesn't quite do anything
> useful.
>
> What I would really like is an hourglass or some spinning thing. Does
> anyone know how to get that (in a cross-platform way)?

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



Re: [O] Babel more verbose?

2014-09-02 Thread John Kitchin

Try this:

#+BEGIN_SRC emacs-lisp
(defadvice org-babel-execute-src-block (around progress nil activate)
  "create a buffer indicating what is running"
  (let ((code-block (org-element-property :name (org-element-at-point)))
(cb (current-buffer)))
(split-window-below)
(other-window 1)
(switch-to-buffer "*My Babel*")
(insert (format "Running %s" code-block))
(other-window 1)
ad-do-it
(kill-buffer "*My Babel*")
(delete-other-windows)))
#+END_SRC

It will mess with your windows a bit, but it does what you want I think.


Gary Oberbrunner  writes:

> I have an org-mode babel program/document that takes about half an
> hour to run (end result is a LaTeX or HTML doc with figures). It's a
> mix of SQL and python. (The SQL is the slow part.) I'd really like it
> if org-mode could tell me, while it's running, which named block it's
> processing. Is there anything like that available? An option perhaps?

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



Re: [O] progress indicator for code blocks?

2014-09-02 Thread John Kitchin
No, it does not seem to work for me. C-g kills the current evaluation
for me.

Rainer M Krug  writes:

> Thanks for this snippet - I think something along these lines should be
> included into org out-of-the-box. 
>
> There are many cases where I simply use C-g to go back to emacs while
> the evaluation is still running - would your snippet still work?
>
> Rainer
>
>
> John Kitchin  writes:
>
>> John Kitchin  writes:
>>
>> I am currently using this bit of advice to change the color of code
>> blocks while they are being executed so there is a visual hint something
>> is happening.
>>
>> ;; give us some hint we are running
>> (defadvice org-babel-execute-src-block (around progress nil activate)
>>   (set-face-attribute
>>'org-block-background nil :background "LightSteelBlue")
>>   (message "Running your code block")
>>   ad-do-it
>>   (set-face-attribute 'org-block-background nil :background "gray")
>>   (message "Done with code block"))
>>
>>
>>> Hi all,
>>> I am using org-mode in a class, and some students wondered if it was
>>> possible for there to be a progress bar of some kind while a code block
>>> is running. Right now Emacs just appears to lock up and there is no
>>> indication anything is happening, especially the first time we run a
>>> python block.
>>>
>>> I found make-progress-reporter and tried something like this::
>>>
>>> #+BEGIN_SRC emacs-lisp
>>> (defadvice org-babel-execute-src-block (around progress nil activate)
>>>   (let ((pr (make-progress-reporter "Running")))
>>> ad-do-it
>>>     (progress-reporter-done pr)))
>>> #+END_SRC
>>>
>>> but there is no way to update it, so it doesn't quite do anything
>>> useful.
>>>
>>> What I would really like is an hourglass or some spinning thing. Does
>>> anyone know how to get that (in a cross-platform way)?

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



Re: [O] Babel more verbose?

2014-09-02 Thread John Kitchin
Nick Dokos  writes:

I found a message is not sufficient because I get another message from
running the code block that looks like:

Wrote
/var/folders/5q/lllv2yf95hg_n6h6kjttbmdwgn/T/babel-27354lYd/ob-input-27354uxF

and it obscures the first message so you cannot tell what is happening.

Here is a another approach that simply puts an overlay to change the
color of the text in the code block while running.

#+BEGIN_SRC emacs-lisp
(defadvice org-babel-execute-src-block (around progress nil activate)
  "create a buffer indicating what is running"
  (let ((ol (make-overlay (org-element-property :begin (org-element-at-point))
  (org-element-property :end (org-element-at-point)

(overlay-put ol 'face '(foreground-color . "blue"))

ad-do-it

(delete-overlay ol)))
#+END_SRC



> John Kitchin  writes:
>
>> Try this:
>>
>> #+BEGIN_SRC emacs-lisp
>> (defadvice org-babel-execute-src-block (around progress nil activate)
>>   "create a buffer indicating what is running"
>>   (let ((code-block (org-element-property :name (org-element-at-point)))
>>  (cb (current-buffer)))
>> (split-window-below)
>> (other-window 1)
>> (switch-to-buffer "*My Babel*")
>> (insert (format "Running %s" code-block))
>> (other-window 1)
>> ad-do-it
>> (kill-buffer "*My Babel*")
>> (delete-other-windows)))
>> #+END_SRC
>>
>> It will mess with your windows a bit, but it does what you want I think.
>>
>
> Wouldn't a (message (format "Running %s" code-block)) be enough?
> That would avoid all the window munging.
>
>>
>> Gary Oberbrunner  writes:
>>
>>> I have an org-mode babel program/document that takes about half an
>>> hour to run (end result is a LaTeX or HTML doc with figures). It's a
>>> mix of SQL and python. (The SQL is the slow part.) I'd really like it
>>> if org-mode could tell me, while it's running, which named block it's
>>> processing. Is there anything like that available? An option perhaps?
>
> --
> Nick
>
>
>

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



[O] help debugging latex-overlays boxes

2014-09-05 Thread John Kitchin
Hi All,

I am using org-mode in a course this fall with 60 students.  All of them
are using org-mode from elpa. For about 10 of them, they are unable to
toggle the latex-overlays; instead of getting the equations, they get
empty gray boxes with an error that the png file was not created.  Oddly
enough, they can export to PDF just fine. I have also checked that they
have LaTeX (TeXLive) installed, and it appears it is. I am able to
convert tex files to dvi, and then use dvipng to make a png image. But
for some reason, the toggle-latex-overlay function does not work for
them.

I am at a loss to figure out what the issue is. These are Windows
laptops that were preconfigured by the department. Almost all of them
work fine, except for this small number I cannot figure out.

Any ideas? Thanks,


-- 
---
John Kitchin
http://kitchingroup.cheme.cmu.edu




Re: [O] help debugging latex-overlays boxes

2014-09-05 Thread John Kitchin
Nick Dokos  writes:

Thanks for the tips. It is possible minted is the culprit. I will give
that a try, and the other ideas too. I am sure it is using dvipng, and
that it works. It will be a nice adventure in more sophisticated
debugging ;)

> John Kitchin  writes:
>
>> Hi All,
>>
>> I am using org-mode in a course this fall with 60 students.  All of them
>> are using org-mode from elpa. For about 10 of them, they are unable to
>> toggle the latex-overlays; instead of getting the equations, they get
>> empty gray boxes with an error that the png file was not created.  Oddly
>> enough, they can export to PDF just fine. I have also checked that they
>> have LaTeX (TeXLive) installed, and it appears it is. I am able to
>> convert tex files to dvi, and then use dvipng to make a png image. But
>> for some reason, the toggle-latex-overlay function does not work for
>> them.
>>
>> I am at a loss to figure out what the issue is. These are Windows
>> laptops that were preconfigured by the department. Almost all of them
>> work fine, except for this small number I cannot figure out.
>>
>> Any ideas? Thanks,
>
> I would edebug-defun the function org-create-formula-image and step
> through it to make sure that it goes the way you want (are you sure you
> are using the dvipng method on these machines? maybe you are using the
> imagemagick method but the program has not been installed?  Check the
> value of org-latex-create-formula-image-program).
>
> While you are stepping you can also check the variables in the function
> and see e.g. what the output file name is.
>
> If that goes OK, then I would edebug-defun
> org-create-formula-image-with-dvipng next and check the latex input file
> it produces. Make sure that things like minted which require
> --shell-escape are *not* included in that input file: it's processed by
> a hard-wired call to latex (without --shell-escape) , so minted will
> cause a failure. If that is the case, check org-latex-packages-alist and
> make sure that minted's snippet-flag is nil.
>
> HTH,
> Nick
>
>
>

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



Re: [O] help debugging latex-overlays boxes

2014-09-09 Thread John Kitchin
Nick Dokos  writes:

I have traced my problem. The issue is in the function
org-preview-latex-fragment. At the end of the function, where it calls
org-format-latex, the default-directory variable that is used in the
function call has a value of
"c:/Users/YUYUA~1/AppData/Local/Temp/ltxpng/mole-balance"

The YUYUA~1 is causing the problem.

I do not understand why the full path, "c:/Users/Yuyu
Yao/AppData/Local/Temp" is not showing up here. When I examine the
default-directory variable in a buffer in that directory, that is what
comes up. It is only inside the org function it gets chomped to what
looks like an old DOS format.

Anyway, latex cannot handle that path, so no dvi is produced, and no
image.

otherwise the latex file is produced, and it compiles fine with the full
path. Any ideas on how to fix that? Thanks,

> John Kitchin  writes:
>
>> Hi All,
>>
>> I am using org-mode in a course this fall with 60 students.  All of them
>> are using org-mode from elpa. For about 10 of them, they are unable to
>> toggle the latex-overlays; instead of getting the equations, they get
>> empty gray boxes with an error that the png file was not created.  Oddly
>> enough, they can export to PDF just fine. I have also checked that they
>> have LaTeX (TeXLive) installed, and it appears it is. I am able to
>> convert tex files to dvi, and then use dvipng to make a png image. But
>> for some reason, the toggle-latex-overlay function does not work for
>> them.
>>
>> I am at a loss to figure out what the issue is. These are Windows
>> laptops that were preconfigured by the department. Almost all of them
>> work fine, except for this small number I cannot figure out.
>>
>> Any ideas? Thanks,
>
> I would edebug-defun the function org-create-formula-image and step
> through it to make sure that it goes the way you want (are you sure you
> are using the dvipng method on these machines? maybe you are using the
> imagemagick method but the program has not been installed?  Check the
> value of org-latex-create-formula-image-program).
>
> While you are stepping you can also check the variables in the function
> and see e.g. what the output file name is.
>
> If that goes OK, then I would edebug-defun
> org-create-formula-image-with-dvipng next and check the latex input file
> it produces. Make sure that things like minted which require
> --shell-escape are *not* included in that input file: it's processed by
> a hard-wired call to latex (without --shell-escape) , so minted will
> cause a failure. If that is the case, check org-latex-packages-alist and
> make sure that minted's snippet-flag is nil.
>
> HTH,
> Nick
>
>
>

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



Re: [O] help debugging latex-overlays boxes

2014-09-09 Thread John Kitchin
The issue seems to finally be the value of temporary-file-directory,
which is defined in C-source, and I think that is where the ~1 comes
from. I have a workaround solution, which is to set the
temproary-file-directory variable this way:

(setq temporary-file-directory (expand-file-name "~/../Local/Temp"))

which gives it a full path.

It is pretty odd. There are about 50 students with nominally the same
computers in this class, but this issue seems to only affect about 20%
of them!

John Kitchin  writes:

> Nick Dokos  writes:
>
> I have traced my problem. The issue is in the function
> org-preview-latex-fragment. At the end of the function, where it calls
> org-format-latex, the default-directory variable that is used in the
> function call has a value of
> "c:/Users/YUYUA~1/AppData/Local/Temp/ltxpng/mole-balance"
>
> The YUYUA~1 is causing the problem.
>
> I do not understand why the full path, "c:/Users/Yuyu
> Yao/AppData/Local/Temp" is not showing up here. When I examine the
> default-directory variable in a buffer in that directory, that is what
> comes up. It is only inside the org function it gets chomped to what
> looks like an old DOS format.
>
> Anyway, latex cannot handle that path, so no dvi is produced, and no
> image.
>
> otherwise the latex file is produced, and it compiles fine with the full
> path. Any ideas on how to fix that? Thanks,
>
>> John Kitchin  writes:
>>
>>> Hi All,
>>>
>>> I am using org-mode in a course this fall with 60 students.  All of them
>>> are using org-mode from elpa. For about 10 of them, they are unable to
>>> toggle the latex-overlays; instead of getting the equations, they get
>>> empty gray boxes with an error that the png file was not created.  Oddly
>>> enough, they can export to PDF just fine. I have also checked that they
>>> have LaTeX (TeXLive) installed, and it appears it is. I am able to
>>> convert tex files to dvi, and then use dvipng to make a png image. But
>>> for some reason, the toggle-latex-overlay function does not work for
>>> them.
>>>
>>> I am at a loss to figure out what the issue is. These are Windows
>>> laptops that were preconfigured by the department. Almost all of them
>>> work fine, except for this small number I cannot figure out.
>>>
>>> Any ideas? Thanks,
>>
>> I would edebug-defun the function org-create-formula-image and step
>> through it to make sure that it goes the way you want (are you sure you
>> are using the dvipng method on these machines? maybe you are using the
>> imagemagick method but the program has not been installed?  Check the
>> value of org-latex-create-formula-image-program).
>>
>> While you are stepping you can also check the variables in the function
>> and see e.g. what the output file name is.
>>
>> If that goes OK, then I would edebug-defun
>> org-create-formula-image-with-dvipng next and check the latex input file
>> it produces. Make sure that things like minted which require
>> --shell-escape are *not* included in that input file: it's processed by
>> a hard-wired call to latex (without --shell-escape) , so minted will
>> cause a failure. If that is the case, check org-latex-packages-alist and
>> make sure that minted's snippet-flag is nil.
>>
>> HTH,
>> Nick
>>
>>
>>

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



Re: [O] Managing articles in orgmode and collaboration

2014-09-09 Thread John Kitchin
Thorsten Jolitz  writes:

I use https://github.com/jkitchin/jmax/blob/master/org/doi-utils.org

It is some code I wrote to build bibtex entries from a doi, and to
download the pdf if you have access to it.

I load it like this:
(org-babel-load-file "doi-utils.org")

You need to define some variables like:

org-ref-pdf-directory

and some features depend on org-ref
(https://github.com/jkitchin/jmax/blob/master/org/org-ref.org).

I use these pretty often.


> Christoph Groth  writes:
>
> Hi,
>
>> Any comments?
>
> do you have a function that automatically fetches bibtex entries for
> books from the web, given some info (title, year, author or so)?

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



Re: [O] help debugging latex-overlays boxes

2014-09-09 Thread John Kitchin
Nick Dokos  writes:

> John Kitchin  writes:
>
>> Nick Dokos  writes:
>>
>> I have traced my problem. The issue is in the function
>> org-preview-latex-fragment. At the end of the function, where it calls
>> org-format-latex, the default-directory variable that is used in the
>> function call has a value of
>> "c:/Users/YUYUA~1/AppData/Local/Temp/ltxpng/mole-balance"
>>
>> The YUYUA~1 is causing the problem.
>>
>
> My (perhaps naive) expectation would be that "YuYu Yao" would become
> "YUYUYA~1", deleting the space, turning the string to upper case,
> keeping the first six characters and adding the "~1" suffix. Why is the
> last "Y" not there? If it *were* there, would the latex invocation
> work?  I believe (quite without any evidence) that it should.

I don't think it would work. the Space is also not the issue, as it
affects some users with no spaces. This is for some reason, like a
partial dos 8.3 filename (http://en.wikipedia.org/wiki/8.3_filename). I
still do not know why it happens, but setting the
temporary-file-directory in the init.el solves the problem, e.g.:

(setq temporary-file-directory "c:/some/full/path")

>
>> I do not understand why the full path, "c:/Users/Yuyu
>> Yao/AppData/Local/Temp" is not showing up here. When I examine the
>> default-directory variable in a buffer in that directory, that is what
>> comes up. It is only inside the org function it gets chomped to what
>> looks like an old DOS format.
>>
>> Anyway, latex cannot handle that path, so no dvi is produced, and no
>> image.
>>
>> otherwise the latex file is produced, and it compiles fine with the full
>> path. Any ideas on how to fix that? Thanks,
>>
>>> John Kitchin  writes:
>>>
>>>> Hi All,
>>>>
>>>> I am using org-mode in a course this fall with 60 students.  All of them
>>>> are using org-mode from elpa. For about 10 of them, they are unable to
>>>> toggle the latex-overlays; instead of getting the equations, they get
>>>> empty gray boxes with an error that the png file was not created.  Oddly
>>>> enough, they can export to PDF just fine. I have also checked that they
>>>> have LaTeX (TeXLive) installed, and it appears it is. I am able to
>>>> convert tex files to dvi, and then use dvipng to make a png image. But
>>>> for some reason, the toggle-latex-overlay function does not work for
>>>> them.
>>>>
>>>> I am at a loss to figure out what the issue is. These are Windows
>>>> laptops that were preconfigured by the department. Almost all of them
>>>> work fine, except for this small number I cannot figure out.
>>>>
>>>> Any ideas? Thanks,
>>>
>>> I would edebug-defun the function org-create-formula-image and step
>>> through it to make sure that it goes the way you want (are you sure you
>>> are using the dvipng method on these machines? maybe you are using the
>>> imagemagick method but the program has not been installed?  Check the
>>> value of org-latex-create-formula-image-program).
>>>
>>> While you are stepping you can also check the variables in the function
>>> and see e.g. what the output file name is.
>>>
>>> If that goes OK, then I would edebug-defun
>>> org-create-formula-image-with-dvipng next and check the latex input file
>>> it produces. Make sure that things like minted which require
>>> --shell-escape are *not* included in that input file: it's processed by
>>> a hard-wired call to latex (without --shell-escape) , so minted will
>>> cause a failure. If that is the case, check org-latex-packages-alist and
>>> make sure that minted's snippet-flag is nil.
>>>
>
> --
> Nick
>
>
>
>
>

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



Re: [O] org-ref "no key found"

2014-09-13 Thread John Kitchin
 Year = {2011},
>
>   Crossref = {burnhm},
>   File = {:Brown2011a.pdf:PDF},
>   Publisher= {Wiley Online Library}
> }
>
> @Article{Hobbs2006,
>   Title= {Alternatives to statistical hypothesis testing 
> in ecology: a guide to self teaching},
>   Author   = {Hobbs, N.T. and Hilborn, R.},
>   Journaltitle = {Ecological Applications},
>   Year         = {2006},
>   Number   = {1},
>   Pages= {5--19},
>   Volume   = {16},
>
>   Crossref = {Quick2010},
>   File = {:Hobbs2006.pdf:PDF},
>   Publisher= {Eco Soc America}
> }
>
> --End trial.bib file 
> -
>
>
>
>
>> Julian M. Burgos writes:
>>
>>> John, for some weird reason everything seems to be working now.  Thanks
>>> for your help... I will let you know if I break it again.
>>>
>>> John Kitchin writes:
>>>
>>>> that is odd. this means org-ref is not finding the key you clicked
>>>> on. could you send me a small example that reproduces your problem (an
>>>> org-file and the bib file)?
>>>>
>>>> "Julian M. Burgos"  writes:
>>>>
>>>>> Hi John, 
>>>>>
>>>>> No, they still do not work even after I click on the bibliography link
>>>>> and get my .bib file opened.
>>>>>
>>>>> Julian
>>>>>
>>>>> John Kitchin writes:
>>>>>
>>>>>> "Julian M. Burgos"  writes:
>>>>>>
>>>>>> If you click on the bibliography link to open the file, and then go back
>>>>>> to your org-file, do the cite links work?
>>>>>>
>>>>>> I suspect the notes problem is related to the no key found problem.
>>>>>>
>>>>>>> Hello everyone,
>>>>>>>
>>>>>>> I am playing around with Joh Kitchin's excellent org-ref, and I am
>>>>>>> having a few issues.  In my .emacs file I have set up the values for the
>>>>>>> org-ref-bibliography-notes, org-ref-default-bibliography, and
>>>>>>> org-ref-pdf-directory.
>>>>>>>
>>>>>>> With this I can access my .bib database and use org-ref-insert-cite link
>>>>>>> to add a citation link with no problems.  But when I press enter on the
>>>>>>> cite link, I get the following message:
>>>>>>>
>>>>>>> no key found
>>>>>>>  (No key found) (p)df (u)rl (n)otes (q) quit
>>>>>>>
>>>>>>> If I press "p" I get the pdf file, but if I press "n" I get the
>>>>>>> following message: 
>>>>>>>
>>>>>>> "Wrong type argument: stringp, nil".
>>>>>>>
>>>>>>> Any ideas how to solve this?
>>>>>>>
>>>>>>> Many thanks,
>>>>>>>
>>>>>>> Julian

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



Re: [O] emailing agenda view

2014-09-14 Thread John Kitchin
Ken  writes:


Here is a function to email the buffer:

(defun email-buffer ()
  "Send region as the body of an email."
  (interactive)
  (let ((content (buffer-string)))
(compose-mail)
(message-goto-body)
(insert content)
(message-goto-to)))

Just run that from your agenda, and then fill in email addresses and
subject, and send.

> Is there anyway to email the agenda view to a list f recipients?
>
> Thank you,
> Ken
>
> --
> You will be divorced within a year.
>
>

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



Re: [O] org-ref "no key found"

2014-09-15 Thread John Kitchin

If you look in your messages do you see something like jit-lock errors?
I do not recall exactly what the errors are but the ones I have seen
that resemble what you describe have jit in them. 

I saw this recently in an ELPA version (maybe around Sept 1), and it went away 
when I updated
the ELPA org version to the most recent one.


"Julian M. Burgos"  writes:

> John, another issue...a really minor one, and I am not sure if it is
> org-ref related.  When I open the notes file, the org faces are not
> applied evenly.  In particular, 
>
> a) Text after #TITLE: or #AUTHOR appears as regular text.  If I use M-x
> describe face, I get "default".  If modify in any way the face changes
> to "org-document-info" as it should be.
>
> b) Within the heading of each reference, the "TODO" statement appears
> with the same face as the rest of the heading (org-level-2 face).
>
> c) Links to pdf files appear like this, with default face:
>  
> [[cite:Collie2000]] [[file:/home/julian/Documents/Refs/Collie2000.pdf][pdf]]
>
> And not as clickable links 
> cite:Collie2000 pdf (underlined, in blue, with org-link face)
>
> Again, as soon as I change anything the org-link face is applied and I
> get a clickable link.
>
> Of all this, the pdf links are the real issue, as they are
> non-functional until I edit them.
>
> Strangely, :PROPERTIES: and :END: appear in their correct face.  Also,
> if I "fix" the faces (editing the text or pressing enter so I get the
> right faces) and close the notes files, I get the same wriong faces when I
> reopen the file.
>
> Does this makes sense?  Do you know what could be the issue?
> Many thanks again,
>
> Julian
>
>
> Julian M. Burgos writes:
>
>> Excellent! Many thanks... now it works like a charm.
>>
>> John Kitchin writes:
>>
>>> No problem. Thanks for the tips to replicate this. It was pretty helpful
>>> in solving the problem (and thanks again to Nick who pointed me towards
>>> edebug-defun a while ago!)
>>>
>>> I think I have fixed this. The problem was org-ref was not finding a key
>>> that exists in a file. the way that is done all over org-ref is to
>>> insert the contents of the bibfile in temp buffer, and then use
>>> bibtex-search-entry on that buffer. It works like a charm usually, but
>>> not in the replicated steps you have below. once it works once, though,
>>> it seems to always work. 
>>>
>>> Anyway, I think it is fixed now. there is a new version at
>>> https://github.com/jkitchin/jmax/blob/master/org/org-ref.org
>>>
>>> Thanks for reporting the bug!
>>>
>>> "Julian M. Burgos"  writes:
>>>
>>>> Hi John,
>>>>
>>>> I am resending this... I think it did not went through the previous
>>>> time.
>>>>
>>>> I think I can replicate the org-ref bug now (if it is a bug).  This is
>>>> the situation:
>>>>
>>>> a) If I open emacs, load a file that already has some link, and click on
>>>> the link (or place the cursor on it and press enter) I get the "no key
>>>> found" message and I cannot open the notes file (I get a "Wrong type
>>>> argument: stringp, nil"), although the link to the pdf file works.  If I
>>>> open more than one file, links do not work in any of them.  At this
>>>> point if I check the value of the "org-ref-default-bibliography"
>>>> variable, I get the correct path and filename of my .bib file.
>>>>
>>>> b) If I insert a new citation (using Ctrl-]) in any of the documents,
>>>> links work as they should in all documents (this is, I get the title and
>>>> I can open the notes file).
>>>>>
>>>> I should say that I am not using the org-ref-insert-bibliography-link
>>>> function, because I use biblatex and I prefer to insert the Latex
>>>> \printbibliography command.  But if use it and insert the bibliography
>>>> link, the behaviour does not change.
>>>>
>>>> This is what I have in my .emacs file that is related to RefTex and
>>>> org-ref:
>>>>
>>>> --
>>>> ;; Load RefTex
>>>> (add-hook 'LaTeX-mode-hook 'turn-on-reftex)   ; with AUCTeX LaTeX mode
>>>> (autoload 'reftex-mode "reftex" "RefTeX Minor M

[O] error exporting with reference to table in another file

2014-09-20 Thread John Kitchin
Hi all,

I have this ina n org-file:


#+NAME: anatase-tio2-elisp
#+BEGIN_SRC emacs-lisp :var data=supporting-information.org:TiO2-data
(remove-if-not (lambda (x) (string= "anatase" (nth 1 x))) data)
#+END_SRC

#+RESULTS: anatase-tio2-elisp
| TiO$_2$ | anatase | LDA| -2802.73 | 33.62 |  187.4 |
| TiO$_2$ | anatase | AM05   | -2741.12 | 34.33 | 178.26 |
| TiO$_2$ | anatase | PBEsol | -2763.61 | 34.25 | 178.71 |
| TiO$_2$ | anatase | PBE| -2781.16 | 35.13 | 171.42 |

The code works fine, but when I try to export to a pdf or html I get errors
like:

org-babel-exp processing... [2 times]
org-babel-ref-resolve: Reference 'TiO2-data' not found in this buffer

Here is my org-version:

Org-mode version 8.2.7c (8.2.7c-25-g1faeb4-elpa @ 
/Users/jkitchin/Dropbox/kitchingroup/jmax/elpa/org-20140811/)

Any thoughts on what is causing this? Thanks,



-- 
-------
John Kitchin
http://kitchingroup.cheme.cmu.edu




[O] filter for src-block export question

2014-09-20 Thread John Kitchin
I have noticed that when code blocks have input variables, e.g.

#+tblname: tbl-data
| x | y |
|---+---|
| 1 | 1 |
| 2 | 4 |
| 3 | 9 |

#+BEGIN_SRC python :var data=tbl-data
print data
#+END_SRC

#+RESULTS:
: [[1, 1], [2, 4], [3, 9]]

When I export this, the codeblock shows no indication of what "data" is,
or where it came from. I had hoped to develop a filter that would allow
me to put something like:

language=python
parameters: :var data=tbl-data

in front of the block for an html export. I tried following the example
here: http://orgmode.org/manual/Advanced-configuration.html at the end,
by defining a derived mode. However, it does not appear that the
information is kept in the parse tree.

(src-block (:language python :switches nil :parameters nil :begin 536 :end 578 
:number-lines nil :preserve-indent t :retain-labels t :use-labels t :label-fmt 
nil :hiddenp nil :value print data
 :post-blank 2 :post-affiliated 536 :parent #4))

although if I look at the element at point, it seems to be there:

(src-block (:language python :switches nil :parameters :var
data=tbl-data :begin 536 :end 629 :number-lines nil :preserve-indent t
:retain-labels t :use-labels t :label-fmt nil :hiddenp nil :value print
data  (princ (org-element-at-point))

I am not sure why the :end values are not the same though.

Here is what I was trying to use:

#+BEGIN_SRC emacs-lisp
(defun my-src-block (src-block contents info)
  (message "start-block\n\n%s\n\nend-block" info)
  (concat ""
   (format "[language: %s]" (org-element-property :language src-block))
   (format "\nparameters: %s" (org-element-property :parameters src-block))
   ""
(org-export-format-code-default src-block info)))

(org-export-define-derived-backend 'my-html 'html
  :translate-alist '((src-block . my-src-block)))

(org-export-to-file 'my-html "custom-src-table-export.html")
(browse-url "custom-src-table-export.html")
#+END_SRC

There are two issues with this block:

1. All parameters are listed as nil
2. the code is not syntax highlighted in html at all. 

Any suggestions on how to achieve this? I also want to insert
tablenames, and if the src-block is named to put the name above the
block (for extra gravy, a hyperlink from :var to the source ;).

thanks,

-- 
---
John Kitchin
http://kitchingroup.cheme.cmu.edu




Re: [O] filter for src-block export question

2014-09-21 Thread John Kitchin
To followup on this, I believe there is either a bug or an inconsistency
in the export engine with regards to getting the parameters of a
src-block. Below, I show why it appears there is a bug.

* Bug report for org-mode

Here is a named table
#+tblname: tbl-data
| x | y |
|---+---|
| 1 | 1 |
| 2 | 4 |
| 3 | 9 |

Here is a named src-block with a defined var
#+name: print-table
#+BEGIN_SRC python :var data=tbl-data :results value
return data 
#+END_SRC




#+RESULTS: print-table
| 1 | 1 |
| 2 | 4 |
| 3 | 9 |

Now, we illustrate that the src-block does have :parameters.
#+name: get-properties
#+BEGIN_SRC emacs-lisp
(save-excursion
(re-search-backward "#\\+name: print-table")
(org-element-property :parameters (org-element-at-point)))
#+END_SRC

#+RESULTS: get-properties
: :var data=tbl-data :results value

In the export machinery, though it appears the src-block does not.


#+BEGIN_SRC emacs-lisp :results output
(defun my-src-block (src-block contents info)

  (princ (concat
  (format "[language: %s]\n" (org-element-property :language src-block))
  (format "name: %s\n" (org-element-property :name src-block))
  (format "parameters: %s\n\n" (org-element-property :parameters 
src-block
(org-export-format-code-default src-block info))

(org-export-define-derived-backend 'my-html 'html
  :translate-alist '((src-block . my-src-block)))

(org-export-to-file 'my-html "custom-src-table-export.html")
#+END_SRC
#+RESULTS:
#+begin_example
[language: python]
name: print-table
parameters: nil

[language: emacs-lisp]
name: get-properties
parameters: nil

[language: emacs-lisp]
name: nil
parameters: nil

#+end_example

You can see the parameters are nil in each case, even though we know the
print-table block does have parameters.

I do not know where the parameters get lost, so I am reporting the issue here.


John Kitchin  writes:

> I have noticed that when code blocks have input variables, e.g.
>
> #+tblname: tbl-data
> | x | y |
>
> |---+---|
> | 1 | 1 |
> | 2 | 4 |
> | 3 | 9 |
>
> #+BEGIN_SRC python :var data=tbl-data
> print data
> #+END_SRC
>
>
> #+RESULTS:
> : [[1, 1], [2, 4], [3, 9]]
>
> When I export this, the codeblock shows no indication of what "data" is,
> or where it came from. I had hoped to develop a filter that would allow
> me to put something like:
>
> language=python
> parameters: :var data=tbl-data
>
> in front of the block for an html export. I tried following the example
> here: http://orgmode.org/manual/Advanced-configuration.html at the end,
> by defining a derived mode. However, it does not appear that the
> information is kept in the parse tree.
>
> (src-block (:language python :switches nil :parameters nil :begin 536
> :end 578 :number-lines nil :preserve-indent t :retain-labels t
> :use-labels t :label-fmt nil :hiddenp nil :value print data
>  :post-blank 2 :post-affiliated 536 :parent #4))
>
> although if I look at the element at point, it seems to be there:
>
> (src-block (:language python :switches nil :parameters :var
> data=tbl-data :begin 536 :end 629 :number-lines nil :preserve-indent t
> :retain-labels t :use-labels t :label-fmt nil :hiddenp nil :value print
> data  (princ (org-element-at-point))
>
> I am not sure why the :end values are not the same though.
>
> Here is what I was trying to use:
>
> #+BEGIN_SRC emacs-lisp
> (defun my-src-block (src-block contents info)
>   (message "start-block\n\n%s\n\nend-block" info)
>   (concat ""
>(format "[language: %s]" (org-element-property :language src-block))
>(format "\nparameters: %s" (org-element-property :parameters src-block))
>""
> (org-export-format-code-default src-block info)))
>
> (org-export-define-derived-backend 'my-html 'html
>   :translate-alist '((src-block . my-src-block)))
>
> (org-export-to-file 'my-html "custom-src-table-export.html")
> (browse-url "custom-src-table-export.html")
> #+END_SRC
>
> There are two issues with this block:
>
> 1. All parameters are listed as nil
> 2. the code is not syntax highlighted in html at all. 
>
> Any suggestions on how to achieve this? I also want to insert
> tablenames, and if the src-block is named to put the name above the
> block (for extra gravy, a hyperlink from :var to the source ;).
>
> thanks,

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



[O] update on missing :parameters in code blocks

2014-09-21 Thread John Kitchin
I did some more digging on the missing :parameters during export, and it
seems that the src block itself is different during export than in the
buffer.  Below illustrates what I mean. In the buffer, if I look at the
contents of the code block using output from org-element-at-point, it
looks as I expect, with the complete header. But, using the same method
in the export, it is clear that the header args are not there.

I have not figured out where they disappear yet.

* Bug report 2 for org-mode

Here is a named table
#+tblname: tbl-data
| x | y |
|---+---|
| 1 | 1 |
| 2 | 4 |
| 3 | 9 |

Here is a named src-block with a defined var
#+name: print-table
#+BEGIN_SRC python :var data=tbl-data :results value
return data 
#+END_SRC


Now, we illustrate that the src-block does have :parameters.
#+name: get-properties
#+BEGIN_SRC emacs-lisp
(save-excursion
  (re-search-backward "#\\+name: print-table")
  (buffer-substring
   (org-element-property :begin (org-element-at-point))
   (org-element-property :end (org-element-at-point
#+END_SRC

#+RESULTS: get-properties
: #+name: print-table
: #+BEGIN_SRC python :var data=tbl-data :results value
: return data 
: #+END_SRC
: 
: 

In the export machinery, though it appears the src-block is not the same.

#+BEGIN_SRC emacs-lisp :results output :exports none
(defun my-src-block (src-block contents info)

  (princ (buffer-substring
  (org-element-property :begin src-block)
  (org-element-property :end src-block)))
  
(org-export-format-code-default src-block info))

(org-export-define-derived-backend 'my-html 'html
  :translate-alist '((src-block . my-src-block)))

(org-export-to-file 'my-html "custom-src-table-export.html")
#+END_SRC
#+RESULTS:
#+begin_example
#+name: print-table
#+BEGIN_SRC python
return data 
#+END_SRC


#+name: get-properties
#+BEGIN_SRC emacs-lisp
(save-excursion
  (re-search-backward "#\\+name: print-table")
  (buffer-substring
   (org-element-property :begin (org-element-at-point))
   (org-element-property :end (org-element-at-point
#+END_SRC

#+end_example

The parameters seem to be gone in the python block.

-- 
---
John Kitchin
http://kitchingroup.cheme.cmu.edu




Re: [O] update on missing :parameters in code blocks

2014-09-22 Thread John Kitchin
Aaron Ecay  writes:

Thanks for the confirmation this happens, and the pointer to where it
happens.

I guess there was at one point a good reason to do this, but I cannot
see it directly.

I found a way to do it with filters and preprocessing, which is
illustrated here:

http://kitchingroup.cheme.cmu.edu/blog/2014/09/22/Showing-what-data-went-into-a-code-block-on-export/

It works, but I feel like it is a workaround that should not be
needed. It does look like some effort to change this, and first it would
be good to know why the modification is being done.

Thanks again for the hints.



> Hi John,
>
> Look at the functions ‘org-babel-exp-src-block’ which calls
> ‘org-babel-exp-do-export’, which calls ‘org-babel-exp-code’.  The tl;dr
> version is that indeed the babel export machinery does change the code
> block in substantial ways, including the removal of parts of it.
>
> This plays merry hell with the cache mechanism, as you might imagine
> (different header args at different points -> the sha1 hash changes).  A
> year or more ago I worked on a patch to overhaul this system.  I got
> partway through before giving up, because it turned into a massive
> undertaking and because it became clear that the cache mechanism would
> not be very reliable/useful for my needs anyway.  But IMHO it remains an
> imperfection in the interface between babel and the new parser, and it
> might be possible to avoid the necessity of doing this sort of
> destructive modification during export.  Along the way simplification of
> the code might also be possible.
>
> Let me know if you’re interested; I may be able to dig the old
> half-patch out of a disused git branch somewhere.  It may have bitrotted
> some, but it may also be useful.

-- 
---
John Kitchin
http://kitchingroup.cheme.cmu.edu



Re: [O] update on missing :parameters in code blocks

2014-09-22 Thread John Kitchin
Charles Berry  writes:

Thanks for the tips. I did not see a way to do the advice here. For what
I need, we need to save parameters for each code block. But it appears
they are all affected by one function org-babel-exp-process-buffer, and
advising this kind of function is tantamount to rewriting the function!

my solution is here:
http://kitchingroup.cheme.cmu.edu/blog/2014/09/22/Showing-what-data-went-into-a-code-block-on-export/

I agree it would be nice if that was unnecessary, but it is not too
terrible for now. 


> John Kitchin  andrew.cmu.edu> writes:
>
>> 
>> I did some more digging on the missing :parameters during export, and it
>> seems that the src block itself is different during export than in the
>> buffer.  Below illustrates what I mean. In the buffer, if I look at the
>> contents of the code block using output from org-element-at-point, it
>> looks as I expect, with the complete header. But, using the same method
>> in the export, it is clear that the header args are not there.
>> 
>> I have not figured out where they disappear yet.
>> 
> [snip]
>
> Instrument org-export-as. Then step thru it.
>
> Before this line:
>  
>  (org-export-execute-babel-code)
>
> the buffer copy ( my-buffer<2>, say ) will show the parameters/headers.
>
> After that line is executed, they are gone.
>
> You can work around this by `advicing' various babel functions and inserting
> things you want to save as attributes, but it would be nice not to need
> to do that.
>
> HTH,
>
> Chuck
>
>
>
>
>

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



Re: [O] update on missing :parameters in code blocks

2014-09-22 Thread John Kitchin
Nicolas Goaziou  writes:

Thanks for the clarification. Is there any chance you know why this
transformation is done? Does it avoid some problem?

> Hello,
>
> John Kitchin  writes:
>
>> Thanks for the tips. I did not see a way to do the advice here. For what
>> I need, we need to save parameters for each code block. But it appears
>> they are all affected by one function org-babel-exp-process-buffer, and
>> advising this kind of function is tantamount to rewriting the
>> function!
>
> Actually, this is not related to this function, which is but a big
> dispatcher. Block transformation happens at a lower level (e.g.,
> `org-babel-exp-src-block' and deeper).
>
>
> Regards,

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



Re: [O] error exporting with reference to table in another file

2014-09-24 Thread John Kitchin
Thanks for checking. It turns out to be a silly problem that is my
fault. I extracted attachments out of two different PDF files into the
same directory, and both PDF files had an attachment called
supporting-information.org. So the first one is what had the TiO2-data
table, and it got overwritten by the second file.

So, of course, it was missing ;)

Sorry for the noise.

Aaron Ecay  writes:

> Hi John,
>
> 2014ko irailak 20an, John Kitchin-ek idatzi zuen:
>> 
>> Hi all,
>> 
>> I have this ina n org-file:
>> 
>> 
>> #+NAME: anatase-tio2-elisp
>> #+BEGIN_SRC emacs-lisp :var data=supporting-information.org:TiO2-data
>> (remove-if-not (lambda (x) (string= "anatase" (nth 1 x))) data)
>> #+END_SRC
>> 
>> #+RESULTS: anatase-tio2-elisp
>> | TiO$_2$ | anatase | LDA| -2802.73 | 33.62 |  187.4 |
>> | TiO$_2$ | anatase | AM05   | -2741.12 | 34.33 | 178.26 |
>> | TiO$_2$ | anatase | PBEsol | -2763.61 | 34.25 | 178.71 |
>> | TiO$_2$ | anatase | PBE| -2781.16 | 35.13 | 171.42 |
>> 
>> The code works fine, but when I try to export to a pdf or html I get errors
>> like:
>> 
>> org-babel-exp processing... [2 times]
>> org-babel-ref-resolve: Reference 'TiO2-data' not found in this buffer
>> 
>> Here is my org-version:
>> 
>> Org-mode version 8.2.7c (8.2.7c-25-g1faeb4-elpa @
>> /Users/jkitchin/Dropbox/kitchingroup/jmax/elpa/org-20140811/)
>
> FWIW I cannot reproduce this in emacs -Q, even with the same commit checked
> out.  I’m attaching to this message the test files I used, in case anyone
> else wants to try.  I did (setq org-confirm-babel-evaluate nil) before
> doing the export.
>
> #+NAME: anatase-tio2-elisp
> #+BEGIN_SRC emacs-lisp :var data=supporting-information.org:TiO2-data 
> :exports both
>
> data
> #+END_SRC
>
> #+RESULTS: anatase-tio2-elisp
> | TiO$_2$ | anatase | LDA| -2802.73 | 33.62 |  187.4 |
>
> | TiO$_2$ | anatase | AM05   | -2741.12 | 34.33 | 178.26 |
> | TiO$_2$ | anatase | PBEsol | -2763.61 | 34.25 | 178.71 |
> | TiO$_2$ | anatase | PBE| -2781.16 | 35.13 | 171.42 |
>
> #+name: TiO2-data
> | TiO$_2$ | anatase | LDA    | -2802.73 | 33.62 |  187.4 |
>
> | TiO$_2$ | anatase | AM05   | -2741.12 | 34.33 | 178.26 |
> | TiO$_2$ | anatase | PBEsol | -2763.61 | 34.25 | 178.71 |
> | TiO$_2$ | anatase | PBE| -2781.16 | 35.13 | 171.42 |

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



[O] line numbers in a code block?

2014-09-27 Thread John Kitchin
Does anyone know a way to get dedicate line numbers in an org code
block?

I know how to get buffer code lines, but when we run a code block and
there is an error, the error line number is relative to line 1 of the
code block. Currently, we type C-c ' to get a code buffer, and navigate
to the line. I would like to see code block numbers on the right hand
side of the buffer, and only inside the code block. Any ideas?

Thanks,

-- 
---
John Kitchin
http://kitchingroup.cheme.cmu.edu




Re: [O] line numbers in a code block?

2014-09-27 Thread John Kitchin
Charles Berry  writes:

> John Kitchin  andrew.cmu.edu> writes:
>
>> 
>> Does anyone know a way to get dedicate line numbers in an org code
>> block?
>> 
>> I know how to get buffer code lines, but when we run a code block and
>> there is an error, the error line number is relative to line 1 of the
>> code block. Currently, we type C-c ' to get a code buffer, and navigate
>> to the line. I would like to see code block numbers on the right hand
>> side of the buffer, and only inside the code block. Any ideas?
>
> You mean like
>
>(org-add-hook 'org-src-mode-hook 'linum-mode)

No, that is not quite what I need. We already have those line numbers on
the left. I wanted a new set of numbers, only in the src-block, and on
the right so they do not get mixed up with the linum-mode numbers. This
is to avoid having to go into the org-src-mode at all.
>
> only with line numbers on the right side? (linum puts them on the left)
>
> Or did you mean in the org-mode buffer itself? 
>
> Maybe (just a guess) hack `linum-update-window' to reset `line' to 0 
> whenever `(forward-line))'gives you a line that matches `#+begin_src'.

I suppose it would involve creating new overlays the way that linum-mode
does. 

>
>
> HTH,
>
> Chuck
>
>
>

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



Re: [O] line numbers in a code block?

2014-09-27 Thread John Kitchin
I came up with a reasonable solution to this that I think is pretty
nice. It doesn't put linenumbers on the src block, but it does something
even better!

The gist is to write the block to a temporary file, then run pyflakes,
pep8 and pylint on it. The output of those goes into a temporary
org-buffer, with links back to the positions in the code block where the
errors are!

The code is laid out here:
http://kitchingroup.cheme.cmu.edu/blog/2014/09/27/Improved-debugging-of-Python-code-blocks-in-org-mode/

I am going to try it out with my students next week!

j

John Kitchin  writes:

> Does anyone know a way to get dedicate line numbers in an org code
> block?
>
> I know how to get buffer code lines, but when we run a code block and
> there is an error, the error line number is relative to line 1 of the
> code block. Currently, we type C-c ' to get a code buffer, and navigate
> to the line. I would like to see code block numbers on the right hand
> side of the buffer, and only inside the code block. Any ideas?
>
> Thanks,

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



[O] odd/unexpected behavior with Python src blocks

2014-09-28 Thread John Kitchin

* Odd behavior in python src-blocks in org-mode

I found that some code blocks in Python execute due to apparently silent
errors! here is how to reproduce it with a vanilla emacs -q.

#+BEGIN_SRC emacs-lisp
(org-babel-do-load-languages
 'org-babel-load-languages
 '((emacs-lisp . t)
   (python . t)))

(setq org-confirm-babel-evaluate nil)
#+END_SRC

#+RESULTS:

This block should raise an error (and does) because k is not defined.
#+BEGIN_SRC python
def f(y, x):
return k * y

print(f(1, 0))
#+END_SRC

#+RESULTS:

It raises this error.

#+BEGIN_EXAMPLE
Traceback (most recent call last):
  File "", line 4, in 
  File "", line 2, in f
NameError: global name 'k' is not defined
#+END_EXAMPLE

However, this code block actually executes, and gives the wrong answer! If I 
open the source block in Python mode, it does not run without error.

#+BEGIN_SRC python :results output
from scipy.integrate import odeint

def f(y, x):
return k * y

print(odeint(f, 1, [0, 1]))
#+END_SRC

#+RESULTS:
: [[ 1.]
:  [ 1.]]

Here is the correct answer.

#+BEGIN_SRC python :results output
from scipy.integrate import odeint

k = -1
def f(y, x):
return k * y

print(odeint(f, 1, [0, 1]))
#+END_SRC

#+RESULTS:
: [[ 1.]
:  [ 0.36787947]]

I am not sure why this happens, but it seems like incorrect behavior to
me.

-- 
-------
John Kitchin
http://kitchingroup.cheme.cmu.edu




Re: [O] odd/unexpected behavior with Python src blocks

2014-09-29 Thread John Kitchin

In case anyone else is interested, here is a workaround of sorts to
capture stderr in a python block:

https://github.com/jkitchin/pycse/blob/master/pycse/sandbox.py

You use this module to redefine stdout and stderr. You basically run
python like this:

#+BEGIN_SRC emacs-lisp
(setq org-babel-python-command "python -m pycse.sandbox")
#+END_SRC

Then you get this output.

#+BEGIN_SRC python :results output
from scipy.integrate import odeint

#k = -1

def f(y, x):
return -k * y

print(odeint(f, 1, [0, 1]))
#+END_SRC

#+RESULTS:
#+begin_example
sandbox:
---stdout---
[[ 1.]
 [ 1.]]

---stderr---
Traceback (most recent call last):
  File "", line 6, in f
NameError: global name 'k' is not defined
Traceback (most recent call last):
  File "", line 6, in f
NameError: global name 'k' is not defined
Traceback (most recent call last):
  File "", line 6, in f
NameError: global name 'k' is not defined
Traceback (most recent call last):
  File "", line 6, in f
NameError: global name 'k' is not defined


#+end_example

At least until babel captures stderr, this is a way to capture it. It does 
break the nice behavior of making tables output, since it
prints a string. The string could be orgified somewhat, eg

#+STDOUT:


#+STDERR:

I am not sure I will use this routinely, so I am not sure how much I
will put into furhter development.

Instructor account  writes:

> Indeed, this passes by org-babel because stderr is not captured, and
> scipy does what you suggest. I guess this happens inside compiled
> c/Fortran code since there is nothing catching it in the odeint
> python function doing that.
>
> Thanks, I will try to bring it up on the scipy list. 
>
> Aaron Ecay  writes:
>
>> Hi John,
>>
>> 2014ko irailak 28an, John Kitchin-ek idatzi zuen:
>>
>> [...]
>>
>>> I am not sure why this happens, but it seems like incorrect behavior to
>>> me.
>>
>> In the first case, python exits with a non-zero exit code, whereas in
>> the second it exits with a zero code (i.e. successful exit), and prints
>> the matrix-thing [[1.], [1.]] to stdout.  It looks like scipy traps the
>> NameErrors and prints them to stderr, but continues its computation
>> regardless.
>>
>> I’d say babel is performing as desired here, but scipy sadly isn’t
>> reporting its errors in the standard way (by a nonzero exit, which I
>> think would happen automatically if the NameErrors made it to the top
>> level of the stack without being caught).

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



[O] behavior of org-image-actual-size with units in attr_* :width

2014-09-30 Thread John Kitchin
I have set this in my init file

(setq org-image-actual-width '(600))

It works great, unless I use:
#+attr_latex: :width 4in

This makes my images 4 inches wide in LaTeX, but it sets my images to
approximately 4 pixels wide!

I feel like it is worth modifying the regexp that gets the width to
catch these cases and fall back on the variable value when they
exist. Any thoughts?


-- 
---
John Kitchin
http://kitchingroup.cheme.cmu.edu




Re: [O] behavior of org-image-actual-size with units in attr_* :width

2014-10-01 Thread John Kitchin
Nicolas Goaziou  writes:

is it the case that ATTR_HTML width attributes are only in pixels? If
so, that is certainly an easier modification to make, and would solve my
problem (we almost exclusively use attr_latex for that export).

Your comment inspired me to solve it this way:

#+attr_latex: :width 4in :placement [H]
#+attr_org: :width 400
[[./images/batch-multiple.png]]


For inline images, the attr_org is found first, but in latex export it
is ignored and it gets the width there.

Maybe no change is needed at all.


> Hello,
>
> John Kitchin  writes:
>
>> I have set this in my init file
>>
>> (setq org-image-actual-width '(600))
>>
>> It works great, unless I use:
>> #+attr_latex: :width 4in
>>
>> This makes my images 4 inches wide in LaTeX, but it sets my images to
>> approximately 4 pixels wide!
>>
>> I feel like it is worth modifying the regexp that gets the width to
>> catch these cases and fall back on the variable value when they
>> exist. Any thoughts?
>
> I wonder if this kludge makes any sense in the general case. As you
> noticed, units given in a LaTeX attributes line will probably be
> different from pixels.
>
> What about limiting the regexp to ATTR_HTML lines only?
>
>
> Regards,

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



Re: [O] Help on org-export-filter-link-functions

2014-10-04 Thread John Kitchin
Daimrod  writes:

Why don't you just define how the link should be exported in your link
definition?

for example:
https://github.com/jkitchin/jmax/blob/master/org/org-ref.org#the-links

You can see a link that is defined, with different export formats for
different backends.

I am intrigued by your function! It does not seem to work for all types
of links though, for example I tried on on some file links,
e.g. file:bib.bib, and [[file.bib]], but these fall in the (t data)
case. [[file:bib.bib][bibliography]] on the other hand gets handled and
you can access the element properties. 

I tried a similar approach on a table, but it did not work as I
expected. Apparently the next property change puts you in a table-cell,
rather than the parent table.

I too am wondering if there is a defined way to get to the element
properties within a filter function. For example, in this post
http://kitchingroup.cheme.cmu.edu/blog/2014/09/22/Showing-what-data-went-into-a-code-block-on-export/
I concocted a preprocess scheme to get a list of table names, and then a
filter function to put the names in the export on each table. It would
be much more elegant to get it directly from the table element somehow.




> Hi,
>
> I've wrote a simple filter to customize how links are exported in
> latex:
>
> #+BEGIN_SRC
> (defun dmd--latex-bib-link-filter (data backend info)
>   "Convert a bib link to a citation (e.g. bib:foo93 -> \cite{foo93})."
>   (let* ((beg (next-property-change 0 data))
>  (link (if beg (get-text-property beg :parent data
> (cond ((and link
> (org-export-derived-backend-p backend 'latex)
> (string= (org-element-property :type link) "bib"))
>(format "\\cite{%s}" (org-element-property :path link)))
>   ((and link
> (org-export-derived-backend-p backend 'latex)
> (string= (org-element-property :type link) "file")
> (string= (org-element-property :path link) "~/.bib.bib"))
>(format "\\cite{%s}" (org-element-property :search-option link)))
>   (t data
> #+END_SRC
>
> And I was wondering whether there is an easier way to retrieve the org
> properties stored in the text properties of DATA.
>
> Best,

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



Re: [O] Help on org-export-filter-link-functions

2014-10-05 Thread John Kitchin
Rasmus  writes:

hmmm... the sometimes makes me nervous. I found even for links, this
only works sometimes. That doesn't seem reliable to me.

I think extending existing backends
(e.g. http://orgmode.org/manual/Advanced-configuration.html) is probably
more reliable for getting element properties, and approximately the same
amount of work.

I guess it just depends on how significantly you are modifying the
export, and what information you need to modify it. Filters are great
for simple wrapping and regexp based modifications. A derived backend is
better if you need reliable element properties, and a different format
than the default export.


> John Kitchin  writes:
>
>> I too am wondering if there is a defined way to get to the element
>> properties within a filter function.
>
> qNo.  But sometimes you can recover it from the text-properties, if it
> is not a verb, (~·~, =·=).  Her's an example:
>
>   (defun rasmus/get-org-headline-string-element  (headline backend info)
> "Return the org element representation of a headline."
> (let ((prop-point (next-property-change 0 headline)))
>   (and prop-point (plist-get (text-properties-at prop-point headline) 
> :parent

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



Re: [O] auto hiding src blocks upon toggling headers

2014-10-08 Thread John Kitchin
Sorry for the weird from email below. This was from me. I have a
separate email setup in Emacs for a class I am teaching.

Instructor account  writes:

> Adriaan Sticker  writes:
>
> This is not perfect but it seems close:
>
> #+BEGIN_SRC emacs-lisp
> (defun my-hide (state)
>   (message "%s" state)
>   (if (or (eq state 'children)
> (eq state 'subtree))
>   (save-restriction
>   (org-narrow-to-subtree)
>   (org-hide-block-all
>
> (add-hook 'org-cycle-hook 'my-hide)
> #+END_SRC
>
>
>
>
>> Hi all
>>
>> Is there a way to automatically hide a source block when toggling the
>> fold status of the parent header.
>>
>> Currently the hide status is remembered when folding its parent
>> headers but this turned out not to be to practical in my current
>> workflow.
>>
>> Greetings
>>

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



Re: [O] Can org show live charts?

2014-10-21 Thread John Kitchin
I think the answer is sort of. I am no idle timer guru, and this code
would probably not do what you want except for this file. The idea is to
have a named table, use it as a data source in a named code block that
generates the image. Then, make an elisp function that goes to that code
block and run it, and set an idle timer to run the elisp function. I
have this in my init file:

;; refresh images after running a block
(add-hook 'org-babel-after-execute-hook
  (lambda () (org-display-inline-images nil t)))

which refreshes inline images after each execution. This works, but it
might take some tinkering to get your idle time ok. 1 second was much
too low, 5 seconds is not too bad, although there is a notable lag when
the graph is made, and the buffer moves around a bit. there is no error
checking for data in the table, so if it crashes the plotting block, you
get an error.

* "live" graphics in org-mode

#+tblname: tbldata
|   x |   y |
|-+-|
|   1 |   1 |
|   1 |   0 |
|   2 |   4 |
|   3 |   5 |
| 0.2 | 0.3 |


#+RESULTS: make-table-graph
#+BEGIN_SRC org
[[1, 1], [1, 0], [2, 4], [3, 5], [0.2, 0.3]]
[[./live-chart.png]]
#+END_SRC

* Code

#+NAME: make-table-graph
#+BEGIN_SRC python :var data=tbldata :results org
import matplotlib.pyplot as plt
plt.plot([x[0] for x in data], [x[1] for x in data])
plt.savefig('live-chart.png')
print data
print '[[./live-chart.png]]'
#+END_SRC

Now, for the elisp part.

#+BEGIN_SRC emacs-lisp
(defun update-graph ()
  (save-excursion
(goto-char (point-min))
(re-search-forward "#\\+NAME: make-table-graph")
(forward-line 2)
(org-babel-execute-src-block)))

(defvar my-timer nil)

(setq my-timer (run-with-idle-timer
5 ; idle for this many seconds
t ; repeat indefinitely
'update-graph))
#+END_SRC

#+RESULTS:
: [nil 0 5 0 t update-graph nil idle 0]

#+BEGIN_SRC emacs-lisp
(cancel-timer my-timer)
#+END_SRC

Tom  writes:

> Reading the documentation it is not clear for me if live
> charts are supported.
>
> By live chart I mean having a table data and below that
> an inserted image in the buffer which shows the data rendered
> from the table, and the image is updated automatically every time
> the the table is changed (and, say, emacs is idle for a while).
>
> So I'm not talking about exporting, but having the live rendered
> chart image right in the buffer,
>
> Can org do this? I don't see any technical obstacles, but
> I haven't seen this explicitly mentioned in the docs, that's
> why I'm asking.
>
>
>

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



Re: [O] How to get to the link destination?

2014-10-21 Thread John Kitchin
Marcin Borkowski  writes:

that looks like a great way to me!

> Hi all,
>
> as in the subject.  I want to do something /at the destination of the
> link/ the point is at (more precisely: get some text property of that
> place).  This is what I came up with:
>
> (save-excursion
>   (org-open-at-point)
>   (get-text-property (point) :some-property))
>
> Is there a better/faster way, especially knowing that the link is an
> internal one?
>
> Best,

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



Re: [O] How to check whether the headline the point is on has some tag?

2014-10-24 Thread John Kitchin
Marcin Borkowski  writes:


Check the last element of org-heading-components. 

* Headline  :tag1:

#+BEGIN_SRC emacs-lisp
(org-heading-components)
#+END_SRC

#+RESULTS:
| 1 | 1 | nil | nil | Headline | :tag1: |




> Hi list,
>
> I'd like to implement splitting an org file at tagged entries in my
> org-one-to-many library (as requested on the list by Daniel Clemente).
> How do I check whether a specific headline (say, one a point is at) has
> some tag (but not inherited)?
>
> TIA,

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



Re: [O] Previewing chemfig

2014-11-02 Thread John Kitchin
Nicolas Goaziou  writes:

Interestingly, this:

#+LATEX_HEADER: \usepackage{chemfig}


$\chemfig{A-B-[1]C-[3]-D-[7]E-[6]F}$


exports to pdf correctly, but the latex preview is not correct. All the
letters are jumbled on top of each other.

> "Garreau, Alexandre"  writes:
>
>>> Have you tried
>>>
>>>   #+LATEX_HEADER: \usepackage{chemfig}
>>
>> Yes. I think it doesn’t influence the preview system.
>
> It should. Perhaps your Org is outdated.
>
>
> Regards,

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



Re: [O] Previewing chemfig

2014-11-03 Thread John Kitchin
g"Garreau, Alexandre"  writes:

I cannot reproduce this, my math previews work fine. just the chemfig is
messed up.

> On 2014-11-02 at 22:48, John Kitchin wrote:
>> Nicolas Goaziou  writes:
>>
>> Interestingly, this:
>>
>> #+LATEX_HEADER: \usepackage{chemfig}
>>
>>
>> $\chemfig{A-B-[1]C-[3]-D-[7]E-[6]F}$
>>
>>
>> exports to pdf correctly, but the latex preview is not correct. All the
>> letters are jumbled on top of each other.
>
> Ok, I tested again, and found that actually any preview (even without
> chemfig) completely stops working when I add
> « #+LATEX_HEADER:\usepackage{chemfig} », even pure maths. I just get
> little shrinked transparent void rectangles.
>
> I’m on Debian Testing (Jessy) and hence use Org version 7.9.3f (GNU
> Emacs 24.3).
>

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



Re: [O] unlinking links

2014-11-06 Thread John Kitchin
Adam Spiers  writes:

Try this:

(defun unlinkify ()
  "replace an org-link with the path, or description."
  (interactive)
  (let ((eop (org-element-context)))
(when (eq 'link (car eop))
(message "%s" eop)
  (let* ((start (org-element-property :begin eop))
 (end (org-element-property :end eop))
 (contents-begin (org-element-property :contents-begin eop))
 (contents-end (org-element-property :contents-end eop))
 (path (org-element-property :path eop))
 (desc (and contents-begin
contents-end
(buffer-substring contents-begin contents-end
(setf (buffer-substring start end) (or desc path))


> Hi all,
>
> Is it just me or is there no quick way to remove the link from some
> hyperlinked text? If so, please consider this a feature request ;-)
>
> Regards,
> Adam
>

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



Re: [O] Extending the Org syntax by a custom exporter - how to do it?

2014-11-25 Thread John Kitchin
Could you remind us of what you are trying to do? It seems like you may
not necessarily need custom elements (although that could be
useful). For example, you can put a lot of information in properties of
a headline.

You might be interested in this:

http://kitchingroup.cheme.cmu.edu/blog/2014/11/23/Machine-gradable-quizzes-in-emacs+org-modex/

I recently used this is in my class of 58 students (who all used emacs
and org-mode to take a quiz!).


Marcin Borkowski  writes:

> Hello there,
>
> this is close to necromancy, but let me revive this old thread.
>
> On 2014-03-16, at 11:16, Nicolas Goaziou wrote:
>
>> Another, more advanced option, is to use a parse tree filter to create
>> pseudo-types, i.e., element or object types that don't exist in regular
>> Org syntax. See `math-block' type in "ox-latex.el", in particular
>> `org-latex-math-block-tree-filter'.
>
> Now that I actually started work on my exporter, I'd like to investigate
> this further.  The thing is, I'm not sure where to start.  First of all,
> I have a bit old Org-mode (without latex-math-blocks); I guess I'll just
> have to update it (I'll try to do an Elpa update in a minute).  But my
> question is:
>
> 1. Is it a good idea to instrument `org-latex--wrap-latex-math-block'
> for Edebug to learn what's happening?
>
> 2. Is there any other (possibly simpler) instance of pseudo-blocks I
> could study?  It seems to me (from the docstring) that latex-math-blocks
> are a bit tricky; what I'm interested in is more like creating a new
> element similar to e.g. italics.
>
> (Reagrdless of the answer, I'll try with Edebug, but I'm a bit afraid
> that I won't understand what's going on).
>
> Also, if (when?) I "get it", I'm going to describe the process of adding
> a pseudo-object somewhere (I consider my blog, or maybe I could upload
> it to Worg?), so that other people can learn it easier.  But for now, I
> might need help.
>
> Best,

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



Re: [O] Extending the Org syntax by a custom exporter - how to do it?

2014-11-26 Thread John Kitchin
I played around with this a little. Here is a minimal kind of example
with a custom exporter that handles quiz blocks separately. The quiz
block can have some attributes defined that get used in rendering the
HTML. Is this along the lines of what you are trying to do? 

* A custom type

#+BEGIN_EXAMPLE
Example text in a block to make sure it gets handled
#+END_EXAMPLE

Some instructions for the quiz.

#+ATTR_quiz: :points 5 :correct-answer A
#+BEGIN_quiz
test quiz
- [ ] answer A
- [ ] answer B
#+END_quiz


#+BEGIN_SRC emacs-lisp :exports none
(defun my-org-html-export-block (export-block contents info)
  "Transcode a EXPORT-BLOCK element from Org to HTML.
CONTENTS is nil.  INFO is a plist used as a communication
channel. QUIZ blocks are handled separately."

  (cond
   ;; handle our special quiz block
   ((string= (org-element-property :type export-block) "QUIZ")

(format
 "got it: %s points, correct answer = %s 

You would have to parse the body to generate your html here.

%s"
 (plist-get 
  (read (format "%s" (org-element-property :attr_quiz export-block)))
 :points)
 (plist-get 
  (read (format "%s" (org-element-property :attr_quiz export-block)))
 :correct-answer)
 (org-element-property :value export-block)
 ))
   ;; handle every other kind of block
   (t
(org-html-export-block (export-block contents info)

(org-export-define-derived-backend 'my-html 'html
  :translate-alist '((export-block . my-org-html-export-block))
  ;; quiz blocks will not be parsed, they are handled directly in 
org-html-export-block.
  :export-block "quiz"
)


(browse-url (org-export-to-file 'my-html "custom-element.html"))
#+END_SRC

#+RESULTS:
: #






John Kitchin  writes:

> Could you remind us of what you are trying to do? It seems like you may
> not necessarily need custom elements (although that could be
> useful). For example, you can put a lot of information in properties of
> a headline.
>
> You might be interested in this:
>
> http://kitchingroup.cheme.cmu.edu/blog/2014/11/23/Machine-gradable-quizzes-in-emacs+org-modex/
>
> I recently used this is in my class of 58 students (who all used emacs
> and org-mode to take a quiz!).
>
>
> Marcin Borkowski  writes:
>
>> Hello there,
>>
>> this is close to necromancy, but let me revive this old thread.
>>
>> On 2014-03-16, at 11:16, Nicolas Goaziou wrote:
>>
>>> Another, more advanced option, is to use a parse tree filter to create
>>> pseudo-types, i.e., element or object types that don't exist in regular
>>> Org syntax. See `math-block' type in "ox-latex.el", in particular
>>> `org-latex-math-block-tree-filter'.
>>
>> Now that I actually started work on my exporter, I'd like to investigate
>> this further.  The thing is, I'm not sure where to start.  First of all,
>> I have a bit old Org-mode (without latex-math-blocks); I guess I'll just
>> have to update it (I'll try to do an Elpa update in a minute).  But my
>> question is:
>>
>> 1. Is it a good idea to instrument `org-latex--wrap-latex-math-block'
>> for Edebug to learn what's happening?
>>
>> 2. Is there any other (possibly simpler) instance of pseudo-blocks I
>> could study?  It seems to me (from the docstring) that latex-math-blocks
>> are a bit tricky; what I'm interested in is more like creating a new
>> element similar to e.g. italics.
>>
>> (Reagrdless of the answer, I'll try with Edebug, but I'm a bit afraid
>> that I won't understand what's going on).
>>
>> Also, if (when?) I "get it", I'm going to describe the process of adding
>> a pseudo-object somewhere (I consider my blog, or maybe I could upload
>> it to Worg?), so that other people can learn it easier.  But for now, I
>> might need help.
>>
>> Best,

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



Re: [O] How to view everything DONE today?

2014-11-26 Thread John Kitchin
I am not sure how to do this through the agenda, but here is a way to
find headlines in the current file that were closed today. You could
wrap this in a loop over the files in your agenda list. It is a little
clumsy on the time comparisons but it works ;)

* Getting items done today

** DONE item 1
   CLOSED: [2014-11-26 Wed 13:09] DEADLINE: <2014-11-26 Wed>



** DONE item 2
   CLOSED: [2014-11-25 Tue 13:09] DEADLINE: <2014-11-26 Wed>


** Mapping entries to find what closed today.

First, we look at a timestamp comparison function. 
#+BEGIN_SRC emacs-lisp
(org-time= "<2014-11-26 Wed>" "<2014-11-26 Wed>")
#+END_SRC

#+RESULTS:
: t

#+BEGIN_SRC emacs-lisp
(org-map-entries
  (lambda ()
(let* ((closed (org-entry-get (point) "CLOSED"))
   (today (format-time-string "<%Y-%m-%d>")))
  (when closed
(when
(org-time=
 today
 (let ((parts (org-parse-time-string closed)))
   (format "<%s-%s-%s>"
   (nth 5 parts) ; year
   (nth 4 parts) ; month
   (nth 3 parts) ; day
   )))
  (message-box "Found a closed task: %s"
   (org-heading-components)))
 
#+END_SRC

#+RESULTS:
| nil | Found a closed task: (2 2 DONE nil item 1 nil) | nil | nil |




Sascha Ziemann  writes:

> Hi,
>
> I tried to get a list of all items done today. I tried to open the
> agenda view but is does not show anything. What is the right command
> to see the items done today?
>
> Regards,
> Sascha
>

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



Re: [O] How to view everything DONE today?

2014-11-27 Thread John Kitchin
try (org-read-date)? It seems to return a string after you select the date.

#+BEGIN_SRC emacs-lisp
(org-read-date)
#+END_SRC

#+RESULTS:
: 2014-11-28




Sascha Ziemann  writes:

> This:
>
> http://jcardente.blogspot.de/2010/06/org-mode-hack-tasks-done-last-month.html
>
> inspired my to do this:
>
> (defun org-done-view (&optional offset)
> "Shows all TODOs, which are done."
> (interactive "nOffset: ")
> (let ((offset (or offset 0)))
> (let ((t0 (calendar-current-date offset))
> (t1 (calendar-current-date (+ offset 1
> (org-tags-view nil 
> (format "CLOSED>=\"[%s-%s-%s]\"+CLOSED<=\"[%s-%s-%s]\""
> (calendar-extract-year t0)
> (calendar-extract-month t0)
> (calendar-extract-day t0)
> (calendar-extract-year t1)
> (calendar-extract-month t1)
> (calendar-extract-day t1))
>
> How can I open a calendar to pick a date?
>
> Regards,
> Sascha
>
> 2014-11-26 20:44 GMT+01:00 John Kitchin :
>
> I am not sure how to do this through the agenda, but here is a way
> to
> find headlines in the current file that were closed today. You
> could
> wrap this in a loop over the files in your agenda list. It is a
> little
> clumsy on the time comparisons but it works ;)
> 
> * Getting items done today
> 
> ** DONE item 1
> CLOSED: [2014-11-26 Wed 13:09] DEADLINE: <2014-11-26 Wed>
> 
> 
> 
> ** DONE item 2
> CLOSED: [2014-11-25 Tue 13:09] DEADLINE: <2014-11-26 Wed>
> 
> 
> ** Mapping entries to find what closed today.
> 
> First, we look at a timestamp comparison function.
> #+BEGIN_SRC emacs-lisp
> (org-time= "<2014-11-26 Wed>" "<2014-11-26 Wed>")
> #+END_SRC
> 
> #+RESULTS:
> : t
> 
> #+BEGIN_SRC emacs-lisp
> (org-map-entries
> (lambda ()
> (let* ((closed (org-entry-get (point) "CLOSED"))
> (today (format-time-string "<%Y-%m-%d>")))
> (when closed
> (when
> (org-time=
> today
> (let ((parts (org-parse-time-string closed)))
> (format "<%s-%s-%s>"
> (nth 5 parts) ; year
> (nth 4 parts) ; month
> (nth 3 parts) ; day
> )))
> (message-box "Found a closed task: %s"
> (org-heading-components)))
> 
> #+END_SRC
> 
> #+RESULTS:
> | nil | Found a closed task: (2 2 DONE nil item 1 nil) | nil | nil
> |
> 
> 
>     
> 
> 
> 
> Sascha Ziemann  writes:
> 
> > Hi,
> >
> > I tried to get a list of all items done today. I tried to open
> the
> > agenda view but is does not show anything. What is the right
> command
> > to see the items done today?
> >
> > Regards,
> > Sascha
> >
> 
> 
> --
> ---
> John Kitchin
> Professor
> Doherty Hall A207F
> Department of Chemical Engineering
> Carnegie Mellon University
> Pittsburgh, PA 15213
> 412-268-7803
> http://kitchingroup.cheme.cmu.edu
> 
>
>

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



[O] possible bug in adding properties to headlines with no properties

2014-11-28 Thread John Kitchin
I noticed an undesirable behavior in setting a property on a headline
with no properties, but which contains a code block that generates
headlines with properties. When I try to set a property with C-c C-x p,
the property gets put in the wrong place (inside the code block). It is
a small issue, but I thought I would report. 

If the headline already has a PROPERTIES drawer then it seems to work fine.

Here is an example.

* bug in setting properties?
 <- put cursor here, C-c C-x p add property

The property goes in the code block below
 
#+BEGIN_SRC emacs-lisp
(format "** %s
  :PROPERTIES:
  :ID: %s
  :END:
%s" "A headline" "some id" "some body text")
#+END_SRC
#+RESULTS:
: ** A headline
:   :PROPERTIES:
:   :ID: some id
:   :END:
: some body text

-- 
---
John Kitchin
http://kitchingroup.cheme.cmu.edu




Re: [O] possible bug in adding properties to headlines with no properties

2014-11-28 Thread John Kitchin
"Charles C. Berry"  writes:

thanks for the note. I am still on 8.2.7, so it sounds like the issue is
fixed upstream of me. I look forward to getting there!

> On Fri, 28 Nov 2014, John Kitchin wrote:
>
>> I noticed an undesirable behavior in setting a property on a headline
>> with no properties, but which contains a code block that generates
>> headlines with properties. When I try to set a property with C-c C-x p,
>> the property gets put in the wrong place (inside the code block). It is
>> a small issue, but I thought I would report.
>>
>
> John,
>
> When I do as you suggest, I get a prompt:
>
> Malformed drawer at 348, repair? (y or n)
>
> `348' was the bol for the first :PROPERTIES: line.
>
> When I respond `y', a properties drawer is created under the headline
> and I get the usual prompts to complete the addition of a property.
>
> In the end, it looks correct.
>
> I get the same behavior with both current and older 8.3beta commits:
>
> : commit e4195fa7db03284c0c0d5b70a66d419ce7caf3e9
> : Author: Nicolas Goaziou 
> : Date:   Thu Nov 13 21:49:03 2014 +0100
>
>
> : commit 5945beef05120ce319228195a9e0c562f8573d19
> : Author: Nicolas Goaziou 
> : Date:   Thu Nov 27 00:21:03 2014 +0100
> :
>
> HTH,
>
> Chuck
>
>
>

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



Re: [O] Display image in current section

2014-12-01 Thread John Kitchin
Leu Zhe  writes:

(defun show-images-subtree ()
 (interactive)
 (save-restriction
  (org-narrow-to-subtree)
  (org-display-inline-images nil t (point-min) (point-max


Should do the trick.
> Hi everyone
>
> I current use org-mode to organise lots of images in different
> sections.
>
> Sometimes i just would like to display the image in current section,
> not all the image, because it takes some time to show them all.
> Any solution?
>
> Thanks in advance.
>
> llcc
>

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



Re: [O] Word under cursor to internal link

2014-12-18 Thread John Kitchin

Something like this seems to do approximately what you want:

#+BEGIN_SRC emacs-lisp
(defun word-to-link ()
  (interactive)
  (save-excursion
(let (start end word)
  (backward-word)  
  (setq start (point))
  (forward-word)
  (setq end (point))
  (setq word (buffer-substring start end))
  (setf (buffer-substring start end)
(format "[[%s]]" word)
#+END_SRC

Chaitanya Krishna  writes:

> Hello there,
>
> Is there a shortcut to change word under cursor to an internal link?
> Basically it is a pain trying to surround with two braces all the
> time!
>
> C-c C-l does not prompt me to create an internal link.
>
> Best regards,
> Chai
>

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



[O] new org-ref repo

2014-12-18 Thread John Kitchin
Hi all,

I have finally put my org-ref code into its own git repo:
https://github.com/jkitchin/org-ref

The repo includes some handy utility functions on a doi and bibtex
entries. I "improved" the cite link menu so it has a lot of new options
to open a cite link bibtex key in web of science, pubmed, google scholar
and cross-ref if the corresponding bibtex entry has a doi. It is pretty
nice (biased opinion of course). Hopefully I got all the dependencies in
this repo correct so it will just work for you. If not, post an issue on
Github, and I will work on fixing it! Thanks,

-- 
---
John Kitchin
@johnkitchin
http://kitchingroup.cheme.cmu.edu




[O] org-mode in teaching

2014-12-18 Thread John Kitchin
Hi all,

I wrote a blog post
(http://kitchingroup.cheme.cmu.edu/blog/2014/12/18/org-mode-+-Python-+-git-in-a-graduate-engineering-course/)
on how I used org-mode in teaching this past fall. Short summary: All
the notes, assignments, quizzes, exams, etc... were in org-mode,
students did all their work in org-mode, and we did all our grading in
org-mode. It was pretty awesome!

Thanks everyone for an awesome community, and fantastic package in
org-mode. Best wishes in the new year!

-- 
---
John Kitchin
@johnkitchin
http://kitchingroup.cheme.cmu.edu




Re: [O] org-mode in teaching

2014-12-19 Thread John Kitchin
On Fri, Dec 19, 2014 at 10:44 AM, Doug Lewan 
wrote:

> Vry cool.
>
> Could we get some background information?
>

Sure. I put a screen cast up here:
http://www.youtube.com/watch?v=cRUCiF2MwP4 in case you want to see what it
looks like.


> How much time did it take to get all the elements coordinated and running
> properly?
>

I spent a lot of July and August writing the techela code, and about a
month after class started polishing it. I set up jmax so it would
automatically pull new additions from github when you launch emacs, so
students were always up to date. the actual code is currently here:
https://github.com/jkitchin/jmax/tree/master/techela, but I will probably
move it into its own repo at some point.



> Was any piece particularly easy? Natural? Difficult?
>

The git integration was most difficult. Getting the right recipe to save
student work and merge when needed was tricky. There is still room for
improvement on this. Getting the secure communication was not obvious
either. In Emacs, I temporarily set GIT_SSH which uses a custom script to
do git over ssh with a config file that points to the student pub key.

org-links were very natural. I made an assignment link so when students
click on it, it would create a local repo for the assignment and open it.
when they finished, they could turn it in from a menu, which pushed the
work back to my git server. I also used a special link to record
multiple-choice question answers, which made grading easy later.



> Were the grade reports assignment-specific or cumulative? Did the grading
> work for the entire course?
> (Exams come to mind, unless they were done in emacs too.)
>

The grading worked for every assignment. Even quizzes and exams were done
in class, in Emacs, we were paper free the whole semester. Each assignment
had the grade stored in it, and the grade report would have an entry for
each assignment in the semester.


>
> Again, vry cool. Thanks for letting everyone know.
>




>
> --
> ,Doug
> Douglas Lewan
> Shubert Ticketing
> (201) 489-8600 ext 224 or ext 4335
>
> "This is a slow pup," he said continuing his ascent.
>
>
> > -Original Message-
> > On
> > Behalf Of John Kitchin
> > Subject: [O] org-mode in teaching
> >
> > Hi all,
> >
> > I wrote a blog post
> > (http://kitchingroup.cheme.cmu.edu/blog/2014/12/18/org-mode-+-Python-+-
> > git-in-a-graduate-engineering-course/)
> > on how I used org-mode in teaching this past fall. Short summary: All
> > the notes, assignments, quizzes, exams, etc... were in org-mode,
> > students did all their work in org-mode, and we did all our grading in
> > org-mode. It was pretty awesome!
> >
> > Thanks everyone for an awesome community, and fantastic package in
> > org-mode. Best wishes in the new year!
> >
> > --
> > ---
> > John Kitchin
> > @johnkitchin
> > http://kitchingroup.cheme.cmu.edu
> >
>
>


Re: [O] org-mode in teaching

2014-12-19 Thread John Kitchin
I put a screencast at
https://www.youtube.com/watch?v=cRUCiF2MwP4&feature=youtu.be&a

if you would like to see some of what this was like.

John Kitchin  writes:

> Hi all,
>
> I wrote a blog post
> (http://kitchingroup.cheme.cmu.edu/blog/2014/12/18/org-mode-+-Python-+-git-in-a-graduate-engineering-course/)
> on how I used org-mode in teaching this past fall. Short summary: All
> the notes, assignments, quizzes, exams, etc... were in org-mode,
> students did all their work in org-mode, and we did all our grading in
> org-mode. It was pretty awesome!
>
> Thanks everyone for an awesome community, and fantastic package in
> org-mode. Best wishes in the new year!

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



Re: [O] org-mode in teaching

2014-12-20 Thread John Kitchin
All of the code is here:
https://github.com/jkitchin/jmax/tree/master/techela

and there is some documentation in the README.

I am not sure how much work it would take to try it yourself though. You
need to setup a gitolite server (that is described in the README), and
more importantly figure out how to get this in your student's hands. For
windows users, they can just clone jmax, and it should run out of the
box (it has an emacs in it).

"Marvin M. Doyley"  writes:

> Very cool indeed.
> I would love to try this for a small course that I will be teaching in the 
> spring semester.
> Is your code available?
> Cheers,
> M
> Sent from my iPad
>

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



Re: [O] Redirecting stderr to stdout with babel/shell

2015-01-04 Thread John Kitchin
Check out this solution:

http://kitchingroup.cheme.cmu.edu/blog/2015/01/04/Redirecting-stderr-in-org-mode-shell-blocks/

I think it does what you want, and uses the idea below.

Samuel Wales  writes:

> hi karl,
>
> i always wrap as follows and it works for me.
>
> {
>   your code
> } 2>&1
> :
>
> the : eliminates fancy error handling.  i find that much less confusing.
>
>
> samuel

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



Re: [O] How to get your list of categories?

2015-01-04 Thread John Kitchin
rene  writes:

(org-buffer-property-keys) will give you all the categories in a buffer.


> I'd like to dynamically get the list of all of my categories (:CATEGORY:
> property).  Is there an easy way to do that?
>
> How can I write a command that would operate much the same way I get
>
>  - the list of all my TODO keywords (using C-c a T), or
>  - the list of all my TAGS (using C-c a M)?
>
> --
> Rene
>
>
>

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



Re: [O] Efficiency of Org v. LaTeX v. Word

2015-01-04 Thread John Kitchin
Ken Mankoff  writes:

Did anyone see the parody of this here:
http://mjambon.github.io/vim-vs-emacs/

It is pretty funny!

> People here might be interested in a publication from [2014-12-19 Fri]
> available at http://dx.doi.org/10.1371/journal.pone.0115069
>
> Title: An Efficiency Comparison of Document Preparation Systems Used
> in Academic Research and Development
>
> Summary: Word users are more efficient and have less errors than even
> experienced LaTeX users.
>
> Someone here should repeat experiment and add Org into the mix, perhaps
> Org -> ODT and/or Org -> LaTeX and see if it helps or hurts. I assume
> Org would trump LaTeX, but would Org -> ODT or Org -> X -> DOCX (via
> pandoc) beat straight Word?
>
>   -k.
>
>
>

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



Re: [O] Org-mode to feed a database

2015-01-04 Thread John Kitchin
Vikas Rawal  writes:

It is possible, but not worth the effort.

Even with moderately experienced users, you will be amazed at how
org-files can get mangled by users. In a recent course I taught, I used
links for some data entry; the links stored data as properties in a
headline. Even then a handful of users found some ways to delete
headlines, modify what got stored, etc...

As someone else mentioned, if Emacs is the input interface, widgets is
the way to go. Otherwise, a webform is a much better idea. Alternatives
include a PDF form, an MS Word or Excel form, or one of the online
survey tools.

> This is, in all likelihood, a crazy idea. Please excuse me for that.
>
> I often need to get a number of people enter complex survey data into
> a database using some kind of forms. The forms I need are fairly
> complex (with several nested grids, for example). I need radio-buttons
> and drop-down menus-equivalents.
>
> I was thinking if it would be worth it to use Org-mode for data entry.
>
> The idea would be something like this. We have a template org file
> that is copied for each survey respondent. The template contains
> “blank” org tables and some source blocks. Responses are filled into
> the org tables, and then the source blocks are evaluated to feed the
> data into the database. You can version-control the whole thing so
> that different people can create these records and push it to a
> centralised git repository.
>
> Has anyone done anything like this? What has been the experience?
>
> There are two aspects that immediately come to my mind.
>
> 1. Is org adequately feature rich for such a scenario? There are two concerns 
> I can think of right now. 
>1.1 Would feeding information from one Org table to another become too 
> complicated?
>1.2 Is there a way to build in tab-completion for columns in Org-table 
> using pre-specified categories? 
>
> 2. In my case, people who would enter the data into org files would
> not have used emacs before. So, there is a learning curve. Is it worth
> it? Or should one just build a web-based graphic application for such
> people to use?
>
> Vikas
>

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



Re: [O] Redirecting stderr to stdout with babel/shell

2015-01-11 Thread John Kitchin
Karl Voit  writes:

Weird. It works for me on MacOSX with bash. Out of curiosity, did you
try the source: 
http://kitchingroup.cheme.cmu.edu/org/2015/01/04/Redirecting-stderr-in-org-mode-shell-blocks.org?

I updated the web page with Achim's  simpler solution.

> * John Kitchin  wrote:
>> Check out this solution:
>>
>> http://kitchingroup.cheme.cmu.edu/blog/2015/01/04/Redirecting-stderr-in-org-mode-shell-blocks/
>
> Hm. This does not work on my machine: Debian Wheezy GNU/Linux
>
> Testing the current satus (again):
>
> #+BEGIN_SRC sh :results output
> echo "testing stdout" >&1
> echo "testing stderr" >&2
> date -g
> #+END_SRC
>
> #+RESULTS:
>
> ... no stderr on stdout and date error message in second buffer
>
>
> Creating a wrapper-script similar as described in web-page above:
>
> #+BEGIN_SRC sh
> echo '#!/usr/bin/zsh
> {
> /usr/bin/zsh $1
> } 2>&1' > ~/src/misc/zsh_stderr_redirected_to_stdout.sh
> chmod +x ~/src/misc/zsh_stderr_redirected_to_stdout.sh
> cd ~/bin
> ln -s ../src/misc/zsh_stderr_redirected_to_stdout.sh .
> #+END_SRC
>
> #+RESULTS:
>
> Setting the sh-command to this wrapper-script:
>
> #+BEGIN_SRC elisp
> (setq org-babel-sh-command "~/bin/zsh_stderr_redirected_to_stdout.sh")
> #+END_SRC
>
> #+RESULTS:
> : ~/bin/zsh_stderr_redirected_to_stdout.sh
>
> Re-testing status:
>
> #+BEGIN_SRC sh :results output
> echo "testing stdout" >&1
> echo "testing stderr" >&2
> date -g
> #+END_SRC
>
> #+RESULTS:
>
> ... no change except the second buffer for the date error message is
> empty. So it's actually worse than before.
>
>
> Trying with bash (as web-page did):
>
> #+BEGIN_SRC sh
> echo '#!/bin/bash
> {
> /bin/bash $1
> } 2>&1' > ~/src/misc/bash_stderr_redirected_to_stdout.sh
> chmod +x ~/src/misc/bash_stderr_redirected_to_stdout.sh
> cd ~/bin
> ln -s ../src/misc/bash_stderr_redirected_to_stdout.sh .
> #+END_SRC
>
> #+RESULTS:
>
> Setting the sh-command to this wrapper-script:
>
> #+BEGIN_SRC elisp
> (setq org-babel-sh-command "~/bin/bash_stderr_redirected_to_stdout.sh")
> #+END_SRC
>
> #+RESULTS:
> : ~/bin/bash_stderr_redirected_to_stdout.sh
>
> Same result as with zsh :-(
>
>
> Re-setting to standard settings to revoke tests from above:
>
> #+BEGIN_SRC elisp
> (setq org-babel-sh-command "sh")
> #+END_SRC
>
> #+RESULTS:
> : sh
>
> Re-testing status:
>
> #+BEGIN_SRC sh :results output
> echo "testing stdout" >&1
> echo "testing stderr" >&2
> date -g
> #+END_SRC
>
> #+RESULTS:

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



Re: [O] Org-mode execute functions upon opening and closing

2015-01-11 Thread John Kitchin

* Load lisp code on opening an org-file

Put this at the end of your org-file:
#+BEGIN_EXAMPLE
### Local Variables:
### mode: org
### eval: (load-file "my-lib.el")
### End:
#+END_EXAMPLE

Create my-lib.el, e.g.

#+BEGIN_SRC emacs-lisp :tangle my-lisp.el
(message-box "Loaded!")
#+END_SRC

The next time you open this file, you will be prompted whether to eval
the local variable. Type y to approve it once, or ! to approve it
forever. You can put whatever you want in this library.

### Local Variables:
### mode: org
### eval: (load-file "my-lib.el")
### End:



Karl Voit  writes:

> Hello Eduardo!
>
> 
>
> This is not an answer to your original question regarding hooks
> where http://www.emacswiki.org/emacs/LocalVariables together with a
> bit of Elisp might be a possible solution.
>
> However, we seem to share the same mind-set or motivation to use
> Org-mode in order to get independent from any cloud-based or closed
> source service.
>
> * Eduardo Mercovich  wrote:
>>
>> The big plan (rant for another thread) is to eventually integrate all
>> the information I use into this system, as many already did:
>> * people (org-contacts, BBDB, google-contacts, other?),
>> * events (calfw+org-mode?)
>> * mail (mu4e in my case, but there are other possible tools too).
>> * documents (org-mode itself)
>> * references (org-mode itself)
>> * etc.
>
> You might be interested in taking a look at Memacs (URL below) and
> http://karl-voit.at/2014/12/03/emacs-chat + other blog posts there.

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



Re: [O] Org-mode execute functions upon opening and closing

2015-01-11 Thread John Kitchin
John Kitchin  writes:

I guess this technically only runs when you open it.

To run something on closing, you might add something to
kill-buffer-hook. That function would need to check if it should run,
e.g. if you are closing an org-buffer that meets some criteria.

You could also look at find-file-hook for an alternative to opening.

> * Load lisp code on opening an org-file
>
> Put this at the end of your org-file:
> #+BEGIN_EXAMPLE
> ### Local Variables:
> ### mode: org
> ### eval: (load-file "my-lib.el")
> ### End:
> #+END_EXAMPLE
>
> Create my-lib.el, e.g.
>
> #+BEGIN_SRC emacs-lisp :tangle my-lisp.el
> (message-box "Loaded!")
> #+END_SRC
>
> The next time you open this file, you will be prompted whether to eval
> the local variable. Type y to approve it once, or ! to approve it
> forever. You can put whatever you want in this library.
>
> ### Local Variables:
> ### mode: org
> ### eval: (load-file "my-lib.el")
> ### End:
>
>
>
> Karl Voit  writes:
>
>> Hello Eduardo!
>>
>> 
>>
>> This is not an answer to your original question regarding hooks
>> where http://www.emacswiki.org/emacs/LocalVariables together with a
>> bit of Elisp might be a possible solution.
>>
>> However, we seem to share the same mind-set or motivation to use
>> Org-mode in order to get independent from any cloud-based or closed
>> source service.
>>
>> * Eduardo Mercovich  wrote:
>>>
>>> The big plan (rant for another thread) is to eventually integrate all
>>> the information I use into this system, as many already did:
>>> * people (org-contacts, BBDB, google-contacts, other?),
>>> * events (calfw+org-mode?)
>>> * mail (mu4e in my case, but there are other possible tools too).
>>> * documents (org-mode itself)
>>> * references (org-mode itself)
>>> * etc.
>>
>> You might be interested in taking a look at Memacs (URL below) and
>> http://karl-voit.at/2014/12/03/emacs-chat + other blog posts there.
>
> --
> ---
> John Kitchin
> Professor
> Doherty Hall A207F
> Department of Chemical Engineering
> Carnegie Mellon University
> Pittsburgh, PA 15213
> 412-268-7803
> http://kitchingroup.cheme.cmu.edu
>
>

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



  1   2   3   4   5   6   7   8   9   10   >