aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2023-04-15 12:43:37 -0400
committerEli Zaretskii2023-04-15 12:43:37 -0400
commit5fecdbcd81db3d4a06277400c458d8ca7dcf7462 (patch)
treee8a6e1cca4f6f7642a268575ecf5243347a87ee8
parent4c086bf2951596d04677c343eb49fb32a3831e18 (diff)
parent5ef7ff05736b9d1b4d806cfe04ec5d99c090e748 (diff)
downloademacs-5fecdbcd81db3d4a06277400c458d8ca7dcf7462.tar.gz
emacs-5fecdbcd81db3d4a06277400c458d8ca7dcf7462.zip
Merge from origin/emacs-29
5ef7ff05736 ; Start a new ChangeLog.4 file. 11126c6d30a Fix 'C-h k' for "Paste from Kill Menu" in context menus 74ddfe811f9 ; * doc/misc/calc.texi (Rewrites Tutorial): Fix a typo (b... 08cda286c3f Improve the documentation of the XDS support 14d1c00e806 Allow reindentation of images inserted by 'mm-inline-image' b63a9eda01c Fix "C-h k" and "C-h c" with Paste from Kill Menu b36c21e27dc Change cursor color on NS port when it matches the face b... 96714c106b7 Improve documentation of image-related commands 6a2863ca016 Fix handling of sliced images 5be79fd05a5 ; * etc/NEWS: Announce 'cyrillic-mongolian' IM. ca1a0fda98a ; Fix last change. ce63462dbda Add cyrillic-mongolian input method 58801792706 ; Minor addition to the Emacs FAQ 88847dee125 Jsonrpc: don't bind inhibit-read-only to t so early cb8c87a423a Allow active region when IM is used # Conflicts: # etc/NEWS
-rw-r--r--ChangeLog.438
-rw-r--r--doc/emacs/files.texi93
-rw-r--r--doc/lispref/display.texi30
-rw-r--r--doc/lispref/frames.texi88
-rw-r--r--doc/misc/calc.texi2
-rw-r--r--doc/misc/efaq.texi20
-rw-r--r--etc/NEWS.2937
-rw-r--r--lisp/gnus/mm-view.el2
-rw-r--r--lisp/image.el25
-rw-r--r--lisp/image/image-crop.el59
-rw-r--r--lisp/international/quail.el3
-rw-r--r--lisp/jsonrpc.el8
-rw-r--r--lisp/leim/quail/cyrillic.el119
-rw-r--r--lisp/mouse.el3
-rw-r--r--lisp/subr.el74
-rw-r--r--lisp/x-dnd.el120
-rw-r--r--src/macfont.m50
-rw-r--r--src/nsterm.m20
18 files changed, 594 insertions, 197 deletions
diff --git a/ChangeLog.4 b/ChangeLog.4
new file mode 100644
index 00000000000..0792df934ff
--- /dev/null
+++ b/ChangeLog.4
@@ -0,0 +1,38 @@
12022-04-04 Eli Zaretskii <eliz@gnu.org>
2
3 * Version 28.1 released.
4
52022-04-03 Eli Zaretskii <eliz@gnu.org>
6
7 Bump Emacs version to 28.1
8
9 * README:
10 * configure.ac:
11 * nt/README.W32:
12 * msdos/sed2v2.inp: Bump Emacs version to 28.1
13
14This file records repository revisions from
15commit f2ae39829812098d8269eafbc0fcb98959ee5bb7 (exclusive) to
16commit de7901abbc21114721057c907cc52455e228f826 (inclusive).
17See ChangeLog.3 for earlier changes.
18
19;; Local Variables:
20;; coding: utf-8
21;; End:
22
23 Copyright (C) 2022 Free Software Foundation, Inc.
24
25 This file is part of GNU Emacs.
26
27 GNU Emacs is free software: you can redistribute it and/or modify
28 it under the terms of the GNU General Public License as published by
29 the Free Software Foundation, either version 3 of the License, or
30 (at your option) any later version.
31
32 GNU Emacs is distributed in the hope that it will be useful,
33 but WITHOUT ANY WARRANTY; without even the implied warranty of
34 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
35 GNU General Public License for more details.
36
37 You should have received a copy of the GNU General Public License
38 along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
diff --git a/doc/emacs/files.texi b/doc/emacs/files.texi
index a9ae4696a06..74315a05bbd 100644
--- a/doc/emacs/files.texi
+++ b/doc/emacs/files.texi
@@ -2289,10 +2289,15 @@ behavior by using the options @code{image-auto-resize} and
2289@code{image-auto-resize-on-window-resize}. 2289@code{image-auto-resize-on-window-resize}.
2290 2290
2291@findex image-transform-fit-to-window 2291@findex image-transform-fit-to-window
2292@kindex s w (Image mode)
2292@findex image-transform-set-percent 2293@findex image-transform-set-percent
2294@kindex s p (Image mode)
2293@findex image-transform-set-scale 2295@findex image-transform-set-scale
2296@kindex s s (Image mode)
2294@findex image-transform-reset-to-initial 2297@findex image-transform-reset-to-initial
2298@kindex s 0 (Image mode)
2295@findex image-transform-reset-to-original 2299@findex image-transform-reset-to-original
2300@kindex s o (Image mode)
2296To resize the image manually you can use the command 2301To resize the image manually you can use the command
2297@code{image-transform-fit-to-window} bound to @kbd{s w} that fits the 2302@code{image-transform-fit-to-window} bound to @kbd{s w} that fits the
2298image to both the window height and width. To scale the image to a 2303image to both the window height and width. To scale the image to a
@@ -2353,6 +2358,94 @@ frames at once. You can go to a specific frame with @kbd{F}
2353(@code{image-reverse-speed}) reverses it. The command @kbd{a 0} 2358(@code{image-reverse-speed}) reverses it. The command @kbd{a 0}
2354(@code{image-reset-speed}) resets the speed to the original value. 2359(@code{image-reset-speed}) resets the speed to the original value.
2355 2360
2361In addition to the above key bindings, which are specific to Image
2362mode, images shown in any Emacs buffer have special key bindings when
2363point is at or inside the image:
2364
2365@table @kbd
2366@cindex resize images
2367@cindex image resize
2368@findex image-increase-size
2369@kindex i + (Image mode)
2370@item i +
2371Increase the image size (@code{image-increase-size}) by 20%. Prefix
2372numeric argument controls the increment; the value of @var{n} means to
2373multiply the size by the factor of @w{@code{1 + @var{n} / 10}}, so
2374@w{@kbd{C-u 5 i +}} means to increase the size by 50%.
2375
2376@findex image-decrease-size
2377@kindex i - (Image mode)
2378@item i -
2379Decrease the image size (@code{image-increase-size}) by 20%. Prefix
2380numeric argument controls the decrement; the value of @var{n} means to
2381multiply the size by the factor of @w{@code{1 - @var{n} / 10}}, so
2382@w{@kbd{C-u 3 i -}} means to decrease the size by 30%.
2383
2384@cindex rotating images
2385@cindex image rotation
2386@findex image-rotate
2387@kindex i r (Image mode)
2388@item i r
2389Rotate the image by 90 degrees clockwise (@code{image-rotate}).
2390With the prefix argument, rotate by 90 degrees counter-clockwise instead.
2391Note that this command is not available for sliced images.
2392
2393@findex image-flip-horizontally
2394@kindex i h (Image mode)
2395@item i h
2396Flip the image horizontally (@code{image-flip-horizontally}). This
2397presents the image as if reflected in a vertical mirror.
2398Note that this command is not available for sliced images.
2399
2400@findex image-flip-vertically
2401@kindex i v (Image mode)
2402@item i v
2403Flip the image vertically (@code{image-flip-vertically}). This
2404presents the image as if reflected in a horizontal mirror.
2405Note that this command is not available for sliced images.
2406
2407@findex image-save
2408@kindex i o (Image mode)
2409@item i o
2410Save the image to a file (@code{image-save}). This command prompts
2411you for the name of the file to save the image.
2412
2413@cindex cropping images
2414@vindex image-crop-crop-command
2415@findex image-crop
2416@kindex i c (Image mode)
2417@item i c
2418Crop the image (@code{image-crop}). This command is available only if
2419your system has an external program installed that can be used for
2420cropping and cutting of images; the user option
2421@code{image-crop-crop-command} determines what program to use, and
2422defaults to the ImageMagick's @command{convert} program. The command
2423displays the image with a rectangular frame superimposed on it, and
2424lets you use the mouse to move and resize the frame. Type @kbd{m} to
2425cause mouse movements to move the frame instead of resizing it; type
2426@kbd{s} to move a square frame instead. When you are satisfied with
2427the position and size of the cropping frame, type @kbd{@key{RET}} to
2428actually crop the part under the frame; or type @kbd{q} to exit
2429without cropping. You can then save the cropped image using @w{@kbd{i
2430o}} or @w{@kbd{M-x image-save}}.
2431
2432@findex image-cut
2433@kindex i x (Image mode)
2434@vindex image-cut-color
2435@vindex image-crop-cut-command
2436@item i x
2437Cut a rectangle from the image (@code{image-cut}). This works the
2438same as @code{image-crop} (and also requires an external program,
2439defined by the variable @code{image-crop-cut-command}, to perform the
2440image cut), but instead of cropping the image, it removes the part
2441inside the frame and fills that part with the color specified by
2442@code{image-cut-color}. With prefix argument, the command prompts for
2443the color to use.
2444@end table
2445
2446The size and rotation commands are ``repeating'', which means that you
2447can continue adjusting the image without using the @kbd{i} prefix.
2448
2356@cindex ImageMagick support 2449@cindex ImageMagick support
2357@vindex imagemagick-enabled-types 2450@vindex imagemagick-enabled-types
2358@vindex imagemagick-types-inhibit 2451@vindex imagemagick-types-inhibit
diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi
index 85fac4b30a6..8184021d998 100644
--- a/doc/lispref/display.texi
+++ b/doc/lispref/display.texi
@@ -6876,7 +6876,7 @@ This function puts image @var{image} in front of @var{pos} in the
6876current buffer. The argument @var{pos} should be an integer or a 6876current buffer. The argument @var{pos} should be an integer or a
6877marker. It specifies the buffer position where the image should appear. 6877marker. It specifies the buffer position where the image should appear.
6878The argument @var{string} specifies the text that should hold the image 6878The argument @var{string} specifies the text that should hold the image
6879as an alternative to the default. 6879as an alternative to the default @samp{x}.
6880 6880
6881The argument @var{image} must be an image descriptor, perhaps returned 6881The argument @var{image} must be an image descriptor, perhaps returned
6882by @code{create-image} or stored by @code{defimage}. 6882by @code{create-image} or stored by @code{defimage}.
@@ -6889,7 +6889,7 @@ buffer's text.
6889 6889
6890Internally, this function creates an overlay, and gives it a 6890Internally, this function creates an overlay, and gives it a
6891@code{before-string} property containing text that has a @code{display} 6891@code{before-string} property containing text that has a @code{display}
6892property whose value is the image. (Whew!) 6892property whose value is the image. (Whew! that was a mouthful@dots{})
6893@end defun 6893@end defun
6894 6894
6895@defun remove-images start end &optional buffer 6895@defun remove-images start end &optional buffer
@@ -6936,41 +6936,47 @@ This function returns @code{t} if point is on an image, and @code{nil}
6936otherwise. 6936otherwise.
6937@end defun 6937@end defun
6938 6938
6939@cindex operations on images
6939Images inserted with the insertion functions above also get a local 6940Images inserted with the insertion functions above also get a local
6940keymap installed in the text properties (or overlays) that span the 6941keymap installed in the text properties (or overlays) that span the
6941displayed image. This keymap defines the following commands: 6942displayed image. This keymap defines the following commands:
6942 6943
6943@table @kbd 6944@table @kbd
6945@findex image-increase-size
6944@item i + 6946@item i +
6945Increase the image size (@code{image-increase-size}). A prefix value 6947Increase the image size (@code{image-increase-size})
6946of @samp{4} means to increase the size by 40%. The default is 20%.
6947 6948
6949@findex image-decrease-size
6948@item i - 6950@item i -
6949Decrease the image size (@code{image-increase-size}). A prefix value 6951Decrease the image size (@code{image-decrease-size}).
6950of @samp{4} means to decrease the size by 40%. The default is 20%.
6951 6952
6953@findex image-rotate
6952@item i r 6954@item i r
6953Rotate the image by 90 degrees clockwise (@code{image-rotate}). 6955Rotate the image (@code{image-rotate}).
6954A prefix means to rotate by 90 degrees counter-clockwise instead.
6955 6956
6957@findex image-flip-horizontally
6956@item i h 6958@item i h
6957Flip the image horizontally (@code{image-flip-horizontally}). 6959Flip the image horizontally (@code{image-flip-horizontally}).
6958 6960
6961@findex image-flip-vertically
6959@item i v 6962@item i v
6960Flip the image vertically (@code{image-flip-vertically}). 6963Flip the image vertically (@code{image-flip-vertically}).
6961 6964
6965@findex image-save
6962@item i o 6966@item i o
6963Save the image to a file (@code{image-save}). 6967Save the image to a file (@code{image-save}).
6964 6968
6969@findex image-crop
6965@item i c 6970@item i c
6966Crop the image interactively (@code{image-crop}). 6971Interactively crop the image (@code{image-crop}).
6967 6972
6973@findex image-cut
6968@item i x 6974@item i x
6969Cut a rectangle from the image interactively (@code{image-cut}). 6975Interactively cut a rectangle from the image (@code{image-cut}).
6970@end table 6976@end table
6971 6977
6972The size and rotation commands are ``repeating'', which means that you 6978@xref{Image Mode,,, emacs, The GNU Emacs Manual}, for more details
6973can continue adjusting the image without using the @kbd{i} prefix. 6979about these image-specific key bindings.
6974 6980
6975@node Multi-Frame Images 6981@node Multi-Frame Images
6976@subsection Multi-Frame Images 6982@subsection Multi-Frame Images
diff --git a/doc/lispref/frames.texi b/doc/lispref/frames.texi
index 7cae94d2627..c78ab1c34ba 100644
--- a/doc/lispref/frames.texi
+++ b/doc/lispref/frames.texi
@@ -4112,7 +4112,7 @@ has the same meaning as the @var{action} argument to
4112 Emacs implements receiving text and URLs individually for each 4112 Emacs implements receiving text and URLs individually for each
4113window system, and does not by default support receiving other kinds 4113window system, and does not by default support receiving other kinds
4114of data as drops. To support receiving other kinds of data, use the 4114of data as drops. To support receiving other kinds of data, use the
4115X-specific interface described below: 4115X-specific interface described below.
4116 4116
4117@vindex x-dnd-test-function 4117@vindex x-dnd-test-function
4118@vindex x-dnd-known-types 4118@vindex x-dnd-known-types
@@ -4141,29 +4141,71 @@ depending on the specific drag-and-drop protocol being used. For
4141example, the data type used for plain text may be either 4141example, the data type used for plain text may be either
4142@code{"STRING"} or @code{"text/plain"}. 4142@code{"STRING"} or @code{"text/plain"}.
4143 4143
4144@cindex XDS
4145@cindex direct save protocol
4144@vindex x-dnd-direct-save-function 4146@vindex x-dnd-direct-save-function
4145@c FIXME: This description is overly-complicated and confusing. In 4147 When Emacs runs on X window system, it supports the X Direct Save
4146@c particular, the two calls to the function basically sound 4148(@acronym{XDS}) protocol, which allows users to save a file by
4147@c identical, so it is unclear how should the function distinguish 4149dragging and dropping it onto an Emacs window, such as a Dired window.
4148@c between the first and the second one. The description of who asks 4150To comply with the unique requirements of @acronym{XDS}, these
4149@c whom to do what is also very hard to understand. Needs rewording, 4151drag-and-drop requests are processed specially: instead of being
4150@c and needs shorter sentences. Perhaps examples could help. 4152handled according to @code{x-dnd-types-alist}, they are handled by the
4151 However, @code{x-dnd-types-alist} does not handle a special kind of 4153@dfn{direct-save function} that is the value of the variable
4152drop sent by a program that wants Emacs to tell it where to save a 4154@code{x-dnd-direct-save-function}. The value should be a function of
4153file in a specific location determined by the user. These drops are 4155two arguments, @var{need-name} and @var{filename}. The @acronym{XDS}
4154instead handled by a function that is the value of the variable 4156protocol uses a two-step procedure for dragging files:
4155@code{x-dnd-direct-save-function}. This function should accept two arguments. 4157
4156If the first argument is non-@code{nil}, then the second argument is a 4158@enumerate 1
4157file name to save (with leading directories) that the other 4159@item
4158program recommends, and the 4160The application from which the file is dragged asks Emacs to provide
4159function should return the full file name under which it should be 4161the full file name under which to save the file. For this purpose,
4160saved. After the function completes, Emacs will ask the other program 4162the direct-save function is called with its first argument
4161to save the file under the name that was returned, and if the file was 4163@var{need-name} non-@code{nil}, and the second argument @var{filename}
4162successfully saved, call the function again with the first argument 4164set to the basename of the file to be saved. It should return the
4163set to a non-@code{nil} value and the second argument set to the file 4165fully-expanded absolute file name under which to save the file. For
4164name that was returned. The function should then perform whatever 4166example, if a file is dragged to a Dired window, the natural directory
4165action is appropriate (i.e., opening the file or refreshing a 4167for the file is the directory of the file shown at location of the
4166directory listing.) 4168drop. If saving the file is not possible for some reason, the
4169function should return @code{nil}, which will cancel the drag-and-drop
4170operation.
4171
4172@item
4173The application from which the file is dragged saves the file under
4174the name returned by the first call to the direct-save function. If
4175it succeeds in saving the file, the direct-save function is called
4176again, this time with the first argument @var{need-name} set to
4177@code{nil} and the second argument @var{filename} set to the full
4178absolute name of the saved file. The function is then expected to do
4179whatever is needed given the fact that file was saved. For example,
4180Dired should update the directory on display by showing the new file
4181there.
4182@end enumerate
4183
4184The default value of @code{x-dnd-direct-save-function} is
4185@code{x-dnd-save-direct}.
4186
4187@defun x-dnd-save-direct need-name filename
4188When called with the @var{need-name} argument non-@code{nil}, this
4189function prompts the user for the absolute file name under which it
4190should be saved. If the specified file already exists, it
4191additionally asks the user whether to overwrite it, and returns the
4192absolute file name only if the user confirms the overwriting.
4193
4194When called with the @var{need-name} argument @code{nil}, it reverts
4195the Dired listing if the current buffer is in Dired mode or one of its
4196descendants, and otherwise visits the file by calling @code{find-file}
4197(@pxref{Visiting Functions}).
4198@end defun
4199
4200@defun x-dnd-save-direct-immediately need-name filename
4201This function works like @code{x-dnd-save-direct}, but when called
4202with its @var{need-name} argument non-@code{nil}, it doesn't prompt
4203the user for the full name of the file to be saved; instead, it
4204returns its argument @var{filename} expanded against the current
4205buffer's default directory (@pxref{File Name Expansion}). (It still
4206asks for confirmation if a file by that name already exists in the
4207default directory.)
4208@end defun
4167 4209
4168@cindex initiating drag-and-drop 4210@cindex initiating drag-and-drop
4169 On capable window systems, Emacs also supports dragging contents 4211 On capable window systems, Emacs also supports dragging contents
diff --git a/doc/misc/calc.texi b/doc/misc/calc.texi
index 044c018080c..aacc0d0b0ec 100644
--- a/doc/misc/calc.texi
+++ b/doc/misc/calc.texi
@@ -5394,7 +5394,7 @@ a variable containing a vector of rules.
53941: [merge, secsqr] 1: [a/x + b/x := (a + b)/x, ... ] 53941: [merge, secsqr] 1: [a/x + b/x := (a + b)/x, ... ]
5395 . . 5395 . .
5396 5396
5397 ' [merge,sinsqr] @key{RET} = 5397 ' [merge,secsqr] @key{RET} =
5398 5398
5399@end group 5399@end group
5400@end smallexample 5400@end smallexample
diff --git a/doc/misc/efaq.texi b/doc/misc/efaq.texi
index 4a8c863230f..0a0c375d273 100644
--- a/doc/misc/efaq.texi
+++ b/doc/misc/efaq.texi
@@ -3133,13 +3133,23 @@ example, you can put the following in your init file:
3133 3133
3134To avoid the slightly distracting visual effect of Emacs starting with 3134To avoid the slightly distracting visual effect of Emacs starting with
3135its default frame size and then growing to fullscreen, you can add an 3135its default frame size and then growing to fullscreen, you can add an
3136@samp{Emacs.Geometry} entry to the Windows registry settings. 3136@samp{Emacs.Geometry} entry to the Windows Registry settings. @xref{X
3137@xref{X Resources,,, emacs, The GNU Emacs Manual}. 3137Resources,,, emacs, The GNU Emacs Manual}. To compute the correct
3138 3138values for width and height you use in the Registry settings, first
3139To compute the correct values for width and height, first maximize the 3139maximize the Emacs frame and then evaluate @code{(frame-height)} and
3140Emacs frame and then evaluate @code{(frame-height)} and
3141@code{(frame-width)} with @kbd{M-:}. 3140@code{(frame-width)} with @kbd{M-:}.
3142 3141
3142Alternatively, you can avoid the visual effect of Emacs changing its
3143frame size entirely in your init file (i.e., without using the
3144Registry), like this:
3145
3146@lisp
3147(setq frame-resize-pixelwise t)
3148(set-frame-position nil 0 0)
3149(set-frame-size nil (display-pixel-width) (display-pixel-height) t)
3150@end lisp
3151
3152
3143@node Emacs in a Linux console 3153@node Emacs in a Linux console
3144@section How can I alleviate the limitations of the Linux console? 3154@section How can I alleviate the limitations of the Linux console?
3145@cindex Console, Linux console, TTY, fbterm 3155@cindex Console, Linux console, TTY, fbterm
diff --git a/etc/NEWS.29 b/etc/NEWS.29
index dc4eb64a63a..84dbb94a71a 100644
--- a/etc/NEWS.29
+++ b/etc/NEWS.29
@@ -222,9 +222,9 @@ In previous Emacs versions, images have had the '+', '-' and 'r' keys
222bound when point is over an image. In Emacs 29.1, additional commands 222bound when point is over an image. In Emacs 29.1, additional commands
223were added, and this made it more likely that users would trigger the 223were added, and this made it more likely that users would trigger the
224image commands by mistake. To avoid this, all image commands have 224image commands by mistake. To avoid this, all image commands have
225moved to the 'i' keymap, so '+' is now 'i +', '-' is now 'i -', and 225moved to the 'i' prefix keymap, so '+' is now 'i +', '-' is now 'i -',
226'r' is now 'i r'. In addition, these commands are now repeating, so 226and 'r' is now 'i r'. In addition, these commands are now repeating,
227you can rotate an image twice by saying 'i r r', for instance. 227so, for example, you can rotate an image twice by typing 'i r r'.
228 228
229+++ 229+++
230** Emacs now picks the correct coding-system for X input methods. 230** Emacs now picks the correct coding-system for X input methods.
@@ -1577,6 +1577,11 @@ This input method is based on the russian-computer input method, and
1577is intended for typing in the Chuvash language written in the Cyrillic 1577is intended for typing in the Chuvash language written in the Cyrillic
1578script. 1578script.
1579 1579
1580---
1581*** New input method 'cyrillic-mongolian'.
1582This input method is for typing in the Mongolian language using the
1583Cyrillic script.
1584
1580 1585
1581* Changes in Specialized Modes and Packages in Emacs 29.1 1586* Changes in Specialized Modes and Packages in Emacs 29.1
1582 1587
@@ -2624,11 +2629,6 @@ image formats saying how to edit it as text. The default is to show
2624this message for SVG and XPM. 2629this message for SVG and XPM.
2625 2630
2626+++ 2631+++
2627*** New commands: 'image-flip-horizontally' and 'image-flip-vertically'.
2628These commands horizontally and vertically flip the image under point,
2629and are bound to 'i h' and 'i v', respectively.
2630
2631+++
2632*** New command 'image-transform-set-percent'. 2632*** New command 'image-transform-set-percent'.
2633It allows setting the image size to a percentage of its original size, 2633It allows setting the image size to a percentage of its original size,
2634and is bound to 's p' in Image mode. 2634and is bound to 's p' in Image mode.
@@ -2644,6 +2644,19 @@ The old name was confusing, and is now an obsolete function alias.
2644** Images 2644** Images
2645 2645
2646+++ 2646+++
2647** New commands 'image-crop' and 'image-cut'.
2648These commands allow interactively cropping/cutting the image at
2649point. The commands are bound to keys 'i c' and 'i x' (respectively)
2650in the local keymap over images. They rely on external programs, by
2651default "convert" from ImageMagick, to do the actual cropping/eliding
2652of the image file.
2653
2654+++
2655*** New commands: 'image-flip-horizontally' and 'image-flip-vertically'.
2656These commands horizontally and vertically flip the image under point,
2657and are bound to 'i h' and 'i v', respectively.
2658
2659+++
2647*** Users can now add special image conversion functions. 2660*** Users can now add special image conversion functions.
2648This is done via 'image-converter-add-handler'. 2661This is done via 'image-converter-add-handler'.
2649 2662
@@ -3238,14 +3251,6 @@ macro, which allows you to isolate package configuration in your init
3238file in a way that is declarative, tidy, and performance-oriented. 3251file in a way that is declarative, tidy, and performance-oriented.
3239See the new Info manual "(use-package) Top" for more. 3252See the new Info manual "(use-package) Top" for more.
3240 3253
3241+++
3242** New commands 'image-crop' and 'image-cut'.
3243These commands allow interactively cropping/cutting the image at
3244point. The commands are bound to keys 'i c' and 'i x' (respectively)
3245in the local keymap over images. They rely on external programs, by
3246default "convert" from ImageMagick, to do the actual cropping/eliding
3247of the image file.
3248
3249--- 3254---
3250** New package 'wallpaper'. 3255** New package 'wallpaper'.
3251This package provides the command 'wallpaper-set', which sets the 3256This package provides the command 'wallpaper-set', which sets the
diff --git a/lisp/gnus/mm-view.el b/lisp/gnus/mm-view.el
index 8dfb0deb418..2c407353559 100644
--- a/lisp/gnus/mm-view.el
+++ b/lisp/gnus/mm-view.el
@@ -98,7 +98,7 @@ This is only used if `mm-inline-large-images' is set to
98 (truncate (* mm-inline-large-images-proportion 98 (truncate (* mm-inline-large-images-proportion
99 (- (nth 3 edges) (nth 1 edges))))))) 99 (- (nth 3 edges) (nth 1 edges)))))))
100 image)) 100 image))
101 " ") 101 "x")
102 (insert "\n") 102 (insert "\n")
103 (mm-handle-set-undisplayer 103 (mm-handle-set-undisplayer
104 handle 104 handle
diff --git a/lisp/image.el b/lisp/image.el
index 838cc0f8942..a32ff1a35bb 100644
--- a/lisp/image.el
+++ b/lisp/image.el
@@ -172,22 +172,27 @@ or \"ffmpeg\") is installed."
172 172
173(define-error 'unknown-image-type "Unknown image type") 173(define-error 'unknown-image-type "Unknown image type")
174 174
175(defvar-keymap image-map 175(defvar-keymap image-slice-map
176 :doc "Map put into text properties on images." 176 :doc "Map put into text properties on sliced images."
177 "i" (define-keymap 177 "i" (define-keymap
178 "-" #'image-decrease-size 178 "-" #'image-decrease-size
179 "+" #'image-increase-size 179 "+" #'image-increase-size
180 "r" #'image-rotate
181 "o" #'image-save 180 "o" #'image-save
182 "c" #'image-crop 181 "c" #'image-crop
183 "x" #'image-cut 182 "x" #'image-cut)
184 "h" #'image-flip-horizontally
185 "v" #'image-flip-vertically)
186 "C-<wheel-down>" #'image-mouse-decrease-size 183 "C-<wheel-down>" #'image-mouse-decrease-size
187 "C-<mouse-5>" #'image-mouse-decrease-size 184 "C-<mouse-5>" #'image-mouse-decrease-size
188 "C-<wheel-up>" #'image-mouse-increase-size 185 "C-<wheel-up>" #'image-mouse-increase-size
189 "C-<mouse-4>" #'image-mouse-increase-size) 186 "C-<mouse-4>" #'image-mouse-increase-size)
190 187
188(defvar-keymap image-map
189 :doc "Map put into text properties on images."
190 :parent image-slice-map
191 "i" (define-keymap
192 "r" #'image-rotate
193 "h" #'image-flip-horizontally
194 "v" #'image-flip-vertically))
195
191(defun image-load-path-for-library (library image &optional path no-error) 196(defun image-load-path-for-library (library image &optional path no-error)
192 "Return a suitable search path for images used by LIBRARY. 197 "Return a suitable search path for images used by LIBRARY.
193 198
@@ -665,7 +670,9 @@ is non-nil, this is inhibited."
665 image) 670 image)
666 rear-nonsticky t 671 rear-nonsticky t
667 inhibit-isearch ,inhibit-isearch 672 inhibit-isearch ,inhibit-isearch
668 keymap ,image-map)))) 673 keymap ,(if slice
674 image-slice-map
675 image-map)))))
669 676
670 677
671;;;###autoload 678;;;###autoload
@@ -701,8 +708,8 @@ The image is automatically split into ROWS x COLS slices."
701 (insert string) 708 (insert string)
702 (add-text-properties start (point) 709 (add-text-properties start (point)
703 `(display ,(list (list 'slice x y dx dy) image) 710 `(display ,(list (list 'slice x y dx dy) image)
704 rear-nonsticky (display) 711 rear-nonsticky (display keymap)
705 keymap ,image-map)) 712 keymap ,image-slice-map))
706 (setq x (+ x dx)))) 713 (setq x (+ x dx))))
707 (setq x 0.0 714 (setq x 0.0
708 y (+ y dy)) 715 y (+ y dy))
diff --git a/lisp/image/image-crop.el b/lisp/image/image-crop.el
index be6e22bc606..9ef848c5bc8 100644
--- a/lisp/image/image-crop.el
+++ b/lisp/image/image-crop.el
@@ -35,6 +35,7 @@
35(declare-function image-property "image.el" (image property)) 35(declare-function image-property "image.el" (image property))
36(declare-function image-size "image.c" (spec &optional pixels frame)) 36(declare-function image-size "image.c" (spec &optional pixels frame))
37(declare-function imagep "image.c" (spec)) 37(declare-function imagep "image.c" (spec))
38(declare-function image--get-image "image.el" (&optional position))
38 39
39(defgroup image-crop () 40(defgroup image-crop ()
40 "Image cropping." 41 "Image cropping."
@@ -113,18 +114,36 @@ and the cropped image data.")
113(defun image-cut (&optional color) 114(defun image-cut (&optional color)
114 "Cut a rectangle from the image under point, filling it with COLOR. 115 "Cut a rectangle from the image under point, filling it with COLOR.
115COLOR defaults to the value of `image-cut-color'. 116COLOR defaults to the value of `image-cut-color'.
116Interactively, with prefix argument, prompt for COLOR to use." 117Interactively, with prefix argument, prompt for COLOR to use.
117 (interactive (list (and current-prefix-arg (read-color "Use color: ")))) 118
119This command presents the image with a rectangular area superimposed
120on it, and allows moving and resizing the area to define which
121part of it to cut.
122
123While moving/resizing the cutting area, the following key bindings
124are available:
125
126`q': Exit without changing anything.
127`RET': Crop/cut the image.
128`m': Make mouse movements move the rectangle instead of altering the
129 rectangle shape.
130`s': Same as `m', but make the rectangle into a square first.
131
132After cutting the image, you can save it by `M-x image-save' or
133\\<image-map>\\[image-save] when point is over the image."
134 (interactive (list (and current-prefix-arg
135 (read-color "Color to use for filling: "))))
118 (image-crop (if (zerop (length color)) image-cut-color color))) 136 (image-crop (if (zerop (length color)) image-cut-color color)))
119 137
120;;;###autoload 138;;;###autoload
121(defun image-crop (&optional cut) 139(defun image-crop (&optional cut)
122 "Crop the image under point. 140 "Crop the image under point.
123If CUT is non-nil, remove a rectangle from the image instead of 141This command presents the image with a rectangular area superimposed
124cropping the image. In that case CUT should be the name of a 142on it, and allows moving and resizing the area to define which
125color to fill the rectangle. 143part of it to crop.
126 144
127While cropping the image, the following key bindings are available: 145While moving/resizing the cropping area, the following key bindings
146are available:
128 147
129`q': Exit without changing anything. 148`q': Exit without changing anything.
130`RET': Crop/cut the image. 149`RET': Crop/cut the image.
@@ -132,15 +151,29 @@ While cropping the image, the following key bindings are available:
132 rectangle shape. 151 rectangle shape.
133`s': Same as `m', but make the rectangle into a square first. 152`s': Same as `m', but make the rectangle into a square first.
134 153
135After cropping an image, you can save it by `M-x image-save' or 154After cropping the image, you can save it by `M-x image-save' or
136\\<image-map>\\[image-save] when point is over the image." 155\\<image-map>\\[image-save] when point is over the image.
156
157When called from Lisp, if CUT is non-nil, remove a rectangle from
158the image instead of cropping the image. In that case, CUT should
159be the name of a color to fill the rectangle."
137 (interactive) 160 (interactive)
138 (unless (image-type-available-p 'svg) 161 (unless (image-type-available-p 'svg)
139 (error "SVG support is needed to crop images")) 162 (error "SVG support is needed to crop and cut images"))
140 (unless (executable-find (car image-crop-crop-command)) 163 (let* ((crop-cmd (car image-crop-crop-command))
141 (error "Couldn't find %s command to crop the image" 164 (found (executable-find crop-cmd)))
142 (car image-crop-crop-command))) 165 (unless found
143 (let ((image (get-text-property (point) 'display))) 166 (error "Couldn't find `%s' command to crop/cut the image" crop-cmd))
167 (if (and (memq system-type '(windows-nt ms-dos))
168 ;; MS-Windows has an incompatible convert.exe, used to
169 ;; convert filesystems...
170 (string-equal crop-cmd "convert")
171 (= 0 (string-search "Invalid drive specification."
172 (shell-command-to-string
173 (format "%s %s" crop-cmd null-device)))))
174 (error "The program `%s' is not an image conversion program"
175 found)))
176 (let ((image (image--get-image)))
144 (unless (imagep image) 177 (unless (imagep image)
145 (user-error "No image under point")) 178 (user-error "No image under point"))
146 (when (overlays-at (point)) 179 (when (overlays-at (point))
diff --git a/lisp/international/quail.el b/lisp/international/quail.el
index 2ffe3392335..317ea8495de 100644
--- a/lisp/international/quail.el
+++ b/lisp/international/quail.el
@@ -1995,7 +1995,8 @@ Remaining args are for FUNC."
1995(defun quail-minibuffer-message (string) 1995(defun quail-minibuffer-message (string)
1996 (message nil) 1996 (message nil)
1997 (let ((point-max (point-max)) 1997 (let ((point-max (point-max))
1998 (inhibit-quit t)) 1998 (inhibit-quit t)
1999 (deactivate-mark nil))
1999 (save-excursion 2000 (save-excursion
2000 (goto-char point-max) 2001 (goto-char point-max)
2001 (insert string)) 2002 (insert string))
diff --git a/lisp/jsonrpc.el b/lisp/jsonrpc.el
index 3965d38bc3e..ccf0f966574 100644
--- a/lisp/jsonrpc.el
+++ b/lisp/jsonrpc.el
@@ -574,15 +574,14 @@ With optional CLEANUP, kill any associated buffers."
574 (cl-return-from jsonrpc--process-filter)) 574 (cl-return-from jsonrpc--process-filter))
575 (when (buffer-live-p (process-buffer proc)) 575 (when (buffer-live-p (process-buffer proc))
576 (with-current-buffer (process-buffer proc) 576 (with-current-buffer (process-buffer proc)
577 (let* ((inhibit-read-only t) 577 (let* ((jsonrpc--in-process-filter t)
578 (jsonrpc--in-process-filter t)
579 (connection (process-get proc 'jsonrpc-connection)) 578 (connection (process-get proc 'jsonrpc-connection))
580 (expected-bytes (jsonrpc--expected-bytes connection))) 579 (expected-bytes (jsonrpc--expected-bytes connection)))
581 ;; Insert the text, advancing the process marker. 580 ;; Insert the text, advancing the process marker.
582 ;; 581 ;;
583 (save-excursion 582 (save-excursion
584 (goto-char (process-mark proc)) 583 (goto-char (process-mark proc))
585 (insert string) 584 (let ((inhibit-read-only t)) (insert string))
586 (set-marker (process-mark proc) (point))) 585 (set-marker (process-mark proc) (point)))
587 ;; Loop (more than one message might have arrived) 586 ;; Loop (more than one message might have arrived)
588 ;; 587 ;;
@@ -631,7 +630,8 @@ With optional CLEANUP, kill any associated buffers."
631 (jsonrpc-connection-receive connection 630 (jsonrpc-connection-receive connection
632 json-message))))) 631 json-message)))))
633 (goto-char message-end) 632 (goto-char message-end)
634 (delete-region (point-min) (point)) 633 (let ((inhibit-read-only t))
634 (delete-region (point-min) (point)))
635 (setq expected-bytes nil)))) 635 (setq expected-bytes nil))))
636 (t 636 (t
637 ;; Message is still incomplete 637 ;; Message is still incomplete
diff --git a/lisp/leim/quail/cyrillic.el b/lisp/leim/quail/cyrillic.el
index ba0b9c9ca12..d0874124fc7 100644
--- a/lisp/leim/quail/cyrillic.el
+++ b/lisp/leim/quail/cyrillic.el
@@ -1844,6 +1844,125 @@ Doubling the postfix separates the letter and postfix
1844 ("E**" ["У*"]) 1844 ("E**" ["У*"])
1845 ("e**" ["у*"])) 1845 ("e**" ["у*"]))
1846 1846
1847
1848;; Mongolian layout: Mongolian alphabet has 2 letters: Ө Ү,
1849;; and the layout is quite different from other cyrillic layouts.
1850;; Written by Garid Zorigoo.
1851(quail-define-package
1852 "cyrillic-mongolian" "Mongolian" "MN-" t
1853 "Input method for cyrillic Mongolian"
1854 nil t nil nil nil nil nil nil nil nil t)
1855
1856;; № - " ₮ : . _ , % ? е щ
1857;; Ф Ц У Ж Э Н Г Ш Ү З К Ъ
1858;; Й Ы Б Ө А Х Р О Л Д П
1859;; Я Ч Ё С М И Т Ь В Ю
1860
1861
1862(quail-define-rules
1863 ;; (lowercase 1st row)
1864 ("q" ?ф)
1865 ("w" ?ц)
1866 ("e" ?у)
1867 ("r" ?ж)
1868 ("t" ?э)
1869 ("y" ?н)
1870 ("u" ?г)
1871 ("i" ?ш)
1872 ("o" ?ү)
1873 ("p" ?з)
1874 ("[" ?к)
1875 ("]" ?ъ)
1876 ;; (lowercase 2nd row)
1877 ("a" ?й)
1878 ("s" ?ы)
1879 ("d" ?б)
1880 ("f" ?ө)
1881 ("g" ?а)
1882 ("h" ?х)
1883 ("j" ?р)
1884 ("k" ?о)
1885 ("l" ?л)
1886 (";" ?д)
1887 ("'" ?п)
1888 ;; (lowercase 3rd row)
1889 ("z" ?я)
1890 ("x" ?ч)
1891 ("c" ?ё)
1892 ("v" ?с)
1893 ("b" ?м)
1894 ("n" ?и)
1895 ("m" ?т)
1896 ("," ?ь)
1897 ("." ?в)
1898 ("/" ?ю)
1899
1900
1901 ;; (uppercase 1st row)
1902 ("Q" ?Ф)
1903 ("W" ?Ц)
1904 ("E" ?У)
1905 ("R" ?Ж)
1906 ("T" ?Э)
1907 ("Y" ?Н)
1908 ("U" ?Г)
1909 ("I" ?Ш)
1910 ("O" ?Ү)
1911 ("P" ?З)
1912 ("{" ?К)
1913 ("}" ?Ъ)
1914 ;; (uppercase 2nd row)
1915 ("A" ?Й)
1916 ("S" ?Ы)
1917 ("D" ?Б)
1918 ("F" ?Ө)
1919 ("G" ?А)
1920 ("H" ?Х)
1921 ("J" ?Р)
1922 ("K" ?О)
1923 ("L" ?Л)
1924 (":" ?Д)
1925 ("\"" ?П)
1926 ;; (uppercase 3rd row)
1927 ("Z" ?Я)
1928 ("X" ?Ч)
1929 ("C" ?Ё)
1930 ("V" ?С)
1931 ("B" ?М)
1932 ("N" ?И)
1933 ("M" ?Т)
1934 ("<" ?Ь)
1935 (">" ?В)
1936 ("?" ?Ю)
1937
1938
1939 ;; (number row without shift)
1940 ("1" ?№)
1941 ("2" ?-)
1942 ("3" ?\")
1943 ("4" ?₮)
1944 ("5" ?:)
1945 ("6" ?.)
1946 ("7" ?_)
1947 ("8" ?,)
1948 ("9" ?%)
1949 ("0" ??)
1950 ("-" ?е)
1951 ("=" ?щ)
1952 ;; (number row with shift)
1953 ("!" ?1)
1954 ("@" ?2)
1955 ("#" ?3)
1956 ("$" ?4)
1957 ("%" ?5)
1958 ("^" ?6)
1959 ("&" ?7)
1960 ("*" ?8)
1961 ("(" ?9)
1962 (")" ?0)
1963 ("_" ?Е)
1964 ("+" ?Щ))
1965
1847;; Local Variables: 1966;; Local Variables:
1848;; coding: utf-8 1967;; coding: utf-8
1849;; End: 1968;; End:
diff --git a/lisp/mouse.el b/lisp/mouse.el
index 9c1a72bb368..3c30361ad7d 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -533,7 +533,8 @@ Some context functions add menu items below the separator."
533 (i 0)) 533 (i 0))
534 (dolist (item (reverse yank-menu)) 534 (dolist (item (reverse yank-menu))
535 (when (consp item) 535 (when (consp item)
536 (define-key submenu (vector (setq i (1+ i))) 536 (define-key submenu
537 (vector (intern (format "kill-%d" (setq i (1+ i)))))
537 `(menu-item ,(cadr item) 538 `(menu-item ,(cadr item)
538 ,(lambda () (interactive) 539 ,(lambda () (interactive)
539 (mouse-yank-from-menu click (car item))))))) 540 (mouse-yank-from-menu click (car item)))))))
diff --git a/lisp/subr.el b/lisp/subr.el
index f90026534e8..a7a67c570b6 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -1555,31 +1555,32 @@ EVENT may be an event or an event type. If EVENT is a symbol
1555that has never been used in an event that has been read as input 1555that has never been used in an event that has been read as input
1556in the current Emacs session, then this function may fail to include 1556in the current Emacs session, then this function may fail to include
1557the `click' modifier." 1557the `click' modifier."
1558 (let ((type event)) 1558 (unless (stringp event)
1559 (if (listp type) 1559 (let ((type event))
1560 (setq type (car type))) 1560 (if (listp type)
1561 (if (symbolp type) 1561 (setq type (car type)))
1562 ;; Don't read event-symbol-elements directly since we're not 1562 (if (symbolp type)
1563 ;; sure the symbol has already been parsed. 1563 ;; Don't read event-symbol-elements directly since we're not
1564 (cdr (internal-event-symbol-parse-modifiers type)) 1564 ;; sure the symbol has already been parsed.
1565 (let ((list nil) 1565 (cdr (internal-event-symbol-parse-modifiers type))
1566 (char (logand type (lognot (logior ?\M-\0 ?\C-\0 ?\S-\0 1566 (let ((list nil)
1567 ?\H-\0 ?\s-\0 ?\A-\0))))) 1567 (char (logand type (lognot (logior ?\M-\0 ?\C-\0 ?\S-\0
1568 (if (not (zerop (logand type ?\M-\0))) 1568 ?\H-\0 ?\s-\0 ?\A-\0)))))
1569 (push 'meta list)) 1569 (if (not (zerop (logand type ?\M-\0)))
1570 (if (or (not (zerop (logand type ?\C-\0))) 1570 (push 'meta list))
1571 (< char 32)) 1571 (if (or (not (zerop (logand type ?\C-\0)))
1572 (push 'control list)) 1572 (< char 32))
1573 (if (or (not (zerop (logand type ?\S-\0))) 1573 (push 'control list))
1574 (/= char (downcase char))) 1574 (if (or (not (zerop (logand type ?\S-\0)))
1575 (push 'shift list)) 1575 (/= char (downcase char)))
1576 (or (zerop (logand type ?\H-\0)) 1576 (push 'shift list))
1577 (push 'hyper list)) 1577 (or (zerop (logand type ?\H-\0))
1578 (or (zerop (logand type ?\s-\0)) 1578 (push 'hyper list))
1579 (push 'super list)) 1579 (or (zerop (logand type ?\s-\0))
1580 (or (zerop (logand type ?\A-\0)) 1580 (push 'super list))
1581 (push 'alt list)) 1581 (or (zerop (logand type ?\A-\0))
1582 list)))) 1582 (push 'alt list))
1583 list)))))
1583 1584
1584(defun event-basic-type (event) 1585(defun event-basic-type (event)
1585 "Return the basic type of the given event (all modifiers removed). 1586 "Return the basic type of the given event (all modifiers removed).
@@ -1587,17 +1588,18 @@ The value is a printing character (not upper case) or a symbol.
1587EVENT may be an event or an event type. If EVENT is a symbol 1588EVENT may be an event or an event type. If EVENT is a symbol
1588that has never been used in an event that has been read as input 1589that has never been used in an event that has been read as input
1589in the current Emacs session, then this function may return nil." 1590in the current Emacs session, then this function may return nil."
1590 (if (consp event) 1591 (unless (stringp event)
1591 (setq event (car event))) 1592 (if (consp event)
1592 (if (symbolp event) 1593 (setq event (car event)))
1593 (car (get event 'event-symbol-elements)) 1594 (if (symbolp event)
1594 (let* ((base (logand event (1- ?\A-\0))) 1595 (car (get event 'event-symbol-elements))
1595 (uncontrolled (if (< base 32) (logior base 64) base))) 1596 (let* ((base (logand event (1- ?\A-\0)))
1596 ;; There are some numbers that are invalid characters and 1597 (uncontrolled (if (< base 32) (logior base 64) base)))
1597 ;; cause `downcase' to get an error. 1598 ;; There are some numbers that are invalid characters and
1598 (condition-case () 1599 ;; cause `downcase' to get an error.
1599 (downcase uncontrolled) 1600 (condition-case ()
1600 (error uncontrolled))))) 1601 (downcase uncontrolled)
1602 (error uncontrolled))))))
1601 1603
1602(defsubst mouse-movement-p (object) 1604(defsubst mouse-movement-p (object)
1603 "Return non-nil if OBJECT is a mouse movement event." 1605 "Return non-nil if OBJECT is a mouse movement event."
diff --git a/lisp/x-dnd.el b/lisp/x-dnd.el
index b213b155249..9286a1858cf 100644
--- a/lisp/x-dnd.el
+++ b/lisp/x-dnd.el
@@ -34,20 +34,20 @@
34 34
35;;; Customizable variables 35;;; Customizable variables
36(defcustom x-dnd-test-function #'x-dnd-default-test-function 36(defcustom x-dnd-test-function #'x-dnd-default-test-function
37 "The function drag and drop uses to determine if to accept or reject a drop. 37 "Function to be used by drag-and-drop to determine whether to accept a drop.
38The function takes three arguments, WINDOW, ACTION and TYPES. 38The function takes three arguments: WINDOW, ACTION, and TYPES.
39WINDOW is where the mouse is when the function is called. WINDOW 39WINDOW is where the window under the mouse is when the function is called.
40may be a frame if the mouse isn't over a real window (i.e. menu 40WINDOW may be a frame if the mouse isn't over a real window (e.g., menu
41bar, tool bar or scroll bar). ACTION is the suggested action 41bar, tool bar, scroll bar, etc.).
42from the drag and drop source, one of the symbols move, copy, 42ACTION is the suggested action from the drag and drop source, one of the
43link or ask. TYPES is a vector of available types for the drop. 43symbols `move', `copy', `link' or `ask'.
44 44TYPES is a vector of available types for the drop.
45Each element of TYPE should either be a string (containing the 45Each element of TYPES should either be a string (containing the
46name of the type's X atom), or a symbol, whose name will be used. 46name of the type's X atom), or a symbol, whose name will be used.
47 47
48The function shall return nil to reject the drop or a cons with 48The function shall return nil to reject the drop or a cons with
49two values, the wanted action as car and the wanted type as cdr. 49two values, the wanted action as `car' and the wanted type as `cdr'.
50The wanted action can be copy, move, link, ask or private. 50The wanted action can be `copy', `move', `link', `ask' or `private'.
51 51
52The default value for this variable is `x-dnd-default-test-function'." 52The default value for this variable is `x-dnd-default-test-function'."
53 :version "22.1" 53 :version "22.1"
@@ -70,14 +70,18 @@ The default value for this variable is `x-dnd-default-test-function'."
70 (,(purecopy "DndTypeFile") . x-dnd-handle-offix-file) 70 (,(purecopy "DndTypeFile") . x-dnd-handle-offix-file)
71 (,(purecopy "DndTypeFiles") . x-dnd-handle-offix-files) 71 (,(purecopy "DndTypeFiles") . x-dnd-handle-offix-files)
72 (,(purecopy "DndTypeText") . dnd-insert-text)) 72 (,(purecopy "DndTypeText") . dnd-insert-text))
73 "Which function to call to handle a drop of that type. 73 "Functions to call to handle drag-and-drop of known types.
74If the type for the drop is not present, or the function is nil, 74If the type of the drop is not present in the alist, or the
75the drop is rejected. The function takes three arguments, WINDOW, ACTION 75function corresponding to the type is nil, the drop of that
76and DATA. WINDOW is where the drop occurred, ACTION is the action for 76type will be rejected.
77this drop (copy, move, link, private or ask) as determined by a previous 77
78call to `x-dnd-test-function'. DATA is the drop data. 78Each function takes three arguments: WINDOW, ACTION, and DATA.
79The function shall return the action used (copy, move, link or private) 79WINDOW is the window where the drop occurred.
80if drop is successful, nil if not." 80ACTION is the action for this drop (`copy', `move', `link', `private'
81or `ask'), as determined by a previous call to `x-dnd-test-function'.
82DATA is the drop data.
83The function shall return the action it used (one of the above,
84excluding `ask') if drop is successful, nil if not."
81 :version "22.1" 85 :version "22.1"
82 :type 'alist 86 :type 'alist
83 :group 'x) 87 :group 'x)
@@ -122,22 +126,27 @@ like xterm) for text."
122 :group 'x) 126 :group 'x)
123 127
124(defcustom x-dnd-direct-save-function #'x-dnd-save-direct 128(defcustom x-dnd-direct-save-function #'x-dnd-save-direct
125 "Function called when a file is dropped that Emacs must save. 129 "Function called when a file is dropped via XDS protocol.
126It is called with two arguments: the first is either nil or t, 130The value should be a function of two arguments that supports
127and the second is a string. 131the X Direct Save (XDS) protocol. The function will be called
128 132twice during the protocol execution.
129If the first argument is t, the second argument is the name the 133
130dropped file should be saved under. The function should return a 134When the function is called with the first argument non-nil,
131complete file name describing where the file should be saved. 135it should return an absolute file name whose base name is
132 136the value of the second argument, a string. The return value
133It can also return nil, which means to cancel the drop. 137is the file name for the dragged file to be saved. The function
134 138can also return nil if saving the file should be refused for some
135If the first argument is nil, the second is the name of the file 139reason; in that case the drop will be canceled.
136that was dropped." 140
141When the function is called with the first argument nil, the
142second argument specifies the file name where the file was saved;
143the function should then do whatever is appropriate when such a
144file is saved, like show the file in the Dired buffer or visit
145the file."
137 :version "29.1" 146 :version "29.1"
138 :type '(choice (const :tag "Prompt for name before saving" 147 :type '(choice (const :tag "Prompt for file name to save"
139 x-dnd-save-direct) 148 x-dnd-save-direct)
140 (const :tag "Save and open immediately without prompting" 149 (const :tag "Save in `default-directory' without prompting"
141 x-dnd-save-direct-immediately) 150 x-dnd-save-direct-immediately)
142 (function :tag "Other function")) 151 (function :tag "Other function"))
143 :group 'x) 152 :group 'x)
@@ -222,14 +231,14 @@ any protocol specific data.")
222 (cdr (x-dnd-get-state-cons-for-frame frame-or-window))) 231 (cdr (x-dnd-get-state-cons-for-frame frame-or-window)))
223 232
224(defun x-dnd-default-test-function (_window _action types) 233(defun x-dnd-default-test-function (_window _action types)
225 "The default test function for drag and drop. 234 "The default test function for drag-and-drop.
226WINDOW is where the mouse is when this function is called. It 235WINDOW is where the mouse is when this function is called. It
227may be a frame if the mouse is over the menu bar, scroll bar or 236may be a frame if the mouse is over the menu bar, scroll bar or
228tool bar. ACTION is the suggested action from the source, and 237tool bar. ACTION is the suggested action from the source, and
229TYPES are the types the drop data can have. This function only 238TYPES are the types the drop data can have. This function only
230accepts drops with types in `x-dnd-known-types'. It always 239accepts drops with types in `x-dnd-known-types'. It always
231returns the action `private', unless `types' contains a value 240returns the action `private', unless `types' contains a value
232inside `x-dnd-copy-types'." 241inside `x-dnd-copy-types', in which case it may return `copy'."
233 (let ((type (x-dnd-choose-type types))) 242 (let ((type (x-dnd-choose-type types)))
234 (when type (let ((list x-dnd-copy-types)) 243 (when type (let ((list x-dnd-copy-types))
235 (catch 'out 244 (catch 'out
@@ -1564,17 +1573,24 @@ was taken, or the direct save failed."
1564 (when (not (equal file-name original-file-name)) 1573 (when (not (equal file-name original-file-name))
1565 (delete-file file-name))))) 1574 (delete-file file-name)))))
1566 1575
1567(defun x-dnd-save-direct (need-name name) 1576(defun x-dnd-save-direct (need-name filename)
1568 "Handle dropping a file that should be saved immediately. 1577 "Handle dropping a file FILENAME that should be saved first, asking the user.
1569NEED-NAME tells whether or not the file was not yet saved. NAME 1578NEED-NAME non-nil means the caller requests the full absolute
1570is either the name of the file, or the name the drop source wants 1579file name of FILENAME under which to save it; FILENAME is just
1571us to save under. 1580the base name in that case. The function then prompts the user
1581for where to save to file and returns the result to the caller.
1582
1583NEED-NAME nil means the file was saved as FILENAME (which should
1584be the full absolute file name in that case). The function then
1585refreshes the Dired display, if the current buffer is in Dired
1586mode, or visits the file otherwise.
1572 1587
1573Prompt the user for a file name, then open it." 1588This function is intended to be the value of `x-dnd-direct-save-function',
1589which see."
1574 (if need-name 1590 (if need-name
1575 (let ((file-name (read-file-name "Write file: " 1591 (let ((file-name (read-file-name "Write file: "
1576 default-directory 1592 default-directory
1577 nil nil name))) 1593 nil nil filename)))
1578 (when (file-exists-p file-name) 1594 (when (file-exists-p file-name)
1579 (unless (y-or-n-p (format-message 1595 (unless (y-or-n-p (format-message
1580 "File `%s' exists; overwrite? " file-name)) 1596 "File `%s' exists; overwrite? " file-name))
@@ -1584,18 +1600,18 @@ Prompt the user for a file name, then open it."
1584 ;; interface can be found. 1600 ;; interface can be found.
1585 (if (derived-mode-p 'dired-mode) 1601 (if (derived-mode-p 'dired-mode)
1586 (revert-buffer) 1602 (revert-buffer)
1587 (find-file name)))) 1603 (find-file filename))))
1588 1604
1589(defun x-dnd-save-direct-immediately (need-name name) 1605(defun x-dnd-save-direct-immediately (need-name filename)
1590 "Save and open a dropped file, like `x-dnd-save-direct'. 1606 "Handle dropping a file FILENAME that should be saved first.
1591NEED-NAME tells whether or not the file was not yet saved. NAME 1607Like `x-dnd-save-direct', but do not prompt for the file name;
1592is either the name of the file, or the name the drop source wants 1608instead, return its absolute file name for saving in the current
1593us to save under. 1609directory.
1594 1610
1595Unlike `x-dnd-save-direct', do not prompt for the name by which 1611This function is intended to be the value of `x-dnd-direct-save-function',
1596to save the file. Simply save it in the current directory." 1612which see."
1597 (if need-name 1613 (if need-name
1598 (let ((file-name (expand-file-name name))) 1614 (let ((file-name (expand-file-name filename)))
1599 (when (file-exists-p file-name) 1615 (when (file-exists-p file-name)
1600 (unless (y-or-n-p (format-message 1616 (unless (y-or-n-p (format-message
1601 "File `%s' exists; overwrite? " file-name)) 1617 "File `%s' exists; overwrite? " file-name))
@@ -1605,7 +1621,7 @@ to save the file. Simply save it in the current directory."
1605 ;; interface can be found. 1621 ;; interface can be found.
1606 (if (derived-mode-p 'dired-mode) 1622 (if (derived-mode-p 'dired-mode)
1607 (revert-buffer) 1623 (revert-buffer)
1608 (find-file name)))) 1624 (find-file filename))))
1609 1625
1610(defun x-dnd-handle-octet-stream-for-drop (save-to) 1626(defun x-dnd-handle-octet-stream-for-drop (save-to)
1611 "Save the contents of the XDS selection to SAVE-TO. 1627 "Save the contents of the XDS selection to SAVE-TO.
diff --git a/src/macfont.m b/src/macfont.m
index d0cdbcd08c7..9f9f6f4efaf 100644
--- a/src/macfont.m
+++ b/src/macfont.m
@@ -632,21 +632,35 @@ get_cgcolor_from_nscolor (NSColor *nsColor, struct frame *f)
632 632
633#define CG_SET_FILL_COLOR_WITH_FACE_FOREGROUND(context, face) \ 633#define CG_SET_FILL_COLOR_WITH_FACE_FOREGROUND(context, face) \
634 do { \ 634 do { \
635 CGColorRef refcol_ = get_cgcolor (NS_FACE_FOREGROUND (face)); \ 635 CGColorRef refcol = get_cgcolor (NS_FACE_FOREGROUND (face)); \
636 CGContextSetFillColorWithColor (context, refcol_) ; \ 636 CGContextSetFillColorWithColor (context, refcol); \
637 CGColorRelease (refcol_); \ 637 CGColorRelease (refcol); \
638 } while (0) 638 } while (0)
639#define CG_SET_FILL_COLOR_WITH_FACE_BACKGROUND(context, face) \ 639#define CG_SET_FILL_COLOR_WITH_FACE_BACKGROUND(context, face) \
640 do { \ 640 do { \
641 CGColorRef refcol_ = get_cgcolor (NS_FACE_BACKGROUND (face)); \ 641 CGColorRef refcol = get_cgcolor (NS_FACE_BACKGROUND (face)); \
642 CGContextSetFillColorWithColor (context, refcol_); \ 642 CGContextSetFillColorWithColor (context, refcol); \
643 CGColorRelease (refcol_); \ 643 CGColorRelease (refcol); \
644 } while (0)
645#define CG_SET_FILL_COLOR_WITH_FRAME_CURSOR(context, frame) \
646 do { \
647 CGColorRef refcol \
648 = get_cgcolor_from_nscolor (FRAME_CURSOR_COLOR (frame), frame); \
649 CGContextSetFillColorWithColor (context, refcol); \
650 CGColorRelease (refcol); \
651 } while (0)
652#define CG_SET_FILL_COLOR_WITH_FRAME_BACKGROUND(context, frame) \
653 do { \
654 CGColorRef refcol \
655 = get_cgcolor_from_nscolor (FRAME_BACKGROUND_COLOR (frame), frame); \
656 CGContextSetFillColorWithColor (context, refcol); \
657 CGColorRelease (refcol); \
644 } while (0) 658 } while (0)
645#define CG_SET_STROKE_COLOR_WITH_FACE_FOREGROUND(context, face) \ 659#define CG_SET_STROKE_COLOR_WITH_FACE_FOREGROUND(context, face) \
646 do { \ 660 do { \
647 CGColorRef refcol_ = get_cgcolor (NS_FACE_FOREGROUND (face)); \ 661 CGColorRef refcol = get_cgcolor (NS_FACE_FOREGROUND (face)); \
648 CGContextSetStrokeColorWithColor (context, refcol_); \ 662 CGContextSetStrokeColorWithColor (context, refcol); \
649 CGColorRelease (refcol_); \ 663 CGColorRelease (refcol); \
650 } while (0) 664 } while (0)
651 665
652 666
@@ -2933,9 +2947,12 @@ macfont_draw (struct glyph_string *s, int from, int to, int x, int y,
2933 { 2947 {
2934 if (s->hl == DRAW_CURSOR) 2948 if (s->hl == DRAW_CURSOR)
2935 { 2949 {
2936 CGColorRef colorref = get_cgcolor_from_nscolor (FRAME_CURSOR_COLOR (f), f); 2950 if (face && (NS_FACE_BACKGROUND (face)
2937 CGContextSetFillColorWithColor (context, colorref); 2951 == [(NSColor *) FRAME_CURSOR_COLOR (f)
2938 CGColorRelease (colorref); 2952 unsignedLong]))
2953 CG_SET_FILL_COLOR_WITH_FACE_FOREGROUND (context, face);
2954 else
2955 CG_SET_FILL_COLOR_WITH_FRAME_CURSOR (context, f);
2939 } 2956 }
2940 else 2957 else
2941 CG_SET_FILL_COLOR_WITH_FACE_BACKGROUND (context, face); 2958 CG_SET_FILL_COLOR_WITH_FACE_BACKGROUND (context, face);
@@ -2949,9 +2966,12 @@ macfont_draw (struct glyph_string *s, int from, int to, int x, int y,
2949 CGContextScaleCTM (context, 1, -1); 2966 CGContextScaleCTM (context, 1, -1);
2950 if (s->hl == DRAW_CURSOR) 2967 if (s->hl == DRAW_CURSOR)
2951 { 2968 {
2952 CGColorRef colorref = get_cgcolor_from_nscolor (FRAME_BACKGROUND_COLOR (f), f); 2969 if (face && (NS_FACE_BACKGROUND (face)
2953 CGContextSetFillColorWithColor (context, colorref); 2970 == [(NSColor *) FRAME_CURSOR_COLOR (f)
2954 CGColorRelease (colorref); 2971 unsignedLong]))
2972 CG_SET_FILL_COLOR_WITH_FACE_BACKGROUND (context, face);
2973 else
2974 CG_SET_FILL_COLOR_WITH_FRAME_BACKGROUND (context, f);
2955 } 2975 }
2956 else 2976 else
2957 CG_SET_FILL_COLOR_WITH_FACE_FOREGROUND (context, face); 2977 CG_SET_FILL_COLOR_WITH_FACE_FOREGROUND (context, face);
diff --git a/src/nsterm.m b/src/nsterm.m
index 87bdb44eadc..ecbf80ff72d 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -3750,14 +3750,18 @@ ns_maybe_dumpglyphs_background (struct glyph_string *s, char force_p)
3750 { 3750 {
3751 struct face *face = s->face; 3751 struct face *face = s->face;
3752 if (!face->stipple) 3752 if (!face->stipple)
3753 { 3753 {
3754 if (s->hl != DRAW_CURSOR) 3754 if (s->hl != DRAW_CURSOR)
3755 [(NS_FACE_BACKGROUND (face) != 0 3755 [(NS_FACE_BACKGROUND (face) != 0
3756 ? [NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND (face)] 3756 ? [NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND (face)]
3757 : FRAME_BACKGROUND_COLOR (s->f)) set]; 3757 : FRAME_BACKGROUND_COLOR (s->f)) set];
3758 else 3758 else if (face && (NS_FACE_BACKGROUND (face)
3759 [FRAME_CURSOR_COLOR (s->f) set]; 3759 == [(NSColor *) FRAME_CURSOR_COLOR (s->f)
3760 } 3760 unsignedLong]))
3761 [[NSColor colorWithUnsignedLong:NS_FACE_FOREGROUND (face)] set];
3762 else
3763 [FRAME_CURSOR_COLOR (s->f) set];
3764 }
3761 else 3765 else
3762 { 3766 {
3763 struct ns_display_info *dpyinfo = FRAME_DISPLAY_INFO (s->f); 3767 struct ns_display_info *dpyinfo = FRAME_DISPLAY_INFO (s->f);