emacs-devel
[Top][All Lists]
Advanced

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

Re: Fix previous-button to work with connected buttons


From: Stefan Monnier
Subject: Re: Fix previous-button to work with connected buttons
Date: Sun, 11 Mar 2007 17:46:19 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.95 (gnu/linux)

>> How 'bout the patch below, then?
>> +  (add-text-properties beg end
>> +                       ;; Each button should have a different `button'
>> +                       ;; property so that next-single-property-change can
>> +                       ;; detect boundaries reliably.
>> +                       (cons 'button (cons (list t) properties)))
> Hmm.  Any reason to waste a cons-cell?

Because it's simpler and 100% reliable, and the waste is negligible (think
of the amount of consing needed for the total list of properties, plus the
amount of consing needed for the data-structure that keeps track of the
text-properties, ...).

> I imagine something like
> (cons 'button (cons (setq button-counter (1+ button-counter)) properties))
> would work as well.

Sure.  Except for wraparounds, of course.  Not that they're likely.


        Stefan




reply via email to

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