Skip to content

Commit f9bbe31

Browse files
author
Po Lu
committed
Merge from origin/emacs-29
4bd8e8c ; * src/xdisp.c: Fix wording in commentary. 3af27a4 Improve commentary in nsfns.m 5de5e4b Fix typos and ommissions in cus-edit.el 9d93c6b ; * src/xdisp.c: Fix typos in the commentary. 86f2d6d ; * src/xdisp.c: Improve commentary. (Bug#64596) ac07517 ; * admin/notes/bugtracker: Fix punctuation. 8151853 ; * admin/notes/bugtracker: Use 'e.g.' throughout the doc... f063f79 Convert NUL-containing NSString objects to Lisp strings c... d172cd5 ; * doc/lispref/keymaps.texi (Modifying Menus): Add cross... 927e8b4 ; * doc/lispref/keymaps.texi (Extended Menu Items): Add @... 77f4894 ; * src/xdisp.c: Minor improvements of the commentary. ce3f9fb ; Improve accuracy of out-out-order message insertion 17073af ; Improve robustness of package-report-bug
2 parents 7ff41bf + 4bd8e8c commit f9bbe31

File tree

7 files changed

+140
-91
lines changed

7 files changed

+140
-91
lines changed

admin/notes/bugtracker

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ tags 123 moreinfo|unreproducible|wontfix|patch|notabug
3939

4040
For a list of all bugs, see https://debbugs.gnu.org/db/pa/lemacs.html
4141
This is a static page, updated once a day. There is also a dynamic
42-
list, generated on request. This accepts various options, eg to see
42+
list, generated on request. This accepts various options, e.g., to see
4343
the most recent bugs:
4444

4545
https://debbugs.gnu.org/cgi/pkgreport.cgi?newest=100
@@ -98,7 +98,7 @@ you might want to have a dialog with the owner address, outside of
9898
normal bug reporting.)
9999

100100
** When reporting a new bug, to send a Cc to another address
101-
(e.g. [email protected]), do NOT just use a Cc: header.
101+
(e.g., [email protected]), do NOT just use a Cc: header.
102102
Instead, use "X-Debbugs-Cc:". This ensures the Cc address(es) will get a
103103
mail with the bug report number in. If you do not do this, each reply
104104
in the subsequent discussion might end up creating a new bug.
@@ -138,7 +138,8 @@ The "maintainer email address" is "[email protected]" in most cases.
138138

139139
** To not get acknowledgment mail from the tracker,
140140
add an "X-Debbugs-No-Ack:" header (with any value). If you use Gnus,
141-
you can add an element to gnus-posting-styles to do this automatically, eg:
141+
you can add an element to gnus-posting-styles to do this automatically,
142+
e.g.:
142143

143144
("gnu-emacs\\(-pretest\\)?-bug"
144145
("X-Debbugs-No-Ack" "yes"))
@@ -222,14 +223,14 @@ Mail-Followup-To: [email protected], person-who-closed
222223
** Setting bug parameters.
223224
There are two ways to set the parameters of bugs in the database
224225
(tags, severity level, etc). When you report a new bug, you can
225-
provide a "pseudo-header" at the start of the report, eg:
226+
provide a "pseudo-header" at the start of the report, e.g.:
226227

227228
Package: emacs
228229
Version: 23.0.60
229230
Severity: minor
230231

231232
This can also include tags, or any X-Debbugs- setting.
232-
Some things (e.g. submitter) don't seem to work here.
233+
Some things (e.g., submitter) don't seem to work here.
233234

234235
Otherwise, send mail to the control server, [email protected].
235236
At the start of the message body, supply the desired commands, one per
@@ -258,12 +259,12 @@ where VERSION is XX.YY numerical version number, like 42.1.
258259
*** To reopen a closed bug:
259260
reopen 123
260261

261-
*** Bugs can be tagged in various ways (eg wontfix, patch, etc).
262+
*** Bugs can be tagged in various ways (e.g., wontfix, patch, etc).
262263
The available tags are:
263264
patch wontfix moreinfo unreproducible fixed notabug help security confirmed easy
264265
See https://debbugs.gnu.org/Developer#tags
265266
The list of tags can be prefixed with +, - or =, meaning to add (the
266-
default), remove, or reset the tags. E.g.:
267+
default), remove, or reset the tags. E.g.:
267268

268269
tags 123 + wontfix
269270

@@ -310,7 +311,7 @@ This will add a usertag "any-tag-you-like" to bug#1234. The tag will
310311
be associated with the user "emacs". If you omit the first line,
311312
the tag will be associated with your email address.
312313

313-
The syntax of the usertags command is the same as that of tags (eg wrt
314+
The syntax of the usertags command is the same as that of tags (e.g., wrt
314315
the optional [=+-] argument).
315316

316317
b) In an initial submission, in the pseudo-header:
@@ -340,15 +341,15 @@ than one email address, but it does not seem to work for me.)
340341
**** To find bugs tagged with a specific usertag:
341342

342343
This works just like a normal tags search, but with the addition of a
343-
"users" field. Eg:
344+
"users" field. E.g.:
344345

345346
https://debbugs.gnu.org/cgi/pkgreport.cgi?users=emacs;tag=calendar
346347

347348
*** To merge bugs:
348-
Eg when bad replies create a bunch of new bugs for the same report.
349-
Bugs must all be in the same state (e.g. same package(s) and severity
349+
e.g., when bad replies create a bunch of new bugs for the same report.
350+
Bugs must all be in the same state (e.g., same package(s) and severity
350351
-- see 'reassign' and 'severity' below), but need not have the same
351-
tags (tags are merged). E.g.:
352+
tags (tags are merged). E.g.:
352353

353354
merge 123 124 125 ...
354355

@@ -557,7 +558,7 @@ debbugs-submit. Approved mail is passed on to the tracker.
557558
tracker, since mail from whitelisted senders goes straight through.)
558559

559560
NOTE: An alternative to this would be to use listhelper AT nongnu.org
560-
as a moderator address. Eg the emacs-bug-tracker list uses this.
561+
as a moderator address. E.g., the emacs-bug-tracker list uses this.
561562
It does basic spam processing on the moderator requests and
562563
automatically rejects the obviously bogus ones. Someone still has to
563564
accept the good ones though. The advantage of this would not be having

doc/lispref/keymaps.texi

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2506,7 +2506,8 @@ get a non-selectable menu item. This is mostly useful when creating
25062506
separator lines and the like.
25072507

25082508
The tail of the list, @var{item-property-list}, has the form of a
2509-
property list which contains other information.
2509+
property list (@pxref{Property Lists}) which contains other
2510+
information.
25102511

25112512
Here is a table of the properties that are supported:
25122513

@@ -3171,14 +3172,15 @@ the menu. To put it elsewhere in the menu, use @code{keymap-set-after}:
31713172

31723173
@defun keymap-set-after map key binding &optional after
31733174
Define a binding in @var{map} for @var{key}, with value @var{binding},
3174-
just like @code{define-key}, but position the binding in @var{map} after
3175-
the binding for the event @var{after}. The argument @var{key} should
3176-
represent a single menu item or key, and @var{after} should be a
3177-
single event type---a symbol or a character, not a sequence. The new
3178-
binding goes after the binding for @var{after}. If @var{after} is
3179-
@code{t} or is omitted, then the new binding goes last, at the end of
3180-
the keymap. However, new bindings are added before any inherited
3181-
keymap.
3175+
just like @code{keymap-set} (@pxref{Changing Key Bindings}), but
3176+
position the binding in @var{map} after the binding for the event
3177+
@var{after}. The argument @var{key} should represent a single menu
3178+
item or key, and should satisfy @code{key-valid-p} (@pxref{Key
3179+
Sequences}). @var{after} should be a single event type---a symbol or
3180+
a character, not a sequence. The new binding goes after the binding
3181+
for @var{after}. If @var{after} is @code{t} or is omitted, then the
3182+
new binding goes last, at the end of the keymap. However, new
3183+
bindings are added before any inherited keymap.
31823184

31833185
Here is an example:
31843186

lisp/cus-edit.el

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3533,7 +3533,11 @@ GNUstep or Macintosh OS Cocoa interface.")
35333533
(const :format "PGTK "
35343534
:sibling-args (:help-echo "\
35353535
Pure-GTK interface.")
3536-
ns)
3536+
pgtk)
3537+
(const :format "Haiku "
3538+
:sibling-args (:help-echo "\
3539+
Haiku interface.")
3540+
haiku)
35373541
(const :format "DOS "
35383542
:sibling-args (:help-echo "\
35393543
Plain MS-DOS.")

lisp/emacs-lisp/package.el

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4641,13 +4641,14 @@ DESC must be a `package-desc' object."
46414641
vars)
46424642
(dolist-with-progress-reporter (group custom-current-group-alist)
46434643
"Scanning for modified user options..."
4644-
(dolist (ent (get (cdr group) 'custom-group))
4645-
(when (and (custom-variable-p (car ent))
4646-
(boundp (car ent))
4647-
(not (eq (custom--standard-value (car ent))
4648-
(default-toplevel-value (car ent))))
4649-
(file-in-directory-p (car group) (package-desc-dir desc)))
4650-
(push (car ent) vars))))
4644+
(when (and (car group)
4645+
(file-in-directory-p (car group) (package-desc-dir desc)))
4646+
(dolist (ent (get (cdr group) 'custom-group))
4647+
(when (and (custom-variable-p (car ent))
4648+
(boundp (car ent))
4649+
(not (eq (custom--standard-value (car ent))
4650+
(default-toplevel-value (car ent)))))
4651+
(push (car ent) vars)))))
46514652
(dlet ((reporter-prompt-for-summary-p t))
46524653
(reporter-submit-bug-report maint name vars))))
46534654

lisp/net/rcirc.el

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2059,7 +2059,7 @@ connection."
20592059
(point-min)))
20602060
(when (let ((then (get-text-property (point) 'rcirc-time)))
20612061
(and then (not (time-less-p time then))))
2062-
(next-single-property-change (point) 'hard)
2062+
(goto-char (next-single-property-change (point) 'hard))
20632063
(forward-char 1)
20642064
(throw 'exit nil))))
20652065
(goto-char (line-beginning-position))

src/nsfns.m

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3840,7 +3840,13 @@ handled fairly well by the NS libraries (displayed with distinct
38403840
/* Make a Lisp string from an NSString. */
38413841
- (Lisp_Object)lispString
38423842
{
3843-
return build_string ([self UTF8String]);
3843+
/* `make_string' creates a string with a given length, instead of
3844+
searching for a trailing NULL byte to determine its end. This is
3845+
important because this function is called to convert NSString
3846+
objects containing clipboard data, which can contain NUL bytes,
3847+
into Lisp strings. (bug#64697) */
3848+
return make_string ([self UTF8String],
3849+
[self lengthOfBytesUsingEncoding: NSUTF8StringEncoding]);
38443850
}
38453851
@end
38463852

src/xdisp.c

Lines changed: 94 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,17 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
2121

2222
Redisplay.
2323

24-
Emacs separates the task of updating the display from code
25-
modifying global state, e.g. buffer text. This way functions
26-
operating on buffers don't also have to be concerned with updating
27-
the display.
28-
29-
Updating the display is triggered by the Lisp interpreter when it
30-
decides it's time to do it. This is done either automatically for
31-
you as part of the interpreter's command loop or as the result of
32-
calling Lisp functions like `sit-for'. The C function
33-
`redisplay_internal' in xdisp.c is the only entry into the inner
34-
redisplay code.
24+
Emacs separates the task of updating the display -- which we call
25+
"redisplay" -- from the code modifying global state, e.g. buffer
26+
text. This way functions operating on buffers don't also have to
27+
be concerned with updating the display as result of their
28+
operations.
29+
30+
Redisplay is triggered by the Lisp interpreter when it decides it's
31+
time to do it. This is done either automatically for you as part
32+
of the interpreter's command loop, or as the result of calling Lisp
33+
functions like `sit-for'. The C function `redisplay_internal' in
34+
xdisp.c is the only entry into the inner redisplay code.
3535

3636
The following diagram shows how redisplay code is invoked. As you
3737
can see, Lisp calls redisplay and vice versa.
@@ -75,63 +75,97 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
7575
and to make these changes visible. Preferably it would do that in
7676
a moderately intelligent way, i.e. fast.
7777

78-
Changes in buffer text can be deduced from window and buffer
78+
At its highest level, redisplay can be divided into 3 distinct
79+
steps, all of which are visible in `redisplay_internal':
80+
81+
. decide which frames need their windows to be considered for redisplay
82+
. for each window whose display might need to be updated, compute
83+
a structure, called "glyph matrix", which describes how it
84+
should look on display
85+
. actually update the display of windows on the glass where the
86+
newly obtained glyph matrix differs from the one produced by the
87+
previous redisplay cycle
88+
89+
The first of these steps is done by `redisplay_internal' itself, by
90+
looping through all the frames and testing their various flags,
91+
such as their visibility. The result of this could be that only
92+
the selected window on the selected frame must be redisplayed, or
93+
it could conclude that other windows need to be considered as well.
94+
95+
The second step considers each window that might need to be
96+
redisplayed. This could be only the selected window, or the window
97+
trees of one or more frames. The function which considers a window
98+
and decides whether it actually needs redisplay is
99+
`redisplay_window'. It does so by looking at the changes in
100+
position of point, in buffer text, in text properties, overlays,
101+
etc. These changes can be deduced from window and buffer
79102
structures, and from some global variables like `beg_unchanged' and
80-
`end_unchanged'. The contents of the display are additionally
81-
recorded in a `glyph matrix', a two-dimensional matrix of glyph
82-
structures. Each row in such a matrix corresponds to a line on the
83-
display, and each glyph in a row corresponds to a column displaying
84-
a character, an image, or what else. This matrix is called the
85-
`current glyph matrix' or `current matrix' in redisplay
86-
terminology.
87-
88-
For buffer parts that have been changed since the last update, a
89-
second glyph matrix is constructed, the so called `desired glyph
90-
matrix' or short `desired matrix'. Current and desired matrix are
91-
then compared to find a cheap way to update the display, e.g. by
92-
reusing part of the display by scrolling lines. The actual update
93-
of the display of each window by comparing the desired and the
94-
current matrix is done by `update_window', which calls functions
95-
which draw to the glass (those functions are specific to the type
96-
of the window's frame: X, w32, NS, etc.).
103+
`end_unchanged'. The current contents of the display are recorded
104+
in a `glyph matrix', a two-dimensional matrix of glyph structures.
105+
Each row in such a matrix corresponds to a line on the display, and
106+
each glyph in a row corresponds to a column displaying a character,
107+
an image, or what else. This matrix is called the `current glyph
108+
matrix', or `current matrix', in redisplay terminology.
109+
110+
For buffer parts that have been changed since the last redisplay,
111+
`redisplay_window' constructs a second glyph matrix, the so called
112+
`desired glyph matrix' or short `desired matrix'. It does so in
113+
the most optimal way possible, avoiding the examination of text
114+
that didn't change, reusing portions of the current matrix if
115+
possible, etc. It could, in particular, decide that a window
116+
doesn't need to be redisplayed at all.
117+
118+
This second step of redisplay also updates the parts of the desired
119+
matrix that correspond to the mode lines, header lines, and
120+
tab-lines of the windows which need that; see `display_mode_lines'.
121+
122+
In the third and last step, the current and desired matrix are then
123+
compared to find a cheap way to update the display, e.g. by reusing
124+
part of the display by scrolling lines. The actual update of the
125+
display of each window, by comparing the desired and the current
126+
matrix, is done by `update_window', which calls functions which
127+
draw to the glass (those functions are specific to the type of the
128+
window's frame: X, w32, NS, etc.).
97129

98130
Once the display of a window on the glass has been updated, its
99131
desired matrix is used to update the corresponding rows of the
100132
current matrix, and then the desired matrix is discarded.
101133

102134
You will find a lot of redisplay optimizations when you start
103-
looking at the innards of redisplay. The overall goal of all these
104-
optimizations is to make redisplay fast because it is done
105-
frequently. Some of these optimizations are implemented by the
106-
following functions:
135+
looking at the innards of `redisplay_window'. The overall goal of
136+
all these optimizations is to make redisplay fast because it is
137+
done frequently. Some of these optimizations are implemented by
138+
the following functions:
107139

108140
. try_cursor_movement
109141

110-
This function tries to update the display if the text in the
111-
window did not change and did not scroll, only point moved, and
112-
it did not move off the displayed portion of the text.
142+
This optimization is applicable if the text in the window did
143+
not change and did not scroll, only point moved, and it did not
144+
move off the displayed portion of the text. In that case, the
145+
window's glyph matrix is still valid, and only the position of
146+
the cursor might need to be updated.
113147

114148
. try_window_reusing_current_matrix
115149

116-
This function reuses the current matrix of a window when text
117-
has not changed, but the window start changed (e.g., due to
150+
This function reuses the current glyph matrix of a window when
151+
text has not changed, but the window start changed (e.g., due to
118152
scrolling).
119153

120154
. try_window_id
121155

122-
This function attempts to redisplay a window by reusing parts of
123-
its existing display. It finds and reuses the part that was not
124-
changed, and redraws the rest. (The "id" part in the function's
125-
name stands for "insert/delete", not for "identification" or
126-
somesuch.)
156+
This function attempts to update a window's glyph matrix by
157+
reusing parts of its current glyph matrix. It finds and reuses
158+
the part that was not changed, and regenerates the rest. (The
159+
"id" part in the function's name stands for "insert/delete", not
160+
for "identification" or somesuch.)
127161

128162
. try_window
129163

130-
This function performs the full, unoptimized, redisplay of a
131-
single window assuming that its fonts were not changed and that
132-
the cursor will not end up in the scroll margins. (Loading
133-
fonts requires re-adjustment of dimensions of glyph matrices,
134-
which makes this method impossible to use.)
164+
This function performs the full, unoptimized, generation of a
165+
single window's glyph matrix, assuming that its fonts were not
166+
changed and that the cursor will not end up in the scroll
167+
margins. (Loading fonts requires re-adjustment of dimensions of
168+
glyph matrices, which makes this method impossible to use.)
135169

136170
The optimizations are tried in sequence (some can be skipped if
137171
it is known that they are not applicable). If none of the
@@ -140,16 +174,17 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
140174

141175
Note that there's one more important optimization up Emacs's
142176
sleeve, but it is related to actually redrawing the potentially
143-
changed portions of the window/frame, not to reproducing the
144-
desired matrices of those potentially changed portions. Namely,
145-
the function update_frame and its subroutines, which you will find
146-
in dispnew.c, compare the desired matrices with the current
147-
matrices, and only redraw the portions that changed. So it could
148-
happen that the functions in this file for some reason decide that
149-
the entire desired matrix needs to be regenerated from scratch, and
150-
still only parts of the Emacs display, or even nothing at all, will
151-
be actually delivered to the glass, because update_frame has found
152-
that the new and the old screen contents are similar or identical.
177+
changed portions of the window/frame as part of the third step, not
178+
to generating the desired matrices of those potentially changed
179+
portions. Namely, the function `update_frame' and its subroutines,
180+
which you will find in dispnew.c, compare the desired matrices with
181+
the current matrices, and only redraw the portions that changed.
182+
So it could happen that the functions in this file for some reason
183+
decide that the entire desired matrix needs to be regenerated from
184+
scratch, and still only parts of the Emacs display, or even nothing
185+
at all, will be actually delivered to the glass, because
186+
`update_frame' has found that the new and the old screen contents
187+
are similar or identical.
153188

154189
Desired matrices.
155190

@@ -159,7 +194,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
159194
redisplay tries to optimize its work, and thus only generates
160195
glyphs for rows that need to be updated on the screen. Rows that
161196
don't need to be updated are left "disabled", and their contents
162-
should be ignored.
197+
in the desired matrix should be ignored.
163198

164199
The function `display_line' is the central function to look at if
165200
you are interested in how the rows of the desired matrix are

0 commit comments

Comments
 (0)