* default-truncate-lines (was: Changes to emacs/lisp/gnus/gnus-art.el, v)
[not found] <E1IvIQa-0006Te-72@localhost.localdomain>
@ 2007-11-22 21:04 ` Reiner Steib
2007-11-23 2:38 ` default-truncate-lines Stefan Monnier
0 siblings, 1 reply; 7+ messages in thread
From: Reiner Steib @ 2007-11-22 21:04 UTC (permalink / raw)
To: Stefan Monnier; +Cc: emacs-devel
On Thu, Nov 22 2007, Stefan Monnier changed:
> --- gnus-art.el 16 Nov 2007 16:50:34 -0000 1.139
> +++ gnus-art.el 22 Nov 2007 20:13:35 -0000 1.140
[...]
> -(defcustom gnus-article-truncate-lines default-truncate-lines
> +(defcustom gnus-article-truncate-lines (default-value 'truncate-lines)
> "Value of `truncate-lines' in Gnus Article buffer.
I don't care about this change, but out of curiosity: (why) does it
make a difference?
,----[ <f1> v default-truncate-lines RET ]
| default-truncate-lines is a variable defined in `src/buffer.c'.
| Its value is nil
|
| Documentation:
| Default value of `truncate-lines' for buffers that do not override it.
| This is the same as (default-value 'truncate-lines).
`----
Bye, Reiner.
--
,,,
(o o)
---ooO-(_)-Ooo--- | PGP key available | http://rsteib.home.pages.de/
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: default-truncate-lines
2007-11-22 21:04 ` default-truncate-lines (was: Changes to emacs/lisp/gnus/gnus-art.el, v) Reiner Steib
@ 2007-11-23 2:38 ` Stefan Monnier
2007-11-24 3:12 ` default-truncate-lines Richard Stallman
2008-03-01 21:15 ` default-truncate-lines Reiner Steib
0 siblings, 2 replies; 7+ messages in thread
From: Stefan Monnier @ 2007-11-23 2:38 UTC (permalink / raw)
To: emacs-devel
>> -(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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: default-truncate-lines
2007-11-23 2:38 ` default-truncate-lines Stefan Monnier
@ 2007-11-24 3:12 ` Richard Stallman
2007-11-24 4:39 ` default-truncate-lines Stefan Monnier
2008-03-01 21:15 ` default-truncate-lines Reiner Steib
1 sibling, 1 reply; 7+ messages in thread
From: Richard Stallman @ 2007-11-24 3:12 UTC (permalink / raw)
To: Stefan Monnier; +Cc: emacs-devel
/* 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.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: default-truncate-lines
2007-11-24 3:12 ` default-truncate-lines Richard Stallman
@ 2007-11-24 4:39 ` Stefan Monnier
0 siblings, 0 replies; 7+ messages in thread
From: Stefan Monnier @ 2007-11-24 4:39 UTC (permalink / raw)
To: rms; +Cc: emacs-devel
> /* 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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: default-truncate-lines
2007-11-23 2:38 ` default-truncate-lines Stefan Monnier
2007-11-24 3:12 ` default-truncate-lines Richard Stallman
@ 2008-03-01 21:15 ` Reiner Steib
2008-03-02 21:56 ` default-truncate-lines Stefan Monnier
1 sibling, 1 reply; 7+ messages in thread
From: Reiner Steib @ 2008-03-01 21:15 UTC (permalink / raw)
To: Stefan Monnier; +Cc: emacs-devel
On Fri, Nov 23 2007, Stefan Monnier wrote:
>>> -(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:
[...]
> and every time I get to replace it with a use of `default-value', I feel
> like maybe this madness will disappear some day.
Wouldn't it make sense to suggest using (default-value 'foo) in the
doc strings of `default-foo'?
Bye, Reiner.
--
,,,
(o o)
---ooO-(_)-Ooo--- | PGP key available | http://rsteib.home.pages.de/
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: default-truncate-lines
2008-03-01 21:15 ` default-truncate-lines Reiner Steib
@ 2008-03-02 21:56 ` Stefan Monnier
2008-03-03 18:26 ` default-truncate-lines Richard Stallman
0 siblings, 1 reply; 7+ messages in thread
From: Stefan Monnier @ 2008-03-02 21:56 UTC (permalink / raw)
To: emacs-devel
>>>> -(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:
> [...]
>> and every time I get to replace it with a use of `default-value', I feel
>> like maybe this madness will disappear some day.
> Wouldn't it make sense to suggest using (default-value 'foo) in the
> doc strings of `default-foo'?
Indeed. We should just mark all those default-* variables obsolete.
The only problematic one, AFAICT is default-enable-multibyte-characters
since (setq-default 'enable-multibyte-characters) doesn't work.
Stefan
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2008-03-03 18:26 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <E1IvIQa-0006Te-72@localhost.localdomain>
2007-11-22 21:04 ` default-truncate-lines (was: Changes to emacs/lisp/gnus/gnus-art.el, v) Reiner Steib
2007-11-23 2:38 ` default-truncate-lines Stefan Monnier
2007-11-24 3:12 ` default-truncate-lines Richard Stallman
2007-11-24 4:39 ` default-truncate-lines Stefan Monnier
2008-03-01 21:15 ` default-truncate-lines Reiner Steib
2008-03-02 21:56 ` default-truncate-lines Stefan Monnier
2008-03-03 18:26 ` default-truncate-lines Richard 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.