emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 0bd860cc2e 1/2: Merge from origin/emacs-28


From: Stefan Kangas
Subject: master 0bd860cc2e 1/2: Merge from origin/emacs-28
Date: Thu, 1 Sep 2022 00:35:41 -0400 (EDT)

branch: master
commit 0bd860cc2e94e3f5178000e929af93863b9ae458
Merge: e8085b1596 8807a4f532
Author: Stefan Kangas <stefankangas@gmail.com>
Commit: Stefan Kangas <stefankangas@gmail.com>

    Merge from origin/emacs-28
    
    8807a4f532 Enable 256 colors in fbterm.
    bbc23ca8ab One more fix for find-file.el
    0cbcaf5119 ; Yet another doc fix for 'ff-other-file-alist' (bug#57325)
    2d9a391727 Recommend using fbterm in the Linux console.
    a5a92e577c ; * src/window.c (syms_of_window) <window-point-insertion-...
    4d52fe6b96 * lisp/find-file.el (ff-other-file-alist): Doc fix.  (Bug#...
    d111b5b651 * lisp/info.el (Info-mode): Support the Linux console better.
    cc945ec0ed ; Fix doc strings in latin1-disp.el
    195fcc932e Improve the documentation of glyphless-character display
    72ae02377e ; * lisp/jit-lock.el (jit-lock-chunk-size): Doc fix.
    3fb69fad49 Fix documentation of 'glyphless-char-display'
    
    # Conflicts:
    #       lisp/international/characters.el
    #       src/xdisp.c
---
 doc/lispref/display.texi          |  4 +-
 doc/misc/efaq.texi                | 97 +++++++++++++++++++++++++++++++++++++++
 etc/PROBLEMS                      |  7 +++
 lisp/find-file.el                 | 36 ++++++++++-----
 lisp/info.el                      |  9 ++--
 lisp/international/characters.el  | 19 +++++---
 lisp/international/latin1-disp.el |  4 +-
 lisp/jit-lock.el                  |  7 ++-
 lisp/term/fbterm.el               | 27 +++++++++++
 src/window.c                      |  3 +-
 src/xdisp.c                       | 28 +++++++----
 11 files changed, 205 insertions(+), 36 deletions(-)

diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi
index db58cd14c6..69b752688e 100644
--- a/doc/lispref/display.texi
+++ b/doc/lispref/display.texi
@@ -8554,6 +8554,7 @@ Display with @var{graphical} on graphical displays, and 
with
 must be one of the display methods described above.
 @end table
 
+@vindex glyphless-char@r{ face}
 @noindent
 The @code{thin-space}, @code{empty-box}, @code{hex-code}, and
 @acronym{ASCII} string display methods are drawn with the
@@ -8618,7 +8619,8 @@ codepoints (typically emojis).
 
 @item no-font
 Characters for which there is no suitable font, or which cannot be
-encoded by the terminal's coding system.
+encoded by the terminal's coding system, or those for which the
+text-mode terminal has no glyphs.
 @end table
 
 @c FIXME: this can also be 'acronym', but that's not currently
diff --git a/doc/misc/efaq.texi b/doc/misc/efaq.texi
index a3459abd04..43fa005434 100644
--- a/doc/misc/efaq.texi
+++ b/doc/misc/efaq.texi
@@ -1602,6 +1602,7 @@ is better to write ``Emacs and XEmacs.''
 * Filling paragraphs with a single space::
 * Escape sequences in shell output::
 * Fullscreen mode on MS-Windows::
+* Emacs in a Linux console::
 @end menu
 
 @node Setting up a customization file
@@ -3031,6 +3032,102 @@ To compute the correct values for width and height, 
first maximize the
 Emacs frame and then evaluate @code{(frame-height)} and
 @code{(frame-width)} with @kbd{M-:}.
 
+@node Emacs in a Linux console
+@section How can I alleviate the limitations of the Linux console?
+@cindex Console, Linux console, TTY, fbterm
+
+If possible, we recommend running Emacs inside @command{fbterm}, when
+in a Linux console.  This brings the Linux console on par with most
+terminal emulators under X.  To do this, install @command{fbterm}, for
+example with the package manager of your GNU/Linux distribution, and
+execute the command
+
+@example
+$ fbterm
+@end example
+
+This will create a sample configuration file @file{~/.fbtermrc} in
+your home directory.  Edit that file and change the options
+@code{font-names} and @code{font-size} if necessary.  For the former,
+you can choose one or more of the lines in the output of the following
+command, separated by commas:
+
+@example
+$ fc-list :spacing=mono family | sed 's/ /\\ /g'
+@end example
+
+You can now start Emacs inside @command{fbterm} with the command
+
+@example
+$ fbterm -- env TERM=fbterm emacs
+@end example
+
+In some versions of @command{fbterm}, setting @env{TERM} to
+@samp{fbterm} can be omitted.  To check whether it is needed, start
+Emacs inside @command{fbterm} with the command
+
+@example
+$ fbterm -- emacs
+@end example
+
+@noindent
+and type @kbd{M-x list-colors-display}.  If only 8 colors are
+displayed, it is necessary; if 256 colors are displayed, it isn't.
+
+You may want to add an alias for that command in your shell
+configuration file.  For example, if you use Bash, you can add the
+following line to your @file{~/.bashrc} file:
+
+@example
+alias emacs="fbterm -- env TERM=fbterm emacs"
+@end example
+
+@noindent
+or, if you use Emacs both in the Linux console and under X:
+
+@example
+[[ "$(tty)" =~ "/dev/tty" ]] && alias emacs="fbterm -- env TERM=fbterm emacs"
+@end example
+
+The @command{fbterm} terminal emulator may define a number of key
+bindings for its own use, some of which conflict with those that Emacs
+uses.  Execute the following two commands as root to ensure that
+@command{fbterm} does not define these key bindings:
+
+@example
+# chmod a-s `which fbterm`
+# setcap cap_sys_tty_config=-ep `which fbterm`
+@end example
+
+If you use Emacs as root, the above is not enough however, because the
+root user has all privileges.  You can use the following command to
+start Emacs inside @command{fbterm} as root while ensuring that
+@command{fbterm} does not define any key bindings for its own use:
+
+@example
+# capsh --drop=cap_sys_tty_config -- -c "fbterm -- env TERM=fbterm emacs"
+@end example
+
+Again you may want to add a shortcut for that command in the shell
+configuration file of the root user.  In this case however, it is not
+possible to use an alias, because the command line arguments passed to
+Emacs need to be inserted in the string at the end of the command.  A
+wrapper script or a function can be used to do that.  For example, if
+you use Bash, you can add the following function in the root user
+@file{~/.bashrc} file:
+
+@example
+function emacs ()
+@{
+  CMD="fbterm -- env TERM=fbterm emacs "
+  for ARG in "$@@"
+  do
+    CMD="$CMD '$ARG' "
+  done
+  capsh --drop=cap_sys_tty_config -- -c "$CMD"
+@}
+@end example
+
 @c ------------------------------------------------------------
 @node Bugs and problems
 @chapter Bugs and problems
diff --git a/etc/PROBLEMS b/etc/PROBLEMS
index 6624f747c8..ed2bc1ae05 100644
--- a/etc/PROBLEMS
+++ b/etc/PROBLEMS
@@ -2267,6 +2267,13 @@ term/xterm.el) for more details.
 
 *** Linux console problems with double-width characters
 
+If possible, we recommend running Emacs inside fbterm, when in a Linux
+console (see the node "Emacs in a Linux console" in the Emacs FAQ).
+Most Unicode characters should then be displayed correctly.
+
+If that is not possible, the following may be useful to alleviate the
+problem of displaying Unicode characters in a raw console.
+
 The Linux console declares UTF-8 encoding, but supports only a limited
 number of Unicode characters, and can cause Emacs produce corrupted or
 garbled display with some unusual characters and sequences.  Emacs 28
diff --git a/lisp/find-file.el b/lisp/find-file.el
index 614ff420f2..646779fc91 100644
--- a/lisp/find-file.el
+++ b/lisp/find-file.el
@@ -193,18 +193,32 @@ The value could be an alist or a symbol whose value is an 
alist.
 Each element of the alist has the form
 
    (REGEXP (EXTENSION...))
-or
-   (REGEXP FUNCTION)
 
 where REGEXP is the regular expression matching a file's extension,
-EXTENSIONs is the list of literal file-name extensions to search for,
-and FUNCTION is a function of one argument, the current file's name,
-that returns the list of extensions to search for.
-The list of extensions should contain the most used extensions before the
-others, since the search algorithm searches sequentially through each
-directory specified in `ff-search-directories'.  If a file is not found,
-a new one is created with the first matching extension (`.cc' yields `.hh').
-This alist should be set by the major mode."
+and EXTENSIONs is the list of literal file-name extensions to search
+for.  The list of extensions should contain the most used extensions
+before the others, since the search algorithm searches sequentially
+through each directory specified in `ff-search-directories'.
+
+Alist elements can also be of the form
+
+   (REGEXP FUNCTION)
+
+where FUNCTION is a function of one argument, the current file's name,
+that returns the list of possible names of the corresponding files, with
+or without leading directories.  Note the difference: FUNCTION returns
+the list of file names, not their extensions.  This is for the case when
+REGEXP is not enough to determine the file name of the other file.
+
+If a file is not found, a new one is created with the first
+matching extension or name (e.g., `.cc' yields `.hh').
+
+This alist should be set by the major mode.
+
+Note: if an element of the alist names a FUNCTION as its cdr, that
+function must return a non-nil list of file-names.  It cannot
+return nil, nor can it signal in any way a failure to find a suitable
+list of file names."
   :type '(choice (repeat (list regexp (choice (repeat string) function)))
                 symbol))
 
@@ -615,7 +629,7 @@ name of the first file found."
             (while (and suffixes (not found))
 
               (setq filename (concat fname-stub this-suffix))
-              (setq file (concat dir "/" filename))
+              (setq file (expand-file-name filename dir))
 
               (if (not ff-quiet-mode)
                   (message "Finding %s..." file))
diff --git a/lisp/info.el b/lisp/info.el
index fb4c3fd782..1a58910c3a 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -4451,9 +4451,12 @@ Advanced commands:
   (setq buffer-read-only t)
   (setq Info-tag-table-marker (make-marker))
   (unless (or (display-multi-font-p)
-              (coding-system-equal
-               (coding-system-base (terminal-coding-system))
-               'utf-8))
+              (and (coding-system-equal
+                    (coding-system-base (terminal-coding-system))
+                    'utf-8)
+                   ;; The Linux console has limited character
+                   ;; repertoire even when its encoding is UTF-8.
+                   (not (equal (tty-type) "linux"))))
     (dolist (elt info-symbols-and-replacements)
       (let ((ch (car elt))
             (repl (cdr elt)))
diff --git a/lisp/international/characters.el b/lisp/international/characters.el
index d6e83c81e7..245ade54e1 100644
--- a/lisp/international/characters.el
+++ b/lisp/international/characters.el
@@ -1661,12 +1661,14 @@ GROUP must be one of these symbols:
                     like U+2069 (PDI) and U+202B (RLE).
   `variation-selectors':
                     Characters in the range U+FE00..U+FE0F and
-                    U+E0100..U+E01EF, used for selecting alternate glyph
-                    presentations, such as Emoji vs Text presentation, of
-                    the preceding character(s).
-  `no-font':        For GUI frames, characters for which no suitable
-                    font is found; for text-mode frames, characters
-                    that cannot be encoded by `terminal-coding-system'.
+                    U+E0100..U+E01EF, used for choosing between
+                    glyph variations, such as Emoji vs Text
+                    presentation, of the preceding character(s).
+  `no-font':        For GUI frames, characters for which no
+                    suitable font is found; for text-mode frames,
+                    characters that cannot be encoded by
+                    `terminal-coding-system' or those for which
+                    the terminal has no glyphs.
 
 METHOD must be one of these symbols:
   `zero-width': don't display.
@@ -1680,7 +1682,10 @@ METHOD must be one of these symbols:
 Do not set its value directly from Lisp; the value takes effect
 only via a custom `:set'
 function (`update-glyphless-char-display'), which updates
-`glyphless-char-display'."
+`glyphless-char-display'.
+
+See also the `glyphless-char' face, which is used to display the
+visual representation of these characters."
   :version "28.1"
   :type '(alist :key-type (symbol :tag "Character Group")
                :value-type (symbol :tag "Display Method"))
diff --git a/lisp/international/latin1-disp.el 
b/lisp/international/latin1-disp.el
index 4de1d6084f..cb3b429957 100644
--- a/lisp/international/latin1-disp.el
+++ b/lisp/international/latin1-disp.el
@@ -87,7 +87,7 @@ This option also treats some characters in the 
`mule-unicode-...'
 charsets if you don't have a Unicode font with which to display them.
 
 Setting this variable directly does not take effect;
-use either \\[customize] or the function `latin1-display'."
+use either \\[customize] or the command `latin1-display'."
   :group 'latin1-display
   :type 'boolean
   :require 'latin1-disp
@@ -746,7 +746,7 @@ This uses the transliterations of the Lynx browser.  The 
display isn't
 changed if the display can render Unicode characters.
 
 Setting this variable directly does not take effect;
-use either \\[customize] or the function `latin1-display'."
+use either \\[customize] or the command `latin1-display-ucs-per-lynx'."
   :group 'latin1-display
   :type 'boolean
   :require 'latin1-disp
diff --git a/lisp/jit-lock.el b/lisp/jit-lock.el
index be26ca55f0..9543253cf2 100644
--- a/lisp/jit-lock.el
+++ b/lisp/jit-lock.el
@@ -45,9 +45,12 @@ Preserves the `buffer-modified-p' state of the current 
buffer."
   :group 'font-lock)
 
 (defcustom jit-lock-chunk-size 1500
-  "Jit-lock fontifies chunks of at most this many characters at a time.
+  "Jit-lock asks to fontify chunks of at most this many characters at a time.
 
-This variable controls both `display-time' and stealth fontification.
+The actual size of the fontified chunk of text can be different,
+depending on what the `fontification-functions' actually decide to do.
+
+This variable controls both display-time and stealth fontifications.
 
 The optimum value is a little over the typical number of buffer
 characters which fit in a typical window."
diff --git a/lisp/term/fbterm.el b/lisp/term/fbterm.el
new file mode 100644
index 0000000000..ad7150c1a1
--- /dev/null
+++ b/lisp/term/fbterm.el
@@ -0,0 +1,27 @@
+;;; fbterm.el  -*- lexical-binding:t -*-
+
+;; Copyright (C) 2022 Free Software Foundation, Inc.
+
+;; Note that, in some versions of fbterm, the TERM environment
+;; variable is set to "linux".  When that's the case, the code below
+;; will not be executed, and only 8 colors will be available.  It is
+;; therefore necessary, with these versions of fbterm, to set that
+;; environment variable to "fbterm" to enable its 256 color mode
+;; extension.  See also the node "Emacs in a Linux console" of the
+;; Emacs FAQ.
+
+(require 'term/xterm)
+
+(defun terminal-init-fbterm ()
+  "Terminal initialization function for fbterm."
+
+  ;; fbterm can't display underlines, even though its terminfo data
+  ;; says it can.
+  (tty-no-underline)
+
+  ;; fbterm supports xterm's 256 color mode extension.
+  (xterm-register-default-colors xterm-standard-colors))
+
+(provide 'term/fbterm)
+
+;;; fbterm.el ends here
diff --git a/src/window.c b/src/window.c
index 2bce4c9723..12a212a85a 100644
--- a/src/window.c
+++ b/src/window.c
@@ -8363,7 +8363,8 @@ on their symbols to be controlled by this variable.  */);
   Vscroll_preserve_screen_position = Qnil;
 
   DEFVAR_LISP ("window-point-insertion-type", Vwindow_point_insertion_type,
-              doc: /* Type of marker to use for `window-point'.  */);
+              doc: /* Insertion type of marker to use for `window-point'.
+See `marker-insertion-type' for the meaning of the possible values.  */);
   Vwindow_point_insertion_type = Qnil;
   DEFSYM (Qwindow_point_insertion_type, "window-point-insertion-type");
 
diff --git a/src/xdisp.c b/src/xdisp.c
index 70f6936dd0..2c9dc63a38 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -7842,7 +7842,13 @@ lookup_glyphless_char_display (int c, struct it *it)
       && CHAR_TABLE_EXTRA_SLOTS (XCHAR_TABLE (Vglyphless_char_display)) >= 1)
     {
       if (c >= 0)
-       glyphless_method = CHAR_TABLE_REF (Vglyphless_char_display, c);
+       {
+         glyphless_method = CHAR_TABLE_REF (Vglyphless_char_display, c);
+         if (CONSP (glyphless_method))
+           glyphless_method = FRAME_WINDOW_P (it->f)
+             ? XCAR (glyphless_method)
+             : XCDR (glyphless_method);
+       }
       else
        glyphless_method = XCHAR_TABLE (Vglyphless_char_display)->extras[0];
 
@@ -31773,9 +31779,9 @@ gui_produce_glyphs (struct it *it)
          /* When no suitable font is found, display this character by
             the method specified in the first extra slot of
             Vglyphless_char_display.  */
-             Lisp_Object acronym = lookup_glyphless_char_display (-1, it);
+         Lisp_Object acronym = lookup_glyphless_char_display (-1, it);
 
-             eassert (it->what == IT_GLYPHLESS);
+         eassert (it->what == IT_GLYPHLESS);
          produce_glyphless_glyph (it, true,
                                   STRINGP (acronym) ? acronym : Qnil);
          goto done;
@@ -37109,16 +37115,20 @@ Each element, if non-nil, should be one of the 
following:
   `empty-box':  display as an empty box
   `thin-space': display as 1-pixel width space
   `zero-width': don't display
+Any other value is interpreted as `empty-box'.
 An element may also be a cons cell (GRAPHICAL . TEXT), which specifies the
 display method for graphical terminals and text terminals respectively.
 GRAPHICAL and TEXT should each have one of the values listed above.
 
-The char-table has one extra slot to control the display of a character for
-which no font is found.  This slot only takes effect on graphical terminals.
-Its value should be an ASCII acronym string, `hex-code', `empty-box', or
-`thin-space'.  It could also be a cons cell of any two of these, to specify
-separate values for graphical and text terminals.
-The default is `empty-box'.
+The char-table has one extra slot to control the display of characters
+for which no font is found on graphical terminals, and characters that
+cannot be displayed by text-mode terminals.  Its value should be an
+ASCII acronym string, `hex-code', `empty-box', or `thin-space'.  It
+could also be a cons cell of any two of these, to specify separate
+values for graphical and text terminals.  The default is `empty-box'.
+
+With the obvious exception of `zero-width', all the other representations
+are displayed using the face `glyphless-char'.
 
 If a character has a non-nil entry in an active display table, the
 display table takes effect; in this case, Emacs does not consult



reply via email to

[Prev in Thread] Current Thread [Next in Thread]