Northward Midget Pole to Pole


Shell Nuggets: Musing on Dates

Posted by Quinn

Nigh ever day I happen across some gem tucked away in the opaque vista of the *nix command-line shell.   While attempting to contrive the proper arguments for a date command interpolation, the following editorial injection from its GNU info entry caught my fancy.

28 Date input formats
First, a quote:
Our units of temporal measurement, from seconds on up to months,
are so complicated, asymmetrical and disjunctive so as to make
coherent mental reckoning in time all but impossible. Indeed, had
some tyrannical god contrived to enslave our minds to time, to
make it all but impossible for us to escape subjection to sodden
routines and unpleasant surprises, he could hardly have done
better than handing down our present system. It is like a set of
trapezoidal building blocks, with no vertical or horizontal
surfaces, like a language in which the simplest thought demands
ornate constructions, useless particles and lengthy
circumlocutions. Unlike the more successful patterns of language
and science, which enable us to face experience boldly or at least
level-headedly, our system of temporal calculation silently and
persistently encourages our terror of time.
... It is as though architects had to measure length in feet,
width in meters and height in ells; as though basic instruction
manuals demanded a knowledge of five different languages. It is
no wonder then that we often look into our own immediate past or
future, last Tuesday or a week from Sunday, with feelings of
helpless confusion. ...
-- Robert Grudin, `Time and the Art of Living'.
This section describes the textual date representations that GNU
programs accept. These are the strings you, as a user, can supply as
arguments to the various programs. The C interface (via the `get_date'
function) is not described here.

Now back to work.



Emacs Menubar Buffers List Format

Posted by Quinn

And now for something completely different.  No depression updates this time.  A new "Hacking" category and a code tip on getting the full filenames in the menubar buffers list of Emacs.

I use Emacs on my desktop, mostly for the kinds of things (quick copy and pasting and scratch pads) vim's modal model doesn't make altogether easy.  I'm not a vehement advocate of either editor, but of both.

;; Copied from /usr/share/emacs/23.1.50/lisp/menu-bar.el.gz
(defun menu-bar-update-buffers-1 (elt)
  (let* ((buf (car elt))
      (and (if (eq buffers-menu-show-directories 'unless-uniquify)
           (or (not (boundp 'uniquify-buffer-name-style))
               (null uniquify-buffer-name-style))
           (or (buffer-file-name buf)
           (buffer-local-value 'list-buffers-directory buf)))))
    (cons (if buffers-menu-show-status
          (let ((mod (if (buffer-modified-p buf) "*" ""))
            (ro (if (buffer-local-value 'buffer-read-only buf) "%" "")))
        (if file
            (format "%s  %s%s" file mod ro )
          (format "%s  %s%s" (cdr elt) mod ro)))
        (if file
        (format "%s  --  %s"  (cdr elt) file)
          (cdr elt)))

Just add that to your init.el or wherever you put your emacs customizations, and you should see the full path and filename of files in your menubar buffers list instead of the basename then the directory.

Also gonna paste this into my flat-text coredump file, where I'll probably find I've already got some code snippet that solved it.


Tagged as: No Comments