aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2020-05-23 07:50:29 -0700
committerGlenn Morris2020-05-23 07:50:29 -0700
commitfabcc1ee13f82297d0f5e41f58fb1774840ebd45 (patch)
tree440b7026631d5a26922a7366e28dbb6b3e307347
parentf8581bcf6a1942ebd331cae20e32945a3a86a3d1 (diff)
parent4b9fbdb5a713745dfdb13042e33ba2345e6860e1 (diff)
downloademacs-fabcc1ee13f82297d0f5e41f58fb1774840ebd45.tar.gz
emacs-fabcc1ee13f82297d0f5e41f58fb1774840ebd45.zip
Merge from origin/emacs-27
4b9fbdb5a7 ; Update TODO item about ligature support 03d44acfdd * doc/lispref/control.texi (Processing of Errors): Improve... b48ab743a8 Minor fixups for mutability doc 6ac2326e5b Don’t use “constant” for values you shouldn’t change
-rw-r--r--doc/lispintro/emacs-lisp-intro.texi5
-rw-r--r--doc/lispref/control.texi1
-rw-r--r--doc/lispref/elisp.texi2
-rw-r--r--doc/lispref/eval.texi21
-rw-r--r--doc/lispref/lists.texi16
-rw-r--r--doc/lispref/objects.texi93
-rw-r--r--doc/lispref/sequences.texi25
-rw-r--r--doc/lispref/strings.texi11
-rw-r--r--etc/TODO31
9 files changed, 116 insertions, 89 deletions
diff --git a/doc/lispintro/emacs-lisp-intro.texi b/doc/lispintro/emacs-lisp-intro.texi
index 7484ce57607..f6dd77a3d96 100644
--- a/doc/lispintro/emacs-lisp-intro.texi
+++ b/doc/lispintro/emacs-lisp-intro.texi
@@ -7317,8 +7317,6 @@ which leave the original list as it was. One way to find out how this
7317works is to experiment. We will start with the @code{setcar} function. 7317works is to experiment. We will start with the @code{setcar} function.
7318 7318
7319@need 1200 7319@need 1200
7320@cindex constant lists
7321@cindex mutable lists
7322First, we can make a list and then set the value of a variable to the 7320First, we can make a list and then set the value of a variable to the
7323list, using the @code{setq} special form. Because we intend to use 7321list, using the @code{setq} special form. Because we intend to use
7324@code{setcar} to change the list, this @code{setq} should not use the 7322@code{setcar} to change the list, this @code{setq} should not use the
@@ -7327,8 +7325,7 @@ a list that is part of the program and bad things could happen if we
7327tried to change part of the program while running it. Generally 7325tried to change part of the program while running it. Generally
7328speaking an Emacs Lisp program's components should be constant (or 7326speaking an Emacs Lisp program's components should be constant (or
7329unchanged) while the program is running. So we instead construct an 7327unchanged) while the program is running. So we instead construct an
7330animal list that is @dfn{mutable} (or changeable) by using the 7328animal list by using the @code{list} function, as follows:
7331@code{list} function, as follows:
7332 7329
7333@smallexample 7330@smallexample
7334(setq animals (list 'antelope 'giraffe 'lion 'tiger)) 7331(setq animals (list 'antelope 'giraffe 'lion 'tiger))
diff --git a/doc/lispref/control.texi b/doc/lispref/control.texi
index c601e3af9bc..7755cbb5f25 100644
--- a/doc/lispref/control.texi
+++ b/doc/lispref/control.texi
@@ -1867,6 +1867,7 @@ concept of continuable errors.
1867@node Processing of Errors 1867@node Processing of Errors
1868@subsubsection How Emacs Processes Errors 1868@subsubsection How Emacs Processes Errors
1869@cindex processing of errors 1869@cindex processing of errors
1870@cindex handle errors
1870 1871
1871When an error is signaled, @code{signal} searches for an active 1872When an error is signaled, @code{signal} searches for an active
1872@dfn{handler} for the error. A handler is a sequence of Lisp 1873@dfn{handler} for the error. A handler is a sequence of Lisp
diff --git a/doc/lispref/elisp.texi b/doc/lispref/elisp.texi
index bba1b63115f..9a6796790c4 100644
--- a/doc/lispref/elisp.texi
+++ b/doc/lispref/elisp.texi
@@ -297,7 +297,7 @@ Lisp Data Types
297* Circular Objects:: Read syntax for circular structure. 297* Circular Objects:: Read syntax for circular structure.
298* Type Predicates:: Tests related to types. 298* Type Predicates:: Tests related to types.
299* Equality Predicates:: Tests of equality between any two objects. 299* Equality Predicates:: Tests of equality between any two objects.
300* Constants and Mutability:: Whether an object's value can change. 300* Mutability:: Some objects should not be modified.
301 301
302Programming Types 302Programming Types
303 303
diff --git a/doc/lispref/eval.texi b/doc/lispref/eval.texi
index baddce4d9c9..39f342a798b 100644
--- a/doc/lispref/eval.texi
+++ b/doc/lispref/eval.texi
@@ -158,11 +158,11 @@ contents unchanged.
158@end group 158@end group
159@end example 159@end example
160 160
161 A self-evaluating form yields constant conses, vectors and strings, and you 161 A self-evaluating form yields a value that becomes part of the program,
162should not attempt to modify their contents via @code{setcar}, @code{aset} or 162and you should not try to modify it via @code{setcar}, @code{aset} or
163similar operations. The Lisp interpreter might unify the constants 163similar operations. The Lisp interpreter might unify the constants
164yielded by your program's self-evaluating forms, so that these 164yielded by your program's self-evaluating forms, so that these
165constants might share structure. @xref{Constants and Mutability}. 165constants might share structure. @xref{Mutability}.
166 166
167 It is common to write numbers, characters, strings, and even vectors 167 It is common to write numbers, characters, strings, and even vectors
168in Lisp code, taking advantage of the fact that they self-evaluate. 168in Lisp code, taking advantage of the fact that they self-evaluate.
@@ -564,8 +564,8 @@ and vectors.)
564 564
565@defspec quote object 565@defspec quote object
566This special form returns @var{object}, without evaluating it. 566This special form returns @var{object}, without evaluating it.
567The returned value is a constant, and should not be modified. 567The returned value might be shared and should not be modified.
568@xref{Constants and Mutability}. 568@xref{Self-Evaluating Forms}.
569@end defspec 569@end defspec
570 570
571@cindex @samp{'} for quoting 571@cindex @samp{'} for quoting
@@ -608,9 +608,9 @@ Here are some examples of expressions that use @code{quote}:
608 608
609 Although the expressions @code{(list '+ 1 2)} and @code{'(+ 1 2)} 609 Although the expressions @code{(list '+ 1 2)} and @code{'(+ 1 2)}
610both yield lists equal to @code{(+ 1 2)}, the former yields a 610both yield lists equal to @code{(+ 1 2)}, the former yields a
611freshly-minted mutable list whereas the latter yields a constant list 611freshly-minted mutable list whereas the latter yields a list
612built from conses that may be shared with other constants. 612built from conses that might be shared and should not be modified.
613@xref{Constants and Mutability}. 613@xref{Self-Evaluating Forms}.
614 614
615 Other quoting constructs include @code{function} (@pxref{Anonymous 615 Other quoting constructs include @code{function} (@pxref{Anonymous
616Functions}), which causes an anonymous lambda expression written in Lisp 616Functions}), which causes an anonymous lambda expression written in Lisp
@@ -710,8 +710,9 @@ Here are some examples:
710@end example 710@end example
711 711
712If a subexpression of a backquote construct has no substitutions or 712If a subexpression of a backquote construct has no substitutions or
713splices, it acts like @code{quote} in that it yields constant conses, 713splices, it acts like @code{quote} in that it yields conses,
714vectors and strings that should not be modified. 714vectors and strings that might be shared and should not be modified.
715@xref{Self-Evaluating Forms}.
715 716
716@node Eval 717@node Eval
717@section Eval 718@section Eval
diff --git a/doc/lispref/lists.texi b/doc/lispref/lists.texi
index fcaf4386b15..ae793d5e15e 100644
--- a/doc/lispref/lists.texi
+++ b/doc/lispref/lists.texi
@@ -873,8 +873,8 @@ primitives @code{setcar} and @code{setcdr}. These are destructive
873operations because they change existing list structure. 873operations because they change existing list structure.
874Destructive operations should be applied only to mutable lists, 874Destructive operations should be applied only to mutable lists,
875that is, lists constructed via @code{cons}, @code{list} or similar 875that is, lists constructed via @code{cons}, @code{list} or similar
876operations. Lists created by quoting are constants and should not be 876operations. Lists created by quoting are part of the program and
877changed by destructive operations. @xref{Constants and Mutability}. 877should not be changed by destructive operations. @xref{Mutability}.
878 878
879@cindex CL note---@code{rplaca} vs @code{setcar} 879@cindex CL note---@code{rplaca} vs @code{setcar}
880@quotation 880@quotation
@@ -911,7 +911,7 @@ value @var{object}. For example:
911 911
912@example 912@example
913@group 913@group
914(setq x (list 1 2)) ; @r{Create a mutable list.} 914(setq x (list 1 2))
915 @result{} (1 2) 915 @result{} (1 2)
916@end group 916@end group
917@group 917@group
@@ -931,7 +931,7 @@ these lists. Here is an example:
931 931
932@example 932@example
933@group 933@group
934;; @r{Create two mutable lists that are partly shared.} 934;; @r{Create two lists that are partly shared.}
935(setq x1 (list 'a 'b 'c)) 935(setq x1 (list 'a 'b 'c))
936 @result{} (a b c) 936 @result{} (a b c)
937(setq x2 (cons 'z (cdr x1))) 937(setq x2 (cons 'z (cdr x1)))
@@ -1022,11 +1022,11 @@ reached via the @sc{cdr}.
1022 1022
1023@example 1023@example
1024@group 1024@group
1025(setq x (list 1 2 3)) ; @r{Create a mutable list.} 1025(setq x (list 1 2 3))
1026 @result{} (1 2 3) 1026 @result{} (1 2 3)
1027@end group 1027@end group
1028@group 1028@group
1029(setcdr x '(4)) ; @r{Modify the list's tail to be a constant list.} 1029(setcdr x '(4))
1030 @result{} (4) 1030 @result{} (4)
1031@end group 1031@end group
1032@group 1032@group
@@ -1135,11 +1135,11 @@ Unlike @code{append} (@pxref{Building Lists}), the @var{lists} are
1135 1135
1136@example 1136@example
1137@group 1137@group
1138(setq x (list 1 2 3)) ; @r{Create a mutable list.} 1138(setq x (list 1 2 3))
1139 @result{} (1 2 3) 1139 @result{} (1 2 3)
1140@end group 1140@end group
1141@group 1141@group
1142(nconc x '(4 5)) ; @r{Modify the list's tail to be a constant list.} 1142(nconc x '(4 5))
1143 @result{} (1 2 3 4 5) 1143 @result{} (1 2 3 4 5)
1144@end group 1144@end group
1145@group 1145@group
diff --git a/doc/lispref/objects.texi b/doc/lispref/objects.texi
index cd037d663da..83066744121 100644
--- a/doc/lispref/objects.texi
+++ b/doc/lispref/objects.texi
@@ -46,10 +46,6 @@ you store in it, type and all. (Actually, a small number of Emacs
46Lisp variables can only take on values of a certain type. 46Lisp variables can only take on values of a certain type.
47@xref{Variables with Restricted Values}.) 47@xref{Variables with Restricted Values}.)
48 48
49 Some Lisp objects are @dfn{constant}: their values should never change.
50Others are @dfn{mutable}: their values can be changed via destructive
51operations that involve side effects.
52
53 This chapter describes the purpose, printed representation, and read 49 This chapter describes the purpose, printed representation, and read
54syntax of each of the standard types in GNU Emacs Lisp. Details on how 50syntax of each of the standard types in GNU Emacs Lisp. Details on how
55to use these types can be found in later chapters. 51to use these types can be found in later chapters.
@@ -63,7 +59,7 @@ to use these types can be found in later chapters.
63* Circular Objects:: Read syntax for circular structure. 59* Circular Objects:: Read syntax for circular structure.
64* Type Predicates:: Tests related to types. 60* Type Predicates:: Tests related to types.
65* Equality Predicates:: Tests of equality between any two objects. 61* Equality Predicates:: Tests of equality between any two objects.
66* Constants and Mutability:: Whether an object's value can change. 62* Mutability:: Some objects should not be modified.
67@end menu 63@end menu
68 64
69@node Printed Representation 65@node Printed Representation
@@ -2383,51 +2379,58 @@ that for two strings to be equal, they have the same text properties.
2383@end example 2379@end example
2384@end defun 2380@end defun
2385 2381
2386@node Constants and Mutability 2382@node Mutability
2387@section Constants and Mutability 2383@section Mutability
2388@cindex constants
2389@cindex mutable objects 2384@cindex mutable objects
2390 2385
2391 Some Lisp objects are constant: their values should never change 2386 Some Lisp objects should never change. For example, the Lisp
2392during a single execution of Emacs running well-behaved Lisp code. 2387expression @code{"aaa"} yields a string, but you should not change
2393For example, you can create a new integer by calculating one, but you 2388its contents. And some objects cannot be changed; for example,
2394cannot modify the value of an existing integer. 2389although you can create a new number by calculating one, Lisp provides
2395 2390no operation to change the value of an existing number.
2396 Other Lisp objects are mutable: it is safe to change their values 2391
2397via destructive operations involving side effects. For example, an 2392 Other Lisp objects are @dfn{mutable}: it is safe to change their
2398existing marker can be changed by moving the marker to point to 2393values via destructive operations involving side effects. For
2399somewhere else. 2394example, an existing marker can be changed by moving the marker to
2400 2395point to somewhere else.
2401 Although all numbers are constants and all markers are 2396
2402mutable, some types contain both constant and mutable members. These 2397 Although numbers never change and all markers are mutable,
2403types include conses, vectors, strings, and symbols. For example, the string 2398some types have members some of which are mutable and others not. These
2404literal @code{"aaa"} yields a constant string, whereas the function 2399types include conses, vectors, and strings. For example,
2405call @code{(make-string 3 ?a)} yields a mutable string that can be 2400although @code{"cons"} and @code{(symbol-name 'cons)} both yield
2401strings that should not be changed, @code{(copy-sequence "cons")} and
2402@code{(make-string 3 ?a)} both yield mutable strings that can be
2406changed via later calls to @code{aset}. 2403changed via later calls to @code{aset}.
2407 2404
2408 A mutable object can become constant if it is part of an expression 2405 A mutable object stops being mutable if it is part of an expression
2409that is evaluated. The reverse does not occur: constant objects 2406that is evaluated. For example:
2410should stay constant. 2407
2411 2408@example
2412 Trying to modify a constant variable signals an error 2409(let* ((x (list 0.5))
2413(@pxref{Constant Variables}). 2410 (y (eval (list 'quote x))))
2414A program should not attempt to modify other types of constants because the 2411 (setcar x 1.5) ;; The program should not do this.
2415resulting behavior is undefined: the Lisp interpreter might or might 2412 y)
2416not detect the error, and if it does not detect the error the 2413@end example
2417interpreter can behave unpredictably thereafter. Another way to put 2414
2418this is that although mutable objects are safe to change and constant 2415@noindent
2419variables reliably prevent attempts to change them, other constants 2416Although the list @code{(0.5)} was mutable when it was created, it should not
2420are not safely mutable: if a misbehaving program tries to change such a 2417have been changed via @code{setcar} because it given to @code{eval}. The
2421constant then the constant's value might actually change, or the 2418reverse does not occur: an object that should not be changed never
2422program might crash or worse. This problem occurs 2419becomes mutable afterwards.
2423with types that have both constant and mutable members, and that have 2420
2424mutators like @code{setcar} and @code{aset} that are valid on mutable 2421 If a program attempts to change objects that should not be
2425objects but hazardous on constants. 2422changed, the resulting behavior is undefined: the Lisp interpreter
2426 2423might signal an error, or it might crash or behave unpredictably in
2427 When the same constant occurs multiple times in a program, the Lisp 2424other ways.@footnote{This is the behavior specified for languages like
2425Common Lisp and C for constants, and this differs from languages like
2426JavaScript and Python where an interpreter is required to signal an
2427error if a program attempts to change an immutable object. Ideally the Emacs
2428Lisp interpreter will evolve in latter direction.}
2429
2430 When similar constants occur as parts of a program, the Lisp
2428interpreter might save time or space by reusing existing constants or 2431interpreter might save time or space by reusing existing constants or
2429constant components. For example, @code{(eq "abc" "abc")} returns 2432their components. For example, @code{(eq "abc" "abc")} returns
2430@code{t} if the interpreter creates only one instance of the string 2433@code{t} if the interpreter creates only one instance of the string
2431constant @code{"abc"}, and returns @code{nil} if it creates two 2434literal @code{"abc"}, and returns @code{nil} if it creates two
2432instances. Lisp programs should be written so that they work 2435instances. Lisp programs should be written so that they work
2433regardless of whether this optimization is in use. 2436regardless of whether this optimization is in use.
diff --git a/doc/lispref/sequences.texi b/doc/lispref/sequences.texi
index 1cb0d05cc7b..91c3049f875 100644
--- a/doc/lispref/sequences.texi
+++ b/doc/lispref/sequences.texi
@@ -183,11 +183,11 @@ for other ways to copy sequences.
183 183
184@example 184@example
185@group 185@group
186(setq bar (list 1 2)) ; @r{Create a mutable list.} 186(setq bar (list 1 2))
187 @result{} (1 2) 187 @result{} (1 2)
188@end group 188@end group
189@group 189@group
190(setq x (vector 'foo bar)) ; @r{Create a mutable vector.} 190(setq x (vector 'foo bar))
191 @result{} [foo (1 2)] 191 @result{} [foo (1 2)]
192@end group 192@end group
193@group 193@group
@@ -278,7 +278,7 @@ Unlike @code{reverse} the original @var{sequence} may be modified.
278 278
279@example 279@example
280@group 280@group
281(setq x (list 'a 'b 'c)) ; @r{Create a mutable list.} 281(setq x (list 'a 'b 'c))
282 @result{} (a b c) 282 @result{} (a b c)
283@end group 283@end group
284@group 284@group
@@ -320,7 +320,7 @@ presented graphically:
320 For the vector, it is even simpler because you don't need setq: 320 For the vector, it is even simpler because you don't need setq:
321 321
322@example 322@example
323(setq x (copy-sequence [1 2 3 4])) ; @r{Create a mutable vector.} 323(setq x (copy-sequence [1 2 3 4]))
324 @result{} [1 2 3 4] 324 @result{} [1 2 3 4]
325(nreverse x) 325(nreverse x)
326 @result{} [4 3 2 1] 326 @result{} [4 3 2 1]
@@ -331,6 +331,7 @@ x
331Note that unlike @code{reverse}, this function doesn't work with strings. 331Note that unlike @code{reverse}, this function doesn't work with strings.
332Although you can alter string data by using @code{aset}, it is strongly 332Although you can alter string data by using @code{aset}, it is strongly
333encouraged to treat strings as immutable even when they are mutable. 333encouraged to treat strings as immutable even when they are mutable.
334@xref{Mutability}.
334 335
335@end defun 336@end defun
336 337
@@ -374,7 +375,7 @@ appears in a different position in the list due to the change of
374 375
375@example 376@example
376@group 377@group
377(setq nums (list 1 3 2 6 5 4 0)) ; @r{Create a mutable list.} 378(setq nums (list 1 3 2 6 5 4 0))
378 @result{} (1 3 2 6 5 4 0) 379 @result{} (1 3 2 6 5 4 0)
379@end group 380@end group
380@group 381@group
@@ -1228,7 +1229,7 @@ This function sets the @var{index}th element of @var{array} to be
1228 1229
1229@example 1230@example
1230@group 1231@group
1231(setq w (vector 'foo 'bar 'baz)) ; @r{Create a mutable vector.} 1232(setq w (vector 'foo 'bar 'baz))
1232 @result{} [foo bar baz] 1233 @result{} [foo bar baz]
1233(aset w 0 'fu) 1234(aset w 0 'fu)
1234 @result{} fu 1235 @result{} fu
@@ -1237,7 +1238,7 @@ w
1237@end group 1238@end group
1238 1239
1239@group 1240@group
1240;; @r{@code{copy-sequence} creates a mutable string.} 1241;; @r{@code{copy-sequence} copies the string to be modified later.}
1241(setq x (copy-sequence "asdfasfd")) 1242(setq x (copy-sequence "asdfasfd"))
1242 @result{} "asdfasfd" 1243 @result{} "asdfasfd"
1243(aset x 3 ?Z) 1244(aset x 3 ?Z)
@@ -1247,9 +1248,7 @@ x
1247@end group 1248@end group
1248@end example 1249@end example
1249 1250
1250The @var{array} should be mutable; that is, it should not be a constant, 1251The @var{array} should be mutable. @xref{Mutability}.
1251such as the constants created via quoting or via self-evaluating forms.
1252@xref{Constants and Mutability}.
1253 1252
1254If @var{array} is a string and @var{object} is not a character, a 1253If @var{array} is a string and @var{object} is not a character, a
1255@code{wrong-type-argument} error results. The function converts a 1254@code{wrong-type-argument} error results. The function converts a
@@ -1262,7 +1261,6 @@ each element of @var{array} is @var{object}. It returns @var{array}.
1262 1261
1263@example 1262@example
1264@group 1263@group
1265;; @r{Create a mutable vector and then fill it with zeros.}
1266(setq a (copy-sequence [a b c d e f g])) 1264(setq a (copy-sequence [a b c d e f g]))
1267 @result{} [a b c d e f g] 1265 @result{} [a b c d e f g]
1268(fillarray a 0) 1266(fillarray a 0)
@@ -1271,7 +1269,6 @@ a
1271 @result{} [0 0 0 0 0 0 0] 1269 @result{} [0 0 0 0 0 0 0]
1272@end group 1270@end group
1273@group 1271@group
1274;; @r{Create a mutable string and then fill it with "-".}
1275(setq s (copy-sequence "When in the course")) 1272(setq s (copy-sequence "When in the course"))
1276 @result{} "When in the course" 1273 @result{} "When in the course"
1277(fillarray s ?-) 1274(fillarray s ?-)
@@ -1310,8 +1307,8 @@ same way in Lisp input.
1310evaluation: the result of evaluating it is the same vector. This does 1307evaluation: the result of evaluating it is the same vector. This does
1311not evaluate or even examine the elements of the vector. 1308not evaluate or even examine the elements of the vector.
1312@xref{Self-Evaluating Forms}. Vectors written with square brackets 1309@xref{Self-Evaluating Forms}. Vectors written with square brackets
1313are constants and should not be modified via @code{aset} or other 1310should not be modified via @code{aset} or other destructive
1314destructive operations. @xref{Constants and Mutability}. 1311operations. @xref{Mutability}.
1315 1312
1316 Here are examples illustrating these principles: 1313 Here are examples illustrating these principles:
1317 1314
diff --git a/doc/lispref/strings.texi b/doc/lispref/strings.texi
index a4c9c2549c5..70c3b3cf4be 100644
--- a/doc/lispref/strings.texi
+++ b/doc/lispref/strings.texi
@@ -49,10 +49,9 @@ by a distinguished character code.
49 49
50 Since strings are arrays, and therefore sequences as well, you can 50 Since strings are arrays, and therefore sequences as well, you can
51operate on them with the general array and sequence functions documented 51operate on them with the general array and sequence functions documented
52in @ref{Sequences Arrays Vectors}. For example, you can access or 52in @ref{Sequences Arrays Vectors}. For example, you can access
53change individual characters in a string using the functions @code{aref} 53individual characters in a string using the function @code{aref}
54and @code{aset} (@pxref{Array Functions}). However, you should not 54(@pxref{Array Functions}).
55try to change the contents of constant strings (@pxref{Modifying Strings}).
56 55
57 There are two text representations for non-@acronym{ASCII} 56 There are two text representations for non-@acronym{ASCII}
58characters in Emacs strings (and in buffers): unibyte and multibyte. 57characters in Emacs strings (and in buffers): unibyte and multibyte.
@@ -382,9 +381,7 @@ usual value is @w{@code{"[ \f\t\n\r\v]+"}}.
382@cindex string modification 381@cindex string modification
383 382
384 You can alter the contents of a mutable string via operations 383 You can alter the contents of a mutable string via operations
385described in this section. However, you should not try to use these 384described in this section. @xref{Mutability}.
386operations to alter the contents of a constant string.
387@xref{Constants and Mutability}.
388 385
389 The most basic way to alter the contents of an existing string is with 386 The most basic way to alter the contents of an existing string is with
390@code{aset} (@pxref{Array Functions}). @code{(aset @var{string} 387@code{aset} (@pxref{Array Functions}). @code{(aset @var{string}
diff --git a/etc/TODO b/etc/TODO
index 20262a77e97..f983fa27d33 100644
--- a/etc/TODO
+++ b/etc/TODO
@@ -264,6 +264,37 @@ of the mode line.
264The prettify-symbols-mode should be deprecated once ligature support 264The prettify-symbols-mode should be deprecated once ligature support
265is in place. 265is in place.
266 266
267A related, but somewhat independent, feature is being able to move the
268cursor "into a ligature", whereby cursor motion commands shows some
269pseudo-cursor on some part of a ligature. For example, if "ffi" is
270displayed as a ligature, then moving by one buffer position should
271show the middle part of the ligature's glyph similar to the cursor
272display: some special background and perhaps also a special
273foreground. There are two possible ways of figuring out the offset at
274which to display the pseudo-cursor:
275
276 . Arbitrarily divide the ligature's glyph width W into N parts,
277 where N is the number of codepoints composed into the ligature, then
278 move that pseudo-cursor by W/N pixels each time a cursor-motion
279 command is invoked;
280 . Use the font information. For example, HarfBuzz has the
281 hb_ot_layout_get_ligature_carets API for that purpose. However,
282 it could be that few fonts actually have that information recorded
283 in them, in which case the previous heuristics will be needed as
284 fallback.
285
286One subtle issue needs to be resolved to have this feature of
287"sub-glyph" cursor movement inside composed characters. The way Emacs
288currently displays the default block cursor is by simply redrawing the
289glyph at point in reverse video. So Emacs currently doesn't have a
290way of displaying a cursor that "covers" only part of a glyph. To
291make this happen, the display code will probably need to be changed to
292draw the cursor as part of drawing the foreground and/or background of
293the corresponding glyph, which is against the current flow of the
294display code: it generally first completely draws the background and
295foreground of the entire text that needs to be redrawn, and only then
296draws the cursor where it should be placed.
297
267** Support for Stylistic Sets 298** Support for Stylistic Sets
268This will allow using "alternate glyphs" supported by modern fonts. 299This will allow using "alternate glyphs" supported by modern fonts.
269For an overview of this feature, see 300For an overview of this feature, see