I want to be able to do all my creative writing in a single, plain text environment. Org-mode provides outlining and organization, so what’s next? Well, org-mode is an Emacs major-mode and Emacs, like most text editors was written with programmers in mind. Emacs only added a real word wrap (visual-line-mode) with the last version, an absolute must have for a writer. But printing from Emacs doesn’t do proper word wrapping. So, I dug around and found GNU enscript, a printing program that takes plain text and outputs to a postscript printer with word wrap and lots of other command line options that give me what I want.
Once I nailed down the options (margins, word wrap, extra vertical space between each line, page numbers where I wanted them,etc) I wrote a function (defun) that automated printing with enscript. I also reassigned a key combination and put both in my .emacs (config file). Now when I want to print all I need to do is highlight the text region and press Shift <print>.
I use org-mode to export to Latex and get a professionally typeset copy that’s far superior to anything you can get using a word processor. The latest version of org-mode can export to Open Office / LibreOffice format and if I wanted, I could save to Word format. I use org-mode to export to html and with a few tweaks to the html source and a run through kinglegen, I have a file that can be sideloaded into my Kindle. But for draft copies, I export as plain text and use enscript to print. The graphic at the top of this post is an example of a plain text printout. All this from plain text files that can be read and edited with any text editor.
So what’s next? I need to add some ‘rules’ and tools to my org-mode creative writing environment. I’ll keep the actual story text at the top of the outline with story or chapter as the top level headline then use the next level down for scenes. That’s it — two levels. Then I can use the rest of the outline headings further down for character sketches, plot ideas, notes or whatever strikes my fancy to keep things organized. It’s easy to export only the text but I don’t want headings so what to do?
I solved that issue earlier this evening when I built a regular expression (regexp) that can find all the scene headings:
^.*\*\*.*$
Org-mode uses asterisks to mark headlines, with first level *, second level ** and so on. The above regexp finds the entire line for each scene heading.
I can replace each instance with the latex markup (\bigskip) that puts extra vertical space between scenes. And I can also insert the Latex markup for no indent for the first paragraph of the new scene. Sounds complex but it’s not, especially since I’ll write a function to automate the process once I have it ironed out to my satisfaction.
Now that I know I can tweak org-mode, I’ll lay off for awhile and do some serious writing instead.
Forgive me if I’m asking a stupid question or I missed something here. What is org-mode?
Hi Patti. This post is Part II of a continuing series. I explained what org-mode is last week. To quote from the org-mode website (http://orgmode.org/): “Org: an Emacs Mode for Notes, Planning, and Authoring.”
Oooh, lol.
You are far to smart for me! I can barely get my head wrapped around simple HTML … I think I will slink away now to my MS Word.
Hi Val. It’s not that I’m so smart, I’m just stubborn. I used to do a lot of programming years ago in Basic, Prolog and R:Base. One of the benefits of using programs like Emacs / org-mode is that you can tweak them to suit your way of working. I insist on plain text. I was reading some of Richard Stallman’s (the creator of Emacs) last night. Word stores everything using a secret format that has never been completely decoded and MS has been known to change the format at the most inconvenient times. None for me thanks.
John
Great post…would you share the lisp code with enscript options? I’d love to “borrow” your work and plug it into my org-mode (saves decrypting the enscript man page to get the good looking output you shared in the post).
Thanks,
Steve
Lets see if this works. You can change the enscript command to suit your preferences. I remember playing with the header, etc. This snippet is from my .emacs file. It’s been awhile since I played with this and my memory is a bit sparse.
(defun enscript-pr nil
“print region using enscript”
(interactive)
(shell-command-on-region
(point)
(mark)
“enscript –word-wrap –header=’||$%’ -s 3”
))
Here’s more: I did a key substitution awhile back:
(substitute-key-definition
‘pr-ps-mode-using-ghostscript ‘enscript-pr (current-global-map))
John
I know this is a very old topic, and likely none of the original commenters need this information anymore, but here it is, for anyone who’s just reading now:
Org-mode has its own customizable “export” functions, which have recently been updated to work even better than they did previously. Using the Org exporter allows you to do perhaps even better than what’s mentioned above, and is more flexible (you can make it do all kinds of transformations to your text before it gets printed, if you need those; you can get it to publish two or more different formats automatically; etc etc).
Thanks David,
Org-mode is indeed powerful. I worked out all the LaTeX CLASS, CLASS_OPTIONS & HEADERS (16 lines) that I need to produce a well formatted Pdf of my journal. It’s so easy: C-c C-e d and the Exporter takes my Org file and works the magic.