Subject: Re: bug#18337: 24.4.50; apropos fails on "scroll"

From: Detlev Zundel <[email-masked]>
Date: Fri, 29 Aug 2014 15:13:15 +0200

Hi Stefan,

[added Dmitry on CC as the changelog seems to make a connection to the
problem at hand]

>> (when (setq properties (symbol-plist 'vertical-scroll-bar))
>>   (setq doc (list (car properties)))
>>   (while (setq properties (cdr (cdr properties)))
>>     (setq doc (cons (car properties) doc)))
>>   (nreverse doc))
>
>> => (0 event-symbol-element-mask event-symbol-elements modifier-cache variable-documentation)
>   
>> Applying 'symbol-name to that list then yields the error.
>
> Note that, while convention is to use a symbol for property names, that
> is not the only valid choice.  0 is a valid property name (tho an odd
> one, arguably).

I think in this case it actually caught an error though.

> So while this 0 should probably be changed the mapconcat code that burps
> on it should probably be changed not to assume that only symbols will
> be used as property names.

Looking deeper, it turns out that the 0 results from this:

buffer.c:5473

  DEFSYM (Qvertical_scroll_bar, "vertical-scroll-bar");
  Fput (Qvertical_scroll_bar, Qchoice, list4 (Qnil, Qt, Qleft, Qright));
  DEFSYM (Qhorizontal_scroll_bar, "horizontal-scroll-bar");

  DEFSYM (Qfraction, "fraction");
  Fput (Qfraction, Qrange, Fcons (make_float (0.0), make_float (1.0)));

  DEFSYM (Qoverwrite_mode, "overwrite-mode");
  Fput (Qoverwrite_mode, Qchoice,
	list3 (Qnil, intern ("overwrite-mode-textual"),
	       intern ("overwrite-mode-binary")));

As far as I can tell, it should thus really be 'choice.  Actually both
vertical-scroll-bar and overwrite-mode have the problem:

(symbol-plist 'vertical-scroll-bar)

=> (0 (nil t left right) event-symbol-element-mask (vertical-scroll-bar 0) event-symbol-elements (vertical-scroll-bar) modifier-cache ((0 . vertical-scroll-bar)) variable-documentation 374228)

(symbol-plist 'overwrite-mode)

=> (0 (nil overwrite-mode-textual overwrite-mode-binary) event-symbol-element-mask (overwrite-mode 0) event-symbol-elements (overwrite-mode) modifier-cache ((0 . overwrite-mode)) :minor-mode-function binary-overwrite-mode variable-documentation 370277)

The changelog mentions this

2014-07-16  Dmitry Antipov  <[email-masked]>

	More precise control over values of some buffer-local variables.
	* keyboard.c (Qvertical_scroll_bar):
	* frame.c (Qleft, Qright): Move to ...
	* buffer.c (Qleft, Qright, Qvertical_scroll_bar): ... here.
	* buffer.c (Qchoice, Qrange, Qoverwrite_mode, Qfraction): New symbols.
	(syms_of_buffer): DEFSYM all of the above, attach special properties.
	Use special symbols to DEFVAR_PER_BUFFER overwrite-mode,
	vertical-scroll-bar, scroll-up-aggressively
	and scroll-down-aggressively.

Dmitry, do you know why the construct for choice fails?

Thanks
  Detlev
  
-- 
We can forgive a man for making a useful thing as long as he does not
admire it.  The only excuse  for making  a useless  thing is that one
admires it intensely.
                                    --- Oscar Wilde