Re: [O] OT: Cloud-dependencies, privacy, decentralization (was: Conducting end user surveys and analyze data)

2015-01-19 Thread Tom Prince
Karl Voit  writes:
> And no cloud service is ever going to get my complete set of emails.
> This is *way* too sensible in my opinion.

What percentange of your contact list is using gmail?



[O] [PATCH] Fix a number of potential infinite loops due to unsgined underflow.

2013-02-08 Thread Tom Prince
I discovered this, when trying to merge a file, with a tag that
overhangs the right margin.  Trying to merge the following line
with itself (with --rmargin less than 10) the causes the driver
to output spaces forever:

** abc :TAG:
---
 src/org_heading.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/org_heading.c b/src/org_heading.c
index 264512e..0c58046 100644
--- a/src/org_heading.c
+++ b/src/org_heading.c
@@ -316,7 +316,7 @@ org_heading_set_entire_text (org_heading *heading, char 
*string, int length,
* This is the whitespace between the stars and heading.
* Store it as a substring.
*/
-  for (count = 0; count < ubound - lbound; count++)
+  for (count = 0; (lbound + count) < ubound; count++)
 {
   if (!iswhitespace (string[lbound + count]))
{
@@ -357,7 +357,7 @@ org_heading_set_entire_text (org_heading *heading, char 
*string, int length,
   /* Scan trailing linebreaks
* Scan right to left.
*/
-  for (count = 0; count < (ubound - lbound); count++)
+  for (count = 0; (lbound + count) < ubound; count++)
 {
   if (!islinebreak (string[ubound - count - 1]))
{
@@ -385,7 +385,7 @@ org_heading_set_entire_text (org_heading *heading, char 
*string, int length,
   bool foundtags = false;
   bool done = false;
 
-  for (i = 0; i < (ubound - lbound); i++)
+  for (i = 0; (lbound + i) < ubound; i++)
 {
   if (string [ubound - i - 1] == ':')
{
@@ -397,7 +397,7 @@ org_heading_set_entire_text (org_heading *heading, char 
*string, int length,
  debug_msg (DOC_ELT, 5, "Setting  tags_ubound =%d\n", tags_ubound);
}
  int j;
- for (j = 2; j < (tags_ubound - lbound); j++)
+ for (j = 2; (lbound + j) < tags_ubound; j++)
{
  if (iswhitespace (string[tags_ubound - j]))
{
@@ -1902,7 +1902,7 @@ merge_tags (substr anc_str, substr loc_str, substr 
rem_str, size_t curr_col,
   int i;
   doc_stream_putc(' ', out);
   //curr_col += 1;
-  for (i=0; i < (ctxt->rmargin - 1 - char_count - curr_col); i++)
+  for (i=0; 1 + char_count + curr_col + i < ctxt->rmargin; i++)
 {
   doc_stream_putc(' ', out);
 }
-- 
1.8.0.2




Re: [O] Getting rid of split frame with org-capture

2011-12-16 Thread Tom Prince
On Wed, 14 Dec 2011 00:11:11 +0100, Andreas Leha 
 wrote:
> While it works well on my emacs23, the emacs24 snapshot from
> http://emacs.naquadah.org/ crashes, when I select a template.  Is this a
> general issue with emacs24?  Ideas to adapt the snippet to work with
> emacs24?

What do you mean by crash? Does the emacs process exit? In that case, I
would try reporting the problem to some emacs forum ... I don't think
emacs should be crashing given any elisp code, certainly not this code.

  Tom



Re: [O] Emacs Prelude

2011-12-04 Thread Tom Prince
On Fri, 02 Dec 2011 20:25:21 -0600, SndChaser  
wrote:
> 2) Has someone bound: org-do-promote, org-do-demote, 
> org-promote-subtree. org-demote-subtree, org-move-subtree-up and 
> org-move-subtree-down to another set of keys that is as handy / workable 
> as the original bindings?

Well, I use the vi emulation provided by evil, and have bound
M-{h,j,k,l} to org-meta*:

#+BEGIN_SRC emacs-lisp
(mapcar (lambda (state)
   (evil-declare-key state org-mode-map
 (kbd "M-l") 'org-metaright
 (kbd "M-h") 'org-metaleft
 (kbd "M-k") 'org-metaup
 (kbd "M-j") 'org-metadown
 (kbd "M-L") 'org-shiftmetaright
 (kbd "M-H") 'org-shiftmetaleft
 (kbd "M-K") 'org-shiftmetaup
 (kbd "M-J") 'org-shiftmetadown))
 '(normal insert))
#+END_SRC

  Tom



[O] Links with link text like [2011-10-10] fail to export properly

2011-11-26 Thread Tom Prince
With Org-mode version 7.7 (release_7.7.601.g55e4d)
and minimal init,

the following link

[[http://www.google.com][2011-09-16]]

gets exported to html as

[[http://www.google.com]  2011-09-16]

not as a link.

  Tom



Re: [O] M-RET and C-RET

2011-11-26 Thread Tom Prince
On Fri, 25 Nov 2011 17:49:09 +0100, "sindikat"  wrote:
> Hello everyone, 
> 
> M-RET works with both headings and plainlists, it's DWIM.
> C-RET works only with headings. I wanted to ask, why C-RET is not DWIM? 
> Wouldn't users want to add new list item respecting the content? 

You can use M-RET-may-split-line, to make it respect content in lists,
more or less. I would guess the reason that they are different is to be
able to always easily start a new heading.

  Tom



Re: [O] How to say "I did that yesterday?"

2011-11-22 Thread Tom Prince
On Tue, 22 Nov 2011 21:02:48 -0800, Dave Abrahams  wrote:
> 
> on Tue Nov 22 2011, Erik Hetzner  wrote:
> 
> > At Tue, 22 Nov 2011 11:40:35 -0800,
> > Dave Abrahams wrote:
> >> 
> >
> >> 
> >> I often discover that I completed something a few days ago and I would
> >> like to mark it done with the appropriate date as though I had marked it
> >> done in the past.  That means, e.g., for a repeating event it might
> >> repeat sooner than if it had been done today.  Is there a way?
> >
> > M-x org-todo-yesterday ?
> 
> Heh, that doesn't seem to work from the agenda, though :(
> 

M-x org-agenda-todo-yesteday

:)

Although, it should in princple, be possible to detect running in tha
agenda, and handle that automatically. I guess there are probably issues
with that.

  Tom



Re: [O] Getting rid of split frame with org-capture

2011-11-20 Thread Tom Prince
On Sun, 13 Nov 2011 12:57:21 -0500, Nick Dokos  wrote:
> > 1) If I don't pass -c to emacsclient, then I need to search all my
> >workspaces to find where emacs decided to put the capture frame
> > 2) If I pass do pass -c to emacsclient, then I need to close the frame
> >afterwards. And more significantly, I need to close the empty frame
> >when I use store-link instead. (I could work around this by using
> >seperate protocols for for each)
> > 
> 
> Sounds like a worthwhile thing to fix - patches would probably be
> welcome.

I came up with the following hack, which seems to do what I want:

(defadvice org-protocol-check-filename-for-protocol (around 
tp/org-protocol-make-frame activate)
  "Advice org-protocol-check-filename-for-protocol to open windows in new 
frames."
  (flet ((org-switch-to-buffer-other-window (&rest args) ; for org-mks
(let ((pop-up-frames t))
  (apply 'switch-to-buffer-other-window args)))
 (org-pop-to-buffer-same-window (&rest args)  ; for org-capture
(let ((pop-up-frames t))
  (apply 'switch-to-buffer-other-window args
(let ((display-buffer-mark-dedicated t))
  ad-do-it)))



Re: [O] Not overwriting unchanged source code files when tangling

2011-11-18 Thread Tom Prince
On Fri, 18 Nov 2011 08:23:18 -0600, Brian Wightman  
wrote:
> Perhaps a way to deal with this would be to tangle to a different
> directory, and then sync any changes into your compilation source
> directory.  If you would update the compilation directory only when
> something differs from the tangle directory, then make could handle it
> from that point on.

The tangle mechanism could probably handle this autoatically. i.e. not
saving a file if the contents are identical.

  Tom



Re: [O] Failure exporting with emacs --batch

2011-11-15 Thread Tom Prince
On Tue, 15 Nov 2011 15:30:25 -0500, Nick Dokos  wrote:
> Tom Prince  wrote:
> 
> > With b43c1c621f52f4a51d8d79cb76c226dfed003998 running
> > 
> 
> Please use C-u M-x org-version to insert version information in your
> mail. It's not possible to see from the SHA1 whether it is a recent
> version or an old version without doing git archaelogy.

org-version doesn't display a sha1 hash, when run from an installed copy
of a git version.

Further simplified: (this time with a git clone)

emacs --no-site-file --no-init-file --load min.el --eval '(setq debug-on-error 
t)' --eval '(find-file "test.org")' --eval '(org-version)' -eval 
'(org-export-as-html 3)' --batch

-- min.el
(setq org-babel-load-languages '((emacs-lisp . t) (latex . t)))
(setq org-confirm-babel-evaluate nil)
(add-to-list 'load-path (expand-file-name "~/src/org-mode/lisp"))
(add-to-list 'auto-mode-alist '("\\.\\(org\\  |org_archive\\|txt\\)$" . 
org-mode))

(require 'org-install)
--

-- test.org
* Notes for 2011-09-16
#+begin_src latex :file diag1.png
 some latex source
#+end_src
--

-- output
OVERVIEW
Loading vc-git...
Org-mode version 7.7 (release_7.7.541.gb43c)
Exporting...
executing Latex code block...
...
  (let* ((info ...) (lang ...) (raw-params ...) hash) (when info (when ... ... 
...) (setf ... ...) (org-babel-exp-do-export info ... hash)))
  (save-excursion (goto-char (match-beginning 0)) (let* (... ... ... hash) 
(when info ... ... ...)))
  org-babel-exp-src-block("some latex source" "latex" ":file" "diag1.png")
  apply(org-babel-exp-src-block "some latex source" ("latex" ":file" 
"diag1.png"))
  (if (memq type org-export-blocks-witheld) "" (apply func body headers))
  (progn (if (memq type org-export-blocks-witheld) "" (apply func body 
headers)))
  (unwind-protect (progn (if ... "" ...)) (set-match-data 
save-match-data-internal (quote evaporate)))
  (let ((save-match-data-internal ...)) (unwind-protect (progn ...) 
(set-match-data save-match-data-internal ...)))
  (save-match-data (if (memq type org-export-blocks-witheld) "" (apply func 
body headers)))
  (let ((replacement ...)) (when replacement (delete-region match-start 
match-end) (goto-char match-start) (insert replacement) (unless preserve-indent 
...)))
  (progn (let (...) (when replacement ... ... ... ...)))
  (if (setq func (cadr ...)) (progn (let ... ...)))
  (when (setq func (cadr ...)) (let (...) (when replacement ... ... ... ...)))
  (let* ((match-start ...) (body-start ...) (indentation ...) (inner-re ...) 
(type ...) (headers ...) (balanced 1) (preserve-indent ...) match-end) (while 
(and ... ...) (if ... ... ...)) (when (not ...) (error "unbalanced begin/end_%s 
blocks with %S" type ...)) (setq match-end (copy-marker ...)) (unless 
preserve-indent (setq body ...)) (unless (memq type types) (setq types ...)) 
(save-match-data (interblock start match-start)) (when (setq func ...) (let ... 
...)) (set-marker match-start nil) (set-marker body-start nil) (set-marker 
match-end nil))
  (while (re-search-forward beg-re nil t) (let* (... ... ... ... ... ... ... 
... match-end) (while ... ...) (when ... ...) (setq match-end ...) (unless 
preserve-indent ...) (unless ... ...) (save-match-data ...) (when ... ...) 
(set-marker match-start nil) (set-marker body-start nil) (set-marker match-end 
nil)) (setq start (point)))
  (let ((beg-re "^\\([  ]*\\)#\\+begin_\\(\\S-+\\)[ ]*\\(.*\\)?[
\n]")) (while (re-search-forward beg-re nil t) (let* ... ... ... ... ... ... 
... ... ... ... ...) (setq start ...)))
  (progn (fset (quote interblock) (function* ...)) (goto-char (point-min)) 
(setq start (point)) (let (...) (while ... ... ...)) (interblock start 
(point-max)) (run-hooks (quote org-export-blocks-postblock-hook)))
  (unwind-protect (progn (fset ... ...) (goto-char ...) (setq start ...) (let 
... ...) (interblock start ...) (run-hooks ...)) (if --cl-letf-bound-- (fset 
... --cl-letf-save--) (fmakunbound ...)))
  (let* ((--cl-letf-bound-- ...) (--cl-letf-save-- ...)) (unwind-protect (progn 
... ... ... ... ... ...) (if --cl-letf-bound-- ... ...)))
  (letf ((... ...)) (goto-char (point-min)) (setq start (point)) (let (...) 
(while ... ... ...)) (interblock start (point-max)) (run-hooks (quote 
org-export-blocks-postblock-hook)))
  (letf* ((... ...)) (goto-char (point-min)) (setq start (point)) (let (...) 
(while ... ... ...)) (interblock start (point-max)) (run-hooks (quote 
org-export-blocks-postblock-hook)))
  (flet ((interblock ... ...)) (goto-char (point-min)) (setq start (point)) 
(let (...) (while ... ... ...)) (interblock start (point-max)) (run-hooks 
(quote org-export-blocks-postblock-hook)))
  (let ((case-fold-search t) (types ...) matched indentation type func start 
end bod

[O] Failure exporting with emacs --batch

2011-11-15 Thread Tom Prince
With b43c1c621f52f4a51d8d79cb76c226dfed003998 running

 emacs --no-init-file --load min.el --eval '(setq debug-on-error t)' --eval 
'(find-file "test.org")' -eval '(org-export-as-html 3)' --batch

with

-- min.el
(setq org-babel-load-languages '((emacs-lisp . t) (latex . t)))
(setq org-confirm-babel-evaluate nil)
(setq org-export-latex-packages-alist
  `(("" "diagrams" t)))

(require 'org-install)
(require 'org)
--
and
-- test.org
#+TITLE: Notes for Higher Category Theory
#+MATHJAX: mathml:t
#+BABEL :exports results

* Notes for 2011-09-16
#+begin_src latex :file diag1.png
\begin{diagram}
  Y\times \{0\} & \rTo & E \\
  \dTo & \ruDotsto & \dTo \\
  Y\times I & \rTo & B
\end{diagram}
#+end_src
--

gives me

-- output
OVERVIEW
Loading vc-git...
Exporting...
Position saved to mark ring, go back with C-c &.
executing Latex code block...
Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p 
unspecified)
  org-create-formula-image("\\begin{diagram}\n  Y\\times \\{0\\} & \\rTo & E 
\n  \\dTo & \\ruDotsto & \\dTo \n  Y\\times I & \\rTo & 
B\n\\end{diagram}" "diag1.png" (:foreground default :background default :scale 
1.0 :html-foreground "Black" :html-background "Transparent" :html-scale 1.0 
:matchers ("begin" "$1" "$" "$$" "\\(" "\\[")) t)
  org-babel-execute:latex("\\begin{diagram}\n  Y\\times \\{0\\} & \\rTo & E 
\n  \\dTo & \\ruDotsto & \\dTo \n  Y\\times I & \\rTo & 
B\n\\end{diagram}" ((:colname-names) (:rowname-names) (:result-params "replace" 
"file" "latex" "file" "replace" "latex") (:result-type . value) (:comments . 
"") (:shebang . "") (:cache . "no") (:padline . "") (:noweb . "no") (:tangle . 
"no") (:exports . "results") (:results . "replace file latex") (:session . 
"none") (:rowname-names) (:result-type . value) (:result-params "file" 
"replace" "latex") (:padnewline . "yes") (:hlines . "no") (:file . "diag1.png") 
(:colname-names)))
  org-babel-execute-src-block(nil ("latex" "\\begin{diagram}\n  Y\\times 
\\{0\\} & \\rTo & E \n  \\dTo & \\ruDotsto & \\dTo \n  Y\\times I & 
\\rTo & B\n\\end{diagram}" ((:colname-names) (:rowname-names) (:result-params 
"replace" "file" "latex" "file" "replace" "latex") (:result-type . value) 
(:comments . "") (:shebang . "") (:cache . "no") (:padline . "") (:noweb . 
"no") (:tangle . "no") (:exports . "results") (:results . "replace file latex") 
(:session . "none") (:rowname-names) (:result-type . value) (:result-params 
"file" "replace" "latex") (:padnewline . "yes") (:hlines . "no") (:file . 
"diag1.png") (:colname-names)) "" nil 0))
  org-babel-exp-results(("latex" "\\begin{diagram}\n  Y\\times \\{0\\} & \\rTo 
& E \n  \\dTo & \\ruDotsto & \\dTo \n  Y\\times I & \\rTo & 
B\n\\end{diagram}" ((:colname-names) (:rowname-names) (:result-params "replace" 
"file" "latex" "file" "replace" "latex") (:result-type . value) (:comments . 
"") (:shebang . "") (:cache . "no") (:padline . "") (:noweb . "no") (:tangle . 
"no") (:exports . "results") (:results . "replace file latex") (:session . 
"none") (:rowname-names) (:result-type . value) (:result-params "file" 
"replace" "latex") (:padnewline . "yes") (:hlines . "no") (:file . "diag1.png") 
(:colname-names)) "" nil 0) block nil 
"e690bc66b5d1181e2751abbc36dc7def2f54c72a")
  org-babel-exp-do-export(("latex" "\\begin{diagram}\n  Y\\times \\{0\\} & 
\\rTo & E \n  \\dTo & \\ruDotsto & \\dTo \n  Y\\times I & \\rTo & 
B\n\\end{diagram}" ((:colname-names) (:rowname-names) (:result-params "replace" 
"file" "latex" "file" "replace" "latex") (:result-type . value) (:comments . 
"") (:shebang . "") (:cache . "no") (:padline . "") (:noweb . "no") (:tangle . 
"no") (:exports . "results") (:results . "replace file latex") (:session . 
"none") (:rowname-names) (:result-type . value) (:result-params "file" 
"replace" "latex") (:padnewline . "yes") (:hlines . "no") (:file . "diag1.png") 
(:colname-names)) "" nil 0) block "e690bc66b5d1181e2751abbc36dc7def2f54c72a")
  org-babel-exp-src-block("\\begin{diagram}\n  Y\\times \\{0\\} & \\rTo & E 
\n  \\dTo & \\ruDotsto & \\dTo \n  Y\\times I & \\rTo & 
B\n\\end{diagram}" "latex" ":file" "diag1.png")
  apply(org-babel-exp-src-block "\\begin{diagram}\n  Y\\times \\{0\\} & \\rTo & 
E \n  \\dTo & \\ruDotsto & \\dTo \n  Y\\times I & \\rTo & 
B\n\\end{diagram}" ("latex" ":file" "diag1.png"))
  
byte-code("\306\307\211\211\211\211\211\211\211\211\211\211+,-./0\310\311!\2111\205)\311K2\312\216\311\313M\210eb\210`\3143\3153\307\306#\203X\316\317\224!4\316\317\225!5\320\321!G-\322\323\324\320\325!\227!\"6\326\320\325!\227!,\327
 
7\330\216\331\320\332!\333\"*\32189\206\200\334\n\235\307:\3358!\204\255\3156\307\306#\203\255\320\321!\227\336\230\203\2458S8\202\2048T8\202\204\3358!\204\276\337\340,4`{#\210\316\317\225!:
   \204\327\327 7\341\216\3425\317\224{!*,/>\204\346,/B/\327 
7\343\216\311
4\"\210*\344,;\"\211\203\346\202\347+\n#*\211>\

Re: [O] Getting rid of split frame with org-capture

2011-11-13 Thread Tom Prince
On Sat, 12 Nov 2011 23:13:11 -0500, Nick Dokos  wrote:
> Not worth the bother IMO[fn:1], but if you wish to implement it and submit
> a patch, I'd be happy to review it.
> 
> Nick
> 
> Footnotes:
> 
> [fn:1] Remember, capture is supposed to be as unobtrusive as possible:
>you just want to squirrel away something for future
>reference. Bells and whistles (which, IMO, this change would be)
>are not the point: you want to get in, record the data and get
>out and back to work as fast as possible. Popping up frames slows
>things down but more importantly jolts you away from what you
>were doing. At least, it would me (I think): that's why I don't
>think it's worth it, but you may very well disagree.

It isn't worth *if* capture is invoked from emacs. If capture is invoked
from org-protocol in firefox, then there might not even be a emacs frame
visible.

1) If I don't pass -c to emacsclient, then I need to search all my
   workspaces to find where emacs decided to put the capture frame
2) If I pass do pass -c to emacsclient, then I need to close the frame
   afterwards. And more significantly, I need to close the empty frame
   when I use store-link instead. (I could work around this by using
   seperate protocols for for each)

 Tom



Re: [O] New version of VimOrganizer, an Org-mode clone in Vim

2011-11-06 Thread Tom Prince
On Thu, 3 Nov 2011 23:26:57 + (UTC), Herbert Sitz  wrote:
> Michael -- No problem, this issue was of course brought up when I
> started the project a year or so ago.  Actually for the many Vim users
> who have tried to make the transition to Emacs I think it is pretty
> well known that there are several different Vim emulators for Emacs.
> (Evil is a fairly new one I still want to try out; I'm not sure but I
> think it's by same team and intended to supplant Vimpulse, which
> itself extends Viper: http://gitorious.org/evil )
>
> [...] 
>
> Even now when I use Org-mode I mostly operate it using the menu system, not 
> with
> the key-chord-combinations.  One neat idea, I think, would be for someone to
> extend Viper/Vimpulse/(or Evil) with keybindings that provide a usable 
> Vim-type
> modal interface to Org-mode's features.  That could be nice.

As far as I can tell, evil grew out the merger of viper and another
vi/vim emulation mode (not viper). In particular, it was designed to
extensible from the gound.

  Tom



Re: [O] Elisp programming style

2011-10-28 Thread Tom Prince
Perhaps 

,---
| (defun main-function (args)   
| (let ((var (assoc :key1 args)))  ; extracting var once
| ...   
| (helper-function1 ... var ...) ; inside let using var 
| (helper-function2 ... var ...) ; inside let using var 
| ))
|   
| (defun helper-function1 (var')
| ...   
| ) 
|   
| (defun helper-function2 (var')
| ...   
| ) 
`---

or

,-
| (defun get-key1 (args) (assoc :key1 args))  
| (defun main-function (args) 
| (let ((value (get-key1 args))   ; extracting var 1st time   
| ... 
| )   
| (helper-function1 ...) ; outside let
| (helper-function2 ...) ; outside let
| )   
| 
| (defun helper-function1 (args)  
| (let ((value (get-key1 args))   ; extracting var 2nd time   
| ... 
| ))  
| 
| (defun helper-function2 (args)  
| (let ((value (get-key1 args))   ; extracting var 3rd time   
| ... 
| ))  
`-


I likely wouldn't suggest the second, unless get-key1 was actually
something more complicated than your example.

  Tom



[O] org-protocol and new frames

2011-10-16 Thread Tom Prince
Is there any way to get org-protocol to create a new frame, when it
needs to open a buffer, but otherwise not open one.

  Tom



Re: [O] [PATCH] Add svg export using pdf2svg, for latex math and src blocks.

2011-10-12 Thread Tom Prince
On Sun,  2 Oct 2011 14:35:48 -0400, Tom Prince  wrote:
> This is my attempt to add export of latex code (for HTML export)
> via svg, rather than png. I don't know if this is the best way to go
> about doing it, but I wanted to avoid as much duplicated code as
> possible.

*ping*



Re: [O] [babel] create tikz pictures in an floating LaTeX environment

2011-10-07 Thread Tom Prince
On Fri, 07 Oct 2011 18:26:15 -0300, Darlan Cavalcante Moreira 
 wrote:
> It would be nice if org had a begin_tikz block. This block could either
> create a PDF file or include the tikz code directly in the latex file when
> exporting to latex (or PDF), and create an SVG file when when exporting to
> HTML. Of course this block should accept all the usual image options, such
> as caption and width.
> 
> This is just a feature request from a tikz lover.

This would actually be useful for arbitrary latex code. I know in
particular that I would love a similiar feature for using Paul Taylor's
diagram.sty[fn:1], generetating inline latex, when compiling to PDF, and
genertating an SVG when exporting to HTML.

It would also be very nice not to have to name every block, just like
the inline math doesn't need to be given a name, when using one of the
image backends.

  Tom

Footnotes:

[fn:1] http://www.paultaylor.eu/diagrams/



[O] [PATCH] Add svg export using pdf2svg, for latex math and src blocks.

2011-10-02 Thread Tom Prince
This is my attempt to add export of latex code (for HTML export)
via svg, rather than png. I don't know if this is the best way to go
about doing it, but I wanted to avoid as much duplicated code as possible.
---
 lisp/ob-latex.el |5 +++-
 lisp/org-exp.el  |1 +
 lisp/org-html.el |1 +
 lisp/org.el  |   67 +-
 4 files changed, 47 insertions(+), 27 deletions(-)

diff --git a/lisp/ob-latex.el b/lisp/ob-latex.el
index 739a936..422e141 100644
--- a/lisp/ob-latex.el
+++ b/lisp/ob-latex.el
@@ -82,7 +82,10 @@ This function is called by `org-babel-execute-src-block'."
  org-export-latex-packages-alist)))
 (cond
  ((string-match "\\.png$" out-file)
-  (org-create-formula-image
+  (org-create-formula-image (assq 'dvipng 
org-latex-image-formats-alist)
+   body out-file org-format-latex-options in-buffer))
+ ((string-match "\\.svg$" out-file)
+  (org-create-formula-image (assq 'pdf2svg 
org-latex-image-formats-alist)
body out-file org-format-latex-options in-buffer))
  ((string-match "\\.pdf$" out-file)
  (require 'org-latex)
diff --git a/lisp/org-exp.el b/lisp/org-exp.el
index 42b26e4..674f85f 100644
--- a/lisp/org-exp.el
+++ b/lisp/org-exp.el
@@ -530,6 +530,7 @@ is not available on all systems."
  (const :tag "Do not process math in any way" nil)
  (const :tag "Obsolete, use dvipng setting" t)
  (const :tag "Use dvipng to make images" dvipng)
+ (const :tag "Use pdf2svg to make images" pdf2svg)
  (const :tag "Use MathJax to display math" mathjax)
  (const :tag "Leave math verbatim" verbatim)))
 
diff --git a/lisp/org-html.el b/lisp/org-html.el
index fde563b..80c9b6b 100644
--- a/lisp/org-html.el
+++ b/lisp/org-html.el
@@ -661,6 +661,7 @@ postamble DIV."
   ((eq (plist-get parameters :LaTeX-fragments) 'mathjax ) 'mathjax)
   ((eq (plist-get parameters :LaTeX-fragments) t) 'mathjax)
   ((eq (plist-get parameters :LaTeX-fragments) 'dvipng  ) 'dvipng)
+  ((eq (plist-get parameters :LaTeX-fragments) 'pdf2svg  ) 'pdf2svg)
   (t nil
   (goto-char (point-min))
   (let (label l1)
diff --git a/lisp/org.el b/lisp/org.el
index 73b1073..7c2d84e 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -16471,6 +16471,13 @@ The images can be removed again with 
\\[org-ctrl-c-ctrl-c]."
 ("\\[" "\\[[^\000]*?\\]" 0 nil)
 ("$$" "\\$\\$[^\000]*?\\$\\$" 0 nil))
   "Regular expressions for matching embedded LaTeX.")
+(defconst org-latex-image-formats-alist
+  `((dvipng "latex" "dvipng" ".dvi" ".png" 'png nil)
+(pdf2svg "pdflatex" "pdf2svg" ".pdf" ".svg" 'svg t))
+  "List of constants for image post-processors.
+
+ ( 
 ).")
+
 
 (defvar org-export-have-math nil) ;; dynamic scoping
 (defun org-format-latex (prefix &optional dir overlays msg at
@@ -16488,7 +16495,7 @@ Some of the options can be changed using the variable
 (org-format-latex-header-extra
  (plist-get (org-infile-export-plist) :latex-header-extra))
 (cnt 0) txt hash link beg end re e checkdir
-executables-checked string
+executables-checked string image-format
 m n block linkfile movefile ov)
 ;; Check the different regular expressions
 (while (setq e (pop re-list))
@@ -16522,21 +16529,22 @@ Some of the options can be changed using the variable
'(org-protected t
(add-text-properties (match-beginning n) (match-end n)
 '(org-protected t
-((or (eq processing-type 'dvipng) t)
+((or (assq processing-type org-latex-image-formats-alist) t)
  ;; Process to an image
  (setq txt (match-string n)
beg (match-beginning n) end (match-end n)
cnt (1+ cnt))
  (let (print-length print-level) ; make sure full list is printed
-   (setq hash (sha1 (prin1-to-string
+   (setq image-format (assq processing-type 
org-latex-image-formats-alist)
+ hash (sha1 (prin1-to-string
  (list org-format-latex-header
org-format-latex-header-extra
org-export-latex-default-packages-alist
org-export-latex-packages-alist
org-format-latex-options
forbuffer txt)))
- linkfile (format "%s_%s.png" prefix hash)
- movefile (format "%s_%s.png" absprefix hash)))
+ linkfile (format (concat "%s_%s" (nth 4 image-format)) 
prefix hash)
+ movefile (format (concat "%s_%s" (nth 4 image-format)) 
absprefix hash)))
  (setq link (concat block "[[file:" linkfile "]]" block))

Re: [O] ODT image export

2011-09-21 Thread Tom Prince
On Wed, 21 Sep 2011 20:11:29 +0530, Jambunathan K  
wrote:
> Does your plotter - R, gnuplot or whatever - support SVG. I see that
> LibreOffice-3.4 (which I have locally installed) supports embedding of
> SVG images. These SVG images are actually embedded as SVM files in the
> exported ODT file. Using BasicODConverter (which uses UNO APIs) SVG->SVM
> creation is a no-brainer. But my little experimentation suggests that
> the SVG images might have to be cropped. But in the long run, working
> with SVG files will probably be a winner.
> 
> For now, you may want to export Tikz->Pdf->High Resolution PNG using
> Image Magick. Hint: Search this list.

I don't know how it would interact with R/gunplot/etc... But I have
hacked my local copy of org-mode to use pdflatex+preview+pdf2svg instead
of latex and dvipng for turning latex blocks into images. I haven't got
around to submitting it, since there should really be some refactoring
of the image handling code to deal with it.

  Tom




Re: [O] org-capture-hook only when in frame?

2011-09-20 Thread Tom Prince
On Tue, 20 Sep 2011 18:45:31 -0400, Micah Anderson  wrote:
Non-text part: multipart/signed
> 
> I have a function to create a frame for capture mode that I can call
> with emacsclient at any time:
> 
> ;; Initialization of capture frames
> (defun make-capture-frame ()
>   "Create a new frame and run org-capture"
>   (interactive)  
>   (make-frame '((name . "capture") (width . 80) (height . 10)))
>   (select-frame-by-name "capture")
>   ;; Org-remember splits windows, force it to a single window
(let ((org-capture-mode-hook))
>   (add-hook 'org-capture-mode-hook  'delete-other-windows)
>   (org-capture)
)
> )
Would probably work, although there may be better ways.

  Tom



[O] org-read-date and (setq pop-up-frames 'graphic-only)

2011-09-10 Thread Tom Prince
 With (set pop-up-frames 't), org-read-date behaves badly, creating
calendar in the bottom. (setq calendar-setup 'calendar-only) would fix
this, but org-read-date overrides it. A new frame for the calendar. But
the frame is split, with the calendar at the bottom, and some random
buffer at the top.

Is there any reason that org-read-date is overriding calendar-setup, or
could this be made customizable?

  Tom