Re: [O] org-vcard -- possible to convert .vcf files to .org ?

2017-02-19 Thread Eric S Fraga
On Sunday, 19 Feb 2017 at 06:49, John Magolske wrote:
> Can org-vcard convert .vcf files into .org files? I have a .vcf file,
> a list of contacts generated from an android phone, which I'd like to
> edit, through a process like:

[...]

> but that buffer is empty. Same when I select as Destination "file",
> it produces an empty file.

I've just tried this and it worked for me (give or take).  Both ways.

What versions of org, emacs and org-vcard?  I downloaded the latest
version of the latter from https://github.com/flexibeast/org-vcard

By the way, there is also a bbdb-vcard package that may be of use to you.

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 26.0.50.1, Org release_9.0.4-242-g2c27b8


signature.asc
Description: PGP signature


Re: [O] %( in capture template

2017-02-19 Thread Samuel Wales
the above bug description pertains to recent org maint.



Re: [O] %( in capture template

2017-02-19 Thread Samuel Wales
On 2/19/17, Nicolas Goaziou  wrote:
> I have trouble understanding the double quote above. Do you mean the
> text below is inserted within the %(concat ...) or are these your
> templates? In this case, which one produces the error?

thanks for asking about this.

for clarity, let's do it from the beginning.

[first please note that i am experiencing random results.  sometimes
it works fine but:

  1] sometimes nothing shows up
  2] sometimes as i will describe below
  3] sometimes nothing shows up, but "Warning (emacs): Please update
your org protocol handler to deal with new-style links." buffer pops
up

what i will describe is 2, which is the topic of this thread.]

just now i selected the first two paragraphs of the quote of your
email, and clicked the org-capture extension unicorn.

i use this function:

(defun alpha-org-protocol-string (link description region)
  (format "* x
   link %s
   description %s
   region %s
   " link description region))

the result of clicking on the unicorn:

===
* x
   link
https://mail.google.com/mail/u/0/h/rfjkj7op114w/?=15a580ccf5cb9d34=c
   description Gmail - %( in capture template
   region
%(alpha-org-protocol-string
"https://mail.google.com/mail/u/0/h/rfjkj7op114w/?=15a580ccf5cb9d34=c;
"Gmail - %( in capture template" "> with the new org maint code, i
still occasionally get the literal string.
%(alpha-org-protocol-string
"https://mail.google.com/mail/u/0/h/rfjkj7op114w/?=15a580ccf5cb9d34=c;
"Gmail - %( in capture template" ">
%(alpha-org-protocol-string
"https://mail.google.com/mail/u/0/h/rfjkj7op114w/?=15a580ccf5cb9d34=c;
"Gmail - %( in capture template" "> it occurs when the region spans a
blank line.
===

region should be what i selected.  instead it is a garbled version of
what i selected with the literal function call text.  is this user
error?

the double quotes are as you see them.  i did not add any.

below are my templates.

  (add-to-list 'org-capture-templates
   `("L" "Protocol L for link" entry
 (file+headline ,org-default-notes-file "xyzzy-remember")
 ;; fixme perhaps i do not need the %i, if it is for no text
 "%(alpha-org-protocol-string \"%:link\"
\"%:description\" \"%i\") L"
 :prepend t :immediate-finish t :jump-to-captured t))
  ;; this seems to get called by org capture whether selection or not
  (add-to-list 'org-capture-templates
   `("p" "Protocol p" entry
 (file+headline ,org-default-notes-file "xyzzy-remember")
 "%(alpha-org-protocol-string \"%:link\"
\"%:description\" \"%i\")"
 :prepend t :immediate-finish t :jump-to-captured t))

the org capture extension is set to p, so the second one should be the
operative one.  but what do i know?

so perhaps %i is being set to some crazy value.

i definitely do not understand any of this stuff.



[O] [PATCH] Add org-babel support for hledger

2017-02-19 Thread Simon Michael
Hello all, thanks for org-mode. 

I'd like org-babel to support hledger for generating financial reports, similar 
to the existing support for Ledger. 

I don't know the exact process to follow (instructions in the git repo, on the 
website and in irc are different) and have not yet signed FSF copyright 
assignment - any help appreciated. Below is the output of git format-patch.

Best,
-Simon


From 4b9348d9b8eaecea948b4295776d4f33e1d43c0d Mon Sep 17 00:00:00 2001
From: Simon Michael 
Date: Sat, 18 Feb 2017 18:14:54 +
Subject: [PATCH] Add org-babel support for hledger

* lisp/ob-hledger.el:
* lisp/org.el (org-babel-load-languages):
* lisp/ox-html.el (org-html-style-default): allow calling hledger from org-babel
---
 lisp/ob-hledger.el | 70 ++
 lisp/org.el|  1 +
 lisp/ox-html.el|  1 +
 3 files changed, 72 insertions(+)
 create mode 100644 lisp/ob-hledger.el

diff --git a/lisp/ob-hledger.el b/lisp/ob-hledger.el
new file mode 100644
index 0..90c6fa981
--- /dev/null
+++ b/lisp/ob-hledger.el
@@ -0,0 +1,70 @@
+;;; ob-hledger.el --- org-babel functions for hledger
+
+;; Copyright (C) 2010-2017 Free Software Foundation, Inc.
+
+;; Author: Simon Michael
+;; Keywords: literate programming, reproducible research, plain text accounting
+;; Homepage: http://orgmode.org
+
+;; This file is 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:
+
+;; Org-Babel support for evaluating hledger entries.
+;;
+;; Based on ob-ledger.el.  
+;; If the source block is empty, hledger will use a default journal file,
+;; probably ~/.hledger.journal (it may not notice your $LEDGER_FILE env var).
+;; So make ~/.hledger.journal a symbolic link to the real file if necessary.
+
+;;; Code:
+(require 'ob)
+
+(defvar org-babel-default-header-args:hledger
+  '((:results . "output") (:exports . "results") (:cmdline . "bal"))
+  "Default arguments to use when evaluating a hledger source block.")
+
+(defun org-babel-execute:hledger (body params)
+  "Execute a block of hledger entries with org-babel.  This function is
+called by `org-babel-execute-src-block'."
+  (message "executing hledger source code block")
+  (let ((result-params (split-string (or (cdr (assoc :results params)) "")))
+   (cmdline (cdr (assoc :cmdline params)))
+(in-file (org-babel-temp-file "hledger-"))
+   (out-file (org-babel-temp-file "hledger-output-")))
+(with-temp-file in-file (insert body))
+(message "%s" (concat "hledger"
+  (if (> (length body) 0)
+  (concat " -f " (org-babel-process-file-name 
in-file))
+"")
+  " " cmdline))
+(with-output-to-string
+  (shell-command (concat "hledger"
+ (if (> (length body) 0)
+ (concat " -f " (org-babel-process-file-name 
in-file))
+   "")
+ " " cmdline
+ " > " (org-babel-process-file-name out-file
+(with-temp-buffer (insert-file-contents out-file) (buffer-string
+
+(defun org-babel-prep-session:hledger (session params)
+  (error "hledger does not support sessions"))
+
+(provide 'ob-hledger)
+
+
+
+;;; ob-hledger.el ends here
diff --git a/lisp/org.el b/lisp/org.el
index 3290a2b96..0afd37360 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -268,6 +268,7 @@ requirements) is loaded."
 (const :tag "Fortran" fortran)
 (const :tag "Gnuplot" gnuplot)
 (const :tag "Haskell" haskell)
+(const :tag "hledger" hledger)
 (const :tag "IO" io)
 (const :tag "J" J)
 (const :tag "Java" java)
diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index 0ca19ef45..f629cbd52 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -333,6 +333,7 @@ for the JavaScript code in this tag.
   pre.src-fortran:before { content: 'Fortran'; }
   pre.src-gnuplot:before { content: 'gnuplot'; }
   pre.src-haskell:before { content: 'Haskell'; }
+  pre.src-hledger:before { content: 'hledger'; }
   pre.src-java:before { content: 'Java'; }
   pre.src-js:before { content: 'Javascript'; }
   pre.src-latex:before { content: 'LaTeX'; }
-- 
2.11.0




[O] orgtbl-insert-matrix, embedded

2017-02-19 Thread Uwe Brauer


Hi

I can use orgtbl-insert-matrix to nicely insert one matrix
resulting in
% BEGIN RECEIVE ORGTBL neu
\[
\begin{pmatrix}
8 & 8 \\
 &  \\
\end{pmatrix}
\]
% END RECEIVE ORGTBL neu
\begin{comment}
#+ORGTBL: SEND neu orgtbl-to-latex-matrix :splice nil :skip 0
| 8 | 8 |
|   |   |
\end{comment}
is there a way to insert another array into the same latex environment?

Thanks

Uwe Brauer 




[O] org-caldav, pull only

2017-02-19 Thread Michael Welle
Hello,

can I configure org-caldav in such a way, that it doesn't synchronise,
but only pull from the server? I don't want local changes, esp.
deletions in shared calendars, going back to the server.

Regards
hmw



Re: [O] Problem of refile in the org capture buffer

2017-02-19 Thread Nicolas Goaziou
Hello,

Liu Hui  writes:

> I find C-c C-w (refine) in the org capture buffer doesn't work
> correctly when there are empty lines (containing the point) in the end
> of buffer. Steps to reproduce:
>
> 1. echo -e "* A\n* B" > /tmp/test.org; cat /tmp/test.org
> * A
> * B
>
> 2. Emacs -Q, and evaluate the code:
>
> (setq org-capture-templates
>   '(("t" "Todo" entry (file+headline "/tmp/test.org" "A")
>  "** test1 %?")))
>
> 3. M-x org-capture, and press t to open the org capture buffer
>
> 4. In the capture buffer, press C-j to insert a newline, then C-c C-w:
>
>=> the subtree "B" will be refiled rather than the "test1".
>
>
> The problem is caused by org-capture-finalize, which deletes empty
> lines and, as a result, makes the point saved by org-capture-refile
> invalid. The following patch should fix the problem:
>
> diff --git a/lisp/org-capture.el b/lisp/org-capture.el
> index 1a1a500..27cb60b 100644
> --- a/lisp/org-capture.el
> +++ b/lisp/org-capture.el
> @@ -827,6 +827,9 @@ already gone.  Any prefix argument will be passed
> to the refile command."
> (base (buffer-base-buffer (current-buffer)))
> (org-capture-is-refiling t)
> (kill-buffer (org-capture-get :kill-buffer 'local)))
> +(and (< (skip-chars-backward " \t\n") 0)
> +(not (bobp))
> +(setq pos (point)))
>  (org-capture-put :kill-buffer nil)
>  (org-capture-finalize)
>  (save-window-excursion

Thank you for the patch and the analysis. I eventually fixed it with
a slightly different solution, however.

Regards,

-- 
Nicolas Goaziou



Re: [O] Why is Org PDF LaTeX Output not readonly?

2017-02-19 Thread Florian Lindner
Am 17.02.2017 um 13:35 schrieb Nicolas Goaziou:
> Hello,
> 
> Florian Lindner  writes:
> 
>> Am 16.02.2017 um 14:47 schrieb Eric S Fraga:
>>> On Thursday, 16 Feb 2017 at 08:33, Florian Lindner wrote:
 It would be much easier to close it quickly this way and it would be
 consistent with other buffers that serve the same
 purpose, like the beforementioned Auctex output buffer.
>>>
>>> It would indeed be easier.  The buffer is created in org-latex-compile
>>> and I guess it would be the case of setting the mode for the buffer?
>>> Beyond my level of elisp expertise however.
>>
>> There is with-output-to-temp-buffer with redirects the output to a temp 
>> buffer that behaves like a help window and shows
>> that buffer Using this function however makes only sense, when org mode 
>> defaults to displaying the latex output in case
>> something goes wrong. Which, imo would be as sensible default too.
>>
>> Changing that is also way beyond my elisp knowlege.
> 
> In development version, Org now switches compilation buffers to
> `compilation-mode'.

http://orgmode.org/w/org-mode.git?p=org-mode.git;a=commit;h=67c84c161fa4e97c1f98ef1bbc72fa0f6098e1fd

Great! Thanks!




Re: [O] %( in capture template

2017-02-19 Thread Nicolas Goaziou
Hello,

Samuel Wales  writes:

> with the new org maint code, i still occasionally get the literal string.
>
> it occurs when the region spans a blank line.

I cannot reproduce your issue.

> like
>
>   %(concat
> "http://whatever.whatever/building-a-mold-free-house/whatever;
> "Building a mold free house" "

I have trouble understanding the double quote above. Do you mean the
text below is inserted within the %(concat ...) or are these your
templates? In this case, which one produces the error?

> these remplates [don't know if first does anything]
>
>   (add-to-list 'org-capture-templates
>`("L" "Protocol L for link" entry
>  (file+headline ,org-default-notes-file "xyzzy-remember")
>  ;; fixme perhaps i do not need the %i, if it is for no text
>  "%(concat \"%:link\"
> \"%:description\" \"%i\") L"
>  :prepend t :immediate-finish t :jump-to-captured t))
>   ;; this seems to get called by org capture whether selection or not
>   (add-to-list 'org-capture-templates
>`("p" "Protocol p" entry
>  (file+headline ,org-default-notes-file "xyzzy-remember")
>  "%(concat \"%:link\"
> \"%:description\" \"%i\")"
>  :prepend t :immediate-finish t :jump-to-captured t))

Regards,

-- 
Nicolas Goaziou



Re: [O] Bug: Bug in Orgmode Clocktable? [9.0.5 (9.0.5-elpa @ c:/Users/sane/AppData/Roaming/.emacs.d/elpa/org-20170210/)]

2017-02-19 Thread Nicolas Goaziou
Hello,

Axel Kielhorn  writes:

> org-clock: Add german translation.
>
> * lisp/org-clocl.el (org-clock-clocktable-language-setup): German
>   translations added.
>
> Axel Kielhorn 
> TINYCHANGE

Applied. Thank you.

Regards,

-- 
Nicolas Goaziou