diff options
| author | Alan Mackenzie | 2023-09-04 12:51:24 +0000 |
|---|---|---|
| committer | Alan Mackenzie | 2023-09-04 12:51:24 +0000 |
| commit | afcb6d0bc7abcdbca6b18d020deeff24d1ad197f (patch) | |
| tree | 1561281df0284ced50d19005770c00023e7a617e /doc/lispref/objects.texi | |
| parent | 55a0f0e047034b3a458b6fdbe245f33b83fd88b0 (diff) | |
| download | emacs-afcb6d0bc7abcdbca6b18d020deeff24d1ad197f.tar.gz emacs-afcb6d0bc7abcdbca6b18d020deeff24d1ad197f.zip | |
Correct the handling of symbols with position in equal
* src/fns.c (internal_equal): Only regard symbols with position
as their symbols when symbols-with-pos-enabled is non-nil.
* doc/lispref/symbols.texi (Symbols with Position): Expand the
description of symbols with position, in particular the way
they work with eq and equal.
* doc/lispref/objects.texi (Equality Predicates): Describe how
eq and equal handle symbols with position.
* test/src/fns-tests.el (fns-tests-equal-symbols-with-position):
New tests for symbols with position.
Diffstat (limited to 'doc/lispref/objects.texi')
| -rw-r--r-- | doc/lispref/objects.texi | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/doc/lispref/objects.texi b/doc/lispref/objects.texi index ad079e0d63a..784d59720ed 100644 --- a/doc/lispref/objects.texi +++ b/doc/lispref/objects.texi | |||
| @@ -2206,6 +2206,10 @@ and the same non-fixnum numeric type, then they might or might not be | |||
| 2206 | the same object, and @code{eq} returns @code{t} or @code{nil} | 2206 | the same object, and @code{eq} returns @code{t} or @code{nil} |
| 2207 | depending on whether the Lisp interpreter created one object or two. | 2207 | depending on whether the Lisp interpreter created one object or two. |
| 2208 | 2208 | ||
| 2209 | If @var{object1} or @var{object2} is a symbol with position, @code{eq} | ||
| 2210 | regards it as its bare symbol when @code{symbols-with-pos-enabled} is | ||
| 2211 | non-@code{nil} (@pxref{Symbols with Position}). | ||
| 2212 | |||
| 2209 | @example | 2213 | @example |
| 2210 | @group | 2214 | @group |
| 2211 | (eq 'foo 'foo) | 2215 | (eq 'foo 'foo) |
| @@ -2363,6 +2367,13 @@ same sequence of character codes and all these codes are in the range | |||
| 2363 | The @code{equal} function recursively compares the contents of objects | 2367 | The @code{equal} function recursively compares the contents of objects |
| 2364 | if they are integers, strings, markers, vectors, bool-vectors, | 2368 | if they are integers, strings, markers, vectors, bool-vectors, |
| 2365 | byte-code function objects, char-tables, records, or font objects. | 2369 | byte-code function objects, char-tables, records, or font objects. |
| 2370 | |||
| 2371 | If @var{object1} or @var{object2} is a symbol with position, | ||
| 2372 | @code{equal} regards it as its bare symbol when | ||
| 2373 | @code{symbols-with-pos-enabled} is non-@code{nil}. Otherwise | ||
| 2374 | @code{equal} compares two symbols with position by recursively | ||
| 2375 | comparing their components. @xref{Symbols with Position}. | ||
| 2376 | |||
| 2366 | Other objects are considered @code{equal} only if they are @code{eq}. | 2377 | Other objects are considered @code{equal} only if they are @code{eq}. |
| 2367 | For example, two distinct buffers are never considered @code{equal}, | 2378 | For example, two distinct buffers are never considered @code{equal}, |
| 2368 | even if their textual contents are the same. | 2379 | even if their textual contents are the same. |