Re: [O] Dired-like agenda

2014-06-06 Thread Thorsten Jolitz
Samuel Wales  writes:

> Here is a brainstorm/RFC/FR.  It is not entirely worked out,
> but it gives the flavor.
>
> The idea is to make Org agenda act more like Dired
> for consistency.

> Comments?

sounds definitely interesting, especially with the same keybindings like
in dired ...

-- 
cheers,
Thorsten




Re: [O] Remove the build-in orgmode

2014-06-06 Thread Thorsten Jolitz
Achim Gratz  writes:

> Nick Dokos writes:
>> I did that in the past (presumably for reasons similar to Thorsten's)
>> and I don't bother any longer (overriding is simple enough as you point
>> out), but the question  still bugs me: what's so bad about it?
>
> The reason it is bad is that parts of the code have already leaked out
> from the org/ directory via custom-load and autoloads and that's going
> to break things in the least convenient moment – for instance when you
> try to hunt down bugs via "-Q".  There simply is no way to remove the
> builtin Org from Emacs other than at build time and it's best not to
> pretend otherwise.  Some day Emacs might actually treat its built-in
> packages as actual packages so that you can de-activate or replace them,
> but I wouldn't hold my breath.

That sounds reasonable enough, but somehow that least convenient moment
never happens, while I remember *many* such moments when I still had more
than one Org on my machine ... but maybe I just don't huntdown bugs via
-Q often enough.

-- 
cheers,
Thorsten




Re: [O] a minor patch to awk invocation

2014-06-06 Thread Greg Minshall
though, in the spirit of "no good deed goes unpunished":

#+name: foo
| a | b | c |

#+begin_src awk :var a=foo
BEGIN{ print a; }
#+end_src

gives an error (and, ':var a="this is a test"' doesn't behave as one
might expect).  i haven't looked at ob-*.el enough to know the patterns
used to wrap up various forms of variables into different languages.



Re: [O] a minor patch to awk invocation

2014-06-06 Thread Greg Minshall
very nice -- thanks!

> I've just pushed up a patch which changes the behavior of awk code
> blocks to assign variables on the command line, so the following now
> work.

> #+begin_src awk :var a=2
> BEGIN{ print a; }
> #+end_src

> #+RESULTS:
> : 2



[O] Dired-like agenda

2014-06-06 Thread Samuel Wales
Here is a brainstorm/RFC/FR.  It is not entirely worked out,
but it gives the flavor.

The idea is to make Org agenda act more like Dired
for consistency.

For example, we might have commands like:

  1) %m -- mark headers with regexp
  2) %g -- mark headers with regexp in body text of entry
  3) %M -- mark lines containing a regexp
 + this would allow matching category/prefix etc.
 + Dired doesn't have this feature
  4) k -- kill this line or marked lines
 + this is similar to how < kills lines in the agenda
   that do not have the current category
  5) t -- toggle all marks
  6) s -- change sorting without redoing the whole agenda

Example of how it would work:

If you want to show only lines in the agenda that have a
category that matches "^x":

  1) %M ^..x RET to mark
  2) t to toggle
  3) k to show only the lines you want

This is actually something I want to do frequently.  It's
like < except with a regexp.  A command could do it, but it
might also be useful if the commands were more Dired-like.

Comments?

Samuel

-- 
The Kafka Pandemic: http://thekafkapandemic.blogspot.com

The disease DOES progress.  MANY people have died from it.  And
ANYBODY can get it.

Denmark: free Karina Hansen NOW.



Re: [O] Adding source location information when tangling

2014-06-06 Thread Thomas Morgan
Eric Schulte  writes:

> Thomas Morgan  writes:
>
>> Hi, Rainer, 
>>
>> Rainer M Krug  writes:
>>
>>> Envoyé de mon iPhone
>>>
 Le 25 mai 2014 à 18:28, Thomas Morgan  a écrit :
 
 Dear Org hackers,
 
 I have a question about tangling LilyPond code blocks.
 
 Is there a way to put the commands `\sourcefilename' and
 `\sourcefileline' in the tangled file before each block,
 perhaps in place of the comment that includes the same information?
>>>
>>> Yes - Check out the header option concerning tangling with comment. So
>>> links are inserted as comments which contain information about the
>>> filename And the header from which it was tangled.
>>
>> Thank you; that option is certainly useful.  What I was looking for,
>> though, is a way to replace or supplement the comments with commands
>> that indicate the same information directly to the compiler or
>> interpreter (`\sourcefilename' and `\sourcefileline' for LilyPond,
>> `#line' for C, etc.).
>>
>
> Hi Thomas,
>
> I believe the `org-babel-tangle-comment-format-beg' and
> `org-babel-tangle-comment-format-end' variable should provide the
> functionality you desire.

Hi, Eric,

Thank you, though I'm afraid I'm still having trouble getting
the right result.  The closest I've come is with this setting:

  (setq org-babel-tangle-comment-format-beg
"\\sourcefilename \"%file\"\n\\sourcefileline %start-line")

But this adds comment characters before the commands.

It also adds a blank line after the comment, throwing line numbers
off by one.  (Actually they are off by two; maybe LilyPond needs
\sourcefileline to be on the same line as the beginning of the code.)

By the way, I tried binding the variable this way in the Org file:

  #+BIND: org-babel-tangle-comment-format-beg "\\sourcefilename 
\"%file\"\n\\sourcefileline %start-line"

But that had no effect.

A further question: can this approach accommodate code blocks in
multiple languages in the same file?

Best,

Thomas



Re: [O] org-contacts email completion by tags

2014-06-06 Thread John Kitchin
Here is what I finally ended up with to allow completion with tag
expressions. I did not figure out how to avoid overwriting an
org-contacts function. I thought I could find the right hooks to use,
but I could not figure it out. It is only a one line modification to the
org-contacts function. This works for tag expressions, but I have not
gotten it to work with properties.


(defun org-contacts-complete-tags (start end tag-expression)
  "insert emails from org-contacts that match the tags expression. For example:
group-phd will match entries tagged with group but not with phd."
  (let* ((completion-ignore-case org-contacts-completion-ignore-case)
 (group-completion-p t))
(let ((result (mapconcat 'identity
 (loop for contact in (org-contacts-db)
   for contact-name = (car contact)
   for email = (org-contacts-strip-link (car 
(org-contacts-split-property
  (or
   (cdr 
(assoc-string org-contacts-email-property

  (caddr contact)))
   ""
   for tags = (cdr (assoc "TAGS" (nth 2 contact)))
   for tags-list = (if tags
   (split-string (substring (cdr 
(assoc "TAGS" (nth 2 contact))) 1 -1) ":")
 '())
   if (let ((todo-only nil))
(eval (cdr (org-make-tags-matcher 
tag-expression
   
   collect (org-contacts-format-email contact-name 
email))
 ",")))
  (when (not (string= "" result))
;; return (start end function)
(lexical-let* ((to-return result))
  (list start end
(lambda (string pred &optional to-ignore) to-return)))
  
this is the function I overwrote in my init files:
  
(defun org-contacts-message-complete-function (&optional start)
  "Function used in `completion-at-point-functions' in `message-mode'."
  ;; Avoid to complete in `post-command-hook'.
  (when completion-in-region-mode
(remove-hook 'post-command-hook #'completion-in-region--postch))
  (let ((mail-abbrev-mode-regexp
 
"^\\(Resent-To\\|To\\|B?Cc\\|Reply-To\\|From\\|Mail-Followup-To\\|Mail-Copies-To\\|Disposition-Notification-To\\|Return-Receipt-To\\):"))
(when (mail-abbrev-in-expansion-header-p)
  (lexical-let*
  ((end (point))
   (start (or start
  (save-excursion
(re-search-backward "\\(\\`\\|[\n:,]\\)[ \t]*")
(goto-char (match-end 0))
(point
   (string (buffer-substring start end)))
(or
 ;; I added the next line
 (org-contacts-complete-tags start end string)
 (org-contacts-complete-group start end string)
 (org-contacts-complete-name start end string))

-- 
---
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] Add a class for first paragraph in ox-html?

2014-06-06 Thread kuanyui
If you export an Org file to HTML, which has a paragraph before the
first outline, the paragraph will be only wrapped with  and no
class/id:

https://dl.dropboxusercontent.com/u/1776218/org-paragraph.png

This is an obstacle for write CSS for org HTML page. Maybe this can be
fix by add a seperate class or id for this paragraph? Thanks.

kuanyui [2014-06-07 土 06:34] GMT+8



Re: [O] Remove the build-in orgmode

2014-06-06 Thread Achim Gratz
Nick Dokos writes:
> I did that in the past (presumably for reasons similar to Thorsten's)
> and I don't bother any longer (overriding is simple enough as you point
> out), but the question  still bugs me: what's so bad about it?

The reason it is bad is that parts of the code have already leaked out
from the org/ directory via custom-load and autoloads and that's going
to break things in the least convenient moment – for instance when you
try to hunt down bugs via "-Q".  There simply is no way to remove the
builtin Org from Emacs other than at build time and it's best not to
pretend otherwise.  Some day Emacs might actually treat its built-in
packages as actual packages so that you can de-activate or replace them,
but I wouldn't hold my breath.


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

Samples for the Waldorf Blofeld:
http://Synth.Stromeko.net/Downloads.html#BlofeldSamplesExtra




Re: [O] a minor patch to awk invocation

2014-06-06 Thread Eric Schulte
Greg Minshall  writes:

> hi.  i just wandered down a rathole others could avoid.  the following
> program fails in (what was to me) a mysterious way:
> 
> #+BEGIN_SRC awk :var a=2
> BEGIN{print $a;}
> #+END_SRC
> 
>
> it turns out values for variables to awk need to be strings (rather than
> a number, as above).  below is a patch to give what might be a less
> mysterious error message.
>
> also: for an awk invocation with ":var a=b", all occurrences of "$a" in
> the body of the awk code are changed to "b".  i'm curious why this is
> done rather than invoking awk with "-v a=b"?  or, moving the
> initialization into a "BEGIN{}" block?  maybe because of the variety of
> awk variants loose in the world?
>

Hi Greg,

Thanks for pointing out this shortcoming and for suggesting the
command-line variable assignment option.  I've just pushed up a patch
which changes the behavior of awk code blocks to assign variables on the
command line, so the following now work.

#+begin_src awk :var a=2
BEGIN{ print a; }
#+end_src

#+RESULTS:
: 2

Thanks,

>
> cheers, Greg
> 
> diff --git a/lisp/ob-awk.el b/lisp/ob-awk.el
> index ed98afd..162ddfb 100644
> --- a/lisp/ob-awk.el
> +++ b/lisp/ob-awk.el
> @@ -47,6 +47,8 @@
>  (defun org-babel-expand-body:awk (body params)
>"Expand BODY according to PARAMS, return the expanded body."
>(dolist (pair (mapcar #'cdr (org-babel-get-header params :var)))
> +(if (not (stringp (cdr pair)))
> + (error "awk variable values must be strings"))
>  (setf body (replace-regexp-in-string
>  (regexp-quote (format "$%s" (car pair))) (cdr pair) body)))
>body)
>

-- 
Eric Schulte
https://cs.unm.edu/~eschulte
PGP: 0x614CA05D (see https://u.fsf.org/yw)



[O] export \cite options with ox-bibtex

2014-06-06 Thread Eric Schulte
Hi,

I just pushed up a small change to ox-bibtex (in comtrib), so that it is
possible to include options in cite: links.  So for example the
following link "[[cite:(Chapter 2)foo]]" will be converted to the
following LaTeX "\cite[Chapter 2](foo)".

Best,

-- 
Eric Schulte
https://cs.unm.edu/~eschulte
PGP: 0x614CA05D (see https://u.fsf.org/yw)



Re: [O] babel C, C++, D enhancement

2014-06-06 Thread Eric Schulte
Hi Thierry,

This looks wonderful, however after applying this patch I get the
following errors when running "make test-dirty".

> 10 unexpected results:
>FAILED  ob-C/inhomogeneous_table
>FAILED  ob-D/inhomogeneous_table
>FAILED  ob-D/integer-var
>FAILED  ob-D/list-list-var
>FAILED  ob-D/list-var
>FAILED  ob-D/simple-program
>FAILED  ob-D/string-var
>FAILED  ob-D/table
>FAILED  ob-D/two-integer-var
>FAILED  ob-D/vector-var

Could you update the test suite so that the C tests pass, and the D
tests are not executed when D is not available?

Also, could you flesh out the commit message so that it meets the Emacs
commit message guidelines (http://orgmode.org/worg/org-contribute.html)?

Many Thanks,
Eric

Thierry Banel  writes:

> Hi Bastien, hi all
>
> Here is a Babel enhancement for C, C++ and D languages
> - support for non-homogeneous tables (mixing numerics and strings)
> - support for table headers
> - easier iterating over a table
> - added some error handling
> - new D support for simple lists and vectors
> - new unit tests
>
> Current documentation is here :
> http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-C.html
> Draft of future documentation is here :
> http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-C-new.html
>
> Have fun
> Thierry
>
>
> From e66e6545776c0506a1f15db800dfe6424c6f997e Mon Sep 17 00:00:00 2001
> From: Thierry Banel 
> Date: Sun, 1 Jun 2014 23:30:20 +0200
> Subject: [PATCH] enhanced table handling in Babel C, C++, D
>
> ---
>  lisp/ob-C.el   |  302 
> +++-
>  testing/examples/ob-C-test.org |   88 
>  testing/lisp/test-ob-C.el  |  103 --
>  3 files changed, 384 insertions(+), 109 deletions(-)
>
> diff --git a/lisp/ob-C.el b/lisp/ob-C.el
> index 793981a..b1846de 100644
> --- a/lisp/ob-C.el
> +++ b/lisp/ob-C.el
> @@ -34,8 +34,6 @@
>(require 'cl))
>  (require 'ob)
>  (require 'cc-mode)
> -(eval-when-compile
> -  (require 'cl))
>  
>  (declare-function org-entry-get "org"
> (pom property &optional inherit literal-nil))
> @@ -72,40 +70,25 @@ This function calls `org-babel-execute:C++'."
>  This function is called by `org-babel-execute-src-block'."
>(let ((org-babel-c-variant 'cpp)) (org-babel-C-execute body params)))
>  
> -;;(defun org-babel-expand-body:C++ (body params) ;; unused
> -;;  "Expand a block of C++ code with org-babel according to it's
> -;;header arguments (calls `org-babel-C-expand')."
> -;;  (let ((org-babel-c-variant 'cpp)) (org-babel-C-expand body params)))
> -
>  (defun org-babel-execute:D (body params)
>"Execute a block of D code with org-babel.
>  This function is called by `org-babel-execute-src-block'."
>(let ((org-babel-c-variant 'd)) (org-babel-C-execute body params)))
>  
> -;; (defun org-babel-expand-body:D (body params) ;; unused
> -;;  "Expand a block of D code with org-babel according to it's
> -;;header arguments (calls `org-babel-C-expand')."
> -;;  (let ((org-babel-c-variant 'd)) (org-babel-C-expand body params)))
> -
>  (defun org-babel-execute:C (body params)
>"Execute a block of C code with org-babel.
>  This function is called by `org-babel-execute-src-block'."
>(let ((org-babel-c-variant 'c)) (org-babel-C-execute body params)))
>  
> -;; (defun org-babel-expand-body:c (body params) ;; unused
> -;;  "Expand a block of C code with org-babel according to it's
> -;;header arguments (calls `org-babel-C-expand')."
> -;;  (let ((org-babel-c-variant 'c)) (org-babel-C-expand body params)))
> -
>  (defun org-babel-C-execute (body params)
>"This function should only be called by `org-babel-execute:C'
>  or `org-babel-execute:C++' or `org-babel-execute:D'."
>(let* ((tmp-src-file (org-babel-temp-file
>   "C-src-"
> - (cond
> -  ((equal org-babel-c-variant 'c  ) ".c"  )
> -  ((equal org-babel-c-variant 'cpp) ".cpp")
> -  ((equal org-babel-c-variant 'd  ) ".d"  
> + (case org-babel-c-variant
> +  (c   ".c"  )
> +  (cpp ".cpp")
> +  (d   ".d"  
>(tmp-bin-file (org-babel-temp-file "C-bin-" org-babel-exeext)) ;; not 
> used for D
>(cmdline (cdr (assoc :cmdline params)))
>(cmdline (if cmdline (concat " " cmdline) ""))
> @@ -113,43 +96,62 @@ or `org-babel-execute:C++' or `org-babel-execute:D'."
>(flags (mapconcat 'identity
>  (if (listp flags) flags (list flags)) " "))
>(full-body
> -   (cond ((equal org-babel-c-variant 'c  ) (org-babel-C-expand-C   body 
> params))
> - ((equal org-babel-c-variant 'cpp) (org-babel-C-expand-C++ body 
> params))
> - ((equal org-babel-c-variant 'd  ) (org-babel-C-expand-D   body 
> params)
> +   (case org-babel-c-variant
> + (c   (org-babel-C-expand-C   body param

Re: [O] Collapse LaTeX source before start of main document?

2014-06-06 Thread Eric Schulte
Matt Lundin  writes:

> Chris Malone  writes:
>
> (Note: When using gmail, please adjust the settings to send your
> messages as plain text only instead of multipart/alternative.)
>
>> When I include the actual contents of my abstract, this preliminary material
>> section (the #+begin ... #+end block) is rather large.  I'd like to be able
>> to put this material into a headline so that I could collapse it - but I
>> don't want this headline exported as content of the main document.
>>
>> In other words, is there a property or tag that I can add to a headline that
>> causes LaTeX export to ignore the fact that it is a headline (i.e. \chapter,
>> \section, \subsection, etc.), but still export its contents?  Something
>> like:
>
> You could add a hook to remove headlines with a "prelim" tag:
>
> --8<---cut here---start->8---
> (defun my-org-export-remove-tagged-headlines (tag)
>   (save-excursion
> (goto-char (point-min))
> (while (re-search-forward (concat ":" tag ":") nil t)
>   (delete-region (point-at-bol) (point-at-eol)
>
> (add-hook 'org-export-preprocess-hook (lambda () 
> (my-org-export-remove-tagged-headlines "prelim")))
> --8<---cut here---end--->8---
>

I found the very useful but sadly outdated snippet from 2011.  If anyone
is interested, the following snippet implements the same functionality
within the new export framework.

--8<---cut here---start->8---
(defun org-export-remove-prelim-headlines (tree backend info)
  "Remove headlines tagged \"prelim\" while retaining their
contents before any export processing."
  (org-element-map tree org-element-all-elements
(lambda (object)
  (when (and (equal 'headline (org-element-type object))
 (member "prelim" (org-element-property :tags object)))
(mapc (lambda (el)
(let ((new-object
   (if (equal 'headline (org-element-type el))
   (org-element-put-property el
 :level (1- (org-element-property :level el)))
 el)))
  (message "%s level %s"
   (org-element-property :raw-value new-object)
   (org-element-property :level new-object))
  (org-element-insert-before new-object object)))
  (cddr object))
(org-element-extract-element object)))
info nil org-element-all-elements)
  tree)

(add-hook 'org-export-filter-parse-tree-functions
  'org-export-remove-prelim-headlines)
--8<---cut here---end--->8---

In addition it promotes all headlines under the removed "prelim"-tagged
headline.  This is useful to support structures like the following.

--8<---cut here---start->8---
* Appendix   :prelim:
#+LaTeX: \begin{appendices}
** Definitions
** Data Sets
** Tooling
#+LaTeX: \end{appendices}
--8<---cut here---end--->8---

Best,

-- 
Eric Schulte
https://cs.unm.edu/~eschulte
PGP: 0x614CA05D (see https://u.fsf.org/yw)



Re: [O] [BUG] [babel] in :eval never with :session

2014-06-06 Thread Eric Schulte
Rainer M Krug  writes:

> Charles Berry  writes:
>
>> Eric Schulte  gmail.com> writes:
>>
>>> 
>>> Rainer M Krug  krugs.de> writes:
>>> 
>>> > The error is back:
>>> >
>>> 
>>> You say "back", was this error not present recently?  If so could you
>>> isolate the commit at which this error appeared?
>>> 
>>
>> The bug seems to be in the use of
>>
>> (org-link-search heading) 
>>
>> in org-babel-exp-in-export-file which is called in 
>> org-babel-exp-process-buffer. 
>>
>> That search will find the first heading that is a match after 
>> (point-min). So it will mess up other header args, too.
>>
>> It was there back in 8.0.7 and recent commits did not touch it AFAICS.
>
> Org-mode version 7.9.3f (release_7.9.3f-17-g7524ef @
> /usr/local/Cellar/emacs-mac/emacs-24.3-mac-4.6/share/emacs/24.3/lisp/org/)
>
> as well. I don't think it makes sense to go further back. 
>
> So no regression, but bug.
>

Thanks Charles for pointing out the use of `org-link-search' in
`org-babel-exp-in-export-file' as the source of the problem.  I'm not
sure there's a clear solution here.  Given that there may be a different
outline structure between the original and exported file (e.g., some
headlines may be present in the former and absent from the later), in
the presence of multiple headings with the same name there is no obvious
(to me) way to find a given heading from the exported file in the
original file.

I've just pushed up a change, so that when headings have IDs these will
be used instead of the heading text to find related heading in the
original buffer.  This should provide a workaround when multiple
headings with the same text are desired---just add IDs to all such
headings.

Best,

>
> Cheers,
>
> Rainer
>
>>
>> HTH,
>>
>> Chuck
>>
>>> Thanks,
>>> Eric
>>> 
>>> >
>>> > When one header in a subtree which has the header argument
>>> > :eval never
>>> > has the same name as in a following subtree which should be evaluated on
>>> > export, the second subtree is not exported. When the name of the header
>>> > is changed, the subtree is exported as expected.
>>> >
>>> > --8<---cut here---start->8---
>>> > #+PROPERTY: exports both
>>> > #+PROPERTY: session *tmp_R*
>>> >
>>> > * Some non-evaluated code
>>> > :PROPERTIES:
>>> > :eval:  never
>>> > :END:
>>> > ** This is the same header
>>> > #+BEGIN_SRC R
>>> > cat("\ntwo\n")
>>> > #+END_SRC
>>> >
>>> > * Data Assessment Results
>>> > ** This is the same header
>>> > If the name of the header is changed, the subtree is evaluated on export.
>>> > #+begin_src R
>>> > cat("\nhere it is  
>> 
>> 
>> \n")
>>> > #+end_src
>>> > --8<---cut here---end--->8---
>>> >  
>>> > Org-mode version 8.2.6 (release_8.2.6-920-gc6d698   
>> /Users/rainerkrug/.emacs.d/org-mode/lisp/)
>>> > GNU Emacs 24.3.1 (x86_64-apple-darwin13.0.0, Carbon Version 1.6.0 AppKit
>> 1265) of 2014-02-13 on Rainers-MacBook-Pro-2.local
>>> >
>>> > Cheers,
>>> >
>>> > Rainer
>>> 
>>
>>
>>
>>
>>

-- 
Eric Schulte
https://cs.unm.edu/~eschulte
PGP: 0x614CA05D (see https://u.fsf.org/yw)



Re: [O] Bug: ob-ditaa fails in generating pdf correctly

2014-06-06 Thread Eric Schulte
Anders Johansson  writes:

> Hi,
> Example input:
> #+header: :eps t
> #+header: :file hello.pdf
> #+BEGIN_SRC ditaa
> +--+
> |  |
> |Hello |
> |  |
> +--+
> #+END_SRC
>
>
> When using the above code (which I guessed should be the correct way) 
> with ob-ditaa to produce a pdf (through  DitaaEps -> epstopdf) it fails 
> in producing the pdf correctly and instead writes an eps to "hello.pdf". 
> This isn't surprising, looking at the code where "cmd" should be 
> constructed to produce the eps as an intermediary file in /tmp (which is 
> expected in the construction of pdf-cmd) but doesn't.
>
> An ugly patch to fix it is attached

Applied.

> (this is ugly because it repeats the line:
> (org-babel-process-file-name (concat in-file ".eps")) )
>

I un-duplicated this line.

Thanks,

>
> Cheers,
> Anders Johansson
>
> --- "/home/aj/H\303\244mtningar/ob-ditaa.el"  2014-05-22 17:15:35.489071991 
> +0200
> +++ ob-ditaa.el   2014-05-22 17:08:46.617089186 +0200
> @@ -90,6 +90,12 @@
>(java (cdr (assoc :java params)))
>(in-file (org-babel-temp-file "ditaa-"))
>(eps (cdr (assoc :eps params)))
> +  (pdf-cmd (when (and (or (string= (file-name-extension out-file) "pdf")
> +  (cdr (assoc :pdf params
> + (concat
> +  "epstopdf"
> +  " " (org-babel-process-file-name (concat in-file ".eps"))
> +  " -o=" (org-babel-process-file-name out-file
>(cmd (concat org-babel-ditaa-java-cmd
> " " java " " org-ditaa-jar-option " "
> (shell-quote-argument
> @@ -97,13 +103,10 @@
>   (if eps org-ditaa-eps-jar-path org-ditaa-jar-path)))
> " " cmdline
> " " (org-babel-process-file-name in-file)
> -   " " (org-babel-process-file-name out-file)))
> -  (pdf-cmd (when (and (or (string= (file-name-extension out-file) "pdf")
> -  (cdr (assoc :pdf params
> - (concat
> -  "epstopdf"
> -  " " (org-babel-process-file-name (concat in-file ".eps"))
> -  " -o=" (org-babel-process-file-name out-file)
> +   " " (if pdf-cmd
> +   (org-babel-process-file-name (concat 
> in-file ".eps"))
> +   (org-babel-process-file-name 
> out-file
> +  )
>  (unless (file-exists-p org-ditaa-jar-path)
>(error "Could not find ditaa.jar at %s" org-ditaa-jar-path))
>  (with-temp-file in-file (insert body))

-- 
Eric Schulte
https://cs.unm.edu/~eschulte
PGP: 0x614CA05D (see https://u.fsf.org/yw)



Re: [O] [babel][PATCHES] ob-R patches for review

2014-06-06 Thread Eric Schulte
>> Additionally, if the variables simply hold R code text, then users can
>> easily initialize them from R files locally with something like the
>> following.
>>
>> (setq org-babel-R-assign-elisp-function
>>   (with-temp-buffer
>> (insert-file-contents-literally "personal.R")
>> (buffer-string)))
>>
>> I think this approach is much simpler.
>
> True - but I like the simplicity of being able to customize the
> behavior of org-babel-R by writing an R function without having to thin
> about elisp. But maybe there is a way of doing both...
>

I guess one man's simplicity is another confusing magic.  I don't see
the difficulty in having to change the value of an elisp variable, to
change the R code executed by an Emacs process, in fact I think this is
the most straight forward and expected way to do such customization.

> New behavior (environment):
> 1) Define the R code in emacs variables, i.e. customizable in emacs.
> 2) Define a function to load the code into an R environment - not 
> customizable.

The above sounds good to me.  It might be nice to also include a
customizable variable which controls whether the function in (2) is run
at all.

Best,

-- 
Eric Schulte
https://cs.unm.edu/~eschulte
PGP: 0x614CA05D (see https://u.fsf.org/yw)



Re: [O] Adding source location information when tangling

2014-06-06 Thread Eric Schulte
Thomas Morgan  writes:

> Hi, Rainer, 
>
> Rainer M Krug  writes:
>
>> Envoyé de mon iPhone
>>
>>> Le 25 mai 2014 à 18:28, Thomas Morgan  a écrit :
>>> 
>>> Dear Org hackers,
>>> 
>>> I have a question about tangling LilyPond code blocks.
>>> 
>>> Is there a way to put the commands `\sourcefilename' and
>>> `\sourcefileline' in the tangled file before each block,
>>> perhaps in place of the comment that includes the same information?
>>
>> Yes - Check out the header option concerning tangling with comment. So
>> links are inserted as comments which contain information about the
>> filename And the header from which it was tangled.
>
> Thank you; that option is certainly useful.  What I was looking for,
> though, is a way to replace or supplement the comments with commands
> that indicate the same information directly to the compiler or
> interpreter (`\sourcefilename' and `\sourcefileline' for LilyPond,
> `#line' for C, etc.).
>

Hi Thomas,

I believe the `org-babel-tangle-comment-format-beg' and
`org-babel-tangle-comment-format-end' variable should provide the
functionality you desire.

Best,

>
> Best,
>
> Thomas
>

-- 
Eric Schulte
https://cs.unm.edu/~eschulte
PGP: 0x614CA05D (see https://u.fsf.org/yw)



Re: [O] export org-table to wiki code

2014-06-06 Thread Shiyuan
I mean the "pipe syntax" as in http://en.wikipedia.org/wiki/Help:Table


On Fri, Jun 6, 2014 at 1:31 AM, Loris Bennett 
wrote:

> Hi,
>
> Shiyuan  writes:
>
> > Hi,
> > Is there a way to export a org-table to wiki code? Thanks.
> >
> > Shiyuan
>
> I don't think there is such a thing as "wiki code" - different wikis use
> different markup.
>
> Cheers,
>
> Loris
>
> --
> This signature is currently under construction.
>
>
>


Re: [O] Remove the build-in orgmode

2014-06-06 Thread Nick Dokos
Bastien  writes:

> Hi Thorsten,
>
> Thorsten Jolitz  writes:
>
>> (On Archlinux) I simply trash the Org dir shipped with Emacs and put a
>> symlink to my git-version of Org-mode there. I was told I shouldn't do
>> that, but since I had many problems with mixed installs before, and no
>> problems at all after doing so, I stick with this apparently 'bad
>> habit'.
>
> I confirm this is a bad habit :)
>

I did that in the past (presumably for reasons similar to Thorsten's)
and I don't bother any longer (overriding is simple enough as you point
out), but the question  still bugs me: what's so bad about it? The
only reason I'm not doing it is laziness. Are there others?

Nick








[O] Display only latest sub notes in agenda

2014-06-06 Thread Steffen Heilmann
Dear all,

thank you very much for the very helpful org-mode! I have been using it 
extensively during my studies and it saved me a great deal of trouble and time.

Now I want to use org-mode to organize / manage my networking contacts. I will 
have a top-level (*) entry for every person, and underneath for each meeting a 
(**) sub level entry with a time stamp.

I am looking for an easy way to see when I had the last interaction with 
everybody (preferably sorted by date). I want to use this to quickly see whom I 
have not contacted for some time and then can reach-out to them.

I have asked Sacha Chua for advice, she mentioned that it might be possible to 
use org-map-entries to go through the level 2 subtrees and update a LASTMEETING 
property on the parent, and then use org columns).

As I am not really firm with Lisp programming, I was wondering if somebody had 
done something similar before that he could share. Or alternatively if somebody 
could give me some help with writing the code. I guess all of this can be done 
very quickly if you know how to do so.

Thank you very much,

Steffen


Re: [O] small patch to org-mac-link (grab selected messages in Mail.app)

2014-06-06 Thread Anthony Lander
Hi Alan,

Thanks for the patch. It looks OK to me - can you please go ahead and apply
it to the file? Also, feel free to add your name to the contributor list at
the top of the file.

Thanks!

  -Anthony



On Wed, Jun 4, 2014 at 6:15 AM, Alan Schmitt  wrote:

> Hello,
>
> Please find attached a small patch to org-mac-link.el for the functions
> creating links to messages in Mail.app.
>
> The problem was that calling the org-mac-message-insert-selected would
> always add a spurious first link with empty url and an escaped quote as
> text. It would also leave another escaped quote at the end of the text
> of the real link.
>
> The patch makes sure that no extra empty line is created during the
> AppleScript call, and removes the escaped quotes around the whole value
> returned from AppleScript. I have left the code that removes additional
> quotes around individual links if they are there, but I don't think it's
> needed (I don't see how they could occur there).
>
> Best,
>
> Alan
>
>


Re: [O] latex equations and $ sign

2014-06-06 Thread Rasmus
Federico Beffa  writes:

> Hi,
>
> I would like to have a mathematical equation typeset in latex and
> automatically generated by sympy, embedded in an equation environment:
>
>   #+NAME: mass-energy
>   #+BEGIN_SRC python :results raw :exports results :wrap EQUATION
> import sympy as sp
> E, m, c = sp.symbols('E, m, c', real=True, positive=True)
> E = m*c**2
> return sp.latex(E)
>   #+END_SRC
>
>
>   #+NAME: eq:1
>   #+RESULTS: mass-energy
>   #+BEGIN_EQUATION
>   c^{2} m
>   #+END_EQUATION
>
> The problem I'm facing is that despite the fact that the equation is
> already in a mathematical mode latex environment, it still gets sub- and
> superscripts surrounded by a $ sign. Here is the generated latex snippet:
>
> \begin{equation}
> \label{eq:1}
> c$^{\text{2}}$ m
> \end{equation}
>
> Is there a way to teach org-mode not to insert $ signs in equation
> environments?

Is there a reason you are not using a mode argument like this:

#+NAME: mass-energy
#+BEGIN_SRC python :results raw :exports results :post
  import sympy as sp
  E, m, c = sp.symbols('E, m, c', real=True, positive=True)
  E = m*c**2
  return sp.latex(E, mode="inline")
#+END_SRC

#+RESULTS: mass-energy
$c^{2} m$


Alternatively, if you need to combine stuff you could use the post
argument

#+name: wrapper
#+BEGIN_SRC emacs-lisp :var x=""
(format "\\(%s\\)" x)
#+END_SRC

#+NAME: mass-energy
#+BEGIN_SRC python :results raw :exports results :post wrapper(x=*this*)
  import sympy as sp
  E, m, c = sp.symbols('E, m, c', real=True, positive=True)
  E = m*c**2
  return sp.latex(E)
#+END_SRC

#+RESULTS: mass-energy
\(c^{2} m\)

—Rasmus

-- 
El Rey ha muerto. ¡Larga vida al Rey!




Re: [O] latex equations and $ sign

2014-06-06 Thread Jorge A. Alfaro-Murillo

Federico Beffa  writes:

> Hi,
>
> I would like to have a mathematical equation typeset in latex and
> automatically generated by sympy, embedded in an equation environment:
>
> #+NAME: mass-energy
> #+BEGIN_SRC python :results raw :exports results :wrap EQUATION
> import sympy as sp
> E, m, c = sp.symbols('E, m, c', real=True, positive=True)
> E = m*c**2
> return sp.latex(E)
> #+END_SRC
>
> #+NAME: eq:1
> #+RESULTS: mass-energy
> #+BEGIN_EQUATION
> c^{2} m
> #+END_EQUATION
>
> The problem I'm facing is that despite the fact that the equation is
> already in a mathematical mode latex environment, it still gets sub-
> and superscripts surrounded by a $ sign. Here is the generated latex
> snippet:
>
> \begin{equation}
> \label{eq:1}
> c$^{\text{2}}$ m
> \end{equation}
>
> Is there a way to teach org-mode not to insert $ signs in equation
> environments?
>
> Thanks,
> Fede

Hi Federico,

I don't think that Org has a way to know that you want everything inside
#+BEGIN_EQUATION and #+END_EQUATION to be an equation in LaTeX, if
instead of EQUATION you write CENTER it does a \begin{center}
\end{center}. So by default it tries to produce text.

I would change your code to:

#+NAME: mass-energy
#+BEGIN_SRC python :results raw :exports results :wrap LaTeX
  import sympy as sp
  E, m, c = sp.symbols('E, m, c', real=True, positive=True)
  E = m*c**2
  return "\\begin{equation}\n" + str(sp.latex(E)) + "\n\\end{equation}\n"
#+END_SRC

which produces:

#+RESULTS: mass-energy
#+BEGIN_LaTeX
\begin{equation}
c^{2} m
\end{equation}
#+END_LaTeX

and gets exported to LaTeX as an equation. 

In fact if you use it often, you could make a function in python:

#+NAME: mass-energy
#+BEGIN_SRC python :results raw :exports results :wrap LaTeX
  import sympy as sp
  def org_equation(the_equation):
  return "\\begin{equation}\n" + str(sp.latex(the_equation)) + 
"\n\\end{equation}\n"

  E, m, c = sp.symbols('E, m, c', real=True, positive=True)
  E = m*c**2
  return org_equation(E)
#+END_SRC

Best,

Jorge.




Re: [O] Remove the build-in orgmode

2014-06-06 Thread Bastien
Hi Thorsten,

Thorsten Jolitz  writes:

> (On Archlinux) I simply trash the Org dir shipped with Emacs and put a
> symlink to my git-version of Org-mode there. I was told I shouldn't do
> that, but since I had many problems with mixed installs before, and no
> problems at all after doing so, I stick with this apparently 'bad
> habit'.

I confirm this is a bad habit :)

>From sources (git or tarball), Org mode setup is just this

(add-to-list 'load-path "/src/org-mode/")
(require 'org)

As for testing, Brady's solution to use emacs -q -l "~/testing.el"
is also the one I would suggest.

2 cents,

-- 
 Bastien



[O] Bug: org-agenda-get-sexps and erroneous agenda tag filtering. [8.2.6 (8.2.6-dist @ /home/rberger/Emacs/share/emacs/site-lisp/org/)]

2014-06-06 Thread Raimund Berger

Remember to cover the basics, that is, what you expected to happen and
what in fact did happen.  You don't know how to make a good report?  See

 http://orgmode.org/manual/Feedback.html#Feedback

Your bug report will be posted to the Org-mode mailing list.


Hi there,

there seems to be an error in org-agenda-get-sexps, in the way tags are
stored for sexp diary entries. I noticed that when trying to filter in
the agenda, for diary entries that inherited a file wide PERSONAL tag.
The sexp entries just vanished when the filter was applied, while normal
diary entries in the diary tree were displayed as expected.

For each normal entry in the diary, the inherited tag was stored in
lower case as an agenda text property of the specific entry, so the tag
read "personal". Except for sexps, where the tag was stored "as is" in
upper case, namely PERSONAL.

By comparing with other functions, I noticed that deleting the 
  'tags tags
part in code portion
(org-add-props txt props 'org-marker marker
   'org-category category 'date date 'todo-state 
todo-state
   'org-category-position category-pos 'tags tags
   'level level
   'type "sexp" 'warntime warntime)

of function
  org-agenda-get-sexps

fixed the issue. Apparantly, the tags are aleady dealt with by the
"org-add-props txt" call, and correctly so (in lower case).

Regards, R.


Emacs  : GNU Emacs 24.3.1 (i686-pc-linux-gnu, GTK+ Version 2.24.10)
 of 2014-05-18 on gigli
Package: Org-mode version 8.2.6 (8.2.6-dist @ 
/home/rberger/Emacs/share/emacs/site-lisp/org/)



[O] latex equations and $ sign

2014-06-06 Thread Federico Beffa
Hi,

I would like to have a mathematical equation typeset in latex and
automatically generated by sympy, embedded in an equation environment:

  #+NAME: mass-energy
  #+BEGIN_SRC python :results raw :exports results :wrap EQUATION
import sympy as sp
E, m, c = sp.symbols('E, m, c', real=True, positive=True)
E = m*c**2
return sp.latex(E)
  #+END_SRC


  #+NAME: eq:1
  #+RESULTS: mass-energy
  #+BEGIN_EQUATION
  c^{2} m
  #+END_EQUATION

The problem I'm facing is that despite the fact that the equation is
already in a mathematical mode latex environment, it still gets sub- and
superscripts surrounded by a $ sign. Here is the generated latex snippet:

\begin{equation}
\label{eq:1}
c$^{\text{2}}$ m
\end{equation}

Is there a way to teach org-mode not to insert $ signs in equation
environments?

Thanks,
Fede


Re: [O] An org password manager

2014-06-06 Thread Michael Albinus
jorge.a.alf...@gmail.com (Jorge A. Alfaro-Murillo) writes:

> Michael Albinus  writes:

Hi Jorge,

>> A useful feature would be an auth-source backend, See (info "(auth)")
>> By this, other packages (like Gnus or Tramp) would profit from the
>> password manager directly.
>
> Thanks Michael. I will look more into auth. What is your idea? To be
> able to use something like auth-source-search, to pass features of the
> org-passwords database as secrets? 

yes.

> I only use auth for gnus and jabber, so my .authinfo.gpg is only five
> lines. What setup could benefit on that? Can auth send secrets to other
> applications, like a web browser?

If another Emacs package uses auth-source-search, it would benefit
automatically from your backend. Several packages uses it already, like
Tramp, gnus, url, erc, ldap.

> Best,
>
> Jorge.

Bet regards, Michael.



Re: [O] Feature request: creating separate tables on same rows

2014-06-06 Thread Rainer M Krug
Aldric Giacomoni  writes:

> Understood, thank you very much for explaining it :)

Well - you could define it as one huge table, where the first x columns
belong to the first table, and the last x belong to the second table -
but using this table as an input for further calculations might be
tricky.

Cheers,

Rainer

>
>
> On Thu, Jun 5, 2014 at 7:06 PM, Jorge A. Alfaro-Murillo <
> jorge.a.alf...@gmail.com> wrote:
>
>> Thorsten Jolitz  writes:
>>
>> > In Org-mode that would be (at least) very strange, but Org-mode uses
>> > backends for the final docs, so you might want to look at e.g. LaTeX
>> > multi-column styles and if Org-mode supports them somehow. But even if
>> > so, it might get complicated and using AucTex directly might be the
>> > better choice in such cases.
>>
>> I agree, in such cases I use AucTeX directly. You can use orgtbl-mode in
>> your tex file to build the main data of the table in LaTeX in Org form,
>> check: (info "(org) A LaTeX example"). Then add your multi-columns with:
>>
>> #+BEGIN_LaTeX
>>   \multirow{''num_rows''}{''width''}{''contents''}
>> #+END_LaTeX
>>
>> If you want multi-rows:
>> #+BEGIN_LaTeX
>>   \usepackage{multirow}
>>   \multirow{''num_rows''}{''width''}{''contents''}
>> #+END_LaTeX
>>
>> A complete example, from a recent paper I was working on:
>>
>> #+BEGIN_LaTeX
>> \documentclass{article}
>> \usepackage{multirow}
>> \usepackage{booktabs}
>> \begin{document}
>>
>> \begin{table}
>>   \centering
>>   \begin{tabular}{cc}
>> \toprule
>> \multirow{2}{*}{Age-group} & \multirow{2}{*}{$L-a$} &
>> \multirow{2}{*}{$p_{d}$}  & \multirow{2}{*}{$p_{h}$} &
>> \multicolumn{2}{c}{Likelihood} \\
>> \cmidrule(lr){5-6}
>> & & & & Mean & 95\% CI \\
>> \midrule
>> 0-5   & 83.73 & 0.4 & 0.0141  & 0.38009 &
>> $[0.24024,\,0.53638]$\\
>> 5-17  & 74.78 & 0.1 & 0.0006  & 0.19399 &
>> $[0.10497,\,0.31382]$\\
>> 18-49 & 52.52 & 0.9 & 0.0042  & 0.12682 &
>> $[0.07216,\,0.20166]$\\
>> 50-64 & 30.10 & 0.00134 & 0.0193  & 0.12682 &
>> $[0.07216,\,0.20166]$\\
>> 65+   & 14.19 & 0.01170 & 0.0421  & 0.17229 &
>> $[0.09871,\,0.26994]$\\
>> \bottomrule
>>   \end{tabular}
>>   \caption{Age-dependent health effect parameters.}
>> \end{table}
>>
>> \end{document}
>> #+END_LaTeX
>>
>> Everything between \midrule and \bottomrule is easier written with
>> orgtbl-mode.
>>
>> Best,
>>
>> Jorge.
>>
>>
>>

-- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, 
UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa

Tel :   +33 - (0)9 53 10 27 44
Cell:   +33 - (0)6 85 62 59 98
Fax :   +33 - (0)9 58 10 27 44

Fax (D):+49 - (0)3 21 21 25 22 44

email:  rai...@krugs.de

Skype:  RMkrug

PGP: 0x0F52F982


pgpg4RxFK7sSd.pgp
Description: PGP signature


Re: [O] export org-table to wiki code

2014-06-06 Thread Loris Bennett
Hi,

Shiyuan  writes:

> Hi, 
>     Is there a way to export a org-table to wiki code? Thanks. 
>
> Shiyuan 

I don't think there is such a thing as "wiki code" - different wikis use
different markup.

Cheers,

Loris

-- 
This signature is currently under construction.




Re: [O] src blocks not fontified

2014-06-06 Thread Sebastien Vauban
Shiyuan wrote:
> On Thu, Jun 5, 2014 at 6:13 AM, Sebastien Vauban wrote:
>> Shiyuan wrote:
>>> On Tue, Jun 3, 2014 at 11:53 AM, Nick Dokos  wrote:

 htmlize.el is included in the contrib/lisp directory of org (but I'm not
 sure if contrib is part of the ELPA org distribution - it is available
 if you get org from the git repo or from the tarball). The one I have
 says:

 ,
 | ;;; htmlize.el --- Convert buffer text and decorations to HTML.
 |
 | ;; Copyright (C) 1997-2013 Hrvoje Niksic
 |
 | ;; Author: Hrvoje Niksic 
 | ;; Keywords: hypermedia, extensions
 | ;; Version: 1.43
 `
>>> I need to download the htmlize.el from the org-mode git repos
>>> separately.  After that, htmlize works magically and highlights the
>>> syntax in the resulting html without any extra markup. Thanks for
>>> the help.
>>
>> You can find it in ELPA. Mine:
>>
>>   ╭
>>   │ ;;; htmlize.el --- Convert buffer text and decorations to HTML.
>>   │
>>   │ ;; Copyright (C) 1997-2003,2005,2006,2009,2011,2012 Hrvoje Niksic
>>   │
>>   │ ;; Author: Hrvoje Niksic 
>>   │ ;; Keywords: hypermedia, extensions
>>   │ ;; Version: 20130207.1202
>>   │ ;; X-Original-Version: 1.47
>>   ╰
>
> What ELPA repos you are using? Could you show me the value of C-h
> v package-archives? Thanks.

I do use this:

--8<---cut here---start->8---
  ;; archives from which to fetch
  (setq package-archives
(append '(("org"   . "http://orgmode.org/elpa/";)
  ("melpa" . "http://melpa.milkbox.net/packages/";)
  ("marmalade" . "http://marmalade-repo.org/packages/";)
  ;; ("ELPA"  . "http://tromey.com/elpa/";)
  )
package-archives))
--8<---cut here---end--->8---

Best regards,
  Seb

-- 
Sebastien Vauban



[O] export org-table to wiki code

2014-06-06 Thread Shiyuan
Hi,
Is there a way to export a org-table to wiki code? Thanks.

Shiyuan