all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* display-time-string-forms
@ 2007-10-09 23:11 Sean Sieger
  2007-10-10  6:53 ` display-time-string-forms Dieter Wilhelm
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Sean Sieger @ 2007-10-09 23:11 UTC (permalink / raw)
  To: help-gnu-emacs

With M-x apropos display-time, I found the variable and its
documentation, but I don't know elisp.  I was hoping there was some
information in the manual, but no.

Is there a little something I can put in my ~/.emacs to get the form:

yyyymmdd hh:mm

when I toggle fullscreen?  This is what I have there so far:

(defun switch-full-screen ()
  (interactive)
  (shell-command "wmctrl -r :ACTIVE: -btoggle,fullscreen"))
(global-set-key [f11] 'switch-full-screen).

By doing f11, I would now have in my mode line:

20071009 7:10PM

Oh, shoot, in a closely related subject, once I go to fullscreen and
evaluate, in my document, (setq left-margin-width 30) I then do C-x C-b
and f to get back to the document and its updated margin.  Is that nuts
and is there a `real' way to do it?

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

* Re: display-time-string-forms
  2007-10-09 23:11 display-time-string-forms Sean Sieger
@ 2007-10-10  6:53 ` Dieter Wilhelm
  2007-10-10  8:28 ` display-time-string-forms Peter Dyballa
       [not found] ` <mailman.1909.1191999022.18990.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 9+ messages in thread
From: Dieter Wilhelm @ 2007-10-10  6:53 UTC (permalink / raw)
  To: Sean Sieger; +Cc: help-gnu-emacs

Sean Sieger <sean.sieger@gmail.com> writes:

> With M-x apropos display-time, I found the variable and its
> documentation, but I don't know elisp.  I was hoping there was some
> information in the manual, but no.
>
> Is there a little something I can put in my ~/.emacs to get the form:
>
> yyyymmdd hh:mm
>
> when I toggle fullscreen?  This is what I have there so far:
>
> (defun switch-full-screen ()
>   (interactive)
>   (shell-command "wmctrl -r :ACTIVE: -btoggle,fullscreen"))
> (global-set-key [f11] 'switch-full-screen).
>
> By doing f11, I would now have in my mode line:
>
> 20071009 7:10PM
>
> Oh, shoot, in a closely related subject, once I go to fullscreen and
> evaluate, in my document, (setq left-margin-width 30) I then do C-x C-b
> and f to get back to the document and its updated margin.  Is that nuts
> and is there a `real' way to do it?

I have  

  (setq display-time-format "%R %Y-%m-%d")

which gives me

      08:47 2007-10-10

in the mode line.  Please have a look at the documentation to the
function:

   format-time-string

-- 
    Best wishes

    H. Dieter Wilhelm
    Darmstadt, Germany

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

* Re: display-time-string-forms
  2007-10-09 23:11 display-time-string-forms Sean Sieger
  2007-10-10  6:53 ` display-time-string-forms Dieter Wilhelm
@ 2007-10-10  8:28 ` Peter Dyballa
       [not found] ` <mailman.1909.1191999022.18990.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 9+ messages in thread
From: Peter Dyballa @ 2007-10-10  8:28 UTC (permalink / raw)
  To: Sean Sieger; +Cc: help-gnu-emacs


Am 10.10.2007 um 01:11 schrieb Sean Sieger:

> With M-x apropos display-time, I found the variable and its
> documentation, but I don't know elisp.  I was hoping there was some
> information in the manual, but no.
>
> Is there a little something I can put in my ~/.emacs to get the form:
>
> yyyymmdd hh:mm

It isn't ELisp, it's UNIX: 'man strftime' can explain. Then you can  
experiment on the command line with something like:

	date '+%Y%M%d %R%p'

When you've found what you want, you can customise display-time- 
format to become "%Y%M%d %R%p" or your finding.

--
Greetings
   Pete

Clovis' Consideration of an Atmospheric Anomaly:
         The perversity of nature is nowhere better demonstrated
         than by the fact that, when exposed to the same atmosphere,
         bread becomes hard while crackers become soft.

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

* Re: display-time-string-forms
       [not found] ` <mailman.1909.1191999022.18990.help-gnu-emacs@gnu.org>
@ 2007-10-10 12:05   ` Warren Oates
  2007-10-10 16:04     ` display-time-string-forms B. T. Raven
  2007-10-10 18:00     ` display-time-string-forms Sean Sieger
  0 siblings, 2 replies; 9+ messages in thread
From: Warren Oates @ 2007-10-10 12:05 UTC (permalink / raw)
  To: help-gnu-emacs

In article <mailman.1909.1191999022.18990.help-gnu-emacs@gnu.org>,
 Dieter Wilhelm <dieter@duenenhof-wilhelm.de> wrote:

> I have  
> 
>   (setq display-time-format "%R %Y-%m-%d")
> 
> which gives me
> 
>       08:47 2007-10-10
> 
> in the mode line.  Please have a look at the documentation to the
> function:

What steps do you take to get the time to appear in  your modeline? I've 
messed with this and _never_ been able to get the time to appear in mine.
-- 
W. Oates

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

* Re: display-time-string-forms
  2007-10-10 12:05   ` display-time-string-forms Warren Oates
@ 2007-10-10 16:04     ` B. T. Raven
  2007-10-10 18:56       ` display-time-string-forms Drew Adams
  2007-10-10 19:50       ` display-time-string-forms Peter Dyballa
  2007-10-10 18:00     ` display-time-string-forms Sean Sieger
  1 sibling, 2 replies; 9+ messages in thread
From: B. T. Raven @ 2007-10-10 16:04 UTC (permalink / raw)
  To: help-gnu-emacs

Warren Oates wrote:
> In article <mailman.1909.1191999022.18990.help-gnu-emacs@gnu.org>,
>  Dieter Wilhelm <dieter@duenenhof-wilhelm.de> wrote:
> 
>> I have  
>>
>>   (setq display-time-format "%R %Y-%m-%d")
>>
>> which gives me
>>
>>       08:47 2007-10-10
>>
>> in the mode line.  Please have a look at the documentation to the
>> function:
> 
> What steps do you take to get the time to appear in  your modeline? I've 
> messed with this and _never_ been able to get the time to appear in mine.


 From menu:
Options
Customize Emacs
Specific options
display TAB

Then setting 2 of these options should put

'(display-time-day-and-date t)
  '(display-time-mode t nil (time))

into your .emacs custom-set-variables section.
There is also the function

  display-time-string-forms

with which I haven't messed.

Btw, this is in version 21.3. Newer versions certainly have the same 
functionality.

Ed

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

* Re: display-time-string-forms
  2007-10-10 12:05   ` display-time-string-forms Warren Oates
  2007-10-10 16:04     ` display-time-string-forms B. T. Raven
@ 2007-10-10 18:00     ` Sean Sieger
  1 sibling, 0 replies; 9+ messages in thread
From: Sean Sieger @ 2007-10-10 18:00 UTC (permalink / raw)
  To: help-gnu-emacs


   What steps do you take to get the time to appear in  your modeline?

M-x display-time

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

* RE: display-time-string-forms
  2007-10-10 16:04     ` display-time-string-forms B. T. Raven
@ 2007-10-10 18:56       ` Drew Adams
  2007-10-10 19:50       ` display-time-string-forms Peter Dyballa
  1 sibling, 0 replies; 9+ messages in thread
From: Drew Adams @ 2007-10-10 18:56 UTC (permalink / raw)
  To: B. T. Raven, help-gnu-emacs

> >> I have  
> >>   (setq display-time-format "%R %Y-%m-%d")
> >> which gives me
> >>       08:47 2007-10-10
> >> in the mode line.
> > 
> > What steps do you take to get the time to appear in  your 
> > modeline? I've messed with this and _never_ been able to get
> > the time to appear in mine.
> 
> From menu:
> Options
> Customize Emacs
> Specific options
> display TAB
> 
> Then setting 2 of these options should put
> '(display-time-day-and-date t)
>   '(display-time-mode t nil (time))
> 
> into your .emacs custom-set-variables section.
> There is also the function
>   display-time-string-forms
> with which I haven't messed.
> 
> Btw, this is in version 21.3. Newer versions certainly have the same 
> functionality.

Icicles can help you _find_ what you might need to customize:

M-x icicle-vardoc RET .* C-q C-g C-j .*time S-SPC .*mode[- ]line

This shows, as completion candidates, all variables, with their doc strings, for which all of the following are true:

* the variable name matches anything: .*
* the doc string contains "time": .*time
* the doc string also contains either "mode-line" or "mode line":
  .*mode[- ]line

The order in the doc string of "time" and "mode-line" (or "mode line") does not matter - all possible orders are considered when you use `S-SPC'.

The incantation C-q C-g C-j just matches the separator used between variable name and doc string, for each completion candidate. The default separator is C-g C-j, and C-q is used to quote the C-q character. (In Icicles, C-j is self-inserting and does not need to be quoted.)

This quickly shows you the following completion candidates (in *Completions*):

 appt-display-mode-line
 *Non-nil means display minutes to appointment and time on the mode line.
 This is in addition to any other display of appointment messages.
--
 display-time-format
 *String specifying format for displaying the time in the mode line.
 See the function `format-time-string' for an explanation of
 how to write this string.  If this is nil, the defaults
 depend on `display-time-day-and-date' and `display-time-24hr-format'.
--
 display-time-hook
 *List of functions to be called when the time is updated on the mode line.
--
 display-time-interval
 *Seconds between updates of time in the mode line.
--
 display-time-string-forms
 *List of expressions governing display of the time in the mode line.
 For most purposes, you can control the time format using `display-time-format'
 which is a more standard interface.

 This expression is a list of expressions that can involve the keywords
 `load', `day', `month', and `year', `12-hours', `24-hours', `minutes',
 `seconds', all numbers in string form, and `monthname', `dayname', `am-pm',
 and `time-zone' all alphabetic strings, and `mail' a true/nil value.

 For example, the form

  '((substring year -2) "/" month "/" day
    " " 24-hours ":" minutes ":" seconds
    (if time-zone " (") time-zone (if time-zone ")")
    (if mail " Mail" ""))

 would give mode line times like `94/12/30 21:07:48 (UTC)'.
--

You can further reduce the number of candidates by filtering with one or more additional patterns (e.g. S-SPC format).

Even more generally, you can look at all functions and all variables whose doc strings contain the strings "time" and either "mode-line" or "mode line":

M-x icicle-doc RET time S-SPC mode[- ]line

That shows, as completion candidates, the doc strings of all functions and all variables that contain both "time" and either "mode-line" or "mode line", in either order. Click `mouse-2' on any candidate to see it (including the function or variable name) displayed in *Help*. Again, you can use additional patterns to further reduce the number of hits.

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

* Re: display-time-string-forms
  2007-10-10 16:04     ` display-time-string-forms B. T. Raven
  2007-10-10 18:56       ` display-time-string-forms Drew Adams
@ 2007-10-10 19:50       ` Peter Dyballa
  2007-10-11  0:25         ` display-time-string-forms Dieter Wilhelm
  1 sibling, 1 reply; 9+ messages in thread
From: Peter Dyballa @ 2007-10-10 19:50 UTC (permalink / raw)
  To: emacs list; +Cc: Sean Sieger


>  Dieter Wilhelm wrote:
>> I have
>>   (setq display-time-format "%R %Y-%m-%d")
>>
>> which gives me
>>
>>       08:47 2007-10-10

The format "%R %F" should give the same result ...


I made a mistake in my previoups eMail: %R gives 24 hours clock, %I  
gives 12 hours clock. %r is an option, too.

--
Mit friedvollen Grüßen

   Pete

A common mistake that people make when trying to design something  
completely foolproof is to underestimate the ingenuity of complete  
fools.

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

* Re: display-time-string-forms
  2007-10-10 19:50       ` display-time-string-forms Peter Dyballa
@ 2007-10-11  0:25         ` Dieter Wilhelm
  0 siblings, 0 replies; 9+ messages in thread
From: Dieter Wilhelm @ 2007-10-11  0:25 UTC (permalink / raw)
  To: Peter Dyballa; +Cc: emacs list, Sean Sieger

Peter Dyballa <Peter_Dyballa@Web.DE> writes:

>>  Dieter Wilhelm wrote:
>>> I have
>>>   (setq display-time-format "%R %Y-%m-%d")
>>>
>>> which gives me
>>>
>>>       08:47 2007-10-10
>
> The format "%R %F" should give the same result ...

Thanks for the hint, where have snatch that information?  %F is not
documented in the format-time-string function, instead:


  For example, to produce full ISO 8601 format, use "%Y-%m-%dT%T%z".


GNU Emacs 23.0.50.1 (x86_64-pc-linux-gnu, GTK+ Version 2.8.20) of 2007-09-15 on elegiac, modified by Debian

-- 
    Best wishes

    H. Dieter Wilhelm
    Darmstadt, Germany

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

end of thread, other threads:[~2007-10-11  0:25 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-09 23:11 display-time-string-forms Sean Sieger
2007-10-10  6:53 ` display-time-string-forms Dieter Wilhelm
2007-10-10  8:28 ` display-time-string-forms Peter Dyballa
     [not found] ` <mailman.1909.1191999022.18990.help-gnu-emacs@gnu.org>
2007-10-10 12:05   ` display-time-string-forms Warren Oates
2007-10-10 16:04     ` display-time-string-forms B. T. Raven
2007-10-10 18:56       ` display-time-string-forms Drew Adams
2007-10-10 19:50       ` display-time-string-forms Peter Dyballa
2007-10-11  0:25         ` display-time-string-forms Dieter Wilhelm
2007-10-10 18:00     ` display-time-string-forms Sean Sieger

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.