Re: [O] Insert a heading in every sibling
Dnia 2013-10-28, o godz. 06:13:21 Scot Becker scot.bec...@gmail.com napisał(a): I'm using org-mode to keep track of student grades. How can I easily add a bunch of identical headings at a certain level in my tree? Specifically,I have a L2 heading for each student, and I want to put a node (heading, with some properties) under each L2 student heading for that class. Personally, I'd just write a small Elisp function to do that. (It's easier than you might think - even I could do that;).) Here's a thing that is (remotely) similar: http://mbork.pl/2013-09-23_Automatic_insertion_of_habit_templates_%28en%29 Or, you could record a keyboard macro, and even save it as Elisp. Hth, -- Marcin Borkowski http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski Adam Mickiewicz University
Re: [O] [RFC] Overlay specification for includegraphics
Hello, Suvayu Ali fatkasuvayu+li...@gmail.com writes: I tested with a minimal setup. Same issue. The following: #+attr_beamer: :overlay 1 :width 0.8\linewidth [[file:bla.png]] exports as, \includegraphics[width=.9\linewidth]{bla.png} Something is off. Beamer back-end delegates external link handling to the LaTeX back-end (see l. 723 in ox-beamer.el). The latter ignores everything about Beamer and its attributes. In most cases, you can specify an overlay attribute to a link using export snippets (see Beamer specific syntax in section 12.5 of the manual). But it requires adding contents to the link, which is impossible for image links, as the must have no contents. Therefore, in this case, Someone needs to copy image handling in ox-beamer.el and add ATTR_BEAMER support there. Regards, -- Nicolas Goaziou
[O] [PATCH] Fix org-indent-region's BEGIN_SRC / END_SRC indentation
Hello, Attached is a 2 character patch that makes org-indent-region indent #+BEGIN_SRC and #+END_SRC lines according to org document rules instead of the indentation rules of the language /inside/ the source block. This is my first patch proposal for org-mode, so please let me know if I need to modify things. In any case, feedback is welcome! Cheers, Joost Diepenmaat Zeekat Software Ontwikkeling 0001-Correctly-indent-BEGIN_SRC-and-END_SRC-lines.patch Description: Binary data
Re: [O] [PATCH] fix org-insert-todo-heading-respect-content in plain list item
Hello, Ingo Lohmar i.loh...@gmail.com writes: please find attached a 1-4-char patch fixing the behavior of the above function when inside a plain list. [...] Subject: [PATCH] fix org-insert-todo-heading-respect-content in plain list item * lisp/org.el (org-insert-todo-heading-respect-content): pass correct prefix arg to always insert heading TINYCHANGE This function used a second argument t, which is eventually passed to org-insert-heading, adding a list item when inside a plain list. Use the proper argument '(4) now, to always create a heading, just like the function's name and documentation imply. Thank you for your patch. Could you provide a test case, because, after a quick test, I do not see any difference before and after applying your patch. Regards, -- Nicolas Goaziou
Re: [O] [RFC] Slight change to asynchronous export
Hello Nicolas, Nicolas Goaziou wrote: At the moment, by default, external emacs process for asynchronous export is called with: /path/to/emacs -Q --batch -l org-export-async-init-file ... export stuff... where `org-export-async-init-file' defaults to `user-init-file'. It is, by default, not the same as calling emacs, because of the -Q. I suggest allowing a nil (default) value for `org-export-async-init-file'. In that case, the command will become: /path/to/emacs --batch ... export stuff... If it is a file, it will be the same as before. WDYT? IIUC, the default `user-init-file' still gets read because you drop the `-Q' option. And you allow adding a supplementary configuration file for the export process. Right? The only drawback would be for people having a long .emacs config file (which takes a long time to load): they would experience a longer running time for the async export, but it's async, so they wouldn't mind much. That seems good to me. BTW, is there no possibility of doing the same with emacsclient (but with no visible buffer)? That'd drop the startup time of Emacs. But, once again, that's not a problem per se, as it's async. It's for my own understanding. Best regards, Seb -- Sebastien Vauban
Re: [O] Insert a heading in every sibling
Marcin Borkowski wrote: Scot Becker scot.bec...@gmail.com napisał(a): I'm using org-mode to keep track of student grades. How can I easily add a bunch of identical headings at a certain level in my tree? Specifically,I have a L2 heading for each student, and I want to put a node (heading, with some properties) under each L2 student heading for that class. Personally, I'd just write a small Elisp function to do that. (It's easier than you might think - even I could do that;).) Here's a thing that is (remotely) similar: http://mbork.pl/2013-09-23_Automatic_insertion_of_habit_templates_%28en%29 Or, you could record a keyboard macro, and even save it as Elisp. Other solutions include: - using YASnippets, or - writing a skeleton in the Org document and cloning it N times at once (see C-c C-x c). Best regards, Seb -- Sebastien Vauban
Re: [O] [PATCH] Fix org-indent-region's BEGIN_SRC / END_SRC indentation
Hello, Joost Diepenmaat jo...@zeekat.nl writes: Attached is a 2 character patch that makes org-indent-region indent #+BEGIN_SRC and #+END_SRC lines according to org document rules instead of the indentation rules of the language /inside/ the source block. This is my first patch proposal for org-mode, so please let me know if I need to modify things. In any case, feedback is welcome! [...] From 659a071cc519ebdaabd586132f1d4d3159475c8d Mon Sep 17 00:00:00 2001 From: Joost Diepenmaat jo...@zeekat.nl Date: Fri, 25 Oct 2013 11:08:46 +0200 Subject: [PATCH] Correctly indent BEGIN_SRC and END_SRC lines Here, you need to specifying what functions and variables are modified by your patch and how. Something like the following should do: * lisp/org.el (org-indent-region): BEGIN_SRC and END_SRC lines should not be considered part of the source block for the purposes of indentation. TINYCHANGE Otherwise, the patch looks good. So I applied it with said modifications. Thank you. Regards, -- Nicolas Goaziou
Re: [O] [RFC] Slight change to asynchronous export
Hello, Sebastien Vauban sva-news-D0wtAvR13HarG/idocf...@public.gmane.org writes: Nicolas Goaziou wrote: At the moment, by default, external emacs process for asynchronous export is called with: /path/to/emacs -Q --batch -l org-export-async-init-file ... export stuff... where `org-export-async-init-file' defaults to `user-init-file'. It is, by default, not the same as calling emacs, because of the -Q. I suggest allowing a nil (default) value for `org-export-async-init-file'. In that case, the command will become: /path/to/emacs --batch ... export stuff... If it is a file, it will be the same as before. WDYT? IIUC, the default `user-init-file' still gets read because you drop the `-Q' option. And you allow adding a supplementary configuration file for the export process. With the proposed change, you get `user-init-file' and all site-lisp/ family, which is equivalent to a regular Emacs call. Actually, by default, you only get `user-init-file'. Right? Correct. The only drawback would be for people having a long .emacs config file (which takes a long time to load): they would experience a longer running time for the async export, but it's async, so they wouldn't mind much. If you specify a specific config file, which is what `org-export-async-init-file' suggests, the load time will be decreased. BTW, is there no possibility of doing the same with emacsclient (but with no visible buffer)? That'd drop the startup time of Emacs. But, once again, that's not a problem per se, as it's async. It's for my own understanding. No, that's not possible. Emacsclient runs in the same process as the server: this is not asynchronous anymore. To convince yourself, try spawning two clients from the same server, run (sleep-for 30) in one of them and switch to the other one. Regards, -- Nicolas Goaziou
Re: [O] [PATCH] Longtable continuation strings customizable
Hello, t...@tsdye.com (Thomas S. Dye) writes: I think there are two axes of variation here: 1) internationalization, and 2) style guides, e.g., for a particular journal, Chicago Manual, etc. IIUC, hardcoding and org-export-dictionary solve 1) but not 2). In my experience, variation in 2) is idiosyncratic, though I haven't looked specifically at table continuation lines. The user can solve both 1) and 2) with customizable continuation strings, so it might be best to stay on this path instead of hardcoding and internationalization in org-export-dictionary. I agree customization is more powerful here (although it means that all non-English Org users will need to change it), but so it is for every other multilingual string. Since we didn't choose to make multilingual strings customizable, I find it strange that this particular one is. Also, I you can use a filter to modify that string and make it comply to a specific style, if needed. IOW, you also get 1) and 2) with the `org-export-dictionary' way, with 1) being more user-friendly and 2) more difficult than in the current way. Am I missing something? Regards, -- Nicolas Goaziou
Re: [O] [PATCH] Fix org-indent-region's BEGIN_SRC / END_SRC indentation
On Mon, Oct 28, 2013 at 9:57 AM, Nicolas Goaziou n.goaz...@gmail.comwrote: Here, you need to specifying what functions and variables are modified by your patch and how. Something like the following should do Oh yes. I'll keep that in mind next time. Otherwise, the patch looks good. So I applied it with said modifications. Great, thanks! Joost.
[O] Confused about org-index, org-favtable, org-reftabel, org-refer-by-number
Hello, I'm using org-reftable.el [1] from the contrib path of the Git repository since several months. It is a useful addition to integrate my personal archive of notes, data sheets, and pages that I tore out of journals into Org Mode documents. Now that I wanted to refine this system, I stumbled across the other packages mentioned in the subject. It seems that they are all revisions of the same project from Marc Ihm. IIUC, org-index.el is the newest version that was preceded by org-favtable.el, org-reftable.el, and org-refer-by-number.el. Currently we have org-favtable.el and org-reftable.el in the contrib path whilst org-index.el is only available via Worg [2]. Marc, could you please clarify this confusion? Anyway, thank you for sharing this add-on! Best regards Michael Strey Footnotes: [1] http://orgmode.org/worg/code/elisp/org-reftable.el [2] http://orgmode.org/worg/code/elisp/org-index.el -- Michael Strey http://www.strey.biz
Re: [O] Beamer export: one question and one bug
Jarmo Hurri jarmo.hu...@syk.fi writes: Greetings again. 1. First the question: when I export the org file below as Beamer (C-c C-e l O), I get an empty outline. How do I fix this? Seems to work fine for me with the older version that I was running, but I upgraded to latest and I get the beamer presentation I expected. I think I posed my initial question in a way that begs for a misunderstanding. When I export the file as Beamer, I get a title page, two slides _and_ an empty outline. Maybe someone interpreted my initial question to mean that I get _only_ an empty outline. I would like for the titles of the slides to appear in the outline. How do I achieve this? (I know that I can get rid of the outline by setting toc:nil.) Ah, indeed I misunderstood. AFAIK, toc-entries are created by \section{...} and the beamer exporter does not add \section headers - there might be a way to do that but I don't know it. There also might be a beamer way of having frames add their title to the TOC without \section help, but again I don't know whether that's possible. Nick
Re: [O] Bug: Priority #B in Agenda causes invalid face reference [8.2.1 (8.2.1-15-ge5cecc-elpa @ /Users/Paul/.emacs.d/elpa/org-20131021/)]
Paul Rankin p...@tilk.co writes: org-mode-hook '(#[nil I would check this variable: the bug report is huge primarily because of a lot of white space in the value of this variable. That might be an artifact of mail/news software of course, but it does seem a bit strange. Nick
Re: [O] Importing from Oddmuse?
Just to answer my own question, I shamelessly took Alex Schroeder's raw.pl script and hacked it up a bit to do some conversion from Oddmuse markup to org-mode. The attached Perl script should run through all the pages in an Oddmuse Wiki and generate .org versions of them in a separate directory. This is still very much a work in progress, but I think the general framework is useful. On thing I have to fix is the hyperlinks. Right now, if the Wiki page is one two.pg, this script will generate a file named one_two.org, but any links will refer to [[file:one two.org][one two]] I concentrated on the small subset of Oddmuse markup that I'm using, but I think it's easily extensible. Let me know if this is at all useful to anyone else. -pd On 10/25/13 10:54 AM, Peter Davis wrote: I'm comparatively new to Org mode (actually, I've used it for years, but only a small subset of its functionality). I've used Oddmuse for years to maintain my own personal Wiki, but now I'm looking to move to Org mode. I know there are lots of tools for exporting or publishing from Org mode to Oddmuse, but how about the other direction? Any tools or tips for importing a large number of Oddmuse pages into Org mode? Ideally, I'd like to keep them as separate files, with links converted to file links, etc. -- Peter Davis The Tech Curmudgeon www.techcurmudgeon.com #! /usr/bin/perl -w # Copyright (C) 2005, 2007 Alex Schroeder a...@emacswiki.org # # Portions copyright (c) 2013, Peter Davis p...@pfdstudio.com # # This program 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. # # This program 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 this program. If not, see http://www.gnu.org/licenses/. sub ParseData { my $data = shift; my %result; while ($data =~ /(\S+?): (.*?)(?=\n[^ \t]|\Z)/sg) { my ($key, $value) = ($1, $2); $value =~ s/\n\t/\n/g; $result{$key} = $value; } return %result; } sub FixMarkUp { my $data = shift; my $orgout = #+STARTUP: showeverything logdone\n#+options: num:nil\n\n; my $csvMode = 0; foreach (split /\n/, $data) { if (length($_)) { s/\r//g; # csv tables if ($_ =~ /csv/) { $csvMode = 1; s/csv/#+ATTR_HTML: :border 2 :rules all :frame border/g; } elsif ($_ =~ /^\s*$/) { $csvMode = 0; } elsif ($csvMode) { s/^/|/g; s/,/|/g; s/$/|/g; } # hyperlinks s/\[\[([^]]*)\]\]/[[file:$1.org][$1]]/g; # strike through s/\/?s/+/g; # verse s/:::/#+BEGIN_VERSE/g; # bold and italic s/'''/*/g; s/''/\//g; # bullet lists s/^\*\*\*\*/*/g; s/^\*\*\*/ */g; s/^\*\*/ */g; s/^\*/ */g; # headers s/^\=\=\=\=//g; s/^\=\=\=/***/g; s/^\=\=/**/g; s/^\=/*/g; # s/ \=?$//g; s/ \=\=\=\=$//g; s/ \=\=\=$//g; s/ \=\=$//g; s/ \=$//g; s/^# / 1. /g; } else { $csvMode = 0; } $orgout = $orgout . $_ . \n; } return $orgout; } sub main { my ($regexp, $PageDir, $OrgDir) = @_; # include dotfiles! local $/ = undef; # Read complete files foreach my $file (glob($PageDir/*/*.pg $PageDir/*/.*.pg)) { next unless $file =~ m|/.*/(.+)\.pg$|; my $page = $1; next if $regexp $page !~ m|$regexp|o; $page = $page . .org; mkdir($OrgDir) or die Cannot create $OrgDir directory: $! unless -d $OrgDir; open(F, $file) or die Cannot read $page file: $!; my $data = F; close(F); my $ts = (stat($OrgDir/$page))[9]; my %result1 = ParseData($data); my $result2 = FixMarkUp($result1{text}); if ($ts $ts == $result1{ts}) { print skipping $page because it is up to date\n if $verbose; } else { print writing $page because $ts != $result{ts}\n if $verbose; open(F, $OrgDir/$page) or die Cannot write $page org file: $!; # print F $result1{text}; print F $result2; close(F); utime $result1{ts}, $result1{ts}, $OrgDir/$page; # touch file } } } use Getopt::Long; my $regexp = undef; my $page = 'page'; my $dir = 'org'; GetOptions (regexp=s = \$regexp, page=s = \$page, dir=s= \$dir, help = \$help); if ($help) { print qq{ Usage: $0 [--regexp REGEXP] [--page DIR] [--dir DIR] Writes the org wiki text into plain text files. --regexp selects a subsets of pages whose names match the regular expression. Note that spaces have been translated to underscores. --page designates the page directory. By default this is 'page' in the current directory. If you run this script in your
Re: [O] [RFC] Slight change to asynchronous export
Hi Nicolas, this sounds OK for me. - Carsten On 27.10.2013, at 10:35, Nicolas Goaziou n.goaz...@gmail.com wrote: Hello, At the moment, by default, external emacs process for asynchronous export is called with: /path/to/emacs -Q --batch -l org-export-async-init-file ... export stuff... where `org-export-async-init-file' defaults to `user-init-file'. It is, by default, not the same as calling emacs, because of the -Q. I suggest allowing a nil (default) value for `org-export-async-init-file'. In that case, the command will become: /path/to/emacs --batch ... export stuff... If it is a file, it will be the same as before. WDYT? Regards, -- Nicolas Goaziou
Re: [O] [PATCH] Longtable continuation strings customizable
Nicolas Goaziou n.goaz...@gmail.com writes: I agree customization is more powerful here (although it means that all non-English Org users will need to change it), but so it is for every other multilingual string. Since we didn't choose to make multilingual strings customizable, I find it strange that this particular one is. Also, I you can use a filter to modify that string and make it comply to a specific style, if needed. IOW, you also get 1) and 2) with the `org-export-dictionary' way, with 1) being more user-friendly and 2) more difficult than in the current way. Am I missing something? An example filter? Otherwise, I agree, there is no need to break the mold here. All the best, Tom -- Thomas S. Dye http://www.tsdye.com
Re: [O] [RFC] Slight change to asynchronous export
2013ko urriak 27an, Nicolas Goaziou-ek idatzi zuen: Hello, At the moment, by default, external emacs process for asynchronous export is called with: /path/to/emacs -Q --batch -l org-export-async-init-file ... export stuff... where `org-export-async-init-file' defaults to `user-init-file'. It is, by default, not the same as calling emacs, because of the -Q. I suggest allowing a nil (default) value for `org-export-async-init-file'. In that case, the command will become: /path/to/emacs --batch ... export stuff... If it is a file, it will be the same as before. WDYT? Hi Nicolas, My init.el file does (server-start), and also opens all the buffers (usually 100+) I had opened the last time I quit emacs (by using emacs’s included desktop library). The buffers in turn spawn child processes (aspell, some python IDE-ish autocomplete server, ...) I think these things are relatively common in init.el files, but not things that should be done by the async export process. Other examples might include gnus/other email/rss fetching, or automatic update of installed elpa packages. Of course this would not be an issue for me in particular, but I think it would be very easy for a user to get unwanted results. I guess you want to make it so that users don’t have to configure async export (beyond just flipping it on) in order to use it. But I don’t know if there is a sensible way to parcel out benign bits of initialization code from dangerous ones without user intervention. (“Dangerous” only in the sense of “should not be run by the export process”.) An interesting approach might be to extend the approach of org-export--generate-copy-script in order to generate an init file containing all relevant variable settings that can be read by the async exporter, but given that export hooks can call into arbitrary user-defined elisp, I don’t know if this could get off the ground. -- Aaron Ecay
[O] Arbitrary lisp functions in column-attributes
Hello all, I would really appreciate it if it were possible to specify an arbitrary lisp function to process node-properties when creating a column view. For example, you can currently have something like: * Top node for columns view :PROPERTIES: :COLUMNS: %25ITEM %TAGS %PRIORITY %TODO :END: But I'd like to be able to do something like: :COLUMNS: %ITEM{fn:process_item} %TAGS %PRIORITY %TODO which would pass the ITEM property's value as a single argument to the process_item function. The returned value/string of the function would be what appears in the column view. Of course it would be good if one could also use a lambda expression in place of the function name. Does this sound like something worth working on? I would certainly have various uses for such functionality, so I imagine it would be useful to others as well. Regards, Mark
Re: [O] [RFC] Slight change to asynchronous export
Hello, Aaron Ecay aarone...@gmail.com writes: My init.el file does (server-start), and also opens all the buffers (usually 100+) I had opened the last time I quit emacs (by using emacs’s included desktop library). The buffers in turn spawn child processes (aspell, some python IDE-ish autocomplete server, ...) I think these things are relatively common in init.el files, but not things that should be done by the async export process. Other examples might include gnus/other email/rss fetching, or automatic update of installed elpa packages. Of course this would not be an issue for me in particular, but I think it would be very easy for a user to get unwanted results. At the moment, default configuration will load init.el (or an equivalent) so my proposal is not different in that regard. I guess you want to make it so that users don’t have to configure async export (beyond just flipping it on) in order to use it. I want the default value to be less surprising, even though I strongly encourage users to customize `org-export-async-init-file'. But I don’t know if there is a sensible way to parcel out benign bits of initialization code from dangerous ones without user intervention. I don't know either, and that is well out of the scope of my proposal. Regards, -- Nicolas Goaziou
[O] Copy Sub-tree
Is there a speed command or command in general to copy a subtree to the clipboard or to another file? Thanks, Sam -- Sam Flint swfl...@flintfam.org freenode: swflint (402) 517-8468 http://flintfam.org/~swflint BAFBF3FF
Re: [O] [RFC] Slight change to asynchronous export
2013ko urriak 28an, Nicolas Goaziou-ek idatzi zuen: At the moment, default configuration will load init.el (or an equivalent) so my proposal is not different in that regard. Oh I see. I didn’t read your original email carefully enough; I focused on the removal of -Q, which I just associate with not loading init.el. Sorry for the noise. -- Aaron Ecay
Re: [O] Copy Sub-tree
Put point on the subtree headline and then C-c C-x M-w. Scott Randby On Mon, Oct 28, 2013 at 1:18 PM, Sam Flint swfl...@flintfam.org wrote: Is there a speed command or command in general to copy a subtree to the clipboard or to another file? Thanks, Sam -- Sam Flint swfl...@flintfam.org freenode: swflint (402) 517-8468 http://flintfam.org/~swflint BAFBF3FF
Re: [O] Copy Sub-tree
On Mon, Oct 28, 2013 at 1:18 PM, Sam Flint swfl...@flintfam.org wrote: Is there a speed command or command in general to copy a subtree to the clipboard or to another file? Thanks, Sam -- Sam Flint swfl...@flintfam.org freenode: swflint (402) 517-8468 http://flintfam.org/~swflint BAFBF3FF I forgot something. Copy a subtree: C-c C-x M-w Paste a subtree: C-c C-x C-y Scott Randby
Re: [O] [RFC] Slight change to asynchronous export
Nicolas Goaziou writes: At the moment, by default, external emacs process for asynchronous export is called with: /path/to/emacs -Q --batch -l org-export-async-init-file ... export stuff... where `org-export-async-init-file' defaults to `user-init-file'. It is, by default, not the same as calling emacs, because of the -Q. That's a good thing, I'd say. There is a lot of stuff going on in init files that you most likely don't want done when firing Emacs off in the background. That is especially true of some site-init files that you typically have no control over. I suggest allowing a nil (default) value for `org-export-async-init-file'. In that case, the command will become: /path/to/emacs --batch ... export stuff... If it is a file, it will be the same as before. WDYT? If you don't make this the default then no harm is done, I guess. Regards, Achim. -- +[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]+ SD adaptations for Waldorf Q V3.00R3 and Q+ V3.54R2: http://Synth.Stromeko.net/Downloads.html#WaldorfSDada
Re: [O] Importing from Oddmuse?
Peter Davis writes: # hyperlinks s/\[\[([^]]*)\]\]/[[file:$1.org][$1]]/g; Try this to fix the links maybe: # hyperlinks s/\[\[([^]]*)\]\]/ my $l = $1; $l =~ s: :_:g; [[file:$l.org][$l]]/gex; Regards, Achim. -- +[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]+ SD adaptation for Waldorf rackAttack V1.04R1: http://Synth.Stromeko.net/Downloads.html#WaldorfSDada
[O] [RFC] [export] synctex support for ox-latex
Hello, Some months ago, I proposed a patch to implement synctex support for the latex exporter. Following feedback from Nicolas, I was working on converting that code to use hooks and advice, without modifying core org-mode functions. It was a frustrating but very educational task, and it is now complete. I attach the patch (which consists only of a single file addition to the contrib directory) to this message. It is very simple to use: load the file, and then M-x ox-synctex-activate. Now every time you export latex to a pdf, the code will patch the resultant synctex file so you can jump from a pdf viewer to the (approximate) org source line that generated it. The hooks and advice can all be removed with M-x ox-synctex-deactivate. Aaron PS Note that you must do the latex compilation within org (C-c C-e l p); you can’t export the .tex file and compile it from the command line. From 43d4bc0ee82874d4389dd7ead7fccd3c81c68418 Mon Sep 17 00:00:00 2001 From: Aaron Ecay aarone...@gmail.com Date: Wed, 23 Oct 2013 15:29:56 -0400 Subject: [PATCH] add synctex support * contrib/lisp/ox-synctex.el: new file --- contrib/lisp/ox-synctex.el | 252 + 1 file changed, 252 insertions(+) create mode 100644 contrib/lisp/ox-synctex.el diff --git a/contrib/lisp/ox-synctex.el b/contrib/lisp/ox-synctex.el new file mode 100644 index 000..6f04c14 --- /dev/null +++ b/contrib/lisp/ox-synctex.el @@ -0,0 +1,252 @@ +;;; ox-synctex.el --- Synctex functionality for org LaTeX export + +;; Copyright (C) 2013 Aaron Ecay + +;; Author: Aaron Ecay aarone...@gmail.com + +;; This program 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. + +;; This program 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 this program. If not, see http://www.gnu.org/licenses/. + +;;; Commentary: + +;; This code provides synctex support for org mode export to latex. +;; To activate, execute (ox-synctex-activate). To deactivate, +;; (ox-synctex-deactivate) + +;; TODOs: +;; - support multi-file documents through #+include and friends +;; - do something so that clicks on a minted source code block go to +;; the .org file and not the .pyg intermediate +;; - ... + +;;; Code: + + Internal functions and variable + +(defvar ox-synctex--concordance nil + The concordance resulting from the last export operation.) + +(defun ox-synctex--read-concordance (concordance src-line) + Get the output line number from CONCORDANCE for input line SRC-LINE. + ;; TODO: not robust against malformed concordances + (while (and (caadr concordance) + (= (caadr concordance) src-line)) +(setq concordance (cdr concordance))) + (cdar concordance)) + +(defun ox-synctex--propertize-buffer () + Put line-number text properties on a buffer. + +Each line gets a org-line-num-pre property, which is its line +number in the buffer. When export operations change the buffer, +the text property will still reflect the original state of affairs. + (save-restriction +(widen) +(while (= 0 (forward-line 1)) + (put-text-property (point) (point-at-eol) + 'ox-synctex-line-num + (line-number-at-pos) + +(defun ox-synctex--line-number-at-pos (pos) + Return the buffer line number at POS, widening if necessary. + +This function first looks for text properties set by +`ox-synctex--propertize-buffer' which allow it to return an +accurate line number in a buffer copy modified during export. It +falls back to the usual method of calculating line numbers if no +text properties are found. + (or (get-text-property pos 'ox-synctex-line-num) + (save-excursion +(widen) +(line-number-at-pos pos + +(defun ox-synctex--add-line-to-element (element) + Add begin and end line numbers to an element as returned by `org-element'. + (let* ((plist (cadr element)) + (beg (plist-get plist :begin)) + (end (plist-get plist :end))) +(and beg (plist-put plist :begin-line (ox-synctex--line-number-at-pos beg))) +(and end (plist-put plist :end-line (ox-synctex--line-number-at-pos end))) +element)) + + +(defun ox-synctex--propertize-string (data string) + Add line number text properties to STRING, based on DATA. + +The function works by copying the properties added by +`ox-synctex--add-line-to-element' to the string. This will allow +the construction of a concordance from the exported string. + (let ((len (length string))) +(when ( len 1) + (put-text-property 0 1 'org-line-num + (org-element-property :begin-line
Re: [O] Importing from Oddmuse?
On 10/28/13, 2:12 PM, Achim Gratz wrote: Peter Davis writes: # hyperlinks s/\[\[([^]]*)\]\]/[[file:$1.org][$1]]/g; Try this to fix the links maybe: # hyperlinks s/\[\[([^]]*)\]\]/ my $l = $1; $l =~ s: :_:g; [[file:$l.org][$l]]/gex; Excellent! I modified it slightly to keep the spaces in the display string: # hyperlinks s/\[\[([^]]*)\]\]/ my $l = $1; my $orig = $1; $l =~ s: :_:g; [[file:$l.org][$orig]]/gex; Thanks, Achim! -pd -- Peter Davis The Tech Curmudgeon www.techcurmudgeon.com
[O] In buffer setting for Ordered
Hello, I am trying to figure out how to add in-buffer (for all tasks in the file) setting to enforce TODO dependencies. I tried #+PROPERTY: ORDERED t but it did not work. Any thoughts, please? Thanks Joe
Re: [O] In buffer setting for Ordered
Joe M wrote: I am trying to figure out how to add in-buffer (for all tasks in the file) setting to enforce TODO dependencies. I tried #+PROPERTY: ORDERED t but it did not work. Any thoughts, please? Just an idea: did you press C-c C-c on the property line, after adding it? If not, it's not taken into account. Well, reloading the file would do it automatically, so it's only for the first time you add it. Best regards, Seb -- Sebastien Vauban
[O] [RFC] [PATCH] [parser] org-element.el: Handle block parameters
* lisp/org-element.el (org-element-center-block-parser, org-element-quote-block-parser, org-element-special-block-parser, org-element-verse-block-parser): Add :parameters to return value (org-element-center-block-interpreter, org-element-quote-block-interpreter, org-element-special-block-interpreter, org-element-verse-block-interpreter): Interpret :parameters if present * testing/lisp/test-org-element.el (test-org-element/center-block-parser, test-org-element/example-block-parser, test-org-element/quote-block-parser, test-org-element/special-block-parser, test-org-element/special-block-parser, test-org-element/verse-block-parser, test-org-element/center-block-interpreter, test-org-element/quote-block-interpreter, test-org-element/special-block-interpreter, test-org-element/example-block-interpreter, test-org-element/verse-block-interpreter): Update tests to check :parameters This brings the parser in line with the Org Syntax as documented on Worg: http://orgmode.org/worg/dev/org-syntax.html#Greater_Blocks. --- This does not handle paramters for export blocks (#+begin_latex et al.) or comment blocks, but these would be trivial to add if needed. lisp/org-element.el | 49 --- testing/lisp/test-org-element.el | 63 +--- 2 files changed, 92 insertions(+), 20 deletions(-) diff --git a/lisp/org-element.el b/lisp/org-element.el index 254af3c..c9ac9a5 100644 --- a/lisp/org-element.el +++ b/lisp/org-element.el @@ -494,7 +494,7 @@ their value. Return a list whose CAR is `center-block' and CDR is a plist containing `:begin', `:end', `:contents-begin', `:contents-end', -`:post-blank' and `:post-affiliated' keywords. +`:parameters', `:post-blank' and `:post-affiliated' keywords. Assume point is at the beginning of the block. (let ((case-fold-search t)) @@ -505,6 +505,8 @@ Assume point is at the beginning of the block. (let ((block-end-line (match-beginning 0))) (let* ((begin (car affiliated)) (post-affiliated (point)) + (params (progn (looking-at [ \t]*#\\+BEGIN_CENTER\\(?: +\\(.*\\)\\)?) + (match-string 1))) ;; Empty blocks have no contents. (contents-begin (progn (forward-line) (and ( (point) block-end-line) @@ -522,6 +524,7 @@ Assume point is at the beginning of the block. :end end :contents-begin contents-begin :contents-end contents-end + :parameters params :post-blank (count-lines pos-before-blank end) :post-affiliated post-affiliated) (cdr affiliated @@ -529,7 +532,11 @@ Assume point is at the beginning of the block. (defun org-element-center-block-interpreter (center-block contents) Interpret CENTER-BLOCK element as Org syntax. CONTENTS is the contents of the element. - (format #+BEGIN_CENTER\n%s#+END_CENTER contents)) + (format #+BEGIN_CENTER%s\n%s#+END_CENTER + (if (org-element-property :parameters center-block) + (concat (org-element-property :parameters center-block)) +) + contents)) Drawer @@ -1338,7 +1345,7 @@ their value. Return a list whose CAR is `quote-block' and CDR is a plist containing `:begin', `:end', `:contents-begin', `:contents-end', -`:post-blank' and `:post-affiliated' keywords. +`:parameters', `:post-blank' and `:post-affiliated' keywords. Assume point is at the beginning of the block. (let ((case-fold-search t)) @@ -1350,6 +1357,8 @@ Assume point is at the beginning of the block. (save-excursion (let* ((begin (car affiliated)) (post-affiliated (point)) + (params (progn (looking-at [ \t]*#\\+BEGIN_QUOTE\\(?: +\\(.*\\)\\)?) + (match-string 1))) ;; Empty blocks have no contents. (contents-begin (progn (forward-line) (and ( (point) block-end-line) @@ -1367,6 +1376,7 @@ Assume point is at the beginning of the block. :end end :contents-begin contents-begin :contents-end contents-end +:parameters params :post-blank (count-lines pos-before-blank end) :post-affiliated post-affiliated) (cdr affiliated) @@ -1374,7 +1384,11 @@ Assume point is at the beginning of the block. (defun org-element-quote-block-interpreter (quote-block contents) Interpret QUOTE-BLOCK element as Org syntax. CONTENTS is the contents of the element. - (format #+BEGIN_QUOTE\n%s#+END_QUOTE contents)) + (format #+BEGIN_QUOTE%s\n%s#+END_QUOTE + (if (org-element-property :parameters quote-block) + (concat (org-element-property
Re: [O] [PATCH] Longtable continuation strings customizable
Nicolas Goaziou n.goaz...@gmail.com writes: Am I missing something? An example filter? (defun my-personal-table-continuation-strings (row backend info) (when (org-export-derived-backend-p 'latex) (replace-regexp-in-string multicolumn{[0-9]+}{l}{\\(.*\\)} String 1 (replace-regexp-in-string multicolumn{[0-9]+}{r}{\\(.*\\)} String 2 row nil nil 1) nil nil 1))) (add-to-list 'org-export-filter-table-row-functions 'my-personal-table-continuation-strings) Untested. Thanks! Tom -- Thomas S. Dye http://www.tsdye.com
Re: [O] [bug] [babel] babel corrupts undo history
Hi Sam, I am sorry for the late reply. It seems I forgot to apply the patch I originally sent. I have just done so. It seems like what you are talking about below is a different problem, though. The ‘org-src-in-org-buffer’ macro is only called when saving or tangling, not when invoking ‘org-edit-special’ (C-c '). And at least in a quick test, I do not see any buffer corruption when saving (C-c ' C-x C-c '). Do you? Thanks, -- Aaron Ecay
Re: [O] Importing from Oddmuse?
Peter Davis writes: Excellent! I modified it slightly to keep the spaces in the display string: This is better, I'd think: # hyperlinks s/\[\[([^]]*)\]\]/ my $l = $1; $l =~ s: :_:g; [[file:$l.org][$1]]/gex; Regards, Achim. -- +[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]+ Wavetables for the Waldorf Blofeld: http://Synth.Stromeko.net/Downloads.html#BlofeldUserWavetables
Re: [O] Importing from Oddmuse?
On 10/28/13, 3:18 PM, Achim Gratz wrote: Peter Davis writes: Excellent! I modified it slightly to keep the spaces in the display string: This is better, I'd think: # hyperlinks s/\[\[([^]]*)\]\]/ my $l = $1; $l =~ s: :_:g; [[file:$l.org][$1]]/gex; That was the first thing I tried, and Perl complained about an undefined variable. I may have made a typo though. Thanks! Cheers, -pd -- Peter Davis The Tech Curmudgeon www.techcurmudgeon.com
Re: [O] [PATCH] fix org-insert-todo-heading-respect-content in plain list item
Hi Nicolas, sure: emacs -q -nw, and in the scratch buffer (add-to-list 'load-path ~/src/org-mode/lisp/) ;refer to HEAD as of yesterday (org-mode) ;and enter/paste: * test - an -!- item - another one Then, with the cursor at -!- (for example), hitting C-S-return breaks the line, while it /should/ create a todo heading after the subtree. Replacing the t with '(4) (which is what org-todo-heading comapres with) fixes this. HTH, regards, Ingo On Mon, Oct 28 2013 09:43 (+0100), Nicolas Goaziou wrote: Hello, Ingo Lohmar i.loh...@gmail.com writes: please find attached a 1-4-char patch fixing the behavior of the above function when inside a plain list. [...] Subject: [PATCH] fix org-insert-todo-heading-respect-content in plain list item * lisp/org.el (org-insert-todo-heading-respect-content): pass correct prefix arg to always insert heading TINYCHANGE This function used a second argument t, which is eventually passed to org-insert-heading, adding a list item when inside a plain list. Use the proper argument '(4) now, to always create a heading, just like the function's name and documentation imply. Thank you for your patch. Could you provide a test case, because, after a quick test, I do not see any difference before and after applying your patch. Regards, -- Nicolas Goaziou
Re: [O] [bug] [babel] babel corrupts undo history
Hi Aaron, Below? If you mean my fix, I don't know why it worked and cannot investigate it. Samuel On 10/28/13, Aaron Ecay aarone...@gmail.com wrote: Hi Sam, I am sorry for the late reply. It seems I forgot to apply the patch I originally sent. I have just done so. It seems like what you are talking about below is a different problem, though. The ‘org-src-in-org-buffer’ macro is only called when saving or tangling, not when invoking ‘org-edit-special’ (C-c '). And at least in a quick test, I do not see any buffer corruption when saving (C-c ' C-x C-c '). Do you? Thanks, -- Aaron Ecay -- The Kafka Pandemic: http://thekafkapandemic.blogspot.com The disease DOES progress. MANY people have died from it. ANYBODY can get it. Denmark: free Karina Hansen NOW.
Re: [O] [bug] [babel] babel corrupts undo history
2013ko urriak 28an, Samuel Wales-ek idatzi zuen: Hi Aaron, Below? If you mean my fix, I don't know why it worked and cannot investigate it. Samuel Argh, I must have mistakenly deleted the quoted text from my reply; I did mean the suggestion to comment out the line (setq buffer-undo-list ul) But since my original patch worked for you (?), all should be fine now. -- Aaron Ecay
Re: [O] how to handle svg files when exporting orgmode to html and pdf?
Thomas, Suvayu, Aaron, Nick, Eric, Carsten, Phil, et al, Hi again! Can I re-open this thread to discuss two new issues I now experience with emacs 24.3.1 and orgmode version 8.2.1 in the handling of svg = tex = pdf ? Here goes: 1) If the plot has text in it which contains a percent character (%), then we fail due to https://bugs.launchpad.net/inkscape/+bug/857231 2) If the :file is in a sub-directory (for example, `:file fig/mtcars.svg`), even though both ./fig/mtcars.pdf_tex and ./fig/mtcars.pdf are created, the reference to the .pdf in the .pdf_tex is not interpreted relative to the subdirectory, but rather to the parent, and so the .pdf is not found. The workaround for (1) is to not use '%' as a label on my plots. The workaround for (2) is to not put my figures in a './fig/' subdirectory. I suppose the fix for (1) is to get the inkscape export 'fixed' to (optionally) escape the labels, and to take the option. Thoughts? I suppose the fix for (2) is somewhere in the org code. Any takers? Or, any other fixes suggested? Thanks! Malcolm -Original Message- From: emacs-orgmode-bounces+mec=stowers@gnu.org [mailto:emacs-orgmode-bounces+mec=stowers@gnu.org] On Behalf Of Cook, Malcolm Sent: Friday, August 09, 2013 4:01 PM To: 'Malcolm Cook'; 'emacs-orgmode@gnu.org'; 'Nick Dokos'; 'Suvayu Ali'; 'Eric Schulte'; 'Vincent Beffara'; 'Thomas S. Dye'; 'phil...@cern.ch'; 'Charles Berry'; 'Aaron Ecay' Subject: Re: [O] how to handle svg files when exporting orgmode to html and pdf? Thomas, Suvayu, Aaron, Nick, Eric, Carsten, Phil, et al, Thanks for all your help. I am now satisfied with approach for exporting images to inline html and inline latex=pdf. In my hands, the following code block will produce in-line images in html and be included in exported pdf. #+LATEX_HEADER: \usepackage{svg} #+begin_src R :results graphics output :exports both :file mtcars.svg with(mtcars,plot(wt, mpg)) #+end_src I am using: Emacs 24.3.1 Suvayus orgmode export filter: (defun my-svg-graphics (contents backend info) (when (eq backend 'latex) (replace-regexp-in-string \\`includegraphics.+\\({.+\.svg}\\) includesvg\1 contents)) ) (add-to-list 'org-export-filter-link-functions 'my-svg-graphics) * svg latex package v1.0 2004/11/05 * customize the emacs variable `org-latex-pdf-process` to include '--shell-escape' (following advice in http://orgmode.org/worg/org-dependencies.html, which outlines some other options) * customize org-export-html-inline-image-extensions to include svg * upgrade to inkscape version 0.48.+ (which is more recent than our centOS repos proffered, but, hey) since the --export-latex switch that svg.sty depends upon is not implemented till this version * upgrade org-mode version 8.0.7-377 built from git pull yesterday I think I've covered all the pieces. I have not explored how/whether any options passed to includegraphics are interpreted by includesvg. Now, if I could get .svg images to display inline in my emacs buffer. The following is not respected, at least in my hands. '(org-export-latex-inline-image-extensions (quote (pdf jpeg jpg png ps eps svg))) Any takers? ~ Malcolm -Original Message- From: emacs-orgmode-bounces+mec=stowers@gnu.org [mailto:emacs-orgmode-bounces+mec=stowers@gnu.org] On Behalf Of Malcolm Cook Sent: Thursday, August 08, 2013 9:05 PM To: Malcolm Cook; emacs-orgmode@gnu.org; Nick Dokos Subject: Re: [O] how to handle svg files when exporting orgmode to html and pdf? Aaron, Thanks for staying with me on this. I'm not sure what you're suggesting. Nonetheless, I just updated org from `git clone git://orgmode.org/org-mode.git` So, now I'm got org-version release_8.0.7-377-gef2d47.dirty. Are you suggesting that with this patch.svg created with exporting graphics :file should now display in the emacs buffer when I toggle display of inline images? I wish they would. They do not, despite my adding svg to org-export-latex-inline-image-extensions. Are you suggesting that such a .svg created by org code block would be appear in the pdf created when I export to latex - pdf? I wish that also... that's what I've been trying to accomplish. Thanks!, Malcolm PS - I see you are/were in PA in linguistics. My first job after my masters in AI from U Mass was at CMU's psych dept as a lisp programmer for John Anderson's intelligent tutoring systems. I then went on in computational linguistics a bit, working on a marcus parser based natural language processing system at wang labs. Ages ago. Now I'm in computational biology. The one commonality through it all? Emacs! -- Malcolm Cook h - 913.642.5257 c - 913.226.1542 w - 816.926.4449 On Thu, Aug 8, 2013 at 4:34 PM, Aaron Ecay aarone...@gmail.com wrote: Hi
Re: [O] how to handle svg files when exporting orgmode to html and pdf?
Hi Malcom, 2013ko urriak 28an, Cook, Malcolm-ek idatzi zuen: Thomas, Suvayu, Aaron, Nick, Eric, Carsten, Phil, et al, Hi again! Can I re-open this thread to discuss two new issues I now experience with emacs 24.3.1 and orgmode version 8.2.1 in the handling of svg = tex = pdf ? Here goes: 1) If the plot has text in it which contains a percent character (%), then we fail due to https://bugs.launchpad.net/inkscape/+bug/857231 It sounds from https://bugs.launchpad.net/inkscape/+bug/719320/comments/3 as though inkscape makes a deliberate effort to support LaTeX markup in their pdf+latex output. So it’s not surprising that % is a problem. It’s unfortunate from the perspective of having a single SVG file that works in both HTML and LaTeX, but I don’t know if that is an argument that will cut ice with them. I don’t know what org can/should do to patch around inkscape’s design decisions. Certainly the svg LaTeX package could be patched to use inkscape’s pdf export, instead of the pdf+latex one. This would lose the nice fonts that running the text through latex nets you, but get rid of the % annoyances. 2) If the :file is in a sub-directory (for example, `:file fig/mtcars.svg`), even though both ./fig/mtcars.pdf_tex and ./fig/mtcars.pdf are created, the reference to the .pdf in the .pdf_tex is not interpreted relative to the subdirectory, but rather to the parent, and so the .pdf is not found. Have you looked at the \graphicspath macro from the graphics package? http://www.tex.ac.uk/cgi-bin/texfaq2html?label=graphicspath. You may be able to get things to work by adding \graphicspath{{fig/}} (note the double braces) to your document. \setsvg{svgpath=fig/} from the svg package may also/additionally be needed. Aaron PS Maybe org should be generating the \includesvg command relative to the graphicspath or svgpath – I’m not sure. But let us know if setting those variables works at all, and if so we can think about adding support to org. -- Aaron Ecay
Re: [O] Confused about org-index, org-favtable, org-reftabel, org-refer-by-number
Hi Michael, thanx for the good words about org-index ! And yes all those packages are earlier Versions of org-index :-/ However, I did not try to cover my traces that way, but rather tried to find a name, that at first glimpse gives an idea of this packages purpose ... Now, org-index is a good fit, I think and I will not change its name again. Regarding your upgrade path, I think you can easily switch from org-favtable to org-index, only that you should rename org-favtable-id into org-index-id within your .emacs As far as I can deduce from the version history which is contained in org-index.el, you do not need to convert your index-table; it will work unchanged with org-index. (please tell me, if there are unexpected problems !) Finally as for the piled up confusion of having several packages with different names. I need help from the org-mode elders in cleaning this up, because I do not have commit-bit for org, only for worg. What should be done is this: The only package that should be retained is org-index.el all others (org-reftable.el, org-favtable.el and org-refer-by-number.el) can simply be removed in favour of org-index.el, the latest version of which resides in worg. Now, if the last paragraph passes unnoticed for some days, I will send out a note directly to someone, asking to help me clean up :-) Thanx for your feedback and best regards ! Marc Am 28.10.2013 12:15, schrieb Michael Strey: Hello, I'm using org-reftable.el [1] from the contrib path of the Git repository since several months. It is a useful addition to integrate my personal archive of notes, data sheets, and pages that I tore out of journals into Org Mode documents. Now that I wanted to refine this system, I stumbled across the other packages mentioned in the subject. It seems that they are all revisions of the same project from Marc Ihm. IIUC, org-index.el is the newest version that was preceded by org-favtable.el, org-reftable.el, and org-refer-by-number.el. Currently we have org-favtable.el and org-reftable.el in the contrib path whilst org-index.el is only available via Worg [2]. Marc, could you please clarify this confusion? Anyway, thank you for sharing this add-on! Best regards Michael Strey Footnotes: [1] http://orgmode.org/worg/code/elisp/org-reftable.el [2] http://orgmode.org/worg/code/elisp/org-index.el
[O] [PATCH 2/3] Mark some org-babel variables as safe locals under proper conditions
* lisp/ob-core.el (org-babel-inline-result-wrap, org-babel-default-header-args, org-babel-default-inline-header-args): mark as safe local variables --- lisp/ob-core.el | 31 +++ 1 file changed, 31 insertions(+) diff --git a/lisp/ob-core.el b/lisp/ob-core.el index 8fafd4b..60666fc 100644 --- a/lisp/ob-core.el +++ b/lisp/ob-core.el @@ -158,6 +158,11 @@ See also `org-babel-noweb-wrap-start'. This string must include a \%s\ which will be replaced by the results. :group 'org-babel :type 'string) +(put 'org-babel-inline-result-wrap + 'safe-local-variable + (lambda (value) + (and (stringp value) + (string-match-p %s value (defun org-babel-noweb-wrap (optional regexp) (concat org-babel-noweb-wrap-start @@ -484,10 +489,14 @@ specific header arguments as well.) '((:session . none) (:results . replace) (:exports . code) (:cache . no) (:noweb . no) (:hlines . no) (:tangle . no)) Default arguments to use when evaluating a source block.) +(put 'org-babel-default-header-args 'safe-local-variable + #'org-babel-default-header-args-safe-p) (defvar org-babel-default-inline-header-args '((:session . none) (:results . replace) (:exports . results)) Default arguments to use when evaluating an inline source block.) +(put 'org-babel-default-inline-header-args 'safe-local-variable + #'org-babel-default-header-args-safe-p) (defvar org-babel-data-names '(tblname results name)) @@ -2785,6 +2794,28 @@ of `org-babel-temporary-directory'. (add-hook 'kill-emacs-hook 'org-babel-remove-temporary-directory) +(defun org-babel-one-header-arg-safe-p (pair) + (or + (memq (car pair) '(:cache :colnames :comments +:exports :epilogue +:hlines :noeval +:noweb :noweb-ref +:noweb-sep :padline +:prologue :rownames +:sep :session :tangle +:wrap)) + (and (eq (car pair) :eval) +(member (cdr pair) '(never query))) + (and (eq (car pair) :results) +(not (string-match file (cdr pair)) + +(defun org-babel-default-header-args-safe-p (value) + (and (listp value) + (and (mapcar (lambda (pair) + (and (consp pair) + (org-babel-one-header-arg-safe-p pair))) + value + (provide 'ob-core) ;; Local variables: -- 1.8.4.1
[O] [PATCH 1/3] Mark ox-latex variables safe locals under proper conditions
* lisp/ox-latex.el (org-latex-with-hyperref, org-latex-default-table-mode, org-latex-tables-booktabs, org-latex-tables-centered, org-latex-table-caption-above, org-latex-listings): add safe local variable properties --- lisp/ox-latex.el | 18 -- 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el index b0cc4bb..235d092 100644 --- a/lisp/ox-latex.el +++ b/lisp/ox-latex.el @@ -343,7 +343,8 @@ the toc:nil option, not to those generated with #+TOC keyword. (defcustom org-latex-with-hyperref t Toggle insertion of \\hypersetup{...} in the preamble. :group 'org-export-latex - :type 'boolean) + :type 'boolean + :safe #'booleanp) Headline @@ -488,12 +489,14 @@ When modifying this variable, it may be useful to change :type '(choice (const :tag Table table) (const :tag Matrix math) (const :tag Inline matrix inline-math) -(const :tag Verbatim verbatim))) +(const :tag Verbatim verbatim)) + :safe (lambda (s) (memq s '(table math inline-math verbatim (defcustom org-latex-tables-centered t When non-nil, tables are exported in a center environment. :group 'org-export-latex - :type 'boolean) + :type 'boolean + :safe #'booleanp) (defcustom org-latex-tables-booktabs nil When non-nil, display tables in a formal \booktabs\ style. @@ -504,13 +507,15 @@ attributes. :group 'org-export-latex :version 24.4 :package-version '(Org . 8.0) - :type 'boolean) + :type 'boolean + :safe #'booleanp) (defcustom org-latex-table-caption-above t When non-nil, place caption string at the beginning of the table. Otherwise, place it near the end. :group 'org-export-latex - :type 'boolean) + :type 'boolean + :safe #'booleanp) (defcustom org-latex-table-scientific-notation %s\\,(%s) Format string to display numbers in scientific notation. @@ -670,7 +675,8 @@ into previewing problems, please consult :type '(choice (const :tag Use listings t) (const :tag Use minted 'minted) - (const :tag Export verbatim nil))) + (const :tag Export verbatim nil)) + :safe (lambda (s) (memq s '(t nil minted (defcustom org-latex-listings-langs '((emacs-lisp Lisp) (lisp Lisp) (clojure Lisp) -- 1.8.4.1
[O] [PATCH 3/3] mark o-b-default-header-args:R as a safe local under proper conditions
* lisp/ob-R.el (org-babel-default-header-args:R): mark as a safe local variable --- lisp/ob-R.el | 16 1 file changed, 16 insertions(+) diff --git a/lisp/ob-R.el b/lisp/ob-R.el index 74d7513..2086622 100644 --- a/lisp/ob-R.el +++ b/lisp/ob-R.el @@ -66,6 +66,22 @@ R-specific header arguments.) (defvar org-babel-default-header-args:R '()) +(put 'org-babel-default-header-args:R 'safe-local-variable + (lambda (value) + (and (listp value) + (and (mapcar + (lambda (pair) + (and (consp pair) +(or (org-babel-one-header-arg-safe-p pair) +(memq (car pair) + '(:width :height :bg + :units :pointsize :antialias + :quality :compression :res + :type :family :title :fonts + :version :paper :encoding + :pagecentre :colormodel + :useDingbats :horizontal) + value) (defcustom org-babel-R-command R --slave --no-save Name of command to use for executing R code. -- 1.8.4.1
Re: [O] Importing from Oddmuse?
On Mon, Oct 28, 2013 at 4:26 PM, Achim Gratz strom...@nexgo.de wrote: Peter Davis writes: That was the first thing I tried, and Perl complained about an undefined variable. I may have made a typo though. Nope, my error. $1 gets clobbered by the second replacement. So you'd want what you wrote or somewhat shorter: # hyperlinks s/\[\[([^]]*)\]\]/ my ($l, $o) = ($1, $1); $l =~ s: :_:g; [[file:$l.org][$o]]/gex; Yes, that works beautifully, and is nice and concise. Thank you! -pd -- The Tech Curmudgeon http://www.techcurmudgeon.com
[O] Org-Mode newbie, configuration?
Hello, I am a newbie to Org-mode and am wondering if anyone would be kind enough to share your org-mode configuration. Thanks Joe
Re: [O] Importing from Oddmuse?
Peter Davis writes: That was the first thing I tried, and Perl complained about an undefined variable. I may have made a typo though. Nope, my error. $1 gets clobbered by the second replacement. So you'd want what you wrote or somewhat shorter: # hyperlinks s/\[\[([^]]*)\]\]/ my ($l, $o) = ($1, $1); $l =~ s: :_:g; [[file:$l.org][$o]]/gex; Regards, Achim. -- +[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]+ Factory and User Sound Singles for Waldorf rackAttack: http://Synth.Stromeko.net/Downloads.html#WaldorfSounds
[O] [PATCH 0/3] Safe local variable declarations
In http://mid.gmane.org/CANtbJLFJ84FixMJr_4BAC=ixrpqozm44dfxaak6z1fbtbrq...@mail.gmail.com, Klaus-Dieter pointed out that many export variables are not marked as safe locals, which makes it annoying to use them as file-local variables, especially in collaborative situations. Here are 3 patches that make a start at marking some variables safe, when they are in fact safe. With respect to the LaTeX export variables specifically, there are many string variables that inject LaTeX code into the output (`org-latex-active-timestamp-format', to give just one example). Currently the patch takes a conservative approach, not touching these variables. LaTeX code can run arbitrary shell commands, *only if* the user passes a command line flag to latex to explicitly enable that functionality. I think a decision has to be made about whether to allow these string variables to be marked as safe. There are two failsafes (the default-unsafe nature of these variables and the LaTeX command line switch); marking the variables as safe would remove one of them. But it would also lower the barrier to collaborating on reproducible documents significantly, I think. Obviously, if people like this approach the other export backends and org-babel languages should be gone through and have safe variable predicates added to them. Aaron Ecay (3): Mark ox-latex variables safe locals under proper conditions Mark some org-babel variables as safe locals under proper conditions mark o-b-default-header-args:R as a safe local under proper conditions lisp/ob-R.el | 16 lisp/ob-core.el | 31 +++ lisp/ox-latex.el | 18 -- 3 files changed, 59 insertions(+), 6 deletions(-) -- 1.8.4.1
Re: [O] Org-Mode newbie, configuration?
Hello Joe, Welcome to the Org mode community. On Mon, Oct 28, 2013 at 03:35:43PM -0500, Joe M wrote: Hello, I am a newbie to Org-mode and am wondering if anyone would be kind enough to share your org-mode configuration. I would suggest you look at articles on Worg instead. This is a good place to start: http://orgmode.org/worg/org-configs/org-customization-guide.html http://orgmode.org/worg/org-configs/index.html I would suggest don't try to go through everything. Just start using, and change things as you need it. Org is a big project. If you think I'll customise everything to my taste before starting, you will never get started. Skim the manual, if you find something that you would like to use, read that in detail, and start using. Hope this helps, -- Suvayu Open source is the future. It sets us free.
Re: [O] [bug] [babel] babel corrupts undo history
Hi Aaron, I think, but not sure, that: - your original patch had the right idea, and i think it improved it, but did not fix it - my tiny fix seemed to fix it, but i did not test enough - i avoid the bug rather than carrying along my patch or yours - my impression is that the bug was due to unnecessary undo fanciness - there might have been a patch that made it into the repo? Samuel On 10/28/13, Aaron Ecay aarone...@gmail.com wrote: 2013ko urriak 28an, Samuel Wales-ek idatzi zuen: Hi Aaron, Below? If you mean my fix, I don't know why it worked and cannot investigate it. Samuel Argh, I must have mistakenly deleted the quoted text from my reply; I did mean the suggestion to comment out the line (setq buffer-undo-list ul) But since my original patch worked for you (?), all should be fine now. -- Aaron Ecay -- The Kafka Pandemic: http://thekafkapandemic.blogspot.com The disease DOES progress. MANY people have died from it. ANYBODY can get it. Denmark: free Karina Hansen NOW.
[O] [PATCH] make comment-dwim in source code blocks more DWIM-ish
* lisp/org.el (org-insert-comment, org-comment-or-uncomment-region): use the relevant language’s major mode comment function if called from within a source block. This patch makes it easier to (un)comment lines of babel source. Now M-; in a soucre code block should Just Work. The modification to ‘org-insert-comment’ also fixes a bug, whereby the function would eat blank lines after it. The first block, where ! is the point, would lead to the second instead of the third: #+name: orig #+begin_src org xxx ! yy #+end_src #+name: bad #+begin_src org xxx # yy #+end_src #+name: desired #+begin_src org xxx # yy #+end_src Also, the ‘org-comment-or-uncomment-region’ change results in an undesirably move of the point after the comment is created. This is because ‘comment-region’ wraps the call to ‘comment-region-function’ in a ‘save-excursion’. The org mode code deletes and reinserts the whole babel block, which confuses save-excursion. Org carefully puts the point back in the proper place, but comment-region’s save-excursion then substitutes its own erroneous placement. --- lisp/org.el | 126 +++- 1 file changed, 74 insertions(+), 52 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 43172c8..4aeeada 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -22478,64 +22478,86 @@ non-nil. (defun org-insert-comment () Insert an empty comment above current line. If the line is empty, insert comment at its beginning. - (beginning-of-line) - (if (looking-at \\s-*$) (replace-match ) (open-line 1)) - (org-indent-line) - (insert # )) + (if (org-in-src-block-p t) + (progn + (require 'ob-core) + (org-babel-do-in-edit-buffer +(call-interactively #'comment-dwim))) +(beginning-of-line) +(if (looking-at \\s-*$) + (delete-region (point) (point-at-eol)) + (open-line 1)) +(org-indent-line) +(insert # ))) (defvar comment-empty-lines) ; From newcomment.el. (defun org-comment-or-uncomment-region (beg end rest ignore) Comment or uncomment each non-blank line in the region. Uncomment each non-blank line between BEG and END if it only contains commented lines. Otherwise, comment them. - (save-restriction -;; Restrict region -(narrow-to-region (save-excursion (goto-char beg) - (skip-chars-forward \r\t\n end) - (line-beginning-position)) - (save-excursion (goto-char end) - (skip-chars-backward \r\t\n beg) - (line-end-position))) -(let ((uncommentp - ;; UNCOMMENTP is non-nil when every non blank line between - ;; BEG and END is a comment. - (save-excursion -(goto-char (point-min)) -(while (and (not (eobp)) -(let ((element (org-element-at-point))) - (and (eq (org-element-type element) 'comment) - (goto-char (min (point-max) - (org-element-property -:end element))) -(eobp - (if uncommentp - ;; Only blank lines and comments in region: uncomment it. - (save-excursion - (goto-char (point-min)) - (while (not (eobp)) - (when (looking-at [ \t]*\\(#\\(?: \\|$\\)\\)) - (replace-match nil nil nil 1)) - (forward-line))) - ;; Comment each line in region. - (let ((min-indent (point-max))) - ;; First find the minimum indentation across all lines. - (save-excursion - (goto-char (point-min)) - (while (and (not (eobp)) (not (zerop min-indent))) - (unless (looking-at [ \t]*$) - (setq min-indent (min min-indent (current-indentation - (forward-line))) - ;; Then loop over all lines. - (save-excursion - (goto-char (point-min)) - (while (not (eobp)) - (unless (and (not comment-empty-lines) (looking-at [ \t]*$)) - ;; Don't get fooled by invisible text (e.g. link path) - ;; when moving to column MIN-INDENT. - (let ((buffer-invisibility-spec nil)) - (org-move-to-column min-indent t)) - (insert comment-start)) - (forward-line + (let* ((pt (point-marker)) +(head (and (org-in-src-block-p t) + (require 'ob-core) + (org-babel-where-is-src-block-head))) +(foot (and head + (save-excursion + (goto-char head) + (looking-at org-babel-src-block-regexp) + (goto-char (match-end 0)) + (point-at-bol) +(if (and head foot
[O] [PATCH 2/2] babel: don’t add babel eval to the session’s comint input ring
* lisp/ob-comint.el (org-babel-comint-in-buffer): don’t add to comint-input-ring Previously, babel code would be added to the comint input ring of a babel session, making interactive use of the session difficult: one had to page through the babel generated commands when browsing the comint history with M-p/M-n. The session repl’s history should just contain commands the user has specifically entered in the repl buffer, and not those which are fed in from org mode. So, we bind ‘comint-input-filter’ to a function that always returns nil in the ‘org-babel-comint-in-buffer’ macro, to avoid any additions to the input ring while executing code from babel. --- lisp/ob-comint.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/ob-comint.el b/lisp/ob-comint.el index 4e2b352..1f28a2c 100644 --- a/lisp/ob-comint.el +++ b/lisp/ob-comint.el @@ -53,7 +53,8 @@ executed inside the protection of `save-excursion' and (error Buffer %s does not exist or has no process ,buffer)) (save-match-data (with-current-buffer ,buffer -,@body +(let ((comint-input-filter (lambda (input) nil))) + ,@body) (def-edebug-spec org-babel-comint-in-buffer (form body)) (defmacro org-babel-comint-with-output (meta rest body) -- 1.8.4.1
[O] [PATCH 1/2] clean up two macros in ob-comint
* lisp/ob-comint.el (org-babel-comint-with-output, org-babel-comint-in-buffer): clean up code. This patch replaces some deeply nested ca/dr calls with ‘nth’, and replaces a setq/unwind-protect/setq incantation with a simple let binding. Finally, it also restructures ’org-babel-comint-in-buffer’ to not needlessly save/restore match and excursion data if the buffer process is not live, and to use with-current-buffer instead of save-excursion+set-buffer (info (elisp) Excursions) --- lisp/ob-comint.el | 84 ++- 1 file changed, 40 insertions(+), 44 deletions(-) diff --git a/lisp/ob-comint.el b/lisp/ob-comint.el index 8b03e2d..4e2b352 100644 --- a/lisp/ob-comint.el +++ b/lisp/ob-comint.el @@ -48,12 +48,12 @@ BUFFER is checked with `org-babel-comint-buffer-livep'. BODY is executed inside the protection of `save-excursion' and `save-match-data'. (declare (indent 1)) - `(save-excursion + `(progn + (unless (org-babel-comint-buffer-livep ,buffer) + (error Buffer %s does not exist or has no process ,buffer)) (save-match-data - (unless (org-babel-comint-buffer-livep ,buffer) - (error Buffer %s does not exist or has no process ,buffer)) - (set-buffer ,buffer) - ,@body))) + (with-current-buffer ,buffer +,@body (def-edebug-spec org-babel-comint-in-buffer (form body)) (defmacro org-babel-comint-with-output (meta rest body) @@ -69,46 +69,42 @@ elements are optional. This macro ensures that the filter is removed in case of an error or user `keyboard-quit' during execution of body. (declare (indent 1)) - (let ((buffer (car meta)) - (eoe-indicator (cadr meta)) - (remove-echo (cadr (cdr meta))) - (full-body (cadr (cdr (cdr meta) + (let ((buffer (nth 0 meta)) + (eoe-indicator (nth 1 meta)) + (remove-echo (nth 2 meta)) + (full-body (nth 3 meta))) `(org-babel-comint-in-buffer ,buffer - (let ((string-buffer ) dangling-text raw) -;; setup filter -(setq comint-output-filter-functions - (cons (lambda (text) (setq string-buffer (concat string-buffer text))) -comint-output-filter-functions)) -(unwind-protect -(progn - ;; got located, and save dangling text - (goto-char (process-mark (get-buffer-process (current-buffer - (let ((start (point)) -(end (point-max))) -(setq dangling-text (buffer-substring start end)) -(delete-region start end)) - ;; pass FULL-BODY to process - ,@body - ;; wait for end-of-evaluation indicator - (while (progn - (goto-char comint-last-input-end) - (not (save-excursion - (and (re-search-forward -(regexp-quote ,eoe-indicator) nil t) - (re-search-forward -comint-prompt-regexp nil t) -(accept-process-output (get-buffer-process (current-buffer))) -;; thought the following this would allow async -;; background running, but I was wrong... -;; (run-with-timer .5 .5 'accept-process-output -;; (get-buffer-process (current-buffer))) -) - ;; replace cut dangling text - (goto-char (process-mark (get-buffer-process (current-buffer - (insert dangling-text)) - ;; remove filter - (setq comint-output-filter-functions -(cdr comint-output-filter-functions))) + (let ((string-buffer ) +(comint-output-filter-functions + (cons (lambda (text) (setq string-buffer (concat string-buffer text))) + comint-output-filter-functions)) +dangling-text raw) +;; got located, and save dangling text +(goto-char (process-mark (get-buffer-process (current-buffer +(let ((start (point)) + (end (point-max))) + (setq dangling-text (buffer-substring start end)) + (delete-region start end)) +;; pass FULL-BODY to process +,@body +;; wait for end-of-evaluation indicator +(while (progn + (goto-char comint-last-input-end) + (not (save-excursion +(and (re-search-forward + (regexp-quote ,eoe-indicator) nil t) + (re-search-forward + comint-prompt-regexp nil t) + (accept-process-output (get-buffer-process (current-buffer))) + ;; thought the following this would allow async + ;; background running, but I was wrong... + ;; (run-with-timer .5 .5 'accept-process-output + ;;
[O] org-agenda moves point in all org agenda buffers
Point is moved to beginning of buffer in every agenda file when I run the agenda. emacs -Q with a minimal test case and (setq org-agenda-window-setup 'current-window) has the bug. Same thing without it does not. Thanks. Samuel
[O] table export-as-html from a simple list
Emacs 24.3 org-mode 7.8.11 I am trying to export org file into html, and the result html needs to show a table rather than a list. I understand that |-+-| | | | | | | would export itself into a table. But this form of contents is not easy to read and edit, though it might be my personal preference. I prefer, * - - style. Is there anyway to export the org list into an html table? soichi
[O] Temp files are not deleted after beamer export with source code blocks
I've set org-latex-listings to Use listings (not minted), and then run this minimal example. #+BIND: org-latex-listings-options ((basicstyle \\ttfamily) (captionpos b) (tabsize 3)) #+LANGUAGE: en #+OPTIONS: H:1 num:t toc:nil \n:nil @:t ::t |:t ^:t -:t f:t *:t :t ':t #+EXPORT_SELECT_TAGS: export #+EXPORT_EXCLUDE_TAGS: noexport #+startup: beamer #+LaTeX_CLASS: beamer #+LaTeX_CLASS_OPTIONS: [presentation] #+BEAMER_THEME: default #+COLUMNS: %45ITEM %10BEAMER_env(Env) %10BEAMER_act(Act) %4BEAMER_col(Col) %8BEAMER_opt(Opt) #+PROPERTY: BEAMER_col_ALL 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 0.0 :ETC #+LATEX_HEADER: \usepackage{listings} #+TITLE: Test #+AUTHOR:hjh * A frame ** You can write some code like this. #+begin_src {} -i :exports code some code here #+end_src Now there is a file beamer-listings-2.vrb containing the LaTeX code for the second frame. This file never gets deleted. As I'm developing the presentation, chances are that frame will end up becoming a different frame number, so I keep getting more and more vrb files on disk. Shouldn't org clean these up after LaTeX is finished? It already cleans up other temporary LaTeX files. hjh