all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How can I put display-time to the right of the mode line?
@ 2013-12-11  8:54 Alan Schmitt
  2013-12-11 15:58 ` Emanuel Berg
  2013-12-11 21:22 ` Johan Bockgård
  0 siblings, 2 replies; 14+ messages in thread
From: Alan Schmitt @ 2013-12-11  8:54 UTC (permalink / raw)
  To: help-gnu-emacs

Hello,

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?

Thanks,

Alan


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: How can I put display-time to the right of the mode line?
  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
  2013-12-12 20:43   ` Alan Schmitt
  2013-12-11 21:22 ` Johan Bockgård
  1 sibling, 1 reply; 14+ messages in thread
From: Emanuel Berg @ 2013-12-11 15:58 UTC (permalink / raw)
  To: help-gnu-emacs

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


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: How can I put display-time to the right of the mode line?
  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
@ 2013-12-11 21:22 ` Johan Bockgård
  2013-12-11 22:17   ` Wes James
                     ` (2 more replies)
  1 sibling, 3 replies; 14+ messages in thread
From: Johan Bockgård @ 2013-12-11 21:22 UTC (permalink / raw)
  To: help-gnu-emacs

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

> Hello,
>
> 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?

Try something like

  (display-time)
  (setq global-mode-string (remove 'display-time-string global-mode-string))
  (setq mode-line-end-spaces
        (list (propertize " " 'display '(space :align-to (- right 12)))
              'display-time-string))


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: How can I put display-time to the right of the mode line?
  2013-12-11 21:22 ` Johan Bockgård
@ 2013-12-11 22:17   ` Wes James
  2013-12-11 22:48   ` Emanuel Berg
  2013-12-12 20:44   ` Alan Schmitt
  2 siblings, 0 replies; 14+ messages in thread
From: Wes James @ 2013-12-11 22:17 UTC (permalink / raw)
  To: Johan Bockgård; +Cc: help-gnu-emacs

On Wed, Dec 11, 2013 at 2:22 PM, Johan Bockgård <bojohan+news@gnu.org>wrote:

> Alan Schmitt <alan.schmitt@polytechnique.org> writes:
>
> > Hello,
> >
> > 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?
>
> Try something like
>
>   (display-time)
>   (setq global-mode-string (remove 'display-time-string
> global-mode-string))
>   (setq mode-line-end-spaces
>         (list (propertize " " 'display '(space :align-to (- right 12)))
>               'display-time-string))
>

I put this in to scratch buffer and then did M-x eval-buffer, but I don't
see any change.  What am I missing?

Thanks,

-wes


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: How can I put display-time to the right of the mode line?
  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-12 20:44   ` Alan Schmitt
  2 siblings, 1 reply; 14+ messages in thread
From: Emanuel Berg @ 2013-12-11 22:48 UTC (permalink / raw)
  To: help-gnu-emacs

Johan Bockgård <bojohan+news@gnu.org> writes:

> (display-time)
> (setq global-mode-string (remove 'display-time-string
> global-mode-string))
> (setq mode-line-end-spaces (list (propertize " "
> 'display '(space :align-to (- right 12)))
> 'display-time-string))

I don't have `mode-line-end-spaces' - is that something
you got from a module? With Google, smart-mode-line.el
is the second hit for "mode-line-end-spaces".

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


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: How can I put display-time to the right of the mode line?
  2013-12-11 22:48   ` Emanuel Berg
@ 2013-12-11 23:08     ` Johan Bockgård
  2013-12-11 23:14       ` Emanuel Berg
  2013-12-11 23:16       ` Wes James
  0 siblings, 2 replies; 14+ messages in thread
From: Johan Bockgård @ 2013-12-11 23:08 UTC (permalink / raw)
  To: help-gnu-emacs

Emanuel Berg <embe8573@student.uu.se> writes:

> I don't have `mode-line-end-spaces' - is that something you got from a
> module? With Google, smart-mode-line.el is the second hit for
> "mode-line-end-spaces".

It was introduced in Emacs 24.3, I think.


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: How can I put display-time to the right of the mode line?
  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-11 23:16       ` Wes James
  1 sibling, 2 replies; 14+ messages in thread
From: Emanuel Berg @ 2013-12-11 23:14 UTC (permalink / raw)
  To: help-gnu-emacs

Johan Bockgård <bojohan+news@gnu.org> writes:

>> I don't have `mode-line-end-spaces' - is that
>> something you got from a module? With Google,
>> smart-mode-line.el is the second hit for
>> "mode-line-end-spaces".
>
> It was introduced in Emacs 24.3, I think.

Aha, that makes sense. I have GNU Emacs 23.4.1. Perhaps
I should upgrade. But I'm very hesitant to upgrade
stuff. My system always works like a Swiss watch. Only
when I "upgrade", all hell breaks lose. But I should at
least read the NEWS file to find out what I'm missing.

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


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: How can I put display-time to the right of the mode line?
  2013-12-11 23:08     ` Johan Bockgård
  2013-12-11 23:14       ` Emanuel Berg
@ 2013-12-11 23:16       ` Wes James
  1 sibling, 0 replies; 14+ messages in thread
From: Wes James @ 2013-12-11 23:16 UTC (permalink / raw)
  To: Johan Bockgård; +Cc: help-gnu-emacs

On Wed, Dec 11, 2013 at 4:08 PM, Johan Bockgård <bojohan+news@gnu.org>wrote:

> Emanuel Berg <embe8573@student.uu.se> writes:
>
> > I don't have `mode-line-end-spaces' - is that something you got from a
> > module? With Google, smart-mode-line.el is the second hit for
> > "mode-line-end-spaces".
>
> It was introduced in Emacs 24.3, I think.
>

That's probably why it didn't work for me.  I'm on CentOS 6.5, emacs 23.1.1.

Thanks,

-wes


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: How can I put display-time to the right of the mode line?
  2013-12-11 15:58 ` Emanuel Berg
@ 2013-12-12 20:43   ` Alan Schmitt
  0 siblings, 0 replies; 14+ messages in thread
From: Alan Schmitt @ 2013-12-12 20:43 UTC (permalink / raw)
  To: help-gnu-emacs

Hi Emanuel,

Emanuel Berg <embe8573@student.uu.se> writes:

> 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].

Thanks a lot for the suggestion. I'll try to make sense of all this.

Alan


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: How can I put display-time to the right of the mode line?
  2013-12-11 21:22 ` Johan Bockgård
  2013-12-11 22:17   ` Wes James
  2013-12-11 22:48   ` Emanuel Berg
@ 2013-12-12 20:44   ` Alan Schmitt
  2 siblings, 0 replies; 14+ messages in thread
From: Alan Schmitt @ 2013-12-12 20:44 UTC (permalink / raw)
  To: help-gnu-emacs

Hi Johan

Johan Bockgård <bojohan+news@gnu.org> writes:

> Alan Schmitt <alan.schmitt@polytechnique.org> writes:
>
>> Hello,
>>
>> 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?
>
> Try something like
>
>   (display-time)
>   (setq global-mode-string (remove 'display-time-string global-mode-string))
>   (setq mode-line-end-spaces
>         (list (propertize " " 'display '(space :align-to (- right 12)))
>               'display-time-string))

It worked great, thanks a lot!

Alan


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: How can I put display-time to the right of the mode line?
  2013-12-11 23:14       ` Emanuel Berg
@ 2013-12-13 21:07         ` Emanuel Berg
  2013-12-14 17:14         ` Rusi
  1 sibling, 0 replies; 14+ messages in thread
From: Emanuel Berg @ 2013-12-13 21:07 UTC (permalink / raw)
  To: help-gnu-emacs

Emanuel Berg <embe8573@student.uu.se> writes:

>>> I don't have `mode-line-end-spaces' - is that
>>> something you got from a module? With Google,
>>> smart-mode-line.el is the second hit for
>>> "mode-line-end-spaces".
>>
>> It was introduced in Emacs 24.3, I think.
>
> Aha, that makes sense. I have GNU Emacs
> 23.4.1. Perhaps I should upgrade. But I'm very
> hesitant to upgrade stuff. My system always works
> like a Swiss watch. Only when I "upgrade", all hell
> breaks lose. But I should at least read the NEWS file
> to find out what I'm missing.

I upgraded to GNU Emacs 24.3.1, and learned a few
things. First, all hell did *not* break loose: so far,
the only thing that happened was that the face
"modeline" had disappeared (easy enough to replace by
mode-line), *and* I had to re-install w3m-el-snapshot
(very easy with aptitude). Also... on Debian, Emacs
seems to be /usr/bin/emacs (with "where" in zsh, or
"type" in bash), and that is a link to
/etc/alternatives/emacs, which in turn is a link to
/usr/bin/emacs24-x (after the upgrade). So there is
still a /usr/bin/emacs23-x if it blows up in your
face. I thought I'd mention this so as not to spread
disinformation and discourage people to upgrade.

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


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: How can I put display-time to the right of the mode line?
  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
  1 sibling, 1 reply; 14+ messages in thread
From: Rusi @ 2013-12-14 17:14 UTC (permalink / raw)
  To: help-gnu-emacs

On Thursday, December 12, 2013 4:44:59 AM UTC+5:30, Emanuel Berg wrote:
> Johan Bockgård writes:

> >> I don't have `mode-line-end-spaces' - is that
> >> something you got from a module? With Google,
> >> smart-mode-line.el is the second hit for
> >> "mode-line-end-spaces".
> > It was introduced in Emacs 24.3, I think.

> Aha, that makes sense. I have GNU Emacs 23.4.1. Perhaps
> I should upgrade. But I'm very hesitant to upgrade
> stuff. My system always works like a Swiss watch. Only
> when I "upgrade", all hell breaks lose.

Like the 'swiss' watches made in China? <Wink-Wink>
http://en.wikipedia.org/wiki/Swiss_Made#The_50.25_Rule_for_Swiss_Made_watches

Little more seriously: I upgraded my debian 2-3 days ago and it
crashed harder than Ive ever seen.  Just could not log in. With a lot
of difficulty logged in and filed a bug-report. Was told that my gdm
and my kernel version did not agree


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: How can I put display-time to the right of the mode line?
  2013-12-14 17:14         ` Rusi
@ 2013-12-14 17:33           ` Emanuel Berg
  2013-12-15  5:33             ` Rusi
  0 siblings, 1 reply; 14+ messages in thread
From: Emanuel Berg @ 2013-12-14 17:33 UTC (permalink / raw)
  To: help-gnu-emacs

Rusi <rustompmody@gmail.com> writes:

>> Aha, that makes sense. I have GNU Emacs
>> 23.4.1. Perhaps I should upgrade. But I'm very
>> hesitant to upgrade stuff. My system always works
>> like a Swiss watch. Only when I "upgrade", all hell
>> breaks lose.
>
> Like the 'Swiss' watches made in China? <Wink-Wink>
>
> Little more seriously: I upgraded my Debian 2-3 days
> ago and it crashed harder than I've ever seen.  Just
> could not log in. With a lot of difficulty logged in
> and filed a bug-report. Was told that my gdm and my
> kernel version did not agree.

What Debian release do you use?

I have these repositories

deb-src http://ftp.se.debian.org/debian/ jessie main contrib
deb http://ftp.se.debian.org/debian/ jessie main contrib

which sure looks like Jessie to me, but on the other
hand, with

cat /etc/os-release

I get

PRETTY_NAME="Debian GNU/Linux 7.0 (wheezy)"
NAME="Debian GNU/Linux"
VERSION_ID="7.0"
VERSION="7.0 (wheezy)"
ID=debian
ANSI_COLOR="1;31"
HOME_URL="http://www.debian.org/"
SUPPORT_URL="http://www.debian.org/support/"
BUG_REPORT_URL="http://bugs.debian.org/"

and with

lsb_release -a

I get

Distributor ID:   Debian
Description:   Debian GNU/Linux 7.0 (wheezy)
Release: 7.0
Codename:   wheezy

But as for upgrading, aptitude uses those repositories
so in practice I should use Jessie (right?).

The reason I mention it is that Jessie should be more
sensitive to upgrades (naturally). Only upgrade when
you experience problems, or when you want to upgrade
one specific piece of software. Never upgrade
everything "just because". That's my piece of advice,
anyway.

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


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: How can I put display-time to the right of the mode line?
  2013-12-14 17:33           ` Emanuel Berg
@ 2013-12-15  5:33             ` Rusi
  0 siblings, 0 replies; 14+ messages in thread
From: Rusi @ 2013-12-15  5:33 UTC (permalink / raw)
  To: help-gnu-emacs

On Saturday, December 14, 2013 11:03:36 PM UTC+5:30, Emanuel Berg wrote:
> Rusi  writes:

> >> Aha, that makes sense. I have GNU Emacs
> >> 23.4.1. Perhaps I should upgrade. But I'm very
> >> hesitant to upgrade stuff. My system always works
> >> like a Swiss watch. Only when I "upgrade", all hell
> >> breaks lose.

> > Little more seriously: I upgraded my Debian 2-3 days
> > ago and it crashed harder than I've ever seen.  Just
> > could not log in. With a lot of difficulty logged in
> > and filed a bug-report. Was told that my gdm and my
> > kernel version did not agree.

> What Debian release do you use?

Jessie

I seemed to have only specific 2.6 versions. Now installed the
meta-package depending on the current versions -- linux-image-686-pae
linux-headers-686-pae -- and its working (as far as I know).


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2013-12-15  5:33 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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.