emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: default-fill-column


From: Luc Teirlinck
Subject: Re: default-fill-column
Date: Sat, 22 Nov 2003 15:23:34 -0600 (CST)

First, a reminder of the behavior:

===File ~/nov22ielm=========================================
*** Welcome to IELM ***  Type (describe-mode) for help.
ELISP> (emacs-version)
"GNU Emacs 21.3.50.1 (i686-pc-linux-gnu, X toolkit)\n of 2003-11-22 on 
swt40.swt.com"
ELISP> (local-variable-p 'fill-column)
nil
ELISP> fill-column
70
ELISP> (setq default-fill-column 75)
75
ELISP> fill-column
70
ELISP> (local-variable-p 'fill-column)
nil
ELISP> (default-value 'fill-column)
75
ELISP> (buffer-local-value 'fill-column (current-buffer))
75
ELISP> fill-column
70
ELISP> (setq-default fill-column (default-value 'fill-column))
75
ELISP> fill-column
75
ELISP> 
============================================================

`default-fill-column' is just an example.  The same holds for other
variables of the same type.

Reminder of Stefan's response:

   Looks like a plain bug indeed.
   Could we just declare those `default-*' variables obsolete and tell
   people to use `setq-default' and `default-value' instead so we can
   slowly hope to get rid of those things ?
   If Luc's bugs were already present in Emacs-20 and Emacs-21, then we
   wouldn't even have to fix them.

That would, according to me, be a satisfactory solution.  There could
be one problem, however.  Indeed, the functionality of these variables
is not equivalent with `setq-default'.  `setq-default' changes the
value in all buffers without buffer-local binding, whereas
(setq default-fill-column 75) only affects the value in newly created
buffers.  This is achieved in a very precarious way, however, because
both the preserved value itself and its type (buffer-local versus
default) are ambiguous and unstable.  If one wants to make new
defaults for these variables apply only to newly created buffers,
either automatically or as an option, then I see at least three
possibilities:

1.  Make all these variables behave like enable-multibyte-characters
    and default-enable-multibyte-characters.  For those, there is no
    problem, because enable-multibyte-characters is always
    buffer-local, even if the user never set it, and
    kill-local-variable has no effect on it.  Thus the default value
    always only affects newly created buffers and the problem in the
    above *ielm* run never occurs for them.

2.  Make setq-default and set-default, for these variables, scan
    through the buffer-list and make all current global values
    buffer-local before resetting the default.

3.  Leave setq-default and set-default alone, but define a new
    function set-default-new-buffers (or whatever) that would behave
    as described in (2), not just for the variables we are talking
    about, but for all variables.  It seems to me that this function
    could be written in Lisp and that this would not be too difficult.
    Could be useful for other variables too.

(2) and (3) still would require making the default-* variables
obsolete (but without loosing their functionality), whereas (1) would
get rid of the problem without a need to slowly get rid of them.

Sincerely,

Luc.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]