emacs-devel
[Top][All Lists]
Advanced

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

Re: default-truncate-lines


From: Stefan Monnier
Subject: Re: default-truncate-lines
Date: Fri, 23 Nov 2007 23:39:56 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.50 (gnu/linux)

>             /* If this variable is a default for something stored
>                in the buffer itself, such as default-fill-column,
>                find the buffers that don't have local values for it
>                and update them.  */

> The reason for this is so that variables like `fill-column'
> which are stored in slots in the buffer
> can have buffer-local values in some buffers and not in others.
> Setting the default value needs to store it into the proper
> slot in buffers that don't have buffer-local bindings of the variable.

> The code seems straightforward.  I don't see how use of
> `default-value' could replace it.

Yes, I've spent enough time recently looking at the var manipulation
code to know that it's correct, but this whole code is only there for
the default-FOO variables.  The loop over all buffers is also present in
set-default where it's indeed necessary.  We could/should of course
use a separate function to avoid this redundancy, but the main ugliness
is in the first 5 lines (which are not needed in set-default):

          if (XOBJFWD (valcontents)->objvar > (Lisp_Object *) &buffer_defaults
              && XOBJFWD (valcontents)->objvar < (Lisp_Object *) 
(&buffer_defaults + 1))
            {
              int offset = ((char *) XOBJFWD (valcontents)->objvar
                            - (char *) &buffer_defaults);

comparing pointers like that is terribly hackish.


        Stefan




reply via email to

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