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: Thu, 22 Nov 2007 21:38:14 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.50 (gnu/linux)

>> -(defcustom gnus-article-truncate-lines default-truncate-lines
>> +(defcustom gnus-article-truncate-lines (default-value 'truncate-lines)
> I don't care about this change, but out of curiosity: (why) does it
> make a difference?

Every time I see one of those default-FOO variable used I get flashes of
the following code:

          /* 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.  */
          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);
              int idx = PER_BUFFER_IDX (offset);

              Lisp_Object tail;

              if (idx <= 0)
                break;

              for (tail = Vbuffer_alist; CONSP (tail); tail = XCDR (tail))
                {
                  Lisp_Object buf;
                  struct buffer *b;

                  buf = Fcdr (XCAR (tail));
                  if (!BUFFERP (buf)) continue;
                  b = XBUFFER (buf);

                  if (! PER_BUFFER_VALUE_P (b, idx))
                    PER_BUFFER_VALUE (b, offset) = newval;
                }
            }

and every time I get to replace it with a use of `default-value', I feel
like maybe this madness will disappear some day.


        Stefan




reply via email to

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