unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* How to turn off conf-mode
@ 2007-12-11  6:42 Robert L Knighten
  2007-12-11 14:36 ` Rupert Swarbrick
  0 siblings, 1 reply; 9+ messages in thread
From: Robert L Knighten @ 2007-12-11  6:42 UTC (permalink / raw)
  To: help-gnu-emacs

How do I turn off conf-mode in a buffer?  Even more how do I make sure it
doesn't start in a buffer?  I opened a simple text file named cf.out and was
horrified to discover the mode is (Conf[Unix]) rather (Text Fill) as I
expected.  The problem appears to be the name cf, but I haven't been able to
find how that is forcing the mode.

-- 
Robert L. Knighten
RLK@knighten.org

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

* Re: How to turn off conf-mode
  2007-12-11  6:42 How to turn off conf-mode Robert L Knighten
@ 2007-12-11 14:36 ` Rupert Swarbrick
  2007-12-12  6:49   ` Robert L Knighten
  0 siblings, 1 reply; 9+ messages in thread
From: Rupert Swarbrick @ 2007-12-11 14:36 UTC (permalink / raw)
  To: help-gnu-emacs

On Mon, 10 Dec 2007 22:42:29 -0800, Robert L Knighten wrote:

> How do I turn off conf-mode in a buffer?  Even more how do I make sure
> it doesn't start in a buffer?  I opened a simple text file named cf.out
> and was horrified to discover the mode is (Conf[Unix]) rather (Text
> Fill) as I expected.  The problem appears to be the name cf, but I
> haven't been able to find how that is forcing the mode.

To "turn off" any mode, you just switch to another mode, so in your case, 
you'd want M-x text-mode (and possibly also M-x auto-fill-mode).

For doing this in general, you need to look at auto-mode-alist, which I 
don't know enough about to be able to help you much. But frankly, if it's 
just one file you may as well just do it by hand each time or maybe place 
this:
-*- text -*-
In the first line of the file, which is a magic command to tell emacs to 
open the file in text-mode.

To check whether things like your auto-mode-alist or the above -*- thing 
are working, a nice trick is M-x revert-buffer which pretends it's 
opening the file from scratch and rechooses its major mode.

Rupert

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

* Re: How to turn off conf-mode
  2007-12-11 14:36 ` Rupert Swarbrick
@ 2007-12-12  6:49   ` Robert L Knighten
  2007-12-12 20:50     ` Peter Dyballa
       [not found]     ` <mailman.4948.1197492613.18990.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 9+ messages in thread
From: Robert L Knighten @ 2007-12-12  6:49 UTC (permalink / raw)
  To: help-gnu-emacs

Rupert Swarbrick <rswarbrick@gmail.com> writes:

> On Mon, 10 Dec 2007 22:42:29 -0800, Robert L Knighten wrote:
>
>> How do I turn off conf-mode in a buffer?  Even more how do I make sure
>> it doesn't start in a buffer?  I opened a simple text file named cf.out
>> and was horrified to discover the mode is (Conf[Unix]) rather (Text
>> Fill) as I expected.  The problem appears to be the name cf, but I
>> haven't been able to find how that is forcing the mode.
>
> To "turn off" any mode, you just switch to another mode, so in your case, 
> you'd want M-x text-mode (and possibly also M-x auto-fill-mode).

Yes.  Moments after I posted this I realized how silly that question was.
It's really the latter part of the question that is relevant.  

> For doing this in general, you need to look at auto-mode-alist, which I 
> don't know enough about to be able to help you much. 

> But frankly, if it's 
> just one file you may as well just do it by hand each time or maybe place 
> this:
> -*- text -*-
> In the first line of the file, which is a magic command to tell emacs to 
> open the file in text-mode.

The problem is that it is not just one file, and the files are neither named
nor constructed by me.

I think the relevant dotted pair in auto-mode-alist is

 ("[/.]c\\(?:on\\)?f\\(?:i?g\\)?\\(?:\\.[a-zA-Z0-9._-]+\\)?\\'" . conf-mode)

but I don't know what to do about it.  I don't want to simply override this
without understanding what else this will affect.

Thank you for your response.

-- Bob
-- 
Robert L. Knighten
RLK@knighten.org

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

* Re: How to turn off conf-mode
  2007-12-12  6:49   ` Robert L Knighten
@ 2007-12-12 20:50     ` Peter Dyballa
       [not found]     ` <mailman.4948.1197492613.18990.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 9+ messages in thread
From: Peter Dyballa @ 2007-12-12 20:50 UTC (permalink / raw)
  To: Robert L Knighten; +Cc: help-gnu-emacs


Am 12.12.2007 um 07:49 schrieb Robert L Knighten:

> The problem is that it is not just one file, and the files are  
> neither named
> nor constructed by me.
>
> I think the relevant dotted pair in auto-mode-alist is
>
>  ("[/.]c\\(?:on\\)?f\\(?:i?g\\)?\\(?:\\.[a-zA-Z0-9._-]+\\)?\\'" .  
> conf-mode)
>
> but I don't know what to do about it.  I don't want to simply  
> override this
> without understanding what else this will affect.


In my Emacsen .out files are not listed in the set of files for which  
conf-mode should be applied. Or, to be more exact: this is my  
interpretation of the lines and I cannot make .out files open in conf- 
mode. So it's likely that you add something. To find out when it happens

	1.) launch GNU Emacs with --no-init-file and open such a .out file

	2.) launch GNU Emacs with --no-site-file and open such a .out file

In case 1 your personal .emacs or default.el is not loaded, only the  
system's ones.
In case 2 the system's init file(s) is (are) not loaded, only your  
personal one.

If in case 1 the .out file is opened in conf-mode, then the system's  
init file(s) set(s) it.
If in case 2 the .out file is opened in conf-mode, then your personal  
init file sets it.
If in case 1 and in case 2 the .out file is opened in conf-mode, then  
both are polluted and you should launch GNU Emacs with -Q!

If your personal init file sets it, then it's easy to correct the  
setting: delete the statement!
If your system's init file(s) set(s) it, then it's also easy to  
correct the setting in your personal init file: remove the mapping  
from the alist:

	(remove '("<whatever>" . conf-mode) auto-mode-alist)


BTW, the reg-exp you're citation tells (most probably):

	.cfg, .conf, .cnf, .config files are opened in conf-mode.

I don't understand the \\(?:\\.[a-zA-Z0-9._-]+\\) part – can it  
really stand for *any* extension? If it's really that, then remove  
the line cited from auto-mode-alist and add it in a changed form with  
the reg-exp part I don't understand:

	(add-to-list 'auto-mode-alist '("[/.]c\\(?:on\\)?f\\(?:i?g\\)\\'".  
conf-mode))

--
Mit friedvollen Grüßen

   Pete

This is a signature virus.  Add me to your signature and help me to live

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

* Re: How to turn off conf-mode
       [not found]     ` <mailman.4948.1197492613.18990.help-gnu-emacs@gnu.org>
@ 2007-12-12 21:31       ` Sven Joachim
  2007-12-12 22:14         ` Peter Dyballa
  2007-12-13  5:10         ` Robert L Knighten
  0 siblings, 2 replies; 9+ messages in thread
From: Sven Joachim @ 2007-12-12 21:31 UTC (permalink / raw)
  To: help-gnu-emacs

On 2007-12-12 21:50 +0100, Peter Dyballa wrote:

> Am 12.12.2007 um 07:49 schrieb Robert L Knighten:
>
>> I think the relevant dotted pair in auto-mode-alist is
>>
>>  ("[/.]c\\(?:on\\)?f\\(?:i?g\\)?\\(?:\\.[a-zA-Z0-9._-]+\\)?\\'"
>> . conf-mode)
>>
>
> In my Emacsen .out files are not listed in the set of files for which
> conf-mode should be applied. Or, to be more exact: this is my
> interpretation of the lines and I cannot make .out files open in conf- 
> mode.

It's not the .out extension that puts the files into conf-mode, but
rather the cf _before_ the extension.  Just try "emacs -Q cf" and see
what happens.

> So it's likely that you add something. To find out when it happens
>
> 	1.) launch GNU Emacs with --no-init-file and open such a .out file
>
> 	2.) launch GNU Emacs with --no-site-file and open such a .out file
>
> In case 1 your personal .emacs or default.el is not loaded, only the
> system's ones.
> In case 2 the system's init file(s) is (are) not loaded, only your
> personal one.
>
> If in case 1 the .out file is opened in conf-mode, then the system's
> init file(s) set(s) it.
> If in case 2 the .out file is opened in conf-mode, then your personal
> init file sets it.
> If in case 1 and in case 2 the .out file is opened in conf-mode, then
> both are polluted and you should launch GNU Emacs with -Q!
>
> If your personal init file sets it, then it's easy to correct the
> setting: delete the statement!
> If your system's init file(s) set(s) it, then it's also easy to
> correct the setting in your personal init file: remove the mapping
> from the alist:
>
> 	(remove '("<whatever>" . conf-mode) auto-mode-alist)

All this does not apply here, since Robert's report can be reproduced in
"emacs -Q".

> BTW, the reg-exp you're citation tells (most probably):
>
> 	.cfg, .conf, .cnf, .config files are opened in conf-mode.

As are cf.*, conf.*, cnf.*, config.* files.  That's rather broad.

> I don't understand the \\(?:\\.[a-zA-Z0-9._-]+\\) part – can it really
> stand for *any* extension?

It stands for most extensions, actually.

> If it's really that, then remove  the line
> cited from auto-mode-alist and add it in a changed form with  the
> reg-exp part I don't understand:
>
> 	(add-to-list 'auto-mode-alist
> ("[/.]c\\(?:on\\)?f\\(?:i?g\\)\\'". conf-mode))

That would be a good idea.

Cheers,
       Sven

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

* Re: How to turn off conf-mode
  2007-12-12 21:31       ` Sven Joachim
@ 2007-12-12 22:14         ` Peter Dyballa
  2007-12-13  5:10         ` Robert L Knighten
  1 sibling, 0 replies; 9+ messages in thread
From: Peter Dyballa @ 2007-12-12 22:14 UTC (permalink / raw)
  To: Sven Joachim; +Cc: Robert L Knighten, emacs list


Am 12.12.2007 um 22:31 schrieb Sven Joachim:

>> 	(add-to-list 'auto-mode-alist
>> ("[/.]c\\(?:on\\)?f\\(?:i?g\\)\\'". conf-mode))
>
> That would be a good idea.

No, not really! Since you explained that *file names* starting with  
cf etc. are triggering conf-mode, the reg-exp to add to auto-mode- 
alist should not start with with the choice of either / or . ...  
Then, I think, another reg-exp should be added, describing just conf*  
files, to still be able to view/edit standard configure,  
configure.in, config.log, config.sub, config.guess, and config.status  
files. And then, of course, the \\(?:\\.[a-zA-Z0-9._-]+\\) part could  
be kept.

--
Mit friedvollen Grüßen

   Pete
                       ~  o
                        ~_\\_/\
                       ~  O   O

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

* Re: How to turn off conf-mode
  2007-12-12 21:31       ` Sven Joachim
  2007-12-12 22:14         ` Peter Dyballa
@ 2007-12-13  5:10         ` Robert L Knighten
  2007-12-15  4:35           ` Kevin Rodgers
       [not found]           ` <mailman.5051.1197783054.18990.help-gnu-emacs@gnu.org>
  1 sibling, 2 replies; 9+ messages in thread
From: Robert L Knighten @ 2007-12-13  5:10 UTC (permalink / raw)
  To: help-gnu-emacs


Thank you for your comments, they certainly make the issue clearer, but where
I am still confused about how to change this in a useful way.  My problem
isn't just what regular expression to use but rather that the one at issue is
part of the defvar of auto-mode-alist that is created when files.el is an
official part of emacs.  Of course I can change files.el, but I certainly do
not want to do that.  And of course I can just redefine auto-mode-alist
changing only the troublesome part, but again I hope there is a less extreme
solution.

-- Bob

-- 
Robert L. Knighten
RLK@knighten.org

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

* Re: How to turn off conf-mode
  2007-12-13  5:10         ` Robert L Knighten
@ 2007-12-15  4:35           ` Kevin Rodgers
       [not found]           ` <mailman.5051.1197783054.18990.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 9+ messages in thread
From: Kevin Rodgers @ 2007-12-15  4:35 UTC (permalink / raw)
  To: help-gnu-emacs

Robert L Knighten wrote:
> Thank you for your comments, they certainly make the issue clearer, but where
> I am still confused about how to change this in a useful way.  My problem
> isn't just what regular expression to use but rather that the one at issue is
> part of the defvar of auto-mode-alist that is created when files.el is an
> official part of emacs.  Of course I can change files.el, but I certainly do
> not want to do that.  And of course I can just redefine auto-mode-alist
> changing only the troublesome part, but again I hope there is a less extreme
> solution.

Put this in your .emacs file:

(add-to-list 'auto-mode-alist "\\(/\\|\\`\\)cf\\.out\\'" 'text-mode)


-- 
Kevin Rodgers
Denver, Colorado, USA

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

* Re: How to turn off conf-mode
       [not found]           ` <mailman.5051.1197783054.18990.help-gnu-emacs@gnu.org>
@ 2007-12-16  8:33             ` Robert L Knighten
  0 siblings, 0 replies; 9+ messages in thread
From: Robert L Knighten @ 2007-12-16  8:33 UTC (permalink / raw)
  To: help-gnu-emacs

Kevin Rodgers <kevin.d.rodgers@gmail.com> writes:
> Robert L Knighten wrote:
>> Thank you for your comments, they certainly make the issue clearer, but where
>> I am still confused about how to change this in a useful way.  My problem
>> isn't just what regular expression to use but rather that the one at issue is
>> part of the defvar of auto-mode-alist that is created when files.el is an
>> official part of emacs.  Of course I can change files.el, but I certainly do
>> not want to do that.  And of course I can just redefine auto-mode-alist
>> changing only the troublesome part, but again I hope there is a less extreme
>> solution.
>
> Put this in your .emacs file:
>
> (add-to-list 'auto-mode-alist "\\(/\\|\\`\\)cf\\.out\\'" 'text-mode)

Thank you!  That didn't actually work, but it woke me up and I realized that
by adding 
("[/.]c\\(?:on\\)?f\\(?:i?g\\)?\\(?:\\.[a-zA-Z0-9._-]+\\)?\\'" 'text-mode)
to the beginning of auto-mode-alist I could prevent the troublesome behavior.
Not the nicest solution, but it will do for now.

-- 
Robert L. Knighten
RLK@knighten.org

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

end of thread, other threads:[~2007-12-16  8:33 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-11  6:42 How to turn off conf-mode Robert L Knighten
2007-12-11 14:36 ` Rupert Swarbrick
2007-12-12  6:49   ` Robert L Knighten
2007-12-12 20:50     ` Peter Dyballa
     [not found]     ` <mailman.4948.1197492613.18990.help-gnu-emacs@gnu.org>
2007-12-12 21:31       ` Sven Joachim
2007-12-12 22:14         ` Peter Dyballa
2007-12-13  5:10         ` Robert L Knighten
2007-12-15  4:35           ` Kevin Rodgers
     [not found]           ` <mailman.5051.1197783054.18990.help-gnu-emacs@gnu.org>
2007-12-16  8:33             ` Robert L Knighten

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