all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Emanuel Berg <embe8573@student.uu.se>
To: help-gnu-emacs@gnu.org
Subject: Re: How can I put display-time to the right of the mode line?
Date: Wed, 11 Dec 2013 16:58:33 +0100	[thread overview]
Message-ID: <87zjo7idkt.fsf@nl106-137-194.student.uu.se> (raw)
In-Reply-To: m2y53rbwdd.fsf@polytechnique.org

Alan Schmitt <alan.schmitt@polytechnique.org> writes:

> Is there a way to have some information in the mode
> line, in my case the time showed by display-time, to be
> at all the way to the right of the mode line?

Yes, I found the mode line is configurable with the
below Elisp [last]. If you want context (and some more
defuns to do various things to the mode line), check
out the entire config file [1].

For a particular mode, you'll need something like this,
in combination with the rest.

;;;; shell / SHELL
(defun set-shell-mode-line ()
  "Mode line: Set the mode line for `shell' use."
  (set-variable '*mode-line-caption*                     "zsh"   t)
  (set-variable '*show-mode-line-caption*                t       t)
  (set-variable '*show-mode-line-modified*               nil     t)
  (set-variable '*show-default-directory*                nil     t)
  (set-variable '*show-mode-line-buffer-identification*  nil     t)
  (set-variable '*show-mode-line-modes*                  nil     t)
  (set-variable 'column-number-mode                      nil     t)
  (set-variable 'line-number-mode                        nil     t) )
(add-hook 'shell-mode-hook 'set-shell-mode-line)

If you can figure out how all that works, you are a
bright guy. What is dynamic and what is not, is all
intermixed at different layers. But if you do the work
of setting it up (mode by mode, if you want it) I can
guarantee it works, as I used it several years by
now. However, that doesn't say, there isn't a better
way to do it.

[1] http://user.it.uu.se/~embe8573/conf/.emacs-mode-line

;;; what to show
(defvar *show-mode-line-caption*)
(setq *show-mode-line-caption* nil)
(defvar *mode-line-caption*)
(defvar *show-mode-line-modified*)
(setq *show-mode-line-modified* t)
(defvar *show-mode-line-buffer-identification*)
(setq *show-mode-line-buffer-identification* t)
(defvar *show-mode-line-modes*)
(setq *show-mode-line-modes* nil)
(setq column-number-mode nil)
(setq line-number-mode nil)
(defvar *show-default-directory*)
(setq *show-default-directory* t)

(defun set-mode-line ()
  "Mode line: Show the mode line elements if the
respective global booleans are set."
  (setq-default mode-line-format
   `(" "
     (*show-mode-line-modified* mode-line-modified)
     (*show-mode-line-modified* " ")
     (*show-mode-line-caption* *mode-line-caption*)
     (*show-mode-line-caption* " ")
     (*show-default-directory* default-directory)
     (*show-mode-line-buffer-identification* mode-line-buffer-identification)
     (*show-mode-line-buffer-identification* " ")
     (line-number-mode   "[%l] ")
     (column-number-mode "{%c} ")
     (*show-mode-line-modes* mode-line-modes)
     )))
(set-mode-line)

-- 
Emanuel Berg, programmer-for-rent. CV, projects, etc at uXu
underground experts united:  http://user.it.uu.se/~embe8573


  reply	other threads:[~2013-12-11 15:58 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-11  8:54 How can I put display-time to the right of the mode line? Alan Schmitt
2013-12-11 15:58 ` Emanuel Berg [this message]
2013-12-12 20:43   ` Alan Schmitt
2013-12-11 21:22 ` Johan Bockgård
2013-12-11 22:17   ` Wes James
2013-12-11 22:48   ` Emanuel Berg
2013-12-11 23:08     ` Johan Bockgård
2013-12-11 23:14       ` Emanuel Berg
2013-12-13 21:07         ` Emanuel Berg
2013-12-14 17:14         ` Rusi
2013-12-14 17:33           ` Emanuel Berg
2013-12-15  5:33             ` Rusi
2013-12-11 23:16       ` Wes James
2013-12-12 20:44   ` Alan Schmitt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zjo7idkt.fsf@nl106-137-194.student.uu.se \
    --to=embe8573@student.uu.se \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.