Re: [O] Clicking on URL does convert some special characters
Hello, I just realized a diff in behavior between 3 URL entered in the Org buffer with slight differences: - http://web.com/file.php?name=Reppath=%2FPROJ%2FSomeFile.txt This one is correctly exported, but when clicking on it from the Org buffer, the URL opened in the browser is http://web.com/file.php?name=Reppath=%252FPROJ%252FSomeFile.txt, ^^ ^^ hence path not found error. - [[http://web.com/file.php?name=Reppath=%2FPROJ%2FSomeFile.txt]] Works OK in Org and in exported HTML file. - [[http://web.com/file.php?name=Reppath=%2FPROJ%2FSomeFile.txt][Description]] Idem. Same as or 99% similar to https://lists.gnu.org/archive/html/emacs-orgmode/2011-08/msg00513.html 1. When link is entered through C-c C-l org unescapes it. As a result the link in the buffer IS DIFFERENT from the entered URL. This is a CRITICAL bug. , In org-insert-link | | (setq link (read-string Link: | (org-link-unescape | (org-match-string-no-properties 1 ` 2. When the Org buffer is exported to html or odt , In org-html-handle-links | (setq path (save-match-data (org-link-unescape == | (match-string 3 line | (setq type (cond | ((match-end 2) (match-string 2 line)) | ((save-match-data |(or (file-name-absolute-p path) |(string-match ^\\.\\.?/ path))) | file) | (t internal))) | (setq path (org-extract-attributes (org-link-unescape path))) == ` link unescape happens twice. Asymmetry due to One link escape + two link unescape asymmetry creates problem on export. Based on historical research, the second org-link-unescape can be removed. The fact that attributes can be entered at C-c C-l prompt is largely documented and so the second call to org-link-unescape can largely be removed. Jambunathan K. Best regards, Seb --
Re: [O] Bug: org-table latex export does not honour alignment [7.5]
Hi Eric, Thanks for the response. Yes, I'm aware of that, but it seems unnecessary when I have already used the alignments in the table (and of course if you want HTML to be the same alignment as latex then you would have to do both). I have a patch that fixes this issue and behaves the same when alignment is not specified (or is specified via the attr_latex). This patch is actually against org version 7.7. Not totally sure the best delivery method, but it is short so I include here. Let me know what you think Thanks, -Arik == diff -U3 /usr/local/share/emacs/site-lisp/org-latex.el /Users/arikm/devel/org-latex-table-export-align-fix.el --- /usr/local/share/emacs/site-lisp/org-latex.el 2011-07-28 20:35:40.0 +1000 +++ /Users/arikm/devel/org-latex-table-export-align-fix.el 2011-09-08 16:31:32.0 +1000 @@ -1867,9 +1867,11 @@ (org-table-last-alignment (copy-sequence org-table-last-alignment)) (org-table-last-column-widths (copy-sequence org-table-last-column-widths)) +(forced-aligns (org-find-text-property-in-string +'org-forced-aligns raw-table)) fnum fields line lines olines gr colgropen line-fmt align - caption width shortn label attr floatp placement -longtblp tblenv tabular-env) + alignments caption width shortn label attr floatp + placement longtblp tblenv tabular-env) (if org-export-latex-tables-verbatim (let* ((tbl (concat \\begin{verbatim}\n raw-table \\end{verbatim}\n))) @@ -1944,12 +1946,21 @@ (when (and (not org-export-latex-tables-column-borders) (string-match ^\\(|\\)?\\(.+\\)|$ line-fmt)) (setq line-fmt (match-string 2 line-fmt))) + ;; incorporate forced alignment defaulting to right alignment + (dotimes (i (length fields)) + (let ((forced forced-aligns) + (a r)) + (while forced + (when (= (car (car forced)) (- (length fields) i)) + (setq a (cdr (car forced + (setq forced (cdr forced))) + (push a alignments))) ;; format alignment (unless align (setq align (apply 'format (cons line-fmt - (mapcar (lambda (x) (if x r l)) - org-table-last-alignment) + (mapcar (lambda (x) x) + alignments) ;; prepare the table to send to orgtbl-to-latex (setq lines (mapcar =
[O] [bug] equations in latex equation environment with leading +/- misinterpreted
Hello, the attached org file illustrates a problem with the latex exporter in which any line within a \begin{equation}...\end{equation} that begins with a + or - is interpreted as a list item. It's easy enough to avoid this problem by either reformatting the lines in question or by enclosing the equation block in a LATEX org block. Therefore, there's no urgency in addressing this bug. Thanks, eric # -*- coding: utf-8; -*- #+TITLE: examplebug.org #+AUTHOR:Eric S Fraga #+EMAIL: e.fr...@ucl.ac.uk #+OPTIONS: H:3 num:t toc:nil \n:nil @:t ::t |:t ^:t -:t f:t *:t :t #+OPTIONS: TeX:t LaTeX:t skip:nil d:nil todo:t pri:nil tags:nil * equation with leading minus sign The following equation \begin{equation} \label{eq:test} y = 3 x - 5 + 4 \end{equation} illustrates a problem in \LaTex export where the leading arithmetic operators are interpreted as list entries. A snippet of the \LaTeX code generated on export is here: #+begin_example The following equation \begin{equation} \label{eq:test} y = 3 x \begin{itemize} \item 5 \item 4 \end{itemize} \end{equation} illustrates a problem in \LaTex export where the leading arithmetic operators are interpreted as list entries. #+end_example -- : Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.50.1 : using Org-mode version 7.7 (release_7.7.261.g2178)
Re: [O] Bug: org-table latex export does not honour alignment [7.5]
Arik Mitschang arik.mitsch...@gmail.com writes: Hi Eric, Thanks for the response. Yes, I'm aware of that, but it seems unnecessary when I have already used the alignments in the table (and of course if you want HTML to I agree but at least there's a workaround. be the same alignment as latex then you would have to do both). I have a patch that fixes this issue and behaves the same when alignment is not specified (or is specified via the attr_latex). This patch is actually against org version 7.7. Not totally sure the best delivery method, but it is short so I include here. Let me know what you think I'll leave this for others more capable in patching etc.! -- : Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.50.1 : using Org-mode version 7.7 (release_7.7.261.g2178)
Re: [O] HTML export headers
i don;t see a defcustim to customize the meta tags generated in the html header, any clues? On Sat, Sep 3, 2011 at 04:32, Jambunathan K kjambunat...@gmail.com wrote: Aditya Mandayam adity...@gmail.com writes: Hello, HTML export produces the following header right now, for example: Is there anyway to customise this? M-x customize-group RET org-export-html RET Look at all the options and see whether something interests you. Or you can do M-: (find-file (locate-library org-html.el)) and search for the specific string that you are querying for. Look around to see where the nearby `defcustom' are. Option 2 is likely to fast and efficient. Jambunathan K. Muchas gracias, A --
Re: [O] A manuscript on reproducible research introducing org-mode
Thomas S. Dye t...@tsdye.com a écritnbsp;: Christophe Pouzat christophe.pou...@parisdescartes.fr writes: Dear all, M. Delescluse, R. Franconville, S. Joucla, T. Lieury and myself (C. Pouzat) have just put a manuscript entitled: Making neurophysiological data analysis reproducible. Why and how? on a pre-print server: http://hal.archives-ouvertes.fr/hal-00591455/fr/ Although the paper has been written for a neurobiological journal, the reader does not have to be a neuroscientist to read and understand it. A toy example illustrating the use of org-mode + Babel (with Python and Octave) takes a fair part of the manuscript. Other tools like R + Sweave are presented and many more are mentioned. I thank Eric Schulte for comments on the manuscript and Eric (again) together with the whole org-mode / Babel community for developing such a great tool. Any comment, remark, suggestion on the manuscript is of course welcome. Christophe Aloha Christophe, Thank you for an interesting and useful paper. I was happy with the distinction you draw between reproducible analysis and reproducible research, which certainly applies to my field of archaeology where unique sites are typically destroyed by the data collection effort. I also think the emphasis you place on data preprocessing is just the right approach; inclusion of the raw data in a reproducible analysis opens up many possibilities, which must be a benefit to a scientific community's pursuit of knowledge. May I offer a suggestion? Carsten Dominik published the Org Mode 7 Manual last year and it would be nice to see it cited in your paper. @book{dominik10:_org_mode_refer_manual, author = {Carsten Dominik}, title ={The Org Mode 7 Reference Manual: Organize Your Life with GNU Emacs}, publisher ={Network Theory Ltd.}, year = 2010 } All the best, Tom -- Thomas S. Dye http://www.tsdye.com Dear Tom, Thanks for these interesting and positive comments. I apologize for forgetting the obvious reference to Carsten's reference manual. I will definitely include it in the next version. I hope that people in my field will come to think the way you do about sharing their raw data. I'm just afraid that the way is still long… but the goal is reachable. Raw data aside, org-mode is surely a tool which should help people experimenting with the reproducible research paradigm. As I wrote to Eric (Schulte), M. Delescluse and I wrote a first RR manuscript 6 years ago based on R/Sweave. The manuscript never got submitted for different reasons, among them, the amount of work required to learn R and LaTeX. Learning about org-mode convinced me that it would be worth re-activating the project. Christophe Most people are not natural-born statisticians. Left to our own devices we are not very good at picking out patterns from a sea of noisy data. To put it another way, we are all too good at picking out non-existent patterns that happen to suit our purposes. Bradley Efron Robert Tibshirani (1993) An Introduction to the Bootstrap -- Christophe Pouzat Laboratoire de Physiologie Cerebrale CNRS UMR 8118 UFR biomedicale de l'Universite Paris-Descartes 45, rue des Saints Peres 75006 PARIS France tel: +33 (0)1 42 86 38 28 fax: +33 (0)1 42 86 38 30 mobile: +33 (0)6 62 94 10 34 web: http://www.biomedicale.univ-paris5.fr/physcerv/C_Pouzat.html
Re: [O] Use id property as anchor in the Table of Contents
2011/9/8 Bernt Hansen be...@norang.ca Pere Quintana Seguí pquint...@obsebre.es writes: Hi, I'm using Org-mode to publish my website. One of my site's pages has a lot of sections and the number of sections is increasing rapidly. My problem is that the HTML exporter, in the Table of Contents, is using the section numbers as anchors. As the section numbers change with time, I can't get stable links across versions of the document. As many of the sections (headings) have id properties, I'd like the HTML exporter to use them as anchor for the Table of Contents, when available. Is this possible? I didn't find an answer in the manual. As an example. This is the document I'm working on: http://pere.quintanasegui.com/diccionari-tecnologia.html#sec-2-78 As you can see, section 2.78, called RSS, has the anchor sec-2-78. If the anchor was its id 04E3903E-EAF1-499F-98CD-9E3E4BA0806A, the link would remain the same in the future. I don't mind if the URL is not human readable. Sec-2-78 isn't human readable too. Hi Pere, You can manually provide CUSTOM_ID properties. These ids are used in the TOC. e.g. * Reminders :PROPERTIES: :CUSTOM_ID: Reminders :END: for http://doc.norang.ca/org-mode.html#Reminders OK, thanks for the tip. That's an option, but unfortunately it is not automatic. I don't know if there is a way to use the ID property automatically. Unfortunately I don't know lisp, so I can't modify org-mode to provide this feature :'( If anyone is willing, I would be very grateful. Thanks, Pere
[O] Exporting verbatim html that should not be part of an outline div
Hello, I'm trying to get a sidebar when exporting an org file to HTML and I'm stuck with getting my verbatim html into a separate div. The produced html should look like this div id=content ... outlines ... /div div id=sidebar /div It doesn't matter to me if the sidebar div is before or after the content div but it shouldn't be a child of it. Placing the verbatim HTML after any part of subtree won't work as the html will become part of this outline div. Placing the verbatim HTML before the first top level node won't work either, the div will be part of the content div. I currently work around this with the :html-postamble and add css for the postamble div but this is rather ugly and put parts of my document into the my org-mode configuration. Another options seems to set the postamble on a per file level but I have no idea how to do that. Is that a missing feature or am I overseeing anything? Cheers, Philipp
Re: [O] Date-centric Clocktable
On Sep 7, 2011, at 5:53 PM, Rasmus wrote: In my experience this is the kind of table most working class heroes will need to hand in. At my last job this was the sort of table I needed to produce, too. -- A. Ryan Reynolds
[O] [babel] VC-Log does not run correctly
#+TITLE: Last VC Log #+AUTHOR:Seb Vauban #+DATE: 2011-09-08 #+LANGUAGE: en #+OPTIONS: num:nil toc:nil * Abstract I'm trying to get, from the VC backend (currently SVN in my case), the name and date of the last committer. Eventually, as well the last log message. Therefore, I try to use the =vc-log= function in the Library of Babel, copied back in this buffer, for the sake of simplicity. When calling =C-c C-e b= on this buffer, I get asked by Emacs: Buffer has a running process; kill it? (yes or no) - If I don't say anything, the export process is just hanging in the blue... - If I say yes, the export process really begins, but there is no vc log inserted where I expect it. - Exactly the same (as if I say yes) happens if I say no: export goes on, but no vc log! What could go wrong here? * Org Source #+source: vc-log #+headers: :var limit=-1 #+headers: :var buf=(buffer-name (current-buffer)) #+begin_src emacs-lisp :exports none ;; Most of this code is copied from vc.el vc-print-log (require 'vc) (when (vc-find-backend-function (vc-backend (buffer-file-name (get-buffer buf))) 'print-log) (let ((limit -1) (vc-fileset nil) (backend nil) (files nil)) (with-current-buffer (get-buffer buf) (setq vc-fileset (vc-deduce-fileset t)) ; FIXME: Why t? --Stef (setq backend (car vc-fileset)) (setq files (cadr vc-fileset))) (with-temp-buffer (let ((status (vc-call-backend backend 'print-log files (current-buffer (when (and (processp status) ; Make sure status is a process (= 0 (process-exit-status status))) ; which has not terminated (while (not (eq 'exit (process-status status))) (sit-for 1 t))) (buffer-string) #+end_src Last edited by XXX on XXX #+call: vc-log() * HTML Result #+begin_src html Last VC Log Org Source Last edited by XXX on XXX Working file: c:/home/sva/ecm.org Date: 2011-09-08 Author: Seb Vauban Validate XHTML 1.0 #+end_src As you can see, there is no vc log at all, well the header of the vc log buffer: Working file: c:/home/sva/ecm.org * Messages buffer #+begin_src text Export buffer: Exporting... Running svn status -v ecm.html in foreground... Running svn status -v ecm.html...OK = 0 Position saved to mark ring, go back with M-x org-mark-ring-goto. (info) +- Requiring `help-fns'... already loaded [6 times] executing Emacs-Lisp code block (vc-log)... (buf (quote ecm.org)) (limit (quote -1)) Running svn log -rHEAD:0 ecm.org in background... done Working file: c:/home/sva/ecm.org (info) +- Requiring `help-fns'... already loaded executing Emacs-Lisp code block... (results (quote Working file: c:/home/sva/ecm.org )) Code block evaluation complete. org-babel-exp processing... org-babel-exp processing... Exporting... Saving file c:/home/sva/ecm.html... Wrote c:/home/sva/ecm.html Running svn status -v ecm.html in foreground... Running svn status -v ecm.html...OK = 0 Exporting... done #+end_src Any idea on how to help me going further with this? Best regards, Seb -- Sebastien Vauban
[O] Odd export of a selected tree
Hi, Consider a file containing something like: * Test :export: * Test 2 And now export it, say to ascii format. I get a buffer containing: 1 Test :export: Is this expected? Thanks, Eythan
[O] [babel] Export problem (Wrong type argument: consp, nil)
Hi, #+TITLE: Export problem #+AUTHOR:Seb Vauban #+DATE: 2011-09-08 #+LANGUAGE: en * Works OK #+source: square(x=6) #+begin_src python return x*x #+end_src * Does not work If there is no value assigned to the code block... #+source: circle(x) #+begin_src python return x*x #+end_src ... there is no an error when exporting: #+begin_src text Debugger entered--Lisp error: (wrong-type-argument consp nil) setcdr(nil nil=x) (setf (cddr (nth variable-index vars)) (concat (symbol-name ...) = (cdr pair))) (prog1 (setf (cddr ...) (concat ... = ...)) (incf variable-index)) (if name (setq vars (append ... ...)) (prog1 (setf ... ...) (incf variable-index))) (let ((name ...)) (if name (setq vars ...) (prog1 ... ...))) (cond ((eql ... ...) (let ... ...)) ((eql ... ...) (setq results ...)) ((eql ... ...) (when ... ... ... ...)) ((eql ... ...) (setq exports ...)) ((eql ... ...) (setq tangle ...)) ((eql ... ...) (setq noweb ...)) ((eql ... ...) (setq cache ...)) ((eql ... ...) (setq padline ...)) ((eql ... ...) (setq shebang ...)) ((eql ... ...) (setq comments ...)) (t (setq params ...))) (case (car pair) (:var (let ... ...)) (:results (setq results ...)) (:file (when ... ... ... ...)) (:exports (setq exports ...)) (:tangle (setq tangle ...)) (:noweb (setq noweb ...)) (:cache (setq cache ...)) (:padline (setq padline ...)) (:shebang (setq shebang ...)) (:comments (setq comments ...)) (t (setq params ...))) (lambda (pair) (case (car pair) (:var ...) (:results ...) (:file ...) (:exports ...) (:tangle ...) (:noweb ...) (:cache ...) (:padline ...) (:shebang ...) (:comments ...) (t ...)))((:var . x)) mapc((lambda (pair) (case (car pair) (:var ...) (:results ...) (:file ...) (:exports ...) (:tangle ...) (:noweb ...) (:cache ...) (:padline ...) (:shebang ...) (:comments ...) (t ...))) ((:var . x))) (lambda (plist) (mapc (lambda ... ...) plist))(((:var . x))) mapc((lambda (plist) (mapc (lambda ... ...) plist)) (((:var . x)) ((:comments . ) (:shebang . ) (:cache . no) (:padline . ) (:noweb . no) (:tangle . no) (:exports . code) (:results . replace) (:padnewline . yes) (:hlines . no) (:session . none (progn (fset (quote e-merge) (function* ...)) (mapc (lambda ... ...) plists)) (unwind-protect (progn (fset ... ...) (mapc ... plists)) (if --cl-letf-bound-- (fset ... --cl-letf-save--) (fmakunbound ...))) (let* ((--cl-letf-bound-- ...) (--cl-letf-save-- ...)) (unwind-protect (progn ... ...) (if --cl-letf-bound-- ... ...))) (letf ((... ...)) (mapc (lambda ... ...) plists)) (letf* ((... ...)) (mapc (lambda ... ...) plists)) (flet ((e-merge ... ...)) (mapc (lambda ... ...) plists)) (let ((results-exclusive-groups ...) (exports-exclusive-groups ...) (variable-index 0) params results exports tangle noweb cache vars shebang comments padline) (flet (...) (mapc ... plists)) (setq vars (reverse vars)) (while vars (setq params ...)) (mapc (lambda ... ...) (quote ...)) params) org-babel-merge-params(((:var . x)) ((:comments . ) (:shebang . ) (:cache . no) (:padline . ) (:noweb . no) (:tangle . no) (:exports . code) (:results . replace) (:padnewline . yes) (:hlines . no) (:session . none))) (setcar (nthcdr 2 info) (org-babel-merge-params (mapcar ... ...) (nth 2 info))) (setf (nth 2 info) (org-babel-merge-params (mapcar ... ...) (nth 2 info))) (progn (setf (nth 2 info) (org-babel-merge-params ... ...))) (if (match-string 6) (progn (setf ... ...))) (when (match-string 6) (setf (nth 2 info) (org-babel-merge-params ... ...))) (progn (setq name (org-babel-clean-text-properties ...)) (when (match-string 6) (setf ... ...))) #+end_src Best regards, Seb -- Sebastien Vauban
Re: [O] Odd export of a selected tree
eythan...@gmail.com (Eythan Weg) writes: Hi, Consider a file containing something like: * Test :export: * Test 2 And now export it, say to ascii format. I get a buffer containing: 1 Test :export: Is this expected? Thanks, Eythan Aloha Eythan, I believe the answer to your question is yes. See http://orgmode.org/worg/org-tutorials/org-latex-export.html#sec-9 for an explanation. All the best, Tom -- Thomas S. Dye http://www.tsdye.com
[O] [odt][ANN] Embed links to mathml files as ODF formula
I am pleased to announce (preliminary) support for embedding mathml files as ODF formulae in odt documents. Specfically if one provides a link to mathml files as shown below [[./equation.mathml]] then the contents of the mathml file is embedded in the exported ODT document as a ODF formula. I intend to support link to *.odf files as well. (But this is not available yet). Moot point: I am still uncertain how the mathml equations specified in Org format. For example, does the current approach of using file links of the form *.mathml (or *.odf) extension sound OK? Should I use a new mathml:// link type? Please see the attached Org file for a quick demonstration of what the current set of changes mean. 1. Update work area 2. Copy mathml.org, formula1.mathml, formula2.mathml to the same directory 3. Use C-c C-e O to export. Currently the equations are embedded as unnumbered, display/paragraph types. IMPORTANT: I am following this mail with a patch to org.el which will add support for LaTeX-to-MathML conversion using an external converter. #+TITLE: mathml.org #+AUTHOR:Jambunathan K #+EMAIL: kjambunat...@gmail.com #+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:t 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: * Unnumbered Display Equation (Non-captioned) [[./formula1.mathml]] * Un-numbered Display Equation (Captioned) #+CAPTION: Kinetic Energy #+LABEL:Equation:1 [[file:formula2.mathml]] * COMMENT LaTeX Fragment #+CAPTION: Kinetic Energy #+LABEL:Equation:1 \begin{equation*} e = \frac{1}{2}mv^2 \end{equation*} ?xml version=1.0 encoding=UTF-8? math xmlns=http://www.w3.org/1998/Math/MathML; semantics mrow mix/mi mi mathvariant=normal=/mi msqrt mib/mi /msqrt /mrow annotation encoding=StarMath 5.0x = sqrt b/annotation /semantics /math ?xml version=1.0 encoding=UTF-8? math xmlns=http://www.w3.org/1998/Math/MathML; semantics mrow mrow mie/mi mi mathvariant=normal=/mi mfrac mn1/mn mn2/mn /mfrac /mrow msup mi mathvariant=italicmv/mi mn2/mn /msup /mrow annotation encoding=StarMath 5.0e=1 over 2 mv^2 /annotation /semantics /math mathml.odt Description: mathml.odt --
Re: [O] Reminders with alarms
*Recommend using flite (FestivalLite) for text-to-speech: cat blah.reminder | flite ** Could get really over-the-top and do something like this: http://gizmodo.com/5522802/twitter-chumby-and-a-cuckoo-bird-walk-into-a-clock?tag=chumby --you could use the Twitter API and send OrgMode Tweets (complete with reminders) to your personalized Chumby Cuckoo Clock!! ;-) P.S. I've used calendar/*Fancy Diary Entries* and appt.el for many years--works great--I just have it pop up a big blank emacs screen with the alarm reminder--I usually set it for 15 minutes ahead of the important reminder: ;;; appt.el --- appointment notification functions. ;; Copyright (C) 1989, 1990, 1994 Free Software Foundation, Inc. ;; Author: Neil Mager ne...@juliet.ll.mit.edu ... (setq appt-message-warning-time 15) (setq appt-display-interval 5) On Wed, Sep 7, 2011 at 11:10 PM, Jude DaShiell jdash...@shellworld.net wrote: In debian, there's a cowsay package you can use to make the computer speak. Also packages that produce different types of beeps are available. So far as I now know, they would need to be run as part of a bash script or the equivalent within emacs in order to work though. On Wed, 7 Sep 2011, Martyn Jago wrote: Hi Stephen Nelson-Smith sanel...@gmail.com writes: Hi there, I'm just starting to explore orgmode. I'm an experienced GTD-er (6 yrs) and have looked with interest at a few articles on using orgmode for this. The one area I can't seem to work out is how to set a reminder with an alarm and attach it to an entry. Suppose I have an entry like: ** My project *** My action 1 :home: *** My action 2 :follow up: I would like to be able to set a reminder that makes a visible (and maybe audible) alert - in say 4 hrs, 2 days, at 1530 next wednesday etc. I see that I can set schedules for when to start work, but I've been unable to get it to remind me at all. Any suggestions? S. I use the growl notification system (on MAC) along with todochiku.el for simple timer notification out of Emacs. Growl can be set to 'speak' the notification (not sure about other sounds). todochiku also works with (snarl/libnotify) on other OSs. The command todochiku-message allows you to add a notification to a hook such as org-timer-done-hook (in your init file)... --8---cut here---start-8--- (defun mj-notify-timer-done () (todochiku-message Title here Further text here (todochiku-icon 'bell))) (add-hook 'org-timer-done-hook 'mj-notify-timer-done)) --8---cut here---end---8--- Regards Martyn Jude jdash...@shellworld.net I love the Pope, I love seeing him in his Pope-Mobile, his three feet of bullet proof plexi-glass. That's faith in action folks! You know he's got God on his side. ~ Bill Hicks
Re: [O] [babel] Collection of code block snippets
Hi Eric Eric Schulte schulte.e...@gmail.com writes: Hi Martyn Martyn Jago martyn.j...@btinternet.com writes: Hi Eric Eric Schulte schulte.e...@gmail.com writes: [...] I just made three small changes to the testing framework so it is now possible to run the test suite in batch mode with the following. emacs -Q --batch -l path/to/org/testing/org-test.el --eval (setq org-confirm-babel-evaluate nil) -f org-test-run-all-tests Great idea - unfortunately its not quite working for me since I get four failing tests. In addition I have no (easy) indication of which four tests are failing since the backtrace is just the output of the tests working (no backtrace for failed tests). I'm getting four failing tests as well when I start Emacs with the -Q option and no failing tests when I run it with my configuration loaded. I will dig through my personal config, find out what options are making these tests pass, and adjust the tests appropriately so that they all pass with no personal config. This is what I like about the ert-run-batch commands - you get an indication and summary of tests passed, and the backtrace of any failures. Also, I mentioned that ert-batch.el and ert-run.el are not part of Emacs. This is actually because their contents were merged into ert.el within Emacs. Thanks for mentioning the batch ert commands, I was not aware of their existence. I've added a batch version of org-test-run-all-tests to the org-mode test suite, the following should now be sufficient to run the test suite from the command line with nicer output. #+begin_src sh emacs -Q --batch -l path/to/org/testing/org-test.el \ --eval (setq org-confirm-babel-evaluate nil) \ -f org-test-run-all-tests #+end_src Thats great - I'll try it out when I get a chance. I have written a few more tests for inline source blocks execution with org-ctrl-c-ctrl-c (not extensive by any means). The last two [:results scaler] and [:results verbatim] surprised me slightly since the manual suggests to me that they would be identical (although verbatim does what I would expect). , | - scalar, verbatim The results should be interpreted literally—they |will not be converted into a table. The results will be inserted into |the Org-mode buffer as quoted text. E.g., :results value verbatim. ` --8---cut here---start-8--- src_src_emacs-lisp[ :results scalar ]{ \x\ } =x= src_src_emacs-lisp[ :results verbatim ]{ \x\ } =x= --8---cut here---end---8--- From b0ea0a6e96188c8ee6861d6cbd04182eb966dbe3 Mon Sep 17 00:00:00 2001 From: Martyn Jago martyn.j...@btinternet.com Date: Thu, 8 Sep 2011 16:50:26 +0100 Subject: [PATCH] * testing/lisp/test-ob.el: More tests for inline source blocks execution via org-ctrl-c-ctrl-c --- testing/lisp/test-ob.el | 172 +++ 1 files changed, 172 insertions(+), 0 deletions(-) diff --git a/testing/lisp/test-ob.el b/testing/lisp/test-ob.el index e0f7c65..9735bd8 100644 --- a/testing/lisp/test-ob.el +++ b/testing/lisp/test-ob.el @@ -236,6 +236,178 @@ (should-not (org-babel-get-inline-src-block-matches)) ))) +(ert-deftest test-org-babel/inline-src_blk-default-results-replace-line-1 () + (with-temp-buffer + +;; src_ at bol line 1... +(let ((test-line src_sh{echo 1})) + (insert test-line) + (should-error (org-ctrl-c-ctrl-c)) + (goto-char (point-min)) (org-ctrl-c-ctrl-c) + (should (string= + (concat test-line =1=) + (buffer-substring-no-properties (point-at-bol) (point-at-eol + (forward-char) (org-ctrl-c-ctrl-c) + (should (string= + (concat test-line =1= =1=) + (buffer-substring-no-properties (point-at-bol) (point-at-eol + (re-search-forward 1}) + (should-error (org-ctrl-c-ctrl-c)) + (backward-char) ;; last char of block body + (org-ctrl-c-ctrl-c) + (should (string= + (concat test-line =1= =1= =1=) + (buffer-substring-no-properties (point-at-bol) (point-at-eol) + +;; src_ follows space line 1... +(let ((test-line src_emacs-lisp{ 1 })) + (beginning-of-line) + (insert (concat test-line \n)) + (goto-char (point-min)) + (should-error (org-ctrl-c-ctrl-c)) + (forward-char) (org-ctrl-c-ctrl-c) + (should (string= + (concat test-line =1=) + (buffer-substring-no-properties (point-at-bol) (point-at-eol + (re-search-forward { 1 ) (org-ctrl-c-ctrl-c) + (should (string= + (concat test-line =1= =1=) + (buffer-substring-no-properties (point-at-bol) (point-at-eol + (forward-char) + (should-error (org-ctrl-c-ctrl-c)) + ))) + +(ert-deftest test-org-babel/inline-src_blk-default-results-replace-line-2 () + (with-temp-buffer + +;; src_ at bol line 2... +(let ((test-line src_emacs-lisp{
[O] Mathjax export taking into account custom macros
Hello, there is an asymmetry between the html-export of latex-formulas by means of dvipng on the one hand and by means of mathjax on the other hand. The asymmetry concerns the handling of information provided by the #+LaTeX_HEADER: parameter. The parameter is taken into account when exporting by means of dvipng, but not when exporting by means of mathjax. Let me give a small example: *Scenario 1* Say we have a file test.org which looks as follows: #+OPTIONS: LaTeX:dvipng #+LaTeX_HEADER: \newcommand{\vd}{\vdash} * Header 1 $\vd$ Now exporting this file into html produces a png image with the |- symbol. *Scenario 2* Now our file test.org looks as follows: #+OPTIONS: LaTeX:t #+LaTeX_HEADER: \newcommand{\vd}{\vdash} * Header 1 $\vd$ [the only change is in line 1] Exporting this file produces a html file with \vd in red (meaning mathjax doesn't have a subroutine dealing with the command \vd). I am not sure if this is the intended behavior. I personally would prefer if the mathjax export would take into account the commands specified in the LaTeX_HEADER. A similar scenario we get with respect to the org-export-latex-default-packages-alist. I have a small style package with all my custom definitions that is listed in org-export-latex-default-packages-alist (with snippet toggled to 't'). Again the LaTeX:dvipng option takes into account the package while the mathjax export ignores it. For the example illustrated in the two examples I used a minimal setup with the following .emacs file: (setq load-path (cons ~/.emacs.d/org-mode/lisp load-path)) (setq load-path (cons ~/.emacs.d/org-mode/contrib/lisp load-path)) (require 'org-install) The org-mode is an up-to-date clone from git: M-x org-version returns: Org-mode version 7.7 (release_7.7.264.gbe69) Thanks! Best, Christian
Re: [O] [babel] Export problem (Wrong type argument: consp, nil)
Hi Seb, All variables must be given a default value, which is why it is an error to write a code block like the following. #+source: circle(x) #+begin_src python return x*x #+end_src I've just pushed up a change which provides a better error message in this case. Best -- Eric Sebastien Vauban wxhgmqzgw...@spammotel.com writes: Hi, #+TITLE: Export problem #+AUTHOR:Seb Vauban #+DATE: 2011-09-08 #+LANGUAGE: en * Works OK #+source: square(x=6) #+begin_src python return x*x #+end_src * Does not work If there is no value assigned to the code block... #+source: circle(x) #+begin_src python return x*x #+end_src ... there is no an error when exporting: #+begin_src text Debugger entered--Lisp error: (wrong-type-argument consp nil) setcdr(nil nil=x) (setf (cddr (nth variable-index vars)) (concat (symbol-name ...) = (cdr pair))) (prog1 (setf (cddr ...) (concat ... = ...)) (incf variable-index)) (if name (setq vars (append ... ...)) (prog1 (setf ... ...) (incf variable-index))) (let ((name ...)) (if name (setq vars ...) (prog1 ... ...))) (cond ((eql ... ...) (let ... ...)) ((eql ... ...) (setq results ...)) ((eql ... ...) (when ... ... ... ...)) ((eql ... ...) (setq exports ...)) ((eql ... ...) (setq tangle ...)) ((eql ... ...) (setq noweb ...)) ((eql ... ...) (setq cache ...)) ((eql ... ...) (setq padline ...)) ((eql ... ...) (setq shebang ...)) ((eql ... ...) (setq comments ...)) (t (setq params ...))) (case (car pair) (:var (let ... ...)) (:results (setq results ...)) (:file (when ... ... ... ...)) (:exports (setq exports ...)) (:tangle (setq tangle ...)) (:noweb (setq noweb ...)) (:cache (setq cache ...)) (:padline (setq padline ...)) (:shebang (setq shebang ...)) (:comments (setq comments ...)) (t (setq params ...))) (lambda (pair) (case (car pair) (:var ...) (:results ...) (:file ...) (:exports ...) (:tangle ...) (:noweb ...) (:cache ...) (:padline ...) (:shebang ...) (:comments ...) (t ...)))((:var . x)) mapc((lambda (pair) (case (car pair) (:var ...) (:results ...) (:file ...) (:exports ...) (:tangle ...) (:noweb ...) (:cache ...) (:padline ...) (:shebang ...) (:comments ...) (t ...))) ((:var . x))) (lambda (plist) (mapc (lambda ... ...) plist))(((:var . x))) mapc((lambda (plist) (mapc (lambda ... ...) plist)) (((:var . x)) ((:comments . ) (:shebang . ) (:cache . no) (:padline . ) (:noweb . no) (:tangle . no) (:exports . code) (:results . replace) (:padnewline . yes) (:hlines . no) (:session . none (progn (fset (quote e-merge) (function* ...)) (mapc (lambda ... ...) plists)) (unwind-protect (progn (fset ... ...) (mapc ... plists)) (if --cl-letf-bound-- (fset ... --cl-letf-save--) (fmakunbound ...))) (let* ((--cl-letf-bound-- ...) (--cl-letf-save-- ...)) (unwind-protect (progn ... ...) (if --cl-letf-bound-- ... ...))) (letf ((... ...)) (mapc (lambda ... ...) plists)) (letf* ((... ...)) (mapc (lambda ... ...) plists)) (flet ((e-merge ... ...)) (mapc (lambda ... ...) plists)) (let ((results-exclusive-groups ...) (exports-exclusive-groups ...) (variable-index 0) params results exports tangle noweb cache vars shebang comments padline) (flet (...) (mapc ... plists)) (setq vars (reverse vars)) (while vars (setq params ...)) (mapc (lambda ... ...) (quote ...)) params) org-babel-merge-params(((:var . x)) ((:comments . ) (:shebang . ) (:cache . no) (:padline . ) (:noweb . no) (:tangle . no) (:exports . code) (:results . replace) (:padnewline . yes) (:hlines . no) (:session . none))) (setcar (nthcdr 2 info) (org-babel-merge-params (mapcar ... ...) (nth 2 info))) (setf (nth 2 info) (org-babel-merge-params (mapcar ... ...) (nth 2 info))) (progn (setf (nth 2 info) (org-babel-merge-params ... ...))) (if (match-string 6) (progn (setf ... ...))) (when (match-string 6) (setf (nth 2 info) (org-babel-merge-params ... ...))) (progn (setq name (org-babel-clean-text-properties ...)) (when (match-string 6) (setf ... ...))) #+end_src Best regards, Seb -- Eric Schulte http://cs.unm.edu/~eschulte/
Re: [O] [babel] Collection of code block snippets
Hi Martyn, I have written a few more tests for inline source blocks execution with org-ctrl-c-ctrl-c (not extensive by any means). Thanks for adding these tests, I get 6 failures all with the same error [1], is that intentional? If not would you mind taking another look at this patch? The last two [:results scaler] and [:results verbatim] surprised me slightly since the manual suggests to me that they would be identical (although verbatim does what I would expect). , | - scalar, verbatim The results should be interpreted literally—they |will not be converted into a table. The results will be inserted into |the Org-mode buffer as quoted text. E.g., :results value verbatim. ` src_src_emacs-lisp[ :results scalar ]{ \x\ } =x= src_src_emacs-lisp[ :results verbatim ]{ \x\ } =x= interesting, I get the same results for both scalar and verbatim... src_emacs-lisp[ :results scalar ]{ x } =x= src_emacs-lisp[ :results verbatim ]{ x } =x= Notice that I had to edit your pasted example for it to run w/o error on my system. Best -- Eric Footnotes: [1] new test results , | Selector: \\(org\\|ob\\) | Passed: 103 | Failed: 6 (6 unexpected) | Total: 109/109 | | Started at: 2011-09-08 11:39:15-0600 | Finished. | Finished at: 2011-09-08 11:39:20-0600 | | ..F..F... | | F test-org-babel/inline-src_blk-default-results-replace-line-1 | (error C-c C-c can do nothing useful at this location) | | F test-org-babel/inline-src_blk-results-file | (error C-c C-c can do nothing useful at this location) | | F test-org-babel/inline-src_blk-results-raw | (error C-c C-c can do nothing useful at this location) | | F test-org-babel/inline-src_blk-results-scaler | (error C-c C-c can do nothing useful at this location) | | F test-org-babel/inline-src_blk-results-silent | (error C-c C-c can do nothing useful at this location) | | F test-org-babel/inline-src_blk-results-verbatim | (error C-c C-c can do nothing useful at this location) | | ` -- Eric Schulte http://cs.unm.edu/~eschulte/
Re: [O] [babel] Collection of code block snippets
Hi Eric Eric Schulte schulte.e...@gmail.com writes: Hi Martyn, I have written a few more tests for inline source blocks execution with org-ctrl-c-ctrl-c (not extensive by any means). Thanks for adding these tests, I get 6 failures all with the same error [1], is that intentional? If not would you mind taking another look at this patch? The last two [:results scaler] and [:results verbatim] surprised me slightly since the manual suggests to me that they would be identical (although verbatim does what I would expect). , | - scalar, verbatim The results should be interpreted literally—they |will not be converted into a table. The results will be inserted into |the Org-mode buffer as quoted text. E.g., :results value verbatim. ` src_src_emacs-lisp[ :results scalar ]{ \x\ } =x= src_src_emacs-lisp[ :results verbatim ]{ \x\ } =x= interesting, I get the same results for both scalar and verbatim... Yes my bad - I have a problem with the spelling of scalar - they are the same here now. src_emacs-lisp[ :results scalar ]{ x } =x= src_emacs-lisp[ :results verbatim ]{ x } =x= Notice that I had to edit your pasted example for it to run w/o error on my system. Apologies, my hasty cut/pasting from tests to gnus. The only way I can generate any failures is by using your older command line script - even using your selector \\(org\\|ob\\) passes everything here. Interestingly, using my test-init.el based script with Emacs -batch -Q produces no errors either. I'll investigate further. Best, Martyn
[O] [PATCH] org.el: Add support for LaTeX to MathML conversion
IMPORTANT: I am following this mail with a patch to org.el which will add support for LaTeX-to-MathML conversion using an external converter. MathToWeb is available from http://www.mathtoweb.com/cgi-bin/mathtoweb_home.pl Your .emacs should look something like this. (custom-set-variables '(org-latex-to-mathml-convert-command java -jar %j -unicode -force -df %o %I) '(org-latex-to-mathml-jar-file ~/tmp-odt/mathtoweb.jar)) I am attaching odt files used with both dvipng and mathml options. The latex-mathml.odt reports an error on one of the $$ $$ equations. Note to reviewers: Can someone enhance the patch so that `org-latex-src-embed-type can take all the various anchors that a latex equation could use - inline, display-unnumbered, display-numbered, what else? Note to the users: 1. You need to not only apply this patch but also pull from the repo for full support. 2. Currently there is NO support for numbered and displayed equations which go like this x = y (1) y = z (2) From 762bffe1fc11d28502d6842c9b7d0049442ee2ef Mon Sep 17 00:00:00 2001 From: Jambunathan K kjambunat...@gmail.com Date: Fri, 9 Sep 2011 00:14:59 +0530 Subject: [PATCH] org.el: Add support for LaTeX to MathML conversion * lisp/org.el (org-latex-to-mathml-jar-file) (org-latex-to-mathml-convert-command): New user-customizable variables. (org-format-latex-mathml-available-p, org-create-math-formula) (org-format-latex-as-mathml): New functions. (org-format-latex): Add a new local variable block-type that notes the nature of the equation - inline or display. Associate it's value to `org-latex-src-embed-type' property of dvipng links. Add mathml as new processing type. --- lisp/org.el | 159 +-- 1 files changed, 154 insertions(+), 5 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index d63b854..b907338 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -16507,11 +16507,11 @@ Some of the options can be changed using the variable (plist-get (org-infile-export-plist) :latex-header-extra)) (cnt 0) txt hash link beg end re e checkdir executables-checked string - m n block linkfile movefile ov) + m n block-type block linkfile movefile ov) ;; Check the different regular expressions (while (setq e (pop re-list)) - (setq m (car e) re (nth 1 e) n (nth 2 e) - block (if (nth 3 e) \n\n )) + (setq m (car e) re (nth 1 e) n (nth 2 e) block-type (nth 3 e) + block (if block-type \n\n )) (when (member m matchers) (goto-char (point-min)) (while (re-search-forward re nil t) @@ -16540,7 +16540,7 @@ Some of the options can be changed using the variable '(org-protected t (add-text-properties (match-beginning n) (match-end n) '(org-protected t - ((or (eq processing-type 'dvipng) t) + ((eq processing-type 'dvipng) ;; Process to an image (setq txt (match-string n) beg (match-beginning n) end (match-end n) @@ -16596,7 +16596,156 @@ Some of the options can be changed using the variable (insert (org-add-props link (list 'org-latex-src (replace-regexp-in-string - \ txt) + \ txt) + 'org-latex-src-embed-type + (if block-type 'paragraph 'character)) + ((eq processing-type 'mathml) + ;; Process to MathML + (unless executables-checked + (unless (save-match-data (org-format-latex-mathml-available-p)) + (error LaTeX to MathML converter not configured)) + (setq executables-checked t)) + (setq txt (match-string n) + beg (match-beginning n) end (match-end n) + cnt (1+ cnt)) + (if msg (message msg cnt)) + (goto-char beg) + (delete-region beg end) + (insert (org-format-latex-as-mathml + txt block-type prefix dir))) + (t + (error Unknown conversion type %s for latex fragments + processing-type) + +(defcustom org-latex-to-mathml-jar-file nil + Value of\%j\ in `org-latex-to-mathml-convert-command'. +Use this to specify additional executable file say a jar file. + +When using MathToWeb as the converter, specify the full-path to +your mathtoweb.jar file. + :group 'org-latex + :type '(choice + (const :tag None nil) + (file :tag JAR file :must-match t))) + +(defcustom org-latex-to-mathml-convert-command nil + Command to convert LaTeX fragments to MathML. +Replace format-specifiers in the command as noted below and use +`shell-command' to convert LaTeX to MathML. +%j: Executable file in fully expanded form as specified by + `org-latex-to-mathml-jar-file'. +%I: Input LaTeX file in fully expanded form +%o: Output MathML file +This command is used by `org-create-math-formula'. + +When using MathToWeb as the converter, set this to +\java -jar %j -unicode -force -df %o %I\. + :group 'org-latex + :type '(choice + (const :tag None nil) + (string :tag \nShell command))) + +(defun org-format-latex-mathml-available-p ()
Re: [O] [babel] Collection of code block snippets
Hi Eric Martyn Jago martyn.j...@btinternet.com writes: Hi Eric Eric Schulte schulte.e...@gmail.com writes: Hi Martyn, I have written a few more tests for inline source blocks execution with org-ctrl-c-ctrl-c (not extensive by any means). Thanks for adding these tests, I get 6 failures all with the same error [1], is that intentional? If not would you mind taking another look at this patch? I reverse-engineered my =test-init.el= script using a call to =org-test-run-batch-tests= and from that worked out why your script was breaking tests. One problem on my system is that emacs was using the wrong org mode since the newer org location wasn't known about. Also, the languages, emacs-lisp and sh need to be switched on (I thought emacs-lisp was on by default)? Now all tests pass. My minimised script... --8---cut here---start-8--- (let ((org-dir ~/org-mode/)) (add-to-list 'load-path (concat org-dir lisp)) (add-to-list 'load-path (concat org-dir testing)) (require 'org-test) (setq org-confirm-babel-evaluate nil) (org-babel-do-load-languages 'org-babel-load-languages '((emacs-lisp . t) (sh . t))) (org-test-run-batch-tests)) --8---cut here---end---8--- Called by... --8---cut here---start-8--- emacs -Q -script ~/orgmode/testing/test-init.el --8---cut here---end---8--- Your modified script... --8---cut here---start-8--- emacs -Q -batch -L ~/org-mode/lisp ~/org-mode/testing -l org-test.el \ -eval (progn(setq org-confirm-babel-evaluate nil) \ (org-babel-do-load-languages 'org-babel-load-languages '((emacs-lisp \ . t) (sh . t -f org-test-run-batch-tests --8---cut here---end---8--- I've fixed my typos in test-ob.el below. Best, Martyn From a444094303e48cbb5f4027e83f8dcf60d240204b Mon Sep 17 00:00:00 2001 From: Martyn Jago martyn.j...@btinternet.com Date: Thu, 8 Sep 2011 22:34:38 +0100 Subject: [PATCH] * testing/lisp/test-ob.el: Fixed typo --- testing/lisp/test-ob.el |6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/testing/lisp/test-ob.el b/testing/lisp/test-ob.el index 9735bd8..1f04c5b 100644 --- a/testing/lisp/test-ob.el +++ b/testing/lisp/test-ob.el @@ -390,13 +390,13 @@ (should (string= (concat test-line [[file:~/test-file]]) (buffer-substring-no-properties (point-min) (point-max))) -(ert-deftest test-org-babel/inline-src_blk-results-scaler () +(ert-deftest test-org-babel/inline-src_blk-results-scalar () (with-temp-buffer -(let ((test-line src_emacs-lisp[ :results scaler ]{ \x\ })) +(let ((test-line src_emacs-lisp[ :results scalar ]{ \x\ })) (insert test-line) (goto-char (point-min)) (org-ctrl-c-ctrl-c) - (should (string= (concat test-line =x=) + (should (string= (concat test-line =\x\=) (buffer-substring-no-properties (point-min) (point-max))) (ert-deftest test-org-babel/inline-src_blk-results-verbatim () -- 1.7.3.4 [...]
Re: [O] Odd export of a selected tree
t...@tsdye.com (Thomas S. Dye) Thu, 08 Sep 2011 05:29:38 -1000 eythan...@gmail.com (Eythan Weg) writes: Hi, Consider a file containing something like: * Test :export: * Test 2 And now export it, say to ascii format. I get a buffer containing: 1 Test :export: Is this expected? Thanks, Eythan Aloha Eythan, I believe the answer to your question is yes. See http://orgmode.org/worg/org-tutorials/org-latex-export.html#sec-9 for an explanation. All the best, Tom -- Thomas S. Dye http://www.tsdye.com Thanks. I read the link. Still, do you mean that the tag :export: is expected to be exported in addition to the selected tree? Eythan
Re: [O] Change in org-babel with indenting code blocks?
Nick Dokos nicholas.do...@hp.com writes: Perhaps Seb Vauban identified the bug correctly (earlier in this thread): he pointed to the thread entitled Extra space inserted in repeated task's date line - see http://thread.gmane.org/gmane.emacs.orgmode/45623 In the current Org (updated today), this problem now affects *all* non-drawer text in entries, including code blocks, lists, and log entries! This is makes entry shifting completely useless to me. What do I need to revert to make it work again? Thanks, John
Re: [O] Change in org-babel with indenting code blocks?
John Wiegley jwieg...@gmail.com writes: In the current Org (updated today), this problem now affects *all* non-drawer text in entries, including code blocks, lists, and log entries! This is makes entry shifting completely useless to me. What do I need to revert to make it work again? Actually, it even worse: This affects all refiled blocks as well, resulting in the indentation of the refiled entry being the same as the original level it was captured in. I just went through my entire Org file by eye and found a huge number of indentation problems resulting from this bug. Help! John
Re: [O] [PATCH 0/5] loop over headlines in active region
At Wed, 07 Sep 2011 21:34:41 +0200, Štěpán Němec wrote: On Sun, 28 Aug 2011 15:57:19 +0200 David Maus wrote: At Thu, 25 Aug 2011 12:08:42 +0200, Štěpán Němec wrote: On Thu, 25 Aug 2011 06:25:29 +0200 David Maus wrote: As for the macro: What stop me to implement a macro for the generic operation is that for now the macro would depend on the global customization variable. That's not a problem per se but according to my readings about macros (mostly in context of Common Lisp, but that shouldn't matter) it should be considered bad style. Could you expand on this a bit? As far as I can tell, you obviously shouldn't depend on a customisation variable at macro expansion time, but I don't see how depending on it at run time is any different from a function doing the same. At expansion time the macro performs a transformation of the lisp at the place where the macro is used. At runtime the code of the expanded macro runs in the scope of the function where the macro was expanded into. A macro that uses a variable inside the expanded code that is not under its control (e.g. part of the argument list or gensym'd) is prone to introduce a bug caused by expanding the macro in an environment where this variable is not bound or used with a different semantics. In this particular case this should not be a problem indeed because we use a global dynamically scoped customization variable. Thus, whereever we would use the macro we can be sure the variable in the macro expansion is bound and carries the same meaning. So your what stop me to implement a macro argument is bogus, isn't it? I can't really comment on whether using a macro or not is the right thing here, but it seems to me you shouldn't base the decision on an invalid argument (IOW, from the fact that you even felt the need to explain why you didn't use a macro to begin with, it would appear to be the case that you would have preferred the macro way). One of the things Ford Prefect had always found hardest to understand about humans was their habit of continually stating and repeating the very very obvious, as in /It's a nice day/, or /You're very tall/, or /Oh dear you seem to have fallen down a thirty-foot well, are you all right?/ At first Ford had formed a theory to account for this strange behavior. If human beings don't keep exercising their lips, he thought, their mouths probably seize up. After a few months' consideration and observation he abandoned this theory in favor of a new one. If they don't keep on exercising their lips, he thought, their brains start working. After a while he abandoned this one as well as being obstructively cynical and decided he quite liked human beings after all, but he always remained desperately worried about the terrible number of things they didn't know about. Douglas Adams, The Hitchiker's Guide to the Galaxy -- OpenPGP... 0x99ADB83B5A4478E6 Jabber dmj...@jabber.org Email. dm...@ictsoc.de pgp5PevHSSLwv.pgp Description: PGP signature