Subject: Re: bug#15312: Info (point-entered, point-left): Doc incomplete, hence incorrect

From: Jambunathan K <[email-masked]>
Date: Fri, 13 Sep 2013 22:12:58 +0530

Stefan Monnier <[email-masked]> writes:

>> Sorry, I'm still in the dark.  Does the code presented in
>> http://debbugs.gnu.org/cgi/bugreport.cgi?bug=15312#11 work correctly
>> and as expected, or does it not?
>
> AFAICT, yes, it works fine.  The problem is one of documentation.

Turn off font-locking :-).  It wouldn't work.

> Jambunathan wrote:
>>    (mapc
>>     (lambda (s)
>>       (insert (propertize s  'mouse-face font-lock-comment-face)))
>>     '("ab" "cd"))
>
> you mean
>      
>     (dolist (s '("ab" "cd"))
>       (insert (propertize s  'mouse-face font-lock-comment-face)))

Is that a convention or there is more to it?  They do the same thing,
right?

If you ask me, the fact there are two chunks can be inferred by saying
that they were added as two different calls.

>> The intention of the programmer in the above case MAY have been to treat
>> "ab" and "cd" differently.  
>> But the way Emacs deals with them, it considers "abcd" as a single
>> stretch and they are highlighted together.
>
> Yes, exactly.  If you want them to appear separate you need to arrange
> for the value to be non-eq, e.g.:
>
>     (dolist (s '("ab" "cd"))
>       (insert (propertize s  'mouse-face (list font-lock-comment-face))))

You are cloning a face here?

Are there any workarounds when the value of the text property is a
function or a value type.  How can we have clones of a function (or a
symbol)?  How can we clone a value type like Integer?  May be there is a
way to turn a Value in to a Object? (In C# world, it is called "Boxing")

> -- Stefan