From a10254dd46da920d14dd990714d0f21fd508d07d Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 23 May 2020 08:50:22 +0300 Subject: [PATCH 1/6] Fix accessing files on networked drives on MS-Windows * src/w32.c (acl_get_file): Set errno to ENOTSUP if get_file_security returns ERROR_NOT_SUPPORTED. (Bug#41463) --- src/w32.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/w32.c b/src/w32.c index 62c53fd7711..78e75f0937e 100644 --- a/src/w32.c +++ b/src/w32.c @@ -6398,7 +6398,15 @@ acl_get_file (const char *fname, acl_type_t type) if (!get_file_security (fname, si, psd, sd_len, &sd_len)) { xfree (psd); - errno = EIO; + err = GetLastError (); + if (err == ERROR_NOT_SUPPORTED) + errno = ENOTSUP; + else if (err == ERROR_FILE_NOT_FOUND + || err == ERROR_PATH_NOT_FOUND + || err == ERROR_INVALID_NAME) + errno = ENOENT; + else + errno = EIO; psd = NULL; } } @@ -6409,6 +6417,8 @@ acl_get_file (const char *fname, acl_type_t type) be encoded in the current ANSI codepage. */ || err == ERROR_INVALID_NAME) errno = ENOENT; + else if (err == ERROR_NOT_SUPPORTED) + errno = ENOTSUP; else errno = EIO; } From 13b6dfd4f767a6ce2b01a519fe412dbf80f4921e Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 23 May 2020 10:33:35 +0300 Subject: [PATCH 2/6] * doc/emacs/killing.texi (Rectangles): Improve indexing. --- doc/emacs/killing.texi | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/emacs/killing.texi b/doc/emacs/killing.texi index 834a5c6159d..6b1f35e6158 100644 --- a/doc/emacs/killing.texi +++ b/doc/emacs/killing.texi @@ -727,6 +727,8 @@ them. Rectangle commands are useful with text in multicolumn formats, and for changing text into or out of such formats. @cindex mark rectangle +@cindex region-rectangle +@cindex rectangular region To specify a rectangle for a command to work on, set the mark at one corner and point at the opposite corner. The rectangle thus specified is called the @dfn{region-rectangle}. If point and the mark are in From fb2e34cd2155cbaaf945d8cd167b600b55b9edff Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 23 May 2020 10:59:39 +0300 Subject: [PATCH 3/6] ; * etc/TODO (Ligatures): Update the entry based on recent discussions. --- etc/TODO | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/etc/TODO b/etc/TODO index f983fa27d33..c11848e0c5d 100644 --- a/etc/TODO +++ b/etc/TODO @@ -220,10 +220,23 @@ https://lists.gnu.org/r/emacs-devel/2013-11/msg00515.html width fonts. However, more features are still needed to achieve this. ** Support ligatures out of the box -For the list of typographical ligatures, see +For the list of frequently-used typographical ligatures, see https://en.wikipedia.org/wiki/Orthographic_ligature#Ligatures_in_Unicode_(Latin_alphabets) +(Note that in general, the number of possible ligatures can be much +larger, and there's no way, in principle, to specify the superset of +all the ligatures that could exist. Each font can support different +ligatures. The reliable way of supporting any and all ligatures is to +hand all text to be displayed to the shaping engine and get back the +font glyphs to display that text. However, doing this is impossible +with the current design of the Emacs display engine, since it examines +buffer text one character at a time, and implements character +composition by calls to Lisp, which makes doing this for every +character impractically slow. therefore, the rest of this item +describes a limited form of ligature support which is compatible with +the current display engine design and uses automatic compositions.) + For Text and derived modes, the job is to figure out which ligatures we want to support, how to let the user customize that, and probably define a minor mode for automatic ligation (as some contexts might not @@ -237,12 +250,12 @@ prettify-symbols-mode. We need to figure out which ligatures are needed for each programming language, and provide user options to turn this on and off. -The implementation should use the infrastructure for character -compositions, i.e., we should define appropriate regexp-based rules -for character sequences that need to be composed into ligatures, and -populate composition-function-table with those rules. See -composite.el for examples of this, and also grep lisp/language/*.el -for references to composition-function-table. +The implementation should use the infrastructure for automatic +character compositions, i.e., we should define appropriate +regexp-based rules for character sequences that need to be composed +into ligatures, and populate composition-function-table with those +rules. See composite.el for examples of this, and also grep +lisp/language/*.el for references to composition-function-table. One problem with character compositions that will need to be solved is that composition-function-table, the char-table which holds the @@ -259,7 +272,11 @@ way of preventing the ligation from happening. One possibility is to have a ZWNJ character separate these ASCII characters; another possibility is to introduce a special text property that prevents character composition, and place that property on the relevant parts -of the mode line. +of the mode line. Yet another possibility would be to write a +specialized composition function, which would detect that it is called +on mode-line strings, and return nil to signal that composition is not +possible in this case; then use that function in the rules for +ligatures stored in composition-function-table. The prettify-symbols-mode should be deprecated once ligature support is in place. From c7737d40f2ae9f8459508e9d07cd7aa5f1ea78b6 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 23 May 2020 11:01:09 +0300 Subject: [PATCH 4/6] ; * etc/TODO (Ligatures): Update the entry based on recent discussions. --- etc/TODO | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/TODO b/etc/TODO index c11848e0c5d..0f908def768 100644 --- a/etc/TODO +++ b/etc/TODO @@ -233,7 +233,7 @@ font glyphs to display that text. However, doing this is impossible with the current design of the Emacs display engine, since it examines buffer text one character at a time, and implements character composition by calls to Lisp, which makes doing this for every -character impractically slow. therefore, the rest of this item +character impractically slow. Therefore, the rest of this item describes a limited form of ligature support which is compatible with the current display engine design and uses automatic compositions.) From 1a6d59eebaff919b38792450edfae7912f6639b3 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 23 May 2020 15:14:27 +0300 Subject: [PATCH 5/6] Improve the documentation of setting up fontsets * doc/lispref/display.texi (Fontsets): Improve the accuracy of a cross-reference to "Character Properties". * doc/emacs/mule.texi (Fontsets, Modifying Fontsets): Improve the documentation of fontsets and how to modify them. --- doc/emacs/mule.texi | 88 +++++++++++++++++++++++++++++----------- doc/lispref/display.texi | 6 +-- 2 files changed, 68 insertions(+), 26 deletions(-) diff --git a/doc/emacs/mule.texi b/doc/emacs/mule.texi index e3fe20c76f8..373c7b55817 100644 --- a/doc/emacs/mule.texi +++ b/doc/emacs/mule.texi @@ -1326,16 +1326,17 @@ stored in the system and the available font names are defined by the system, fontsets are defined within Emacs itself. Once you have defined a fontset, you can use it within Emacs by specifying its name, anywhere that you could use a single font. Of course, Emacs fontsets -can use only the fonts that the system supports. If some characters +can use only the fonts that your system supports. If some characters appear on the screen as empty boxes or hex codes, this means that the fontset in use for them has no font for those characters. In this case, or if the characters are shown, but not as well as you would -like, you may need to install extra fonts. Your operating system may -have optional fonts that you can install; or you can install the GNU -Intlfonts package, which includes fonts for most supported -scripts.@footnote{If you run Emacs on X, you may need to inform the X -server about the location of the newly installed fonts with commands -such as: +like, you may need to install extra fonts or modify the fontset to use +specific fonts already installed on your system (see below). Your +operating system may have optional fonts that you can install; or you +can install the GNU Intlfonts package, which includes fonts for most +supported scripts.@footnote{If you run Emacs on X, you may need to +inform the X server about the location of the newly installed fonts +with commands such as: @c FIXME? I feel like this may be out of date. @c E.g., the intlfonts tarfile is ~ 10 years old. @@ -1376,14 +1377,20 @@ explicitly requested, despite its name. @w{@kbd{M-x describe-fontset}} command. It prompts for a fontset name, defaulting to the one used by the current frame, and then displays all the subranges of characters and the fonts assigned to -them in that fontset. +them in that fontset. To see which fonts Emacs is using in a session +started without a specific fontset (which is what happens normally), +type @kbd{fontset-default @key{RET}} at the prompt, or just +@kbd{@key{RET}} to describe the fontset used by the current frame. A fontset does not necessarily specify a font for every character code. If a fontset specifies no font for a certain character, or if it specifies a font that does not exist on your system, then it cannot display that character properly. It will display that character as a -hex code or thin space or an empty box instead. (@xref{Text Display, , -glyphless characters}, for details.) +hex code or thin space or an empty box instead. (@xref{Text Display, +, glyphless characters}, for details.) Or a fontset might specify a +font for some range of characters, but you may not like their visual +appearance. If this happens, you may wish to modify your fontset; see +@ref{Modifying Fontsets}, for how to do that. @node Defining Fontsets @section Defining Fontsets @@ -1542,10 +1549,10 @@ call this function explicitly to create a fontset. Fontsets do not always have to be created from scratch. If only minor changes are required it may be easier to modify an existing -fontset. Modifying @samp{fontset-default} will also affect other -fontsets that use it as a fallback, so can be an effective way of -fixing problems with the fonts that Emacs chooses for a particular -script. +fontset, usually @samp{fontset-default}. Modifying +@samp{fontset-default} will also affect other fontsets that use it as +a fallback, so can be an effective way of fixing problems with the +fonts that Emacs chooses for a particular script. Fontsets can be modified using the function @code{set-fontset-font}, specifying a character, a charset, a script, or a range of characters @@ -1553,26 +1560,61 @@ to modify the font for, and a font specification for the font to be used. Some examples are: @example -;; Use Liberation Mono for latin-3 charset. -(set-fontset-font "fontset-default" 'iso-8859-3 - "Liberation Mono") - ;; Prefer a big5 font for han characters. (set-fontset-font "fontset-default" 'han (font-spec :registry "big5") nil 'prepend) -;; Use DejaVu Sans Mono as a fallback in fontset-startup -;; before resorting to fontset-default. -(set-fontset-font "fontset-startup" nil "DejaVu Sans Mono" - nil 'append) - ;; Use MyPrivateFont for the Unicode private use area. (set-fontset-font "fontset-default" '(#xe000 . #xf8ff) "MyPrivateFont") +;; Use Liberation Mono for latin-3 charset. +(set-fontset-font "fontset-default" 'iso-8859-3 + "Liberation Mono") + +;; Use DejaVu Sans Mono as a fallback in fontset-startup +;; before resorting to fontset-default. +(set-fontset-font "fontset-startup" nil "DejaVu Sans Mono" + nil 'append) @end example +@noindent +@xref{Fontsets, , , elisp, GNU Emacs Lisp Reference Manual}, for more +details about using the @code{set-fontset-font} function. + +@cindex script of a character +@cindex codepoint of a character +If you don't know the character's codepoint or the script to which it +belongs, you can ask Emacs. With point at the character, type +@w{@kbd{C-u C-x =}} (@code{what-cursor-position}), and this +information, together with much more, will be displayed in the +@file{*Help*} buffer that Emacs pops up. @xref{Position Info}. For +example, Japanese characters belong to the @samp{kana} script, but +Japanese text also mixes them with Chinese characters so the following +uses the @samp{han} script to set up Emacs to use the @samp{Kochi +Gothic} font for Japanese text: + +@example +(set-fontset-font "fontset-default" 'han "Kochi Gothic") +@end example + +@noindent +@cindex CKJ characters +(For convenience, the @samp{han} script in Emacs is set up to support +all of the Chinese, Japanese, and Korean, a.k.a.@: @acronym{CJK}, +characters, not just Chinese characters.) + +@vindex script-representative-chars +For the list of known scripts, see the variable +@code{script-representative-chars}. + +Fontset settings like those above only affect characters that the +default font doesn't support, so if the @samp{Kochi Gothic} font +covers Latin characters, it will not be used for displaying Latin +scripts, since the default font used by Emacs usually covers Basic +Latin. + @cindex ignore font @cindex fonts, how to ignore @vindex face-ignored-fonts diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index e655f2f0cae..588e2217b9b 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi @@ -3600,9 +3600,9 @@ characters in the range @var{from} and @var{to} (inclusive). @var{character} may be a charset (@pxref{Character Sets}). In that case, use @var{font-spec} for all the characters in the charset. -@var{character} may be a script name (@pxref{Character Properties}). -In that case, use @var{font-spec} for all the characters belonging to -the script. +@var{character} may be a script name (@pxref{Character Properties, +char-script-table}). In that case, use @var{font-spec} for all the +characters belonging to the script. @var{character} may be @code{nil}, which means to use @var{font-spec} for any character which no font-spec is specified. From d6a0b66a0cf44389c7474a60dd23cbf666e78537 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Sat, 23 May 2020 09:33:41 -0400 Subject: [PATCH 6/6] * lisp/subr.el (save-match-data): Clarify use in docstring --- lisp/subr.el | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lisp/subr.el b/lisp/subr.el index 33194e4ffa2..2b3231b879b 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -4088,7 +4088,11 @@ MODES is as for `set-default-file-modes'." ;; now, but it generates slower code. (defmacro save-match-data (&rest body) "Execute the BODY forms, restoring the global value of the match data. -The value returned is the value of the last form in BODY." +The value returned is the value of the last form in BODY. +NOTE: The convention in Elisp is that any function, except for a few +exceptions like car/assoc/+/goto-char, can clobber the match data, +so `save-match-data' should normally be used to save *your* match data +rather than your caller's match data." ;; It is better not to use backquote here, ;; because that makes a bootstrapping problem ;; if you need to recompile all the Lisp files using interpreted code.