all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* enriched-mode problems
@ 2005-06-15  5:08 Werner LEMBERG
  2005-06-15 13:07 ` Lute Kamstra
  0 siblings, 1 reply; 20+ messages in thread
From: Werner LEMBERG @ 2005-06-15  5:08 UTC (permalink / raw)



If I put

  Local Variables:
  mode: enriched
  End:

into a file and I load it into Emacs, I get the message

  Toggling enriched-mode off; better pass an explicit argument.

Why?


    Werner

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

* Re: enriched-mode problems
  2005-06-15  5:08 enriched-mode problems Werner LEMBERG
@ 2005-06-15 13:07 ` Lute Kamstra
  2005-06-15 13:18   ` Werner LEMBERG
                     ` (2 more replies)
  0 siblings, 3 replies; 20+ messages in thread
From: Lute Kamstra @ 2005-06-15 13:07 UTC (permalink / raw)
  Cc: emacs-devel

Werner LEMBERG <wl@gnu.org> writes:

> If I put
>
>   Local Variables:
>   mode: enriched
>   End:
>
> into a file and I load it into Emacs, I get the message
>
>   Toggling enriched-mode off; better pass an explicit argument.
>
> Why?

I did a quick analysis:

When you save a file with enriched minor mode on, it inserts

  Content-Type: text/enriched

at the top of the file.  The next time you load it, this text turns
enriched mode on.  Then the "mode: enriched" at the end of the file
switches it off again.  Not using the "mode: enriched" local variable
probably solves your problem.

I've got the same problem with auto-fill sometimes.  I switch that
mode on with text-mode-hook.  When I visit a text file that has "mode:
auto-fill", it is effectively turned off.  Maybe we should do
(some-minor-mode 1) for "mode: some-minor-mode" constructs.

Lute.

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

* Re: enriched-mode problems
  2005-06-15 13:07 ` Lute Kamstra
@ 2005-06-15 13:18   ` Werner LEMBERG
  2005-06-15 13:28   ` Ralf Angeli
  2005-06-16  4:07   ` Richard Stallman
  2 siblings, 0 replies; 20+ messages in thread
From: Werner LEMBERG @ 2005-06-15 13:18 UTC (permalink / raw)
  Cc: emacs-devel

> I've got the same problem with auto-fill sometimes.  I switch that
> mode on with text-mode-hook.  When I visit a text file that has
> "mode: auto-fill", it is effectively turned off.  Maybe we should do
> (some-minor-mode 1) for "mode: some-minor-mode" constructs.

Sounds reasonable.


    Werner

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

* Re: enriched-mode problems
  2005-06-15 13:07 ` Lute Kamstra
  2005-06-15 13:18   ` Werner LEMBERG
@ 2005-06-15 13:28   ` Ralf Angeli
  2005-06-15 14:39     ` Lute Kamstra
  2005-06-15 16:28     ` Stefan Monnier
  2005-06-16  4:07   ` Richard Stallman
  2 siblings, 2 replies; 20+ messages in thread
From: Ralf Angeli @ 2005-06-15 13:28 UTC (permalink / raw)


* Lute Kamstra (2005-06-15) writes:

> I've got the same problem with auto-fill sometimes.  I switch that
> mode on with text-mode-hook.  When I visit a text file that has "mode:
> auto-fill", it is effectively turned off.  Maybe we should do
> (some-minor-mode 1) for "mode: some-minor-mode" constructs.

I'd prefer a way where it is possible to define explicitely if the
mode should be turned on or off.  One way could be to let people add a
second value to the "mode:" keyword, e.g. "mode: some-mode 1" for
turning a mode on.  Another possibility could be to recognize mode
variables and call the respective mode functions with the given values
if they are encountered.  The latter solution is probably a bit
problematic because people don't expect a function to be called when a
variable is set.

-- 
Ralf

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

* Re: enriched-mode problems
  2005-06-15 13:28   ` Ralf Angeli
@ 2005-06-15 14:39     ` Lute Kamstra
  2005-06-15 15:20       ` David Kastrup
  2005-06-15 15:21       ` Ralf Angeli
  2005-06-15 16:28     ` Stefan Monnier
  1 sibling, 2 replies; 20+ messages in thread
From: Lute Kamstra @ 2005-06-15 14:39 UTC (permalink / raw)
  Cc: emacs-devel

Ralf Angeli <angeli@iwi.uni-sb.de> writes:

> * Lute Kamstra (2005-06-15) writes:
>
>> I've got the same problem with auto-fill sometimes.  I switch that
>> mode on with text-mode-hook.  When I visit a text file that has "mode:
>> auto-fill", it is effectively turned off.  Maybe we should do
>> (some-minor-mode 1) for "mode: some-minor-mode" constructs.
>
> I'd prefer a way where it is possible to define explicitely if the
> mode should be turned on or off.

Could you give an example of a situation where it would be useful to
turn a minor mode off for a certain file?

Lute.

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

* Re: enriched-mode problems
  2005-06-15 14:39     ` Lute Kamstra
@ 2005-06-15 15:20       ` David Kastrup
  2005-06-15 15:21       ` Ralf Angeli
  1 sibling, 0 replies; 20+ messages in thread
From: David Kastrup @ 2005-06-15 15:20 UTC (permalink / raw)
  Cc: Ralf Angeli, emacs-devel

Lute Kamstra <Lute.Kamstra.lists@xs4all.nl> writes:

> Ralf Angeli <angeli@iwi.uni-sb.de> writes:
>
>> * Lute Kamstra (2005-06-15) writes:
>>
>>> I've got the same problem with auto-fill sometimes.  I switch that
>>> mode on with text-mode-hook.  When I visit a text file that has "mode:
>>> auto-fill", it is effectively turned off.  Maybe we should do
>>> (some-minor-mode 1) for "mode: some-minor-mode" constructs.
>>
>> I'd prefer a way where it is possible to define explicitely if the
>> mode should be turned on or off.
>
> Could you give an example of a situation where it would be useful to
> turn a minor mode off for a certain file?

A default of the possible global preference "TeX-PDF-mode t" might
need to get turned off for particular files that won't compile in PDF
generating mode.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

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

* Re: enriched-mode problems
  2005-06-15 14:39     ` Lute Kamstra
  2005-06-15 15:20       ` David Kastrup
@ 2005-06-15 15:21       ` Ralf Angeli
  1 sibling, 0 replies; 20+ messages in thread
From: Ralf Angeli @ 2005-06-15 15:21 UTC (permalink / raw)
  Cc: emacs-devel

* Lute Kamstra (2005-06-15) writes:

> Ralf Angeli <angeli@iwi.uni-sb.de> writes:
>
>> I'd prefer a way where it is possible to define explicitely if the
>> mode should be turned on or off.
>
> Could you give an example of a situation where it would be useful to
> turn a minor mode off for a certain file?

For example in case of LaTeX files in connection with AUCTeX.  AUCTeX
allows you to switch between DVI and PDF output by means of a minor
mode.  Now if your user preference is to have PDF output you'd
activate the PDF minor mode globally for all LaTeX files.  But there
may be files which cannot be compiled with PDFLaTeX in PDF mode.  For
these files you have to disable the PDF minor mode somehow.

I can imagine that there may be other examples with minor modes like
Auto Fill mode where you normally have it enabled when editing a file
in Text mode, but where you occasionally have to deal with files in
Text mode where Auto Fill mode should be turned off because long lines
have to stay intact.  I don't have a concrete example here, though.

-- 
Ralf

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

* Re: enriched-mode problems
  2005-06-15 13:28   ` Ralf Angeli
  2005-06-15 14:39     ` Lute Kamstra
@ 2005-06-15 16:28     ` Stefan Monnier
  2005-06-15 18:30       ` Ralf Angeli
  1 sibling, 1 reply; 20+ messages in thread
From: Stefan Monnier @ 2005-06-15 16:28 UTC (permalink / raw)
  Cc: emacs-devel

> turning a mode on.  Another possibility could be to recognize mode
> variables and call the respective mode functions with the given values
> if they are encountered.

That would be good.  Especially since it would solve the problem where you
can't both specify "text-mode" and "flyspell-mode" at the same time (IIRC
the first mode spec which changes the major mode prevents further mode
specs from being considered, but placing flyspell-mode before text-mode
makes no sense since text-mode turns off flylspell-mode).


        Stefan

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

* Re: enriched-mode problems
  2005-06-15 16:28     ` Stefan Monnier
@ 2005-06-15 18:30       ` Ralf Angeli
  2005-06-15 18:59         ` Stefan Monnier
  0 siblings, 1 reply; 20+ messages in thread
From: Ralf Angeli @ 2005-06-15 18:30 UTC (permalink / raw)


* Stefan Monnier (2005-06-15) writes:

>> turning a mode on.  Another possibility could be to recognize mode
>> variables and call the respective mode functions with the given values
>> if they are encountered.
>
> That would be good.

Actually a t value of the variable might have to be mapped to a value
of 1 for the function argument and nil to 0 or -1.

> Especially since it would solve the problem where you
> can't both specify "text-mode" and "flyspell-mode" at the same time (IIRC
> the first mode spec which changes the major mode prevents further mode
> specs from being considered, but placing flyspell-mode before text-mode
> makes no sense since text-mode turns off flylspell-mode).

Hm, upon opening a file with name "test" and the contents

Local Variables:
mode: text
mode: flyspell
End:

both modes are active.

-- 
Ralf

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

* Re: enriched-mode problems
  2005-06-15 18:30       ` Ralf Angeli
@ 2005-06-15 18:59         ` Stefan Monnier
  0 siblings, 0 replies; 20+ messages in thread
From: Stefan Monnier @ 2005-06-15 18:59 UTC (permalink / raw)
  Cc: emacs-devel

> Hm, upon opening a file with name "test" and the contents

> Local Variables:
> mode: text
> mode: flyspell
> End:

> both modes are active.

Hmm...indeed...I must be misremembreing.  Either it was another problem, or
it got fixed in the mean time.  Oh well, I guess that's good ;-)


        Stefan

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

* Re: enriched-mode problems
  2005-06-15 13:07 ` Lute Kamstra
  2005-06-15 13:18   ` Werner LEMBERG
  2005-06-15 13:28   ` Ralf Angeli
@ 2005-06-16  4:07   ` Richard Stallman
  2005-06-16 11:45     ` Lute Kamstra
  2 siblings, 1 reply; 20+ messages in thread
From: Richard Stallman @ 2005-06-16  4:07 UTC (permalink / raw)
  Cc: emacs-devel

    I've got the same problem with auto-fill sometimes.  I switch that
    mode on with text-mode-hook.  When I visit a text file that has "mode:
    auto-fill", it is effectively turned off.  Maybe we should do
    (some-minor-mode 1) for "mode: some-minor-mode" constructs.

That would be hard, since the code doesn't know whether the mode
is a minor or major mode.  But worse than that, it is misguided.

It would be a mistake to try to make this "work", since it is
misguided ayway.  Minor modes such as auto-fill mode are personal
choices; files should not specify them at all.

It might be useful to find a way to arrange a warning when files use
Mode: or -*-...-*- to specify minor modes.

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

* Re: enriched-mode problems
  2005-06-16  4:07   ` Richard Stallman
@ 2005-06-16 11:45     ` Lute Kamstra
  2005-06-17  4:38       ` Richard Stallman
  0 siblings, 1 reply; 20+ messages in thread
From: Lute Kamstra @ 2005-06-16 11:45 UTC (permalink / raw)
  Cc: emacs-devel

Richard Stallman <rms@gnu.org> writes:

>     I've got the same problem with auto-fill sometimes.  I switch that
>     mode on with text-mode-hook.  When I visit a text file that has "mode:
>     auto-fill", it is effectively turned off.  Maybe we should do
>     (some-minor-mode 1) for "mode: some-minor-mode" constructs.
>
> That would be hard, since the code doesn't know whether the mode
> is a minor or major mode.

Can't you tell a major mode from a minor mode by looking at the
argument list?

> But worse than that, it is misguided.
>
> It would be a mistake to try to make this "work", since it is
> misguided ayway.  Minor modes such as auto-fill mode are personal
> choices; files should not specify them at all.

While I tend to agree with you in theory (for the case of auto-fill
mode), the problem still bites me in practice.  I don't control all
files I visit.  Other people might put "mode: auto-fill" in a file and
that will cause problems for me.  Also, it is quite clear that someone
intends to turn auto-fill on in that case.  So why not do that instead
of toggling?

> It might be useful to find a way to arrange a warning when files use
> Mode: or -*-...-*- to specify minor modes.

In general, there are examples of minor modes (Ralf and David gave an
example) for which it is useful to turn them on (or off) for a certain
file because of the _contents_ of that file.  So it would be nice to
have a mechanism to do this.

Lute.

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

* Re: enriched-mode problems
  2005-06-16 11:45     ` Lute Kamstra
@ 2005-06-17  4:38       ` Richard Stallman
  2005-06-19 10:41         ` Lute Kamstra
  0 siblings, 1 reply; 20+ messages in thread
From: Richard Stallman @ 2005-06-17  4:38 UTC (permalink / raw)
  Cc: emacs-devel

    > It might be useful to find a way to arrange a warning when files use
    > Mode: or -*-...-*- to specify minor modes.

    In general, there are examples of minor modes (Ralf and David gave an
    example) for which it is useful to turn them on (or off) for a certain
    file because of the _contents_ of that file.  So it would be nice to
    have a mechanism to do this.

I don't understand what the scenario would be.  Why would those
minor modes be on, in the first place, in these files?

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

* Re: enriched-mode problems
  2005-06-17  4:38       ` Richard Stallman
@ 2005-06-19 10:41         ` Lute Kamstra
  2005-06-20  3:49           ` Richard Stallman
  0 siblings, 1 reply; 20+ messages in thread
From: Lute Kamstra @ 2005-06-19 10:41 UTC (permalink / raw)
  Cc: emacs-devel

Richard Stallman <rms@gnu.org> writes:

>     > It might be useful to find a way to arrange a warning when files use
>     > Mode: or -*-...-*- to specify minor modes.
>
>     In general, there are examples of minor modes (Ralf and David gave an
>     example) for which it is useful to turn them on (or off) for a certain
>     file because of the _contents_ of that file.  So it would be nice to
>     have a mechanism to do this.
>
> I don't understand what the scenario would be.  Why would those
> minor modes be on, in the first place, in these files?

[Maybe Ralf or David can correct me if I'm wrong, but this is how I
understand the situation.]

AUCTeX provides a major mode for editing LaTeX file.  Normally, you
can generate both dvi files and pdf files from a LaTeX source file.
AUCTeX provides a minor mode that lets you select the output format.
You can customize this minor mode to a default that reflects your
preferred output format.

Some LaTeX files use certain features that are incompatible with one
of the output formats so that only one possible output format remains.
It would be nice then if the file could set (either on or off) the
minor mode that selects the output format.

Lute.

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

* Re: enriched-mode problems
  2005-06-19 10:41         ` Lute Kamstra
@ 2005-06-20  3:49           ` Richard Stallman
  2005-06-20  7:08             ` David Kastrup
  0 siblings, 1 reply; 20+ messages in thread
From: Richard Stallman @ 2005-06-20  3:49 UTC (permalink / raw)
  Cc: emacs-devel

    AUCTeX provides a major mode for editing LaTeX file.  Normally, you
    can generate both dvi files and pdf files from a LaTeX source file.
    AUCTeX provides a minor mode that lets you select the output format.
    You can customize this minor mode to a default that reflects your
    preferred output format.

It doesn't seem right to put that in a file's local variables list.
This is a personal preference issue.

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

* Re: enriched-mode problems
  2005-06-20  3:49           ` Richard Stallman
@ 2005-06-20  7:08             ` David Kastrup
  2005-06-21  2:00               ` Richard Stallman
  0 siblings, 1 reply; 20+ messages in thread
From: David Kastrup @ 2005-06-20  7:08 UTC (permalink / raw)
  Cc: Lute Kamstra, emacs-devel

Richard Stallman <rms@gnu.org> writes:

>     AUCTeX provides a major mode for editing LaTeX file.  Normally, you
>     can generate both dvi files and pdf files from a LaTeX source file.
>     AUCTeX provides a minor mode that lets you select the output format.
>     You can customize this minor mode to a default that reflects your
>     preferred output format.
>
> It doesn't seem right to put that in a file's local variables list.
> This is a personal preference issue.

It usually is, but there are files which simply won't work in one of
the two modes.  And for those files, it is not a personal preference.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

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

* Re: enriched-mode problems
  2005-06-20  7:08             ` David Kastrup
@ 2005-06-21  2:00               ` Richard Stallman
  2005-06-21  5:29                 ` David Kastrup
  0 siblings, 1 reply; 20+ messages in thread
From: Richard Stallman @ 2005-06-21  2:00 UTC (permalink / raw)
  Cc: Lute.Kamstra.lists, emacs-devel

    > It doesn't seem right to put that in a file's local variables list.
    > This is a personal preference issue.

    It usually is, but there are files which simply won't work in one of
    the two modes.  And for those files, it is not a personal preference.

Why do some files not work in one of these modes?  I'd expect
TeX to be able to produce DVI from any input, and if PDF is made
from the DVI file, that should always work too right?

Meanwhile, you ought to be able to control this with a couple of ordinary
variables auctex-cant-make-dvi and auctex-cant-make-pdf, right?
You could set those in appropriate files, and the commands
would look at one or both of them in deciding what to do.

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

* Re: enriched-mode problems
  2005-06-21  2:00               ` Richard Stallman
@ 2005-06-21  5:29                 ` David Kastrup
  2005-06-21 15:14                   ` Gaëtan LEURENT
  2005-06-21 22:58                   ` Richard M. Stallman
  0 siblings, 2 replies; 20+ messages in thread
From: David Kastrup @ 2005-06-21  5:29 UTC (permalink / raw)
  Cc: Lute.Kamstra.lists, emacs-devel

Richard Stallman <rms@gnu.org> writes:

>     > It doesn't seem right to put that in a file's local variables list.
>     > This is a personal preference issue.
>
>     It usually is, but there are files which simply won't work in one of
>     the two modes.  And for those files, it is not a personal preference.
>
> Why do some files not work in one of these modes?  I'd expect TeX to
> be able to produce DVI from any input, and if PDF is made from the
> DVI file, that should always work too right?

TeX-PDF-mode does not go through DVI.  A different executable "pdftex"
is employed that has its own set of primitive commands.

> Meanwhile, you ought to be able to control this with a couple of
> ordinary variables auctex-cant-make-dvi and auctex-cant-make-pdf,
> right?  You could set those in appropriate files, and the commands
> would look at one or both of them in deciding what to do.

Not exactly a pretty and intuitive solution.  What we currently do is
allowing local variable specifications like
TeX-PDF-mode: nil

Anyway, it seems pretty natural to offer minor modes with a
customizable default setting, and not all minor modes might be 100%
user-preference.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

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

* Re: enriched-mode problems
  2005-06-21  5:29                 ` David Kastrup
@ 2005-06-21 15:14                   ` Gaëtan LEURENT
  2005-06-21 22:58                   ` Richard M. Stallman
  1 sibling, 0 replies; 20+ messages in thread
From: Gaëtan LEURENT @ 2005-06-21 15:14 UTC (permalink / raw)
  Cc: rms, Lute.Kamstra.lists, emacs-devel


David Kastrup wrote on 21 Jun 2005 07:29:49 +0200:

> TeX-PDF-mode does not go through DVI.  A different executable "pdftex"
> is employed that has its own set of primitive commands.

The most obvious difference is that when using TeX you can include ps
graphics but not pdf, and when using PDFTeX you can include pdf but not
ps. So if you include ps or pdf graphics, that will force to use TeX or
PDFTeX.

-- 
Gaëtan LEURENT

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

* Re: enriched-mode problems
  2005-06-21  5:29                 ` David Kastrup
  2005-06-21 15:14                   ` Gaëtan LEURENT
@ 2005-06-21 22:58                   ` Richard M. Stallman
  1 sibling, 0 replies; 20+ messages in thread
From: Richard M. Stallman @ 2005-06-21 22:58 UTC (permalink / raw)
  Cc: Lute.Kamstra.lists, emacs-devel

    Anyway, it seems pretty natural to offer minor modes with a
    customizable default setting, and not all minor modes might be 100%
    user-preference.

Minor modes are supposed to be used for user preferences.  Things
which are not user preferences should be handled with variables that
are not minor modes and not called "mode".

I know people don't follow the conventions all the time, but we will
not design Emacs features for the sake of not following the
conventions of Emacs.

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

end of thread, other threads:[~2005-06-21 22:58 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-06-15  5:08 enriched-mode problems Werner LEMBERG
2005-06-15 13:07 ` Lute Kamstra
2005-06-15 13:18   ` Werner LEMBERG
2005-06-15 13:28   ` Ralf Angeli
2005-06-15 14:39     ` Lute Kamstra
2005-06-15 15:20       ` David Kastrup
2005-06-15 15:21       ` Ralf Angeli
2005-06-15 16:28     ` Stefan Monnier
2005-06-15 18:30       ` Ralf Angeli
2005-06-15 18:59         ` Stefan Monnier
2005-06-16  4:07   ` Richard Stallman
2005-06-16 11:45     ` Lute Kamstra
2005-06-17  4:38       ` Richard Stallman
2005-06-19 10:41         ` Lute Kamstra
2005-06-20  3:49           ` Richard Stallman
2005-06-20  7:08             ` David Kastrup
2005-06-21  2:00               ` Richard Stallman
2005-06-21  5:29                 ` David Kastrup
2005-06-21 15:14                   ` Gaëtan LEURENT
2005-06-21 22:58                   ` Richard M. Stallman

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.