How to Fix a Little Eshell Issue

Wanting to set up a pleasant shell environment in Emacs, I invested in getting
Eshell happy. Everything went well but the fact that directory name
completion doesn’t work. The error message appeared:

Invalid variable reference

Lately I’ve been learning more about how to develop (or re-learning depending upon
how you look at it) so I set up the debugger to run when the error occurred:

(toggle-debug-on-error)

to receive:

Debugger entered--Lisp error: (error "Invalid variable reference")
  signal(error ("Invalid variable reference"))
  error("Invalid variable reference")
  eshell-parse-variable-ref()
  eshell-parse-variable()
  eshell-interpolate-variable()
  run-hook-with-args-until-success(eshell-interpolate-variable)
  byte-code("m\204-�\303\304!\206�\305\306f!\306u\210     \204�\202)�\n\204$�    C\307       C\244\210)\202��\306\207" [result eshell-current-argument eshell-arg-listified run-hook-with-args-until-success eshell-parse-argument-hook char-to-string nil t] 2)
  eshell-parse-argument()
  byte-code("m?\205$�`\303 `U\203�\304\305d{\"\210  \203 �\n       C\244\210*\202��\207" [here arg args eshell-parse-argument error "Failed to parse argument '%s'"] 4)
  eshell-parse-arguments(29 #<marker at 43 in *eshell*>)
  byte-code("\303\304         \"\207" [begin end args nil eshell-parse-arguments] 4)
  eshell-complete-parse-arguments()
  pcomplete-parse-arguments(nil)
  #[0 "\306!\2053�   \nU\203� \207\307\f !\206�
\310        T\311     \nV\203.�\312\313!\210\314\315\310\"\210 \210\262\207" [pcomplete-expand-before-complete pcomplete-index pcomplete-last pcomplete-command-completion-function pcomplete-command-name-function pcomplete-default-completion-function pcomplete-parse-arguments pcomplete-find-completion-function nil pcomplete-arg message "No completions" throw pcompleted pcomplete-stub] 5 "\n\n(fn)"]()
  funcall(#[0 "\306!\2053�   \nU\203� \207\307\f !\206�
\310        T\311     \nV\203.�\312\313!\210\314\315\310\"\210 \210\262\207" [pcomplete-expand-before-complete pcomplete-index pcomplete-last pcomplete-command-completion-function pcomplete-command-name-function pcomplete-default-completion-function pcomplete-parse-arguments pcomplete-find-completion-function nil pcomplete-arg message "No completions" throw pcompleted pcomplete-stub] 5 "\n\n(fn)"])
  pcomplete-completions()
  #[0 "\306\211\306\211\306\211\f\f

\307 \310\"\211\2056�\211@\311=?\2056�\211A\2056�\312A@\313>$.\207" [pcomplete-stub pcomplete-seen pcomplete-norm-func pcomplete-args pcomplete-last pcomplete-index nil pcomplete-completions pcomplete-do-complete listed pcomplete-insert-entry (sole shortest) pcomplete-autolist pcomplete-suffix-list pcomplete-last-completion-raw] 8 "\n\n(fn)"]()
  funcall(#[0 "\306\211\306\211\306\211\f\f

\307 \310\"\211\2056�\211@\311=?\2056�\211A\2056�\312A@\313>$.\207" [pcomplete-stub pcomplete-seen pcomplete-norm-func pcomplete-args pcomplete-last pcomplete-index nil pcomplete-completions pcomplete-do-complete listed pcomplete-insert-entry (sole shortest) pcomplete-autolist pcomplete-suffix-list pcomplete-last-completion-raw] 8 "\n\n(fn)"])
  pcomplete(1)
  call-interactively(pcomplete)
  byte-code("\203�\301\302!\207\302 \207" [interactively call-interactively pcomplete] 2)
  eshell-pcomplete(1)
  call-interactively(eshell-pcomplete nil nil)

This stacktrace is simpler because I unloaded yasnippet. This will be a good
project for me to learn more about this environment because right now I’m
not sure how to address an issue like this beyond the standard, universal issue addressing techniques.

Creation and conservation of computer files (C3F)

Wanting to learn literate programming in org-mode I figured that my Emacs configuration would be the simplest place to start. In that regard I was right, it just took a lot more work then I had expected, and that is OK. It was a non-trivial effort and I learned a lot. In my mind, the door is now wide open to utilize literate programming; the org-mode team has truly unleashed an amazing gift to the world and it may take the world some time to really understand and appreciate it.
My configs and document follow; the first one, C3F.html, is the human-readable document:
C3F
ditaa-simple
C3F.org
Cask

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.

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.