[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
How about text-property-functions using `equal' rather than `eq'?
From: |
Alan Mackenzie |
Subject: |
How about text-property-functions using `equal' rather than `eq'? |
Date: |
Mon, 4 Feb 2008 20:53:58 +0000 |
User-agent: |
Mutt/1.5.9i |
Hi, Emacs!
All the built in text property functions which compare properties appear
to use `eq' for the comparison. Some of these actually say this in
their doc-strings or the pertinent manual page, some of them might
actually say it in both. ;-(
However, it seems to me that `equal' would be a better comparison. I am
currently playing with syntax-table text-properties, and some characters
need to have the property set to '(1) (i.e. punctuation).
I would dearly love to use text-property-any to locate such a buffer
position, but unfortunately (eq '(1) '(1)) => nil. :-( So I've had to
code up a clumsy equivalent which will certainly be much slower.
Would it not be a good idea to change these functions to use `equal'
instead? No, it wouldn't be a good idea.
How about providing each of these with an optional extra parameter, the
comparison predicate? A much better idea! So we'd have, for example:
(defun text-property-any (start end prop value &optional object pred)
, with PRED defaulting to `eq'.
--
Alan Mackenzie (Nuremberg, Germany)
- How about text-property-functions using `equal' rather than `eq'?,
Alan Mackenzie <=