[O] Bug: empty ob-stan.el when installed from ELPA [8.3.4 (8.3.4-47-gaf853d-elpaplus @ /home/tamas/.emacs.d/elpa/org-plus-contrib-20160502/)]

2016-05-02 Thread Tamas Papp
This is about the ELPA package org-plus-contrib, but I could not find a
more specific place to report it.

When installing org-plus-contrib from ELPA, the file ob-stan.el is empty
(length 0). This has been the situation for a while (see [1]), but
cloning from the master git repo [2] was a workaround, with the
expectation that this would eventually be fixed. However, the ELPA
version 20160502 has the same problem.

[1] https://lists.gnu.org/archive/html/emacs-orgmode/2016-01/msg00487.html
[2] git://orgmode.org/org-mode.git 



Emacs  : GNU Emacs 25.1.50.2 (x86_64-pc-linux-gnu, GTK+ Version 3.18.9)
 of 2016-04-25
Package: Org-mode version 8.3.4 (8.3.4-47-gaf853d-elpaplus @ 
/home/tamas/.emacs.d/elpa/org-plus-contrib-20160502/)



[O] capture: create or append to existing heading, by date

2015-10-01 Thread Tamas Papp
Hi,

I am tracking calories using tables like this:

--8<---cut here---start->8---
** [2015-10-01 Thu]
|   | food | quantity | kcal/unit |  kcal |
|---+--+--+---+---|
|   |  |  ||   |
| # | pepper_bell  |  100 |57/100 |  57.0 |
| # | cheese_Old_Amsterdam |   20 |   429/100 |  85.8 |
| # | mustard  |   15 |   105/100 |  15.8 |
| # | egg  |3 |88 | 264.0 |
| # | chocolate_dark   |   10 |   550/100 |  55.0 |
|---+--+--+---+---|
| # |  |  || 477.6 |
#+TBLFM: $4='(diet-lookup-calories $2)::$5=$3*$4;%0.1f::@>$5=vsum(@<<<..@>>)
--8<---cut here---end--->8---

(diet-lookup-calories is a function that looks up calories from another
table).

I need help with the following: the tables are organized daily, with
dates in the headings as above. I would like to have a capture process
where

1. if there is no table for today, create it, capture,
2. if there is a table for today, take me there and capture.

Currently I have implemented 1. with the org-capture-template

--8<---cut here---start->8---
("f" "food diary" entry (file+olp "~/org/calories.org" "diary")
 "* %u
|   | food | quantity  | kcal/unit   |  kcal |
|---+--+---+-+---|
|   |  |   |  |   |
| # |  |   | |   |
|---+--+---+-+---|
| # |  |   |  |   |
#+TBLFM: $4='(diet-lookup-calories $2)::$5=$3*$4;%0.1f::@>$5=vsum(@<<<..@>>)
")
--8<---cut here---end--->8---

but it would be great if I had an automated process where tables are
created for the first capture of the day, then appended to after.

Thanks,

Tamas



[O] ob-R ignores ess-eval-visibly?

2015-09-04 Thread Tamas Papp
Hi,

I prefer ESS not to wait for results of evaluating R code, especially if
it takes a longer time (eg estimating a model in RStan, 1-2 minutes), so
I have

(setq ess-eval-visibly 'nowait)

But I find that ob-R ignores this, eg evaluating

#+BEGIN_SRC R :results none
  Sys.sleep(10)
#+END_SRC

I looked at the source and I think I understand why this is: the results
need to be inserted into the buffer. However, could there be an
exception for :results none, when they are not needed? Then I could put
code which takes a long time into these blocks, and they would not block
my Emacs.

Best,

Tamas



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

2015-08-07 Thread Tamas Papp
On Tue, Aug 04 2015, Charles C. Berry  wrote:

> On Tue, 4 Aug 2015, Tamas Papp wrote:
>
>> I would like to do the following: whenever I open the file in Emacs, I would 
>> like to eval all the source blocks under the heading Setup.
>>
>> I have found org-babel-execute-subtree, but I cannot figure out how to call 
>> it on the subtree "Setup" from a local eval.
>
> Name the first block in the subtree "start setup" (say).
>
> Then
>
> # Local Variables:
> # eval: (org-babel-goto-named-src-block "start setup")
> # eval: (org-babel-execute-subtree)
> # End:

Thanks! I found that I can also assign an ID to the section, and then
use

# eval: (progn (org-id-goto ...some-id...) (org-babel-execute-subtree))

It looks like I need the progn for it to work reliably (don't know why).

I am wondering if it would be possible to break a line in Local
Variables, but

# eval: (progn (org-id-goto ...some-id...) \
#  (org-babel-execute-subtree))

didn't work.

Best,

Tamas



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

2015-08-04 Thread Tamas Papp

Hi,

I have a file that looks like this (stylized):

--8<---cut here---start->8--- 
* Setup :noexport:


 #+COMMENT: some code here I want to run every time I open the 
 file in SRC blocks


* Experiment 1

 #+COMMENT: code I run when necessary, not every time

* Experiment 2

 #+COMMENT: code I run when necessary, not every time

* end of file :noexport: #+COMMENT: This is just for local 
variables, not exported.   # Local Variables: # 
org-confirm-babel-evaluate: nil # org-export-babel-evaluate: 
'inline-only # End: --8<---cut 
here---end--->8--- 

I would like to do the following: whenever I open the file in 
Emacs, I would like to eval all the source blocks under the 
heading Setup.


I have found org-babel-execute-subtree, but I cannot figure out 
how to call it on the subtree "Setup" from a local eval.


Best,

Tamas



[O] changing cells in an org-mode table with Emacs lisp

2014-12-27 Thread Tamas Papp
Hi,

I would like to manipulate cells in an org-mode table using Emacs lisp
code. Suppose I have a function (FORMAT-CELL CELL ROW COL) that takes a
cell (string), row and column numbers, and returns a new string if I
want to replace content in a cell, and NIL otherwise.

I need help with writing code that makes Emacs walk the table (all
cells), and then the new row when I insert a row (eg after capture).

For example, if my formatting function is

  (defun format-cell (cell row col)
;; toy example, actual code would be more complicated
(when (<= (length cell) col)
  (concat "*" cell "*")))

then the table

| a   | a   |
| aa  | aa  |
| aaa | aaa |

would be replaced by

| *a* | *a*  |
| aa  | *aa* |
| aaa | aaa  |

I need the replacement in place, I don't want to make a new table. I
would like to re-align the table when done.

Any help with this would be appreciated, in particular, the names of the
functions that would help me get started, I could not figure this out.

Best,

Tamas



[O] error when completing in org-contacts

2012-02-20 Thread Tamas Papp
Hi,

I started using org-contacts (from the contrib directory of the
org-mode git repo, with the emacs-snapshot package in Debian), with
the following configuration:

(require 'org-contacts)
(setq org-contacts-files '("~/org/contacts.org")
  org-capture-templates '(("c" "contacts" entry (file "~/org/contacts.org")
   "* %(mu4e-view-snarf-from 'name)
:PROPERTIES:
:EMAIL %(mu4e-view-snarf-from 'email)
:NICK:
:BIRTHDAY:
:END:\n\n"))
  org-contacts-completion-ignore-case t)

Capturing contacts works fine (they show up in the file), but I cannot
recall/complete contacts in message mode: when I

M-: (org-contacts-complete-name) 

(on eg a To: field), I get

(64 64 #[771 "\301?\303\300$)\207" [nil nil completion-ignore-case 
complete-with-action] 8 "

(fn STRING PRED ACTION)"])

I wonder if this is a known bug, a result of some invalid combination
of versions, or me not using org-contacts in the way it was intended.

Best,

Tamas





[O] short section titles in TOC

2012-02-16 Thread Tamas Papp
Hi,

Is it possible to have a short version of a section title in the table
of contents?  Eg in LaTeX, one can use

\section[Suggestions]{Suggestions for discussion}

and the first one would show up in the TOC.  I was wondering if one
can do this in org-mode.

Best,

Tamas