[O] date calculation in org table

2013-05-22 Thread The Dude
Hi all,

I'm having hard time to find a solution to my problem.  I've got a
simple table with a dates column where I set an $sdate variable in the
first row.  What I want to achieve is that the dates in the column 4 are
the sum of the date from the row above plus the number of days in column
3 in the same row apart from the field @4$4 which uses the $sdate
variable; thus my naïve column and field formulae:
@4$4=$sdate + $3::$4=@-1$4+$3

--8<---cut here---start->8---
* Test date table

|   | WP | Days | Arrival Date |
|---++--+--|
| # ||  | <2013-06-05 Wed> |
| ^ ||  | sdate|
|---++--+--|
|   |  1 |4 | <2013-06-09 Sun> |
|   |  - |2 | <2013-06-11 Tue> |
|   |  2 |4 | <2013-06-15 Sat> |
|   |  - |2 | <2013-06-17 Mon> |
|   |  3 |1 | <2013-06-18 Tue> |
|   |  4 |2 | <2013-06-20 Thu> |
|   |  5 |1 | <2013-06-21 Fri> |
|   |  - |2 | <2013-06-23 Sun> |
|   |  6 |1 | <2013-06-24 Mon> |
|   |  7 |2 | <2013-06-26 Wed> |
|   |  - |1 | <2013-06-27 Thu> |
|   |  8 |1 | <2013-06-28 Fri> |
|   |  9 |1 | <2013-06-29 Sat> |
|   |  - |3 | <2013-07-02 Tue> |
|   | 10 |3 | <2013-07-05 Fri> |
|   |  - |1 | <2013-07-06 Sat> |
|   | 11 |2 | <2013-07-08 Mon> |
|---++--+--|
|   ||   33 | <2013-07-08 Mon> |
#+TBLFM: @4$4=$sdate + 
$3::$4=@-1$4+$3::@21$3=vsum(@II..@III)::@21$4=@III-1::$sdate=<2013-06-05 Wed>
--8<---cut here---end--->8---

The problem is that when I change the $sdate and recalculate the whole
table with `C-u C-u C-c C-c' only the element @4$4 is set.  It seems
like the column formula doesn't apply to the other fields.

So the question is what am I doing wrongly?  Didn't I get how the column
formula works or is it a problem with the date calculation?

Any help would be very much appreciated,
cheers
-- 
-dude

Too brief? Here's why! http://emailcharter.org




Re: [O] Bug in structmode++?

2013-05-22 Thread The Dude
-> Igor Sosa Mayor writes:

> Am Sun, May 12, 2013 at 03:59:00PM +0100, Christopher Schmidt wrote:
>> Please give the current master a try.

> After the commit 0ea11e26e46f2f562c1997cf1645dd744d5f6f2f you did, it
> seems to work again.

Yes, I confirm, it works for me too.  Thanks man!

> thanks a lot.

> -- 
> :: Igor Sosa Mayor :: joseleopoldo1...@gmail.com ::
> :: GnuPG: 0x1C1E2890   :: http://www.gnupg.org/  ::
> :: jabberid: rogorido  ::::

-- 
-dude

Too brief? Here's why! http://emailcharter.org




Re: [O] Minor problems with dvipng latex image preview

2013-05-22 Thread Nick Dokos
Nicolas Goaziou  writes:

>> ... I set:
>>
>> (setq org-export-latex-listings 'minted)
>
> You mean `org-latex-listings'.  `org-export-latex-listings' belongs to
> the old export framework (like almost all variables with
> "org-export-BACKEND-" prefix).
>

Yes, indeed.

>> (add-to-list 'org-latex-packages-alist '("" "minted"))
>
>> in which case, I end up with a \usepackage{minted} in the preview
>> latex file. 
>
> Use:
>
>   (add-to-list 'org-latex-packages-alist '("" "minted" nil))
>
> to tell Org not to include the package for previewing snippets.
>

OK, that works - I didn't know about the three-element list
form. Thanks!

Perhaps the docstring for org-latex-listings should include
the three-element list form, with a pointer to the
org-latex-packages-alist doc for more details.

There is also a (perhaps unlikely) scenario where this is not enough:
previewing typeset code where I *want* to use minted:

--8<---cut here---start->8---
* Code

\begin{minted}{c}
  printf("Hello world\n");
\end{minted}
--8<---cut here---end--->8---

-- 
Nick




Re: [O] Org-babel & R exporting multiple tables

2013-05-22 Thread Eric Schulte
Joe Bogner  writes:

> Figured it out. Option #2 works with ob-org as long as the defaults
> are set to output the results
>
> (setq org-babel-default-header-args:org '((:results . "raw") (:exports
> . "results")))
>
> By default it looks like it's silent.
>

Another option may be to try option 3, but replace

  :results output raw

with

  :results output drawer

Best,

>
>
>
> On Wed, May 22, 2013 at 5:26 PM, Joe Bogner  wrote:
>> I have a list of data frames that I would like to output. The number
>> of frames may vary
>>
>> Is there a way to export multiple tables formatted? These are the
>> three options I came up with. None of them work very well:
>>
>> Option #3 works the best, but it will append each time it's run in the
>> doc, so I can't have the contents in the doc without having it
>> duplicated.
>>
>> Option #2 would be good if I could just instruct it to render the table as 
>> HTML
>>
>> There was a post about 2 years ago that I attempted implement by
>> adding (require 'ob-org) to my .emacs for #2 but it didn't seem to
>> work 
>> (http://article.gmane.org/gmane.emacs.orgmode/29286/match=results+org+babel+ascii).
>>
>>
>>
>> * Option 1
>>
>> Will combine the frames
>>
>> #+begin_src R :session *R* :colnames yes
>> frames <- list()
>> frames[[1]] <- data.frame(col=c("a","b"))
>> frames[[2]] <- data.frame(col2=c("a","b"))
>> frames
>> #+end_src
>>
>> #+RESULTS:
>> | col | col2 |
>> |-+--|
>> | a   | a|
>> | b   | b|
>>
>>
>>
>> * Option 2
>>
>> It won't format on export
>>
>> #+begin_src R :session *R* :results output org :exports both
>> frames <- list()
>> frames[[1]] <- data.frame(col=c("a","b"))
>> frames[[2]] <- data.frame(col2=c("a","b"))
>> for(i in 1:2) {
>> print(ascii(frames[[i]]), type="org")
>> cat("\n")
>> }
>> #+end_src
>>
>> #+RESULTS:
>> #+BEGIN_SRC org
>>  |   | col |
>>  |---+-|
>>  | 1 | a   |
>>  | 2 | b   |
>>
>> |   | col2 |
>> |---+--|
>> | 1 | a|
>> | 2 | b|
>> #+END_SRC
>>
>>
>> * Option 3
>>
>> It will format on export but won't replace if it's run in the document
>>
>> #+begin_src R :session *R* :results output raw :exports both
>> frames <- list()
>> frames[[1]] <- data.frame(col=c("a","b"))
>> frames[[2]] <- data.frame(col2=c("a","b"))
>> for(i in 1:2) {
>> print(ascii(frames[[i]]), type="org")
>> cat("\n")
>> }
>> #+end_src
>

-- 
Eric Schulte
http://cs.unm.edu/~eschulte



Re: [O] Org-babel & R exporting multiple tables

2013-05-22 Thread Joe Bogner
Figured it out. Option #2 works with ob-org as long as the defaults
are set to output the results

(setq org-babel-default-header-args:org '((:results . "raw") (:exports
. "results")))

By default it looks like it's silent.



On Wed, May 22, 2013 at 5:26 PM, Joe Bogner  wrote:
> I have a list of data frames that I would like to output. The number
> of frames may vary
>
> Is there a way to export multiple tables formatted? These are the
> three options I came up with. None of them work very well:
>
> Option #3 works the best, but it will append each time it's run in the
> doc, so I can't have the contents in the doc without having it
> duplicated.
>
> Option #2 would be good if I could just instruct it to render the table as 
> HTML
>
> There was a post about 2 years ago that I attempted implement by
> adding (require 'ob-org) to my .emacs for #2 but it didn't seem to
> work 
> (http://article.gmane.org/gmane.emacs.orgmode/29286/match=results+org+babel+ascii).
>
>
>
> * Option 1
>
> Will combine the frames
>
> #+begin_src R :session *R* :colnames yes
> frames <- list()
> frames[[1]] <- data.frame(col=c("a","b"))
> frames[[2]] <- data.frame(col2=c("a","b"))
> frames
> #+end_src
>
> #+RESULTS:
> | col | col2 |
> |-+--|
> | a   | a|
> | b   | b|
>
>
>
> * Option 2
>
> It won't format on export
>
> #+begin_src R :session *R* :results output org :exports both
> frames <- list()
> frames[[1]] <- data.frame(col=c("a","b"))
> frames[[2]] <- data.frame(col2=c("a","b"))
> for(i in 1:2) {
> print(ascii(frames[[i]]), type="org")
> cat("\n")
> }
> #+end_src
>
> #+RESULTS:
> #+BEGIN_SRC org
>  |   | col |
>  |---+-|
>  | 1 | a   |
>  | 2 | b   |
>
> |   | col2 |
> |---+--|
> | 1 | a|
> | 2 | b|
> #+END_SRC
>
>
> * Option 3
>
> It will format on export but won't replace if it's run in the document
>
> #+begin_src R :session *R* :results output raw :exports both
> frames <- list()
> frames[[1]] <- data.frame(col=c("a","b"))
> frames[[2]] <- data.frame(col2=c("a","b"))
> for(i in 1:2) {
> print(ascii(frames[[i]]), type="org")
> cat("\n")
> }
> #+end_src



Re: [O] Seeking advice on structuring my org-mode file

2013-05-22 Thread Matt Lundin
Marcin Borkowski  writes:

> I have an Org-mode file with notes concerning a large project connected
> with teaching at my university.  One of the headlines is dedicated to
> one particular course, where I am part of a group developing a concept
> of this course.  So, one subheadline is devoted to that.  Yet another
> (subsub)headline is a list if my proposals of things that should be
> covered during that course, and now it needs 3 more levels down.
> Summing it up: I have 5 levels of headlines and now I need a sixth
> one.  So, my question is: what are good practices of other Org-moders?
> Do you push such a monster to an external file and just include a link
> to it?  

If a file grows to large, I simply create a new one. In this instance, I
would recommend creating a separate file for each course.

Below you'll find a very hackish helper function that I use to generate
a new file from a headline. It leaves a link to the new file in the
original location.

Best,
Matt

--8<---cut here---start->8---
(defun my-org-file-from-headline (file)
  (interactive
   (list
(completing-read "File: "
 (mapcar 'file-name-nondirectory
 (file-expand-wildcards "~/org/*.org"))
 nil nil)))
  (unless (string-match "\\.org$" file)
(error "Not an org file"))
  (save-excursion
(beginning-of-line)
(unless (org-at-heading-p)
  (error "Not on a headline")))
  (let* ((exists (file-exists-p file))
 (ftags (append
 (list (file-name-sans-extension file))
 (mapcar 'substring-no-properties org-file-tags)))
 (headline (nth 4 (org-heading-components)))
 (org-archive-reversed-order t)
 (org-archive-location (concat file "::"))
 (org-archive-save-context-info nil))
(org-archive-subtree)
(save-excursion (insert "* [[file:" file "][" file "]] - " headline "\n"))
(find-file file)
(goto-char (point-min))
(save-excursion
  (if (re-search-forward "#\\+FILETAGS:\\(.*\\)$" nil t)
  (progn
(save-match-data
  (setq ftags
(mapconcat 'identity
   (org-uniquify
(append ftags
(split-string
 (substring-no-properties
  (match-string 1) " ")))
(replace-match (concat "#+FILETAGS: " ftags)))
(insert "#+FILETAGS: " (mapconcat 'identity ftags " ") "\n"))
  (goto-char (point-min))
  (unless (re-search-forward "#\\+CATEGORY:\\(.*\\)$" nil t)
(insert "#+CATEGORY: " (file-name-sans-extension file) "\n"))
  (goto-char (point-min))
  (when (re-search-forward "^Archived entries from file.+\n" nil t)
(replace-match ""
  (write-file file))
--8<---cut here---end--->8---




[O] [PATCH] ox-koma-letter.el: Reintroduce variables removed in commit 832c6fd with proper defaults (was Re: [patch] ox-koma-letter.el: clean-up/semantic bug [4/4])

2013-05-22 Thread Viktor Rosenfeld
Hi Rasmus,

Viktor Rosenfeld wrote:

> Hi Rasmus,
> 
> Rasmus wrote:
> 
> > Viktor Rosenfeld  writes:
> > 
> > > Or 5, keep the change from SENDER to AUTHOR but revert the default
> > > values to `org-koma-letter-*' variables. (Right now the AUTHOR and EMAIL
> > > lines could be removed because they duplicate the derived latex
> > > backend.)
> > 
> > I once had a teacher who talked about the optimal degree of
> > conservatism (as well speaking positively about being in the infamoues
> > ivory tower).  5. is fine with me.  So I guess the deal is
> >   1. default value is the same as in ox-latex.
> >   2. . . . but it's kept in a seperete variable ox-kl variable.
> > 
> > > I think that switching from SENDER to AUTHOR, keeping the
> > > `org-koma-letter-{author,email}' variables in the KOMA backend, but
> > > setting them per default to `user-full-name' and `user-mail-address',
> > > would solve both your problems and let me keep LCO files. I would then
> > > simply set these `org-koma-letter-*' variables to `nil' and document
> > > this setup in the docstring. I'll see tomorrow if this is feasable.
> > 
> > Does the attached patch work for you (also with ps tags?)
> 
> It works, but I noticed the following problem: According to the Emacs
> documentation `user-mail-address' is only set by Emacs after the
> initialization process has completed and if it is not explicitly set
> during initialization [1]. So, the defcustom of org-koma-letter-email
> does not work as expected if the user has not set `user-mail-address'
> before. Instead it is set to the empty string, which according to the
> code setting `user-mail-address' means "not set yet."
> 
> This can be taking care of by using `after-init-hook' as in the example
> below. It has the added advantage that the value of `user-mail-address'
> will be picked up regardless of whether it is set before or after
> require'ing ox-koma-letter. 
> 
> Note that this creates a slight inconsistency with regard to
> `user-full-name' which is only picked up correctly if it is set before
> require'ing ox-koma-letter. I've fixed this by a slightly complicated
> defcustom definition of `org-koma-letter-author' and another
> after-init-hook.
> 
> I've also changed the docstring to indicate what are the default values
> and added the :group and :type flags again.

I've put my changes into a patch against the current master (commit
06cdb2d2). Could you check it with your setup?

Cheers,
Viktor
>From 271c6548aa1f0b61763c30b7116dbb3325364683 Mon Sep 17 00:00:00 2001
From: Viktor Rosenfeld 
Date: Thu, 23 May 2013 00:00:38 +0200
Subject: [PATCH] ox-koma-letter.el: Reintroduce variables removed in commit
 832c6fd with proper defaults.

* ox-koma-letter.el (org-koma-letter-author): Dedicated
variable to set the KOMA variable fromname; initialized to
`user-full-name' using `after-init-hook' if not set
explicitly.
(org-koma-letter-email): Dedicated variable to set the KOMA
variable fromemail; initialized to `user-mail-address' using
`after-init-hook' if not set explicitly.
(koma-letter): Use dedicated variables for AUTHOR and EMAIL.
(org-koma-letter-template): Variable name change.

Setting the variables `org-koma-letter-author' and `org-koma-letter-email' to 
the values of `user-full-name' and `user-mail-address' respectively, allows the 
user to skip =#+AUTHOR:= and =#+EMAIL:= lines when configuring a letter. 
However, if the user wishes to set this information in LCO files, these 
variables need to be set to nil.
---
 contrib/lisp/ox-koma-letter.el | 37 +++--
 1 file changed, 31 insertions(+), 6 deletions(-)

diff --git a/contrib/lisp/ox-koma-letter.el b/contrib/lisp/ox-koma-letter.el
index 4318db1..b56dadb 100644
--- a/contrib/lisp/ox-koma-letter.el
+++ b/contrib/lisp/ox-koma-letter.el
@@ -80,6 +80,32 @@
   :group 'org-export-koma-letter
   :type 'string)
 
+(defcustom org-koma-letter-author (if (boundp 'org-koma-letter-author)
+  user-full-name
+;; Empty string means "not set yet."
+"")
+  "The sender's name.
+
+This variable defaults to the value of `user-full-name'."
+  :group 'org-export-koma-letter
+  :type 'string)
+
+(add-hook 'after-init-hook
+(lambda ()
+  (if (string= org-koma-letter-author "")
+(setq org-koma-letter-author user-full-name
+
+(defcustom org-koma-letter-email user-mail-address
+  "The sender's email address.
+
+This variable defaults to the value of `user-mail-address'."
+  :group 'org-export-koma-letter
+  :type 'string)
+
+(add-hook 'after-init-hook
+(lambda ()
+  (if (string= org-koma-letter-email "")
+(setq org-koma-letter-email user-mail-address
 
 (defcustom org-koma-letter-from-address nil
   "Sender's address, as a string."
@@ -91,7 +117,6 @@
   :group 'org-export-koma-letter
   :type 'string)
 
-
 (defcustom org-koma-letter-place nil
   "Place from which the letter is sent."
   :

Re: [O] Trigger org-capture window using linux shortcut key

2013-05-22 Thread Matt Lundin
Jackin  writes:

>   I am wondering if it is possible to start a org-capture window
> (when not within emacs) using a shortcut key. Org-protocol allows this
> to be done from a web browser or adobe reader which is very useful. But
> I am thinking of a more general solution, for triggering a org-capture
> window from any where in Linux -> type in something and -> C-c c-c.
>
>  Any ideas or solutions? Thanks in advance.

The answer will likely depend on which desktop or window manager you
use. I have the following in my openbox rc.xml:


  
emacsclient -c -e "(org-capture)"
  


Gnome and KDE will likely have a GUI for adding custom keyboard
shortcuts.

Best,
Matt



Re: [O] Let's discuss citation and Org syntax

2013-05-22 Thread Matt Lundin
Marcin Borkowski  writes:
> I do not use Org-mode for authoring (I'm quite happy with LaTeX itself
> for that), and in LaTeX, I use neither bibtex nor biblatex; but AFAIK,
> bibtex is basically dead like John Cleese's parrot.  I don't even think
> that it needs to or should be supported; the faster bibtex usage fades
> away, the better.

As a point of clarification, bibtex syntax and bib files remain alive
and well (albeit with modifications) for those who use biblatex.

> What I would suggest is to look into amsrefs manual.  The amsrefs
> package was (is?) an interesting attempt at a /pure LaTeX/ solution to
> the bibliography problem, not dependent on any executable other than
> LaTeX.  It is not capable of sorting bibliographies, but other than
> that is quite powerful (much more than bibtex, though seemingly less
> than biblatex).  What is interesting here is its \ycite and \ocite
> commands (see
> http://mirrors.ctan.org/macros/latex/contrib/amsrefs/amsrdoc.pdf); it
> might be a good idea to support something similar.  (I'm not sure
> whether biblatex supports such a thing.)

Most biblatex backends have multiple versions of cite commands. I use
biblatex-chicago, which provides, among others, \autocite, \fullcite,
\citetitle, \footfullcite, \headlesscite, \headlessfullcite, \shortcite.

Best,
Matt



[O] Org-babel & R exporting multiple tables

2013-05-22 Thread Joe Bogner
I have a list of data frames that I would like to output. The number
of frames may vary

Is there a way to export multiple tables formatted? These are the
three options I came up with. None of them work very well:

Option #3 works the best, but it will append each time it's run in the
doc, so I can't have the contents in the doc without having it
duplicated.

Option #2 would be good if I could just instruct it to render the table as HTML

There was a post about 2 years ago that I attempted implement by
adding (require 'ob-org) to my .emacs for #2 but it didn't seem to
work 
(http://article.gmane.org/gmane.emacs.orgmode/29286/match=results+org+babel+ascii).



* Option 1

Will combine the frames

#+begin_src R :session *R* :colnames yes
frames <- list()
frames[[1]] <- data.frame(col=c("a","b"))
frames[[2]] <- data.frame(col2=c("a","b"))
frames
#+end_src

#+RESULTS:
| col | col2 |
|-+--|
| a   | a|
| b   | b|



* Option 2

It won't format on export

#+begin_src R :session *R* :results output org :exports both
frames <- list()
frames[[1]] <- data.frame(col=c("a","b"))
frames[[2]] <- data.frame(col2=c("a","b"))
for(i in 1:2) {
print(ascii(frames[[i]]), type="org")
cat("\n")
}
#+end_src

#+RESULTS:
#+BEGIN_SRC org
 |   | col |
 |---+-|
 | 1 | a   |
 | 2 | b   |

|   | col2 |
|---+--|
| 1 | a|
| 2 | b|
#+END_SRC


* Option 3

It will format on export but won't replace if it's run in the document

#+begin_src R :session *R* :results output raw :exports both
frames <- list()
frames[[1]] <- data.frame(col=c("a","b"))
frames[[2]] <- data.frame(col2=c("a","b"))
for(i in 1:2) {
print(ascii(frames[[i]]), type="org")
cat("\n")
}
#+end_src



[O] [NEW FEATURE] org-hlc.el - hidden-lines-cookies (hlc) for Org-mode

2013-05-22 Thread Thorsten Jolitz

Hi List, 

I ported this from outshine.el (i.e. outline-minor-mode) to Org-mode,
hope it is useful. 

What is it all about? With 'org-hlc' 

,
| Behind every folded headline, a little 'cookie' shows the number of
| hidden lines till the next visible headline.
`

e.g.

,-
| * my-file.org [#13]
| ** Commentary [#1]
| *** About my-file
| 
|  This file implements extensions for occur-mode. You can think of a
|  navi-buffer as a kind of 'remote-control' for an (adecuately)
|  outline-structured original-buffer.
| 
| *** Usage [#165]
`-

I attach the code to this message, you can find the git-repo here:

,
| https://github.com/tj64/org-hlc
| git clone https://github.com/tj64/org-hlc
`--

Please let me know if there is interest to include this in Org-mode. 

---
ORG-HLC.EL
---

;;; org-hlc.el --- hidden-lines-cookies for folded Org-mode headlines

;; Copyright (C) 2013 Thorsten Jolitz

;; Author: Thorsten Jolitz 
;; Keywords: org-mode, outline, visibility, overlays

;; This file is (NOT YET) part of GNU Emacs.

;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.

;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs.  If not, see .

;;; Commentary:

;; 'hidden-lines-cookies' (hlc) are small cookies at the end of each folded
;; (and visible) headline in an Org-mode buffer that show the number of hidden
;; lines before the next visible headline.

;; hidden-lines-cookies can be handled with three user commands:
;; `org-hlc-show-hidden-lines-cookies', `org-hlc-hide-hidden-lines-cookies',
;; and the convenience command `org-hlc-toggle-hidden-lines-cookies' that
;; toggles between the two other commands conditional on the last one
;; executed.

;; The appearance of the cookies can be customized by changing the values of
;; four customizable variables: `org-hlc-hidden-lines-cookie-left-delimiter'
;; (with default value "["), `org-hlc-hidden-lines-cookie-right-delimiter'
;; (with default value ']), `org-hlc-hidden-lines-cookie-left-signal-char'
;; (with default value "#") and
;; `org-hlc-hidden-lines-cookie-right-signal-char' (with default value "").

;; Thus an exemplary folded headline with 165 hidden lines before the next
;; visible headline might look like this when hidden-lines-cookies are shown:

;; ,-
;; | *** Headline [#165]
;; `-

;;; Code:

 Variables

(defvar org-hlc-hidden-lines-cookies-on-p nil
  "If non-nil, hidden-lines cookies are shown, otherwise hidden.")

(defgroup org-hlc nil
  "Enhanced library for outline navigation in source code buffers."
  :prefix "org-hlc-"
  :group 'org)

(defcustom org-hlc-hidden-lines-cookie-left-delimiter "["
  "Left delimiter of cookie that shows number of hidden lines."
  :group 'org-hlc
  :type 'string)

(defcustom org-hlc-hidden-lines-cookie-right-delimiter "]"
  "Left delimiter of cookie that shows number of hidden lines."
  :group 'org-hlc
  :type 'string)

(defcustom org-hlc-hidden-lines-cookie-left-signal-char "#"
  "Left signal character of cookie that shows number of hidden lines."
  :group 'org-hlc
  :type 'string)

(defcustom org-hlc-hidden-lines-cookie-right-signal-char ""
  "Right signal character of cookie that shows number of hidden lines."
  :group 'org-hlc
  :type 'string)

(defvar org-hlc-hidden-lines-cookie-format-regexp
  (concat
   "\\( "
   (regexp-quote org-hlc-hidden-lines-cookie-left-delimiter)
   (regexp-quote org-hlc-hidden-lines-cookie-left-signal-char)
   "\\)"
   "\\([[:digit:]]+\\)"
   "\\("
   (regexp-quote org-hlc-hidden-lines-cookie-right-signal-char)
   ;; FIXME robust enough?
   (format "\\%s" org-hlc-hidden-lines-cookie-right-delimiter)
   "\\)")
  "Matches cookies that show number of hidden lines for folded subtrees.")

 Functions

;; Calc and show line number of hidden body for all visible headlines
(defun org-hlc-write-hidden-lines-cookies ()
  "Show line number of hidden lines in folded headline."
  (save-excursion
(goto-char (point-min))
(and (outline-on-heading-p)
 (org-hlc-hidden-lines-cookie-status-changed-p)
 (org-hlc-set-hidden-lines-cookie))
(while (not (eobp))
  (outline-next-visible-heading 1)
  

Re: [O] (Potential) new feature for Org-mode: "hidden-lines cookies"

2013-05-22 Thread Thorsten Jolitz
Suvayu Ali  writes:

> On Wed, May 22, 2013 at 04:14:03PM +0200, Thorsten Jolitz wrote:
>> 
>> Now I wonder if such a feature already exists in Org-mode (I would not
>> be surprised, but I'm not aware of it) and if anybody would be
>> interested in having such a feature?
>
> As per my understanding, there is no such feature; and as a user, I
> would love it!

Ok, the porting was even easier than I imagined, just renaming the
definitions did the job, the code worked 'as is' with Org-mode buffers
too.

See my anouncement mail please. 

-- 
cheers,
Thorsten




Re: [O] Minor problems with dvipng latex image preview

2013-05-22 Thread Nicolas Goaziou
Hello,

Nick Dokos  writes:

> The main problem is that the latex->dvi invocation is hard-wired in
> org-create-formula-image-with-dvipng and in addition, when the latex
> file is created, the value of org-latex-packages-alist is spliced in.
>
> That in itself is fine, except in the case when (for normal latex
> processing) I choose minted for code prettification. Following the
> docstring of or-export-latex-listings, I set:
>
> (setq org-export-latex-listings 'minted)

You mean `org-latex-listings'.  `org-export-latex-listings' belongs to
the old export framework (like almost all variables with
"org-export-BACKEND-" prefix).

> (add-to-list 'org-latex-packages-alist '("" "minted"))

> in which case, I end up with a \usepackage{minted} in the preview
> latex file. 

Use:

  (add-to-list 'org-latex-packages-alist '("" "minted" nil))

to tell Org not to include the package for previewing snippets.


Regards,

-- 
Nicolas Goaziou



[O] Seeking advice on structuring my org-mode file

2013-05-22 Thread Marcin Borkowski
Hi all,

I have an Org-mode file with notes concerning a large project connected
with teaching at my university.  One of the headlines is dedicated to
one particular course, where I am part of a group developing a concept
of this course.  So, one subheadline is devoted to that.  Yet another
(subsub)headline is a list if my proposals of things that should be
covered during that course, and now it needs 3 more levels down.
Summing it up: I have 5 levels of headlines and now I need a sixth
one.  So, my question is: what are good practices of other Org-moders?
Do you push such a monster to an external file and just include a link
to it?  Or do you just live with 6-level structure (which is a bit
cumbersome, since I sometimes want to copy a part of this document to
an email)?  Or maybe there's yet another way of handling this?

Best,

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Adam Mickiewicz University



Re: [O] [patch] ox-koma-letter.el: credit [3/4]

2013-05-22 Thread Viktor Rosenfeld
Hi,

Rasmus wrote:

> Viktor Rosenfeld  writes:
> 
> >> Ah, you mean the textsc?  Perhaps it is a bit eccentric.  But you're
> >> bringing up a good point.  It should recognize [p]+s and perhaps even
> >> order them. . .
> >
> > If there is no PS prefix set, users could simply write these out
> > themselves. I don't think it is much of a burden. Recognizing multiple
> > :P[+]S: tags in code seems like overkill to me. The all go into the same
> > \ps, don't they?
> 
> No, you'd want have
> \ps{ps:one}
> \ps{pps:two}
> \ps{pps:three}.

Okay, I didn't know this. But what's the advantage over

\ps{
ps:one

ps:two

ps:three}
 
> > The latter example does not really work for me because I often write
> > letters below a TODO headline (as opposed to a dedicated file). So I
> > restrict export to a subtree which would not work if I'm below the
> > letter headline. In my case I would use something like this:
> >
> > #+BEGIN_EXAMPLE
> > * TODO write letter
> > :PROPERTIES:
> > :EXPORT_OPENING: ...
> > ...
> > :END:
> >
> > The letter goes here.
> >
> > ** TO :TO:
> > ...
> > #+END_EXAMPLE
> > I have a capture template setup for letters, so I don't normally have to
> > add the address information manually. I would probably stick to the old
> > format and use headlines if I have a PS and so on.
> 
> Cool, you should write an article about!

Do you mean the capture template? I might put it in the tutorial. I
planned to have a tips and tricks section there anyway.

Cheers,
Viktor

> 
> -- 
> Don't panic!!!
> 



Re: [O] XeLaTeX and the new exporter

2013-05-22 Thread Suvayu Ali
Hi Christopher,

On Tue, May 07, 2013 at 05:42:04PM +0200, Christopher Witte wrote:
> 
> I had export working using XeLaTeX using the instructions from the
> FAQ(with
> some slight modifications), but after upgrading to the new export it
> isn't working.  It appears the hook
> org-export-latex-after-initial-vars-hook isn't defined anymore.
> 
> Any advice on what I need to change to get it to work?

I have noticed discussions on this before and I fail to understand the
need for all the setup mentioned in the above Worg entry.  I use XeLaTeX
almost exclusively, and all I have is something like this:

  ;;; XeLaTeX customisations
  ;; remove "inputenc" from default packages as it clashes with xelatex
  (setf org-latex-default-packages-alist
(remove '("AUTO" "inputenc" t) org-latex-default-packages-alist))

  (add-to-list 'org-latex-packages-alist '("" "xltxtra" t))
  ;; choose Linux Libertine O as serif and Linux Biolinum O as sans-serif fonts
  (add-to-list 'org-latex-packages-alist '("" "libertineotf" t))

  ;; org to latex customisations, -shell-escape needed for minted
  (setq org-export-dispatch-use-expert-ui t ; non-intrusive export dispatch
org-latex-pdf-process   ; for regular export
'("xelatex -shell-escape -interaction nonstopmode -output-directory %o 
%f"
  "xelatex -shell-escape -interaction nonstopmode -output-directory %o 
%f"
  "xelatex -shell-escape -interaction nonstopmode -output-directory %o 
%f"))

For beamer export I add this line:

  #+LaTeX_HEADER: \setsansfont{Linux Biolinum O}

So far I have not encountered any problems.  Although I have to say, I
do not use unicode in mathmode.

I am curious to know why others need all this elaborate setup to use
XeLaTeX.

Cheers,

-- 
Suvayu

Open source is the future. It sets us free.



Re: [O] [patch] ox-koma-letter.el: credit [3/4]

2013-05-22 Thread Rasmus
Viktor Rosenfeld  writes:

>> Ah, you mean the textsc?  Perhaps it is a bit eccentric.  But you're
>> bringing up a good point.  It should recognize [p]+s and perhaps even
>> order them. . .
>
> If there is no PS prefix set, users could simply write these out
> themselves. I don't think it is much of a burden. Recognizing multiple
> :P[+]S: tags in code seems like overkill to me. The all go into the same
> \ps, don't they?

No, you'd want have
\ps{ps:one}
\ps{pps:two}
\ps{pps:three}.

Either they could be different subtrees 
* ps :ps: 
** ps-one
  ps:one
** ps-two
  ps:two
[...]

or they could just be ordered the way they were in the buffer.
Probably that's easier.

> The latter example does not really work for me because I often write
> letters below a TODO headline (as opposed to a dedicated file). So I
> restrict export to a subtree which would not work if I'm below the
> letter headline. In my case I would use something like this:
>
> #+BEGIN_EXAMPLE
> * TODO write letter
> :PROPERTIES:
> :EXPORT_OPENING: ...
> ...
> :END:
>
> The letter goes here.
>
> ** TO :TO:
> ...
> #+END_EXAMPLE
> I have a capture template setup for letters, so I don't normally have to
> add the address information manually. I would probably stick to the old
> format and use headlines if I have a PS and so on.

Cool, you should write an article about!

-- 
Don't panic!!!



Re: [O] (Potential) new feature for Org-mode: "hidden-lines cookies"

2013-05-22 Thread Suvayu Ali
On Wed, May 22, 2013 at 04:14:03PM +0200, Thorsten Jolitz wrote:
> 
> Now I wonder if such a feature already exists in Org-mode (I would not
> be surprised, but I'm not aware of it) and if anybody would be
> interested in having such a feature?

As per my understanding, there is no such feature; and as a user, I
would love it!

-- 
Suvayu

Open source is the future. It sets us free.



Re: [O] link abbreviation with multiple params, e. g. for geo locations

2013-05-22 Thread Michael Brand
Hi all

On Tue, May 7, 2013 at 12:29 AM, Christian Moe  wrote:
> I'm afraid knowing that doesn't help much. The problem is, you don't know
> what point the inline call is at, so you cannot point org-entry-get to
> the right entry. If you try
>
> : (org-entry-get (point) "geo")
>
> it will look for a geo property in the outline entry the source block is
> in, not in the entry the call comes from.
>
> I don't know any easy way to pass a parameter to a source block from an
> outline entry property via an inline call in that entry. Others may know
> better.

After some trials it seemed to me that it is enough to just add a "loc
(point-marker)" to a "let" of org-babel-ref-resolve. Now when the Lisp
variable loc ("Location Of Call") is used as the first argument of
org-entry-get it reads the property from that entry where the code
block has been called. With this, Babel perfectly covers every
requirement of my use case described earlier in this thread.

Please review and comment my attached patch containing doc and ERT.

Michael
From 178d8c7100176561a395d545c193ea36225ab81c Mon Sep 17 00:00:00 2001
From: Michael Brand 
Date: Wed, 22 May 2013 18:59:24 +0200
Subject: [PATCH] Entry properties as code block arguments in Babel

* doc/org.texi (var): Document loc ("Location Of Call").
* lisp/ob-ref.el (org-babel-ref-resolve): Add `loc' which is set to
point as a marker object.
* testing/examples/babel.org: Add test entry for ERT.
* testing/lisp/test-ob-exp.el: Add expected code block results for
ERT.
---
 doc/org.texi|9 +
 lisp/ob-ref.el  |4 +++-
 testing/examples/babel.org  |   30 ++
 testing/lisp/test-ob-exp.el |8 
 4 files changed, 50 insertions(+), 1 deletions(-)

diff --git a/doc/org.texi b/doc/org.texi
index 290c671..29362cd 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -14381,6 +14381,15 @@ evaluation of the code block body.
 #+END_SRC
 @end example
 
+Within Emacs Lisp evaluation the Lisp variable @code{loc} provides the
+``Location Of Call'' as a marker object which can be passed for example to
+the Lisp function @code{org-entry-get} to read a property from that entry
+where the code block has been called:
+
+@example
+#+HEADERS: :var todo_state=(org-entry-get loc "TODO" t)
+@end example
+
 Note that values read from tables and lists will not be evaluated as
 Emacs Lisp, as shown in the following example.
 
diff --git a/lisp/ob-ref.el b/lisp/ob-ref.el
index a2814ea..9645b9e 100644
--- a/lisp/ob-ref.el
+++ b/lisp/ob-ref.el
@@ -124,7 +124,9 @@ the variable."
 (save-excursion
   (let ((case-fold-search t)
type args new-refere new-header-args new-referent result
-   lob-info split-file split-ref index index-row index-col id)
+   lob-info split-file split-ref index index-row index-col id
+   ;; For Emacs Lisp evaluation of :var, see Org manual.
+   (loc (point-marker)))
;; if ref is indexed grab the indices -- beware nested indices
(when (and (string-match "\\[\\([^\\[]+\\)\\]$" ref)
   (let ((str (substring ref 0 (match-beginning 0
diff --git a/testing/examples/babel.org b/testing/examples/babel.org
index 7c30ab2..8b18c3f 100644
--- a/testing/examples/babel.org
+++ b/testing/examples/babel.org
@@ -359,3 +359,33 @@ Here is a call line with more than just the results 
exported.
   <>
   echo "1$i"
 #+END_SRC
+
+* Emacs Lisp evaluation of :var with "loc" (Location Of Call)
+  :PROPERTIES:
+  :ID:   cc5fbc20-bca5-437a-a7b8-2b4d7a03f820
+  :END:
+
+#+NAME: func
+#+HEADERS: :var a=(string-to-number (or (org-entry-get loc "a" t) "0"))
+#+HEADERS: :var b=(string-to-number (or (org-entry-get loc "b" t) "0"))
+#+HEADERS: :var c=(string-to-number (or (org-entry-get loc "c" t) "0"))
+#+HEADERS: :var d=(string-to-number (or (org-entry-get loc "d" t) "0"))
+#+HEADERS: :var e=(string-to-number (or (org-entry-get loc "e" t) "0"))
+#+BEGIN_SRC emacs-lisp
+  (message "a:%d, b:%d, c:%d, d:%d, e:%d" a b c d e)
+#+END_SRC
+
+** section
+   :PROPERTIES:
+   :a:1
+   :c:3
+   :END:
+- section: call_func()
+
+*** subsection
+:PROPERTIES:
+:b:2
+:c:4
+:END:
+- subsec1: call_func()
+- subsec2: call_func(c=5, e=6)
diff --git a/testing/lisp/test-ob-exp.el b/testing/lisp/test-ob-exp.el
index abfe230..ea671f0 100644
--- a/testing/lisp/test-ob-exp.el
+++ b/testing/lisp/test-ob-exp.el
@@ -216,6 +216,14 @@ Here is one at the end of a line. =2=
   (should-not (string-match (regexp-quote "<>") result))
   (should-not (string-match (regexp-quote "i=\"10\"") result)
 
+(ert-deftest ob-exp/location-of-call ()
+  (org-test-at-id "cc5fbc20-bca5-437a-a7b8-2b4d7a03f820"
+(org-narrow-to-subtree)
+(let ((result (org-test-with-expanded-babel-code (buffer-string
+  (should (string-match "section: =a:1, b:0, c:3, d:0, e:0=" result))
+  (should (string-match "subsec1: =a:1, b:2, c:4, d:0, e:0=" result))
+  

Re: [O] XeLaTeX and the new exporter

2013-05-22 Thread Christopher Witte
Thanks, that fixed it.


On 14 May 2013 12:04, Søren Mikkelsen  wrote:

> Hi Chris
>
> I asked the question a couple of weeks ago. Take a look at the hook:
>
> org-export-before-parsing-hook
>
> It worked for me.
>
> Best regards
> Søren
>
>
> On 2013-05-07 17:42, Christopher Witte wrote:
>
>> Hi all,
>>
>> I had export working using XeLaTeX using the instructions from the FAQ
>> 
>> >
>>
>> (with some slight modifications), but after upgrading to the new export
>> it isn't working.  It appears the hook
>> org-export-latex-after-**initial-vars-hook isn't defined anymore.
>>
>> Any advice on what I need to change to get it to work?
>>
>> Thanks
>> Chris.
>>
>
>
>


Re: [O] formatting org-babel output

2013-05-22 Thread Joe Bogner
Eric - That is perfect. It's exactly what I was looking for. Thank you
for very much!

Jay - format is a good option too.I also found the scales packages

> scales::comma(scales::dollar(5))
[1] "$55,555"

In the end, the org-mode post solution feels more automatic and in the
right layer - since I'm using org-mode for presentation of the R
results.

Thanks again
Joe

On Wed, May 22, 2013 at 9:12 AM, Eric Schulte  wrote:
> Joe Bogner  writes:
>
>> I am using org-mode and babel with R for reproducible research. I
>> would like certain numbers in the output tables to be formatted for
>> easier reading - such as eliminating decimals and adding commas for
>> readability.
>>
>> The best I came up with is to use a TBLFM line at the bottom of my
>> results table using a function I found on the ElispCookbook on
>> emacswiki. A simple example is below that doesn't require R to
>> reproduce.
>>
>> It's a two step process currently to execute the R code in org-babel
>> and then jump to the result table TBLFM line and  Ctrl+c Ctrl+c to
>> format the table
>>
>> Is there a better way to format table outputs for simple things like
>> currency? I would be content if it's only during the org export
>> process too
>>
>
> You can use the recently introduced :post header argument to
> post-process the output of a code block.  The following example
> demonstrates the use of this argument to apply your number-grouper
> function to table output.
>
>
>
> Cheers,
>
> --
> Eric Schulte
> http://cs.unm.edu/~eschulte
>



Re: [O] Let's discuss citation and Org syntax

2013-05-22 Thread Matt Price
On Wed, May 22, 2013 at 5:02 AM, Christian Moe  wrote:
>
> I have a rough, working example of this enabling Zotero cites for ODT
> export (attached). I've been meaning to polish it up as a contributed
> module for Zotero users, but if there's interest in a unified citation
> syntax along these lines, I could rewrite it to work for Bibtex as well.
>
Hi Christian,

I'm really interested in this, as I use Zotero not only for writing
but for group bibliographies in my  courses.  The broader conversation
about the appropriate syntax is a bit beyond me, but I do have a
couple of questions about your work with Zotero:

(1) How do you get the Zotero cite keys right now, and what method do
you think would ultimately be the best to try for?  Since zotero now
operates as a service, I would think it should be possible to write an
emacs plugin that communicates directly to Zotero the way that the
word/libreoffice plugin does (though I don't know how to do that stuff
myself).

(2) How might you generalize the export to other formats, esp. HTML?
I imagine the best thing to do would be to use citeproc.js & set the
citation format using a variable, e.g.

#+ ZOTERO-FORMAT: Chicago

The option to do this would be great e.g. for people (like me) who use
org to compose blog posts, then process through the html export (in my
case via org2blog).

(3) Have you seen Erik Hetzner's zotero-plain,
https://bitbucket.org/egh/zotero-plain ?  Would it be useful to your
work? I see Erik is already involved in this thread, do you have any
comments Erik?

Thank you for this!

Matt

> Yours,
> Christian Moe
>



Re: [O] R plots always exported to Rplots.pdf

2013-05-22 Thread Eric Schulte
Greg Slodkowicz  writes:

> Hi,
> I'm trying to generate a report with R plots using org-mode but no matter
> what header arguments are you the generated files are always called
> Rplots.pdf
>
> This is what my code block looks like:
>
> #+NAME: pvals_waw
> #+BEGIN_SRC R :file fig1.png :exports results
> pvals = read.table("waw_data.txt", header=T)
> plot(pvals$pvalue, pvals$length)
> #+END_SRC
>
> after evaluating the code block I get
>
> #+RESULTS: pvals_waw
> [[file:fig1.png]]
>
> but I can see that the plot is in Rplots.pdf so subsequent attempt to
> export Latex/PDF fail.  I'm using org 20130522 and R 3.0.
>
> Best,
> Greg

The following example demonstrates the combination of header arguments
required to generate the correctly named output.

#+name: input
| 1 | 2 |
| 2 | 4 |
| 3 | 9 |

#+NAME: pvals_waw
#+headers: :var input=input
#+BEGIN_SRC R :results graphics :file output.pdf
plot(input)
#+END_SRC

after evaluating the code block I get

#+RESULTS: pvals_waw
[[file:output.pdf]]

This should be documented on Worg, but there is no doubt that there is
still work to be done on language-specific header argument
documentation.

-- 
Eric Schulte
http://cs.unm.edu/~eschulte


Re: [O] formatting org-babel output

2013-05-22 Thread Eric Schulte
Joe Bogner  writes:

> I am using org-mode and babel with R for reproducible research. I
> would like certain numbers in the output tables to be formatted for
> easier reading - such as eliminating decimals and adding commas for
> readability.
>
> The best I came up with is to use a TBLFM line at the bottom of my
> results table using a function I found on the ElispCookbook on
> emacswiki. A simple example is below that doesn't require R to
> reproduce.
>
> It's a two step process currently to execute the R code in org-babel
> and then jump to the result table TBLFM line and  Ctrl+c Ctrl+c to
> format the table
>
> Is there a better way to format table outputs for simple things like
> currency? I would be content if it's only during the org export
> process too
>

You can use the recently introduced :post header argument to
post-process the output of a code block.  The following example
demonstrates the use of this argument to apply your number-grouper
function to table output.

#+BEGIN_SRC emacs-lisp :results silent
  (defun group-number (num &optional size char)
"Format NUM as string grouped to SIZE with CHAR."
;; Based on code for `math-group-float' in calc-ext.el
(let* ((size (or size 3))
   (char (or char ","))
   (str (if (stringp num)
(number-to-string (string-to-number
   (replace-regexp-in-string "," "" num)))
  (number-to-string num)))
   (pt (or (string-match "[^0-9a-zA-Z]" str) (length str
  (while (> pt size)
(setq str (concat (substring str 0 (- pt size))
  char
  (substring str (- pt size)))
  pt (- pt size)))
  str))
#+END_SRC

The following code block will call the group-number Emacs Lisp
function on every cell in its input argument which is a number.

#+name: table-number-grouper
#+BEGIN_SRC emacs-lisp :var data='()
  (mapcar (lambda (row)
(if (equalp row 'hline) 'hline
  (mapcar (lambda (cell) (if (numberp cell) (group-number cell) cell))
  row)))
  data)
#+END_SRC

Here's a simple shell code block which produces the table (this is a
stand in for your R code block).
#+begin_src sh
  cat <
Cheers,

-- 
Eric Schulte
http://cs.unm.edu/~eschulte


Re: [O] Starting emacs followed directly by org-agenda search and visiting file removes color formatting

2013-05-22 Thread Rainer Stengele
Am 22.05.2013 15:02, schrieb Rainer Stengele:
> Am 21.05.2013 12:25, schrieb Bastien:
>>
>>
>> Hi Sébastien and John,
>>
>> "Sebastien Vauban" 
>> writes:
>>
>>> I did not have time yet to bisect the problem, but it _seems_ to be a newly
>>> introduced feature.
>>
>> Can you check if the problems persist *before* this commit?
>>
>> http://orgmode.org/cgit.cgi/org-mode.git/commit/?id=b83c03
>>
> Hi all,
> 
> today I updated from master and same issue here. Switching from agenda to org 
> buffer removes colors.
> How can I switch to b83c03. I get an error following the url you provided.
> 
> Rainer
> 
> 
> 
Bastien,

I switched to
commit 838e421bf53c2ae41e6321d363fd0e8b85eb3c32
and the colors are back again.

Rainer




Re: [O] Org sources and PDF files on Worg

2013-05-22 Thread Viktor Rosenfeld
Hi,

Jay Kerns wrote:

> Hello Viktor,
> 
> On Tue, May 21, 2013 at 2:13 PM, Viktor Rosenfeld  
> wrote:
> > Hi,
> >
> > I recently wrote a tutorial for the ox-koma-letter exporter [1] which
> > includes a link to an Org file [2] file and a PDF file [3] as examples.
> > The files are checked into the Worg repository, but they are not
> > available online. Is there something I have to do to enable this? At
> > first I thought the problem was related to the switchover to the new
> > exporter, but the issue persists.
> >
> > Also, an old version of the tutorial at an old address [4] is still
> > online even though I've changed the location in the git repository. How
> > can I delete this version?
> >
> > Cheers,
> > Viktor
> >
> > [1] http://orgmode.org/worg/exporters/koma-letter-export.html
> > [2] http://orgmode.org/worg/sources/exporters/koma-letter-example.org
> > [3] http://orgmode.org/worg/images/ox-koma-letter/koma-letter-example.pdf
> > [4] http://orgmode.org/worg/org-tutorials/koma-letter-export.html
> >
> 
> I believe I can give a partial answer: it looks like Worg isn't
> publishing right now, which suggests that there was a recent commit
> which broke things.  The search for the problem begins.  Once the
> error is identified and fixed, then things should get back to normal.

That's not it. The publishing process was working when I last checked. I
just pushed a change and it's reflected in the published HTML file, i.e.
[1], but the links are still now working and the old file still exists.

Cheers,
Viktor

> 
> I've copied Marc on this message - we'll see if we can track the problem down.
> 
> Thanks for the report.
> 
> -- 
> Jay Kerns
> 
> 
> -- 
> G. Jay Kerns, Ph.D.
> Youngstown State University
> http://people.ysu.edu/~gkerns/
> 



Re: [O] [patch] ox-koma-letter.el: clean-up/semantic bug [4/4]

2013-05-22 Thread Viktor Rosenfeld
Hi Rasmus,

Rasmus wrote:

> Viktor Rosenfeld  writes:
> 
> > Or 5, keep the change from SENDER to AUTHOR but revert the default
> > values to `org-koma-letter-*' variables. (Right now the AUTHOR and EMAIL
> > lines could be removed because they duplicate the derived latex
> > backend.)
> 
> I once had a teacher who talked about the optimal degree of
> conservatism (as well speaking positively about being in the infamoues
> ivory tower).  5. is fine with me.  So I guess the deal is
>   1. default value is the same as in ox-latex.
>   2. . . . but it's kept in a seperete variable ox-kl variable.
> 
> > I think that switching from SENDER to AUTHOR, keeping the
> > `org-koma-letter-{author,email}' variables in the KOMA backend, but
> > setting them per default to `user-full-name' and `user-mail-address',
> > would solve both your problems and let me keep LCO files. I would then
> > simply set these `org-koma-letter-*' variables to `nil' and document
> > this setup in the docstring. I'll see tomorrow if this is feasable.
> 
> Does the attached patch work for you (also with ps tags?)

It works, but I noticed the following problem: According to the Emacs
documentation `user-mail-address' is only set by Emacs after the
initialization process has completed and if it is not explicitly set
during initialization [1]. So, the defcustom of org-koma-letter-email
does not work as expected if the user has not set `user-mail-address'
before. Instead it is set to the empty string, which according to the
code setting `user-mail-address' means "not set yet."

This can be taking care of by using `after-init-hook' as in the example
below. It has the added advantage that the value of `user-mail-address'
will be picked up regardless of whether it is set before or after
require'ing ox-koma-letter. 

Note that this creates a slight inconsistency with regard to
`user-full-name' which is only picked up correctly if it is set before
require'ing ox-koma-letter. I've fixed this by a slightly complicated
defcustom definition of `org-koma-letter-author' and another
after-init-hook.

I've also changed the docstring to indicate what are the default values
and added the :group and :type flags again.

#+BEGIN_SRC
(defcustom org-koma-letter-email user-mail-address
  "The sender's email address.

This variable defaults to the value of `user-mail-address'."
  :group 'org-export-koma-letter
  :type 'string)

(add-hook 'after-init-hook 
(lambda ()
  (if (string= org-koma-letter-email "")
(setq org-koma-letter-email user-mail-address

(defcustom org-koma-letter-author (if (boundp 'org-koma-letter-author)
  user-full-name
;; Empty string means "not set yet."
"")
  "The sender's name.

This variable defaults to the value of `user-full-name'."
  :group 'org-export-koma-letter
  :type 'string)

(add-hook 'after-init-hook 
(lambda ()
  (if (string= org-koma-letter-author "")
(setq org-koma-letter-author user-full-name
#+END_SRC

Cheers,
Viktor

[1]
http://www.gnu.org/software/emacs/manual/html_node/elisp/User-Identification.html#User-Identification

> 
> –Rasmus
> 
> -- 
> Dung makes an excellent fertilizer

> >From 92b07bac2d707f01e48796778453b67a9ecd1daa Mon Sep 17 00:00:00 2001
> From: "rasmus.pank" 
> Date: Wed, 22 May 2013 01:16:54 +0200
> Subject: [PATCH 5/5] Variables for author and email for ox-koma-letter and a
>  bug fix.
> 
> * ox-koma-letter.el (koma-letter): reintroduced koma-letter
> specif author and email.
> * ox-koma-letter.el (koma-letter): set
> org-koma-special-content to nil when exporting
> 
> The former is needed so that author/email can be set in a LCO file.
> 
> TINYCHANGE
> ---
>  contrib/lisp/ox-koma-letter.el | 49 
> +++---
>  1 file changed, 27 insertions(+), 22 deletions(-)
> 
> diff --git a/contrib/lisp/ox-koma-letter.el b/contrib/lisp/ox-koma-letter.el
> index 020df52..92cf13a 100644
> --- a/contrib/lisp/ox-koma-letter.el
> +++ b/contrib/lisp/ox-koma-letter.el
> @@ -109,6 +109,12 @@
>:group 'org-export-koma-letter
>:type 'string)
>  
> +(defcustom org-koma-letter-email user-mail-address
> +  "The default email address stored in the letter." )
> +
> +(defcustom org-koma-letter-author user-full-name
> +  "The default name of the sender." )
> +
>  (defcustom org-koma-letter-signature "\\usekomavar{fromname}"
>"String used as the signature."
>:group 'org-export-koma-letter
> @@ -143,7 +149,6 @@ English manual of 2012-07-22)"
>:group 'org-export-koma-letter)
>  
>  
> -
>  (defcustom org-koma-letter-use-backaddress t
>"Print return address in small line above to address."
>:group 'org-export-koma-letter
> @@ -179,7 +184,6 @@ Use `foldmarks:true' to activate default fold marks or
>:group 'org-export-koma-letter
>:type 'string)
>  
> -
>  (defconst org-koma-letter-special-tags-after-closing
>'("PS" "ENCL" "CC")
>"Headers tags to be inserted after closing")
> @@ -193,7 +197,7 @@ Use `

Re: [O] R plots always exported to Rplots.pdf

2013-05-22 Thread Greg Slodkowicz
That solves it, many thanks!

- Greg


On Wed, May 22, 2013 at 2:38 PM, Jay Kerns  wrote:

> Hi Greg,
>
> On Wed, May 22, 2013 at 8:23 AM, Greg Slodkowicz  wrote:
>
> [snip]
>
> > This is what my code block looks like:
> >
> > #+NAME: pvals_waw
> > #+BEGIN_SRC R :file fig1.png :exports results
> > pvals = read.table("waw_data.txt", header=T)
> > plot(pvals$pvalue, pvals$length)
> > #+END_SRC
> >
>
> Have you tried (something like) this?
>
>  #+BEGIN_SRC R :exports results :results graphics :file fig1.png
>
> I hope this helps,
>
>
> --
> Jay
>



-- 
Greg Slodkowicz
PhD student, Nick Goldman group
EMBL-EBI


[O] (Potential) new feature for Org-mode: "hidden-lines cookies"

2013-05-22 Thread Thorsten Jolitz

Hi List, 

I implemented a new (optional and customizable) feature for
'outshine.el' (https://github.com/tj64/outshine):

,
| Behind every folded headline, a little 'cookie' shows the number of
| hidden lines till the next visible headline.
`

E.g., an Emacs Lisp buffer structured the 'outshine-way', with
'outline-minor-mode' and 'outshine' activated, might look like this
after doing 'M-x outshine-show-hidden-lines-cookies':

,---
| ;; * navi-mode.el --- major-mode for easy buffer-navigation [#13]
| ;; ** Commentary [#1]
| ;; *** About navi-mode
| 
| ;; This file implements extensions for occur-mode. You can think of a
| ;; navi-buffer as a kind of 'remote-control' for an (adecuately)
| ;; outline-structured original-buffer. It enables quick navigation and basic
| ;; structure editing in the original-buffer without (necessarily) leaving the
| ;; navi-buffer. When switching to the original-buffer and coming back after
| ;; some modifications, the navi-buffer is always reverted (thus up-to-date).
| 
| ;; Besides the fundamental outline-heading-searches (8 outline-levels) and the
| ;; 5 basic keyword-searches (:FUN, :VAR, :DB, :OBJ and :ALL), all languages
| ;; can have their own set of searches and keybindings (see `navi-key-mappings'
| ;; and `navi-keywords'). Heading-searches and keyword-searches can be
| ;; combined, offering a vast amount of possible 'views' at the
| ;; original-buffer.
| 
| ;; *** Usage [#165]
| ;; *** Installation [#19]
| ;; *** Emacs Version [#5]
| ;; * Requires [#4]
| ;; * Mode Definitions [#30]
`---

 'M-x outshine-hide-hidden-lines-cookies' deletes all the cookies again. 

Now I wonder if such a feature already exists in Org-mode (I would not
be surprised, but I'm not aware of it) and if anybody would be
interested in having such a feature?

I guess it would be quite easy to extract the relevant functionality
from outshine.el and make it a contrib library for Org-mode (mostly
renaming of definitions and maybe replacing some outline-functions by
their Org-mode equivalents. 

On the other hand - this is new (customizable) syntax, and with the new
parser and exporting framework there are probably more things to
consider than just porting the code to an Org-mode library.

PS 
Note that the appearance of the cookies can actually be completely
customized by 4 customizable variables that define 'left/right
delimiter' and 'left/right signal char'.

-- 
cheers,
Thorsten





Re: [O] R plots always exported to Rplots.pdf

2013-05-22 Thread Jay Kerns
Hi Greg,

On Wed, May 22, 2013 at 8:23 AM, Greg Slodkowicz  wrote:

[snip]

> This is what my code block looks like:
>
> #+NAME: pvals_waw
> #+BEGIN_SRC R :file fig1.png :exports results
> pvals = read.table("waw_data.txt", header=T)
> plot(pvals$pvalue, pvals$length)
> #+END_SRC
>

Have you tried (something like) this?

 #+BEGIN_SRC R :exports results :results graphics :file fig1.png

I hope this helps,


-- 
Jay



Re: [O] formatting org-babel output

2013-05-22 Thread Jay Kerns
Hi Joe,

On Wed, May 22, 2013 at 7:18 AM, Joe Bogner  wrote:
> I am using org-mode and babel with R for reproducible research. I
> would like certain numbers in the output tables to be formatted for
> easier reading - such as eliminating decimals and adding commas for
> readability.
>

[snip]

Have you considered doing your formatting in R before it ever gets to
the org table?  The format function is very powerful. For instance,

> format(163328361.2423, nsmall = 2, big.mark =",")
[1] "163,328,361.24"

Just an idea.

-- 
Jay



Re: [O] Org sources and PDF files on Worg

2013-05-22 Thread Jay Kerns
On Wed, May 22, 2013 at 3:04 AM, Bastien  wrote:
> Hi Jay and Marc,

[snip]

> Don't want to steal your work :)  Just thought I would fix this
> because I may be the one who broke things by forgetting to compile
> at some point.  I checked the scripts in ~/bin/ and they do compile
> normally.  Also, I removed the FORCE flag in (defun publish-worg ...)
> so that publishing does not republish everything.
>
> HTH,

Thanks, Bastien, yes, this helps a lot.

-- 
Jay



Re: [O] Starting emacs followed directly by org-agenda search and visiting file removes color formatting

2013-05-22 Thread Rainer Stengele
Am 21.05.2013 12:25, schrieb Bastien:
> 
> 
> Hi Sébastien and John,
> 
> "Sebastien Vauban" 
> writes:
> 
>> I did not have time yet to bisect the problem, but it _seems_ to be a newly
>> introduced feature.
> 
> Can you check if the problems persist *before* this commit?
> 
> http://orgmode.org/cgit.cgi/org-mode.git/commit/?id=b83c03
> 
Hi all,

today I updated from master and same issue here. Switching from agenda to org 
buffer removes colors.
How can I switch to b83c03. I get an error following the url you provided.

Rainer




[O] R plots always exported to Rplots.pdf

2013-05-22 Thread Greg Slodkowicz
Hi,
I'm trying to generate a report with R plots using org-mode but no matter
what header arguments are you the generated files are always called
Rplots.pdf

This is what my code block looks like:

#+NAME: pvals_waw
#+BEGIN_SRC R :file fig1.png :exports results
pvals = read.table("waw_data.txt", header=T)
plot(pvals$pvalue, pvals$length)
#+END_SRC

after evaluating the code block I get

#+RESULTS: pvals_waw
[[file:fig1.png]]

but I can see that the plot is in Rplots.pdf so subsequent attempt to
export Latex/PDF fail.  I'm using org 20130522 and R 3.0.

Best,
Greg


-- 
Greg Slodkowicz
PhD student, Nick Goldman group
EMBL-EBI


[O] formatting org-babel output

2013-05-22 Thread Joe Bogner
I am using org-mode and babel with R for reproducible research. I
would like certain numbers in the output tables to be formatted for
easier reading - such as eliminating decimals and adding commas for
readability.

The best I came up with is to use a TBLFM line at the bottom of my
results table using a function I found on the ElispCookbook on
emacswiki. A simple example is below that doesn't require R to
reproduce.

It's a two step process currently to execute the R code in org-babel
and then jump to the result table TBLFM line and  Ctrl+c Ctrl+c to
format the table

Is there a better way to format table outputs for simple things like
currency? I would be content if it's only during the org export
process too



#+BEGIN_SRC emacs-lisp
(defun group-number (num &optional size char)
"Format NUM as string grouped to SIZE with CHAR."
; Based on code for `math-group-float' in calc-ext.el
(let* ((size (or size 3))
   (char (or char ","))
   (str (if (stringp num)
(number-to-string (string-to-number
(replace-regexp-in-string "," "" num)))
  (number-to-string num)))
   (pt (or (string-match "[^0-9a-zA-Z]" str) (length str
  (while (> pt size)
(setq str (concat (substring str 0 (- pt size))
  char
  (substring str (- pt size)))
  pt (- pt size)))
  str))
#+END_SRC

#+RESULTS:
: group-number

 #+NAME: example-table
 | 1.55 | a |
 | 23000 | b |
 |  3000 | c |
 | 40004 | e |
 |  5000 | 3 |


This is the table I want formatted

#+BEGIN_SRC emacs-lisp :var data=example-table
data
#+END_SRC

 #+RESULTS:
 | 100,000,000.55 | a |
 | 23,000 | b |
 | 3,000  | c |
 | 40,004 | e |
 | 5,000  | 3 |
#+TBLFM: $1='(group-number $1)'



Re: [O] Let's discuss citation and Org syntax

2013-05-22 Thread Christian Moe

Hi,

I'd be cool with a dedicated citation syntax, or using a
yet-to-be-introduced extensible syntax for citations. 

But link syntax does make sense to me -- after all, citations do point
to things. And unlike one of the opinions you cited, I think link
descriptions *are* meaningful in citations, and can be made more
meaningful yet (code attached).

First, with links, you can have an easily human-readable reference in
the description, and the link keyword and citekey tucked away, e.g. as
you note:

>  [[cite:jones-etal-2000][Jones et al., 2000]]

That makes for a better authoring experience when revising your document
months or years later. Sure, Bibtex users usually keep their citekeys
mnemonic. However, there are alternatives to Bibtex, and people will
increasingly be keying their references to very non-mnemonic DOIs,
Zotero IDs or other database keys, etc.

But second, and more interesting: 

Parsing the description part as meaningful would also let us think
outside the latex box and handle things like page numbers and post-notes
a bit more intuitively. The following is an example of thinking like latex:

>So, a possible extension of that could, for instance,
>use a third pair of [] as in
>  [[cite:jones-etal-2000][Jones et al., 
> 2000][[citationcommand][prenote][postnote]]]
> ^^^  ^^
> key   displayed in org

Why should the prenote go nearly at the end? Do we really to add a
citation command? (Or define a bunch of different link types, one for
each citation command, as in Thomas S. Dye's excellent setup?) And do we
need all those brackets anyway?

My preference would be to write something like:

  [[cite:jones2000][(see further: Jones et al., 2000: p.18)]]

and  use a simple algorithm and a smidgen of extra processing power to
make sense of different human-meaningful forms of description, so that
e.g.:

  [[cite:jones2000][(2000: p.17)]] becomes a \citeyear
  [[cite:jones2000][Jones, 2000]] without round parens becomes a \citet

etc.

I have a rough, working example of this enabling Zotero cites for ODT
export (attached). I've been meaning to polish it up as a contributed
module for Zotero users, but if there's interest in a unified citation
syntax along these lines, I could rewrite it to work for Bibtex as well.

Yours,
Christian Moe



org-zotero-export.el
Description: application/emacs-lisp


[O] trigger org-capture window using linux shortcut key

2013-05-22 Thread jackin
Hi,

  I am wondering if it is possible to start a org-capture window
(when not within emacs) using a shortcut key. Org-protocol allows this
to be done from a web browser or adobe reader which is very useful. But
I am thinking of a more general solution, for triggering a org-capture
window from any where in Linux -> type in something and -> C-c c-c.

 Any ideas or solutions? Thanks in advance.

-jackin




Re: [O] Extending ODT export

2013-05-22 Thread Jambunathan K

doc-view (for OpenDocument files) uses the below mentioned work around.

The fix can be ported to `org-odt.el' and `ox-odt.el'.


--8<---cut here---start->8---
(defun doc-view-odf->pdf-converter-soffice (odf callback)
  "Convert ODF to PDF asynchronously and call CALLBACK when finished.
The converted PDF is put into the current cache directory, and it
is named like ODF with the extension turned to pdf."
  ;; FIXME: soffice doesn't work when there's another running
  ;; LibreOffice instance, in which case it returns success without
  ;; actually doing anything.  See LibreOffice bug
  ;; https://bugs.freedesktop.org/show_bug.cgi?id=37531.  A workaround
  ;; is to start soffice with a separate UserInstallation directory.
  (let ((tmp-user-install-dir (make-temp-file "libreoffice-docview" t)))
(doc-view-start-process "odf->pdf" doc-view-odf->pdf-converter-program
(list
 (concat "-env:UserInstallation=file://"
 tmp-user-install-dir)
 "--headless" "--convert-to" "pdf"
 "--outdir" (doc-view-current-cache-dir) odf)
(lambda ()
  (delete-directory tmp-user-install-dir t)
  (funcall callback)
--8<---cut here---end--->8---



Andreas Leha  writes:

> I had problems to use LibreOffice to convert a *already open* document.  So,
> if you are viewing the doc in LibreOffice while you try your export, you
> might run into problems.
>
> This is a reported bug in LibreOffice.  The suggested work-around is to
> use a temporary profile as in:
> libreoffice "-env:UserInstallation=file:///tmp/LibO_Conversion"
> --headless --invisible --convert-to txt:text "$FILENAME" >/dev/null
> ^^^
>
> You might try to add that to the conversion command and see whether it
> helps.



Re: [O] Trigger org-capture window using linux shortcut key

2013-05-22 Thread Michael Strey
Hi Jackin,

On Wed, May 22, 2013 at 06:40:39AM +, Jackin wrote:
>   I am wondering if it is possible to start a org-capture window
> (when not within emacs) using a shortcut key. Org-protocol allows this
> to be done from a web browser or adobe reader which is very useful. But
> I am thinking of a more general solution, for triggering a org-capture
> window from any where in Linux -> type in something and -> C-c c-c.
> 
>  Any ideas or solutions? Thanks in advance.

I've implemented this behaviour for my Xmonad desktop.  The solution
consists of two parts

1. The configuration of a shortcut calling a shell script in the Xmonad
configuration file .xmonad/xmonad.hs


2. A shell script simulating the keystrokes to change to the virtual
desktop were my Emacs lives and calling org-capture.

#+BEGIN_SRC shell
#!/bin/sh

xdotool key Super+m 7
emacsclient -e '(org-capture)'
#xdotool key Super+0
#+END_SRC

-- 
Michael Strey 
www.strey.biz



Re: [O] Org sources and PDF files on Worg

2013-05-22 Thread Bastien
Hi Jay and Marc,

Jay Kerns  writes:

> I believe I can give a partial answer: it looks like Worg isn't
> publishing right now, which suggests that there was a recent commit
> which broke things.

Apparently things broke because Org in ~/git/org-mode on the server 
was not compiled (and autoloads not created etc.)  I compiled Org
again and republished it.  It should publish correctly now.

> The search for the problem begins.  Once the
> error is identified and fixed, then things should get back to normal.

Don't want to steal your work :)  Just thought I would fix this
because I may be the one who broke things by forgetting to compile
at some point.  I checked the scripts in ~/bin/ and they do compile
normally.  Also, I removed the FORCE flag in (defun publish-worg ...)
so that publishing does not republish everything.

HTH,

-- 
 Bastien