Go to the first, previous, next, last section, table of contents.


A Modified Mode Line

Finally, a feature I really like: a modified mode line.

Since I sometimes work over a network, I replaced the `Emacs: ' that is normally written on the left hand side of the mode line by the name of the system--otherwise, I forget which machine I am using. In addition, I list the default directory lest I lose track of where I am, and I specify the line point is on, with `Line' spelled out. My `.emacs' file looks like this:

(setq mode-line-system-identification  
  (substring (system-name) 0
             (string-match "\\..+" (system-name))))

(setq default-mode-line-format
      (list ""
            'mode-line-modified
            "<"
            'mode-line-system-identification
            "> "
            "%14b"
            " "
            'default-directory
            " "
            "%[(" 
            'mode-name 
            'minor-mode-alist 
            "%n" 
            'mode-line-process  
            ")%]--" 
             "Line %l--"
            '(-3 . "%P")
            "-%-"))

;; Start with new default.
(setq mode-line-format default-mode-line-format)

I set the default mode line format so as to permit various modes, such as Info, to override it. Many elements in the list are self-explanatory: mode-line-modified is a variable the tells whether the buffer has been modified, mode-name tells the name of the mode, and so on.

The `"%14b"' displays the current buffer name (using the buffer-name function with which we are familiar); the `14' specifies the maximum number of characters that will be displayed. When a name has fewer characters, whitespace is added to fill out to this number. `%[' and `%]' cause a pair of square brackets to appear for each recursive editing level. `%n' says `Narrow' when narrowing is in effect. `%P' tells you the percentage of the buffer that is above the bottom of the window, or `Top', `Bottom', or `All'. (A lower case `p' tell you the percentage above the top of the window.) `%-' inserts enough dashes to fill out the line.

In and after Emacs version 19.29, you can use frame-title-format to set the title of an Emacs frame. This variable has the same structure as mode-line-format.

Mode line formats are described in section `Mode Line Format' in The GNU Emacs Lisp Reference Manual.

Remember, "You don't have to like Emacs to like it" -- your own Emacs can have different colors, different commands, and different keys than a default Emacs.

On the other hand, if you want to bring up a plain `out of the box' Emacs, with no customization, type:

emacs -q

This will start an Emacs that does not load your `~/.emacs' initialization file. A plain, default Emacs. Nothing more.


Go to the first, previous, next, last section, table of contents.