aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2020-04-25 07:50:21 -0700
committerGlenn Morris2020-04-25 07:50:21 -0700
commit519567878fa32715aa377d1fa23240f09ce291f6 (patch)
tree6024af0ac41fca6aa73cebd84352860a864dae7e
parentf7748ad682abca5968ce24ed488ba56d2e48ef8a (diff)
parent45a64c97c74c34d3d2e912a670b30aa10dbf439c (diff)
downloademacs-519567878fa32715aa377d1fa23240f09ce291f6.tar.gz
emacs-519567878fa32715aa377d1fa23240f09ce291f6.zip
Merge from origin/emacs-27
45a64c97c7 (origin/emacs-27) Clarify semantics of trace-function CONT... 821760fdc4 Don't let a code literal get modified in mml parsing (Bug#... 74a92be16d * lisp/simple.el (kill-ring-save): Doc fix. (Bug#40797) 3d0e859692 Minor doc clarification regarding fringe bitmaps 4d86c7f822 Fix documentation of fringe bitmaps a76af88dd8 Tweak mutability doc a bit more f7e488d206 Calc: fix autoload errors (bug#40800) 369761b36d ; * src/xdisp.c: Improve the introductory commentary. a92ca1f177 Improve indexing of ELisp manual 5a25d17760 * lisp/image-mode.el (image-transform-resize): Remove FIXM... 37ebec3a95 Improve the default value of 'doc-view-ghostscript-program'. ba6104d1e8 Change doc-view-mode-map prefix key 's' to 'c'. 400ff5cd19 Improve wording about constants d2836fe71b Improve the default value of 'doc-view-ghostscript-program'. fc55f65305 Minor improvements in documentation of the last change a64da75961 Add image-auto-resize defcustoms to image-mode.el 692ad40539 Improve the documentation of tab-bar and tab-line # Conflicts: # etc/NEWS
-rw-r--r--doc/emacs/display.texi1
-rw-r--r--doc/emacs/emacs.texi1
-rw-r--r--doc/emacs/files.texi37
-rw-r--r--doc/emacs/frames.texi62
-rw-r--r--doc/emacs/glossary.texi2
-rw-r--r--doc/emacs/misc.texi10
-rw-r--r--doc/emacs/modes.texi2
-rw-r--r--doc/emacs/windows.texi37
-rw-r--r--doc/lispref/display.texi10
-rw-r--r--doc/lispref/eval.texi6
-rw-r--r--doc/lispref/lists.texi7
-rw-r--r--doc/lispref/objects.texi21
-rw-r--r--doc/lispref/tips.texi1
-rw-r--r--etc/NEWS.2764
-rw-r--r--lisp/calc/calc-ext.el9
-rw-r--r--lisp/calc/calc-prog.el5
-rw-r--r--lisp/doc-view.el32
-rw-r--r--lisp/emacs-lisp/trace.el4
-rw-r--r--lisp/gnus/mml.el2
-rw-r--r--lisp/image-mode.el55
-rw-r--r--lisp/simple.el2
-rw-r--r--src/xdisp.c271
22 files changed, 436 insertions, 205 deletions
diff --git a/doc/emacs/display.texi b/doc/emacs/display.texi
index cbc00ee4eef..536f4cb5daa 100644
--- a/doc/emacs/display.texi
+++ b/doc/emacs/display.texi
@@ -735,6 +735,7 @@ in a way that does not interact well with @code{highlight}.
735@cindex @code{tab-line} face 735@cindex @code{tab-line} face
736Similar to @code{mode-line} for a window's tab line, which appears 736Similar to @code{mode-line} for a window's tab line, which appears
737at the top of a window with tabs representing window buffers. 737at the top of a window with tabs representing window buffers.
738@xref{Tab Line}.
738@item vertical-border 739@item vertical-border
739@cindex @code{vertical-border} face 740@cindex @code{vertical-border} face
740This face is used for the vertical divider between windows on text 741This face is used for the vertical divider between windows on text
diff --git a/doc/emacs/emacs.texi b/doc/emacs/emacs.texi
index 60f2be9a513..6b82aeb8234 100644
--- a/doc/emacs/emacs.texi
+++ b/doc/emacs/emacs.texi
@@ -517,6 +517,7 @@ Multiple Windows
517* Displaying Buffers:: How Emacs picks a window for displaying a buffer. 517* Displaying Buffers:: How Emacs picks a window for displaying a buffer.
518* Temporary Displays:: Displaying non-editable buffers. 518* Temporary Displays:: Displaying non-editable buffers.
519* Window Convenience:: Convenience functions for window handling. 519* Window Convenience:: Convenience functions for window handling.
520* Tab Line:: Window tab line.
520 521
521Displaying a Buffer in a Window 522Displaying a Buffer in a Window
522 523
diff --git a/doc/emacs/files.texi b/doc/emacs/files.texi
index 7d57555ce33..56ce7fdea19 100644
--- a/doc/emacs/files.texi
+++ b/doc/emacs/files.texi
@@ -2113,8 +2113,6 @@ point. Partial Completion mode offers other features extending
2113 2113
2114@findex image-mode 2114@findex image-mode
2115@findex image-toggle-display 2115@findex image-toggle-display
2116@findex image-next-file
2117@findex image-previous-file
2118@cindex images, viewing 2116@cindex images, viewing
2119 Visiting image files automatically selects Image mode. In this 2117 Visiting image files automatically selects Image mode. In this
2120major mode, you can type @kbd{C-c C-c} (@code{image-toggle-display}) 2118major mode, you can type @kbd{C-c C-c} (@code{image-toggle-display})
@@ -2122,12 +2120,34 @@ to toggle between displaying the file as an image in the Emacs buffer,
2122and displaying its underlying text (or raw byte) representation. 2120and displaying its underlying text (or raw byte) representation.
2123Additionally you can type @kbd{C-c C-x} (@code{image-toggle-hex-display}) 2121Additionally you can type @kbd{C-c C-x} (@code{image-toggle-hex-display})
2124to toggle between displaying the file as an image in the Emacs buffer, 2122to toggle between displaying the file as an image in the Emacs buffer,
2125and displaying it in hex representation. 2123and displaying it in hex representation. Displaying the file as an
2126Displaying the file as an image works only if Emacs is compiled with 2124image works only if Emacs is compiled with support for displaying
2127support for displaying such images. If the displayed image is wider 2125such images.
2128or taller than the frame, the usual point motion keys (@kbd{C-f}, 2126
2129@kbd{C-p}, and so forth) cause different parts of the image to be 2127@vindex image-auto-resize
2130displayed. You can press @kbd{n} (@code{image-next-file}) and @kbd{p} 2128@vindex image-auto-resize-on-window-resize
2129If the displayed image is wider or taller than the window in which it
2130is displayed, the usual point motion keys (@kbd{C-f}, @kbd{C-p}, and
2131so forth) cause different parts of the image to be displayed.
2132However, by default images are resized automatically to fit the
2133window, so this is only necessary if you customize the default
2134behavior by using the options @code{image-auto-resize} and
2135@code{image-auto-resize-on-window-resize}.
2136
2137@findex image-transform-fit-both
2138@findex image-transform-set-scale
2139@findex image-transform-reset
2140To resize the image manually you can use the command
2141@code{image-transform-fit-both} bound to @kbd{s b}
2142that fits the image to both the window height and width.
2143To scale the image specifying a scale factor, use the command
2144@code{image-transform-set-scale} bound to @kbd{s s}.
2145To reset all transformations to the initial state, use
2146@code{image-transform-reset} bound to @kbd{s 0}.
2147
2148@findex image-next-file
2149@findex image-previous-file
2150You can press @kbd{n} (@code{image-next-file}) and @kbd{p}
2131(@code{image-previous-file}) to visit the next image file and the 2151(@code{image-previous-file}) to visit the next image file and the
2132previous image file in the same directory, respectively. 2152previous image file in the same directory, respectively.
2133 2153
@@ -2195,7 +2215,6 @@ can be used to transform the image in question to @acronym{PNG} before
2195displaying. GraphicsMagick, ImageMagick and @command{ffmpeg} are 2215displaying. GraphicsMagick, ImageMagick and @command{ffmpeg} are
2196currently supported for image conversions. 2216currently supported for image conversions.
2197 2217
2198
2199@findex thumbs-mode 2218@findex thumbs-mode
2200@cindex mode, Thumbs 2219@cindex mode, Thumbs
2201 The Image-Dired package can also be used to view images as 2220 The Image-Dired package can also be used to view images as
diff --git a/doc/emacs/frames.texi b/doc/emacs/frames.texi
index 94218424d37..d9373b8bc78 100644
--- a/doc/emacs/frames.texi
+++ b/doc/emacs/frames.texi
@@ -1262,6 +1262,12 @@ sessions (@pxref{Saving Emacs Sessions}), the tabs from the Tab Bar are
1262recorded in the desktop file, together with their associated window 1262recorded in the desktop file, together with their associated window
1263configurations, and will be available after restoring the session. 1263configurations, and will be available after restoring the session.
1264 1264
1265Note that the Tab Bar is different from the Tab Line (@pxref{Tab Line}).
1266Whereas tabs on the Tab Line at the top of each window are used to
1267switch between buffers, tabs on the Tab Bar at the top of each frame
1268are used to switch between window configurations containing several
1269windows.
1270
1265@findex tab-bar-mode 1271@findex tab-bar-mode
1266 To toggle the use of tab bars, type @kbd{M-x tab-bar-mode}. This 1272 To toggle the use of tab bars, type @kbd{M-x tab-bar-mode}. This
1267command applies to all frames, including frames yet to be created. To 1273command applies to all frames, including frames yet to be created. To
@@ -1275,9 +1281,11 @@ is turned on automatically. If the value is @code{t}, then
1275tabs. The value @code{1} hides the tab bar when it has only one tab, 1281tabs. The value @code{1} hides the tab bar when it has only one tab,
1276and shows it again when more tabs are created. The value @code{nil} 1282and shows it again when more tabs are created. The value @code{nil}
1277always keeps the tab bar hidden; in this case it's still possible to 1283always keeps the tab bar hidden; in this case it's still possible to
1278use persistent named window configurations without using the tab bar 1284switch between named window configurations without the tab bar by
1279by typing the related commands: @kbd{M-x tab-new}, @kbd{M-x tab-next}, 1285using @kbd{M-x tab-next}, @kbd{M-x tab-switcher}, and other commands
1280@kbd{M-x tab-close}, @kbd{M-x tab-switcher}, etc. 1286that provide completion on tab names. Also it's possible to create
1287and close tabs without the tab bar by using commands @kbd{M-x
1288tab-new}, @kbd{M-x tab-close}, etc.
1281 1289
1282@kindex C-x t 1290@kindex C-x t
1283 The prefix key @kbd{C-x t} is analogous to @kbd{C-x 5}. 1291 The prefix key @kbd{C-x t} is analogous to @kbd{C-x 5}.
@@ -1286,7 +1294,8 @@ Whereas each @kbd{C-x 5} command pops up a buffer in a different frame
1286tab with a different window configuration in the selected frame. 1294tab with a different window configuration in the selected frame.
1287 1295
1288 The various @kbd{C-x t} commands differ in how they find or create the 1296 The various @kbd{C-x t} commands differ in how they find or create the
1289buffer to select: 1297buffer to select. The following commands can be used to select a buffer
1298in a new tab:
1290 1299
1291@table @kbd 1300@table @kbd
1292@item C-x t 2 1301@item C-x t 2
@@ -1295,19 +1304,18 @@ buffer to select:
1295Add a new tab (@code{tab-new}). You can control the choice of the 1304Add a new tab (@code{tab-new}). You can control the choice of the
1296buffer displayed in a new tab by customizing the variable 1305buffer displayed in a new tab by customizing the variable
1297@code{tab-bar-new-tab-choice}. 1306@code{tab-bar-new-tab-choice}.
1307
1298@item C-x t b @var{bufname} @key{RET} 1308@item C-x t b @var{bufname} @key{RET}
1299Select buffer @var{bufname} in another tab. This runs 1309Select buffer @var{bufname} in another tab. This runs
1300@code{switch-to-buffer-other-tab}. 1310@code{switch-to-buffer-other-tab}.
1311
1301@item C-x t f @var{filename} @key{RET} 1312@item C-x t f @var{filename} @key{RET}
1302Visit file @var{filename} and select its buffer in another tab. This 1313Visit file @var{filename} and select its buffer in another tab. This
1303runs @code{find-file-other-tab}. @xref{Visiting}. 1314runs @code{find-file-other-tab}. @xref{Visiting}.
1315
1304@item C-x t d @var{directory} @key{RET} 1316@item C-x t d @var{directory} @key{RET}
1305Select a Dired buffer for directory @var{directory} in another tab. 1317Select a Dired buffer for directory @var{directory} in another tab.
1306This runs @code{dired-other-tab}. @xref{Dired}. 1318This runs @code{dired-other-tab}. @xref{Dired}.
1307@item C-x t r @var{tabname} @key{RET}
1308Renames the current tab to @var{tabname}. You can control the
1309programmatic name given to a tab by default by customizing the
1310variable @code{tab-bar-tab-name-function}.
1311@end table 1319@end table
1312 1320
1313@vindex tab-bar-new-tab-choice 1321@vindex tab-bar-new-tab-choice
@@ -1316,7 +1324,7 @@ current before calling the command that adds a new tab.
1316To start a new tab with other buffers, customize the variable 1324To start a new tab with other buffers, customize the variable
1317@code{tab-bar-new-tab-choice}. 1325@code{tab-bar-new-tab-choice}.
1318 1326
1319 The following commands are used to delete and operate on tabs: 1327 The following commands can be used to delete tabs:
1320 1328
1321@table @kbd 1329@table @kbd
1322@item C-x t 0 1330@item C-x t 0
@@ -1325,19 +1333,45 @@ To start a new tab with other buffers, customize the variable
1325Close the selected tab (@code{tab-close}). It has no effect if there 1333Close the selected tab (@code{tab-close}). It has no effect if there
1326is only one tab. 1334is only one tab.
1327 1335
1336@item C-x t 1
1337@kindex C-x t 1
1338@findex tab-close-other
1339Close all tabs on the selected frame, except the selected one.
1340@end table
1341
1342 The following commands can be used to switch between tabs:
1343
1344@table @kbd
1328@item C-x t o 1345@item C-x t o
1346@itemx C-@key{TAB}
1329@kindex C-x t o 1347@kindex C-x t o
1330@kindex C-TAB 1348@kindex C-TAB
1331@findex tab-next 1349@findex tab-next
1332Switch to another tab. If you repeat this command, it cycles through 1350Switch to the next tab. If you repeat this command, it cycles through
1333all the tabs on the selected frame. With a positive numeric argument 1351all the tabs on the selected frame. With a positive numeric argument
1334N, it switches to the next Nth tab; with a negative argument −N, it 1352N, it switches to the next Nth tab; with a negative argument −N, it
1335switches back to the previous Nth tab. 1353switches back to the previous Nth tab.
1336 1354
1337@item C-x t 1 1355@item S-C-@key{TAB}
1338@kindex C-x t 1 1356@kindex S-C-TAB
1339@findex tab-close-other 1357@findex tab-previous
1340Close all tabs on the selected frame, except the selected one. 1358Switch to the previous tab. With a positive numeric argument N, it
1359switches to the previous Nth tab; with a negative argument −N, it
1360switches back to the next Nth tab.
1361@end table
1362
1363 The following commands can be used to operate on tabs:
1364
1365@table @kbd
1366@item C-x t r @var{tabname} @key{RET}
1367Rename the current tab to @var{tabname}. You can control the
1368programmatic name given to a tab by default by customizing the
1369variable @code{tab-bar-tab-name-function}.
1370
1371@item C-x t m
1372Move the current tab N positions to the right with a positive numeric
1373argument N. With a negative argument −N, it moves the current tab
1374N positions to the left.
1341@end table 1375@end table
1342 1376
1343@node Dialog Boxes 1377@node Dialog Boxes
diff --git a/doc/emacs/glossary.texi b/doc/emacs/glossary.texi
index 416431b8cd4..4d622ec0e3f 100644
--- a/doc/emacs/glossary.texi
+++ b/doc/emacs/glossary.texi
@@ -1367,7 +1367,7 @@ configurations. @xref{Tab Bars}.
1367 1367
1368@item Tab Line 1368@item Tab Line
1369The tab line is a line of tabs at the top of an Emacs window. 1369The tab line is a line of tabs at the top of an Emacs window.
1370Clicking on one of these tabs switches window buffers. 1370Clicking on one of these tabs switches window buffers. @xref{Tab Line}.
1371 1371
1372@anchor{Glossary---Tags Table} 1372@anchor{Glossary---Tags Table}
1373@item Tags Table 1373@item Tags Table
diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi
index a15aa17a66f..47f195d0b20 100644
--- a/doc/emacs/misc.texi
+++ b/doc/emacs/misc.texi
@@ -617,12 +617,12 @@ of pages to display. A slice is a rectangle within the page area;
617once you specify a slice in DocView, it applies to whichever page you 617once you specify a slice in DocView, it applies to whichever page you
618look at. 618look at.
619 619
620 To specify the slice numerically, type @kbd{s s} 620 To specify the slice numerically, type @kbd{c s}
621(@code{doc-view-set-slice}); then enter the top left pixel position 621(@code{doc-view-set-slice}); then enter the top left pixel position
622and the slice's width and height. 622and the slice's width and height.
623@c ??? how does this work? 623@c ??? how does this work?
624 624
625 A more convenient graphical way to specify the slice is with @kbd{s 625 A more convenient graphical way to specify the slice is with @kbd{c
626m} (@code{doc-view-set-slice-using-mouse}), where you use the mouse to 626m} (@code{doc-view-set-slice-using-mouse}), where you use the mouse to
627select the slice. Simply press and hold the left mouse button at the 627select the slice. Simply press and hold the left mouse button at the
628upper-left corner of the region you want to have in the slice, then 628upper-left corner of the region you want to have in the slice, then
@@ -631,10 +631,10 @@ button.
631 631
632 The most convenient way is to set the optimal slice by using 632 The most convenient way is to set the optimal slice by using
633BoundingBox information automatically determined from the document by 633BoundingBox information automatically determined from the document by
634typing @kbd{s b} (@code{doc-view-set-slice-from-bounding-box}). 634typing @kbd{c b} (@code{doc-view-set-slice-from-bounding-box}).
635 635
636@findex doc-view-reset-slice 636@findex doc-view-reset-slice
637 To cancel the selected slice, type @kbd{s r} 637 To cancel the selected slice, type @kbd{c r}
638(@code{doc-view-reset-slice}). Then DocView shows the entire page 638(@code{doc-view-reset-slice}). Then DocView shows the entire page
639including its entire margins. 639including its entire margins.
640 640
@@ -791,7 +791,7 @@ the same number of columns as provided by the shell.
791@vindex shell-command-prompt-show-cwd 791@vindex shell-command-prompt-show-cwd
792 To make the above commands show the current directory in their 792 To make the above commands show the current directory in their
793prompts, customize the variable @code{shell-command-prompt-show-cwd} 793prompts, customize the variable @code{shell-command-prompt-show-cwd}
794to a non-nil value. 794to a non-@code{nil} value.
795 795
796@kindex M-| 796@kindex M-|
797@findex shell-command-on-region 797@findex shell-command-on-region
diff --git a/doc/emacs/modes.texi b/doc/emacs/modes.texi
index 92d60d2d7c2..f5fb6b1e797 100644
--- a/doc/emacs/modes.texi
+++ b/doc/emacs/modes.texi
@@ -299,7 +299,7 @@ Bars}.
299Tab Bar mode gives each frame a tab bar. @xref{Tab Bars}. 299Tab Bar mode gives each frame a tab bar. @xref{Tab Bars}.
300 300
301@item 301@item
302Tab Line mode gives each window a tab line. 302Tab Line mode gives each window a tab line. @xref{Tab Line}.
303 303
304@item 304@item
305Transient Mark mode highlights the region, and makes many Emacs 305Transient Mark mode highlights the region, and makes many Emacs
diff --git a/doc/emacs/windows.texi b/doc/emacs/windows.texi
index 910ef8fd88d..cb5e9bce4d1 100644
--- a/doc/emacs/windows.texi
+++ b/doc/emacs/windows.texi
@@ -21,6 +21,7 @@ one frame.
21* Change Window:: Deleting windows and changing their sizes. 21* Change Window:: Deleting windows and changing their sizes.
22* Displaying Buffers:: How Emacs picks a window for displaying a buffer. 22* Displaying Buffers:: How Emacs picks a window for displaying a buffer.
23* Window Convenience:: Convenience functions for window handling. 23* Window Convenience:: Convenience functions for window handling.
24* Tab Line:: Window tab line.
24@end menu 25@end menu
25 26
26@node Basic Window 27@node Basic Window
@@ -542,16 +543,6 @@ Reference Manual}), and cannot exceed the size of the containing frame.
542@node Window Convenience 543@node Window Convenience
543@section Convenience Features for Window Handling 544@section Convenience Features for Window Handling
544 545
545@findex global-tab-line-mode
546@cindex tab line
547 The command @code{global-tab-line-mode} toggles the display of a
548@dfn{tab line} on the top screen line of each window. The tab line
549shows special buttons (``tabs'') for each buffer that was displayed in
550a window, and allows switching to any of these buffers by clicking the
551corresponding button. You can add a tab by clicking on the @kbd{+}
552icon and delete a tab by clicking on the @kbd{x} icon of a tab. The
553mouse wheel on the tab line scrolls the tabs horizontally.
554
555@findex winner-mode 546@findex winner-mode
556@vindex winner-dont-bind-my-keys 547@vindex winner-dont-bind-my-keys
557@vindex winner-ring-size 548@vindex winner-ring-size
@@ -616,3 +607,29 @@ shown in different windows. @xref{Comparing Files}.
616 Scroll All mode (@kbd{M-x scroll-all-mode}) is a global minor mode 607 Scroll All mode (@kbd{M-x scroll-all-mode}) is a global minor mode
617that causes scrolling commands and point motion commands to apply to 608that causes scrolling commands and point motion commands to apply to
618every single window. 609every single window.
610
611
612@node Tab Line
613@section Window Tab Line
614
615@findex global-tab-line-mode
616@cindex tab line
617 The command @code{global-tab-line-mode} toggles the display of
618a @dfn{tab line} on the top screen line of each window. The Tab Line
619shows special buttons (``tabs'') for each buffer that was displayed in
620a window, and allows switching to any of these buffers by clicking the
621corresponding button. Clicking on the @kbd{+} icon adds a new buffer
622to the window-local tab line of buffers, and clicking on the @kbd{x}
623icon of a tab deletes it. The mouse wheel on the tab line scrolls
624the tabs horizontally.
625
626Selecting the previous window-local tab is the same as typing @kbd{C-x
627@key{LEFT}} (@code{previous-buffer}), selecting the next tab is the
628same as @kbd{C-x @key{RIGHT}} (@code{next-buffer}). Both commands
629support a numeric prefix argument as a repeat count.
630
631Note that the Tab Line is different from the Tab Bar (@pxref{Tab Bars}).
632Whereas tabs on the Tab Bar at the top of each frame are used to
633switch between window configurations containing several windows,
634tabs on the Tab Line at the top of each window are used to switch
635between buffers.
diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi
index e01cfedc4b8..e53f0e9f60c 100644
--- a/doc/lispref/display.texi
+++ b/doc/lispref/display.texi
@@ -4155,8 +4155,8 @@ topmost and bottommost buffer text line; and @code{top-bottom}
4155indicates where there is just one line of text in the buffer. 4155indicates where there is just one line of text in the buffer.
4156 4156
4157@item @code{empty-line} 4157@item @code{empty-line}
4158Used to indicate empty lines when @code{indicate-empty-lines} is 4158Used to indicate empty lines after the buffer end when
4159non-@code{nil}. 4159@code{indicate-empty-lines} is non-@code{nil}.
4160 4160
4161@item @code{overlay-arrow} 4161@item @code{overlay-arrow}
4162Used for overlay arrows (@pxref{Overlay Arrow}). 4162Used for overlay arrows (@pxref{Overlay Arrow}).
@@ -4298,6 +4298,7 @@ The former is used by overlay arrows. The latter is unused.
4298@itemx @code{bottom-left-angle}, @code{bottom-right-angle} 4298@itemx @code{bottom-left-angle}, @code{bottom-right-angle}
4299@itemx @code{top-left-angle}, @code{top-right-angle} 4299@itemx @code{top-left-angle}, @code{top-right-angle}
4300@itemx @code{left-bracket}, @code{right-bracket} 4300@itemx @code{left-bracket}, @code{right-bracket}
4301@itemx @code{empty-line}
4301Used to indicate buffer boundaries. 4302Used to indicate buffer boundaries.
4302 4303
4303@item @code{filled-rectangle}, @code{hollow-rectangle} 4304@item @code{filled-rectangle}, @code{hollow-rectangle}
@@ -4305,7 +4306,7 @@ Used to indicate buffer boundaries.
4305@itemx @code{vertical-bar}, @code{horizontal-bar} 4306@itemx @code{vertical-bar}, @code{horizontal-bar}
4306Used for different types of fringe cursors. 4307Used for different types of fringe cursors.
4307 4308
4308@item @code{empty-line}, @code{exclamation-mark}, @code{question-mark} 4309@item @code{exclamation-mark}, @code{question-mark}
4309Not used by core Emacs features. 4310Not used by core Emacs features.
4310@end table 4311@end table
4311 4312
@@ -4338,7 +4339,8 @@ The argument @var{bits} specifies the image to use. It should be
4338either a string or a vector of integers, where each element (an 4339either a string or a vector of integers, where each element (an
4339integer) corresponds to one row of the bitmap. Each bit of an integer 4340integer) corresponds to one row of the bitmap. Each bit of an integer
4340corresponds to one pixel of the bitmap, where the low bit corresponds 4341corresponds to one pixel of the bitmap, where the low bit corresponds
4341to the rightmost pixel of the bitmap. 4342to the rightmost pixel of the bitmap. (Note that this order of bits
4343is opposite of the order in XBM images; @pxref{XBM Images}.)
4342 4344
4343The height is normally the length of @var{bits}. However, you 4345The height is normally the length of @var{bits}. However, you
4344can specify a different height with non-@code{nil} @var{height}. The width 4346can specify a different height with non-@code{nil} @var{height}. The width
diff --git a/doc/lispref/eval.texi b/doc/lispref/eval.texi
index 021604c5142..baddce4d9c9 100644
--- a/doc/lispref/eval.texi
+++ b/doc/lispref/eval.texi
@@ -606,6 +606,12 @@ Here are some examples of expressions that use @code{quote}:
606@end group 606@end group
607@end example 607@end example
608 608
609 Although the expressions @code{(list '+ 1 2)} and @code{'(+ 1 2)}
610both yield lists equal to @code{(+ 1 2)}, the former yields a
611freshly-minted mutable list whereas the latter yields a constant list
612built from conses that may be shared with other constants.
613@xref{Constants and Mutability}.
614
609 Other quoting constructs include @code{function} (@pxref{Anonymous 615 Other quoting constructs include @code{function} (@pxref{Anonymous
610Functions}), which causes an anonymous lambda expression written in Lisp 616Functions}), which causes an anonymous lambda expression written in Lisp
611to be compiled, and @samp{`} (@pxref{Backquote}), which is used to quote 617to be compiled, and @samp{`} (@pxref{Backquote}), which is used to quote
diff --git a/doc/lispref/lists.texi b/doc/lispref/lists.texi
index 1125af7bec3..ea44e01f48a 100644
--- a/doc/lispref/lists.texi
+++ b/doc/lispref/lists.texi
@@ -1625,10 +1625,9 @@ keys may not be symbols:
1625 '(("simple leaves" . oak) 1625 '(("simple leaves" . oak)
1626 ("compound leaves" . horsechestnut))) 1626 ("compound leaves" . horsechestnut)))
1627 1627
1628;; @r{The @code{copy-sequence} means the keys are not @code{eq}.} 1628(assq "simple leaves" leaves)
1629(assq (copy-sequence "simple leaves") leaves) 1629 @result{} @r{Unspecified; might be @code{nil} or non-@code{nil}.}
1630 @result{} nil 1630(assoc "simple leaves" leaves)
1631(assoc (copy-sequence "simple leaves") leaves)
1632 @result{} ("simple leaves" . oak) 1631 @result{} ("simple leaves" . oak)
1633@end smallexample 1632@end smallexample
1634@end defun 1633@end defun
diff --git a/doc/lispref/objects.texi b/doc/lispref/objects.texi
index 3e9f2221020..d35a9ace572 100644
--- a/doc/lispref/objects.texi
+++ b/doc/lispref/objects.texi
@@ -46,7 +46,7 @@ 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 never change. 49 Some Lisp objects are @dfn{constant}: their values should never change.
50Others are @dfn{mutable}: their values can be changed via destructive 50Others are @dfn{mutable}: their values can be changed via destructive
51operations that involve side effects. 51operations that involve side effects.
52 52
@@ -2388,22 +2388,28 @@ that for two strings to be equal, they have the same text properties.
2388@cindex constants 2388@cindex constants
2389@cindex mutable objects 2389@cindex mutable objects
2390 2390
2391 Some Lisp objects are constant: their values never change. 2391 Some Lisp objects are constant: their values should never change
2392during a single execution of Emacs running well-behaved Lisp code.
2392For example, you can create a new integer by calculating one, but you 2393For example, you can create a new integer by calculating one, but you
2393cannot modify the value of an existing integer. 2394cannot modify the value of an existing integer.
2394 2395
2395 Other Lisp objects are mutable: their values can be changed 2396 Other Lisp objects are mutable: it is safe to change their values
2396via destructive operations involving side effects. For example, an 2397via destructive operations involving side effects. For example, an
2397existing marker can be changed by moving the marker to point to 2398existing marker can be changed by moving the marker to point to
2398somewhere else. 2399somewhere else.
2399 2400
2400 Although numbers are always constants and markers are always 2401 Although all numbers are constants and all markers are
2401mutable, some types contain both constant and mutable members. These 2402mutable, some types contain both constant and mutable members. These
2402types include conses, vectors, strings, and symbols. For example, the string 2403types include conses, vectors, strings, and symbols. For example, the string
2403literal @code{"aaa"} yields a constant string, whereas the function 2404literal @code{"aaa"} yields a constant string, whereas the function
2404call @code{(make-string 3 ?a)} yields a mutable string that can be 2405call @code{(make-string 3 ?a)} yields a mutable string that can be
2405changed via later calls to @code{aset}. 2406changed via later calls to @code{aset}.
2406 2407
2408 A mutable object can become constant if it is part of an expression
2409that is evaluated, because a program should not modify an object
2410that is being evaluated. The reverse does not occur: constant objects
2411should stay constant.
2412
2407 Trying to modify a constant variable signals an error 2413 Trying to modify a constant variable signals an error
2408(@pxref{Constant Variables}). 2414(@pxref{Constant Variables}).
2409A program should not attempt to modify other types of constants because the 2415A program should not attempt to modify other types of constants because the
@@ -2411,9 +2417,10 @@ resulting behavior is undefined: the Lisp interpreter might or might
2411not detect the error, and if it does not detect the error the 2417not detect the error, and if it does not detect the error the
2412interpreter can behave unpredictably thereafter. Another way to put 2418interpreter can behave unpredictably thereafter. Another way to put
2413this is that although mutable objects are safe to change and constant 2419this is that although mutable objects are safe to change and constant
2414symbols reliably reject attempts to change them, other constants are 2420variables reliably prevent attempts to change them, other constants
2415not safely mutable: if you try to change one your program might 2421are not safely mutable: if a misbehaving program tries to change such a
2416behave as you expect but it might crash or worse. This problem occurs 2422constant then the constant's value might actually change, or the
2423program might crash or worse. This problem occurs
2417with types that have both constant and mutable members, and that have 2424with types that have both constant and mutable members, and that have
2418mutators like @code{setcar} and @code{aset} that are valid on mutable 2425mutators like @code{setcar} and @code{aset} that are valid on mutable
2419objects but hazardous on constants. 2426objects but hazardous on constants.
diff --git a/doc/lispref/tips.texi b/doc/lispref/tips.texi
index 1ca97e2f092..3b8da35b6cc 100644
--- a/doc/lispref/tips.texi
+++ b/doc/lispref/tips.texi
@@ -8,6 +8,7 @@
8@cindex tips for writing Lisp 8@cindex tips for writing Lisp
9@cindex standards of coding style 9@cindex standards of coding style
10@cindex coding standards 10@cindex coding standards
11@cindex best practices
11 12
12 This chapter describes no additional features of Emacs Lisp. Instead 13 This chapter describes no additional features of Emacs Lisp. Instead
13it gives advice on making effective use of the features described in the 14it gives advice on making effective use of the features described in the
diff --git a/etc/NEWS.27 b/etc/NEWS.27
index 091c831e9d6..1eb391f1350 100644
--- a/etc/NEWS.27
+++ b/etc/NEWS.27
@@ -866,6 +866,11 @@ its functions.
866*** A new user option 'doc-view-pdftotext-program-args' has been added 866*** A new user option 'doc-view-pdftotext-program-args' has been added
867to allow controlling how the conversion to text is done. 867to allow controlling how the conversion to text is done.
868 868
869+++
870*** The prefix key 's' was changed to 'c' for slicing commands
871to avoid conflicts with image-mode key 's'. The new key 'c' still
872has good mnemonics of "cut", "clip", "crop".
873
869** Ido 874** Ido
870 875
871--- 876---
@@ -2720,8 +2725,8 @@ left to higher-level functions.
2720+++ 2725+++
2721*** Tab Bar mode 2726*** Tab Bar mode
2722The new command 'tab-bar-mode' enables the tab bar at the top of each 2727The new command 'tab-bar-mode' enables the tab bar at the top of each
2723frame, where you can use tabs to switch between named persistent 2728frame (including TTY frames), where you can use tabs to switch between
2724window configurations. 2729named persistent window configurations.
2725 2730
2726The 'C-x t' sequence is the new prefix key for tab-related commands: 2731The 'C-x t' sequence is the new prefix key for tab-related commands:
2727'C-x t 2' creates a new tab; 'C-x t 0' deletes the current tab; 2732'C-x t 2' creates a new tab; 'C-x t 0' deletes the current tab;
@@ -2738,6 +2743,11 @@ when its value is "on", "yes" or "1".
2738 2743
2739The user option 'tab-bar-position' specifies where to show the tab bar. 2744The user option 'tab-bar-position' specifies where to show the tab bar.
2740 2745
2746Tab-related commands can be used even without the tab bar when
2747'tab-bar-mode' is disabled by a nil value of the user option
2748'tab-bar-show'. Without the tab bar you can switch between tabs
2749using completion on tab names, or using 'tab-switcher'.
2750
2741Read the new Info node "(emacs) Tab Bars" for full description 2751Read the new Info node "(emacs) Tab Bars" for full description
2742of all related features. 2752of all related features.
2743 2753
@@ -2752,6 +2762,9 @@ a repeat count. Clicking on the plus icon adds a new buffer to the
2752window-local tab line of buffers. Using the mouse wheel on the tab 2762window-local tab line of buffers. Using the mouse wheel on the tab
2753line scrolls tabs. 2763line scrolls tabs.
2754 2764
2765Read the new Info node "(emacs) Tab Line" for full description
2766of all related features.
2767
2755+++ 2768+++
2756** fileloop.el lets one setup multifile operations like search&replace. 2769** fileloop.el lets one setup multifile operations like search&replace.
2757 2770
@@ -3515,9 +3528,32 @@ functions.
3515*** 'image-mode' now uses this library to automatically rotate images 3528*** 'image-mode' now uses this library to automatically rotate images
3516according to the orientation in the Exif data, if any. 3529according to the orientation in the Exif data, if any.
3517 3530
3531+++
3532*** The command 'image-rotate' now accepts a prefix argument.
3533With a prefix argument, 'image-rotate' now rotates the image at point
353490 degrees counter-clockwise, instead of the default clockwise.
3535
3536+++
3518*** In 'image-mode' the image is resized automatically to fit in window. 3537*** In 'image-mode' the image is resized automatically to fit in window.
3519The image will resize upon first display and whenever the window's 3538By default, the image will resize upon first display and whenever the
3520dimensions change. 3539window's dimensions change. Two user options 'image-auto-resize' and
3540'image-auto-resize-on-window-resize' control the resizing behavior
3541(including the possibility to disable auto-resizing). A new key
3542prefix 's' contains the commands that can be used to fit the image to
3543the window manually.
3544
3545---
3546*** Some 'image-mode' variables are now buffer-local.
3547The image parameters 'image-transform-rotation',
3548'image-transform-scale' and 'image-transform-resize' are now declared
3549buffer-local, so each buffer could have its own values for these
3550parameters.
3551
3552+++
3553*** Three new 'image-mode' commands have been added: 'm', which marks
3554the file in the dired buffer(s) for the directory the file is in; 'u',
3555which unmarks the file; and 'w', which pushes the current buffer's file
3556name to the kill ring.
3521 3557
3522--- 3558---
3523*** New library image-converter. 3559*** New library image-converter.
@@ -3538,26 +3574,6 @@ These now default to using 'image-mode'.
3538some years back. It now respects 'imagemagick-types-inhibit' as a way 3574some years back. It now respects 'imagemagick-types-inhibit' as a way
3539to disable that. 3575to disable that.
3540 3576
3541---
3542*** Some 'image-mode' variables are now buffer-local.
3543The image parameters 'image-transform-rotation',
3544'image-transform-scale' and 'image-transform-resize' are now declared
3545buffer-local, so each buffer could have its own values for these
3546parameters.
3547
3548+++
3549*** Three new 'image-mode' commands have been added: 'm', which marks
3550the file in the dired buffer(s) for the directory the file is in; 'u',
3551which unmarks the file; and 'w', which pushes the current buffer's file
3552name to the kill ring.
3553
3554+++
3555*** The command 'image-rotate' now accepts a prefix argument.
3556With a prefix argument, 'image-rotate' now rotates the image at point
355790 degrees counter-clockwise, instead of the default clockwise.
3558
3559*** 'image-mode' has a new key prefix 's' for transformation commands.
3560
3561** Modules 3577** Modules
3562 3578
3563--- 3579---
diff --git a/lisp/calc/calc-ext.el b/lisp/calc/calc-ext.el
index bc70ec283fa..5c11554d5d7 100644
--- a/lisp/calc/calc-ext.el
+++ b/lisp/calc/calc-ext.el
@@ -674,7 +674,6 @@
674 (define-key calc-mode-map "Z/" 'calc-kbd-break) 674 (define-key calc-mode-map "Z/" 'calc-kbd-break)
675 (define-key calc-mode-map "Z`" 'calc-kbd-push) 675 (define-key calc-mode-map "Z`" 'calc-kbd-push)
676 (define-key calc-mode-map "Z'" 'calc-kbd-pop) 676 (define-key calc-mode-map "Z'" 'calc-kbd-pop)
677 (define-key calc-mode-map "Z=" 'calc-kbd-report)
678 (define-key calc-mode-map "Z#" 'calc-kbd-query) 677 (define-key calc-mode-map "Z#" 'calc-kbd-query)
679 678
680 (calc-init-prefixes) 679 (calc-init-prefixes)
@@ -845,8 +844,8 @@ math-bernoulli-number math-gammap1-raw)
845 ("calc-incom" calc-digit-dots) 844 ("calc-incom" calc-digit-dots)
846 845
847 ("calc-keypd" calc-do-keypad 846 ("calc-keypd" calc-do-keypad
848calc-keypad-x-left-click calc-keypad-x-middle-click 847calc-keypad-left-click calc-keypad-middle-click
849calc-keypad-x-right-click) 848calc-keypad-right-click)
850 849
851 ("calc-lang" calc-set-language 850 ("calc-lang" calc-set-language
852math-read-big-balance math-read-big-rec) 851math-read-big-balance math-read-big-rec)
@@ -1003,7 +1002,7 @@ calc-find-root calc-poly-interp)
1003calc-floor calc-idiv calc-increment calc-mant-part calc-max calc-min 1002calc-floor calc-idiv calc-increment calc-mant-part calc-max calc-min
1004calc-round calc-scale-float calc-sign calc-trunc calc-xpon-part) 1003calc-round calc-scale-float calc-sign calc-trunc calc-xpon-part)
1005 1004
1006 ("calc-bin" calc-and calc-binary-radix calc-clip calc-twos-complement-mode 1005 ("calc-bin" calc-and calc-binary-radix calc-clip
1007calc-decimal-radix calc-diff calc-hex-radix calc-leading-zeros 1006calc-decimal-radix calc-diff calc-hex-radix calc-leading-zeros
1008calc-lshift-arith calc-lshift-binary calc-not calc-octal-radix calc-or calc-radix 1007calc-lshift-arith calc-lshift-binary calc-not calc-octal-radix calc-or calc-radix
1009calc-rotate-binary calc-rshift-arith calc-rshift-binary calc-word-size 1008calc-rotate-binary calc-rshift-arith calc-rshift-binary calc-word-size
@@ -1116,7 +1115,7 @@ calc-equal-to calc-get-user-defn calc-greater-equal calc-greater-than
1116calc-in-set calc-kbd-break calc-kbd-else calc-kbd-else-if 1115calc-in-set calc-kbd-break calc-kbd-else calc-kbd-else-if
1117calc-kbd-end-for calc-kbd-end-if calc-kbd-end-loop calc-kbd-end-repeat 1116calc-kbd-end-for calc-kbd-end-if calc-kbd-end-loop calc-kbd-end-repeat
1118calc-kbd-for calc-kbd-if calc-kbd-loop calc-kbd-pop calc-kbd-push 1117calc-kbd-for calc-kbd-if calc-kbd-loop calc-kbd-pop calc-kbd-push
1119calc-kbd-query calc-kbd-repeat calc-kbd-report calc-less-equal 1118calc-kbd-query calc-kbd-repeat calc-less-equal
1120calc-less-than calc-logical-and calc-logical-if calc-logical-not 1119calc-less-than calc-logical-and calc-logical-if calc-logical-not
1121calc-logical-or calc-not-equal-to calc-pass-errors calc-remove-equal 1120calc-logical-or calc-not-equal-to calc-pass-errors calc-remove-equal
1122calc-timing calc-user-define calc-user-define-composition 1121calc-timing calc-user-define calc-user-define-composition
diff --git a/lisp/calc/calc-prog.el b/lisp/calc/calc-prog.el
index e88aa92364c..6db5de4c96c 100644
--- a/lisp/calc/calc-prog.el
+++ b/lisp/calc/calc-prog.el
@@ -1452,11 +1452,6 @@ Redefine the corresponding command."
1452 (error "%s" "Unbalanced Z' in keyboard macro"))) 1452 (error "%s" "Unbalanced Z' in keyboard macro")))
1453 1453
1454 1454
1455;; (defun calc-kbd-report (msg)
1456;; (interactive "sMessage: ")
1457;; (calc-wrapper
1458;; (math-working msg (calc-top-n 1))))
1459
1460(defun calc-kbd-query () 1455(defun calc-kbd-query ()
1461 (interactive) 1456 (interactive)
1462 (let ((defining-kbd-macro nil) 1457 (let ((defining-kbd-macro nil)
diff --git a/lisp/doc-view.el b/lisp/doc-view.el
index 8b3d5527f08..3cac2629a9c 100644
--- a/lisp/doc-view.el
+++ b/lisp/doc-view.el
@@ -59,16 +59,16 @@
59;; will be remembered and applied to all pages of the current 59;; will be remembered and applied to all pages of the current
60;; document. This enables you to cut away the margins of a document 60;; document. This enables you to cut away the margins of a document
61;; to save some space. To select a slice you can use 61;; to save some space. To select a slice you can use
62;; `doc-view-set-slice' (bound to `s s') which will query you for the 62;; `doc-view-set-slice' (bound to `c s') which will query you for the
63;; coordinates of the slice's top-left corner and its width and 63;; coordinates of the slice's top-left corner and its width and
64;; height. A much more convenient way to do the same is offered by 64;; height. A much more convenient way to do the same is offered by
65;; the command `doc-view-set-slice-using-mouse' (bound to `s m'). 65;; the command `doc-view-set-slice-using-mouse' (bound to `c m').
66;; After invocation you only have to press mouse-1 at the top-left 66;; After invocation you only have to press mouse-1 at the top-left
67;; corner and drag it to the bottom-right corner of the desired slice. 67;; corner and drag it to the bottom-right corner of the desired slice.
68;; Even more accurate and convenient is to use 68;; Even more accurate and convenient is to use
69;; `doc-view-set-slice-from-bounding-box' (bound to `s b') which uses 69;; `doc-view-set-slice-from-bounding-box' (bound to `c b') which uses
70;; the BoundingBox information of the current page to set an optimal 70;; the BoundingBox information of the current page to set an optimal
71;; slice. To reset the slice use `doc-view-reset-slice' (bound to `s 71;; slice. To reset the slice use `doc-view-reset-slice' (bound to `c
72;; r'). 72;; r').
73;; 73;;
74;; You can also search within the document. The command `doc-view-search' 74;; You can also search within the document. The command `doc-view-search'
@@ -155,9 +155,19 @@
155(defcustom doc-view-ghostscript-program 155(defcustom doc-view-ghostscript-program
156 (cond 156 (cond
157 ((memq system-type '(windows-nt ms-dos)) 157 ((memq system-type '(windows-nt ms-dos))
158 "gswin32c") 158 (cond
159 (t 159 ;; Windows Ghostscript
160 "gs")) 160 ((executable-find "gswin64c") "gswin64c")
161 ((executable-find "gswin32c") "gswin32c")
162 ;; The GS wrapper coming with TeX Live
163 ((executable-find "rungs") "rungs")
164 ;; The MikTeX builtin GS Check if mgs is functional for external
165 ;; non-MikTeX apps. Was available under:
166 ;; http://blog.miktex.org/post/2005/04/07/Starting-mgsexe-at-the-DOS-Prompt.aspx
167 ((and (executable-find "mgs")
168 (= 0 (shell-command "mgs -q -dNODISPLAY -c quit")))
169 "mgs")))
170 (t "gs"))
161 "Program to convert PS and PDF files to PNG." 171 "Program to convert PS and PDF files to PNG."
162 :type 'file 172 :type 'file
163 :version "27.1") 173 :version "27.1")
@@ -421,10 +431,10 @@ Typically \"page-%s.png\".")
421 ;; Killing the buffer (and the process) 431 ;; Killing the buffer (and the process)
422 (define-key map (kbd "K") 'doc-view-kill-proc) 432 (define-key map (kbd "K") 'doc-view-kill-proc)
423 ;; Slicing the image 433 ;; Slicing the image
424 (define-key map (kbd "s s") 'doc-view-set-slice) 434 (define-key map (kbd "c s") 'doc-view-set-slice)
425 (define-key map (kbd "s m") 'doc-view-set-slice-using-mouse) 435 (define-key map (kbd "c m") 'doc-view-set-slice-using-mouse)
426 (define-key map (kbd "s b") 'doc-view-set-slice-from-bounding-box) 436 (define-key map (kbd "c b") 'doc-view-set-slice-from-bounding-box)
427 (define-key map (kbd "s r") 'doc-view-reset-slice) 437 (define-key map (kbd "c r") 'doc-view-reset-slice)
428 ;; Searching 438 ;; Searching
429 (define-key map (kbd "C-s") 'doc-view-search) 439 (define-key map (kbd "C-s") 'doc-view-search)
430 (define-key map (kbd "<find>") 'doc-view-search) 440 (define-key map (kbd "<find>") 'doc-view-search)
diff --git a/lisp/emacs-lisp/trace.el b/lisp/emacs-lisp/trace.el
index 5c35036a50d..4ebb7ff711d 100644
--- a/lisp/emacs-lisp/trace.el
+++ b/lisp/emacs-lisp/trace.el
@@ -292,7 +292,9 @@ If `current-prefix-arg' is non-nil, also read a buffer and a \"context\"
292(defun trace-function-foreground (function &optional buffer context) 292(defun trace-function-foreground (function &optional buffer context)
293 "Trace calls to function FUNCTION. 293 "Trace calls to function FUNCTION.
294With a prefix argument, also prompt for the trace buffer (default 294With a prefix argument, also prompt for the trace buffer (default
295`trace-buffer'), and a Lisp expression CONTEXT. 295`trace-buffer'), and a Lisp expression CONTEXT. When called from
296Lisp, CONTEXT should be a function of no arguments which returns
297a value to insert into BUFFER during the trace.
296 298
297Tracing a function causes every call to that function to insert 299Tracing a function causes every call to that function to insert
298into BUFFER Lisp-style trace messages that display the function's 300into BUFFER Lisp-style trace messages that display the function's
diff --git a/lisp/gnus/mml.el b/lisp/gnus/mml.el
index 2006837d6a7..21491499eb8 100644
--- a/lisp/gnus/mml.el
+++ b/lisp/gnus/mml.el
@@ -281,7 +281,7 @@ part. This is for the internal use, you should never modify the value.")
281 (setq tag (mml-read-tag) 281 (setq tag (mml-read-tag)
282 no-markup-p nil 282 no-markup-p nil
283 warn nil) 283 warn nil)
284 (setq tag (list 'part '(type . "text/plain")) 284 (setq tag (list 'part (cons 'type "text/plain"))
285 no-markup-p t 285 no-markup-p t
286 warn t)) 286 warn t))
287 (setq raw (cdr (assq 'raw tag)) 287 (setq raw (cdr (assq 'raw tag))
diff --git a/lisp/image-mode.el b/lisp/image-mode.el
index fbce1193cd0..3ee185a0dc5 100644
--- a/lisp/image-mode.el
+++ b/lisp/image-mode.el
@@ -53,11 +53,37 @@ See `image-mode-winprops'.")
53 "Special hook run when image data is requested in a new window. 53 "Special hook run when image data is requested in a new window.
54It is called with one argument, the initial WINPROPS.") 54It is called with one argument, the initial WINPROPS.")
55 55
56;; FIXME this doesn't seem mature yet. Document in manual when it is. 56(defcustom image-auto-resize t
57 "Non-nil to resize the image upon first display.
58Its value should be one of the following:
59 - nil, meaning no resizing.
60 - t, meaning to fit the image to the window height and width.
61 - `fit-height', meaning to fit the image to the window height.
62 - `fit-width', meaning to fit the image to the window width.
63 - A number, which is a scale factor (the default size is 1)."
64 :type '(choice (const :tag "No resizing" nil)
65 (other :tag "Fit height and width" t)
66 (const :tag "Fit height" fit-height)
67 (const :tag "Fit width" fit-width)
68 (number :tag "Scale factor" 1))
69 :version "27.1"
70 :group 'image)
71
72(defcustom image-auto-resize-on-window-resize 1
73 "Non-nil to resize the image whenever the window's dimensions change.
74This will always keep the image fit to the window.
75When non-nil, the value should be a number of seconds to wait before
76resizing according to the value specified in `image-auto-resize'."
77 :type '(choice (const :tag "No auto-resize on window size change" nil)
78 (integer :tag "Wait for number of seconds before resize" 1))
79 :version "27.1"
80 :group 'image)
81
57(defvar-local image-transform-resize nil 82(defvar-local image-transform-resize nil
58 "The image resize operation. 83 "The image resize operation.
59Its value should be one of the following: 84Its value should be one of the following:
60 - nil, meaning no resizing. 85 - nil, meaning no resizing.
86 - t, meaning to fit the image to the window height and width.
61 - `fit-height', meaning to fit the image to the window height. 87 - `fit-height', meaning to fit the image to the window height.
62 - `fit-width', meaning to fit the image to the window width. 88 - `fit-width', meaning to fit the image to the window width.
63 - A number, which is a scale factor (the default size is 1).") 89 - A number, which is a scale factor (the default size is 1).")
@@ -427,9 +453,10 @@ call."
427 (define-key map "sf" 'image-mode-fit-frame) 453 (define-key map "sf" 'image-mode-fit-frame)
428 (define-key map "sh" 'image-transform-fit-to-height) 454 (define-key map "sh" 'image-transform-fit-to-height)
429 (define-key map "sw" 'image-transform-fit-to-width) 455 (define-key map "sw" 'image-transform-fit-to-width)
456 (define-key map "sb" 'image-transform-fit-both)
457 (define-key map "ss" 'image-transform-set-scale)
430 (define-key map "sr" 'image-transform-set-rotation) 458 (define-key map "sr" 'image-transform-set-rotation)
431 (define-key map "s0" 'image-transform-reset) 459 (define-key map "s0" 'image-transform-reset)
432 (define-key map "ss" 'image-transform-set-scale)
433 460
434 ;; Multi-frame keys 461 ;; Multi-frame keys
435 (define-key map (kbd "RET") 'image-toggle-animation) 462 (define-key map (kbd "RET") 'image-toggle-animation)
@@ -482,6 +509,10 @@ call."
482 :help "Resize image to match the window height"] 509 :help "Resize image to match the window height"]
483 ["Fit to Window Width" image-transform-fit-to-width 510 ["Fit to Window Width" image-transform-fit-to-width
484 :help "Resize image to match the window width"] 511 :help "Resize image to match the window width"]
512 ["Fit to Window Height and Width" image-transform-fit-both
513 :help "Resize image to match the window height and width"]
514 ["Set Scale..." image-transform-set-scale
515 :help "Resize image by specified scale factor"]
485 ["Rotate Image..." image-transform-set-rotation 516 ["Rotate Image..." image-transform-set-rotation
486 :help "Rotate the image"] 517 :help "Rotate the image"]
487 ["Reset Transformations" image-transform-reset 518 ["Reset Transformations" image-transform-reset
@@ -569,6 +600,7 @@ Key bindings:
569 600
570 (major-mode-suspend) 601 (major-mode-suspend)
571 (setq major-mode 'image-mode) 602 (setq major-mode 'image-mode)
603 (setq image-transform-resize image-auto-resize)
572 604
573 (if (not (image-get-display-property)) 605 (if (not (image-get-display-property))
574 (progn 606 (progn
@@ -611,7 +643,8 @@ Key bindings:
611 643
612 (add-hook 'change-major-mode-hook #'image-toggle-display-text nil t) 644 (add-hook 'change-major-mode-hook #'image-toggle-display-text nil t)
613 (add-hook 'after-revert-hook #'image-after-revert-hook nil t) 645 (add-hook 'after-revert-hook #'image-after-revert-hook nil t)
614 (add-hook 'window-state-change-functions #'image--window-state-change nil t) 646 (when image-auto-resize-on-window-resize
647 (add-hook 'window-state-change-functions #'image--window-state-change nil t))
615 648
616 (run-mode-hooks 'image-mode-hook) 649 (run-mode-hooks 'image-mode-hook)
617 (let ((image (image-get-display-property)) 650 (let ((image (image-get-display-property))
@@ -768,7 +801,7 @@ was inserted."
768 filename)) 801 filename))
769 ;; If we have a `fit-width' or a `fit-height', don't limit 802 ;; If we have a `fit-width' or a `fit-height', don't limit
770 ;; the size of the image to the window size. 803 ;; the size of the image to the window size.
771 (edges (and (null image-transform-resize) 804 (edges (and (eq image-transform-resize t)
772 (window-inside-pixel-edges (get-buffer-window)))) 805 (window-inside-pixel-edges (get-buffer-window))))
773 (type (if (image--imagemagick-wanted-p filename) 806 (type (if (image--imagemagick-wanted-p filename)
774 'imagemagick 807 'imagemagick
@@ -878,7 +911,9 @@ Otherwise, display the image by calling `image-mode'."
878 ;; image resizing happens later during redisplay. So if those 911 ;; image resizing happens later during redisplay. So if those
879 ;; consecutive calls happen without any redisplay between them, 912 ;; consecutive calls happen without any redisplay between them,
880 ;; the costly operation of image resizing should happen only once. 913 ;; the costly operation of image resizing should happen only once.
881 (run-with-idle-timer 1 nil #'image-fit-to-window window)) 914 (when (numberp image-auto-resize-on-window-resize)
915 (run-with-idle-timer image-auto-resize-on-window-resize nil
916 #'image-fit-to-window window)))
882 917
883(defun image-fit-to-window (window) 918(defun image-fit-to-window (window)
884 "Adjust size of image to display it exactly in WINDOW boundaries." 919 "Adjust size of image to display it exactly in WINDOW boundaries."
@@ -1282,7 +1317,7 @@ These properties are determined by the Image mode variables
1282`image-transform-resize' and `image-transform-rotation'. The 1317`image-transform-resize' and `image-transform-rotation'. The
1283return value is suitable for appending to an image spec." 1318return value is suitable for appending to an image spec."
1284 (setq image-transform-scale 1.0) 1319 (setq image-transform-scale 1.0)
1285 (when (or image-transform-resize 1320 (when (or (not (memq image-transform-resize '(nil t)))
1286 (/= image-transform-rotation 0.0)) 1321 (/= image-transform-rotation 0.0))
1287 ;; Note: `image-size' looks up and thus caches the untransformed 1322 ;; Note: `image-size' looks up and thus caches the untransformed
1288 ;; image. There's no easy way to prevent that. 1323 ;; image. There's no easy way to prevent that.
@@ -1328,6 +1363,12 @@ return value is suitable for appending to an image spec."
1328 (setq image-transform-resize 'fit-width) 1363 (setq image-transform-resize 'fit-width)
1329 (image-toggle-display-image)) 1364 (image-toggle-display-image))
1330 1365
1366(defun image-transform-fit-both ()
1367 "Fit the current image both to the height and width of the current window."
1368 (interactive)
1369 (setq image-transform-resize t)
1370 (image-toggle-display-image))
1371
1331(defun image-transform-set-rotation (rotation) 1372(defun image-transform-set-rotation (rotation)
1332 "Prompt for an angle ROTATION, and rotate the image by that amount. 1373 "Prompt for an angle ROTATION, and rotate the image by that amount.
1333ROTATION should be in degrees." 1374ROTATION should be in degrees."
@@ -1338,7 +1379,7 @@ ROTATION should be in degrees."
1338(defun image-transform-reset () 1379(defun image-transform-reset ()
1339 "Display the current image with the default size and rotation." 1380 "Display the current image with the default size and rotation."
1340 (interactive) 1381 (interactive)
1341 (setq image-transform-resize nil 1382 (setq image-transform-resize image-auto-resize
1342 image-transform-rotation 0.0 1383 image-transform-rotation 0.0
1343 image-transform-scale 1) 1384 image-transform-scale 1)
1344 (image-toggle-display-image)) 1385 (image-toggle-display-image))
diff --git a/lisp/simple.el b/lisp/simple.el
index 8bc84a9dfa0..b5ba05426f5 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -4846,7 +4846,7 @@ In Transient Mark mode, deactivate the mark.
4846If `interprogram-cut-function' is non-nil, also save the text for a window 4846If `interprogram-cut-function' is non-nil, also save the text for a window
4847system cut and paste. 4847system cut and paste.
4848 4848
4849If you want to append the killed line to the last killed text, 4849If you want to append the killed region to the last killed text,
4850use \\[append-next-kill] before \\[kill-ring-save]. 4850use \\[append-next-kill] before \\[kill-ring-save].
4851 4851
4852The copied text is filtered by `filter-buffer-substring' before it is 4852The copied text is filtered by `filter-buffer-substring' before it is
diff --git a/src/xdisp.c b/src/xdisp.c
index 32588939564..140d134572f 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -30,8 +30,9 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
30 Updating the display is triggered by the Lisp interpreter when it 30 Updating the display is triggered by the Lisp interpreter when it
31 decides it's time to do it. This is done either automatically for 31 decides it's time to do it. This is done either automatically for
32 you as part of the interpreter's command loop or as the result of 32 you as part of the interpreter's command loop or as the result of
33 calling Lisp functions like `sit-for'. The C function `redisplay' 33 calling Lisp functions like `sit-for'. The C function
34 in xdisp.c is the only entry into the inner redisplay code. 34 `redisplay_internal' in xdisp.c is the only entry into the inner
35 redisplay code.
35 36
36 The following diagram shows how redisplay code is invoked. As you 37 The following diagram shows how redisplay code is invoked. As you
37 can see, Lisp calls redisplay and vice versa. 38 can see, Lisp calls redisplay and vice versa.
@@ -89,7 +90,15 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
89 second glyph matrix is constructed, the so called `desired glyph 90 second glyph matrix is constructed, the so called `desired glyph
90 matrix' or short `desired matrix'. Current and desired matrix are 91 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 then compared to find a cheap way to update the display, e.g. by
92 reusing part of the display by scrolling lines. 93 reusing part of the display by scrolling lines. The actual update
94 of the display of each window by comparing the desired and the
95 current matrix is done by `update_window', which calls functions
96 which draw to the glass (those functions are specific to the type
97 of the window's frame: X, w32, NS, etc.).
98
99 Once the display of a window on the glass has been updated, its
100 desired matrix is used to update the corresponding rows of the
101 current matrix, and then the desired matrix is discarded.
93 102
94 You will find a lot of redisplay optimizations when you start 103 You will find a lot of redisplay optimizations when you start
95 looking at the innards of redisplay. The overall goal of all these 104 looking at the innards of redisplay. The overall goal of all these
@@ -119,13 +128,13 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
119 128
120 . try_window 129 . try_window
121 130
122 This function performs the full redisplay of a single window 131 This function performs the full, unoptimized, redisplay of a
123 assuming that its fonts were not changed and that the cursor 132 single window assuming that its fonts were not changed and that
124 will not end up in the scroll margins. (Loading fonts requires 133 the cursor will not end up in the scroll margins. (Loading
125 re-adjustment of dimensions of glyph matrices, which makes this 134 fonts requires re-adjustment of dimensions of glyph matrices,
126 method impossible to use.) 135 which makes this method impossible to use.)
127 136
128 These optimizations are tried in sequence (some can be skipped if 137 The optimizations are tried in sequence (some can be skipped if
129 it is known that they are not applicable). If none of the 138 it is known that they are not applicable). If none of the
130 optimizations were successful, redisplay calls redisplay_windows, 139 optimizations were successful, redisplay calls redisplay_windows,
131 which performs a full redisplay of all windows. 140 which performs a full redisplay of all windows.
@@ -145,38 +154,62 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
145 154
146 Desired matrices. 155 Desired matrices.
147 156
148 Desired matrices are always built per Emacs window. The function 157 Desired matrices are always built per Emacs window. It is
149 `display_line' is the central function to look at if you are 158 important to know that a desired matrix is in general "sparse": it
150 interested. It constructs one row in a desired matrix given an 159 only has some of the glyph rows "enabled". This is because
160 redisplay tries to optimize its work, and thus only generates
161 glyphs for rows that need to be updated on the screen. Rows that
162 don't need to be updated are left "disabled", and their contents
163 should be ignored.
164
165 The function `display_line' is the central function to look at if
166 you are interested in how the rows of the desired matrix are
167 produced. It constructs one row in a desired matrix given an
151 iterator structure containing both a buffer position and a 168 iterator structure containing both a buffer position and a
152 description of the environment in which the text is to be 169 description of the environment in which the text is to be
153 displayed. But this is too early, read on. 170 displayed. But this is too early, read on.
154 171
172 Glyph rows.
173
174 A glyph row is an array of `struct glyph', where each glyph element
175 describes a "display element" to be shown on the screen. More
176 accurately, a glyph row can have up to 3 different arrays of
177 glyphs: one each for every display margins, and one for the "text
178 area", where buffer text is displayed. The text-area glyph array
179 is always present, whereas the arrays for the marginal areas are
180 present (non-empty) only if the corresponding display margin is
181 shown in the window. If the glyph array for a marginal area is not
182 present its beginning and end coincide, i.e. such arrays are
183 actually empty (they contain no glyphs). Frame glyph matrics, used
184 on text-mode terminals (see below) never have marginal areas, they
185 treat the entire frame-wide row of glyphs as a single large "text
186 area".
187
155 Iteration over buffer and strings. 188 Iteration over buffer and strings.
156 189
157 Characters and pixmaps displayed for a range of buffer text depend 190 Characters and pixmaps displayed for a range of buffer text depend
158 on various settings of buffers and windows, on overlays and text 191 on various settings of buffers and windows, on overlays and text
159 properties, on display tables, on selective display. The good news 192 properties, on display tables, on selective display. The good news
160 is that all this hairy stuff is hidden behind a small set of 193 is that all this hairy stuff is hidden behind a small set of
161 interface functions taking an iterator structure (struct it) 194 interface functions taking an iterator structure (`struct it')
162 argument. 195 argument.
163 196
164 Iteration over things to be displayed is then simple. It is 197 Iteration over things to be displayed is then simple. It is
165 started by initializing an iterator with a call to init_iterator, 198 started by initializing an iterator with a call to `init_iterator',
166 passing it the buffer position where to start iteration. For 199 passing it the buffer position where to start iteration. For
167 iteration over strings, pass -1 as the position to init_iterator, 200 iteration over strings, pass -1 as the position to `init_iterator',
168 and call reseat_to_string when the string is ready, to initialize 201 and call `reseat_to_string' when the string is ready, to initialize
169 the iterator for that string. Thereafter, calls to 202 the iterator for that string. Thereafter, calls to
170 get_next_display_element fill the iterator structure with relevant 203 `get_next_display_element' fill the iterator structure with
171 information about the next thing to display. Calls to 204 relevant information about the next thing to display. Calls to
172 set_iterator_to_next move the iterator to the next thing. 205 `set_iterator_to_next' move the iterator to the next thing.
173 206
174 Besides this, an iterator also contains information about the 207 Besides this, an iterator also contains information about the
175 display environment in which glyphs for display elements are to be 208 display environment in which glyphs for display elements are to be
176 produced. It has fields for the width and height of the display, 209 produced. It has fields for the width and height of the display,
177 the information whether long lines are truncated or continued, a 210 the information whether long lines are truncated or continued, a
178 current X and Y position, and lots of other stuff you can better 211 current X and Y position, the face currently in effect, and lots of
179 see in dispextern.h. 212 other stuff you can better see in dispextern.h.
180 213
181 The "stop position". 214 The "stop position".
182 215
@@ -184,57 +217,62 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
184 infrequently. These include the face of the characters, whether 217 infrequently. These include the face of the characters, whether
185 text is invisible, the object (buffer or display or overlay string) 218 text is invisible, the object (buffer or display or overlay string)
186 being iterated, character composition info, etc. For any given 219 being iterated, character composition info, etc. For any given
187 buffer or string position, the sources of information that 220 buffer or string position, the sources of information that affects
188 affects the display can be determined by calling the appropriate 221 the display can be determined by calling the appropriate
189 primitives, such as Fnext_single_property_change, but both these 222 primitives, such as `Fnext_single_property_change', but both these
190 calls and the processing of their return values is relatively 223 calls and the processing of their return values is relatively
191 expensive. To optimize redisplay, the display engine checks these 224 expensive. To optimize redisplay, the display engine checks these
192 sources of display information only when needed. To that end, it 225 sources of display information only when needed, not for every
193 always maintains the position of the next place where it must stop 226 character. To that end, it always maintains the position of the
194 and re-examine all those potential sources. This is called "stop 227 next place where it must stop and re-examine all those potential
195 position" and is stored in the stop_charpos field of the iterator. 228 sources. This is called "the stop position" and is stored in the
196 The stop position is updated by compute_stop_pos, which is called 229 `stop_charpos' field of the iterator. The stop position is updated
197 whenever the iteration reaches the current stop position and 230 by `compute_stop_pos', which is called whenever the iteration
198 processes it. Processing a stop position is done by handle_stop, 231 reaches the current stop position and processes it. Processing a
199 which invokes a series of handlers, one each for every potential 232 stop position is done by `handle_stop', which invokes a series of
200 source of display-related information; see the it_props array for 233 handlers, one each for every potential source of display-related
201 those handlers. For example, one handler is handle_face_prop, 234 information; see the `it_props' array for those handlers. For
202 which detects changes in face properties, and supplies the face ID 235 example, one handler is `handle_face_prop', which detects changes
203 that the iterator will use for all the glyphs it generates up to 236 in face properties, and supplies the face ID that the iterator will
204 the next stop position; this face ID is the result of realizing the 237 use for all the glyphs it generates up to the next stop position;
205 face specified by the relevant text properties at this position. 238 this face ID is the result of "realizing" the face specified by the
206 Each handler called by handle_stop processes the sources of display 239 relevant text properties at this position (see xfaces.c). Each
240 handler called by `handle_stop' processes the sources of display
207 information for which it is "responsible", and returns a value 241 information for which it is "responsible", and returns a value
208 which tells handle_stop what to do next. 242 which tells `handle_stop' what to do next.
243
244 Once `handle_stop' returns, the information it stores in the
245 iterator fields will not be refreshed until the iteration reaches
246 the next stop position, which is computed by `compute_stop_pos'
247 called at the end of `handle_stop'. `compute_stop_pos' examines
248 the buffer's or string's interval tree to determine where the text
249 properties change, finds the next position where overlays and
250 character composition can change, and stores in `stop_charpos' the
251 closest position where any of these factors should be reconsidered.
209 252
210 Once handle_stop returns, the information it stores in the iterator 253 Handling of the stop position is done as part of the code in
211 fields will not be refreshed until the iteration reaches the next 254 `get_next_display_element'.
212 stop position, which is computed by compute_stop_pos called at the
213 end of handle_stop. compute_stop_pos examines the buffer's or
214 string's interval tree to determine where the text properties
215 change, finds the next position where overlays and character
216 composition can change, and stores in stop_charpos the closest
217 position where any of these factors should be reconsidered.
218 255
219 Producing glyphs. 256 Producing glyphs.
220 257
221 Glyphs in a desired matrix are normally constructed in a loop 258 Glyphs in a desired matrix are normally constructed in a loop
222 calling get_next_display_element and then PRODUCE_GLYPHS. The call 259 calling `get_next_display_element' and then `PRODUCE_GLYPHS'. The
223 to PRODUCE_GLYPHS will fill the iterator structure with pixel 260 call to `PRODUCE_GLYPHS' will fill the iterator structure with
224 information about the element being displayed and at the same time 261 pixel information about the element being displayed and at the same
225 produce glyphs for it. If the display element fits on the line 262 time will produce glyphs for it. If the display element fits on
226 being displayed, set_iterator_to_next is called next, otherwise the 263 the line being displayed, `set_iterator_to_next' is called next,
227 glyphs produced are discarded. The function display_line is the 264 otherwise the glyphs produced are discarded, and `display_line'
228 workhorse of filling glyph rows in the desired matrix with glyphs. 265 marks this glyph row as a "continued line". The function
229 In addition to producing glyphs, it also handles line truncation 266 `display_line' is the workhorse of filling glyph rows in the
230 and continuation, word wrap, and cursor positioning (for the 267 desired matrix with glyphs. In addition to producing glyphs, it
231 latter, see also set_cursor_from_row). 268 also handles line truncation and continuation, word wrap, and
269 cursor positioning (for the latter, see `set_cursor_from_row').
232 270
233 Frame matrices. 271 Frame matrices.
234 272
235 That just couldn't be all, could it? What about terminal types not 273 That just couldn't be all, could it? What about terminal types not
236 supporting operations on sub-windows of the screen (a.k.a. "TTY" or 274 supporting operations on sub-windows of the screen (a.k.a. "TTY" or
237 "text-mode terminal")? To update the display on such a terminal, 275 "text-mode terminals")? To update the display on such a terminal,
238 window-based glyph matrices are not well suited. To be able to 276 window-based glyph matrices are not well suited. To be able to
239 reuse part of the display (scrolling lines up and down), we must 277 reuse part of the display (scrolling lines up and down), we must
240 instead have a view of the whole screen. This is what `frame 278 instead have a view of the whole screen. This is what `frame
@@ -252,19 +290,62 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
252 using the frame matrices, which allows frame-global optimization of 290 using the frame matrices, which allows frame-global optimization of
253 what is actually written to the glass. 291 what is actually written to the glass.
254 292
255 To be honest, there is a little bit more done, but not much more. 293 Frame matrices don't have marginal areas, only a text area. That
256 If you plan to extend that code, take a look at dispnew.c. The 294 is, the entire row of glyphs that spans the width of a text-mode
257 function build_frame_matrix is a good starting point. 295 frame is treated as a single large "text area" for the purposes of
296 manipulating and updating a frame glyph matrix.
297
298 To be honest, there is a little bit more done for frame matrices,
299 but not much more. If you plan to extend that code, take a look at
300 dispnew.c. The function build_frame_matrix is a good starting
301 point.
302
303 Simulating display.
304
305 Some of Emacs commands and functions need to take display layout
306 into consideration. For example, C-n moves to the next screen
307 line, but to implement that, Emacs needs to find the buffer
308 position which is directly below the cursor position on display.
309 This is not trivial when buffer display includes variable-size
310 elements such as different fonts, tall images, etc.
311
312 To solve this problem, the display engine implements several
313 functions that can move through buffer text in the same manner as
314 `display_line' and `display_string' do, but without producing any
315 glyphs for the glyph matrices. The workhorse of this is
316 `move_it_in_display_line_to'. Its code and logic are very similar
317 to `display_line', but it differs in two important aspects: it
318 doesn't produce glyphs for any glyph matrix, and it returns a
319 status telling the caller how it ended the iteration: whether it
320 reached the required position, hit the end of line, arrived at the
321 window edge without exhausting the buffer's line, etc. Since the
322 glyphs are not produced, the layout information available to the
323 callers of this function is what is recorded in `struct it' by the
324 iteration process.
325
326 Several higher-level functions call `move_it_in_display_line_to' to
327 perform more complex tasks: `move_it_by_lines' can move N lines up
328 or down from a given buffer position and `move_it_to' can move to a
329 given buffer position or to a given X or Y pixel coordinate.
330
331 These functions are called by the display engine itself as well,
332 when it needs to make layout decisions before producing the glyphs.
333 For example, one of the first things to decide when redisplaying a
334 window is where to put the `window-start' position; if the window
335 is to be recentered (the default), Emacs makes that decision by
336 starting from the position of point, then moving up the number of
337 lines corresponding to half the window height using
338 `move_it_by_lines'.
258 339
259 Bidirectional display. 340 Bidirectional display.
260 341
261 Bidirectional display adds quite some hair to this already complex 342 Bidirectional display adds quite some hair to this already complex
262 design. The good news are that a large portion of that hairy stuff 343 design. The good news are that a large portion of that hairy stuff
263 is hidden in bidi.c behind only 3 interfaces. bidi.c implements a 344 is hidden in bidi.c behind only 3 interfaces. bidi.c implements a
264 reordering engine which is called by set_iterator_to_next and 345 reordering engine which is called by `set_iterator_to_next' and
265 returns the next character to display in the visual order. See 346 returns the next character to display in the visual order. See
266 commentary on bidi.c for more details. As far as redisplay is 347 commentary on bidi.c for more details. As far as redisplay is
267 concerned, the effect of calling bidi_move_to_visually_next, the 348 concerned, the effect of calling `bidi_move_to_visually_next', the
268 main interface of the reordering engine, is that the iterator gets 349 main interface of the reordering engine, is that the iterator gets
269 magically placed on the buffer or string position that is to be 350 magically placed on the buffer or string position that is to be
270 displayed next in the visual order. In other words, a linear 351 displayed next in the visual order. In other words, a linear
@@ -279,27 +360,27 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
279 monotonously changing with vertical positions. Also, accounting 360 monotonously changing with vertical positions. Also, accounting
280 for face changes, overlays, etc. becomes more complex because 361 for face changes, overlays, etc. becomes more complex because
281 non-linear iteration could potentially skip many positions with 362 non-linear iteration could potentially skip many positions with
282 changes, and then cross them again on the way back (see 363 such changes, and then cross them again on the way back (see
283 handle_stop_backwards)... 364 `handle_stop_backwards')...
284 365
285 One other prominent effect of bidirectional display is that some 366 One other prominent effect of bidirectional display is that some
286 paragraphs of text need to be displayed starting at the right 367 paragraphs of text need to be displayed starting at the right
287 margin of the window---the so-called right-to-left, or R2L 368 margin of the window---the so-called right-to-left, or R2L
288 paragraphs. R2L paragraphs are displayed with R2L glyph rows, 369 paragraphs. R2L paragraphs are displayed with R2L glyph rows,
289 which have their reversed_p flag set. The bidi reordering engine 370 which have their `reversed_p' flag set. The bidi reordering engine
290 produces characters in such rows starting from the character which 371 produces characters in such rows starting from the character which
291 should be the rightmost on display. PRODUCE_GLYPHS then reverses 372 should be the rightmost on display. `PRODUCE_GLYPHS' then reverses
292 the order, when it fills up the glyph row whose reversed_p flag is 373 the order, when it fills up the glyph row whose `reversed_p' flag
293 set, by prepending each new glyph to what is already there, instead 374 is set, by prepending each new glyph to what is already there,
294 of appending it. When the glyph row is complete, the function 375 instead of appending it. When the glyph row is complete, the
295 extend_face_to_end_of_line fills the empty space to the left of the 376 function `extend_face_to_end_of_line' fills the empty space to the
296 leftmost character with special glyphs, which will display as, 377 left of the leftmost character with special glyphs, which will
297 well, empty. On text terminals, these special glyphs are simply 378 display as, well, empty. On text terminals, these special glyphs
298 blank characters. On graphics terminals, there's a single stretch 379 are simply blank characters. On graphics terminals, there's a
299 glyph of a suitably computed width. Both the blanks and the 380 single stretch glyph of a suitably computed width. Both the blanks
300 stretch glyph are given the face of the background of the line. 381 and the stretch glyph are given the face of the background of the
301 This way, the terminal-specific back-end can still draw the glyphs 382 line. This way, the terminal-specific back-end can still draw the
302 left to right, even for R2L lines. 383 glyphs left to right, even for R2L lines.
303 384
304 Bidirectional display and character compositions. 385 Bidirectional display and character compositions.
305 386
@@ -310,23 +391,23 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
310 391
311 Emacs display supports this by providing "character compositions", 392 Emacs display supports this by providing "character compositions",
312 most of which is implemented in composite.c. During the buffer 393 most of which is implemented in composite.c. During the buffer
313 scan that delivers characters to PRODUCE_GLYPHS, if the next 394 scan that delivers characters to `PRODUCE_GLYPHS', if the next
314 character to be delivered is a composed character, the iteration 395 character to be delivered is a composed character, the iteration
315 calls composition_reseat_it and next_element_from_composition. If 396 calls `composition_reseat_it' and `next_element_from_composition'.
316 they succeed to compose the character with one or more of the 397 If they succeed to compose the character with one or more of the
317 following characters, the whole sequence of characters that were 398 following characters, the whole sequence of characters that were
318 composed is recorded in the `struct composition_it' object that is 399 composed is recorded in the `struct composition_it' object that is
319 part of the buffer iterator. The composed sequence could produce 400 part of the buffer iterator. The composed sequence could produce
320 one or more font glyphs (called "grapheme clusters") on the screen. 401 one or more font glyphs (called "grapheme clusters") on the screen.
321 Each of these grapheme clusters is then delivered to PRODUCE_GLYPHS 402 Each of these grapheme clusters is then delivered to
322 in the direction corresponding to the current bidi scan direction 403 `PRODUCE_GLYPHS' in the direction corresponding to the current bidi
323 (recorded in the scan_dir member of the `struct bidi_it' object 404 scan direction (recorded in the `scan_dir' member of the `struct
324 that is part of the iterator). In particular, if the bidi iterator 405 bidi_it' object that is part of the iterator). In particular, if
325 currently scans the buffer backwards, the grapheme clusters are 406 the bidi iterator currently scans the buffer backwards, the
326 delivered back to front. This reorders the grapheme clusters as 407 grapheme clusters are delivered back to front. This reorders the
327 appropriate for the current bidi context. Note that this means 408 grapheme clusters as appropriate for the current bidi context.
328 that the grapheme clusters are always stored in the LGSTRING object 409 Note that this means that the grapheme clusters are always stored
329 (see composite.c) in the logical order. 410 in the `LGSTRING' object (see composite.c) in the logical order.
330 411
331 Moving an iterator in bidirectional text 412 Moving an iterator in bidirectional text
332 without producing glyphs. 413 without producing glyphs.
@@ -337,18 +418,18 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
337 As far as the iterator is concerned, the geometry of such rows is 418 As far as the iterator is concerned, the geometry of such rows is
338 still left to right, i.e. the iterator "thinks" the first character 419 still left to right, i.e. the iterator "thinks" the first character
339 is at the leftmost pixel position. The iterator does not know that 420 is at the leftmost pixel position. The iterator does not know that
340 PRODUCE_GLYPHS reverses the order of the glyphs that the iterator 421 `PRODUCE_GLYPHS' reverses the order of the glyphs that the iterator
341 delivers. This is important when functions from the move_it_* 422 delivers. This is important when functions from the `move_it_*'
342 family are used to get to certain screen position or to match 423 family are used to get to certain screen position or to match
343 screen coordinates with buffer coordinates: these functions use the 424 screen coordinates with buffer coordinates: these functions use the
344 iterator geometry, which is left to right even in R2L paragraphs. 425 iterator geometry, which is left to right even in R2L paragraphs.
345 This works well with most callers of move_it_*, because they need 426 This works well with most callers of `move_it_*', because they need
346 to get to a specific column, and columns are still numbered in the 427 to get to a specific column, and columns are still numbered in the
347 reading order, i.e. the rightmost character in a R2L paragraph is 428 reading order, i.e. the rightmost character in a R2L paragraph is
348 still column zero. But some callers do not get well with this; a 429 still column zero. But some callers do not get well with this; a
349 notable example is mouse clicks that need to find the character 430 notable example is mouse clicks that need to find the character
350 that corresponds to certain pixel coordinates. See 431 that corresponds to certain pixel coordinates. See
351 buffer_posn_from_coords in dispnew.c for how this is handled. */ 432 `buffer_posn_from_coords' in dispnew.c for how this is handled. */
352 433
353#include <config.h> 434#include <config.h>
354#include <stdlib.h> 435#include <stdlib.h>