Easily set column width in org tables

Org tables are great. Most of the time I rely on the column width auto-resizing feature. Perhaps you want to do force a smaller width though for example. Just specify the width, in its own empty row inside of angled parentheses. Default justification is right. Prefix the number with a l or c to do left or center.
Here is the page. Thanks Tory!

     |---+------------------------------|               |---+--------|
     |   |                              |               |   | <6>    |
     | 1 | one                          |               | 1 | one    |
     | 2 | two                          |     ----\     | 2 | two    |
     | 3 | This is a long chunk of text |     ----/     | 3 | This=> |
     | 4 | four                         |               | 4 | four   |
     |---+------------------------------|               |---+--------|

org-table-edit-field (C-c `) lets you easily edit the entire field and the org super key (C-c C-c) saves it.

A reference card for code execution in org 8

refcard-org-babel “contains the reference documentation that describes how to perform code execution within Org mode documents using Org Babel 8”.
Look forward to referencing this when I read about other’s personal org workflows, and, document down my own.

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.

Easily check src block correctness in org-mode

Thank you Nicolas Goaziou, for the beginnings of an org-lint. The goal here was to:

  1. Report an error if there is a source block without a language
    specified
  2. Report an error if there is a source block with a language specified
    that is not present in `org-babel-load-languages’

And, it does.

(defun gcr/src-block-check ()
  (interactive)
  (org-element-map (org-element-parse-buffer 'element) 'src-block
    (lambda (src-block)
      (let ((language (org-element-property :language src-block)))
        (cond ((null language)
               (error "Missing language at position %d"
                      (org-element-property :post-affiliated src-block)))
              ((not (assoc-string language org-babel-load-languages))
               (error "Unknown language at position %d"
                      (org-element-property :post-affiliated src-block)))))))
  (message "Source blocks checked in %s." (buffer-name (buffer-base-buffer))))

Addendum: 2015-02-05
Sebastien Vauban just posted his improved version to:
– “Check as well for the language of inline code blocks,”
– “Report the line number instead of the char position.”

  (defun org-src-block-check ()
    (interactive)
    (org-element-map (org-element-parse-buffer)
      '(src-block inline-src-block)
      (lambda (sb)
        (let ((language (org-element-property :language sb)))
          (cond ((null language)
                 (error "Missing language at line %d in %s"
                        (org-current-line
                         (org-element-property :post-affiliated sb))
                        (buffer-name)))
                ((not (assoc-string language org-babel-load-languages))
                 (error "Unknown language `%s' at line %d in `%s'"
                        language
                        (org-current-line
                         (org-element-property :post-affiliated sb))
                        (buffer-name)))))))
    (message "Source blocks checked in %s." (buffer-name (buffer-base-buffer))))

Not seeing this post on the web yet so no link.

Notes on ALEC

Last week I blogged about pushing ALEC out to GitHub. My focus there was 100% philosophical, and I barely said a thing about the details. This post is to share some of the details.

ALEC is my 5th attempt and configuring Emacs for myself. After spending nearly a year practicing Org-Mode, this version feels much better than the last. The biggest note is that the system compiles in 27 seconds instead of 600 seconds!

The old approach was to generate both a lightweight and heavyweight configuration file, but that is gone now. With a 27s tangle time, you can easily comment out the source block noweb-references to build what you want quite easily.

Package management was the major theme. Cask has worked perfectly, and I wanted to see how easy easily that I could deploy this system on Windows. When I set out to do so, Cask did not have Windows support. Now I think it does, but I’m not going to pursue it right now. Package seems to do quite well, despite some nagging behavior that still exists (noted in the system) of not installing packages sometimes.

The packages are packaged up and stored in GitHub. Heresy? Perhaps. It is a best attempt at capturing the entirety of a working system, so that I and even others have an example or proof that it does what it should be doing.

Literate programming here is done with Org-Mode. It is an insanely delightful and hyper productivity enhancing tool. It is so simple that the 99% will dismiss it as a “markup language”, and the 1% will soon find that the painful-gap between exploration, implementation, and reflection can now be totally and completely removed regardless of the implementation artifact that you use to perform these three critical tasks.

ALEC's a Language for Expressing Creativity

ALEC is the new configuration of my Emacs/Organization-Mode system. Just wanted to share some thoughts on the experience. The code says a lot, and the text, too, but I’m more interested in the experience.
For context, this is the next step of TC3F.
If nothing else, just know that the tangle time went down from 10m to 27 seconds :).

Continue reading “ALEC's a Language for Expressing Creativity”

Don't run mode hooks during org exports

binchen has a nice post about how to disable org mode hook execution during exports. It can be a surprise when you run in batch mode and your export breaks because of dependency failures. Oh yea, the major mode hooks run during export even though you personally are not opening a buffer, Emacs is doing so!
Here is his solution:

(defun is-buffer-file-temp ()
  (interactive)
  "If (buffer-file-name) is nil or a temp file or HTML file converted from org file"
  (let ((f (buffer-file-name))
        (rlt t))
    (if f
        (if (and (not (string-match temporary-file-directory f))
                 (not (file-exists-p (replace-regexp-in-string "\.html$" ".org" f))))
          (setq rlt nil)))
    rlt))

Interesting.

Org-Mode Details To Accompany Questions

The details that are likely to help questions to be answered on the org mailing list.

(print emacs-version)
(print org-version)
(print (pp-to-string org-babel-default-header-args))
(print (pp-to-string org-babel-default-header-args:R))

=

Eg:

"24.3.1"
"8.2.10"
"((:eval . \"always\")
 (:padline . \"yes\")
 (:noweb . \"no-export\")
 (:exports . \"both\")
 (:results . \"output replace\")
 (:comments . \"noweb\")
 (:session . \"none\")
 (:cache . \"no\")
 (:hlines . \"no\")
 (:tangle . \"no\"))
"
"((:session . \"*R*\"))
"