[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 90083b7 5/5: Merge from origin/emacs-27
From: |
Glenn Morris |
Subject: |
master 90083b7 5/5: Merge from origin/emacs-27 |
Date: |
Mon, 30 Dec 2019 12:12:39 -0500 (EST) |
branch: master
commit 90083b7d78df1b8a054f3028cc9eb8c55a632b1e
Merge: 00c9308 59f71d2
Author: Glenn Morris <address@hidden>
Commit: Glenn Morris <address@hidden>
Merge from origin/emacs-27
59f71d20ea (origin/emacs-27) Fix tar-mode reading the oldgnu Tar format
e3ec84fd7d Ensure mini-window is resized to show active minibuffer co...
450633f85a Fix mini-window resizing under resize-mini-windows = t
219d47893a (emacs-27) Fixes for makeinfo 4.13
4bbfd2b42f ; fix previous NEWS entry
81b697d106 Fix crash under -nw on macOS properly this time
9ce4207969 Revert "Check for GUI frame in ns_color_index_to_rgba"
732dcfc850 Ignore all color fonts when using XFT
aa0c679f48 Avoid unbounded growth of cl-random-state components (bug#...
# Conflicts:
# etc/NEWS
# src/nsterm.m
---
doc/lispref/customize.texi | 3 +--
doc/lispref/internals.texi | 4 ++--
etc/NEWS.27 | 8 ++++++++
lisp/emacs-lisp/cl-extra.el | 2 +-
lisp/tar-mode.el | 31 +++++++++++++++++++++++++------
src/dispextern.h | 4 +++-
src/ftfont.c | 17 ++++++++++++++++-
src/keyboard.c | 15 +++++++++++++++
src/nsterm.m | 25 ++++++++++---------------
src/window.c | 7 ++++++-
10 files changed, 87 insertions(+), 29 deletions(-)
diff --git a/doc/lispref/customize.texi b/doc/lispref/customize.texi
index b19feaf..a44446b 100644
--- a/doc/lispref/customize.texi
+++ b/doc/lispref/customize.texi
@@ -431,8 +431,7 @@ the build-time context. This also has the side-effect that
the
@kindex local@r{, @code{defcustom} keyword}
If the @var{value} is @code{t}, mark @var{option} as automatically
buffer-local; if the value is @code{permanent}, also set @var{option}s
-@code{permanent-local} property to @code{t}. @xref {Creating
-Buffer-Local}.
+@code{permanent-local} property to @code{t}. @xref{Creating Buffer-Local}.
@item :risky @var{value}
@kindex risky@r{, @code{defcustom} keyword}
diff --git a/doc/lispref/internals.texi b/doc/lispref/internals.texi
index 75e8345..2c47d67 100644
--- a/doc/lispref/internals.texi
+++ b/doc/lispref/internals.texi
@@ -972,7 +972,7 @@ The name of the variable to be used by Lisp programs.
The name of the variable in the C sources.
@item doc
The documentation for the variable, as a C
-comment. @xref{Documentation Basics} for more details.
+comment. @xref{Documentation Basics}, for more details.
@end table
By convention, when defining variables of a ``native'' type
@@ -1651,7 +1651,7 @@ little-endian magnitude of the return value.
The following example uses the GNU Multiprecision Library (GMP) to
calculate the next probable prime after a given integer.
-@xref{Top,,,gmp} for a general overview of GMP, and @pxref{Integer
+@xref{Top,,,gmp}, for a general overview of GMP, and @pxref{Integer
Import and Export,,,gmp} for how to convert the @code{magnitude} array
to and from GMP @code{mpz_t} values.
diff --git a/etc/NEWS.27 b/etc/NEWS.27
index e630bb7..0c055ca 100644
--- a/etc/NEWS.27
+++ b/etc/NEWS.27
@@ -296,6 +296,14 @@ To get the old, less-secure behavior, you can set the
*** When run by root, emacsclient no longer connects to non-root sockets.
(Instead you can use Tramp methods to run root commands in a non-root Emacs.)
+---
+** 'xft-ignore-color-fonts' now ignores even more color fonts.
+There are color fonts that managed to bypass the existing checks,
+causing XFT crashes, they are now filtered out. Setting
+'xft-ignore-color-fonts' to nil removes those checks, which might
+require setting 'face-ignored-fonts' to filter out problematic fonts.
+Known problematic fonts are "Noto Color Emoji" and "Emoji One".
+
+++
** New user option 'what-cursor-show-names'.
When non-nil, 'what-cursor-position' will show the name of the character
diff --git a/lisp/emacs-lisp/cl-extra.el b/lisp/emacs-lisp/cl-extra.el
index 7e9d8fe..2e0b37c 100644
--- a/lisp/emacs-lisp/cl-extra.el
+++ b/lisp/emacs-lisp/cl-extra.el
@@ -469,7 +469,7 @@ Optional second arg STATE is a random-state object."
(while (< (setq i (1+ i)) 200) (cl-random 2 state))))
(let* ((i (cl-callf (lambda (x) (% (1+ x) 55)) (cl--random-state-i state)))
(j (cl-callf (lambda (x) (% (1+ x) 55)) (cl--random-state-j state)))
- (n (logand 8388607 (aset vec i (- (aref vec i) (aref vec j))))))
+ (n (aset vec i (logand 8388607 (- (aref vec i) (aref vec j))))))
(if (integerp lim)
(if (<= lim 512) (% n lim)
(if (> lim 8388607) (setq n (+ (ash n 9) (cl-random 512 state))))
diff --git a/lisp/tar-mode.el b/lisp/tar-mode.el
index 569b01f..d3ad583 100644
--- a/lisp/tar-mode.el
+++ b/lisp/tar-mode.el
@@ -223,10 +223,14 @@ Preserve the modified states of the buffers and set
`buffer-swapped-with'."
"Round S up to the next multiple of 512."
(ash (ash (+ s 511) -9) 9))
-(defun tar-header-block-tokenize (pos coding)
+(defun tar-header-block-tokenize (pos coding &optional disable-slash)
"Return a `tar-header' structure.
This is a list of name, mode, uid, gid, size,
-write-date, checksum, link-type, and link-name."
+write-date, checksum, link-type, and link-name.
+CODING is our best guess for decoding non-ASCII file names.
+DISABLE-SLASH, if non-nil, means don't decide an entry is a directory
+based on the trailing slash, only based on the \"link-type\" field
+of the file header. This is used for \"old GNU\" Tar format."
(if (> (+ pos 512) (point-max)) (error "Malformed Tar header"))
(cl-assert (zerop (mod (- pos (point-min)) 512)))
(cl-assert (not enable-multibyte-characters))
@@ -272,7 +276,7 @@ write-date, checksum, link-type, and link-name."
(decode-coding-string name coding)
linkname
(decode-coding-string linkname coding))
- (if (and (null link-p) (string-match "/\\'" name))
+ (if (and (null link-p) (null disable-slash) (string-match "/\\'" name))
(setq link-p 5)) ; directory
(if (and (equal name "././@LongLink")
@@ -283,12 +287,23 @@ write-date, checksum, link-type, and link-name."
;; This is a GNU Tar long-file-name header.
(let* ((size (tar-parse-octal-integer
string tar-size-offset tar-time-offset))
- ;; -1 so as to strip the terminating 0 byte.
+ ;; The long name is in the next 512-byte block.
+ ;; We've already moved POS there, when we computed
+ ;; STRING above.
(name (decode-coding-string
+ ;; -1 so as to strip the terminating 0 byte.
(buffer-substring pos (+ pos size -1)) coding))
+ ;; Tokenize the header of the _real_ file entry,
+ ;; which is further 512 bytes into the archive.
(descriptor (tar-header-block-tokenize
- (+ pos (tar-roundup-512 size))
- coding)))
+ (+ pos (tar-roundup-512 size)) coding
+ ;; Don't intuit directories from
+ ;; the trailing slash, because the
+ ;; truncated name might by chance end
+ ;; in a slash.
+ 'ignore-trailing-slash)))
+ ;; Fix the descriptor of the real file entry by using
+ ;; the information from the long name entry.
(cond
((eq link-p (- ?L ?0)) ;GNUTYPE_LONGNAME.
(setf (tar-header-name descriptor) name))
@@ -296,6 +311,10 @@ write-date, checksum, link-type, and link-name."
(setf (tar-header-link-name descriptor) name))
(t
(message "Unrecognized GNU Tar @LongLink format")))
+ ;; Fix the "link-type" attribute, based on the long name.
+ (if (and (null (tar-header-link-type descriptor))
+ (string-match "/\\'" name))
+ (setf (tar-header-link-type descriptor) 5)) ; directory
(setf (tar-header-header-start descriptor)
(copy-marker (- pos 512) t))
descriptor)
diff --git a/src/dispextern.h b/src/dispextern.h
index 0615b16..4bf9f39 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -123,7 +123,9 @@ typedef HDC Emacs_Pix_Context;
#ifdef HAVE_NS
#include "nsgui.h"
-#define FACE_COLOR_TO_PIXEL(face_color, frame)
ns_color_index_to_rgba(face_color, frame)
+#define FACE_COLOR_TO_PIXEL(face_color, frame) (FRAME_NS_P (frame) \
+ ? ns_color_index_to_rgba
(face_color, frame) \
+ : face_color)
/* Following typedef needed to accommodate the MSDOS port, believe it or not.
*/
typedef struct ns_display_info Display_Info;
typedef Emacs_Pixmap Emacs_Pix_Container;
diff --git a/src/ftfont.c b/src/ftfont.c
index b8199dc..5bc048c 100644
--- a/src/ftfont.c
+++ b/src/ftfont.c
@@ -865,6 +865,9 @@ ftfont_list (struct frame *f, Lisp_Object spec)
#ifdef FC_FONTFORMAT
FC_FONTFORMAT,
#endif
+#if defined HAVE_XFT && defined FC_COLOR
+ FC_COLOR,
+#endif
NULL);
if (! objset)
goto err;
@@ -904,7 +907,19 @@ ftfont_list (struct frame *f, Lisp_Object spec)
for (i = 0; i < fontset->nfont; i++)
{
Lisp_Object entity;
-
+#if defined HAVE_XFT && defined FC_COLOR
+ {
+ /* Some fonts, notably NotoColorEmoji, have an FC_COLOR value
+ that's neither FcTrue nor FcFalse, which means FcFontList
+ returns them even when it shouldn't really do so, so we
+ need to manually skip them here (Bug#37786). */
+ FcBool b;
+ if (Vxft_ignore_color_fonts
+ && FcPatternGetBool (fontset->fonts[i], FC_COLOR, 0, &b)
+ == FcResultMatch && b != FcFalse)
+ continue;
+ }
+#endif
if (spacing >= 0)
{
int this;
diff --git a/src/keyboard.c b/src/keyboard.c
index 4cf1f64..cb311ef 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -1318,6 +1318,11 @@ command_loop_1 (void)
message1 (0);
safe_run_hooks (Qecho_area_clear_hook);
+ /* We cleared the echo area, and the minibuffer will now
+ show, so resize the mini-window in case the minibuffer
+ needs more or less space than the echo area. */
+ resize_mini_window (XWINDOW (minibuf_window), false);
+
unbind_to (count, Qnil);
/* If a C-g came in before, treat it as input now. */
@@ -2989,6 +2994,16 @@ read_char (int commandflag, Lisp_Object map,
{
safe_run_hooks (Qecho_area_clear_hook);
clear_message (1, 0);
+ /* If we were showing the echo-area message on top of an
+ active minibuffer, resize the mini-window, since the
+ minibuffer may need more or less space than the echo area
+ we've just wiped. */
+ if (minibuf_level
+ && EQ (minibuf_window, echo_area_window)
+ /* The case where minibuffer-message-timeout is a number
+ was already handled near the beginning of command_loop_1. */
+ && !NUMBERP (Vminibuffer_message_timeout))
+ resize_mini_window (XWINDOW (minibuf_window), false);
}
else if (FUNCTIONP (Vclear_message_function))
clear_message (1, 0);
diff --git a/src/nsterm.m b/src/nsterm.m
index c575e6c..ab571e4 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -2290,26 +2290,21 @@ ns_lisp_to_color (Lisp_Object color, NSColor **col)
/* Convert an index into the color table into an RGBA value. Used in
xdisp.c:extend_face_to_end_of_line when comparing faces and frame
- color values. No-op on non-gui frames. */
+ color values. */
unsigned long
ns_color_index_to_rgba(int idx, struct frame *f)
{
- if (FRAME_DISPLAY_INFO (f))
- {
- NSColor *col;
- col = ns_lookup_indexed_color (idx, f);
+ NSColor *col;
+ col = ns_lookup_indexed_color (idx, f);
- EmacsCGFloat r, g, b, a;
- [col getRed: &r green: &g blue: &b alpha: &a];
+ EmacsCGFloat r, g, b, a;
+ [col getRed: &r green: &g blue: &b alpha: &a];
- return ARGB_TO_ULONG((unsigned long) (a * 255),
- (unsigned long) (r * 255),
- (unsigned long) (g * 255),
- (unsigned long) (b * 255));
- }
- else
- return idx;
+ return ARGB_TO_ULONG((unsigned long) (a * 255),
+ (unsigned long) (r * 255),
+ (unsigned long) (g * 255),
+ (unsigned long) (b * 255));
}
void
@@ -2330,7 +2325,7 @@ ns_query_color(void *col, Emacs_Color *color_def, bool
setPixel)
if (setPixel == YES)
color_def->pixel
= ARGB_TO_ULONG((unsigned long) (a * 255),
- (unsigned long) (r * 255),
+ (unsigned long) (r * 255),
(unsigned long) (g * 255),
(unsigned long) (b * 255));
}
diff --git a/src/window.c b/src/window.c
index c52a8ca..1962e07 100644
--- a/src/window.c
+++ b/src/window.c
@@ -5229,10 +5229,15 @@ grow_mini_window (struct window *w, int delta)
{
struct frame *f = XFRAME (w->frame);
int old_height = window_body_height (w, true);
+ int min_height = FRAME_LINE_HEIGHT (f);
eassert (MINI_WINDOW_P (w));
- if ((delta != 0) && (old_height + delta >= FRAME_LINE_HEIGHT (f)))
+ /* Never shrink mini-window to less than its minimum height. */
+ if (old_height + delta < min_height)
+ delta = old_height > min_height ? min_height - old_height : 0;
+
+ if (delta != 0)
{
Lisp_Object root = FRAME_ROOT_WINDOW (f);
struct window *r = XWINDOW (root);