How to handle the enter key while inside of comment blocks

This post reveals a nice function comment-indent-new-line which gives you the
right kind of indentation for block comments. That got me wondering if my
enter key-binding should do different things depending upon whether or not the
cursor is inside of a comment block or not. Specifically, if it is, then call
the aforementioned function, else call the normal binding. This seems that it
might be an improvement

This post explains how to check if the cursor is inside of a comment block:

(nth 4 (syntax-ppss))

It is not nil when the point (cursor) is inside of a comment block.

Great to know.

I decided not to make this change yet, but, I wanted to capture how, here.

The Lenticular Text Style of Literate Programming

This announcement is pretty exciting because it reveals a new-to-me take on literate programming. The style is to store a single file as a source, and render disparate parts of that file in different buffers in a mode correct for the content.

For example you may have an Emacs Lisp file serve as the source and two separate buffers, one Emacs Lisp and one Organization (Mode), to work on the content, with all of the mode-specific assistance.

Is it a new idea? It is new to me and I am curious to find out about other approaches people have taken to realize this style.

Here is an overview and a nice video that demonstrates it.

A tiny org-mode literate programming Makefile

Basic build for a document:


	caffeinate -s time emacs --batch --no-init-file --load .org-mode.emacs.el --find-file --funcall org-babel-tangle --kill

TC3F.txt: $(INIT)
	caffeinate -s time emacs --batch --no-init-file --load .org-mode.emacs.el --find-file --funcall org-ascii-export-to-ascii --kill

TC3F.html: $(INIT)
	caffeinate -s time emacs --batch --no-init-file --load .org-mode.emacs.el --find-file --funcall org-html-export-to-html --kill

TC3F.pdf: $(INIT)
	caffeinate -s time emacs --batch --no-init-file --load .org-mode.emacs.el --find-file --funcall org-latex-export-to-pdf --kill

all: TC3F.txt TC3F.html TC3F.pdf

	rm $(INIT)
	rm TC3F.txt
	rm TC3F.html
	rm TC3F.pdf

Addendum: 14-06-13

Added caffeinate command.

Easily setting system header arguments in org mode

A little helper function:

(defun gcr/set-org-system-header-arg (property value)
  "Easily set system header arguments in org mode.

PROPERTY is the system-wide value that you would like to modify.

VALUE is the new value you wish to store.

Attribution: URL
  (setq org-babel-default-header-args
        (cons (cons property value)
              (assq-delete-all property org-babel-default-header-args))))

Set your expectations for your org-mode system

This weekend I set up a Makefile for tangling and weaving one of my org documents. Wanting to automate it for the obvious reasons, I also wanted to have a “fresh” environment for the run. Actually, I was hoping that it would be faster, not just fresher.

Playing with the command line arguments for Emacs, I was stunned to get the tangling down to 30s. Could. Not. Believe. It. Down from 8 minutes! Then, I see the warning:

Insufficient requirements. Expected 8.2.6. Found 7.9.3

(From my memory, didn’t copy and paste it)

Uh oh. I screwed something up. Oops.

Glad I added a check!

All org users should have something like this in their code!

(when (not (version= (org-version) "8.2.6"))
    "Insufficient requirements. Expected 8.2.6. Found " (org-version))

There may be more

AddendunM 14-06-09

Thank you SHK and Alexander Baier for pointing out that I should be using version= instead of string-equal.

Lower casing your source block templates

org-mode has nice template expansion for its frequently used blocks via Easy Templates. I wanted them to be lower cased because my document won’t tangle with upper case block statements. Thorsten pointed out which variable needs to be configured. This approach is preferable because it it is temporary:

(mapc (lambda (asc)
        (let ((org-sce-dc (downcase (nth 1 asc))))
          (setf (nth 1 asc) org-sce-dc)))