bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#35718: 26.2; Functions in yank-handled-properties ALWAYS get called


From: Noam Postavsky
Subject: bug#35718: 26.2; Functions in yank-handled-properties ALWAYS get called
Date: Fri, 07 Jun 2019 09:03:59 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux)

>> However, the function foo is always called even there is no image at
>> all. This is unexpected since the function should only be called when
>> the property 'image is found according to the documentation:
>>
>>     When the `yank' command inserts text into the buffer, it scans the
>>     inserted text for stretches of text that have `eq' values of the text
>>     property PROP; for each such stretch of text, FUN is called with three
>>     arguments...
>> 
>> The function is called inside remove-yank-excluded-properties, however
>> FUN is always called no matter what PROP is:
>> 
>>     (while (< run-start end)
>>       (let ((value (get-text-property run-start prop))
>>             (run-end (next-single-property-change
>>                       run-start prop nil end)))
>>         (funcall fun value run-start run-end)
>>         (setq run-start run-end)))
>
> The above code actually calls the handler function whenever PROP's
> value _changes_, not just where PROP is non-nil.  Not sure if this is
> a bug or a feature; opinions welcome.

I think the question is more about whether we distinguish between an
absent property, and a property whose value is nil
(remove-yank-excluded-properties currently does not, which is what I
think this bug report is complaining about).  The manual doesn't say
either way, but text-property-any (and other property checking
functions) seem to treat them the same as well:

(text-property-any 0 2 'xxx nil (propertize "foo" 'xxx nil)) ;=> 0
(text-property-any 0 2 'xxx nil (propertize "foo" 'xxx t)) ;=> nil
(text-property-any 0 2 'xxx nil "foo") ;=> 0






reply via email to

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