[Orgmode] enabling org-protocol with Firefox 3 and Ubuntu 9.04
Hi everybody, if you have tried to enable org-protocol under Firefox you might run into the issue that firefox does not start emacsclient, no matter what the about:config variables say. After spending some time I discovered that this is an issue of Firefox's integration with Gnome. What you need is to tell Gnome that you have a new URI protocol called org-protocol, and that emacsclient is responsible for it. This is done with the following two commands (be careful to indicate the correct full path of emacsclient): gconftool -s /desktop/gnome/url-handlers/org-protocol/command -t string '/usr/bin/emacsclient %s' gconftool -s /desktop/gnome/url-handlers/org-protocol/enabled -t boolean true --dmg -- -- Daniel M. German http://turingmachine.org/ http://silvernegative.com/ dmg (at) uvic (dot) ca replace (at) with @ and (dot) with . ___ Emacs-orgmode mailing list Remember: use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
Re: [Orgmode] Re: Org-mode and Nokia N900
Óscar> Thierry Guillemin writes: >> Hello >> >> This question comes after reading >> http://lifehacker.com/5419988/five-best-outlining-tools >> and before buying a N900... >> >> Will it be possible to install Org-mode on the N900 (only Emacs available is >> Qemacs) ? Óscar> It seems that QEmacs has no Emacs Lisp support. Hence org-mode cannot Óscar> run on it. Óscar> You need either Emacs or XEmacs for running org-mode. I just got a N900.I was using emacs on the N810, with org-mode on it. Then synchronizing my files using subversion. Applications are being made available for the N900. Hopefully emacs will be too (at least without N900 support, as it was with the N900). --dmg -- -- Daniel M. German http://turingmachine.org/ http://silvernegative.com/ dmg (at) uvic (dot) ca replace (at) with @ and (dot) with . ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
[Orgmode] running org-mode (inside emacs) in the n900
Yes, it can be done: http://turingmachine.org/blog/index.php?/archives/99-Running-emacs-and-org-mode-in-the-N900.html I just got it running. The instructions are there. Now I need to figure out where the meta key is ;) --dmg -- -- Daniel M. German http://turingmachine.org/ http://silvernegative.com/ dmg (at) uvic (dot) ca replace (at) with @ and (dot) with . ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
Re: [Orgmode] Browser Interface to org-mode?
Manish twisted the bytes to say: Manish> On Mon, Dec 21, 2009 at 12:24 PM, sumeet pareek wrote: >> I am not a 100% sure but I believe I heard some where in the google tech >> talk about browser interface to org-mode. Could anybody tell me where can I >> find it? It would be a boon to me as I am mostly on a windows box where >> running org-mode is not the most simple thing to do. Manish> I do not think there is any browser interface to Org mode. Manish> Do you use Org on non-Windows system at present? Do you use Emacs on Manish> Windows at present? Have you tried Org with Emacs on Windows? What Manish> difficulties did you face? >> I also work from multiple systems and would seriously benefit from any >> org-mode interface/clone that works from the browser!? Manish> Most folks here use DVCS based syncing solutions. I use org-mobile to synchronize an iphone. this has the advantage of uploading the files to a web site. You can use it for a simple way to "read-only" browse your org files from another computer (which I just had to do few minutes ago). --dmg -- -- Daniel M. German http://turingmachine.org/ http://silvernegative.com/ dmg (at) uvic (dot) ca replace (at) with @ and (dot) with . ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
[Orgmode] Encrypting files for org-mobile
Hi everybody, Does anybody know if it is possible to keep the files for org-mobile encrypted in the server? I know you can protect them with a password, but that protection is from people who look into the server. How about protecting it from the people who run the server? thanks a lot! -- -- Daniel M. German http://turingmachine.org/ http://silvernegative.com/ dmg (at) uvic (dot) ca replace (at) with @ and (dot) with . ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
Re: [Orgmode] Encrypting files for org-mobile
Hi Richard, Richard> Hi Daniel, Richard> There is no support for this in MobileOrg yet, but it has resided on my todo list for a while. Richard> Do you currently use any encryption on your local Org-files in Emacs? I've been meaning to examine AutoEncryption or CryptPlusPlus (http:// Richard> www.emacswiki.org/emacs/CategoryCryptography) to see how it plays with Org. If it worked well, my rough plan was to make MobileOrg able to en/ Richard> decrypt files along those lines. Richard> If anyone has any better ideas, let me know. I'm not sure how this would best be implemented. I think there are two use cases for this problem. * On one side is the people who work with encrypted files. the mobile-org application would need to be aware of the type of encryption used. I suspect many people would be willing to change encryption method to the one used in org if it was "good enough". * On the other there is the people who are only interested in encrypting the files in the server to avoid them to be browsed by unwanted eyes. I suspect that even a simple symmetric encryption method will be sufficient here for the majority of the users. these two uses cases are not mutually exclusive. One can imagine an scenario where only one or more files are encrypted at the client level, but the user wants all the files uploaded to the server to be made available in encrypted mode at the file system level on the server. Which get me thinking... is there a way to decrypt the files on the file at the server as they are requested by the mobile-org client? In other words, the files are encrypted in the server, but when the user requests them (and provides the proper credentials---such as in the current environment) the files are then decrypted on the file before they are sent to the iphone. I suspect this is probably implemented somehow. I have an iphone development environment (no dev. license though) and I learning objective-C. I am not very good at UI, but I can help with the backend code, if necessary. --dmg Richard> -Richard Richard> On Tue, Dec 29, 2009 at 4:04 AM, D M German wrote: Hi everybody, Does anybody know if it is possible to keep the files for org-mobile encrypted in the server? I know you can protect them with a password, but that protection is from people who look into the server. How about protecting it from the people who run the server? thanks a lot! -- -- Daniel M. German http://turingmachine.org/ http://silvernegative.com/ dmg (at) uvic (dot) ca replace (at) with @ and (dot) with . ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode -- -- Daniel M. German http://turingmachine.org/ http://silvernegative.com/ dmg (at) uvic (dot) ca replace (at) with @ and (dot) with . ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
[Orgmode] Re: Encrypting files for org-mobile
Bernt Hansen twisted the bytes to say: Bernt> Hi Richard, I don't currently use MobileOrg but I do use encryption Bernt> with org-mode as described here: Bernt> http://doc.norang.ca/org-mode.html#HandlingEncryption Bernt> Regards, Bernt> Bernt Thanks Bernt, for calling my attention to this feature. It certainly works as a way to avoid my most important data to be "server" readable. I'll give it a try. --dmg -- -- Daniel M. German http://turingmachine.org/ http://silvernegative.com/ dmg (at) uvic (dot) ca replace (at) with @ and (dot) with . ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
[Orgmode] protocol for PDFs?
hi there, I am trying to add support in Evince and Xournal for org. I have already implemented most of it in Xournal, but now I am hitting a roadblock. What would the form of the URI for a link to a PDF document and a page be? In other words, is there support for a link to a given page in a PDF already written in org? If not, what would the place to add this functionality? thanks a lot! --daniel -- -- Daniel M. German http://turingmachine.org/ http://silvernegative.com/ dmg (at) uvic (dot) ca replace (at) with @ and (dot) with . ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
Re: [Orgmode] protocol for PDFs?
Jan Böcker twisted the bytes to say: Jan> Example: Jan> [[docview:/home/jan/some-file.pdf::7][Page 7]] Jan> Of course, these links open the file by visiting it in emacs. Jan> I would propose to modify org-docview.el to look in org-file-apps for an Jan> entry for \.pdf\' thanks. This will get me going for the time being. Also, keep in mind that some people use xournal for native .xoj files, so it will be nice to generalize this for any extension (provide a "handler" for the given type of document). --dmg -- -- Daniel M. German http://turingmachine.org/ http://silvernegative.com/ dmg (at) uvic (dot) ca replace (at) with @ and (dot) with . ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
Re: [Orgmode] protocol for PDFs?
Jan Böcker twisted the bytes to say: Jan> On 02.01.2010 16:20, Darlan Cavalcante Moreira wrote: >> Evince also has an option ("-p") to open the file in a >> given page and this would be enough for a link to a PDF file. Since I prefer >> using Evince instead of docview mode I would be very happy to test it. Jan> I have implemented an experimental version of org-docview.el which Jan> allows you to specify an external PDF viewer. Check out the docview-dev Jan> branch at Jan> http://github.com/jboecker/org-mode Jan> To test this, pull from there or apply the following patch, then: Jan> M-x customize-variable org-docview-pdf-app Jan> Set it to "evince %s -p %p" and docview: links to PDF files should now Jan> open in evince. There may still be bugs lurking here, and I am thinking Jan> about generalizing this to use a variable org-docview-apps which would Jan> behave like org-file-apps. Great. I have now a patch for xournal that supports page numbers from the command line: https://sourceforge.net/tracker/?func=detail&aid=2924825&group_id=163434&atid=827735 The format is --page=%p or -p %p It is likely to make it into xournal. I am now adding an option to use org-protocol to create the link from xournal. more later. --dmg Jan> This would duplicate functionality of file: links again, which bugs me, Jan> but on the other hand it would be difficult to reuse org-file-apps for Jan> this, as I suggested in my previous email -- when opening a file: link Jan> to a PDF, the %p would not get replaced and may confuse the PDF viewer Jan> application :( Jan> Also, YAGNI may apply here if nobody uses docview: links to link to Jan> non-PDF files anyway. Jan> --- Jan> new experimental variable: org-docview-pdf-app Jan> External application to open docview: links pointing to a pdf file. Jan> Possible values: 'emacs:Visit the file with emacs using doc-view-mode. string:An external PDF viewer application. %s will be replaced by the file name. %p will be replaced by the page number. Example: evince %s -p %p -- -- Daniel M. German http://turingmachine.org/ http://silvernegative.com/ dmg (at) uvic (dot) ca replace (at) with @ and (dot) with . ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
Re: [Orgmode] protocol for PDFs?
I have implemented 'Remember' in xournal. I doubt this feature will ever make into the mainstream. You can check out my fork. it contains many features not in the current distribution, but useful, including very rudimentary search support, ability to jump to next and previous annotations: http://github.com/dmgerman/xournal or you can cherry pick my commits. Look for Remember under the edit menu. By default it would use the name of the PDF file (if one exits), otherwise it will use the .XOJ file. I am curious to see if we can select text in xournal. I don't use Link (only remember) but that would be easy to implement too. The infrastructure is there now. Jan> PS: I am very interested in integrating Xournal with Org. I use Xournal Jan> for doing all my homework for university; when I have saved the file, I Jan> manually add a file: link to my org file. It would be great to store Jan> that link directly from Xournal! Jan> - Jan -- -- Daniel M. German http://turingmachine.org/ http://silvernegative.com/ dmg (at) uvic (dot) ca replace (at) with @ and (dot) with . ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
Re: [Orgmode] protocol for PDFs?
Jan> It allows you to link to any document format which doc-view-mode Jan> supports, which includes PDF files. The syntax is: Jan> docview::: Jan> Example: Jan> [[docview:/home/jan/some-file.pdf::7][Page 7]] I have started modifying evince. I got to the point in evince that I can now call emacs-client. The problem is, what do I pass to it? Will the call to emacsclient be: emascclient ort-protocol://remember://docview:/home/jan/some-file.pdf::7/TitleOfPDF/Selection By the way, the way I envision it, xournal will have an option to open evince in the same page (already implemented), and then one can select text from the PDF and send it to org. In xournal one can create a hyperlink to a given page using org, but no selection is possible (no support in xournal yet). --dmg -- Daniel M. German http://turingmachine.org/ http://silvernegative.com/ dmg (at) uvic (dot) ca replace (at) with @ and (dot) with . ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
[Orgmode] org-remember support in xournal
Hi everybody, I am sorry I have been a bit slow to finish the integration of xournal with remember mode. I think I got it working. My branch of xournal is available at github: http://github.com/jboecker/xournal If the loaded file in xournal is a PDF, the remember link is created to the .pdf file. Otherwise it is created to the .xoj file. In both cases the protocol is docview: emacsclient 'org-protocol://remember://docview:filename::pagenumber Evince has become a bit trickier because it does not support jumping to a specific page number (it uses labels instead). So I need to do a bit more hacking within it. Remember, this is an unofficial branch of xournal. It actually supports more features than xournal (such as jumping to previous, next annotation, very, very rough search features, and ability to attach images to the xoj file. --dmg -- -- Daniel M. German http://turingmachine.org/ http://silvernegative.com/ dmg (at) uvic (dot) ca replace (at) with @ and (dot) with . ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
[Orgmode] patch to support remember in evince
here is a patch to support remember inside evince. http://turingmachine.org/~dmg/temp/0001-Added-support-for-xournal-but-docview-linking-needs-.patch I tried to pass the text selection to remember, but it does not work (org-protocol://remember://docview:filename::pagenumber::selection). Looking at the code of org-docview.el I can see that its code does not support splitting the selection. I suspect this is a minor change required. Any suggestions on how to change it? -- -- Daniel M. German http://turingmachine.org/ http://silvernegative.com/ dmg (at) uvic (dot) ca replace (at) with @ and (dot) with . ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
[Orgmode] org-protocol: non-ASCII characters
Jan> After learning about org-protocol on worg, I got it working. Jan> There seems to be a problem with non-ASCII characters in the file names, Jan> though: an "ü" in the file path arrived in emacs as "%0 %))". I have been looking around and I am not sure how to solve this problem. Withing Evince and Xournal I am encoding any non alphanum (as defined by the C macro) each byte that is contained in the filename individually. Does anybody know which are the characters above 0 (zero) that need to be encoded for a safe org link? --dmg -- Daniel M. German http://turingmachine.org/ http://silvernegative.com/ dmg (at) uvic (dot) ca replace (at) with @ and (dot) with . ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
[O] a window with my agenda at all times
Hi everybody, I struggle to keep (in emacs) a window with the agenda at all times. If anybody has any pointers on how to get a window or a frame to "stick" at all times with the contents of a frame, and basically be ignored from any window-related command (split, kill, etc), I would be grateful. For a long time I have wanted a sticky window that keeps this information. Like a sticky note on my desktop (think a widget in Android). I wrote a small program in qt that simply monitors a file and displays it. Nothing more. It does the work for me, and maybe somebody else will find it useful. It relies on exporting the agenda as html every time the org file is modified, and then this little program displays the html file. The window manager is responsible of removing decorations, making it sticky, and placing it in same place always. Here is a screenshot (see window to the bottom right). The decorations are removed by the window manager: http://turingmachine.org/hacking/org-mode/orgdisplay.png Here is the code. As I said, very, very simple, but maybe somebody will find if useful. http://turingmachine.org/hacking/org-mode/ -- Daniel M. German http://turingmachine.org/ http://silvernegative.com/ dmg (at) uvic (dot) ca replace (at) with @ and (dot) with .
Re: [O] a window with my agenda at all times
Hi Erick, Eric> D M German writes: >> Hi everybody, >> >> I struggle to keep (in emacs) a window with the agenda at all times. If >> anybody has any pointers on how to get a window or a frame to "stick" at >> all times with the contents of a frame, and basically be ignored from >> any window-related command (split, kill, etc), I would be grateful. >> >> For a long time I have wanted a sticky window that keeps this >> information. Like a sticky note on my desktop (think a widget in >> Android). Eric> I can't answer your question directly but I have done this in the past Eric> by using /conky/ to display the contents of a file (updating Eric> automatically) where the file is created by Emacs to consist of the Eric> output of the agenda command. This elisp snippet writes out the agenda Eric> to a specified file (untested): (save-window-excursion (org-batch-agenda "a") (org-write-agenda "some-file-name")) I do something similar, but in the "after-save-hook" (defun dmg-org-update-agenda-file (&optional force) (interactive) (save-excursion (save-window-excursion (let ((file "/tmp/agenda.html")) (org-agenda-list) (org-write-agenda file) Eric> In conky, you can use the /head/ directive to output a specified number Eric> of lines. Eric> Conky can write to the root window (i.e. the screen) or to a window. Eric> The former works better, in my opinion, but this may depend on the Eric> window manager you use. Thanks for the hint. Sometimes the problem is knowing the name of a tool. I though about doing something like this, but I wanted rendering in HTML. Searching on the Internet I found an alternative that does HTML (gtk-desktop-info). https://code.launchpad.net/~m-buck/+junk/gtk-desktop-info I think at the end it is a matter of taste. With my utility a window is created with scrollbars if the agenda is too large. But it seems to be making a difference to me, which is what matters ;) --dmg Eric> HTH, Eric> eric Eric> -- Eric> : Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.50.1 Eric> : using Org-mode version 7.5 (release_7.5.461.g6d18) -- -- Daniel M. German http://turingmachine.org/ http://silvernegative.com/ dmg (at) uvic (dot) ca replace (at) with @ and (dot) with .
[O] bug in expansion of variables in babel Perl
Hi Everybody, I found a bug in the Babel perl code. When a table is used as input, the values of the table are not escaped. In fact, they are surrounded by double quotes " instead of single ones '. This means that special characters are interpreted: $, and @ | jon #+name: output(data=patito) #+begin_src perl :results output print "Begin\n"; print $$data[0][0], "\n"; print "End\n"; #+end_src #+RESULTS: output : Begin : Jon : End -- I see two ways to solve this. The first is simply to replace the output format of the variable from "%S" to "'%s'" (use quotes '). The other one is to optionally escape the fields of the table (which is more complicated, and would require replacing each). The third one is a combination of both: replace them only if desired, via some header configuration variable. diff --git a/lisp/ob-perl.el b/lisp/ob-perl.el index ccd3826..2f795aa 100644 --- a/lisp/ob-perl.el +++ b/lisp/ob-perl.el @@ -75,7 +75,7 @@ The elisp value, VAR, is converted to a string of perl source code specifying a var of the same value." (if (listp var) (concat "[" (mapconcat #'org-babel-perl-var-to-perl var ", ") "]") -(format "%S" var))) +(format "'%s'" var))) Debugging perl is very cumbersome in org-mode. It would be nice to have a feature to export the source to a file. This is because the variable expansion needs to be done before the code can be used (hence simply cut and paste does not work, nor shell-command-on-region) I used the org-babel-perl-command variable to replace perl with a script that simply wrote to a file. It would be nice to be able to write the script created by org a file, so this can be debugged (it would have the variable definitions). Maybe this is already a feature and I don't know about it. As we are into it, I found this declaration to be very useful. -- (setq org-babel-perl-wrapper-method " use strict; sub org_columns { my ($table) = @_; my $y = $$table[0]; return scalar(@$y); } sub org_rows { my ($table) = @_; return scalar(@$table); } sub main { %s } my @r = main; open(o, \">%s\"); print o join(\"\\n\", @r), \"\\n\"") -- It does two things: it uses strict, so undeclared variables create errors, and it also creates two functions: org_columns and org_rows that, when used on the variable declared as input, return its number of columns and rows: my $rows = org_rows($data); my $columns = org_columns($data); the only problem with using strict is that variables would have to be defined with "my" too: so that would require this patch: diff --git a/lisp/ob-perl.el b/lisp/ob-perl.el index ccd3826..82f8086 100644 --- a/lisp/ob-perl.el +++ b/lisp/ob-perl.el @@ -62,7 +62,7 @@ This function is called by `org-babel-execute-src-block'." "Return list of perl statements assigning the block's variables." (mapcar (lambda (pair) - (format "$%s=%s;" + (format "my $%s=%s;" (car pair) (org-babel-perl-var-to-perl (cdr pair (mapcar #'cdr (org-babel-get-header params :var Finally, if interested, i can write a couple of examples for Perl that could help people who want to use it. thanks again, -- Daniel M. German "Great algorithms are Francis Sullivan -> the poetry of computation" http://turingmachine.org/ http://silvernegative.com/ dmg (at) uvic (dot) ca replace (at) with @ and (dot) with .
Re: [O] bug in expansion of variables in babel Perl
dmg> Mm, I also noticed that when :results output is used, there is no way dmg> to insert perl code before or after the executed code. dmg> org-babel-perl-wrapper-method only works for all the methods but dmg> output. It would be nice to have a variable that dmg> does this for any output type. I implemented a proof-of-concept. The idea is to have a variable called org-babel-perl-preface that is inserted before the code. I also like to be able to use my in all variables, so I can use strict, if I choose to. See the patch at the bottom. here is a test example: == Input table #+RESULTS: patito | id | title | year | index | notes | attr | |+-+--+---+---+--| | Taxi Driver (1944) | Taxi Driver | 1944 | | | | | Taxi Driver (1954) | Taxi Driver | 1954 | | | | | Taxi Driver (1973) | Taxi Driver | 1973 | | | | | Taxi Driver (1976) | Taxi Driver | 1976 | | | | | Taxi Driver (1978) | Taxi Driver | 1978 | | | | | Taxi Driver (1981) | Taxi Driver | 1981 | | | | | Taxi Driver (1990) | Taxi Driver | 1990 | | | | | Taxi Driver (2004) | Taxi Driver | 2004 | | | | Simple row output: the last statement is returned as a list, each in a line. #+name: output2(data=patito) #+begin_src perl :results raw org_rows($data), org_columns($data); #+end_src #+RESULTS: output2 8 6 More complex example. By defining org_rows and org_columns in the preface, it makes it easier to manipulate them. org-babel implements tables as a reference to an array of references to arrays. #+name: rip(data=patito) #+begin_src perl :results output my $rows = org_rows($data); my $columns = org_columns($data); for (my $j=0;$j<$rows; $j++) { for (my $i=0;$i<$columns; $i++) { print "$i:$j "; print $$data[$j][$i]; print " ;" } print "|\n"; } print "Row $rows\n"; print "Columns $columns\n"; #+end_src #+RESULTS: rip #+begin_example 0:0 Taxi Driver (1944) ;1:0 Taxi Driver ;2:0 1944 ;3:0;4:0;5:0 ;| 0:1 Taxi Driver (1954) ;1:1 Taxi Driver ;2:1 1954 ;3:1;4:1;5:1 ;| 0:2 Taxi Driver (1973) ;1:2 Taxi Driver ;2:2 1973 ;3:2;4:2;5:2 ;| 0:3 Taxi Driver (1976) ;1:3 Taxi Driver ;2:3 1976 ;3:3;4:3;5:3 ;| 0:4 Taxi Driver (1978) ;1:4 Taxi Driver ;2:4 1978 ;3:4;4:4;5:4 ;| 0:5 Taxi Driver (1981) ;1:5 Taxi Driver ;2:5 1981 ;3:5;4:5;5:5 ;| 0:6 Taxi Driver (1990) ;1:6 Taxi Driver ;2:6 1990 ;3:6;4:6;5:6 ;| 0:7 Taxi Driver (2004) ;1:7 Taxi Driver ;2:7 2004 ;3:7;4:7;5:7 ;| Row 8 Columns 6 #+end_example == diff --git a/lisp/ob-perl.el b/lisp/ob-perl.el index ccd3826..65e6b88 100644 --- a/lisp/ob-perl.el +++ b/lisp/ob-perl.el @@ -62,7 +62,7 @@ This function is called by `org-babel-execute-src-block'." "Return list of perl statements assigning the block's variables." (mapcar (lambda (pair) - (format "$%s=%s;" + (format "my $%s=%s;" (car pair) (org-babel-perl-var-to-perl (cdr pair (mapcar #'cdr (org-babel-get-header params :var @@ -85,13 +85,34 @@ specifying a var of the same value." (defvar org-babel-perl-wrapper-method " +%s sub main { %s } -@r = main; +my @r = main; open(o, \">%s\"); print o join(\"\\n\", @r), \"\\n\"") +(defvar org-babel-perl-preface + " +use strict; + +sub org_columns +{ +my ($table) = @_; +my $y = $$table[0]; +return scalar(@$y); +} + +sub org_rows +{ +my ($table) = @_; +return scalar(@$table); +} + +") + + (defvar org-babel-perl-pp-wrapper-method nil) @@ -102,11 +123,11 @@ of the statements in BODY, if RESULT-TYPE equals 'value then return the value of the last statement in BODY, as elisp." (when session (error "Sessions are not supported for Perl")) (case result-type -(output (org-babel-eval org-babel-perl-command body)) +(output (org-babel-eval org-babel-perl-command (format "%s\n%s" org-babel-perl-preface body))) (value (let ((tmp-file (org-babel-temp-file "perl-"))) (org-babel-eval org-babel-perl-command - (format org-babel-perl-wrapper-method body + (format org-babel-perl-wrapper-method org-babel-perl-preface body (org-babel-process-file-name tmp-file 'noquote))) (org-babel-eval-read-file tmp-file) -- Daniel M. German "In questions of science the authority of a thousand is not worth the humble Galileo -> reasoning of a single individual." http://turingmachine.org/ http://silvernegative.com/ dmg (at) uvic (dot) ca replace (at) with @ and (dot) wi
[O] babel :results output and format of output
hi everybody, I have been testing babel with perl and I am very puzzled by the following: Say I have the following script that outputs 10 numbers. org/babel wraps it as a begin_example #+begin_src perl :results output for (my $i=0;$i<10;$i++) { print "$i\n"; } #+end_src #+RESULTS: #+begin_example 0 1 2 3 4 5 6 7 8 9 #+end_example But if my script only outputs 9 lines then the format is not wrapped by #+begin_example, and instead is prefixed by : #+begin_src perl :results output for (my $i=0;$i<9;$i++) { print "$i\n"; } #+end_src #+RESULTS: : 0 : 1 : 2 : 3 : 4 : 5 : 6 : 7 : 8 Is this behaviour expected? Is the threshold at which it happens configurable? thanks a lot for your help, --dmg -- Daniel M. German "In questions of science the authority of a thousand is not worth the humble Galileo -> reasoning of a single individual." http://turingmachine.org/ http://silvernegative.com/ dmg (at) uvic (dot) ca replace (at) with @ and (dot) with .
Re: [O] bug in expansion of variables in babel Perl
Achim> D M German writes: Achim> […] Achim> Please leave the formats alone, if you change the number of parameters Achim> there folks that use their own definitions won't know what hit them. Achim> What you want is to prepend something to the body that Babel gives you, Achim> so let-bind that result and use it. You could even advise the function Achim> and have it submit to your will without changing Org. Hi Achim, thanks for the recommendation. As I said before, see my previous patch as a proof-of-concept and not as something that I think should be applied. I am fully aware of the potential consequences. Achim> BTW, now that I think some more about it: debugging Perl is much easier Achim> than you seem to let on: Achim> (setq org-babel-perl-command "perl -Mstrict -ne print"). Using strict is complicated by use of variables from org tables and the way that the code in R is executed. It would require the variable @r and each of the created variables from tables to be defined as my. I know I can change the behaviour of org-babel-variable-assignment, but perhaps simply adding "my" to any variable created in org would be a good thing to do. I don't think it would harm, anyways. Achim> This will echo the program sent to Perl in full glory into the output Achim> block. thanks, this i a great suggestion that I didn't know about. --dmg Achim> Regards, Achim> Achim. Achim> -- Achim> +<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+ Achim> Waldorf MIDI Implementation & additional documentation: Achim> http://Synth.Stromeko.net/Downloads.html#WaldorfDocs -- Daniel M. German "Beware of bugs in the above code; I have only proved it Donald Knuth ->correct, not tried it." http://turingmachine.org/ http://silvernegative.com/ dmg (at) uvic (dot) ca replace (at) with @ and (dot) with .
[O] evaluation of perl in babel
Hi Everybody, I looked a bit more onto the way that perl is evaluated. I know the support of perl is minor. I understand that, so please, don't see this message as a complaint, so this is more for discussion and potential improvements of the Perl support in Babel. One of the things I have noticed is that the way that Babel handles the results coming from the code is not the best. Let me elaborate: At the bottom you will find a set of test that stress the different :results types. There are some bugs. For example, the interpretation of :results table, vector and list. But I think the main problem comes from the way that Babel expects the result. In Babel, and except for :results output, the last expression in perl is considered the input to the results. This is implementing by saving the last expression into a variable, and printing each value separated by a "\n" (including the last). So basically, org takes the last expression, and outputs them to the babel input file one per line. This places some constraints. First, it is not currently capable of dealing with two dimensional arrays. Second, it makes it hard to create complex output (such as HTML or LaTeX), and third, it is hard to debug without first printing the value of the array (this output would be lost during the evaluation, so it would have be debugged outside org). I feel that a better approach is to use std output as the default input to any of these :results types, and then try to parse them into the corresponding :results types. This will allow the creation of HTML and LaTeX from perl (which the current implementation does not allow). So recapitulating, my suggestion is that perl should use STDOUT as the output of the snippet in any :results type, rather than the result of the last expression. I know this will break backwards compatibility. One solution is to keep the current src perl and add a new perl_stdout mode (or something like that) that implements this. --dmg -- #+begin_src perl :results output print "Test\n"; (1, 2) #+end_src #+RESULTS: : Test #+name: t_output_raw #+begin_src perl :results raw print "Test\n"; (1, 2) #+end_src #+RESULTS: t_output_raw 1 2 #+name: t_output_table #+begin_src perl :results table print "Test\n"; (1, 2) #+end_src #+RESULTS: t_output_table | 1\n2\n | #+name: t_output_vector #+begin_src perl :results vector print "Test\n"; (1, 2) #+end_src #+RESULTS: t_output_vector | 1\n2\n | #+name: t_output_list #+begin_src perl :results list print "Test\n"; (1, 2) #+end_src #+RESULTS: t_output_list #+begin_example - 1 2 #+end_example #+name: t_output_org #+begin_src perl :results org print "Test\n"; (1, 2) #+end_src #+RESULTS: t_output_org #+BEGIN_SRC org 1 2 #+END_SRC #+name: t_output_html #+begin_src perl :results html print "Test\n"; (1, 2) #+end_src #+RESULTS: t_output_html #+BEGIN_HTML 1 2 #+END_HTML #+name: t_output_latex #+begin_src perl :results latex print "Test\n"; (1, 2) #+end_src #+RESULTS: t_output_latex #+BEGIN_LaTeX 1 2 #+END_LaTeX -- -- Daniel M. German "I see no good reason why the views given in this volume should shock the religious Charles Darwin -> feelings of anyone." http://turingmachine.org/ http://silvernegative.com/ dmg (at) uvic (dot) ca replace (at) with @ and (dot) with .
Re: [O] [PATCH] bug in expansion of variables in babel Perl
Achim Gratz twisted the bytes to say: Hi Achim, thanks for taking the time to do this. I applied the patch, one of the hunks didn't apply due to Eric's changes, but that is not an issue, since they do the same: -- diff a/lisp/ob-perl.el b/lisp/ob-perl.el(rejected hunks) @@ -75,7 +75,7 @@ (defun org-babel-perl-var-to-perl (var) specifying a var of the same value." (if (listp var) (concat "[" (mapconcat #'org-babel-perl-var-to-perl var ", ") "]") -(format "%S" var))) +(format "q(%s)" var))) (defvar org-babel-perl-buffers '(:default . nil)) -- Everything works as intended, except for the return value of the perl code. Values in the list are concatenated, as one: #+begin_src perl :results table (1, 2, 3) #+end_src #+RESULTS: | 123 | #+begin_src perl :results table (1, 2, 3) #+end_src #+RESULTS: | 123 | I think the issue is that, at least in my computer the variable $\ returns empty (the record separator). #+begin_src perl :results output print "value of \$\\ [$\]\n"; #+end_src #+RESULTS: #+begin_example value of $\ [] #+end_example --daniel -- Daniel M. German "Work. Finish. Publish. " Michael Faraday http://turingmachine.org/ http://silvernegative.com/ dmg (at) uvic (dot) ca replace (at) with @ and (dot) with .
Re: [O] bug in expansion of variables in babel Perl
Achim> Eric Schulte writes: >> Are you familiar with `org-babel-expand-src-block' bound to C-c C-v v? Achim> I wasn't, obviously, and neither was the OP. >> If I understand the desire correctly, it should be what you're after. >> Perhaps an option to raise the expanded source code buffer along with >> the error buffer when an error is raised would be a useful addition. Achim> Yes, so there's no three ways for Perl to get the same result for Achim> comparison. :-P Just keep in mind, org-babel-expand-src-block is not exactly what emacs passes to perl. It does not contain the wrapping code. --dmg -- Daniel M. German http://turingmachine.org/ http://silvernegative.com/ dmg (at) uvic (dot) ca replace (at) with @ and (dot) with .
Re: [O] evaluation of perl in babel
Achim Gratz twisted the bytes to say: Achim> D M German writes: >> There are some bugs. For example, the interpretation of :results table, >> vector and list. Achim> You may misunderstand some things, or I don't understand what you are Achim> asking. It is (at least currently) the responsibility of the Perl Achim> program (or any other Babel language) to deliver the result in such a Achim> way that it can be interpreted correctly by the result type chosen (in Achim> other word, the program output must be valid Org syntax in the given Achim> context). You can't have the same program produce tables, vectors and Achim> LaTeX output just by switching the results type. I understand. But what I want is the output to be wrapped accordingly, and my script to deliver exactly the output as expected. So say I want to generate HTML in my script, I can use :results output, but then I have to change to replace the #+being_example with #+begin_HTML. I guess that I can generate a two dimensional table with perl too using output (printing the necessary | and \n), but then it will be wrapped with #+begin_example. >> But I think the main problem comes from the way that Babel expects the >> result. In Babel, and except for :results output, the last expression in >> perl is considered the input to the results. Achim> That is with the default wrapper function, which expects the program to Achim> return something that either is a string or interpolates to a string Achim> that Babel can interpret. You can easily define one yourself that does Achim> different things, like simply open the output file then select the Achim> filehandle for output. That's what I'd do in any case and I think it Achim> would work just as you want. Perhaps a string can be the solution. Ok, I am testing: #+begin_src perl :results table ("a|b|c|\n|c|d|e") #+end_src #+RESULTS: | a | b | c | \n | c | d | e | Ok, this seems to be more useful that returning a list of values. Is there a way to separate two rows in the result? Thanks again Achim, --daniel -- Daniel M. German http://turingmachine.org/ http://silvernegative.com/ dmg (at) uvic (dot) ca replace (at) with @ and (dot) with .
Re: [O] [PATCH] bug in expansion of variables in babel Perl
Achim> D M German uvic.ca> writes: >> I think the issue is that, at least in my computer the variable $\ >> returns empty (the record separator). Achim> Thinko on my side, what I wanted was the input record separator "$/" Achim> (to avoid Achim> specifying a literal newline for those systems where this is actually Achim> multi-character). Hi Achim, Once I changed it: (defvar org-babel-perl-wrapper-method "{ my @r = eval( q( %s )); open my $BO, qq(>%s) or die qq( Perl: Could not open output file.$\\ ); print $BO join($/, @r), $/ ; }") the result now has \n in between fields (literally): #+name: t_output_table #+begin_src perl :results table print "Test\n"; (1, 2) #+end_src #+RESULTS: t_output_table | 1\n2\n | what is the expected field separator for Org-babel? Achim> Regards, Achim> Achim. -- Daniel M. German "Prose is intrinsically linear; a good book carries the reader forward The Economist ->on the crest of the words" http://turingmachine.org/ http://silvernegative.com/ dmg (at) uvic (dot) ca replace (at) with @ and (dot) with .
[O] Small tutorial on how to use Perl within org
hi everybody, I have created a small document that describes how to use perl within org. Hopefully others will find it useful: http://turingmachine.org/~dmg/emacs/examplePerl.org --dmg -- Daniel M. German http://turingmachine.org/ http://silvernegative.com/ dmg (at) uvic (dot) ca replace (at) with @ and (dot) with .
Re: [O] Small tutorial on how to use Perl within org
Hi Tom, Thomas S Dye twisted the bytes to say: [...] >> >> http://turingmachine.org/~dmg/emacs/examplePerl.org Tom> Nice. Tom> It would be great to use this document as the basis of ob-doc-perl. Tom> Perl is one of about 20 languages that need to be documented at Tom> http://orgmode.org/worg/org-contrib/babel/languages.html. Tom> Note that there is a template that helps create a "standard" language Tom> document: Tom> http://orgmode.org/w/?p=worg.git;a=blob;f=org-contrib/babel/languages/ob-doc-template.org;hb=HEAD Tom> I don't know the first thing about Perl, but I'll be happy to help if Tom> there are questions about getting to ob-doc-perl from the template. It sounds good. I'll do it. I'll probably have it ready the end of the week or beginning of next. I'll also take care of SQL, which I have been using under Org too. --dmg Tom> All the best, Tom> Tom Tom> -- Tom> Thomas S. Dye Tom> http://www.tsdye.com -- Daniel M. German "Science can be esoteric The Economist -> technology has to be pragmatic" http://turingmachine.org/ http://silvernegative.com/ dmg (at) uvic (dot) ca replace (at) with @ and (dot) with .
[O] performance of exporting large tables
hi everybody, I have a table with 15 columns and 500 rows. One of the columns is a URL. org-mode is hanging while exporting the table. It does not seem to crash, but it is taking a significant amount of time. The worst part is that it does not appear to be linear. 80 rows -> 17 seconds 160 rows (same 80 rows duplicated) -> 58 seconds 160 rows, 8 columns -> 21 seconds (it seems to not matter which columns there are). I wonder if this is expected behaviour. Given that org does not sort the tables, why does the time increase non-linearly to the size of the table? If interested, I can make the table available. thanks a lot! --daniel -- Daniel M. German "And ye shall know the truth, John 8:32 ->and the truth shall make you free." http://turingmachine.org/ http://silvernegative.com/ dmg (at) uvic (dot) ca replace (at) with @ and (dot) with .
Re: [O] performance of exporting large tables
Hi Suvayu, Suvayu> Hi Daniel, Suvayu> On Thu, May 16, 2013 at 01:24:10PM -0700, D M German wrote: >> >> If interested, I can make the table available. Suvayu> A working example that reproduces the issue always helps. If you could Suvayu> post the table (of course after removing sensitive/private information) Suvayu> it would be great help for the developers and testers. Here is a trivial example: http://turingmachine.org/~dmg/temp/bigTable.org (you can do anything with this file, including adding it to any battery of tests in the future). - Latex works well (export within a couple of seconds) - ASCII, HTML, Markdown (based on html so no surpise) take more than a minute Does anybody know where the processing might be taking time? thanks again, --daniel Suvayu> Thanks, Suvayu> -- Suvayu> Suvayu Suvayu> Open source is the future. It sets us free. -- Daniel M. German "Operating systems are like underwear, Bill Joy -> nobody really wants to look at them." http://turingmachine.org/ http://silvernegative.com/ dmg (at) uvic (dot) ca replace (at) with @ and (dot) with .
Re: [O] performance of exporting large tables
Nicolas Goaziou twisted the bytes to say: Nicolas> Nicolas Goaziou writes: >> I am going to have a look at this. Nicolas> I pushed a commit caching the results of some table functions. Export of Nicolas> large tables should be a lot faster (I get 6 s now; it was 90 s before). Hi Nicolas, thank you very much. This has resolved my issue. I can now export an org file with these tables in few seconds. thank you, --daniel Nicolas> Regards, Nicolas> -- Nicolas> Nicolas Goaziou -- Daniel M. German "To read is to travel without all the hassles of luggage." Emilio Salgari http://turingmachine.org/ http://silvernegative.com/ dmg (at) uvic (dot) ca replace (at) with @ and (dot) with .
[O] overview of org files
Hi everybody, here is a small contribution to the org project. It is a "dashboard" of org files in your main org directory. It shows, in a table, each of the org files, including its title (#+TITLE: field) and the filename. Date Title Filename -- 13/05/29 Cooking /home/dmg/org/cooking.org 13/05/29 Project X /home/dmg/org/x.org 13/05/29 The different licenses /home/dmg/org/licenses.org 13/05/29 Todo File /home/dmg/org/todo.org 13/05/28 Linux /home/dmg/org/linux.org 13/05/28 Notes /home/dmg/org/notes.org >From there, if you press return, you will visit that particular file. the code is here: https://github.com/dmgerman/org-manage Hopefully somebody finds it useful. --dmg -- Daniel M. German "Beauty is the first test; there is no permanent place in the world for ugly G. H. Hardy -> mathematics." http://turingmachine.org/ http://silvernegative.com/ dmg (at) uvic (dot) ca replace (at) with @ and (dot) with .
Re: [O] question about org-coderef-label-format and HTML export
Nicolas Goaziou twisted the bytes to say: Nicolas> Hello, Nicolas> dmg writes: >> I was playing with org-coderef-label-format to reference lines of code >> in blocks. >> >> I created a small example that overrides the default value: >> >> #+BEGIN_SRC C++ :main no :flags -std=c++14 -Wall --pedantic -Werror >> :results output :exports both -r -l "//(ref:%s)" +n Nicolas> Switches are to be located before Babel parameters: #+begin_src C++ -r -l "//(ref:%s)" +n :main no .. Thank you, Nicolas, I appreciate your response. It almost works now. I think I found a bug. It works in some cases but not in others: the following code properly defines the references abc and bfc. But it does not define the one for (ref:jump). Here is a link to the exported HTML file: http://turingmachine.org/~dmg/temp/ref-test.html http://turingmachine.org/~dmg/temp/ref-test.org #+BEGIN_SRC C++ -r -l "//(ref:%s)" +n :main no :results output :exports both #include int main() { //(ref:abc) std::cout << "Hello world" << std::endl; std::cout << "Hello world 2" << std::endl; //(ref:jump) return 0; //(ref:bcf) } #+END_SRC Nicolas> Regards, thank you again, --daniel Nicolas> -- Nicolas> Nicolas Goaziou -- Daniel M. German "Computer Science is no more about computers than astronomy Edsger Dijkstra -> is about telescopes" http://turingmachine.org/ http://silvernegative.com/ dmg (at) uvic (dot) ca replace (at) with @ and (dot) with .
Re: [O] function to select text of in a cell of a table
Kaushal Modi twisted the bytes to say: Kaushal> Check out this earlier thread: Kaushal> https://lists.gnu.org/archive/html/emacs-orgmode/2016-05/msg00240.html Kaushal> You probably just need the org-table-mark-field definition from that. thank you both very much. Kaushal, your function is exactly what I needed. --daniel Kaushal> On Sat, Dec 31, 2016, 8:28 AM Charles C. Berry wrote: >> On Fri, 30 Dec 2016, dmg wrote: >> >> > hi everybody, >> > >> > has anybody written a function to select the text in a cell of a table? >> >> If you mean like what ob-ref.el uses to support babel references, yes. >> >> Also see org-table.el. >> >> If you just want support for working with Babel src blocks, see >> >> (info "(org) var") >> >> HTH, >> >> Chuck >> >> -- Kaushal> Kaushal Modi -- Daniel M. German "If Microsoft ever does applications Linus Torvalds -> for Linux it means I've won." http://turingmachine.org/ http://silvernegative.com/ dmg (at) uvic (dot) ca replace (at) with @ and (dot) with .
Re: [O] bug report: ox-html with coderef links needs a space between attributes in element (with patch)
Nicolas Goaziou twisted the bytes to say: >> >> I am running version 9.0.3 of org. >> >> I believe this patch will solve the issue. It simply adds a space before >> the class attribute. Nicolas> It works but I eventually applied a slightly different patch. Thank you Nicolas> for both the report and the patch. thank you very much! --daniel Nicolas> Regards, Nicolas> -- Nicolas> Nicolas Goaziou -- Daniel M. German "For indeed who is there alive that will not be swayed by his bias and partiality to Jonathan Swift -> the place of his birth?" http://turingmachine.org/ http://silvernegative.com/ dmg (at) uvic (dot) ca replace (at) with @ and (dot) with .
Re: [O] Bug report: export to HTML does not escape * in example
Hi Charles, everybody, >> I am running a babel script that generates, as one of its line * in the >> front: >> >> #+BEGIN_SRC sh >> echo "* Hello" >> #+END_SRC >> >> #+RESULTS: >> #+begin_example >> * Hello >> #+end_example >> >> In that case, should babel be the one escaping the * in the RESULTS block? Charles> Is that *really* what it did? Charles> When I run your example, I get: Charles> #+RESULTS: Charles> : * Hello Charles> and this exports (with the `:exports results' header) to html wrapped in a container: Charles> Charles> * Hello Charles> Charles> using Org 9.0.5. Charles> Without that header the src code gets wrapped in a container. Charles> So there must be something in/about your setup you haven't mentioned. Charles> HTH, Charles> Chuck I looked a bit into my configuration. In my configuration, I set the value of org-babel-min-lines-for-block-output to 0. The default value of this variable is by default 10. When the number of lines in the output is larger than it, it uses EXAMPLE blocks rather than the escaped ones. So the original issue (* not being escaped) will nonetheless appear when the threshold is passed: Here is an example (I run it with emacs -nw -q, using emacs25) org version 8.2.10 (this works also in my configuration under 9.0.2) #+BEGIN_SRC emacs-lisp :results output (dotimes (i 2) (print '*hello)) #+END_SRC #+RESULTS: : : *hello : : *hello #+BEGIN_SRC emacs-lisp :results output (dotimes (i 10) (print '*hello)) #+END_SRC #+RESULTS: #+begin_example *hello *hello *hello *hello *hello #+end_example thank you all again, -- Daniel M. German "Cyberspace. A consensual hallucination experienced daily by billions William Gibson -> of legitimate operators in every nation" http://turingmachine.org/ http://silvernegative.com/ dmg (at) uvic (dot) ca replace (at) with @ and (dot) with .
Re: [O] bug report: + is not escaped in org-link-escape
Nicolas Goaziou twisted the bytes to say: Nicolas> Hello, Nicolas> dmg writes: >> org-link-escape only replaces space, [, ], and % >> >> but search in google/gmail is replacing + also. >> >> The simplest solution is to add 43 to org-link-escape-chars: >> >> org-link-escape-chars is a variable defined in ‘org.el’. >> Its value is (32 91 93 37) >> >> This variable may be risky if used as a file-local variable. Nicolas> `org-link-escape' is for internal links, not for general URL-encoding. Nicolas> You may want to use `url-encode-url' instead. this indeed addresses the issue I was having. thank you very much for your response. --daniel -- Daniel M. German "It is useless to punish a man unless he knows why he is punished... Punishment must be unusual R. Heinlein -> or it serves no purpose." http://turingmachine.org/ http://silvernegative.com/ dmg (at) uvic (dot) ca replace (at) with @ and (dot) with .