[O] language comparison framework

2014-11-14 Thread Michael Bach
Hi all,

I found a nice comparison of python, R and matlab[1].  This type of
comparison is available for other domains as well[2].  Now the sources
for these are on github[3].  The markup looks, erhm, unpleasant, i.e.
hard to edit, unless you use wikidot[4] - which is what the author uses.
 Now I was wondering how easy / hard it would be to translate (a subset)
of these to org-mode, since it would be much more comfortable to edit.
By this I mean e.g. links from row titles to a glossary at the end,
table code cells as verbatim, notes typographically different (italic
and grey) etc.

I do have crude macros and with a little manual tweaking, I can convert
the tables to org-tables.  This is tedious and I would appreciate any
ideas on how you would automate the section linking and table-wide (or
column-wide) typesetting instructions (see also my previous post[5]).

Also, I am curious about whether someone already cooked up a home grown
comparison framework in org-mode.

Best Regards,
Michael


[1] http://hyperpolyglot.org/numerical-analysis
[2] http://hyperpolyglot.org/
[3] https://github.com/clarkgrubb/hyperpolyglot
[4] http://www.wikidot.com/
[5] http://permalink.gmane.org/gmane.emacs.orgmode/92246




[O] Table columns verbatim export

2014-10-31 Thread Michael Bach
Hi,

I am looking for a way to format table columns to be verbatim for the
(latex) export.  The reason is that in the following table, the numpy
`A[0]` will be interpreted as a footnote without a matching description
and export will fail.

|| matlab| r   | numpy   |
| element access | A(1, 1)   | A[1, 1] | A[0, 0] |
| row access | A(1, 1:2) | A[1, ]  | A[0]|

I had a look into the manual and maybe relatedly found section 3.5.3
Emacs Lisp forms as formulas with string manipulation, e.g. wrapping
== or ~~ around the string, but I am really just concerned with export.

Is there an obvious way I am missing?

Thanks and Best Regards,
Michael




Re: [O] helm and org-refile

2014-06-23 Thread Michael Bach
On 6/17/14 12:20 PM, Eric Abrahamsen wrote:
 Hi there,
 
 I just started using helm, with some ambivalence. Turning on helm mode
 stompled all over my emacs, but for just that reason I suppose it might
 be worth trading my ido muscle memory for helm muscle memory.
 
 Anyhoo... The only thing it doesn't work well with is org-refile and
 friends. It can complete the filename, but not the subtree path. My
 org-refile-use-outline-path is set to 'file. I found this:
 
 http://permalink.gmane.org/gmane.emacs.orgmode/70751
 
 In the replies to that was a patch for making a 'helm option for org
 refile, but my guess is that's well and truly out of date. Is anyone
 using helm and org, and have a good solution for refiling? It's actually
 preventing me from using refile and goto, at the moment...
 

Have a look at the variable `org-outline-path-complete-in-steps' and its
documentation.  Try setting it to nil.




[O] ob-clojure :session echo settings

2014-04-16 Thread Michael Bach
Hi,

Emacs 24.4.
org-mode latest master
clojure-mode latest MELPA
cider latest MELPA

Following the instructions in [1], I set up session evaluation for
clojure in the snippet:

#+BEGIN_SRC org
#+PROPERTY: header-args:clojure :session :cache no

#+begin_src clojure
(+ 1 2 3)
#+end_src

#+RESULTS:
: 6
#+END_SRC

Now I would like to have the results echoed in the repl instead of
inserted into the buffer under #+RESULTS: for presentation purposes.
The session is active, as I am able to e.g. define functions in the
babel block and call them in the repl.  I did not find anything about
results in terms of sessions in the manual - am I missing something?

Best Regards,
Michael

[1]
http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-clojure.html#sec-7




Re: [O] LaTeX export: Handle hash symbol in footnote url links

2014-04-10 Thread Michael Bach
On 2/26/14 3:11 PM, Nicolas Goaziou wrote:
 Hello,
 
 Michael Bach pha...@gmail.com writes:
 
 Thanks for your answer. `\url` can handle hash symbols in its argument
 without escaping alright - as can be expected. AFAICS, the problem lies
 in the `\footnote` command. And yes, I was thinking of `ox-latex`
 figuring out that the url is in a footnote and escape accordingly.

 I can see that the export engine should not and cannot cover all special
 cases, but since links and footnotes are `first-class` org-mode
 concepts, it would be nice to have them play along in this situation.
 From a typographic point of view, I figured url links in footnotes are
 not that unusual.
 
 This needs to be properly defined.
 
 Where protecting characters in verbatim parts of the buffer should
 happen? Within footnotes only? In every verbatim part? And on which
 characters?
 

Ok, using org-element, we could escape special symbols - for now, only
'#', '%' and '' come to mind - in http links iff they are inside a
footnote and exporter backend is latex.

As I said, if this is too special a case to be supported, I was playing
around with regexps and `org-export-filter-final-output-functions' as
seen e.g. in [1].

On other occasions that involved in-buffer replacements, I had success
using group matching with the `re-search-forward', `replace-match' and
`match-string' functions (see also [2]).  But IIUC, since the export
filter function gets passed a string with the .tex export results, I
need a function that operates on a string such as
`replace-regexp-in-string' as seen in [1].

Now I assume for in-string regexp replacement and the use case at hand I
would need a (missing) lookbehind feature [3], don't I?

Please let me know whether you think this is feasible.

Best Regards,
Michael


[1] https://lists.gnu.org/archive/html/emacs-orgmode/2014-02/msg00146.html
[2]
http://stackoverflow.com/questions/6395898/emacs-how-do-i-replace-regexp-with-a-lisp-function-in-a-defun
[3] http://comments.gmane.org/gmane.emacs.devel/147844




[O] LaTeX export: Handle hash symbol in footnote url links

2014-02-21 Thread Michael Bach
Dear org-mode Devs and Users,

I am trying to export the following snippet

#+BEGIN_ORG
* LaTeX export of url with hash symbol

The Org mode export facilities can be used to export Org documents or
parts of Org documents to a variety of other formats.[fn:1]

* Footnotes

[fn:1] [[http://orgmode.org/org.html#Exporting]]
#+END_ORG

Now the exported .tex file contains the link as
: \footnote{\url{http://orgmode.org/org.html#Exporting}}

Which LaTeX does not like:
: Illegal parameter number in definition of \Hy@tempa

FWIW, there is a workaround for the percent symbol described on SO[1]
using `\urldef` - but this does not work with the hash symbol.

Is there another workaround/solution that works with org-mode?

[1] bit.ly/1cwYJaM




Re: [O] LaTeX export: Handle hash symbol in footnote url links

2014-02-21 Thread Michael Bach
Hello Vladimir,

On 21/02/2014 12:14, Vladimir Lomov wrote:
 Hello,
 ** Michael Bach [2014-02-21 11:52:14 +0100]:
 
 Dear org-mode Devs and Users,
 
 I am trying to export the following snippet
 
 #+BEGIN_ORG
 * LaTeX export of url with hash symbol
 
 The Org mode export facilities can be used to export Org documents or
 parts of Org documents to a variety of other formats.[fn:1]
 
 * Footnotes
 
 [fn:1] [[http://orgmode.org/org.html#Exporting]]
 #+END_ORG
 
 Now the exported .tex file contains the link as
 : \footnote{\url{http://orgmode.org/org.html#Exporting}}
 
 Which LaTeX does not like:
 : Illegal parameter number in definition of \Hy@tempa
 
 FWIW, there is a workaround for the percent symbol described on SO[1]
 using `\urldef` - but this does not work with the hash symbol.
 
 Is there another workaround/solution that works with org-mode?
 
 Hash (#), as well as several other symbols have to be espaced when used
 as is in LaTeX documents. See, for example, The Not So Short
 Introduction to LaTeX2e, 1.3.2 Special Characters. In general it is
 duty of ox-latex (LaTeX export backend) to espace such characters.
 

Thanks for your answer. `\url` can handle hash symbols in its argument
without escaping alright - as can be expected. AFAICS, the problem lies
in the `\footnote` command. And yes, I was thinking of `ox-latex`
figuring out that the url is in a footnote and escape accordingly.

I can see that the export engine should not and cannot cover all special
cases, but since links and footnotes are `first-class` org-mode
concepts, it would be nice to have them play along in this situation.
From a typographic point of view, I figured url links in footnotes are
not that unusual.

Best Regards,
Michael


 [1] bit.ly/1cwYJaM
 
 ---
 WBR, Vladimir Lomov
 





Re: [O] org-edit-src-code window setup

2014-02-09 Thread Michael Bach
On 2/7/14 6:01 PM, John Hendy wrote:
 On Fri, Feb 7, 2014 at 5:29 AM, Michael Bach pha...@gmail.com wrote:
 Dear org-mode Developers and Users,

 (Org-mode version 8.2.5g from git)

 I want to change the behaviour of C-c ' when inside a source block.
 What I am after is best described in a schematic:

 +---+---+
 |   |   |
 |   |   2   |
 |   |   |
 |   |   |
 +   1   +---+
 |   |   |
 |   |   3   |
 |   |   |
 |   |   |
 +---+---+

 I am editing the .org file in window 1 ('org').  I want C-c ' to display
 the code block contents in window 2 ('source').  In window 3 I want to
 have the interpreter for the language I am editing ('interpreter').
 
 Can you clarify whether you simply want to obtain this view in Emacs
 and are not sure how, or if you are asking for a way to automate the
 process via a keyboard binding/macros/function in order to do this
 automatically on every use of =C-c '=?
 

I set this view up myself and also remember that there is a way to
automate this.  My problem is not with the setup per se, but with the
behaviour that if I repeatedly press =C-c '= in the mentioned window
setup, the org src buffer is alternatingly displayed in window 2 and 3,
which is annoying (distracting)

I would like the interpreter buffer to stay in window 3 and the org src
buffer always be displayed in window 2 if I press =C-c '=.






[O] org-edit-src-code window setup

2014-02-07 Thread Michael Bach
Dear org-mode Developers and Users,

(Org-mode version 8.2.5g from git)

I want to change the behaviour of C-c ' when inside a source block.
What I am after is best described in a schematic:

+---+---+
|   |   |
|   |   2   |   
|   |   |
|   |   |
+   1   +---+
|   |   |
|   |   3   |
|   |   |
|   |   |
+---+---+

I am editing the .org file in window 1 ('org').  I want C-c ' to display
the code block contents in window 2 ('source').  In window 3 I want to
have the interpreter for the language I am editing ('interpreter').

I read up on the internal documentation:
`org-edit-special'  `org-edit-src-code'  `org-src-window-setup' 
other-window (`switch-to-buffer-other-window')

Now, when I do C-c ' multiple times, the source buffer changes from 2 to
3 and back again and so on - effectively switching the 'source' and
'interpreter' window contents on each C-c '.

After reading the documentation for `switch-to-buffer-other-window', I
wanted to check out the NORECORD option that has the description:

Optional second argument NORECORD non-nil means do not put this
buffer at the front of the list of recently selected ones.

Now is there a way to control this option that I miss?  Would it have
any effect?  How would you handle this situation?

Best Regards,
Michael Bach




[O] Deactivate babel source block

2013-10-06 Thread Michael Bach
Dear org-mode Users and Developers,


I am looking for a nice way to deactivate a babel source block with
point being anywhere on it. Imagine e.g. C-c C-v C-w to say I want to
toggle execution/tangling for this block.

Background: I have the .emacs setup in a literate org-mode file where I
am testing new emacs packages.  Now many blocks represent specific
features that I want to be activated / deactivated.  This should ideally
behave like the other source code functions (i.e. C-c C-v family).

My naive approach as elisp noob was:
#+begin_src emacs-lisp
  (defun my-org-babel-deactivate ()
(interactive)
(org-edit-special)
(mark-whole-buffer)
(comment-region)
(org-edit-src-exit))
#+end_src

Apart from it not working (Wrong number of arguments), this would have
been a dirty one in any case.  Now I thought there must be a better way
by setting/un-setting the respective header arguments in an automated
way.  Is this already possible with org-mode version 8.2?

Best Regards,
Michael




Re: [O] Deactivate babel source block

2013-10-06 Thread Michael Bach
On 10/6/13 5:09 PM, Eric Schulte wrote:
 You want to set the :eval and :tangle header arguments, this can be done
 with `org-babel-insert-header-arg' bound to C-c C-v j.  I've just
 updated this function so that it now takes two optional arguments
 specifying the header argument and value.
 
 So your function could now be something like the following.
 
 (defun my-org-babel-deactivate ()
   (interactive)
   (org-babel-insert-header-arg eval never)
   (org-babel-insert-header-arg tangle no))
 
 Hope this helps,
 

Thanks for implementing this so quickly - I am currently on 8.2 release
branch, but am looking forward to it!

Michael






[O] Babel code block linking issue

2013-10-06 Thread Michael Bach
Dear org-mode Users and Developers,


I am running org 8.2.1 and was following the nice video [1] showing off
some org-mode features.  I could follow and reproduce up to the point
where he goes on to edit a code block via C-c ' and puts a link there
via `org-store-link'.  When I try that, I get the good old
``wrong-type-argument stringp nil'' error - see backtrace on pastebin
[2].  I very much assume that the `org-store-link(nil)' call at the very
beginning is messed up.  I am using a simple `username' as link, nothing
fancy here.

Any ideas?  How to further debug?

Michael

[1] http://www.youtube.com/watch?v=lsYdK0C2RvQ
[2] http://pastebin.com/QqLFvSwn




[O] latex export subtree: org-latex-export-process

2013-09-25 Thread Michael Bach
Dear org-mode Users and Developers,

(org-mode v8.1) I use the following function for customizable latex
export processes
#+begin_src emacs-lisp
(defun my-auto-tex-cmd (backend)
  When exporting from .org with latex,
  automatically run latex, pdflatex, or xelatex as appropriate,
  using latexmk.
  (let ((texcmd))
(cond ((string-match LATEX_CMD: pdflatex (buffer-string))
   (setq texcmd latexmk -pdflatex=pdflatex -pdf %f))
  ((string-match LATEX_CMD: pdflatex-shell-escape (buffer-string))
   (setq texcmd latexmk -pdflatex=pdflatex --shell-escape -pdf
%f))
  ((string-match LATEX_CMD: xelatex (buffer-string))
   (setq texcmd latexmk -pdflatex=xelatex -pdf %f))
  (t (setq texcmd latexmk -pdf %f))
  )
(setq org-latex-pdf-process (list texcmd
(add-hook 'org-export-before-processing-hook 'my-auto-tex-cmd)
#+end_src

which essentially uses an earlier idea[1].  Now this works well if I
export an .org buffer as a whole.  If I export a subtree, the
`buffer-string` only contains the subtree without the .org buffer
header, so the `string-match` always fails.

Any ideas on how to best integrate this function during a subtree
export?  Maybe inside a hook that is run before the subtree is narrowed
down?

Best Regards,
Michael

[1] http://lists.gnu.org/archive/html/emacs-orgmode/2010-10/msg00218.html




Re: [O] Import files to babel blocks

2013-07-24 Thread Michael Bach
Hi Myles,

On 7/21/13 12:31 PM, Myles English wrote:
 
 From the documentation (C-h f insert-file-contents), it says that it
 returns list of absolute file name and number of characters but
 doesn't move the marker forwards, unlike insert does.  So, I guess you
 would have to then move the marker forwards by the number of characters.
 

Erhm, another case of readthedocs... Thanks for the shove! For
reference, I got it to work using a simple let like so:

--8---cut here---start-8---
(defun import-to-org-from-files (path pattern progmode)
(mapcar #'(lambda (filepath)
(progn
  (insert (format
   \n#+name: %s\n (file-name-nondirectory
 (file-name-sans-extension
  filepath
  (insert (format #+begin_src %s :eval no\n progmode))
  (let ((res (insert-file-contents filepath)))
(forward-char (second res)))
  (insert \n#+end_src\n))
)
(directory-files path t pattern)))
--8---cut here---end---8---

much obliged,
Michael




[O] Import files to babel blocks

2013-07-21 Thread Michael Bach
Dear org-mode Users and Developers,

I am trying to write a simple function for importing files to org-mode
babel code blocks.

My naive approach was

--8---cut here---start-8---
(defun import-to-org-from-files (path pattern progmode)
  (mapcar #'(lambda (filepath)
  (progn
(insert (format
 \n#+name: %s\n (file-name-nondirectory
   (file-name-sans-extension
filepath
(insert (format #+begin_src: %s :eval no\n progmode))
(insert-file-contents filepath)
(insert \n#+end_src\n))
  )
  (directory-files path t pattern)))
--8---cut here---end---8---

to be called e.g. like this

--8---cut here---start-8---
(import-to-org-from-files /path/to/scripts/ .*\.sh$ sh)
--8---cut here---end---8---


This leads to all babel code blocks being inserted empty and all file
content inserted afterwards, i.e. the `insert-file-contents' is somehow
delayed until all `insert's have happened.

Maybe this is just related to my misunderstanding of the involved elisp,
but I am posting it here since I am sure someone must have thought about
this import. Or is there even an org-mode builtin that can be used?

Best Regards,
Michael





[O] ox-freemind exporter

2013-07-19 Thread Michael Bach
Dear org-mode Users and Developers,

I checked out org-mode from today and tried the ox-freemind exporter. It
fails with the error:

`cond: Keyword argument :translations not one of (:name :parent
:transcoders :options :filters :blocks :menu)'.

I searched around and found a post[1] by Nicolas Goaziou who seems to
maintain this exporter and a message that he fixed it after a change to
the internal representation of back-ends.

Am I missing something?

Best Regards,
Michael

[1] http://lists.nongnu.org/archive/html/emacs-orgmode/2013-07/msg00241.html




[O] org-list-allow-alphabetical LaTeX export

2013-06-06 Thread Michael Bach
The LaTeX exporter does not honor the setting of
org-list-allow-alphabetical.  It exports ordered alphabetical list as
standard enumerate environment with numbered items.

org-mode 8.0.3

I placed the setq before loading ox-latex.  I read in the docstring that
org-list-allow-alphabetical should be set before org.el is loaded.  I
installed org-plus-contrib from ELPA and thus do not manually load org.el.

I found a post on this ml [1] on a related issue where the OP states that
doing the setq before loading the exporter solved his issue.

[1] https://lists.gnu.org/archive/html/emacs-orgmode/2013-04/msg01843.html


Re: [O] [New Exporter] org-export-latex-after-initial-vars-hook

2013-06-06 Thread Michael Bach
Nicolas Goaziou address@hidden writes:

 Søren Mikkelsen address@hidden writes:

* But I have a problem with the exporter:*
**
* I have modified by org-exporter to export latex-files with the xelatex*
* compiler. The implementation uses the*
* org-export-latex-after-initial-vars-hook-hook to reconfigure the*
* default process, however, this hook seems to be deleted and I'm not*
* able to find equivalent hook.*

 Isn't it sufficient to customize `org-latex-pdf-process' so it uses

 xelatex?

I assume Søren is using a similar snippet [1] as I do which is very
convenient (credit goes to Bruno Tavernier). This approach lets you
specify a #+LATEX_CMD (think of xelatex, -shell-escape, etc.) on a per
file basis and allows LaTeX package 'injection'.

Is there a hook that is run before actual LaTeX export of a given
org-mode buffer in the new exporter engine?

[1] http://lists.gnu.org/archive/html/emacs-orgmode/2010-10/msg00218.html


Re: [O] [New Exporter] org-export-latex-after-initial-vars-hook

2013-06-06 Thread Michael Bach
To minimize risk of eye cancer (previous version was sent from gmail
web interface at work without plain text setting) here it goes again:

Nicolas Goaziou address@hidden writes:

 Søren Mikkelsen address@hidden writes:

 But I have a problem with the exporter:

 I have modified by org-exporter to export latex-files with the xelatex
 compiler. The implementation uses the
 org-export-latex-after-initial-vars-hook-hook to reconfigure the
 default process, however, this hook seems to be deleted and I'm not
 able to find equivalent hook.

 Isn't it sufficient to customize `org-latex-pdf-process' so it uses
 xelatex?

I assume Søren is using a similar snippet [1] as I do which is very
convenient (credit goes to Bruno Tavernier). This approach lets you
specify a #+LATEX_CMD (think of xelatex, -shell-escape, etc.) on a per
file basis and allows LaTeX package 'injection'.

Is there a hook that is run before actual LaTeX export of a given
org-mode buffer in the new exporter engine?

[1] http://lists.gnu.org/archive/html/emacs-orgmode/2010-10/msg00218.html



Re: [O] org-list-allow-alphabetical LaTeX export

2013-06-06 Thread Michael Bach
Carsten Dominik carsten.dominik at gmail.com writes:

 On 6 jun. 2013, at 10:20, Michael Bach phaebz at gmail.com wrote:
 The LaTeX exporter does not honor the setting of org-list-allow-
alphabetical.  
 
 I think it never did.  Such a list is just an ordered list for export, the 
bullet type is just visual sugar in the Org buffer.
 To force a special bulllet type, you should use other means (literal 
LaTeX).  For example:
 
 ---
 
 * test
 
 1. skfkshafkj
 2. fkjshfksj
 
 #+LaTeX: {\renewcommand{\theenumi}{\alph{enumi}}
 
 1. kajsfkjhf
 2. fjsfksjhf
 
 #+LaTeX: }
 
 1. sss
 2. ljhsdfkjh
 ---
 

Oh, I never saw it handled by the exporter, just a wrong assumption.  Just 
out of curiosity, do you think this could be implemented 'easily'?

Thanks for clarification and example.

Michael





Re: [O] org-list-allow-alphabetical LaTeX export

2013-06-06 Thread Michael Bach
Carsten Dominik carsten.dominik at gmail.com writes:

  Oh, I never saw it handled by the exporter, just a wrong assumption.  Just 
  out of curiosity, do you think this could be implemented 'easily'?
 
 I guess it could be - but I am not sure if it should.  Conventions about the 
type of bullet to be used in a document
 belong to the typesetting side, and I rather establish a global setting for 
a document than follow my
 momentary decisions when I write the Org-mode version of it.  On a similar 
vein, we do have lists starting
 with - and * and +, but we still let LaTeX and HTML choose what to use as a 
bullet.  To me this feels like the right behavior.

Good point.  The separation of typesetting and content is of course more 
reasonable than my lazyness.






Re: [O] [New Exporter] org-export-latex-after-initial-vars-hook

2013-06-06 Thread Michael Bach
 Is there a hook that is run before actual LaTeX export of a given
 org-mode buffer in the new exporter engine?
 

For reference:
I got it to work by adapting the snippet from Bruno Tavernier[1]:
#+begin_src emacs-lisp
(defun my-auto-tex-cmd (backend)
When exporting from .org with latex,
automatically run latex, pdflatex, or xelatex as appropriate,
using latexmk.
(let ((texcmd))
  (setq texcmd latexmk -pdf %f)
  (if (string-match LATEX_CMD: pdflatex (buffer-string))
  (setq texcmd latexmk -pdflatex=pdflatex -pdf %f))
  (if (string-match LATEX_CMD: pdflatex-shell-escape (buffer-string))
  (setq texcmd latexmk -pdflatex=pdflatex --shell-escape -pdf %f))
  (if (string-match LATEX_CMD: xelatex (buffer-string))
  (setq texcmd latexmk -pdflatex=xelatex -pdf %f))
  (setq org-latex-pdf-process (list texcmd
  (add-hook 'org-export-before-parsing-hook 'my-auto-tex-cmd)
#+end_src

One thing that tripped me up initially was the requirement for the function to 
accept exactly one argument (unused in this case).

[1] http://lists.gnu.org/archive/html/emacs-orgmode/2010-10/msg00218.html





Re: [O] Auto-unfold subtrees with matches in query-replace (et al.?)

2013-06-06 Thread Michael Bach
Hi Bastien,

On Tue, May 14, 2013 at 10:34 AM, Bastien b...@gnu.org wrote:

 Would be a nice feature to have -- don't hesitate to report it with
 M-x report-emacs-bug RET


Done. Thanks for explanation.

Michael



[O] ox-beamer worg site: broken download

2013-05-23 Thread Michael Bach
Dear org-mode Users and Developers,

I just tried to get an example of the usage of the new ox-beamer module and 
thus tried to view the source of the org file referenced on the ox-beamer 
example page on worg[1].

I see from the browser's javascript tools console, that the 'Show Org source' 
button's onclick function show_org_source() is not defined. Is this file 
accessible otherwise?

Best Regards,
Michael Bach

[1] http://orgmode.org/worg/exporters/beamer/presentation.html




[O] Auto-unfold subtrees with matches in query-replace (et al.?)

2013-05-07 Thread Michael Bach

Dear org-mode Users and Developers,

When I do a M-% (query-replace) in an org-mode buffer where the relevant 
trees are folded, subtrees with matches are not unfolded.  I am looking 
for a similar behavior as is observed when doing a simple C-s 
(search-forward).


While I am at it: the same applies to a 3-way ediff merge session 
started from magit, namely the `next' difference is not visible because 
of folding.  My solution for now is to fundamental-mode the buffers 
prior to the merging work.


Is there an option for this that I am missing?  (How) Did you solve this?

Best Regards,
Michael




Re: [O] LaTeX export: Keep point position in TeX file

2012-01-23 Thread Michael Bach
Eric S Fraga e.fr...@ucl.ac.uk writes:

 If so, I suggest you could achieve what you want by using the
 org-export-* hooks to, for instance, save current position before export
 and then jump to that position after export?  Maybe
 org-export-first-hook and org-export-latex-final-hook could be used?


Thanks for your thoughts on this and sorry for being late to reply.  I
stumbled upon your reply and have tried it today with this:

--8---cut here---start-8---
(defun my-org-latex-export-save-point ()
  (interactive)
  (let ((latexfile (concat (file-name-sans-extension (buffer-name)) .tex))
(orgfile (buffer-name)))
(if (get-buffer latexfile)
(save-excursion (set-buffer latexfile)
(setq temppoint (point)))
  (message Open exported LaTeX file to save point position
--8---cut here---end---8---

`(interactive)' is only for testing purposes.  Saving of point in .tex
file under `temppoint' works this way.

I tried further restoring point but failed.  For reference:

--8---cut here---start-8---
(defun my-org-latex-export-restore-point ()
  (interactive)
  (let ((latexfile (concat (file-name-sans-extension (buffer-name)) .tex))
(orgfile (concat (file-name-sans-extension (buffer-name)) .org)))
(progn
  (switch-to-buffer-other-frame (get-buffer latexfile))
  (goto-char temppoint
--8---cut here---end---8--- 

The switching to latex file works, but `(goto-char temppoint)' does not
- for a reason I do not understand.  The only benefit of this is that
after export, emacs switches to the latex file automatically, which may
or may not be wanted (in my case, it is).

The last thing is to bind the functions to the correct hooks.  I found
this worked:

--8---cut here---start-8---
(add-hook 'org-export-latex-after-initial-vars-hook
  'my-org-latex-export-save-point)
(add-hook 'org-export-latex-after-save-hook
  'my-org-latex-export-restore-point)
--8---cut here---end---8---

 Untried and obviously untested!  And likely beyond my elisp capabilities
 so I'd be very keen on seeing a solution.  This behaviour has also
 bothered me (well, very minor irritation) for a long time as I often
 export to latex when debugging the export to PDF.


It is also a minor irritation to me.  And even if I could get my
solution to work as intended, this approach only helps for minor edits,
since the org-export could insert arbitrarily many new lines into the
latex file, making the restore by previous point position rather
useless.

What would be needed is a context sensitive position check which can
check for environments and contents simultaneously.  Just guessing and
thinking aloud here.  A solution by hobby-elispers like me will be
necessarily cumbersome, but maybe someone more skilled can pick up the
scraps and make it work better :-)

Best,
Michael



Re: [O] inline src_R also in latex src block

2012-01-12 Thread Michael Bach
Andreas Leha andreas.l...@med.uni-goettingen.de writes:

 yes, that should work.  Try to export the following several times.  The
 first number should not change.
 (note: maybe you'd have to execute the inner_test_cached once on your
 system)

 #+name: inner_test_cached
 #+begin_src R :cache yes :exports none
   rnorm(1)
 #+end_src

 #+results[dbeb7280be41fdc949815808cf601a6d01a400bb]: inner_test_cached
 : 1.12399967834262

 #+name: inner_test_not_cached
 #+begin_src R :exports none
   rnorm(1)
 #+end_src

 #+results: inner_test_not_cached
 : -0.562660468468834
 #+name: test
 #+begin_src latex :noweb yes
   \begin{equation}
 inner_test_cached()
 !=
 inner_test_not_cached()
   \end{equation}
 #+end_src

Thanks for the testing code.  Having R and LaTeX inside org this way is
just pure fun.

Michael



[O] LaTeX export: Keep point position in TeX file

2012-01-12 Thread Michael Bach
Hello everyone,

The way I am now doing LaTeX export is that I have the exported tex
buffer below the org buffer.  When I do an export via `C-c C-e l' the
.tex buffer gets updated, but point jumps to beginning of buffer instead
of staying where it was.  (How) Can I changed that so point stays near
where it was before I exported again?

Best Regards,
Michael





[O] Synctex -- Syncorg?

2012-01-12 Thread Michael Bach
Hello Everyone,

I am interested whether something like synctex search and inverse search
can be cooked up to work with org-mode.  The codename `syncorg' was used
in this conversation [1].  Would this be hard to implement?  Just
curious.

Kind Regards,
Michael

Footnotes:
[1]  http://lists.gnu.org/archive/html/emacs-orgmode/2010-08/msg01253.html



Re: [O] inline src_R also in latex src block

2012-01-12 Thread Michael Bach



Sebastien Vauban
wxhgmqzgwmuf-genee64ty+gs+fvcfc7...@public.gmane.org writes:

 That's perfectly correct: as long as your input code block does not change
 (options on the meta line and/or contents), your results will be taken as
 is, instead of being recomputed every time.

Very nice, Thanks for confirmation!  

Michael





Re: [O] inline src_R also in latex src block

2012-01-10 Thread Michael Bach
Eric Schulte eric.schu...@gmx.com writes:


 I don't know of a way to evaluate inline code blocks which are already
 inside of regular code blocks.  

Thanks for your thoughts on this, Eric.  This would be *really*
convenient for me.  Too bad the christmas wishlist was processed
already.

 You could try direct begin_latex code blocks, but in-buffer font lock
 support may simply not be possible in this situation.


Sadly, direct begin_latex code blocks get fontified with `org-block' and
also export the inline `src_R' snippets literally.

What I was looking for is latex code fontified as AUCTeX and inline
`src_R' snippets evaluated prior to exporting.  The only working
combination I got right now is inline `src_R' evaluation and no AUCTeX
font-lock.  This is only a minor itch and not too bad considering what
org-mode already does for me.

Best Regards,
Michael



[O] org-preview-latex-fragment does not include #+LaTeX_CLASS definition

2012-01-10 Thread Michael Bach
Hello everyone,

org-mode version 7.8.02

When doing `org-preview-latex-fragment' on a buffer with custom set
#+LaTeX_CLASS and some #+LATEX_HEADER lines, the pdflatex process to
create the ltxpng/*.png images fails e.g. with:

Failed to create dvi file from /tmp/orgtex1650tNa.tex

Now when I check the temporary .tex file under
e.g. /tmp/orgtex1650tNa.tex, I see that the #+LATEX_HEADER: parts of my
file got put in, but the preamble does not include the #+LaTeX_CLASS
\usepackage definitions.

The #+LATEX_HEADER lines depend on the packages loaded in my
#+LaTeX_CLASS definition, so there is no wonder pdflatex fails.

My actual question: Why is the tmp tex file generated without the custom
#+LaTeX_CLASS preamble?

Best Regards,
Michael



Re: [O] inline src_R also in latex src block

2012-01-10 Thread Michael Bach
Andreas Leha andreas.l...@med.uni-goettingen.de writes:

 would this noweb-based approach work for you:

 #+name: inner_test
 #+begin_src R
   4 + 4
 #+end_src

 #+name: test
 #+begin_src latex :noweb yes
   \begin{equation}
 inner_test()
   \end{equation}
 #+end_src


Yes, that works.  Thanks for your thoughts on this, Andreas.

I am just thinking of another benefit:  Is it correct that I can use
caching with this approach?  So that the call to inner_test() does
not evaluate the `inner_test' block but instead takes its results
directly from the cached `#+results[6099...]: inner_test' block?  This
would be speedier than src_R usage...



[O] inline src_R also in latex src block

2011-12-30 Thread Michael Bach
Hello,

I am using org-mode version 7.8.02

I can successfully do inline `src_R' e.g. via

--8---cut here---start-8---
\begin{equation}
  src_R{4 + 4}
\end{equation}
--8---cut here---end---8---

where `8' is put into the equation environment on export.  Sadly, there
is no LaTeX font lock in the org file this way.  But when I do it inside
a latex src block providing font lock, e.g.

--8---cut here---start-8---
#+name: test
#+begin_src latex
  \begin{equation}
src_R{4 + 4}
  \end{equation}
#+end_src
--8---cut here---end---8---

the `src_R' is put in literally on latex export.

Is there a way of preprocessing this latex src block with babel for R
prior to exporting?

Thanks in advance,
Michael




[O] org-edit-special behavior

2011-12-14 Thread Michael Bach
Dear org-ers,

I am using babel more often.  The way I do it is together with R and
LaTeX.  That means I have a certain window layout with .org, .r, ESS,
latex output, etc. buffers.  All in all that makes around 6 buffers.

Now when I use C-c ' to edit a babel src block in a temporary buffer, my
layout gets shadowed, presenting me with the org buffer from where
org-edit-special was called and the editing buffer.

How can I change that behavior so that org-edit-special uses the
existing layout or can it be told which window to use?

Best Regards,
Michael



Re: [O] LaTeX export keyword coloring

2011-11-27 Thread Michael Bach
Michael Bach pha...@gmail.com writes:

 Can someone give me a hint on where to look for a solution?  Do I miss
 something obvious?

Indeed I missed something obvious.  Once again: More thinking, less
typing.

Sorry for the noise



[O] LaTeX export keyword coloring

2011-11-25 Thread Michael Bach
Hello,

I am having trouble controlling what org's LaTeX export does with my
keyword markup.  I have set

org-export-latex-todo-keyword-markup (quote ((NEW . \\new{%s}) 
 (TODO . \\todo{%s})
 (DONE . \\done{%s})))

In the org file, I got

#+OPTIONS: todo:t
#+LATEX_HEADER: \usepackage[usenames, dvipsnames]{color}
#+LATEX_HEADER: \def\done#1{{\color{ForestGreen}#1}}

I am using the standard latex export class.  When I export to a
temporary buffer via C-c C-e L, I see this below my inserted
#+LATEX_HEADER lines

\usepackage[usenames, dvipsnames]{color}
\def\done#1{{\color{ForestGreen}#1}}
\usepackage{color}
\def\todo#1{{\color{red}#1}}
\def\done#1{{\color{green}#1}}
\providecommand{\alert}[1]{\textbf{#1}}

Now I wonder where the last 4 lines (which overrule the coloring) came
from and am at a loss.  I could not find it in the docs and googled
around to no avail.  Also, I do not think this is caused by my other
org-mode configuration settings.

Can someone give me a hint on where to look for a solution?  Do I miss
something obvious?

Thanks in advance,
Michael Bach



Re: [O] #+begin_src LaTeX blocks export to literal LaTeX

2011-11-07 Thread Michael Bach
Just for reference, I found that I need to load `ob-latex.el'.  With
that it works nicely.



[O] #+begin_src LaTeX blocks export to literal LaTeX

2011-11-06 Thread Michael Bach
Dear org-mode community,

I am configuring my LaTeX export setup and found LaTeX src blocks very
nice for the font lock they provide and the possibility of having AUCTeX
activated for that block by =C-c '=.  However, org's LaTeX exporter puts
them into a \verbatim environment by default in the resulting LaTeX
file.

I looked into the documentation whether some src flags could accomplish
this and found none.  I see that an option `:exports literal' would be
rather too much, since it probably only really makes any sense for this
specific use case.  But it would be nice nonetheless...

Did I make myself clear?  Or is there a better approach to this?

Thanks in advance!

Michael



Re: [O] emacs 24.1 and org compatibility

2011-10-29 Thread Michael Bach
Tassilo Horn tass...@member.fsf.org writes:

Hi Tassilo!

 Usually, if you've adapted your `load-path' to include the org lisp
 direcory before requiring/loading anything from org, then all the
 bundled org files from emacs should be shadowed.

Yeah, I thought so as well.  I manage org-mode (git) and my other 3rd
party packages with el-get [1].  In this case, somehow it does not play
along with the way emacs handles this shadowing of built-in packages.

The el-get init is pretty much the first thing I load from my emacs init
file.  So it should set the load-path accordingly.  I am too busy right
now to fix this, so for now I require the correct org-compat with an
explicit path.

cheers

Footnotes: 
[1]  https://github.com/dimitri/el-get




[O] emacs 24.1 and org compatibility

2011-10-28 Thread Michael Bach




Re: [O] emacs 24.1 and org compatibility

2011-10-28 Thread Michael Bach
Tassilo Horn tass...@member.fsf.org writes:

 Michael Bach pha...@gmail.com writes:

 [nothing]

 I agree with all that you've said. :-)


Hm.  Since my subject line is the only thing I said, that was easy.  :-)

So for the actual issue: After pulling emacs from bzr and org mode from
git today, org-capture failed with error:

void-function: org-pop-to-buffer-same-window

After digging around, I found the definition in org-compat.el from the
git repo and a comment within saying that `pop-to-buffer-same-window'
has been introduced with Emacs 24.1.

I now require the org-compat from git repo instead of the one built into
org-mode from emacs 24.0.90.1 since org-pop-to-buffer-same-window is not
defined within that.

I am not fully used to development versions yet...

Sorry for sending only an empty draft and then some noise.

cheers 



Re: [O] orgtbl multicolumn support

2011-05-06 Thread Michael Bach
Michael Bach pha...@gmail.com writes:

What kind of evil, sleep-deprived line of thoughts took me when I wrote
this?  Must have been too late for anything remotely meaningful.  This
one clearly did not deserve any answer...  Sorry for the noise

 Michael Bach pha...@gmail.com writes:

 # edit

 Dear org-mode Users and Developers,

 I just wanted to know whether there are plans to support multicolumns in
 default orgtbl-to-latex.  Something along these lines:

 #+ORGTBL: SEND multicol orgtbl-to-latex :splice t :skip 0 :hline \\midrule
 |   | a | b   | c |
 |---+---+-+---|
 | 1 |   | mc(2)(c)(3) |   |
 |   | 2 | mc(2)(c)(4) |   |

 Would produce

 % % BEGIN RECEIVE ORGTBL multicol
a  b  c\NN
 \midrule
 1 \multicolumn{2}{c}{3}  \NN
2  \multicolumn{2}{c}{4}  \LL
 % END RECEIVE ORGTBL multicol

 # This should correctly read:

 % % BEGIN RECEIVE ORGTBL multicol
a  b  c \\
 \midrule
 1 \multicolumn{2}{c}{3} \\
2  \multicolumn{2}{c}{4} \\
 % END RECEIVE ORGTBL multicol

 The reason being that I would like to use \multicolumn often in the
 middle of an orgtbl.  My workarounds with manually inserting the LaTeX
 macro are clumsy.

 I understood that users should write their own conversion functions.  If
 I was going to try my fresh elisp fu, I wanted to ask here whether there
 exists a generic orgtbl syntax to implement the above intercell
 modification.  I read the doc for version 7.5 but maybe there are also
 new methods in the dev version which I freshly use.

 Kind Regards,
 Michael Bach



Re: [O] Row formula in orgtbl mode

2011-05-05 Thread Michael Bach
Michael Brand michael.ch.br...@gmail.com writes:

 Your range formula @4$2..@4$5=@-1*@-2 will work if you upgrade at
 least to this commitdiff
 http://orgmode.org/w/?p=org-mode.git;a=commitdiff;h=8237c9ae6d587a22646333e0315683675e2db538

I am now running the 7.5 development version checked out today.  I knew
I would have to do this one day...

 |   |a |b |c |d |
 | Specific cost |1 |9 |2 |3 |
 | System size   | 1000 | 1000 | 1000 | 1000 |
 |   | 1000 | 9000 | 2000 | 3000 |
 | ...   |  ... |  ... |  ... |  ... |
 #+TBLFM: @4$2..@4$5=@-1*@-2

 For this application I would suggest
 #+TBLFM: @4$..@4$=@-1*@-2

Thanks for the quick and competent answer Michael, it worked right away.

MB



[O] orgtbl multicolumn support

2011-05-05 Thread Michael Bach
Dear org-mode Users and Developers,

I just wanted to know whether there are plans to support multicolumns in
default orgtbl-to-latex.  Something along these lines:

#+ORGTBL: SEND multicol orgtbl-to-latex :splice t :skip 0 :hline \\midrule
|   | a | b   | c |
|---+---+-+---|
| 1 |   | mc(2)(c)(3) |   |
|   | 2 | mc(2)(c)(4) |   |

Would produce

% % BEGIN RECEIVE ORGTBL multicol
   a  b  c\NN
\midrule
1 \multicolumn{2}{c}{3}  \NN
   2  \multicolumn{2}{c}{4}  \LL
% END RECEIVE ORGTBL multicol

The reason being that I would like to use \multicolumn often in the
middle of an orgtbl.  My workarounds with manually inserting the LaTeX
macro are clumsy.

I understood that users should write their own conversion functions.  If
I was going to try my fresh elisp fu, I wanted to ask here whether there
exists a generic orgtbl syntax to implement the above intercell
modification.  I read the doc for version 7.5 but maybe there are also
new methods in the dev version which I freshly use.

Kind Regards,
Michael Bach



Re: [O] orgtbl multicolumn support

2011-05-05 Thread Michael Bach
Michael Bach pha...@gmail.com writes:

# edit

 Dear org-mode Users and Developers,

 I just wanted to know whether there are plans to support multicolumns in
 default orgtbl-to-latex.  Something along these lines:

 #+ORGTBL: SEND multicol orgtbl-to-latex :splice t :skip 0 :hline \\midrule
 |   | a | b   | c |
 |---+---+-+---|
 | 1 |   | mc(2)(c)(3) |   |
 |   | 2 | mc(2)(c)(4) |   |

 Would produce

 % % BEGIN RECEIVE ORGTBL multicol
a  b  c\NN
 \midrule
 1 \multicolumn{2}{c}{3}  \NN
2  \multicolumn{2}{c}{4}  \LL
 % END RECEIVE ORGTBL multicol

# This should correctly read:

% % BEGIN RECEIVE ORGTBL multicol
   a  b  c \\
\midrule
1 \multicolumn{2}{c}{3} \\
   2  \multicolumn{2}{c}{4} \\
% END RECEIVE ORGTBL multicol

 The reason being that I would like to use \multicolumn often in the
 middle of an orgtbl.  My workarounds with manually inserting the LaTeX
 macro are clumsy.

 I understood that users should write their own conversion functions.  If
 I was going to try my fresh elisp fu, I wanted to ask here whether there
 exists a generic orgtbl syntax to implement the above intercell
 modification.  I read the doc for version 7.5 but maybe there are also
 new methods in the dev version which I freshly use.

 Kind Regards,
 Michael Bach



[O] Row formula in orgtbl mode

2011-05-04 Thread Michael Bach
Dear org-mode Users,

Given this table

|   |a |b |c |d |
| Specific cost |1 |9 |2 |3 |
| System size   | 1000 | 1000 | 1000 | 1000 |
|   |  |  |  |  |
| ...   |  ... |  ... |  ... |  ... |
#+TBLFM: @4=@2*@3

I am wondering how I would need to format the #+TBLFM: line to multiply
the respective numeric values of rows 2 and 3 in row 4.  I am using org
v.7.4.  All my attempts, also trying to define ranges like
@4$2..@4$5=@-1*@-2, fail.

Thanks in advance,
Michael Bach



[O] Row formula in orgtbl mode

2011-05-04 Thread Michael Bach

# I sent this one previously by mistake in reply to a totally unrelated post, 
so now
# again.

Dear org-mode Users,

Given this table

|   |a |b |c |d |
| Specific cost |1 |9 |2 |3 |
| System size   | 1000 | 1000 | 1000 | 1000 |
|   |  |  |  |  |
| ...   |  ... |  ... |  ... |  ... |
#+TBLFM: @4=@2*@3

I am wondering how I would need to format the #+TBLFM: line to multiply
the respective numeric values of rows 2 and 3 in row 4.  I am using org
v.7.4.  All my attempts, also trying to define ranges like
@4$2..@4$5=@-1*@-2, fail.

Thanks in advance,
Michael Bach



[O] orgtbl export option :hlstart :hllstart

2011-03-04 Thread Michael Bach
Dear orgers,

I love orgtbl minor mode in auctex. I tried to set it up today for ctable
and this is the work in progress:

% % BEGIN RECEIVE ORGTBL systems
headline  headline \\NN
second row  second row \\NN
% END RECEIVE ORGTBL systems

#+ORGTBL: SEND systems orgtbl-to-latex :splice t :skip 0 :hline nil :lend
\\NN :llend \\LL :hlstart \\FL :hlend \\ML
| headline | headline |
| second row | second row |
all works nicely, except :hlstart \\FL :hlend \\ML, and hll variants of
those which I found in the docstring for the orgtbl-to-latex function, do
not work.

Do I miss something?

Michael


[Orgmode] Option: special beginning of headline (list) option for navigation commands

2011-02-23 Thread Michael Bach
Is there an option for org-metaup (org-metadown) and 
outline-next-visible-heading (outline-previous-visible-heading) to alway jump 
to the first non-star character in a headline instead of the beginning of a 
headline? I could not find this option in the manual. In my opinion, this would 
complement the special C-a/e commands which I also use. This behaviour is 
already the default for org-metaup/-down in lists.

Thanks,
Michael

___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] Re: problem with org-export-latex-todo-keyword-markup [7.4]

2011-02-16 Thread Michael Bach
On 02/16/2011 11:36 AM, phaebz wrote:
 I defined it as an associative list, as described in the manual:
 org-export-latex-todo-keyword-markup evaluates to ((new . \\new{%s}) 
 (done . \\done{%s}) (todo . \\todo{%s}))

 In my LaTeX header are the options:
 #+LATEX_HEADER: \def\todo#1{{\color{red}#1}}
 #+LATEX_HEADER: \def\done#1{{\color{green}#1}}
 #+LATEX_HEADER: \def\new#1{{\color{blue}#1}}

 Now I noticed that, in the exported pdf, all todo keywords are typeset in the 
 same color, which is always the value of the first element in the a-list. In 
 the above example, all keywords get set to blue, i.e. the LaTeX file contains 
 odd things like \new{TODO}.

 According to the manual, I expect this behaviour - using the value of the 
 first element - only for todo keywords for which there is no key in the 
 a-list defined.

 Am I doing something wrong?

Actually, I am thinking of setting up a virtual mailing-list just for me, so 
that I can send my email there, since there seems to be a correlation between 
me sending my problems to this list and finding the solution on my own.

For completeness, obviously the keys have all to be upper case, i.e. ((NEW . 
\\new{%s}) (DONE . \\done{%s}) (TODO . \\todo{%s})).

I will try to avoid these mails in the future.

Michael Bach

___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] problem with org-export-latex-todo-keyword-markup [7.4]

2011-02-16 Thread Michael Bach
On 02/16/2011 01:32 PM, Bastien wrote:
 Hi Phaebz,

 phaebz pha...@googlemail.com writes:

 I defined it as an associative list, as described in the manual:
 org-export-latex-todo-keyword-markup evaluates to ((new
 . \\new{%s}) (done . \\done{%s}) (todo . \\todo{%s}))
 Use NEW TODO DONE instead of new todo done, the search 
 for this is case-sensitive.

 HTH,


Thanks for the notice Bastien, I just read your message today, delivery was not 
really working it seems. See also my own reply to this...

cheers,
Michael

___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode