unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* .emacs - minor mode behavior
@ 2007-02-13 21:54 J K
  2007-02-14  3:24 ` Kevin Rodgers
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: J K @ 2007-02-13 21:54 UTC (permalink / raw)
  To: help-gnu-emacs

I'm just learning Emacs and have recently started working on a .emacs
file for myself.  I was hoping someone could answer what I think is
probably a simple question:

During customization of the mode line, I was able to turn on column-
number-mode with the following line in .emacs:

(setq column-number-mode t)

I understand that this line is setting 'column-number-mode to t
(true).  I also understand that this variable is created along with
the column-number-mode function by the define-minor-mode macro in
simple.el.

I then proceeded to attempt to add the time to the mode line with the
line:

(setq display-time-mode t)

This doesn't work.  I have seen that you can instead call the function
with a positive argument like so:

(display-time-mode 1)

But I don't understand why the first method doesn't work.  I think the
problem is that I don't know how emacs goes from variables being set
to t/nil to actually drawing the screen, but I was hoping to avoid
digging that deep as I still am learning.  Could someone please help
me to understand?

Also - I've read quite a few posts in this group, and it seems like
most folks lean toward using customize as opposed to hand
editing .emacs.  Am I making things harder on myself?

Thanks for the information.

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

* Re: .emacs - minor mode behavior
  2007-02-13 21:54 J K
@ 2007-02-14  3:24 ` Kevin Rodgers
  2007-02-14 17:04 ` Stefan Monnier
  2007-02-15 13:13 ` Robert Thorpe
  2 siblings, 0 replies; 5+ messages in thread
From: Kevin Rodgers @ 2007-02-14  3:24 UTC (permalink / raw)
  To: help-gnu-emacs

J K wrote:
> I'm just learning Emacs and have recently started working on a .emacs
> file for myself.  I was hoping someone could answer what I think is
> probably a simple question:
> 
> During customization of the mode line, I was able to turn on column-
> number-mode with the following line in .emacs:
> 
> (setq column-number-mode t)
> 
> I understand that this line is setting 'column-number-mode to t
> (true).  I also understand that this variable is created along with
> the column-number-mode function by the define-minor-mode macro in
> simple.el.
> 
> I then proceeded to attempt to add the time to the mode line with the
> line:
> 
> (setq display-time-mode t)
> 
> This doesn't work.  I have seen that you can instead call the function
> with a positive argument like so:
> 
> (display-time-mode 1)
> 
> But I don't understand why the first method doesn't work.  I think the
> problem is that I don't know how emacs goes from variables being set
> to t/nil to actually drawing the screen, but I was hoping to avoid
> digging that deep as I still am learning.  Could someone please help
> me to understand?

Some minor modes are simple enough that all you need to do is set a
variable to turn them on.  But some are not, in which case the variable
is merely an indicator of whether the mode is on or not.
display-time-mode is one of the latter; see the third sentence of its
doc string:

,----[ C-h v display-time-mode RET ]
| display-time-mode is a variable defined in `time.el'.
| Its value is nil
|
|
| Documentation:
| Non-nil if Display-Time mode is enabled.
| See the command `display-time-mode' for a description of this minor-mode.
| Setting this variable directly does not take effect;
| either customize it (see the info node `Easy Customization')
| or call the function `display-time-mode'.
|
| You can customize this variable.
|
| [back]
`----

> Also - I've read quite a few posts in this group, and it seems like
> most folks lean toward using customize as opposed to hand
> editing .emacs.  Am I making things harder on myself?

Perhaps.  But since I had used Emacs for about 15 years before custom
came along, I prefer to stick with .emacs.


-- 
Kevin Rodgers
Denver, Colorado, USA

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

* Re: .emacs - minor mode behavior
  2007-02-13 21:54 J K
  2007-02-14  3:24 ` Kevin Rodgers
@ 2007-02-14 17:04 ` Stefan Monnier
  2007-02-15 13:13 ` Robert Thorpe
  2 siblings, 0 replies; 5+ messages in thread
From: Stefan Monnier @ 2007-02-14 17:04 UTC (permalink / raw)
  To: help-gnu-emacs

> (setq column-number-mode t)

> I understand that this line is setting 'column-number-mode to t
> (true).  I also understand that this variable is created along with
> the column-number-mode function by the define-minor-mode macro in
> simple.el.

And it just happens to work because the definition of the minor mode is
sufficiently simple.  Better to use

  (column-number-mode 1)


-- Stefan

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

* Re: .emacs - minor mode behavior
@ 2007-02-14 21:48 A Soare
  0 siblings, 0 replies; 5+ messages in thread
From: A Soare @ 2007-02-14 21:48 UTC (permalink / raw)
  To: Emacs   Help  [help-gnu-emacs]

look also to the code of default-mode-line-format,mode-line-format to find out more about mode line.

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

* Re: .emacs - minor mode behavior
  2007-02-13 21:54 J K
  2007-02-14  3:24 ` Kevin Rodgers
  2007-02-14 17:04 ` Stefan Monnier
@ 2007-02-15 13:13 ` Robert Thorpe
  2 siblings, 0 replies; 5+ messages in thread
From: Robert Thorpe @ 2007-02-15 13:13 UTC (permalink / raw)
  To: help-gnu-emacs

> Also - I've read quite a few posts in this group, and it seems like
> most folks lean toward using customize as opposed to hand
> editing .emacs.  Am I making things harder on myself?

It depends on what you're doing, some modes don't properly support
customize and of-course you can't write elisp programs in customize.
But where you can use customize it is useful.

I use it for most of my customizations, but some still live in elisp.

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

end of thread, other threads:[~2007-02-15 13:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-02-14 21:48 .emacs - minor mode behavior A Soare
  -- strict thread matches above, loose matches on Subject: below --
2007-02-13 21:54 J K
2007-02-14  3:24 ` Kevin Rodgers
2007-02-14 17:04 ` Stefan Monnier
2007-02-15 13:13 ` Robert Thorpe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).