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 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 e53f0e9f60c..3d738b9965f 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi @@ -3597,9 +3597,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. diff --git a/etc/TODO b/etc/TODO index f983fa27d33..0f908def768 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. diff --git a/lisp/subr.el b/lisp/subr.el index 324c59f13f7..10c37e94134 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -4112,7 +4112,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. diff --git a/src/w32.c b/src/w32.c index 0f69e652a57..f391f5e26eb 100644 --- a/src/w32.c +++ b/src/w32.c @@ -6519,7 +6519,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; } } @@ -6530,6 +6538,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; }