Dealing with inter-org links vs #+include
Hi, I want what may be two conflicting things: - Produce a monolithic HTML export of an main org file that #+include:'s other org files. - Have links in the other org files that are valid both when the monolith is exported to HTML and when visiting the individual org files in Emacs. Below is a simple test. The "main.org" includes "a.org" and "b.org". The "b.org" has two types of links. The link: [[A][A by headline only]] is valid in the HTML export of "main.org" but it is not valid for Emacs visiting b.org (C-c C-o gives "No match - create this as a new heading?"). And then vice versa for the link: [[file:a.org::*A][A by file with headline]] I can follow that link in Emacs but it renders to an with "a.html#MissingReference". And export fails outright if I do not include #+options: broken-links:t Is there a way I can have my cake and eat it too? That is, how can I make a link between "sub" org files that can be followed by Emacs and also that produces a valid HTML link when the main.org is exported? Thanks! -Brett. $ ls *.org a.org b.org main.org $ for n in *.org echo "=== $n ===" cat $n end === a.org === * A This is A. === b.org === * B This is B. Links: - [[file:a.org::*A][A by file with headline]]. - [[A][A by headline only]]. === main.org === #+title: Main #+options: broken-links:t * Main This is main. * Includes #+include: a.org #+include: b.org * Links - A :: [[file:a.org]] - B :: [[file:b.org]] signature.asc Description: PGP signature
Re: [O] Org agenda
"M. P." writes: > I create a TODO and save the file but I can’t see the todo when I > select todo view in agenda? What am I doing wrong? Maybe your file is not in the org-agenda-files list. If so, a quick check is to visit the file and do "C-c [" (org-agenda-file-to-front). Then, recheck your agenda todo view. -Brett. signature.asc Description: PGP signature
Re: [O] why prepend "file://" to abs paths in html output?
Hi Nicolas, Nicolas Goaziou writes: > So, basically, upon exporting the following document to HTML: > > #+html_link_root: /tmp/ > [[/tmp/unicorn.jpg]] > > the link becomes > > Is this saying "subtract the value of 'html_link_root' from the Org link to make its URL"? If so, I think this would not be general enough to help some cases. For example, with Nikola+orgmode and with Nikola's "pretty URLs" option the relative location between either the Org source or its generated HTML and an image that they both link will differ. Some details: Nikola source wants this layout: /path/to/my/nikola/posts/my-blog-post.org /path/to/my/nikola/images/unicorn.jpg The Org source generates to HTML which will be found at this URL path: /mysiteroot/posts/my-blog-post/index.html So, right now, either the Org link to the image must be written to be invalid (for Org): [[../../images/unicorn.jpg]] Or, some mechanism needs to turn the valid Org link: [[../images/unicorn.jpg]] into either: or: I guess I could use html_link_root set to "/path/to/my/nikola" but then my Org source loses portability. I think better would be able to explicitly state the desired URL path for the HTML like: #+html_url_path: /mysiteroot/images/unicorn.jpg [[../images/unicorn.jpg]] -Brett. PS: imo, in this example, I think the real solution is to make Nikola allow for keeping org+img source together and to output org+img+html all together in one web directory. signature.asc Description: PGP signature
Re: [O] Overriding org-html-headline or other export functions?
Brett Viren writes: > Or, maybe you suggest I do direct "surgery" on the TEXT argument that > gets passed in to the filter and insert the "..." that way? I guess it > could work to find the end of the "" opening tag and then insert > my "..." part. I'll try this approach. Okay, this works but relies on searching through the HTML to find the end of "" tag. This feels like it will be error prone but so far it seems to work when processing my manual. In case it might help others, here is my filter: https://github.com/WireCell/wire-cell-docs/blob/master/manuals/publish.el#L7 My Elisp is bad, so maybe this is not done well And, for completeness there is now also the export-as-html, export-to-html and publish-to-html functions copied from ox-html and tweaked for this custom backend. Thanks for the nudges and help! -Brett.
Re: [O] Overriding org-html-headline or other export functions?
Marcin Borkowski writes: > It's been a while since I did that, but AFAIR deriving a new, slightly > midified backend may be exactly what you want, since you seem to need to > modify just one of the exporter functions. Right, by my concern is I'm copy-pasting a large function just to change basically one line. I understand that instead of simply stepping on org-* function namespace with my copy, I can rename my copy and make a derived exporter with my modified function registered as a filter. But that doesn't get away from now having a chunk of code that is at risk of diverging away as Org's original develops further. -Brett.
Re: [O] Overriding org-html-headline or other export functions?
"Charles C. Berry" writes: > You do have that wrong. This is exactly what export filters and > derived backends are for. In fact, you can use both. For an example, > see > > http://orgmode.org/worg/exporters/filter-markup.html > > You will want to change `latex' to `html' in the > > `(org-export-define-derived-backend ...)' > > call and delete all filters except for `:filter-headline'. And revise > `ox-mrkup-filter-headline' accordingly. Thanks for checking me on this, but I still don't see it. If I understand, a derived HTML backend with my own filter-headline would let me add my own extra HTML *outside* the "...", "...", etc, HTML that is generated by the base org-html-headline filter. But for the output I want I need to add my extra HTML *inside* the contents of the "..." tags. And I don't see an export filter for this "..." part. Or, maybe you suggest I do direct "surgery" on the TEXT argument that gets passed in to the filter and insert the "..." that way? I guess it could work to find the end of the "" opening tag and then insert my "..." part. I'll try this approach. -Brett.
[O] Overriding org-html-headline or other export functions?
Hi, I am writing a manual in Org which gets exported/published to HTML and styled with org-html-themes. I want the HTML to include a little icon next to each headline which is a direct link to the headline itself. Basically, I want to rip off what GitHub does when it renders Org. First, is there some way to achieve this headline link without explicitly adding it in the Org text or diving into Org Elisp? I couldn't find one so I took the latter route by copying out the whole of org-html-headline into the Emacs init Elisp file I used for publishing and fiddle with it until I got more or less what I wanted. Here are the lines tweaked: https://github.com/WireCell/wire-cell-docs/blob/master/manuals/publish.el#L69 Here is an example of the result: http://www.phy.bnl.gov/~bviren/wirecell.github.io/manual.html Is this copy+hack the proper way to tweak the exporting in this case? In particular, I worry about my copy of org-html-headline diverging from the real. I read about export filters and extending an existing back-end, but I think these do not apply, but maybe I have that wrong. Thanks for any suggestions! -Brett.
Re: [O] git and orgmode: teaching git a bit of orgmode syntax
Karl Voit writes: > -* NEXT test with DAVdroid > +* Lesestoff [1/26]:2read: > :PROPERTIES: > -:CREATED: [2016-05-08 Sun 12:51] > +:CREATED: [2012-04-17 Tue 10:39] > +:ARCHIVE: %s_archive::* Lesestoff > +:CATEGORY: reading > :END: Without seeing before/after versions it's not clear that this diff is somehow wrong. Depending on the editing one does to a given file, a diff may seem "non local" with some chunks appearing to undo something and others redoing it. This happens when parts of the file get rearranged. For example, do either of your headlines appear elsewhere in your diff with their "+/-" signs reversed? -Brett. signature.asc Description: PGP signature
Re: [O] XML dump of org file?
Aaron Ecay writes: > Have a look at the org-element library, Just to add, there are circular dependencies in this data structure due to ":parent" and potentially some of the ":structure" elements. They obviously need to be broken to avoid infinite loops. Here my hackish attempt to deal with this in order to dump org-element to JSON: https://github.com/brettviren/joyful-web/blob/master/joy/org2json.el See org-json-straigten-tree for how I nullified these elements. -Brett. signature.asc Description: PGP signature
Re: [O] Open Peer-Review Reproducible Publication with Org and GRASS
Thanks for your example. A few ideas: - When you begin developing your paper, or sometime before submission, make a break from your personal ~/.emacs.d/ environment and begin processing the .org in an explicitly configured Emacs session. Submit the needed, minimal, paper-specific Emacs setup as part of the supplementary material. - Bundle the document building into a shell script which calls Emacs so that you can assure that personal ~/.emacs.d/ is excluded and only the paper-specific Emacs setup is used. It also helps users to rebuild the paper, especially if they may not yet be Emacs aficionados. - Instead of multi-GB VM image, provide a few kB Dockerfile which can be used to build a Linux container with base OS and all required applications needed to run the Babel code blocks. - The Dockerfile could go so far as to create a user account, get the supplementary material from a repository or the publisher's web page, unpack and run the shell script which calls Emacs to build the document. If you go this far then in principle just this Dockerfile is enough to reproduce the paper - but this will rely on some binaries to remain available (Docker base OS images and OS packages). The reliance on long-term availability of the Docker base OS image and binary packages is problematic for long term automated reproducibility. However, even after those bits disappear from the 'net the Dockerfile serves as a concise and explicit recipe for future humans to follow. -Brett. Ken Mankoff writes: > Hi Org and GRASS lists, > > I just wanted to let these two lists know that I've just posted a > paper written in Org and using GRASS (text-mode) and Python for the > analysis. My goal was to create not just an open access publication, > but a fully reproducible publication. This is an early announcement, > and the paper may not pass peer review. > > The Supplemental Material is the Org file with all the code to > generate the document, beginning with downloading the 3rd party data > that is input to our analysis, the GRASS code to perform the analysis, > and the Python code to regenerate the figures. > > I don't think I did a great job on the reproducible part because I > have a highly customized .emacs, etc. All the information necessary to > replicate the work should be in the Supplemental Material, but it > might not be easy to do so. Anyway, I think it is a step in the right > direction. > > To make it easier to reproduce... including my emacs.org seems > overkill. Including a Virtual Machine that contains everything, > including my ~/.emacs.d/ and all the software and data seems like the > right thing to do, but journals don't want to host a 20 GB VM with the > publication. > > Thanks to people on these two lists who have developed the software and > helped me use it. > >-k. > > http://www.the-cryosphere-discuss.net/tc-2016-113/ signature.asc Description: PGP signature
Re: [O] Clocking work time vs. office time
Marcin Borkowski writes: > On 2016-04-29, at 11:21, Michael Welle wrote: > >> Marcin Borkowski writes: >> I assume that you use a laptop or some other portable device? In that >> case you can grep the IP address (which might change when you change >> workplaces) and timestamps from the log files (or create a script that >> logs the IP address changes to an ORG file) and then somehow (coughcough) >> integrate that into your report. > > That's actually an interesting (and not standard) idea. Even moreso > because I'm writing a RescueTime-like time-tracking tool for Emacs, > working (unlike Org's clocking) without manual intervention - recording > the state of computer (i.e., current idle time, active X window, active > Emacs buffer name and mode) at regular (or not) intervals and making > reports. I did not include any network-related info, but this would be > easy to add. Thanks, I'll definitely think about it! Along similar lines, how about running a process on a computer near where you dwell at work which watches for your mobile phone's bluetooth ID. Recording when your phone enters/exits its range will sample the time you are physically present. If you roam around at work you will need to remember to visit the BT range at the start and at the end of your day in order to get a full measure. And, you'll need to process the samples to pull out the earliest/latest times to calculate the time present. This post-processing can emit Org text or whatever format you want. Looking at what bluetooth stuff is available on Ubuntu, "bluemon" seems perfect for the heavy lifting. Your OS may vary. There are also Android apps that do this kind of locating directly using GPS/WiFi location and uploading the results to google drive or similar. However, I've never managed to find one which I can make work reliably. -Brett. signature.asc Description: PGP signature
Re: [O] Best way to create blog for company web site with Orgmode
Rainer Hansen writes: > Sometimes I should read more carefully what I write. I want to use a > static web site generator! So Wordpress is no option for me. Ah, okay! That makes more sense. One day I will also learn to read what I write. :) > Of course I could use Bootstrap with an Org-based static site > generator. However, I my thinking is that I need to do a lot of > customizations to use it as a blogging engine. Perhaps I am wrong. I > would be happy if someone on the mailing-list has done it and can show > that it is quite straight forward to do. Yes, this desire to have the HTML match the CSS (without touching the CSS) is one thing that drove me to rolling my own generator. I didn't want to muck with Org HTML export to make that match happen. In the end, I found that most of what I wanted from Bootstrap relates to what I think of as "outer" HTML - the banner, nav bar, menus, table of contents, etc. It ends up mattering less to me for the "inner" HTML of the actual blog post or page payload content. If ever I do need to, I'm prepared develop some code to do some rewriting of Org HTML during the generation. > Yes, easy is relative. What I mean is that I can set it up in less than > 4 hours through configuration. I want to be able to reuse the visual > theme implemented in CSS for the rest of the web site in the time limit > mentioned before. When my system has some more polish then maybe your 4 hour limit can be satisfied. Right now, being my only customer, it may not pass your definition of "easy". But, you are welcome to take a look and try. > Could you please provide some links? I am especially interested in > tutorials on setting them up. I don't guarantee that it will live up to its name but here is my generator: https://github.com/brettviren/joyful-web It's mostly Python based and uses Jinja2 templates. Emacs is used to generate a JSON dump of the org-element tree, to produce the HTML body text and to make a PDF. I don't have many examples in the source but I do inside my actual Org content area. Some things to look at include the main config file: https://github.com/brettviren/org-pub/blob/master/joy.cfg an example template: https://github.com/brettviren/org-pub/tree/master/templates/topic.html and, maybe look at how I call "joy" to rebuild the site. I use "waf" to do that and its control file is: https://github.com/brettviren/org-pub/blob/master/wscript I only have this working on my laptop now so I can't show you the results at the moment. -Brett. signature.asc Description: PGP signature
Re: [O] Best way to create blog for company web site with Orgmode
Rainer Hansen writes: > I wonder what is the best way to create a blog for a company website > with Orgmode. I do not want to use a static web site generator. The > design of the web site is relying on Bootstrap and customs CSS. Just curious, why does wanting to use Bootstrap rule out an Org-based static site generator for you? I'm slowly developing just such a beast. It Works For Me(TM) but is still a bit raw for others unless they can deal with some Python hacking and spotty documentation. > It should be easy to setup and to maintain for me? I think maybe you can better define what you mean by "easy"? In the end, developing my own generator was easier than trying to adapt existing ones. There are a lot of great ones out there, especially if you expand to allow Markdown ones (either native authoring or using Org's Markdown export), but none do exactly what I wanted. -Brett. signature.asc Description: PGP signature
Re: [O] Code block returning code results formatted as another type of code block?
"Charles C. Berry" writes: > Try `:wrap src json': Works perfectly, thanks. I had missed this in the manual, but it was there for me all along! http://orgmode.org/manual/wrap.html -Brett. signature.asc Description: PGP signature
[O] Code block returning code results formatted as another type of code block?
Hi, I have some shell command line program that spits out JSON. I want Org execute that command from a source block (of type "sh") and have the result displayed as another source block of type "json". I can almost get all that working except the resulting block is also of type "sh": I have: #+BEGIN_SRC sh :exports both :format json :results value code echo '{"foo":"bar", "baz":"quax"}' #+END_SRC #+RESULTS: #+BEGIN_SRC sh {"foo":"bar", "baz":"quax"} #+END_SRC But, instead, I want the result: #+RESULTS: #+BEGIN_SRC json {"foo":"bar", "baz":"quax"} #+END_SRC Is there some arg to the initial source block which I'm missing? I guessed with that ":format json" arg. With or without it makes no difference. Thanks! -Brett. signature.asc Description: PGP signature
Re: [O] Exporting a subtree
Peter Davis writes: > For the first time, I'm trying to export just a single subtree of my overall > document, by typing > > C-c C-e C-s H O > > However, I get this error: > > apply: Wrong type argument: listp, #("Details, November 2015" 0 22 (:parent > (#0))) FWIW, I had this problem on my home machine about a week ago or so. I messed around with different versions of org and org-plus-contrib installed from package-list-packages and eventually got it to go away. Sorry I don't recall the specifics. But I just wanted to say it's not just you. Right now, on my work system your test succeeds: Org-mode version 8.2.10 (8.2.10-41-g42228a-elpa @ /home/bviren/.emacs.d/elpa/org-20150622/) -Brett. signature.asc Description: PGP signature
Re: [O] Bug: message after org-clock-in [8.2.10 (8.2.10-34-gc41bbc-elpa @ /home/torys/.emacs.d/elpa/org-20150223/)]
torys.ander...@gmail.com (Tory S. Anderson) writes: > I'd love to. Unfortunately, search engines were unable to give me > decisive answer on what an ECM is. Heh. I guessed what it meant, but not what it stood for, and found: http://orgmode.org/worg/org-faq.html Some users call this an "ECM", a French acronym that means a "minimal complete example". Cheers, -Brett.
Re: [O] Executing org shell blocks on remote machine over ssh
David Bjergaard writes: > I know this is working "against the grain" of the literate programming > paradigm where the document and the source code are coupled, and > tangling the document produces a program that can be executed. I'm just > wondering if its possible. If not that's fine. Really I'm just trying > to save myself a copy-paste (and the associated issues with it getting > recorded in my .bash_history). I usually come at it from the "reproducible research" angle which maybe is more relaxed than literate programming. In any case, I find it hard to capture all the info needed to reproduce something and so I settle for capturing as much as easily achievable - that is when I try at all as capturing it in an RR org doc greatly increases the time I need to do something. Many of the software stacks I use also take significant time to configure the end-user environment. 10 seconds is not unheard of and it can be minutes if the stack lives on slow network disk. I think the approach I suggested of caching the environment should work for you. Unfortunately, I do not know of a trivial, general way to do this. The "env" program comes close but does not spit out a format that is immediately consumable by the shell. In particular, spaces in variable values confound it. It also lacks the "export" keyword. And, in any case is only close to sh syntax. Any exported functions also have to be handled properly In your shoes, I'd probably write a small Python script that dumps the "os.environ" dictionary holding the environment of the caller into a form suitable for consumption by your shell. You can call this dumper in a shell code block at the top of your org file and source the result as the first line in each subsequent shell code block. A starting point would be something like the following, but this does not properly handle and sh functions defined. #!/usr/bin/env python import os for k,v in os.environ.items(): print 'export %s="%s"' % (k,v) Good luck! -Brett. pgpHzOCk2dOsk.pgp Description: PGP signature
Re: [O] Executing org shell blocks on remote machine over ssh
David Bjergaard writes: > I use org mode as a lab notebook. I write org-src blocks to keep track > of tasks I do at the command line, and then I copy paste them into the > terminal. I would really like to hit "C-c C-c" on the source block and > have it executed on the remote machine. I know that you can specify > the remote machine according to [1], however the software I use requires > a fairly complicated setup to get going. Is it just complicated, or is it also prohibitively long-running? If just the former, you could maybe bundle the setup into some shell script and source it in each of your sh source blocks. Eg: #+BEGIN_SRC sh :results output :dir /ssh:lycastus:/home/bviren /bin/pwd echo $HOSTNAME ls -l foo.sh echo "---" cat foo.sh echo "---" source ./foo.sh echo $FOO #+END_SRC #+RESULTS: : /home/bviren : lycastus : -rw-rw-r-- 1 bviren bviren 16 Nov 18 10:27 foo.sh : --- : export FOO=bar : : --- : bar If the setup is purely environmental, and it takes a long time to perform, maybe you could do the set up once and then cache the resulting environment using the output of "env". -Brett. pgpgZL2hLBQi4.pgp Description: PGP signature
Re: [O] org-mode for knowledge management
Hi Louis, Louis writes: > I've been using org-mode for a variety of purposes for a few years. I > find that it suffers from the same problem that other such tools > do. The problem is me. I can't remember week to week how I may have > classified some scrap of information. Did I drop it into > notes/someproduct.org or was it procedures/someprocess.org? I hear you. My strategy so far has been: just write org content and an ideal lookup solution will eventually be found (via threads like this one!). This weekend I took a first step and *finally* got agenda-based searching to work. For better or worse, my setup intentionally spreads org content over a few areas: For a few explicit, "global" files (eg, todo.org) ~/org/*.org For daily, private notes: ~/org/web/notesnotes.org For a wiki-like blog / knowledge bank: ~/org-pub/topics//index.org By default, my attempts with org agenda search was not finding files in these areas. Particularly the latter two were difficult for me to figure out how to tell org about. The final solution was to walk these directories at initialization time and add all .org files found to org-agenda-text-search-extra-files. Here is the most concise way to do that which I found after various searches: (require 'find-lisp) (setq org-agenda-files (list "~/org") org-agenda-text-search-extra-files (append (find-lisp-find-files "~/org-pub/topics/" "\\.org$") (find-lisp-find-files "~/org/web/notes/" "\\.org$")) ) If anyone knows better ways to do this, I'm all ears. I'm particularly wondering how long-running org sessions will handle newly created topics or notes in this setup. -Brett. pgp983NtKSPH7.pgp Description: PGP signature
Re: [O] Fwd: Cooperating with oneself using the cloud?
"Monroe, Will" writes: > Thanks so much for your reply, Tim. git-annex does seem like a > possibility for syncing org-mode files but it appears that there's a > lot to consider when setting it up. This thread prompted me last weekend to try git-annex via its "assistant". It was pretty painless to set up hosts where I could run a local web browser. I was also able to easily set up a remote annex on a headless git/SSH server via the web app. I followed this: http://git-annex.branchable.com/assistant/quickstart/ -Brett. pgpuwO89OFSzn.pgp Description: PGP signature
Re: [O] Emacs server and org-protocol
Alexis writes: > If i may ask, which email front-end were you using? (Gnus, perhaps?) i > used to use notmuch.el, and currently use mu4e, and basically don't have > this issue My GNUS + IMAP subprocess + Maildir used to lead to long wait times when updating for new mail ("g" in Groups). Things have now vastly improved since moving my Maildirs to a SSD. -Brett. pgpdCvvL5sXuj.pgp Description: PGP signature
Re: [O] Unit conversions and symbolic mathematics with Babel
Hi, die...@duenenhof-wilhelm.de (H. Dieter Wilhelm) writes: > But what is missing is to assign variables within a source block > > #+BEGIN_SRC calc :var L1 = "5 mm" > L2 := cvun( L1, m) > #+END_SRC > > Unfortunately this is not working. Do you have an idea how to > implement this? > > - Are you using (better) alternatives? I like Python and in Python I like Pint for units. http://pint.readthedocs.org Below is an example org document that should "run" and shows a couple ways to use snippets of Pint code to do unit conversion. Not shown but Pint Quantity objects support arithmetic so are useful for carrying units through some calculation. For assigning to variables - presumably for use in later blocks - maybe you can investigate using the :session header argument to source blocks. Have fun, -Brett. One way to install Pint is: #+BEGIN_SRC sh :results silent pip install --user pint #+END_SRC Here is an example: #+name: uconv #+header: :var val="10m" :var unit="inch" #+BEGIN_SRC python import pint units = pint.UnitRegistry() return units.Quantity(val).to(unit) #+END_SRC #+RESULTS: uconv : 393.700787402 inch Now call =uconv= do to some other conversion: #+call: uconv("2.54cm","inch") #+RESULTS: : 1.0 inch pgpGnSjfoKUX4.pgp Description: PGP signature
Re: [O] Possible to use src block to generate org headlines for export?
Matt Lundin writes: > That sounds interesting. I look forward to hearing more! It's not yet usable for anything real but I'm keeping the work here: https://github.com/brettviren/orgonpy -Brett. pgptNgTBz8D6F.pgp Description: PGP signature
Re: [O] Possible to use src block to generate org headlines for export?
Matt Lundin writes: > Brett Viren writes: >> >> Maybe it would be more convenient to add the "meta-ness" you want as >> part of a new exporter process? > > To change the "meta" wrappers for code block results, we would have to > modify org babel (ob-core.el). Just to be clear (hopefully) I actually meant something different. I was suggesting to *not* use org babel to produce your extra headlines. Rather, have whatever logic produces them reside in some new exporter. I'm may be making incorrect guesses as to what you are actually going for with these extra headlines. You mentioning this is for a blog made me think they are some kind of "standard augmentation" for every blog post or something. If not then I'm probably barking up the wrong tree. But if so, putting them into an exporter seems apt. This is an approach I'm taking in a JSON+HTML exporter (analogous to the latex+pdf one) that I'm working on. For example, I'd like to have a "tag cloud" generated from tags on org headlines. This tag cloud won't explicitly exist on the org side. Rather it will be implicitly produced and updated by some (Python) code that runs as part of the JSON->HTML stage of the exporter. Cheers, -Brett. pgp43MvSLzUiN.pgp Description: PGP signature
Re: [O] Possible to use src block to generate org headlines for export?
Matt Lundin writes: > Let's hope the real blog (when I get around to publishing it) is more > interesting than the example above. ;) Maybe it would be more convenient to add the "meta-ness" you want as part of a new exporter process? -Brett. pgpX0dUH7NC9P.pgp Description: PGP signature
Re: [O] org-redisplay-inline-images and export to HTML
Nick Dokos writes: > I think you'd be better off with the tip that Rick Frankel posted in > the same thread: > > #+BEGIN_SRC emacs-lisp > (add-hook 'org-babel-after-execute-hook > (lambda () (org-display-inline-images nil t))) > #+END_SRC Thanks Nick (and Rick). I changed this to use the "re" version: #+BEGIN_SRC emacs-lisp (add-hook 'org-babel-after-execute-hook (lambda () (org-redisplay-inline-images))) #+END_SRC and it works great! -Brett. pgp_IbEYy8Wl6.pgp Description: PGP signature
[O] org-redisplay-inline-images and export to HTML
Someone recently posted a tip to add :post (org-redisplay-inline-images) to a SRC block which generates an image in order to freshen the Emacs buffer with the regenerated image each time the block is executed. It works *almost* fine but I have two problems which I hope someone can help with. 1) Priming-the-pump I'm using a document containing a GraphViz graph and running "dot" on it: -- #+BEGIN_SRC dot :cmd dot :cmdline -Tpng :file foo.png :exports results :post (org-redisplay-inline-images) digraph "foo" { rankdir=LR; params -> builders; builders -> objects; objects -> file; } #+END_SRC -- I do "C-c C-c" in the block and the buffer does not display any result. I see the messages: -- No images to display inline executing Dot code block... Wrote /tmp/babel-11819Iqr/ob-input-11819Lrv org-babel-ref-resolve: Reference 'No images to display inline' not found in this buffer -- If I do "C-c hh" to export to HTML I see: -- org-babel-exp processing... No images to display inline [2 times] executing Dot code block... Wrote /tmp/babel-11819Iqr/ob-input-11819kTR org-babel-ref-resolve: Reference 'No images to display inline' not found in this buffer -- And I get no HTML file produced. If I now take out the :post and do "C-c C-c" I get this appearing just after the SRC block as expected: -- #+RESULTS: [[file:foo.png]] -- If I now add back the ":post" and do "C-c C-c" again I get the inlined image. I can now edit the SRC block and repeat the "C-c C-c" and I am pleased to see the figure refresh each time. It's great! But, it needs this "pump priming". 2) Post-priming, still no HTML export After this "priming the pump" is done the second problem is that still a "C-c hh" does not produce an exported HTML file. Similar messages: -- org-babel-exp processing... No images to display inline Inline image display turned off No images to display inline executing Dot code block... Wrote /tmp/babel-11819Iqr/ob-input-11819zYx org-babel-ref-resolve: Reference 'No images to display inline' not found in this buffer -- Finally, if I remove the :post but leave the "#+RESULTS:" I can do a successful "C-c hh". So, the upshot is I have to keep adding and removing the :post to make things work in different contexts. This is obviously not so smooth. Is there some way to both have my cake an eat it too? Thanks! -Brett. pgp9XklYJJw8A.pgp Description: PGP signature
Re: [O] Indentation messed up after example block
Hi, Alexander Baier writes: > On 2014-07-06 20:03 York Zhao wrote: ... >> #+BEGIN_EXAMPLE >> * Example at level one >> #+END_EXAMPLE >> >> Indentation is wrong. > > The asterisk followed by a space followed by text in your example block > is recognized by org as a headline. So org thinks everything under that > headline is the body of the headline. I hit this very problem recently and first assumed it must be a bug. But, since it's documented[1] I guess it's a "feature". Although one I don't immediately see a use for. I hit this when capturing some logging info which happened to have a line starting with a triple-*. Trying to manually find such offending lines in a large EXAMPLE block is too tedious to contemplate. A better way, which is implied by that footnote, is to use Org Src buffers when entering the content of EXAMPLE blocks in the first place. I do like: C-c' Where is me pasting or typing whatever is the content of the EXAMPLE block. This will not only indent the entire block with a couple of spaces but will "escape" the problematic headline asterisk with the "special syntax" comma. -Brett. [1] http://orgmode.org/manual/Literal-examples.html#fnd-4 pgpxexQb8TG5u.pgp Description: PGP signature
Re: [O] PDF output from Org
David Masterson writes: > How do I control the page margins that Org uses in its Latex/PDF output? I also just started a new doc today and wanted reduce the margins. Normally I set all the various margin-related distances which I can never seem to remember and have to go search for. This time the search turned up a nice one-liner: #+LATEX_HEADER: \usepackage{fullpage} I might even be able to remember this one next time. Cheers, -Brett. pgpKk6H7E_so_.pgp Description: PGP signature
Re: [O] Reverse lookup from pdf to org?
Rainer M Krug writes: > Brett Viren writes: >> file:///path/to/foo.tex.orglink?line=42 > But jumping to the .org file would be the aim - right? Yes, right. Maybe a better example is: file://foo.orglink?line=42 which might get interpreted as "go to line 42 in ./foo.org". This example is also a relative link which would be less brittle as long as foo.org and foo.pdf are kept together in the same directory. >> Chance of success: 10% > > I guess higher? I like your optimism! -Brett. pgpSS2ZCL501D.pgp Description: PGP signature
Re: [O] Reverse lookup from pdf to org?
Nick Dokos writes: > One more (half-)possibility is as follows: produce the tex file and > compile it not with pdflatex, but with plain latex, producing a DVI > file. Passing the -src option to the latex invocation inserts "source > specials" into the DVI file that some DVI viewers (in particular, xdvi) > can interpret to jump back from the DVI view to the (approximate) > corresponding location in the tex file: > > latex --shell-escape -src foo.tex > xdvi foo.dvi Okay, here is a crazy idea. Maybe one can use hyperref and place \url{} and/or \href{}{} macros in the org file. These will turn into clickable links in the final PDF. In them place URLs that look like: file:///path/to/foo.tex.orglink?line=42 And then use .mailcap (or whatever MIME config that xpdf/evince/etc honors) to map the .orglink extension to a script that parses the URL (does that full URL get passed?) and invokes emacs to open foo.tex at line 42? If that much can be made to work (big if!) I see one problem in that the /path/to will break if the source is moved. Chance of success: 10% -Brett. pgpW9ggcB7moA.pgp Description: PGP signature
Re: [O] Reverse lookup from pdf to org?
Rainer M Krug writes: > Therefore I export the document to pdf, and look for errors there. Now I > have to find the corresponding section in the org file - possible, but > tedious. Not quite what you have in mind and maybe only a half-measure but when I produce draft latex documents I like to turn on this package: \usepackage[color]{showkeys} It prints the symbol used for labels, references and citations in light gray in the PDF output. I can then search for these in the tex to find the corresponding region. To the extent they are set in your .org source you might do similar. A little screen cap is attached to show an example output. -Brett. <> pgp1YsNo_YSNM.pgp Description: PGP signature
Re: [O] Finer-grained control of published files
Bastien writes: > Please test the attached patch against the tip of the master branch > and let me know if it works: it checks against a .oxignore file, one > regexp on each line. If you find it useful, I'll commit this for > the next version. I had some unrelated trouble with the head of master so I applied your patch to the 8.2.5h tag. It applied cleanly with a little fuzz. It seems to work great! I played with various ways to ignore and couldn't make it fail. One thing, and I know it's going back on what I asked originally, but I wonder if file globs would be the more natural pattern matching here than regexp? Either way, this will really help publishing from my messy source directories Thanks! -Brett. pgpd7fBn1fVHN.pgp Description: PGP signature
[O] Finer-grained control of published files
Hi, I'm trying to set up org-publish and am looking for more fine-grained control over what files get published than what (I think) I can get from configuring org-publish-project-alist. I've played with the publishing-function of org-publish-attachment and :exclude/:include and :base-extension regexps. What I'm finding is that I want to control what type of files get published on almost a per-directory basis and different directories may have mutually conflicting file patterns to include/exclude. Creating a new org-publish-project-alist entry for each is tedious. What I hope for is something equivalent to git's .gitignore functionality where I can place, say, .orgignore files full of regexp patterns anywhere in my org source tree and have org-publish honor them. Is there anything in this direction? Thanks, -Brett. pgpYXBBGs4DBQ.pgp Description: PGP signature
Re: [O] Graph not hierarchical?
Lawrence Bottorff writes: > being able to organize and > extract based on your stuff being stored graph-aware would be nice, > IMHO. I'm by no means an expert on this but I know org-element-parse-buffer returns a data structure which is a directed-graph. http://orgmode.org/worg/org-api/org-element-api.html Note, each node has a :parent reference which makes the data structure circular. Traversing it must take this feature into account. -Brett. pgpCPGL3596sN.pgp Description: PGP signature
Re: [O] terminal emulators
Gregor Zattler writes: > Hi Achim, > * Achim Gratz [10. Feb. 2014]: >> You cannot enter C-: in some terminals because it would require >> simultaneous processing of shift and control (these terminals ignore >> shift while control is pressed). > > this is true for xterm, rxvt-unicode, gnome-terminal, konsole and > the linux console. This terminal "feature" surprised me so I checked a few terminals I have here. xterm on Debian (278-4) does pass the C-:. Testing with C-c C-: after starting "emacs -nw -q" in that xterm I get the expected: C-c C-: is undefined But, I confirm that mate-terminal (1.6.1-1.1+7.wheezy) and rxvt (1:2.6.4-14) strip off the Ctrl. There the test produces: C-c : is undefined I note that mate-terminal does process Ctrl+Shift as some of its shortcuts use this combo. So, it's "actively" stripping the Ctrl away. -Brett. pgpE3DkoflQIp.pgp Description: PGP signature
Re: [O] most robust linking practices?
Hi John, John Kitchin writes: > The files are all on a unix file system served over nfs, so everyone > has the same / root. the users (students) have read access to my > files. > > I am working towards creating "packages" of notes in org-mode (they > might even be installed as emacs packages) for the courses that I > teach. Having relative paths within a package certainly makes sense. I > would like to link to notes in other packages too, as the courses are > related, and build on each other. but I won't know in advance where > those get installed. It sounds like those packages will have to have > some variables configured to make that work out. How about defining a slew of links in org-link-abbrev-list. Say, one for each set of class notes. Maybe you'd maintain two copies of such a list, one that assumes your shared file system is being used and one that assumes some layout convention in the user's home directory. Your users could pick the best one or use them as a starting point for their own customization. The fact that the link definitions may contain inline lisp functions may help to organize this. I guess you would need some way to update your reader/user's copy of the list as it evolves. Immediately, I don't have any ideas about that. I've started to use this approach a little. So far, just to reference some common external links. Here's my setup: #+BEGIN_SRC elisp ;; Custom external links ;; http://orgmode.org/manual/Adding-hyperlink-types.html#Adding-hyperlink-types ;; http://orgmode.org/manual/Link-abbreviations.html#Link-abbreviations (defun bv-link-resolve-github (tag) (replace-regexp-in-string ":" "/blob/master/" tag)) (setq org-link-abbrev-alist '( ("ghsite" . "https://github.com/brettviren/%h";) ("ghfile" . "https://github.com/brettviren/%(bv-link-resolve-github)") ("dbtrac" . "http://dayabay.ihep.ac.cn/tracs/dybsvn/ticket/%h";) )) #+END_SRC -Brett. pgpR2F1YSCk2N.pgp Description: PGP signature
Re: [O] working on cloud
David Belohrad writes: > 1) privacy: you're basically giving your data to somebody else. In case >of emacs init there is no danger. In case of your org data, which >might contain sensitive information you want to encrypt it, what >complicates matter when switching between two win/lin machines An alternative to consider is btsync. It will provide you similar functionality as Dropbox but removes reliance on a central server which is outside your control. All storage endpoints are peers. Peers are authorized by a shared key so only your machines, or maybe your friends get access - it's not an anonymous p2p system despite the "bt" in its name. You can also allow read-only access. Even with no "well known" server involved I've yet to find a case where peers can not be located behind firewalls or NAT'ed routers. Of course, btsync brings it's own issues. The main one for me is that it's not Free Software (it is a free-of-charge binary) but then the server side of Dropbox is even more restricted. I guess let your own conscience be the guide here. Personally, I go the git/github route for .emacs files and a private git repo for org files. I would like to not have the (explicit) commit/push/pull steps for org files and so have been testing btsync. Ideally there would be some way to marry the benefits of both, but I've yet to come up with one. -Brett. pgpfsIHSXtMGE.pgp Description: PGP signature
Re: [O] Parsing Org-mode in Python
Hi Daniel, Daniel Clemente writes: > Are there already Python parsers for it? Parsing generic JSON is fairly trivial in Python. import json data = json.dumps(open('file.json').read()) The resulting "data" is then a bunch of Python lists and/or dicts matching whatever structure was output from org and is in the .json file. The schema in these three contexts are (will be) identical. At this point, Pythonistas can do what they want with "data". Although, as I mentioned, I'd like to put another layer on this "raw" data structure which expresses/enforces the org schema as understood by the org-exporter. If I can figure out how to dump a representation of this schema from org I'll express it as a set of generated collections.namedtuple instances. We'll see. > Should ox-json's output be as raw as possible (e.g. what your code > produces now) or transformed to simpler JSON? > (I think both formats should coexist). I suppose there may be a usefulness to "winnow down" the structure. One thing I'm thinking about here is the narrowing done to support the "blog From anywhere" feature of Karl's lazyblorg mentioned in this thread. That can be done either on the emacs side or Python side (or both, in principle). However, my intention is to do as little modification of the org document structure on the emacs-side in order to preserve details that may possibly be interesting on the Python-side in the future. Also, I'm still learning LISP but know Python fairly well so would rather do as much processing as possible on the Python side. :) So far the only thing I see that needs to be stripped is the :parent property (and the :structure, which really should be resolved as a copy instead of being stripped) which cause the emacs-side data structure to become a Circular Object and thus break the emacs JSON dumper. I just noticed that Python's JSON dumper can do this kind of stripping implicitly and in general. It might be nice if someone were to add such a feature to the emacs JSON dumper but I don't plan to try this. -Brett. pgp9M9SeqaAZM.pgp Description: PGP signature
Re: [O] Parsing Org-mode in Python
François Pinard writes: > Brett Viren writes: > >> http://permalink.gmane.org/gmane.emacs.orgmode/79838 > > This yields: > > , > | Not Found > | > | The requested URL /gmane.emacs.orgmode/79838 was not found on this server. > ` Huh, maybe a transient failure? It's there for me right now. Here is the same message from GNU's archive: http://lists.gnu.org/archive/html/emacs-orgmode/2013-12/msg00415.html In any case, here is the salient chunk: #+BEGIN_SRC elisp (require 'json) (let* ((tree (org-element-parse-buffer 'object nil))) (org-element-map tree (append org-element-all-elements org-element-all-objects '(plain-text)) (lambda (x) (if (org-element-property :parent x) (org-element-put-property x :parent "none")) (if (org-element-property :structure x) (org-element-put-property x :structure "none")) )) (write-region (json-encode tree) nil "foo.dat")) #+END_SRC This test is meant to run from inside an org-mode buffer which itself provides the fodder for the test. But, it shows the steps that I'll need to integrate into some new org export mechanism. The important part is nulling out the :parent and :structure (and maybe others?) properties in order to break their circular references. The heavy lifting is all in org-element-parse-buffer and json-encode. >> At the end of the day one will have a DOM-style data structure >> representing the initial org document. > > Keep me (us!) posted! :-) Definitely! -Brett. pgpOODLoXxtb1.pgp Description: PGP signature
Re: [O] Parsing Org-mode in Python
Hi Karl, Karl Voit writes: > Hi! > > * Daniel Clemente wrote: >>> >>> I dream of having a general Python parser for Org mode files, knowing >>> every bit about the current syntax for Org files, surrounded by enough >>> Python machinery to make it useful. > > Oh, this would be great since there are way more Python-coders out > there as ELISP coders. I agree. I'm also (slowly) working toward some Python-based org processing. My strategy is to produce an intermediate file in JSON format which is designed to capture the full org document structure. I am calling this a "shunt" export as it is meant to do as little interpretation of the document as possible. If this is interesting to you and you haven't already seen it please check the thread from December were I got a lot of help to output this JSON via the new org export mechanism (I'm a LISP newbie). Here is the concluding post with a working example: http://permalink.gmane.org/gmane.emacs.orgmode/79838 Besides any eventual Python-side development, one remaining gap in my plan is how to produce some kind of schema description using the org exporter machinery. I want to have this description generated automatically so that any future changes to the org format can be accommodated with some level of automation. So, my current thinking is to find a way to exploit org export machinery to generate this schema (call it a "meta-shunt" export?). If I can find that I'll output it as another JSON file. Then, on the Python-side, I will read this schema file in and generate instances of collections.namedtuple. Finally a reader of the JSON org document will be developed to produce objects of these namedtuple classes. At the end of the day one will have a DOM-style data structure representing the initial org document. -Brett. pgpRE1ypSZwl8.pgp Description: PGP signature
Re: [O] email -> TODO items?
Peter Davis writes: > I use half a dozen email clients, including mutt, which lets me easily > pipe a message to a script. The need to support multiple clients may rule out my suggestion but capturing a TODO or a note while visiting a GNUS message and thus preserving the link back to the article that spawned my task/idea is fantastically useful. In your pipe scheme maybe there is some way you can preserve this link back. -Brett. pgpeqX1xVTzBZ.pgp Description: PGP signature
Re: [O] Org mode and "shunt" exporters?
Hi Eric, Eric Schulte writes: > This should work in a recent Emacs. > > (require 'json) > (defun org-as-json-to-file (&optional path) > "Export the current Org-mode buffer as JSON to the supplied PATH." > (interactive "Fwrite to file: ") > (let ((tree (org-element-parse-buffer))) > (org-element-map tree > (append org-element-all-objects org-element-all-elements) > (lambda (el) (org-element-put-property el :parent nil))) > (with-temp-file path > (insert (json-encode tree) Thanks. With this, Nicolas's and all the other input I've got something working now. There was still one small issue I found with this last round. The :structure property also causes an error inside json.el like: json-encode-key: Bad JSON object key: 105 But, for now, nulling :structure in the same way as :parent let's me chain org->JSON->Python! The first elisp code block in the test doc below works. Thanks for all the patient help from everyone. I've learned a lot. -Brett. #+TITLE: The Title. Blah blah blah. * A heading. This uses http://edward.oconnor.cx/2006/03/json.el - foo - bar - baz #+BEGIN_SRC elisp (require 'json) (let* ((tree (org-element-parse-buffer 'object nil))) (org-element-map tree (append org-element-all-elements org-element-all-objects '(plain-text)) (lambda (x) (if (org-element-property :parent x) (org-element-put-property x :parent "none")) (if (org-element-property :structure x) (org-element-put-property x :structure "none")) ;; (if (eq (org-element-type x) 'plain-text) ;; (org-element-set-contents x (substring-no-properties ;; (org-element-contents x )) (write-region (json-encode tree) ;(prin1-to-string tree) nil "foo.dat")) #+END_SRC #+RESULTS: * From Eric Schultz #+BEGIN_SRC elisp (require 'json) (defun org-as-json-to-file (&optional path) "Export the current Org-mode buffer as JSON to the supplied PATH." (interactive "Fwrite to file: ") (let ((tree (org-element-parse-buffer))) (org-element-map tree (append org-element-all-objects org-element-all-elements) (lambda (el) (org-element-put-property el :parent "none"))) (with-temp-file path (insert (json-encode tree) (org-as-json-to-file "eric.txt") #+END_SRC * Try some hand written data #+BEGIN_SRC elisp (require 'json) (with-current-buffer (find-file-noselect "foo.dat") (let ((tree (read (current-buffer (prin1-to-string (json-encode tree #+END_SRC pgpUoNT2XJl7p.pgp Description: PGP signature
Re: [O] Org mode and "shunt" exporters?
Matt Price writes: > I am pretty ignorant and may have missed a referene o this in the > thread, but this (very outdated) code is on the emacswiki: > > http://www.emacswiki.org/emacs/org-json.el Thanks. My searches didn't find this. It looks like this is parsing the org buffer directly and only to the level of headings. Ultimately I want to emit JSON to get at the full detailed document structure so this probably isn't in the direction I want to go. -Brett. pgp1Mae8rSsOL.pgp Description: PGP signature
Re: [O] Org mode and "shunt" exporters?
Hi, Nicolas Goaziou writes: > You can walk the tree, e.g. with `org-element-map', and remove > all :parent references if you don't need them. I figured out how to follow this advice. I can even make valid JSON From the filtered parse tree by handing it to Edward O'Conner's json.el (link in example below). However this method only works for a very simple org document. I'm successfully filtering out the :parent properties of (most of) the elements but as soon as my document produces a plain text element like: #("Text" 0 4 (:parent #1)) then two problems occcur: First, I'm simply failing to see how to set this :parent property to nil like I do with the others. Second, json.el throws a "Bad JSON Object" error. I tried assuming that the problem was it doesn't know what to do with this substring form. Naively, I tried to follow some other recent advice in another thread about using substring-no-properties to strip out the meta data from the plain text elements. But this apparently is a net no-op as I suspect that the org-element-set-contents then puts them right back. I feel like I'm pretty close. Any more advice? Thanks, -Brett. #+TITLE: The Title. Blah blah blah. * A heading. This uses http://edward.oconnor.cx/2006/03/json.el - foo - bar - baz #+BEGIN_SRC elisp (require 'json) (let* ((tree (org-element-parse-buffer 'object nil))) (org-element-map tree org-element-all-elements (lambda (x) (if (org-element-property :parent x) (org-element-put-property x :parent nil)) ;; (if (eq (org-element-type x) 'plain-text) ;; (org-element-set-contents x (substring-no-properties ;; (org-element-contents x )) (write-region ;(json-encode tree) (prin1-to-string tree) nil "foo.txt")) #+END_SRC #+RESULTS: pgpD3LPnqETG3.pgp Description: PGP signature
Re: [O] Org mode and "shunt" exporters?
Hi John, John Kitchin writes: > that sounds like an interesting approach. xml seems like what you > really want, since looking at the parsetree there is a lot of > information (e.g. attributes, properties, etc...) that would be tricky > to generate a fully representative json scheme. I see from your other thread that you are looking in to this idea of dumping to JSON. That's great! If you want a tester of your JSON exporter I'd be very happy to give it a try. If it means I can abandon my own stumbling around, that would make me even happier. But, I am still slowly messing with this myself. I plan to next follow Nicolas's suggestion of simply removing the :parent parameter to get over the hurdle that the circular object caused me. I think if the overall structure of the parse tree is preserved in the JSON then parentage can be restored when it is read back. I've also thought a bit about schema issues. Regardless of how an "org schema" might be represented, it would be best if it could be generated From org instead of hand crafted. This would need a kind of a "meta export" feature. I've not yet checked to see if there is some facility in org to exploit to do this. Maybe someone knows? In the past I've expressed schema descriptions for JSON data in JSON itself. Internet searches now show this is not a novel approach so I think there is some fruit to be found pursuing this direction. Or, I may just be trying too hard to avoid XML > This page suggests at the bottom you could export to texinfo, and > convert that to docbook: > http://orgmode.org/worg/exporters/ox-overview.html > > * (1) DocBook export, available in previous Org-mode versions, has not > currently been ported to the new exporter, however the new > ox-texinfo backend can generate DocBook format. Once file.texi is > created via ox-texinfo, simply execute: > > makeinfo --docbook file.texi Thanks. I did try this but makeinfo failed on the texinfo file that was produced. I didn't pursue it enough to figure out why or if I was doing something wrong. -Brett. pgpPfJ_x2K9ew.pgp Description: PGP signature
Re: [O] Org mode and "shunt" exporters?
Eric Schulte writes: > You can use `org-element-parse-buffer' to convert an Emacs Buffer to a > structured Emacs Lisp object. At that point you can use existing tools > for converting lisp to JSON or YAML. I've used cl-json for Common Lisp, > I would imagine something similar exists for Emacs Lisp. Thanks for the suggestion. I pursued that a bit this weekend. The resulting data structure is a Circular Object[1] due to the ":parent" references. It seems dealing with this kind of data structure is somewhat uncommon (or my search-fu lacking), although I do find a recent reference to it on this mailing list[2]. I also found a "cust-print"[3] feature from Emacs 19 which has since been removed. It shows a way to deal with Circular Objects. So far it has strongly taxed my poor elisp skills but I plan to pursue this direction a bit more. I did try throwing a JSON parser/generator[4] at the output of org-element-parse-buffer but this failed due to exceeding emacs's recursion limits. I think this must be from the ":parent" references getting recursed on forever. -Brett. [1] one must (setq print-circle t) to avoid emacs reader errors http://www.gnu.org/software/emacs/manual/html_node/elisp/Circular-Objects.html [2] http://comments.gmane.org/gmane.emacs.orgmode/65999 [3] http://web.mit.edu/dosathena/sandbox/emacs-19.28/lisp/cust-print.el [4] http://edward.oconnor.cx/2006/03/json.el pgpvW01zMgjgz.pgp Description: PGP signature
[O] Org mode and "shunt" exporters?
Has anyone written any new-style exporter which will produce a common markup/data language format like JSON or YAML? I'm looking for something that fully preserves the original org document structure and does no semantic interpretation along the way. What I really want is to parse arbitrary org files in Python. I've looked at the entries at worg's "org-tool" node which do this but they seem out of date or make assumptions about what org elements exist or their URLs are not loading (NEO). If any of that's a misrepresentation please correct me. In any case, using org's own exporter to produce JSON or YAML and then relying on these format's Python modules for parsing seems like the best way to go to let me author in org and process in Python. I'm not very good with elisp (which is why I want to get org data into Python) but I guess I can have a go at making such a "shunt" exporter. Before I try, I just wanted to check if someone had this wheel already spinning. Thanks, -Brett. pgpOHJn2FZTRp.pgp Description: PGP signature
Re: [O] Capture templates with "function" type
Bastien writes: > Capture templates using `function' should now return back to the > correct window location. Thanks for raising this, Thanks so much for putting time in it! Regards, -Brett. pgpgYsSYgPjri.pgp Description: PGP signature
Re: [O] Capture templates with "function" type
Hi Bastien, Bastien writes: > You may try this (not tested myself): > > (defun bv-daily-log-file () > (save-window-excursion > (find-file (concat "~/org/web/notes/" > (format-time-string "%Y-%m-%d") ".org")) > (goto-char (point-max)) > (newline 2))) > > The trick is to use `save-window-excursion'. Thanks for the pointer but it looks like this macro runs afoul of the capture process somehow. I redefined my function as you have above and did C-xC-e to reload it and then initiated a capture from a window showing my GNUS summary. It fails with: byte-code: Capture abort: (buffer-read-only #) I then tried another capture staring from a read-write buffer. The capture succeeds but the captured text is inserted into this starting buffer instead of the one found by the bv-daily-log-file function. The Elisp manual mentions that save-selected-window is sometimes a better alternative but that gives the same behavior. Do you maybe have further ideas I could try? Thanks, -Brett. pgpmfnukccpMQ.pgp Description: PGP signature
[O] Capture templates with "function" type
Hi, I'm trying to set up a capture template of type "function" in order to produce a daily log file named after today's date. It mostly works. However, after doing the C-cC-c to close the capture buffer the window is left holding the daily log file which the capture just updated instead of going back to whatever buffer I was in when I initiated the capture. This returning-to-previous-buffer behavior is what I see when I use the file+headline capture type. Can someone say how I might get this behavior for the "function" capture type as well? Here is my setup: (defun bv-daily-log-file () (find-file (concat "~/org/web/notes/" (format-time-string "%Y-%m-%d") ".org")) (goto-char (point-max)) (newline 2) ) (setq org-capture-templates (quote ( ("n" "Note" entry (function bv-daily-log-file) "\* %U %^{title}\n %a\n\n%?" :empty-lines 1) ))) Thanks, -Brett. pgp3fjuT9LesZ.pgp Description: PGP signature
[O] Export org to dot for an organization chart?
Hi, I'd like to produce an organization chart using org. What I want to do is: - enter an organization role as a section heading - have the heading hierarchy map to the organization hierarchy - enter optional section properties to specify: - the name of the individual who might fill the role - color and line types for drawing "the box" for the role - a URL associated with the role - section text providing a brief description of the role - render this into some "nice looking" graphic The end result I'm going for is a clickable image on a web page made by rendering the organization chart such that clicking on a box sends the browser to the role-specific URL and the "alt" text for that link gives the section text. Is there already something along these lines? Some searches turned up empty My thinking is that if there was an "org-export-as-dot" then it would be close to what I want. I found org-export-as-freemind which is in the right direction but I think lacks some of what I want and I'd like to avoid using a GUI in the process. Thanks for any ideas on this. If there is nothing like this yet, maybe I can use it as an excuse to learn org's new export system. -Brett. PS: rough example org file might look like: * Boss :PROPERTIES: :Actor: Bob Bigbooty :URL: http://www.example.com/boss.html :NodeColor: blue :END: The boss dictates. ** Middle Manager :PROPERTIES: :Actor: :URL: http://www.example.com/layer.html :NodeColor: red :END: The middle manager spectates. *** Flunky :PROPERTIES: :Actor: Sam Small :URL: http://www.example.com/hardworker.html :END: While the flunky gets stuff done. pgpd7J_RKfACP.pgp Description: PGP signature
Re: [O] Amazing demonstration by John Kitchin
John Kitchin writes: > Here is part of how I use org-mode to publish to my blog: > http://jkitchin.github.io/blog/2013/09/27/Publishing-to-blogofile-using-org-mode/ Thank you very much for typing this up! I now have some weekend entertainment to try and replicate it for myself. -Brett. pgpEelfEMRLq4.pgp Description: PGP signature
Re: [O] Amazing demonstration by John Kitchin
John, I finally got a chance to watch your really nice SciPy talk last night. I've been trying to incorporate Reproducible Research methods with org into my own work. I strive to do more and what you are doing looks to provide a wealth of examples. I hope more researchers follow this methodology. One thing I've yet to get a good handle on is publishing org content in an automated (and beautiful) way. I was very taken with your github.io pages and would like to try to set up something similar for myself. Do you have a write-up or other guidance on this that I might follow? I've started to go through your related github repositories to figure out what you do but if something more guided exists it would help. Thanks, -Brett. Carsten Dominik writes: > Hi, > > I don't know if this has been linked to before on this mailing > list. At SciPy 2013, John Kitchin has made an amazing > demonstration of Org-mode as a tool for reproducible research. > Really amazing to watch. > > http://www.youtube.com/watch?v=1-dUkyn_fZA > > - Carsten pgp7cZIYAKeld.pgp Description: PGP signature
Re: [O] Org mode issue tracker
Hi, Suvayu Ali writes: > * TODO Subject :emacs_ver:org_ver:org_module: ... > Emacs version ends up as a tag: > > * TODO . :24.3: Or, if I add an Org version: * TODO . :24.3:8.0.3: These bare numbers seem a bit too anonymous to me. I think it's unlikely that Org will reach versions in the 20's anytime soon so collision won't happen for a while but eventually (hackers willing!) it will. So, I suggest simply qualifying the versions like: * TODO . :emacs_24.3:org_8.0.3: I can also see a desire to list other software and their versions that might be implicated in the bug being reported. Listing their bare versions as tags is, I think, obviously no good. They could just include this info in an ad-hoc manner in the body of their report, but maybe it would be good to define a property to explicitly list them following the same _ pattern of the tags. * TODO . :emacs_24.3:org_8.0.3: :PROPERTIES: :IMPLICATED_SOFTWARE: texlive_2012.20120611-5 beamer_3.10-2 BTW, I think an issue tracker in Org is very interesting. I look forward to seeing how it evolves. -Brett. pgp6kwuMSCpiV.pgp Description: PGP signature
Re: [O] asynchronous code evaluation
Hi Johannes, Johannes Rainer writes: > well, I'm using emacs/org for my data analyses in R. I thus combine > documentation (i.e. the conclusions drawn from e.g. plots created in > R) and the R code to perform the analysis in my org file. Since I'm > analysing high throughput data some tasks to handle the data are quite > time consuming. A variation on Allen's Makefile approach, I structure my (Python) code to be idempotent. The "real" code never (re)runs unless its output either doesn't exist or is older than the input. Normally when org runs the code's higher level interface it's essentially a no-op and very fast. If something does change it's usually because I'm doing development and will be running the code outside of org enough that it's reached its "no-op state" before I go back into emacs to refresh/edit the org document. Also, I keep things synchronous to avoid having to multiple, competing processes running at once. What I want is to take this approach and generalize into a more formal workflow system. One which handles caching files and in-memory objects in a versioned store to provide data provenance and idempotent running in a general sense. There's already been some work on this ("bein", "pyutilib workflow" and "sumatra" to name some Python oriented ones) but so far nothing that "just fits". I'm in the middle of trying my hand at something better, but it's not yet usable. -Brett. pgpgHPRVolmV1.pgp Description: PGP signature
Re: [O] org-export-current-backend variable and org-mode 8
Hi Christophe, Christophe Rhodes writes: > In org-mode 7, I was able to use the (documented) variable > org-export-current-backend to test what the current backend is, allowing > me to dynamically produce and include images of different formats > depending on whether I was exporting to latex (tikz) or html (png). > > In org-mode 8, I cannot find this variable, or any documented variable > of a similar nature. What is the recommended way for dispatching at the > emacs-lisp level when exporting a document on the export backend? I don't know if this is exactly what you are asking for but I hit on the following a few weeks ago. It defines an elisp macro inside the org file and then calls it later in the header of a code block to switch the output file names based on which backend (if any) is in effect. I hope it helps. If you have a better way to do these kind of output switches, I'd like to know. * COMMENT setup #+begin_src emacs-lisp :results silent (defmacro by-backend (&rest body) `(case (if (boundp 'backend) backend nil) ,@body)) #+end_src * A graph #+header: :file (by-backend (html "graph.png") (latex "graph.pdf") (t "graph.svg")) #+header: :export results #+begin_src dot digraph Name { tail -> head; } #+end_src -Brett. pgprOFxwMXXfh.pgp Description: PGP signature
[O] Interpreter/shell prompts when exporting code blocks?
Hi organistas. I'd like to have my executable code blocks get exported to HTML/LaTeX with some prompt prefixed to each line of code but still let the blocks themselves remain executable in their given language. Is there already a nice way to do this? For example, if there was something like a "prompt" header to specify what should get prefixed on export then something like... #+prompt: $ #+BEGIN_SRC sh :results none :exports code mkdir mymod touch mymod/__init__.py #+END_SRC #+prompt: >>> :indent ... #+BEGIN_SRC python :results none :exports code import mymod def myfun(): mymod.something() #+END_SRC ...would export something resembling: $ mkdir mymod $ touch mymod/__init__.py >>> import mymod >>> def myfun(): ... mymod.something() For HTML export, some stylesheet magic which allows any cut-and-paste to ignore the prefixed prompt would be icing on an already tasty cake. -Brett. pgpi4jxziOuQp.pgp Description: PGP signature
[O] Switch for exported file types when evaluating code blocks
Hi, I'm hitting on an old theme in a new way here. I want graphics files which are exported by evaluated code blocks to be generated in a format best suited to their intended use. For HTML I want either PNG or SVG. For LaTeX/PDF I almost always want PDF. For inline viewing in emacs I want either PNG or SVG. To that end I went a'googling and found this idea: http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-LaTeX.html#sec-4-3 It doesn't work with my copies[1] of emacs and org-mode but I was able to adapt it. I suck at elisp so this is probably more an accomplishment to me than it appears to most of you! In any case, here is a short org document based on the one I found above in worg which shows what I ended up with: * COMMENT setup #+begin_src emacs-lisp :results silent (defmacro by-backend (&rest body) `(case (if (boundp 'backend) backend nil) ,@body)) #+end_src * A graph #+header: :file (by-backend (html "graph.png") (latex "graph.pdf") (t "graph.svg")) #+header: :export results #+begin_src dot digraph Name { tail -> head; } #+end_src I think the real learning experience for me was that I could put lisp directly in a header like this! Now, I just gotta learn elisp better Also, I'd certainly be interested to hear of any better ways to accomplish this. Thanks, -Brett. [1] The versions I'm using are - Org-mode version 8.0.3 (8.0.3-elpa @ /home/bviren/.emacs.d/elpa/org-20130514/) - GNU Emacs 24.1.1 (i486-pc-linux-gnu, GTK+ Version 2.24.10) of 2012-07-20 on murphy, modified by Debian pgpOglEO1Y7O6.pgp Description: PGP signature
Re: [O] advice needed: how do you guys sync org files between devices?
Alan Schmitt writes: > Well, what would be there? If there is (and there may be) an external > tool that knows how to merge org files (it can be a 3-way merge, if it > makes things simpler), I could try to devise the magical incantation to > use it. It is not org-specific, but meld [1] is a Free and capable GUI merge tool. It can be used directly or can be invoked by git to resolve merge conflicts. -Brett. http://meldmerge.org/ pgpXrGc9cQ3V4.pgp Description: PGP signature
Re: [O] RFQ - new contribution - org-screenshot.el
Max Mikhanosha writes: > Just committed a potential fix, can you see if it works? Commit > 0d68eef0372b6b57359a49cb5e35b67c651c5ee2 Works great! Thanks, -Brett. pgpAYtFdzq95n.pgp Description: PGP signature
Re: [O] RFQ - new contribution - org-screenshot.el
Hi Max, Max Mikhanosha writes: > I have committed org-screenshot to master This sounds like a great idea. And just to prove that no good deed goes unpunished, here is a bug report: In an org-mode file I run "M-x org-screenshot-take", scrot runs and I can either click on a window or draw a selection box. However, lifting the mouse button leads to: error in process sentinel: Symbol's value as variable is void: return [2 times] An actual PNG is produced in the expected images/ subdir and also I confirm that running "/usr/bin/scrot -s /path/to/file.png" by hand works returning a 0 error code. My org is: Org-mode version 8.0.3 (8.0.3-elpa @ /home/bviren/.emacs.d/elpa/org-20130514/) Running in: GNU Emacs 24.1.1 (i486-pc-linux-gnu, GTK+ Version 2.24.10) of 2012-07-20 on murphy, modified by Debian I copied the org-screenshot.el you just pushed from git's contrib/ to my load path and added a "(require 'org-screenshot)" just after my "(require 'org)". The same behavior also occurs with the original copy you posted to this mailing list. A quick Google search just left me confused (I'm not great with elisp). Is there anything I can do to debug this further? Thanks, -Brett. pgpJZFNBqF1WX.pgp Description: PGP signature
Re: [O] Nested list with percent-complete in multiple states?
Bastien writes: > Check boxes have only three state: empty, checked, undecided. > > If you need more states, I suggest using a property. > Then the column view can be used to display a summary > of the "sum" of all properties in the subtree. Thanks for the pointer, Bastien. This looks like a fine way to do things. I've been able to "capture" the columnview into another .org file and then export that to an HTML file. Is there a way to automate these three steps? Notes on what I did so far follow. In a "notes.org": * Document status :PROPERTIES: :COLUMNS: %25ITEM(Section) %25Responsible %3Received{X} %3Converted{X} %3Editing{X} %3Frozen{X} :Responsible_ALL: Person1 Person2 Person3 :Received_ALL: "[ ]" "[X]" :Converted_ALL: "[ ]" "[X]" :Editing_ALL: "[ ]" "[X]" :Frozen_ALL: "[ ]" "[X]" :ID: document-status :END: ** Section 1 *** Subsection 1.1 :PROPERTIES: :Responsible: Person1 :Received: [X] :Converted: [ ] :END: Etc for other sections. Hints: - only need to add properties in sub (or subsub, etc) sections where they are strictly needed. Parents inherit from children - don't actually edit :PROPERTIES: by hand instead do C-c C-x C-c to turn on columns and "e" in a cell to edit it with values from the list of possible ones in the *_ALL and/or do C-c C-c to toggle values I shall look into adding numerical values to get %-done type columns. Then for presentation. As per http://orgmode.org/manual/Capturing-column-view.html To make presentation with just this tree of info make another file "status.org" with: * Status #+BEGIN: columnview :vlines t :hlines 1 :id "document-status" #+END: Go to "BEGIN" and hit C-c C-c and a table will be inserted. Then a normal export to HTML can be done. -Brett. pgpO6qFZcERmh.pgp Description: PGP signature
[O] Nested list with percent-complete in multiple states?
Hi, I'm helping to edit a large document with section contributions from many people. Any given section may come in some bizarre format (ie, .doc) which I convert to LaTeX, leave open a time for subsequent edits and finally freeze the section. I'd like to track this state using org-mode. So far I've been using a nested checklist like: * Document Sections [0/4] - [-] Chapter 1 [0/3] - [ ] section 1 (person A) - [ ] section 2 (person B) - [ ] section 2 (person C) - [-] Chapter 2 [1/1] - [X] section 1 (Person D) This is okay for binary state, but is there any to have more states represented and get a summary of the percent of each chapter/section in that state? For example, I'd like something like: * Document Sections (received:[1/4] converted:[1/4] frozen:[1/4] missing [1/4]) - [-] Chapter 1 (received:[2/3] converted:[1/3] frozen:[0/3] missing [1/3]) - [ ] section 1 (person A) - [R] section 2 (person B) - [C] section 2 (person C) - [-] Chapter 2 (received:[1/1] converted:[1/1] frozen:[1/1] missing [0/1]) - [F] section 1 (Person D) Is there anything which gets me in this direction? Thanks, -Brett. pgpyM8HpWA7c3.pgp Description: PGP signature
Re: [O] The statement on what is orgmode.
Rasmus writes: >> Orgmode: your life, in plain text. > > I like the idea of a catch phrase (your life, in plain text) and > perhaps a more detailed paragraph belows, potentially with links. This phrase is also what first comes to my mind when I try to explain org-mode to others. However, it is clear there are many apt description-blurbs. How about having a database along the lines of "what people are saying about org-mode" that is initially seeded with what has come up in this thread and then have each refresh of the main org page select and present a new one? I'm sure there are lots of issues and details with this idea so I just toss it out there. -Brett. pgpTinPD3BPee.pgp Description: PGP signature
Re: [O] Embed images in formats best suited for HTML and LaTeX export and inline viewing
Hi Bastien, Bastien writes: > Brett Viren writes: > >> Can they have newlines? > > I don't think so -- did you try? Now, there is an idea! I had not tried, but yes, the are accepted and a "multiline" macro can be defined using '\n' characters like: #+MACRO: mimg #+HTML: $3\n#+LATEX: \begin{figure}\label{$1}\includegraphics[width=\textwidth]{$2.pdf}\caption{$3}\end{figure} I can now call this macro with a single line like: {{{mimg(fig-overview,dataflow,Overview of the data flow.)}}} and both HTML and LaTeX/PDF export produces correct output. I give up the "fig:" style prefix for the label, but that is a small detail. So, I'm satisfied now. Thanks for the nudge! -Brett. pgpiWMT4yBwku.pgp Description: PGP signature
Re: [O] Embed images in formats best suited for HTML and LaTeX export and inline viewing
Hi, I'm back wanting to specify per-export image formats again. I learned about macros in org-mode and I have found a half-solution: #+MACRO: himg #+HTML: $3 #+MACRO: limg #+LATEX: \begin{figure}\label{$1}\includegraphics[width=\textwidth]{$2.pdf}\caption{$3}\end{figure} I then call each macro explicitly: {{{limg(fig:overview,dataflow,Overview of the data flow.)}}} {{{himg(fig-overview,dataflow,Overview of the data flow.)}}} It works but has a few warts: 0) It totally subverts org-mode's figure markup. 1) So far I think I must use two macro calls thus annoyingly repeating data. Can macros be nested? Can they have newlines? 2) I prefer "fig:label" type labels in LaTeX but the HTML export apparently forms the link translating ":" to "-". So, this must be taken into account when the macros are called. Any other ideas? Thanks, -Brett. pgpm463BDDm42.pgp Description: PGP signature
Re: [O] How to integrate org-mode in a MS Windows-/Office-based environment?
Hi Martin, M writes: > One example of helpful integration: if I send or get an e-mail which I want > to follow-up on later, I want to track that in org-mode and I want to have a > way to quickly find the original message in Outlook again (to reply or > forward it or whatever), which can be done with hyperlinks. You can simplify making links to your email messages by creating a custom link abbreviation assuming there is some uniquely identifying chunk of the URL to use as a key. Here are examples using google search and maps: ;; in .emacs (setq org-link-abbrev-alist '( ("google" . "http://www.google.com/search?q=";) ("gmap" . "http://maps.google.com/maps?q=%s";) )) Example org markup: [[google:org-mode][org-mode on google]] -Brett. pgpDDe58dMKmx.pgp Description: PGP signature
Re: [O] Multiple images per figure with LaTeX export
Hi Suvayu, suvayu ali writes: > Glad to see another HEP researcher using org-mode. :) Greetings! > Sadly my solution is a big bad hack: > > #+begin_latex > \begin{figure} > \centering > \begin{tabular}{c} > \includegraphics[]{plots/file1.eps} \\ > \includegraphics[]{plots/file2.eps} > \end{tabular} > \caption[Caption in LOI]{Long caption} > \label{fig:somelabel} > \end{figure} > #+end_latex Okay, thanks! I didn't think about just putting it directly in LaTeX. This will works just fine for my purposes. Cheers, -Brett. pgphrxQPOxCyM.pgp Description: PGP signature
[O] Multiple images per figure with LaTeX export
I'm using GNU emacs 23.2+1-7 and org-mode 6.27a-1 on Debian. I want to put two images in one figure for LaTeX/PDF export but can't find a way. Googling has not born fruit. I have tried a few naive things like: #+caption: Caption. #+label: fig:figure [[./img1.pdf]][[./img2.pdf]] or: #+caption: Caption. #+label: fig:figure [[./img1.pdf]] [[./img2.pdf]] but the resulting export has either two figures with identical captions, each holding one of the images or the first image in a figure and the second image inserted bare. I've also tried to put each image in the cell of a table but that leads to an "undefined control sequence" error. How can this be done? Thanks, -Brett. pgphS6Yo1v4pd.pgp Description: PGP signature
Re: [O] python/babel inline images
henry atting writes: > I do not succeed in generating an inline image as a result of a > python code block. The code itself works, C-c C-c generates the > according picture, but only in my home directory. The code block: Could you not just follow the block with a hand-written link to the output file? Then, when it becomes available toggle "C-c C-x C-v" (once or twice) or "M-x org-display-inline-images" once. Maybe also rewrite the Python to place the output SVG in a directory associated with your ORG file so that link can be relative. I simply use an env. var. to locate where my plots should output. I'm an org-newbie so maybe there are better ways. -Brett. pgpZ7AoYIND5t.pgp Description: PGP signature
[O] Embed images in formats best suited for HTML and LaTeX export and inline viewing
Hi, How can I tell org-mode to use different file formats for an image for different purposes? What I really want is a scalable format to embed "line art" type images (plots) into org-mode documents so that they can display inline and in both HTML and LaTeX exports. SVG seems good for the first two but LaTeX doesn't accept it. Likewise, LaTeX wants PDF but inline and HTML export do not. Anyway to eat my cake? Thanks, -Brett. pgpIaTlUSMolG.pgp Description: PGP signature