org-mode Observations 2014-02-24

org-mode style structural editing is available anywhere with the orgstruct-mode minor-mode running.
org-reveal exports Org documents to Reveal.js
org-protocol lets you use emacsclient as a sort of unlimited general purpose API vehicle.
When exporting to LaTeX, you may specify the table width as an attribute.
A Babel session may be “none” to prevent session creation.

Smartparens

Smartparens is minor mode for Emacs that deals with parens pairs and tries to be smart about it. It started as a unification effort to combine functionality of several existing packages in a single, compatible and extensible way to deal with parentheses, delimiters, tags and the like.

The documentation in the link above and this video paints a picture of a tool that looks like a good fit for a wide range of scenarios that we often face.

color-theme-retro-green on Emacs 24

Wonder if anyone is using color-theme anymore; seems like wasted effort to just bail on all of the great themes in there. Today I wanted to get color-theme-retro-green at least working, and here is what it took against 6.5.5 of the Marmalade release:

(defun gcr/plist-to-alist (ls)
  "Convert a plist to an alist. Primarily for old color-theme themes."
  (let ((result nil))
    (while ls
      (add-to-list 'result (cons (car ls) (cadr ls)))
      (setq ls (cddr ls)))
    result))
(defalias 'plist-to-alist 'gcr/plist-to-alist)

Make a change in color-theme.el’s color-theme-retro-green to initialize face and faces with an empty list:

 ;; Build a list of faces without parameters
  (let ((old-faces (face-list))
        (faces '())
        (face '())
        (foreground (or color "green")))

Didn’t find a Github project to submit a patch so I emailed the owner.

One Emacs SML Workflow

Being partial to the full-REPL-reboot style of development (ala DrRacket) for most situations I wanted the same thing in Emacs with sml-mode. The value add is that you know all of your files are saved and that your environment is in a fresh and known state. I came up with this:

(defun gcr/sml-eval-buffer ()
  "Intelligently evaluate a SML buffer."
  (interactive)
  (gcr/save-all-file-buffers)
  (let ((sml-process (get-process "sml")))
    (when sml-process
      (quit-process sml-process)))
  (sleep-for 0.25)
  (let ((sml-buffer (get-buffer "*sml*")))
    (when sml-buffer
      (kill-buffer sml-buffer)))
  (sml-prog-proc-load-file buffer-file-name t))

Only to be delighted (though not surprised) to find yet another nearly identical approach here by wenjun.yan:

(defun isml ()
  "If sml repl exists, then restart it else create a new repl"
  (interactive)
  (when (get-buffer "*sml*")
    (with-current-buffer "*sml*"
      (when (process-live-p "sml")
        (comint-send-eof)))
    (sleep-for 0.2))
  (sml-run "sml" ""))

My urge to attain Emacs Comint mastery only grows.