Quantcast
Channel: Eli Boling
Viewing all articles
Browse latest Browse all 10

Minor Emacs Utility

$
0
0

I use Emacs quite a bit.  It’s very common for me to be looking large dumps of data that are tabular in nature.  Symbol table information, usually, but it could be lots of things.  Usually it’s the output of one or another command line utility for dumping some file format.  In any case, it’s also very common for me to get a few hundred lines down into some table, and be looking at an entry, and to forget which column is which.  And so I go back to the header, and look again, then back to the entry.  It’s pretty irritating.  So I whined about this, and someone told me about Emacs Header Lines (http://emacswiki.org/emacs/HeaderLine), and I was very pleased.  So I spit this little function into my .emacs file, and now I can just go to the header line in the file, and toggle my Emacs header line for that buffer, and scroll down to my hearts content, and there’s that nice header line right at the top of the buffer, occupying minimal space, and when I’m done, I toggle it, and it’s gone.  It’s just one of those little things that makes life easier to deal with.  Less pain, more gain.

Here’s the code:

(defun freeze-line-as-header ()
    (interactive)
    (if header-line-format
        (setq header-line-format nil)
      (setq header-line-format (concat " " (buffer-substring (line-beginning-position)
                                                                 (line-end-position)))))
    (force-window-update)
  )
(define-key global-map [(control ?!)] 'freeze-line-as-header)

Viewing all articles
Browse latest Browse all 10

Latest Images

Trending Articles





Latest Images