[O] [babel] Code for simple set-operations on two tables. Asking for some input.
Hello, Please find attached the elisp-file and a tutorial (as an org-file) for org-babel-table-proc. It provides some simple set-operations (mostly merge and intersect), which treat org-mode tables as sets. An example for merging two tables would be: #+name: lower | 2 | b | | 4 | d | | 5 | e | | 6 | h | #+name: upper | 1 | A | | 3 | C | | 4 | D | | 10 | J | | 2 | B | #+begin_src emacs-lisp :var t1=lower :var t2=upper (babel-table-proc-merge t1 t2) #+end_src #+results: | 1 | | A | | 2 | b | B | | 3 | | C | | 4 | d | D | | 5 | e | | | 6 | h | | | 10 | | J | which merges the two input tables lower and upper into a single table, even, if they do not have all keys (from the first column) in common. In general this merges information from two different sources without loosing anything. The package org-babel-table-proc provides these and a few other operations, but definitely still needs some debugging and polishing. However, before finishing this work, I would like to ask, if something like this is already present in babel or the library of babel ? Also, I am not sure, which prefix to use for packages and functions; is org-babel-table-proc the right name or can it be shortened to ob-table-proc. Any input would be very welcome ! With kind regards, Marc-Oliver Ihm ;;; org-babel-table-proc.el --- Common operations on tables for use with orgmode and lob ;; Copyright (C) 2010-2011 ;; Free Software Foundation, Inc. ;; Author: Marc-Oliver Ihm ;; Keywords: tables library of babel orgmode ;; Version: 0.01 ;;; License: ;; 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, 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 GNU Emacs; see the file COPYING. If not, write to the ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ;; Boston, MA 02110-1301, USA. ;;; Commentary: ;; Purpose: ;; ;; Common operations on tables for use with orgmode and lob: ;; - simple set operations (intersection and merge) ;; - filtering one table according to another ;; ;; ;; Setup: ;; ;; (require 'org-babel-table-proc) ;; ;; Further reading: ;; ;; See the file org-babel-table-proc.org for complete examples. ;; ;;; Code: (defun babel-table-proc-keep (t1 t2) Keep only those keys from the second table, that appear within the first (lob-tbl-filter 'keep t1 t2) ) (defun babel-table-proc-remove (t1 t2) Remove those keys from the second table, that appear within the first (lob-tbl-filter 'remove t1 t2) ) (defun lob-tbl-filter (what t1 t2) Internal function to do the work of babel-table-proc-keep and -remove (let (keys result) (setq keys (mapcar 'car t1)) (dolist (line t2) (if (equal (member (car line) keys) (equal what 'keep)) (setq result (cons line result)) ) ) (nreverse result) ) ) (defun babel-table-proc-merge (rest tables) Merge two tables by first column; sort the result (babel-table-proc-two-tables-to-one 'merge tables)) (defun babel-table-proc-intersect (rest tables) Intersect two tables by first column; sort the result (babel-table-proc-two-tables-to-one 'intersect tables)) (defun babel-table-proc-two-tables-to-one (what tables) Internal function to do the work of babel-table-proc-merge and -intersect (let (is-all-numbers less-than-function equal-function conversion-function format-specifier rests-of-tables rest-of-rests-of-tables rest-of-table widths-of-tables current-key current-key-in-intersection result-table result-line i) ;; Find out, if all keys in all tables are numbers or if there are strings among them (setq is-all-numbers (catch 'not-a-number (dolist (table tables) (dolist (line table) (unless (numberp (car line)) (throw 'not-a-number 'nil 't)) ;; prepare functions to treat table contents in a unified way (setq format-specifier (if is-all-numbers %g %s)) (setq conversion-function (if is-all-numbers (lambda (x) x) (lambda (x) (if (numberp x) (number-to-string x) x)) )) (setq less-than-function (lambda (x y) (if is-all-numbers ( x y) (string (funcall conversion-function x) (funcall conversion-function y) (setq equal-function (lambda (x y) (if is-all-numbers (= x y) (string= (funcall conversion-function
Re: [O] [odt] [PATCH] Anchoring image to a page
Jeremy Jambunathan K kjambunat...@gmail.com writes: Jeremy What about the second patch ? I'm very interested in seeing it merged. I did a quick run of the attached patch (authored by you). When I do this: #+ATTR_ODT: :anchor page [[./org-mode-unicorn.png]] I see that the image is anchored to the page as expected. But the moment I attach a caption and label to it like this: #+CAPTION: caption #+LABEL: label #+ATTR_ODT: :anchor page [[./org-mode-unicorn.png]] the image is no longer anchored to the page. I need to make additional modifications to achieve the desired effect for captioned images. (Let me do this modification myself.) OK. I am wondering what your use case is. For example, when someone does this: #+ATTR_ODT: :anchor page [[./org-mode-unicorn.png]] some text #+ATTR_ODT: :anchor page [[./org-mode-unicorn.png]] what do you think should be the desired behaviour. Practically, I see that the images get super-posed one on top of the other on the same page (i.e, effectively I see only one image). I am wondering what the trick is to embed multiple page anchored images in the document. You get the correct behavior :) The trick is : you write text and text and text. Sometimes, you want to add a picture but you don't want a page break. For example, you want to add a big illustration. To render correctly, the picture needs its own page but you don't want to break the page. In this case you need to anchor the picture to the page. I made an example based on the road book I'm working on : http://www.jerryland.fr/tatw/WorldTrip.odt. Quick example visible on pages 20 and 23. For information, the first map inclusion was at the beginning of 2.1.1 and the second map inclusion at the beginning of 2.3.1. Obviously if you anchor consecutively two pictures to the same page, you could be disappointed by the result but it's an issue you have to address with some others parameters which I do not know actually. I have added support for page-anchored images based on your suggestions. I have also added support for associating custom frame styles to the images. The attached org file and odt file will serve as an illustration. Thanks for working on this patch and suggesting improvements to the odt exporter. Jambunathan K. #+TITLE: page.org #+AUTHOR:Jambunathan K #+EMAIL: kjambunat...@gmail.com #+DATE: 2011-12-25 Sun #+DESCRIPTION: #+KEYWORDS: #+LANGUAGE: en #+OPTIONS: H:3 num:t toc:t \n:nil @:t ::t |:t ^:t -:t f:t *:t :t #+OPTIONS: TeX:t LaTeX:dvipng skip:nil d:nil todo:t pri:nil tags:not-in-toc #+EXPORT_SELECT_TAGS: export #+EXPORT_EXCLUDE_TAGS: noexport #+LINK_UP: #+LINK_HOME: #+XSLT: * Image1 #+ATTR_ODT: :scale 0.5 :anchor page #+CAPTION: Centered Image [[./org-mode-unicorn.png]] * Image2 #+ATTR_ODT: :scale 0.5 :anchor page :style OrgPageBottomImage [[./org-mode-unicorn.png]] =OrgPageBottomImage= is a custom frame style that is defined as below in =OrgOdtStyles.xml=. #+begin_src nxml style:style style:name=OrgPageBottomImage style:family=graphic style:parent-style-name=Graphics style:graphic-properties text:anchor-type=page fo:margin-top=0.21cm fo:margin-bottom=0.21cm style:vertical-pos=bottom style:vertical-rel=page style:horizontal-pos=center style:horizontal-rel=page fo:background-color=transparent style:background-transparency=100% style:shadow=none style:mirror=none fo:clip=rect(0cm, 0cm, 0cm, 0cm) draw:luminance=0% draw:contrast=0% draw:red=0% draw:green=0% draw:blue=0% draw:gamma=100% draw:color-inversion=false draw:image-opacity=100% draw:color-mode=standard style:background-image/ /style:graphic-properties /style:style #+end_src page.odt Description: page.odt
[O] [patch] Fix variable assignments written in the old way (in the LOB)
Hello, 2011-12-26 Sebastien Vauban s...@mygooglest.com * library-of-babel.org: Fix old-way variable assignments. Fix oddlevels. Delete trailing whitespaces. Best regards, Seb -- Sebastien Vauban From 732a4ef01b93dab34060d64c4deca23ac13aed5e Mon Sep 17 00:00:00 2001 From: Sebastien Vauban s...@mygooglest.com Date: Mon, 26 Dec 2011 12:36:11 +0100 Subject: [PATCH] Fix old-way variable assignments. --- contrib/babel/library-of-babel.org | 68 ++-- 1 files changed, 34 insertions(+), 34 deletions(-) diff --git a/contrib/babel/library-of-babel.org b/contrib/babel/library-of-babel.org index 571eb70..ecad0fe 100644 --- a/contrib/babel/library-of-babel.org +++ b/contrib/babel/library-of-babel.org @@ -1,22 +1,23 @@ #+title:The Library of Babel #+author: Org-mode People -#+STARTUP: oddeven hideblocks +#+STARTUP: hideblocks * Introduction - The Library of Babel is an extensible collection of ready-made and - easily-shortcut-callable source-code blocks for handling common tasks. - Org-babel comes pre-populated with the source-code blocks located in this - file. It is possible to add source-code blocks from any org-mode file to - the library by calling =(org-babel-lob-ingest path/to/file.org)=. - - This file is included in worg mainly less for viewing through the web - interface, and more for contribution through the worg git repository. If - you have code snippets that you think others may find useful please add - them to this file and [[file:~/src/worg/worg-git.org::contribute-to-worg][contribute them]] to worg. - - The raw Org-mode text of this file can be downloaded at - [[repofile:contrib/babel/library-of-babel.org][library-of-babel.org]] +The Library of Babel is an extensible collection of ready-made and +easily-shortcut-callable source-code blocks for handling common tasks. +Org-babel comes pre-populated with the source-code blocks located in +this file. It is possible to add source-code blocks from any org-mode +file to the library by calling =(org-babel-lob-ingest +path/to/file.org)=. + +This file is included in worg mainly less for viewing through the web +interface, and more for contribution through the worg git repository. +If you have code snippets that you think others may find useful please +add them to this file and [[file:~/src/worg/worg-git.org::contribute-to-worg][contribute them]] to worg. + +The raw Org-mode text of this file can be downloaded at +[[repofile:contrib/babel/library-of-babel.org][library-of-babel.org]] * Simple @@ -63,7 +64,7 @@ as a table in traditional Org-mode table syntax. ** Remote files - json +*** json Read local or remote file in [[http://www.json.org/][json]] format into emacs-lisp objects. @@ -83,14 +84,14 @@ Read local or remote file in [[http://www.json.org/][json]] format into emacs-li (json-read #+end_src - Google docs +*** Google docs The following code blocks make use of the [[http://code.google.com/p/googlecl/][googlecl]] Google command line tool. This tool provides functionality for accessing Google services from the command line, and the following code blocks use /googlecl/ for reading from and writing to Google docs with Org-mode code blocks. -** Read a document from Google docs + Read a document from Google docs The =google= command seems to be throwing Moved Temporarily errors when trying to download textual documents, but this is working fine @@ -120,7 +121,7 @@ document as a string. : #+call: gdoc-read(title=loremi, :format txt) -** Write a document to a Google docs + Write a document to a Google docs Write =data= to a google document named =title=. If =data= is tabular it will be saved to a spreadsheet, otherwise it will be saved as a @@ -147,18 +148,18 @@ example usage : (flet ((fib (m) (if ( m 2) 1 (+ (fib (- m 1)) (fib (- m 2)) : (mapcar (lambda (el) (list el (fib el))) (number-sequence 0 (- n 1 : #+end_src -: +: : #+call: gdoc-write(title=fibs, data=fibs(n=10)) * Plotting code ** R - Plot column 2 (y axis) against column 1 (x axis). Columns 3 and - beyond, if present, are ignored. +Plot column 2 (y axis) against column 1 (x axis). Columns 3 and +beyond, if present, are ignored. -#+name: R-plot(data=R-plot-example-data) -#+begin_src R +#+name: R-plot +#+begin_src R :var data=R-plot-example-data plot(data) #+end_src @@ -275,7 +276,7 @@ are optional. %head %foot %lastfoot - + %table \\end{longtable}\n (list @@ -296,7 +297,6 @@ are optional. (list :lend :sep:hline hline) #+end_src - *** booktabs-notes This source block builds on [[booktabs]]. It accepts two additional @@ -350,7 +350,7 @@ span. Note the use of LaTeX, rather than Org-mode, markup. ))) #+end_src -** Elegant lisp for transposing a matrix. +** Elegant lisp for transposing a matrix #+tblname: transpose-example | 1 | 2
Re: [O] [patch] Fix variable assignments written in the old way (in the LOB)
Hello Sébastien, Sebastien Vauban wxhgmqzgw...@spammotel.com writes: 2011-12-26 Sebastien Vauban s...@mygooglest.com * library-of-babel.org: Fix old-way variable assignments. Fix oddlevels. Delete trailing whitespaces. The patch does not apply -- there is no contrib/ directory in worg.git. Can you provide another one fixing this problem? Also, if you want to get push access to worg.git, just send me your public key -- I'd rather avoid patches to worg.git sent on this mailing list, as we need to discard them in the patchwork. Thanks! -- Bastien
Re: [O] Inconsisent typesetting of commands in the manual
Dear Takaaki, Takaaki ISHIKAWA tak...@ieee.org writes: I think this is caused by @table @asis at L.1645 in doc/org.texi. When I change it to @table @kbd, it looks good. But my suggestion is that the @table section is separated as follows: Thanks for the suggestion, it's a good one. The patch is not 100% correct though, as @table @kbd is enough to tell items how they should appear, so we don't need the @key{...} in @item and @itemx anymore. See the diff here: http://goo.gl/AYzPJ It's fixed now. Best, -- Bastien
Re: [O] [patch] Fix variable assignments written in the old way (in the LOB)
Hi Bastien, Bastien wrote: Sebastien Vauban wxhgmqzgw...@spammotel.com writes: 2011-12-26 Sebastien Vauban s...@mygooglest.com * library-of-babel.org: Fix old-way variable assignments. Fix oddlevels. Delete trailing whitespaces. The patch does not apply -- there is no contrib/ directory in worg.git. Can you provide another one fixing this problem? It's not for Worg.git: it's for Babel's library in the code base... Also, if you want to get push access to worg.git, just send me your public key I had push access on Worg, but still need to send back my public key since the change. I had very little time up to now. Hopefully, things are changing in the good direction. -- I'd rather avoid patches to worg.git sent on this mailing list, as we need to discard them in the patchwork. I understand, but as said above, the patch is for the file contrib/babel/library-of-babel.org, to be found from Org-mode.git's root. Best regards, Seb -- Sebastien Vauban
Re: [O] [patch] Fix variable assignments written in the old way (in the LOB)
Sebastien Vauban wxhgmqzgw...@spammotel.com writes: The patch does not apply -- there is no contrib/ directory in worg.git. Can you provide another one fixing this problem? It's not for Worg.git: it's for Babel's library in the code base... Silly me! Okay, I've applied it now. Thanks again :) -- Bastien
Re: [O] Bugs/features of accumulating property values when used with entries (concretely: in org-contacts)
Hi Christoph, Christoph LANGE ch.la...@jacobs-university.de writes: noticing the new feature Property names ending in + accumulate (as described on http://orgmode.org/Changes.html#accumulating-property-keywords – BTW, this exposes another issue with the fixed head bar on the new homepage, as the actual link target is hidden by the head bar), This has been fixed. I thought I could use it in the property drawers of the entries of my org-contacts file, and noticed the following problems: 1. font lock (aka syntax highlighting) does not yet recognize :PROPERTY+: I just fixed this, thanks. 2. accumulation doesn't work within the same entry; details follow: I let Eric answer this -- I'm not familiar enough with accumulating properties. Best, -- Bastien
Re: [O] Org-drill doesn't work...
Hi Joost, Joost Kremers joostkrem...@fastmail.fm writes: i'm sure i'm doing something wrong, but i can't figure out what... would appriciate any help pointing me in the right direction. Sorry, I'm not familiar enough with org-drill.el to help you here, hopefully Paul can have a look. btw, i noticed that some of the customize items in org-drill.el are incorrectly defined. for example, the :type declaration in org-drill-spaced-repetition-algorithm is: This is fixed, thanks. -- Bastien
Re: [O] BUG: Text in single quotes not recognized by markup
Hi Viktor, Viktor Rosenfeld listuse...@googlemail.com writes: the text ='t'= is not recognized as code. Other markup doesn't work either. If the quotes are in the middle (e.g. =foo'bar=) it is properly recognized. I'm using org-mode 7.7 pulled today from git. Please see ̀org-emphasis-regexp-components' and configure it to allow the single quote character in emphasized strings. HTH, -- Bastien
Re: [O] Bugs/features of accumulating property values when used with entries (concretely: in org-contacts)
Hi Bastien, Christoph and Eric, Bastien wrote: Christoph LANGE ch.la...@jacobs-university.de writes: 1. font lock (aka syntax highlighting) does not yet recognize :PROPERTY+: I just fixed this, thanks. 2. accumulation doesn't work within the same entry; details follow: So when I changed the above contact entry to * Contact Name :PROPERTIES: :EMAIL:f...@bar.org :EMAIL+: b...@baz.org :END: I would have expected (org-entry-get (point) EMAIL t) to evaluate to, well, at least f...@bar.org b...@baz.org (and in some later version of org-mode maybe to a two-item list, for even easier automated processing). But I got the following unexpected results, which indicate that accumulation is not yet supported in this context (well, if it was ever _intended_…): I let Eric answer this -- I'm not familiar enough with accumulating properties. I'll try to answer that one, under the supervision of the guru... Well, the following works: :PROPERTIES: :var: foo=7 :var+: baz=3 :END: so your syntax looks correct, but AFAIK the `+' is only supported at this stage for the `var' property: you can't take any property and add a `+' to transform it in an accumulative property. Whether this should be restricted by default or open by default, I have no opinion at this stage. I know, however, multivalued properties are sort of already well supported. See http://orgmode.org/manual/Using-the-property-API.html for more info. Best regards, Seb -- Sebastien Vauban
Re: [O] Unexpected expansion in a table
title - #+TITLE: is a yasnippet expansion. I think it's pre-added by default in the emacs-starter-kit (if not in general via YAS). You may need to see about adjusting the snippet so it doesn't affect things in the table. On Sat, Dec 24, 2011 at 12:36, Nick Dokos nicholas.do...@hp.com wrote: Thomas S. Dye t...@tsdye.com wrote: Aloha all, With the cursor after 'title' in the following table, pressing TAB doesn't move me to the next cell in the table, it expands title, as shown. | project | title | description | | project | #+TITLE: title | description | Is this expected behavior? I can't reproduce it: TAB gets me to the description cell from anywhere in the title cell. Org-mode version 7.8.02 (release_7.8.02.31.g1a092) Nick
[O] Footnotes issue with LaTeX export
I'm experiencing an issue similar to this one: --- http://osdir.com/ml/emacs-orgmode-gnu/2011-10/msg00544.html I have a paragraph in which I reference a dollar amount (preceded by $). Attempting to insert a footnote anywhere in that paragraph gets me the error Cannot insert a footnote here. Inserting one manually leaves the text black vs. fontified in the typical link color. Export produces it as the verbatim text ([fn:xx]) instead of converting it. Trying to escape the $ sign with \ doesn't fix the issue. Inserting another $ re-activates the footnote, but that will obviously convert my dollar amount to math font, which isn't what I want. Any suggestions? Thanks, John
[O] Invitation to connect on LinkedIn
LinkedIn Org, I'd like to add you to my professional network on LinkedIn. - Keith Keith Lancaster Adjunct Professor at University of Houston Houston, Texas Area Confirm that you know Keith Lancaster: https://www.linkedin.com/e/-l8obw9-gwof85rn-5h/isd/5330236969/Nc09ZtnS/?hs=falsetok=1UOWYZ_sZNZ501 -- You are receiving Invitation to Connect emails. Click to unsubscribe: http://www.linkedin.com/e/-l8obw9-gwof85rn-5h/vOSdlYg1NorPt_FFKOSdlMRpwHtSZO5DwH/goo/emacs-orgmode%40gnu%2Eorg/20061/I1856199221_1/?hs=falsetok=30aPsbi8ZNZ501 (c) 2011 LinkedIn Corporation. 2029 Stierlin Ct, Mountain View, CA 94043, USA.