From 71661b287297f328c2c5ad67e180a760f80850cb Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 24 Oct 2020 15:34:12 -0700 Subject: [PATCH 1/5] Use WebKit sandboxing * src/xwidget.c (Fmake_xwidget): Enable sandboxing if WebKit 2.26 or later. Do this early, as required for sandboxing (Bug#43071). Co-authored-by: Qiantan Hong Copyright-paperwork-exempt: yes --- src/xwidget.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/xwidget.c b/src/xwidget.c index ea8987f5b3b..fb906d181ac 100644 --- a/src/xwidget.c +++ b/src/xwidget.c @@ -101,6 +101,13 @@ Returns the newly constructed xwidget, or nil if construction fails. */) if (EQ (xw->type, Qwebkit)) { block_input (); + WebKitWebContext *webkit_context = webkit_web_context_get_default (); + +# if WEBKIT_CHECK_VERSION (2, 26, 0) + if (!webkit_web_context_get_sandbox_enabled (webkit_context)) + webkit_web_context_set_sandbox_enabled (webkit_context, TRUE); +# endif + xw->widgetwindow_osr = gtk_offscreen_window_new (); gtk_window_resize (GTK_WINDOW (xw->widgetwindow_osr), xw->width, xw->height); @@ -139,7 +146,7 @@ Returns the newly constructed xwidget, or nil if construction fails. */) "load-changed", G_CALLBACK (webkit_view_load_changed_cb), xw); - g_signal_connect (G_OBJECT (webkit_web_context_get_default ()), + g_signal_connect (G_OBJECT (webkit_context), "download-started", G_CALLBACK (webkit_download_cb), xw); From e2005f1f2a7d7b743c79057565729375797c13ce Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Sun, 25 Oct 2020 12:44:01 +0100 Subject: [PATCH 2/5] * INSTALL: Mention efaq.texi for installation of intlfonts. --- INSTALL | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/INSTALL b/INSTALL index 2d257f9ce68..4d65f302aac 100644 --- a/INSTALL +++ b/INSTALL @@ -147,7 +147,9 @@ lisp/ps-mule.el defines the *.bdf font files required for printing each character set. The intlfonts distribution contains its own installation instructions, -in the intlfonts/README file. +in the intlfonts/README file. See also the Emacs Frequently Asked +Questions info pages "(efaq) How to add fonts" for installation +instructions. * Image support libraries From 20c02e628cb6126457e675d824d51ad4286c7c7a Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Mon, 26 Oct 2020 18:01:13 +0200 Subject: [PATCH 3/5] Improve documentation of display-fill-column-indicator * lisp/display-fill-column-indicator.el (display-fill-column-indicator-mode): Mention the globalized version in the doc string. * doc/emacs/display.texi (Displaying Boundaries): Improve and clarify the documentation of display-fill-column-indicator. Suggest using the minor mode as the primary means for turning the feature on. * src/xdisp.c (syms_of_xdisp) : Doc fix. (Bug#44226) --- doc/emacs/display.texi | 51 ++++++++++++++------------- lisp/display-fill-column-indicator.el | 2 ++ src/xdisp.c | 6 ++-- 3 files changed, 33 insertions(+), 26 deletions(-) diff --git a/doc/emacs/display.texi b/doc/emacs/display.texi index a4040d986e1..ed2fa8bf710 100644 --- a/doc/emacs/display.texi +++ b/doc/emacs/display.texi @@ -1173,31 +1173,34 @@ right-to-left paragraphs. @cindex mode, display-fill-column-indicator @findex display-fill-column-indicator-mode @findex global-display-fill-column-indicator-mode - Emacs can add an indicator to display a fill column position. The -fill column indicator is a useful functionality especially in -@code{prog-mode} to indicate the position of a specific column. + Emacs can display an indication of the @code{fill-column} position +(@pxref{Fill Commands}). The fill-column indicator is a useful +functionality especially in @code{prog-mode} and its descendants +(@pxref{Major Modes}) to indicate the position of a specific column +that has some special meaning for formatting the source code of a +program. - You can set the buffer-local variables + To activate the fill-column indication display, use the minor modes +@w{@kbd{M-x display-fill-column-indicator-mode}} and +@w{@kbd{M-x global-display-fill-column-indicator-mode}}, which enable +the indicator locally or globally, respectively. + +Alternatively, you can set the two buffer-local variables @code{display-fill-column-indicator} and @code{display-fill-column-indicator-character} to activate the -indicator and control how it looks, respectively. +indicator and control the character used for the indication. Note +that both variables must be non-@code{nil} for the indication to be +displayed. (Turning on the minor mode sets both these variables.) -Alternatively you can type @w{@kbd{M-x display-fill-column-indicator-mode}} -or @w{@kbd{M-x global-display-fill-column-indicator-mode}} which -enables the indicator locally or globally, respectively, and also -chooses the character to use if none is already set. It is possible -to use the first one to activate the indicator in a hook and the -second one to enable it globally. - -There are 2 buffer local variables and 1 face to customize this mode: +There are 2 buffer local variables and a face to customize this mode: @table @code @item display-fill-column-indicator-column @vindex display-fill-column-indicator-column Specifies the column number where the indicator should be set. It can -take positive numerical values for the column or the special value -@code{t} which means that the variable @code{fill-column} will be -used. +take positive numerical values for the column, or the special value +@code{t}, which means that the value of the variable +@code{fill-column} will be used. Any other value disables the indicator. The default value is @code{t}. @@ -1205,18 +1208,18 @@ Any other value disables the indicator. The default value is @code{t}. @vindex display-fill-column-indicator-character Specifies the character used for the indicator. This character can be any valid character including Unicode ones if the font supports them. - -When the mode is enabled through the functions -@code{display-fill-column-indicator-mode} or -@code{global-display-fill-column-indicator-mode}, the initialization -functions check if this variable is non-@code{nil}, otherwise the -initialization tries to set it to @code{U+2502} or @samp{|}. +The value @code{nil} disables the indicator. When the mode is enabled +through the functions @code{display-fill-column-indicator-mode} or +@code{global-display-fill-column-indicator-mode}, they will use the +character specified by this variable, if it is non-@code{nil}; +otherwise Emacs will use the character @samp{U+2502 VERTICAL LINE}, +falling back to @samp{|} if @code{U+2502} cannot be displayed. @item fill-column-indicator @vindex fill-column-indicator Specifies the face used to display the indicator. It inherits its -default values from the face @code{shadow} but without background -color. To change the indicator color you need only set the foreground +default values from the face @code{shadow}, but without background +color. To change the indicator color, you need only set the foreground color of this face. @end table diff --git a/lisp/display-fill-column-indicator.el b/lisp/display-fill-column-indicator.el index 3391aa371b7..2013fb13abd 100644 --- a/lisp/display-fill-column-indicator.el +++ b/lisp/display-fill-column-indicator.el @@ -51,6 +51,8 @@ This uses `display-fill-column-indicator' internally. To change the position of the column displayed by default customize `display-fill-column-indicator-column'. You can change the character for the indicator setting `display-fill-column-indicator-character'. +The globalized version is `global-display-fill-column-indicator-mode', +which see. See Info node `Displaying Boundaries' for details." :lighter nil (if display-fill-column-indicator-mode diff --git a/src/xdisp.c b/src/xdisp.c index 03dc4bec712..6c14a9a7b9d 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -35025,6 +35025,8 @@ It has no effect when set to 0, or when line numbers are not absolute. */); DEFVAR_BOOL ("display-fill-column-indicator", Vdisplay_fill_column_indicator, doc: /* Non-nil means display the fill column indicator. +If you set this non-nil, make sure `display-fill-column-indicator-character' +is also non-nil. See Info node `Displaying Boundaries' for details. */); Vdisplay_fill_column_indicator = false; DEFSYM (Qdisplay_fill_column_indicator, "display-fill-column-indicator"); @@ -35042,8 +35044,8 @@ See Info node `Displaying Boundaries' for details. */); DEFVAR_LISP ("display-fill-column-indicator-character", Vdisplay_fill_column_indicator_character, doc: /* Character to draw the indicator when `display-fill-column-indicator' is non-nil. -The default is U+2502 but a good alternative is (ascii 124) -if the font in fill-column-indicator face does not support Unicode characters. +A good candidate is U+2502, and an alternative is (ascii 124) if the +font of `fill-column-indicator' face does not support Unicode characters. See Info node `Displaying Boundaries' for details. */); Vdisplay_fill_column_indicator_character = Qnil; DEFSYM (Qdisplay_fill_column_indicator_character, "display-fill-column-indicator-character"); From a4ec03fa9be8315fba1be1658654be98643498ea Mon Sep 17 00:00:00 2001 From: Philipp Stephani Date: Mon, 26 Oct 2020 21:38:13 +0100 Subject: [PATCH 4/5] ; * etc/tutorials/TUTORIAL.de: Fix grammar (Bug#44246) --- etc/tutorials/TUTORIAL.de | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/tutorials/TUTORIAL.de b/etc/tutorials/TUTORIAL.de index 75c03a18e4a..2df066972e1 100644 --- a/etc/tutorials/TUTORIAL.de +++ b/etc/tutorials/TUTORIAL.de @@ -1276,7 +1276,7 @@ Funktion set-language-environment). Mittels C-x l latin-1 können Sie z.B. in einer laufenden Emacs-Sitzung auf Latin-1 -umzuschalten. Dadurch wird erreicht, dass Emacs beim Laden einer +umschalten. Dadurch wird erreicht, dass Emacs beim Laden einer Datei (und Speichern derselben) standardmäßig die Latin-1-Zeichenkodierung verwendet. Sie können an der Ziffer 1 unmittelbar vor dem Doppelpunkt links unten in der Statuszeile From e0de9f3295b4c46cb7198ec0b9634809d7b7a36d Mon Sep 17 00:00:00 2001 From: Clemens Radermacher Date: Tue, 27 Oct 2020 09:45:25 +0100 Subject: [PATCH 5/5] Don't skip empty lines when fitting mini frame to buffer (Bug#44080) * lisp/window.el (fit-mini-frame-to-buffer, window--resize-mini-frame, fit-frame-to-buffer, fit-frame-to-buffer-1): By default, fit a mini frame without skipping its buffer's leading or trailing empty lines. * src/frame.c (resize-mini-frames): Update doc-string. * lisp/cus-start.el (resize-mini-frames): Update for customize. * doc/lispref/minibuf.texi (resize-mini-frames): Update description. --- doc/lispref/minibuf.texi | 6 ++++-- etc/NEWS | 8 ++++++++ lisp/cus-start.el | 4 ++-- lisp/window.el | 24 +++++++++++++++++++++--- src/frame.c | 2 +- 5 files changed, 36 insertions(+), 8 deletions(-) diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi index ecab882fed7..b955355dc0a 100644 --- a/doc/lispref/minibuf.texi +++ b/doc/lispref/minibuf.texi @@ -2445,8 +2445,10 @@ frame is the buffer whose contents will be shown the next time that window is redisplayed. The function is expected to fit the frame to the buffer in some appropriate way. -Any other non-@code{nil} value means to resize minibuffer-only frames -by calling @code{fit-frame-to-buffer} (@pxref{Resizing Windows}). +Any other non-@code{nil} value means to resize minibuffer-only frames by +calling @code{fit-mini-frame-to-buffer}, a function that behaves like +@code{fit-frame-to-buffer} (@pxref{Resizing Windows}) but does not strip +leading or trailing empty lines from the buffer text. @end defopt diff --git a/etc/NEWS b/etc/NEWS index c3ee1cdd6a9..f0b5dd088af 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -32,6 +32,14 @@ applies, and please also update docstrings as needed. This is a bug-fix release with no new features. + +* Lisp Changes in Emacs 27.2 + +*** The behavior of the user option 'resize-mini-frames' has changed. +If set to non-nil, resize the mini frame using the new function +'fit-mini-frame-to-buffer' which won't skip leading or trailing empty +lines of the buffer. + * Editing Changes in Emacs 27.2 diff --git a/lisp/cus-start.el b/lisp/cus-start.el index 6632687da47..1d344893a5a 100644 --- a/lisp/cus-start.el +++ b/lisp/cus-start.el @@ -317,9 +317,9 @@ Leaving \"Default\" unchecked is equivalent with specifying a default of (resize-mini-frames frames (choice (const :tag "Never" nil) - (const :tag "Fit frame to buffer" t) + (const :tag "Fit mini frame to buffer" t) (function :tag "User-defined function")) - "27.1") + "27.2") (menu-bar-mode frames boolean nil ;; FIXME? ;; :initialize custom-initialize-default diff --git a/lisp/window.el b/lisp/window.el index 7b75495ad84..48005fc93e0 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -3406,7 +3406,7 @@ routines." "Resize minibuffer-only frame FRAME." (if (functionp resize-mini-frames) (funcall resize-mini-frames frame) - (fit-frame-to-buffer frame))) + (fit-mini-frame-to-buffer frame))) (defun window--sanitize-window-sizes (horizontal) "Assert that all windows on selected frame are large enough. @@ -8762,6 +8762,14 @@ Return 0 otherwise." (declare-function tool-bar-height "xdisp.c" (&optional frame pixelwise)) +(defun fit-mini-frame-to-buffer (&optional frame) + "Adjust size of minibuffer FRAME to display its contents. +FRAME should be a minibuffer-only frame and defaults to the +selected one. Unlike `fit-frame-to-buffer' FRAME will fit to the +contents of its buffer with any leading or trailing empty lines +included." + (fit-frame-to-buffer-1 frame)) + (defun fit-frame-to-buffer (&optional frame max-height min-height max-width min-width only) "Adjust size of FRAME to display the contents of its buffer exactly. FRAME can be any live frame and defaults to the selected one. @@ -8780,8 +8788,18 @@ horizontally only. The new position and size of FRAME can be additionally determined by customizing the options `fit-frame-to-buffer-sizes' and `fit-frame-to-buffer-margins' or setting the corresponding -parameters of FRAME." +parameters of FRAME. + +Any leading or trailing empty lines of the buffer content are not +considered." (interactive) + (fit-frame-to-buffer-1 frame max-height min-height max-width min-width only t t)) + +(defun fit-frame-to-buffer-1 (&optional frame max-height min-height max-width min-width only from to) + "Helper function for `fit-frame-to-buffer'. +FROM and TO are the buffer positions to determine the size to fit +to, see `window-text-pixel-size'. The remaining arguments are as +for `fit-frame-to-buffer'." (unless (fboundp 'display-monitor-attributes-list) (user-error "Cannot resize frame in non-graphic Emacs")) (setq frame (window-normalize-frame frame)) @@ -8916,7 +8934,7 @@ parameters of FRAME." ;; Note: Currently, for a new frame the sizes of the header ;; and mode line may be estimated incorrectly (size - (window-text-pixel-size window t t max-width max-height)) + (window-text-pixel-size window from to max-width max-height)) (width (max (car size) min-width)) (height (max (cdr size) min-height))) ;; Don't change height or width when the window's size is fixed diff --git a/src/frame.c b/src/frame.c index 255606957c2..adcc489a406 100644 --- a/src/frame.c +++ b/src/frame.c @@ -6204,7 +6204,7 @@ window of that frame is the buffer whose text will be eventually shown in the minibuffer window. Any other non-nil value means to resize minibuffer-only frames by -calling `fit-frame-to-buffer'. */); +calling `fit-mini-frame-to-buffer'. */); resize_mini_frames = Qnil; DEFVAR_LISP ("focus-follows-mouse", focus_follows_mouse,