From 01dfcb7c879831b5cf2614e35f9f610dfadb13a0 Mon Sep 17 00:00:00 2001 From: Martin Rudalics Date: Thu, 2 Jan 2020 09:35:49 +0100 Subject: [PATCH 1/7] Fix removal of frame decorations on Windows (Bug#38705) * src/w32fns.c (w32_set_undecorated): Actualize f->output_data.w32->dwStyle for subsequent calls of AdjustWindowRect (Bug#38705). * src/w32term.h (struct w32_output): Add comment for dwstyle slot. --- src/w32fns.c | 3 +++ src/w32term.h | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/src/w32fns.c b/src/w32fns.c index 75e0d531a23..61e22e57009 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -2146,6 +2146,9 @@ w32_set_undecorated (struct frame *f, Lisp_Object new_value, Lisp_Object old_val | SWP_FRAMECHANGED); FRAME_UNDECORATED (f) = false; } + + f->output_data.w32->dwStyle = GetWindowLong (hwnd, GWL_STYLE); + unblock_input (); } diff --git a/src/w32term.h b/src/w32term.h index 5a54f542365..737764b8942 100644 --- a/src/w32term.h +++ b/src/w32term.h @@ -371,6 +371,10 @@ struct w32_output /* Non-hourglass cursor that is currently active. */ HCURSOR current_cursor; + /* The window style for this frame. Set up when the frame is + created and updated when adding/removing decorations in + w32_set_undecorated. Used by w32_set_window_size to adjust the + frame's window rectangle. */ DWORD dwStyle; /* This is the Emacs structure for the display this frame is on. */ From 1420906b812852fab3ee37393db813afdf9e75b7 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Thu, 2 Jan 2020 19:34:30 +0200 Subject: [PATCH 2/7] * src/fileio.c (Fwrite_region): Improve the doc string. --- src/fileio.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/fileio.c b/src/fileio.c index 6e2fe2f0b82..34934dd6df6 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -4975,6 +4975,7 @@ Optional fourth argument APPEND if non-nil means Optional fifth argument VISIT, if t or a string, means set the last-save-file-modtime of buffer to this file's modtime and mark buffer not modified. +If VISIT is t, the buffer is marked as visiting FILENAME. If VISIT is a string, it is a second file name; the output goes to FILENAME, but the buffer is marked as visiting VISIT. VISIT is also the file name to lock and unlock for clash detection. From 37f9182b68c62ee1912cf28d4ea0c30b4f8d59e0 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 3 Jan 2020 09:28:35 +0200 Subject: [PATCH 3/7] Fix redisplay when mode-line-format changes mode-line's height * lisp/frame.el (top-level): Add mode-line-format, tab-line-format, and header-line-format to the list of variables that should trigger an immediate redisplay of the buffer's window. This fixes redisplay of windows when the mode line changes its height. * src/xdisp.c (window_box_height): Use the window's mode_line_height, tab_line_height, and header_line_height fields in preference to CURRENT_MODE_LINE_HEIGHT, CURRENT_TAB_LINE_HEIGHT, and CURRENT_HEADER_LINE_HEIGHT, respectively. This fixes display of vertical scroll bar when the height of the window's mode line changes. * src/dispnew.c (adjust_glyph_matrix): When resizing a window's matrix, reset the mode_line_p flag of the previous mode-line row, so that the window_box_height, CURRENT_MODE_LINE_HEIGHT, and their ilk won't use stale info. (Bug#38828) --- lisp/frame.el | 3 +++ src/dispnew.c | 7 ++++++ src/xdisp.c | 65 +++++++++++++++++++++++++++++++-------------------- 3 files changed, 50 insertions(+), 25 deletions(-) diff --git a/lisp/frame.el b/lisp/frame.el index c533e5a23fb..16ee7580f89 100644 --- a/lisp/frame.el +++ b/lisp/frame.el @@ -2725,6 +2725,9 @@ See also `toggle-frame-maximized'." line-prefix wrap-prefix truncate-lines + mode-line-format + header-line-format + tab-line-format display-line-numbers display-line-numbers-width display-line-numbers-current-absolute diff --git a/src/dispnew.c b/src/dispnew.c index b2a257090cc..ed8c5552e75 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -534,6 +534,13 @@ adjust_glyph_matrix (struct window *w, struct glyph_matrix *matrix, int x, int y eassert (left >= 0 && right >= 0); matrix->left_margin_glyphs = left; matrix->right_margin_glyphs = right; + + /* If we are resizing a window, make sure the previous mode-line + row of the window's current matrix is no longer marked as such. */ + if (w && matrix == w->current_matrix + && dim.height != matrix->nrows + && matrix->nrows <= matrix->rows_allocated) + MATRIX_MODE_LINE_ROW (matrix)->mode_line_p = false; } /* Number of rows to be used by MATRIX. */ diff --git a/src/xdisp.c b/src/xdisp.c index 6b677b63ae4..4856a7b13b6 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -1093,44 +1093,59 @@ window_box_height (struct window *w) /* Note: the code below that determines the mode-line/header-line/tab-line height is essentially the same as that contained in the macro - CURRENT_{MODE,HEADER}_LINE_HEIGHT, except that it checks whether - the appropriate glyph row has its `mode_line_p' flag set, - and if it doesn't, uses estimate_mode_line_height instead. */ + CURRENT_{MODE,HEADER,TAB}_LINE_HEIGHT, except that it checks whether + the appropriate glyph row has its `mode_line_p' flag set, and if + it doesn't, uses estimate_mode_line_height instead. */ if (window_wants_mode_line (w)) { - struct glyph_row *ml_row - = (w->current_matrix && w->current_matrix->rows - ? MATRIX_MODE_LINE_ROW (w->current_matrix) - : 0); - if (ml_row && ml_row->mode_line_p) - height -= ml_row->height; + if (w->mode_line_height >= 0) + height -= w->mode_line_height; else - height -= estimate_mode_line_height (f, CURRENT_MODE_LINE_FACE_ID (w)); + { + struct glyph_row *ml_row + = (w->current_matrix && w->current_matrix->rows + ? MATRIX_MODE_LINE_ROW (w->current_matrix) + : 0); + if (ml_row && ml_row->mode_line_p) + height -= ml_row->height; + else + height -= estimate_mode_line_height (f, + CURRENT_MODE_LINE_FACE_ID (w)); + } } if (window_wants_tab_line (w)) { - struct glyph_row *tl_row - = (w->current_matrix && w->current_matrix->rows - ? MATRIX_TAB_LINE_ROW (w->current_matrix) - : 0); - if (tl_row && tl_row->mode_line_p) - height -= tl_row->height; + if (w->tab_line_height >= 0) + height -= w->tab_line_height; else - height -= estimate_mode_line_height (f, TAB_LINE_FACE_ID); + { + struct glyph_row *tl_row + = (w->current_matrix && w->current_matrix->rows + ? MATRIX_TAB_LINE_ROW (w->current_matrix) + : 0); + if (tl_row && tl_row->mode_line_p) + height -= tl_row->height; + else + height -= estimate_mode_line_height (f, TAB_LINE_FACE_ID); + } } if (window_wants_header_line (w)) { - struct glyph_row *hl_row - = (w->current_matrix && w->current_matrix->rows - ? MATRIX_HEADER_LINE_ROW (w->current_matrix) - : 0); - if (hl_row && hl_row->mode_line_p) - height -= hl_row->height; - else - height -= estimate_mode_line_height (f, HEADER_LINE_FACE_ID); + if (w->header_line_height >= 0) + height -= w->header_line_height; + { + struct glyph_row *hl_row + = (w->current_matrix && w->current_matrix->rows + ? MATRIX_HEADER_LINE_ROW (w->current_matrix) + : 0); + if (hl_row && hl_row->mode_line_p) + height -= hl_row->height; + else + height -= estimate_mode_line_height (f, HEADER_LINE_FACE_ID); + } } /* With a very small font and a mode-line that's taller than From 09b65707cc7c4b401c7a4fb817749355b781da1a Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 3 Jan 2020 10:19:23 +0200 Subject: [PATCH 4/7] ; * src/dispnew.c (adjust_glyph_matrix): Fix last change. --- src/dispnew.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/dispnew.c b/src/dispnew.c index ed8c5552e75..9af1ce259d4 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -538,6 +538,7 @@ adjust_glyph_matrix (struct window *w, struct glyph_matrix *matrix, int x, int y /* If we are resizing a window, make sure the previous mode-line row of the window's current matrix is no longer marked as such. */ if (w && matrix == w->current_matrix + && matrix->nrows > 0 && dim.height != matrix->nrows && matrix->nrows <= matrix->rows_allocated) MATRIX_MODE_LINE_ROW (matrix)->mode_line_p = false; From 2d82f5a44e5c7a34035eae10d30e398aed914bbf Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Fri, 3 Jan 2020 13:18:52 +0100 Subject: [PATCH 5/7] Change Tramp version to 2.4.3.27.1 * doc/misc/trampver.texi: * lisp/net/trampver.el: Change version to "2.4.3.27.1". (customize-package-emacs-version-alist): Add Tramp version integrated in Emacs 27.1. --- doc/misc/trampver.texi | 2 +- lisp/net/trampver.el | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/doc/misc/trampver.texi b/doc/misc/trampver.texi index 6ee69117387..478ec7037a8 100644 --- a/doc/misc/trampver.texi +++ b/doc/misc/trampver.texi @@ -8,7 +8,7 @@ @c In the Tramp GIT, the version numbers are auto-frobbed from @c tramp.el, and the bug report address is auto-frobbed from @c configure.ac. -@set trampver 2.4.3 +@set trampver 2.4.3.27.1 @set tramp-bug-report-address tramp-devel@@gnu.org @set emacsver 24.4 diff --git a/lisp/net/trampver.el b/lisp/net/trampver.el index e5f628d8537..dacdd44102f 100644 --- a/lisp/net/trampver.el +++ b/lisp/net/trampver.el @@ -39,7 +39,7 @@ (defvar inhibit-message) ;;;###tramp-autoload -(defconst tramp-version "2.4.3" +(defconst tramp-version "2.4.3.27.1" "This version of Tramp.") ;;;###tramp-autoload @@ -73,7 +73,7 @@ ;; Check for Emacs version. (let ((x (if (not (string-lessp emacs-version "24.4")) "ok" - (format "Tramp 2.4.3 is not fit for %s" + (format "Tramp 2.4.3.27.1 is not fit for %s" (replace-regexp-in-string "\n" "" (emacs-version)))))) (unless (string-equal "ok" x) (error "%s" x))) @@ -92,7 +92,8 @@ ("2.2.13.25.1" . "25.1") ("2.2.13.25.2" . "25.2") ("2.2.13.25.2" . "25.3") ("2.3.3" . "26.1") ("2.3.3.26.1" . "26.1") ("2.3.5.26.2" . "26.2") - ("2.3.5.26.3" . "26.3"))) + ("2.3.5.26.3" . "26.3") + ("2.4.3.27.1" . "27.1"))) (add-hook 'tramp-unload-hook (lambda () From d3884f50e0d5e6235d41ff31914a851ebb0fafbd Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Fri, 3 Jan 2020 13:19:24 +0100 Subject: [PATCH 6/7] Adapt commentary in Tramp persistency file * lisp/net/tramp-cache.el (tramp-dump-connection-properties): Adapt commentary in `tramp-persistency-file-name'. --- lisp/net/tramp-cache.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/net/tramp-cache.el b/lisp/net/tramp-cache.el index d4f6aa00263..b81a1a23d5f 100644 --- a/lisp/net/tramp-cache.el +++ b/lisp/net/tramp-cache.el @@ -474,7 +474,7 @@ used to cache connection properties of the local machine." tramp-persistency-file-name)) (error "\n")) ";; Tramp connection history. Don't change this file.\n" - ";; You can delete it, forcing Tramp to reapply the checks.\n\n" + ";; Run `M-x tramp-cleanup-all-connections' instead.\n\n" (with-output-to-string (pp (read (format "(%s)" (tramp-cache-print cache))))))))))) From 06364316e0998d6906b8a42d54102c5de4a54990 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Fri, 3 Jan 2020 13:20:32 +0100 Subject: [PATCH 7/7] * lisp/net/tramp.el (tramp-file-local-name): New defun. (Bug#34343) --- lisp/net/tramp.el | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 1e52fae49f0..85330e98aa2 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -1329,6 +1329,25 @@ entry does not exist, return nil." (string-match-p tramp-file-name-regexp name) t)) +;; This function bypasses the file name handler approach. It is NOT +;; recommended to use it in any package if not absolutely necessary, +;; because it won't work for remote file names not supported by Tramp. +;; However, it is more performant than `file-local-name', and might be +;; useful where performance matters, like in operations over a bulk +;; list of file names. +(defun tramp-file-local-name (name) + "Return the local name component of NAME. +This function removes from NAME the specification of the remote +host and the method of accessing the host, leaving only the part +that identifies NAME locally on the remote system. NAME must be +a string that matches `tramp-file-name-regexp'. The returned +file name can be used directly as argument of ‘process-file’, +‘start-file-process’, or ‘shell-command’." + (save-match-data + (and (tramp-tramp-file-p name) + (string-match (nth 0 tramp-file-name-structure) name) + (match-string (nth 4 tramp-file-name-structure) name)))) + (defun tramp-find-method (method user host) "Return the right method string to use depending on USER and HOST. This is METHOD, if non-nil. Otherwise, do a lookup in