[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

easy mode-line manipulation

From: Juanma Barranquero
Subject: easy mode-line manipulation
Date: Tue, 23 Oct 2001 18:43:19 +0200


I've been thinking for a while about making a module to ease
manipulation of the mode-line; or, more specifically, of

I often want to define alternate mode-lines that are almost like the
standard one, but for a few differences. For example, I like showing the
line/column in "l/c" format, instead of "Ln--Cn", and adding private
data at the end of the mode-line.

Currently you can do that by "direct" manipulation of the default
format, but that is cumbersome and error-prone. There's no easy way to
reuse the existing properties, among other things. The value of
mode-line-format is complex and unstructured.

What I envision is splitting up the mode-line value in logical sections
and elements (via attributes would be easy, I think), and defining
functions to manipulate those sections and the elements inside them,
so for example:

(setq my-mode-line
      (mode-line-modify (copy-mode-line 'standard)
                        :section 'position-info
                        :help 'default

would replace the position-info section's contents (that presumibly
would include the current "L%l" and "C%c" specifiers) with the string
"%l/%c" propertized with the default help attribute.

Other posibilities:

(mode-line-add    my-mode-line :section 'mule :position 'before "My Emacs: ")
(mode-line-delete my-mode-line :element 'frame-identification)

(mode-line-modify my-mode-line
                  :end 'buffer-file-name
                  :help (mode-line-help my-mode-line :element 

Etc, etc. Obviously, the interface is not well-thought yet.

So the question is: is that worthwhile, or am I the only one
interested on it?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]