From: Stefan Monnier <monnier@iro.umontreal.ca>
To: help-gnu-emacs@gnu.org
Subject: Re: How can I enable minor mode, always?
Date: Fri, 29 Oct 2010 14:20:16 -0400 [thread overview]
Message-ID: <jwvd3qs27eq.fsf-monnier+gnu.emacs.help@gnu.org> (raw)
In-Reply-To: mailman.3.1287810110.20231.help-gnu-emacs@gnu.org
> I want to always have the highlight-80+ mode enabled. In my .emacs file I
> have:
> (load "~/Emacs/highlight-80+.el")
> (require 'highlight-80+)
The require and the load are two different ways to do the same thing:
you can remove either of them.
> (highlight-80+-mode 1)
> However, when I start Emacs the highlight-80+ is not active, I have to
> manually enable it for each new buffer I open.
From what you say, it seems that this mode is buffer-local, so you need
to (re)enable it in each buffer rather than enabling it like this in
your .emacs (which will only end up enabling it in the buffer that
happens to be current when your .emacs is executed).
I suggest you try
(add-hook 'find-file-hook 'highlight-80+-mode)
> My other modes, I want to always have enabled, are enabled as follows (and
> it works for those modes):
> (show-paren-mode 1)
> (setq-default show-trailing-whitespace t)
> (setq column-number-mode t)
> As you can see each mode is enabled is slightly different ways, very
> confusing. Unfortunately none of these methods works for highlight-80+.
Yes, that's unfortunate. Some settings are controlled by functions
others by variables. So there are basically two ways to control
a global setting: calling the function with a an argument 1 or -1, or
applying `setq-default' with a value nil or t. You did it right for the
first two lines:
> (show-paren-mode 1)
> (setq-default show-trailing-whitespace t)
The last line:
> (setq column-number-mode t)
happens to work as well, but I'd recommend you change it to either of
the two (for column-number-mode they both happen to work as well):
(column-number-mode 1)
or
(setq-default column-number-mode t)
The use of `setq-default' makes it explicit that you want the setting to
be global rather than per-buffer.
Stefan
next parent reply other threads:[~2010-10-29 18:20 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.3.1287810110.20231.help-gnu-emacs@gnu.org>
2010-10-29 18:20 ` Stefan Monnier [this message]
2010-10-21 19:46 How can I enable minor mode, always? paxxus
2010-10-23 10:57 ` PJ Weisberg
2010-10-23 15:15 ` Drew Adams
2010-10-26 23:49 ` paxxus
2010-10-27 6:43 ` Oleksandr Gavenko
2010-10-27 16:07 ` PJ Weisberg
2010-10-28 8:57 ` Oleksandr Gavenko
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwvd3qs27eq.fsf-monnier+gnu.emacs.help@gnu.org \
--to=monnier@iro.umontreal.ca \
--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.
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).