unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Why aren't paragraph-s\(tart\|eparate\) buffer local by default?
@ 2005-06-18 21:17 Alan Mackenzie
  2005-06-19 15:55 ` Richard Stallman
  2005-06-20 12:28 ` Stefan Monnier
  0 siblings, 2 replies; 3+ messages in thread
From: Alan Mackenzie @ 2005-06-18 21:17 UTC (permalink / raw)


Hi, Emacs!

Why aren't paragraph-s\(tart\|eparate\) buffer local?  There doesn't seem
to be any call for having global values for them since so many major
modes (amongst them C Mode, Lisp mode, Texinfo mode) give these variables
mode specific values.

The reason I ask is that a CC Mode user erroneously called (c-set-style)
in a buffer that wasn't a CC Mode buffer.  This set these two paragraph
variables to style values.

Unfortunately, the CC Mode initialisation hadn't been done for the
buffer.  In particular, the the two paragraph variables hadn't been made
buffer local.  So the global values got overwritten.

May I suggest that paragraph-s\(tart\|eparate\) be made buffer local by
default?

-- 
Alan Mackenzie (Munich, Germany)

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

* Re: Why aren't paragraph-s\(tart\|eparate\) buffer local by default?
  2005-06-18 21:17 Why aren't paragraph-s\(tart\|eparate\) buffer local by default? Alan Mackenzie
@ 2005-06-19 15:55 ` Richard Stallman
  2005-06-20 12:28 ` Stefan Monnier
  1 sibling, 0 replies; 3+ messages in thread
From: Richard Stallman @ 2005-06-19 15:55 UTC (permalink / raw)
  Cc: emacs-devel

    Why aren't paragraph-s\(tart\|eparate\) buffer local?  There doesn't seem
    to be any call for having global values for them since so many major
    modes (amongst them C Mode, Lisp mode, Texinfo mode) give these variables
    mode specific values.

There is certainly a reason for these variables to have global defaults.
The paragraph commands can be used even in Fundamental mode.

We could consider making them automatically local whenever set;
that doesn't require eliminating the global defaults.  I am not
sure this is bad, but it isn't obvious to me it is desirable.

I think the right fix for the problem you encountered is to make
c-set-style check that the buffer has an appropriate mode before it
does anything else.


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click


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

* Re: Why aren't paragraph-s\(tart\|eparate\) buffer local by default?
  2005-06-18 21:17 Why aren't paragraph-s\(tart\|eparate\) buffer local by default? Alan Mackenzie
  2005-06-19 15:55 ` Richard Stallman
@ 2005-06-20 12:28 ` Stefan Monnier
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Monnier @ 2005-06-20 12:28 UTC (permalink / raw)
  Cc: emacs-devel

> Unfortunately, the CC Mode initialisation hadn't been done for the
> buffer.  In particular, the the two paragraph variables hadn't been made
> buffer local.  So the global values got overwritten.

Which is why I strongly recommend to always use

      (set (make-local-variable 'foo) bar)

rather than

       (make-local-variable 'foo)
       ...
       ...
       (setq foo bar)

Putting the two parts in different functions is asking for trouble,


        Stefan

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

end of thread, other threads:[~2005-06-20 12:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-06-18 21:17 Why aren't paragraph-s\(tart\|eparate\) buffer local by default? Alan Mackenzie
2005-06-19 15:55 ` Richard Stallman
2005-06-20 12:28 ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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