commit 15fa8de1ae3228413fde95e583008d9b9f19e7c7 (HEAD, refs/remotes/origin/master) Author: João Távora Date: Fri May 11 23:28:40 2018 +0100 Fix filesystem littering by Flymake's legacy backend The Flymake legacy "proc" backend, which is active by default will try to syntax-check foo.c/foo.cpp and many other types of files, but on failing to find a suitable Makefile target, will fail. There's nothing wrong with that except that it used to leave behind the foo_flymake.c and foo_flymake.cpp auxiliary files behind, littering the filesystem. * lisp/progmodes/flymake-proc.el (flymake-proc-legacy-flymake): Call init-function inside of the unwind-protect. diff --git a/lisp/progmodes/flymake-proc.el b/lisp/progmodes/flymake-proc.el index 9bb328d6a6..867df7d138 100644 --- a/lisp/progmodes/flymake-proc.el +++ b/lisp/progmodes/flymake-proc.el @@ -793,43 +793,43 @@ can also be executed interactively independently of (flymake-proc--clear-buildfile-cache) (flymake-proc--clear-project-include-dirs-cache) - (let* ((cleanup-f (flymake-proc--get-cleanup-function buffer-file-name)) - (cmd-and-args (funcall init-f)) - (cmd (nth 0 cmd-and-args)) - (args (nth 1 cmd-and-args)) - (dir (nth 2 cmd-and-args)) - (success nil)) + (let ((cleanup-f (flymake-proc--get-cleanup-function buffer-file-name)) + (success nil)) (unwind-protect - (cond - ((not cmd-and-args) - (flymake-log 1 "init function %s for %s failed, cleaning up" - init-f buffer-file-name)) - (t - (setq proc - (let ((default-directory (or dir default-directory))) - (when dir - (flymake-log 3 "starting process on dir %s" dir)) - (make-process - :name "flymake-proc" - :buffer (current-buffer) - :command (cons cmd args) - :noquery t - :filter - (lambda (proc string) - (let ((flymake-proc--report-fn report-fn)) - (flymake-proc--process-filter proc string))) - :sentinel - (lambda (proc event) - (let ((flymake-proc--report-fn report-fn)) - (flymake-proc--process-sentinel proc event)))))) - (process-put proc 'flymake-proc--output-buffer - (generate-new-buffer - (format " *flymake output for %s*" (current-buffer)))) - (setq flymake-proc--current-process proc) - (flymake-log 2 "started process %d, command=%s, dir=%s" - (process-id proc) (process-command proc) - default-directory) - (setq success t))) + (let* ((cmd-and-args (funcall init-f)) + (cmd (nth 0 cmd-and-args)) + (args (nth 1 cmd-and-args)) + (dir (nth 2 cmd-and-args))) + (cond + ((not cmd-and-args) + (flymake-log 1 "init function %s for %s failed, cleaning up" + init-f buffer-file-name)) + (t + (setq proc + (let ((default-directory (or dir default-directory))) + (when dir + (flymake-log 3 "starting process on dir %s" dir)) + (make-process + :name "flymake-proc" + :buffer (current-buffer) + :command (cons cmd args) + :noquery t + :filter + (lambda (proc string) + (let ((flymake-proc--report-fn report-fn)) + (flymake-proc--process-filter proc string))) + :sentinel + (lambda (proc event) + (let ((flymake-proc--report-fn report-fn)) + (flymake-proc--process-sentinel proc event)))))) + (process-put proc 'flymake-proc--output-buffer + (generate-new-buffer + (format " *flymake output for %s*" (current-buffer)))) + (setq flymake-proc--current-process proc) + (flymake-log 2 "started process %d, command=%s, dir=%s" + (process-id proc) (process-command proc) + default-directory) + (setq success t)))) (unless success (funcall cleanup-f)))))))) commit e3d115ae86f7baa1483c5f14f1ac7d60d8aefa81 Author: Michael Albinus Date: Fri May 11 18:38:46 2018 +0200 Tramp updates * lisp/net/tramp-gvfs.el (tramp-gvfs-handle-file-attributes): Parse multibyte symlinks correctly. * test/lisp/net/tramp/tramp-tests.el (tramp--test-utf8): Improve backward compatibility. diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el index 199ac4fad2..a9a1a6085a 100644 --- a/lisp/net/tramp-gvfs.el +++ b/lisp/net/tramp-gvfs.el @@ -1158,6 +1158,18 @@ If FILE-SYSTEM is non-nil, return file system attributes." (setq dirp (if (equal "directory" (cdr (assoc "type" attributes))) t)) (setq res-symlink-target (cdr (assoc "standard::symlink-target" attributes))) + (when (stringp res-symlink-target) + (setq res-symlink-target + ;; Parse unibyte codes "\xNN". We assume they are + ;; non-ASCII codepoints in the range #x80 through #xff. + ;; Convert them to multibyte. + (decode-coding-string + (replace-regexp-in-string + "\\\\x\\([[:xdigit:]]\\{2\\}\\)" + (lambda (x) + (unibyte-string (string-to-number (match-string 1 x) 16))) + res-symlink-target) + 'utf-8))) ;; ... number links (setq res-numlinks (string-to-number diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index 15187efdd3..2c0b3199be 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -4716,7 +4716,7 @@ Use the `ls' command." (and (stringp (setq x (eval (get-language-info (car x) 'sample-text)))) (not (unencodable-char-position - 0 nil file-name-coding-system nil x)) + 0 (length x) file-name-coding-system nil x)) ;; ?\n and ?/ shouldn't be part of any file name. ?\t, ;; ?. and ?? do not work for "smb" method. (replace-regexp-in-string "[\t\n/.?]" "" x))) commit eabb6f6c3ee75dac1a7510e80bdd3c2fcfbbbcb5 Author: Basil L. Contovounesios Date: Tue May 1 13:48:30 2018 +0100 Rewrite scroll-other-window-down in C (bug#30207) * lisp/window.el (scroll-other-window-down): Move to src/window.c as Fscroll_other_window_down. * src/window.c (scroll_command): Generalise for arbitrary windows. (Fscroll_up, Fscroll_down): Use scroll_command with selected_window. (Fscroll_other_window, Fscroll_other_window_down): Rewrite in terms of scroll_command. (syms_of_window): Add Sscroll_other_window_down. diff --git a/lisp/window.el b/lisp/window.el index bc2008e1d9..085e51646f 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -8923,17 +8923,6 @@ This is different from `scroll-down-command' that scrolls a full screen." (put 'scroll-down-line 'scroll-command t) -(defun scroll-other-window-down (&optional lines) - "Scroll the \"other window\" down. -For more details, see the documentation for `scroll-other-window'." - (interactive "P") - (scroll-other-window - ;; Just invert the argument's meaning. - ;; We can do that without knowing which window it will be. - (if (eq lines '-) nil - (if (null lines) '- - (- (prefix-numeric-value lines)))))) - (defun beginning-of-buffer-other-window (arg) "Move point to the beginning of the buffer in the other window. Leave mark at previous position. diff --git a/src/window.c b/src/window.c index af317674bb..f654d87e14 100644 --- a/src/window.c +++ b/src/window.c @@ -5634,35 +5634,54 @@ window_scroll_line_based (Lisp_Object window, int n, bool whole, bool noerror) } -/* Scroll selected_window up or down. If N is nil, scroll a +/* Scroll WINDOW up or down. If N is nil, scroll upward by a screen-full which is defined as the height of the window minus - next_screen_context_lines. If N is the symbol `-', scroll. - DIRECTION may be 1 meaning to scroll down, or -1 meaning to scroll - up. This is the guts of Fscroll_up and Fscroll_down. */ + next_screen_context_lines. If N is the symbol `-', scroll downward + by a screen-full. DIRECTION may be 1 meaning to scroll down, or -1 + meaning to scroll up. */ static void -scroll_command (Lisp_Object n, int direction) +scroll_command (Lisp_Object window, Lisp_Object n, int direction) { + struct window *w; + bool other_window; ptrdiff_t count = SPECPDL_INDEX (); eassert (eabs (direction) == 1); - /* If selected window's buffer isn't current, make it current for + w = XWINDOW (window); + other_window = ! EQ (window, selected_window); + + /* If given window's buffer isn't current, make it current for the moment. But don't screw up if window_scroll gets an error. */ - if (XBUFFER (XWINDOW (selected_window)->contents) != current_buffer) + if (XBUFFER (w->contents) != current_buffer) { record_unwind_protect (save_excursion_restore, save_excursion_save ()); - Fset_buffer (XWINDOW (selected_window)->contents); + Fset_buffer (w->contents); + } + + if (other_window) + { + SET_PT_BOTH (marker_position (w->pointm), + marker_byte_position (w->pointm)); + SET_PT_BOTH (marker_position (w->old_pointm), + marker_byte_position (w->old_pointm)); } if (NILP (n)) - window_scroll (selected_window, direction, true, false); + window_scroll (window, direction, true, false); else if (EQ (n, Qminus)) - window_scroll (selected_window, -direction, true, false); + window_scroll (window, -direction, true, false); else { n = Fprefix_numeric_value (n); - window_scroll (selected_window, XINT (n) * direction, false, false); + window_scroll (window, XINT (n) * direction, false, false); + } + + if (other_window) + { + set_marker_both (w->pointm, Qnil, PT, PT_BYTE); + set_marker_both (w->old_pointm, Qnil, PT, PT_BYTE); } unbind_to (count, Qnil); @@ -5677,7 +5696,7 @@ If ARG is the atom `-', scroll downward by nearly full screen. When calling from a program, supply as argument a number, nil, or `-'. */) (Lisp_Object arg) { - scroll_command (arg, 1); + scroll_command (selected_window, arg, 1); return Qnil; } @@ -5690,7 +5709,7 @@ If ARG is the atom `-', scroll upward by nearly full screen. When calling from a program, supply as argument a number, nil, or `-'. */) (Lisp_Object arg) { - scroll_command (arg, -1); + scroll_command (selected_window, arg, -1); return Qnil; } @@ -5750,36 +5769,21 @@ It is determined by the function `other-window-for-scrolling', which see. */) (Lisp_Object arg) { - Lisp_Object window; - struct window *w; ptrdiff_t count = SPECPDL_INDEX (); - - window = Fother_window_for_scrolling (); - w = XWINDOW (window); - - /* Don't screw up if window_scroll gets an error. */ - record_unwind_protect (save_excursion_restore, save_excursion_save ()); - - Fset_buffer (w->contents); - SET_PT_BOTH (marker_position (w->pointm), marker_byte_position (w->pointm)); - SET_PT_BOTH (marker_position (w->old_pointm), marker_byte_position (w->old_pointm)); - - if (NILP (arg)) - window_scroll (window, 1, true, true); - else if (EQ (arg, Qminus)) - window_scroll (window, -1, true, true); - else - { - if (CONSP (arg)) - arg = XCAR (arg); - CHECK_NUMBER (arg); - window_scroll (window, XINT (arg), false, true); - } - - set_marker_both (w->pointm, Qnil, PT, PT_BYTE); - set_marker_both (w->old_pointm, Qnil, PT, PT_BYTE); + scroll_command (Fother_window_for_scrolling (), arg, 1); unbind_to (count, Qnil); + return Qnil; +} +DEFUN ("scroll-other-window-down", Fscroll_other_window_down, + Sscroll_other_window_down, 0, 1, "P", + doc: /* Scroll next window downward ARG lines; or near full screen if no ARG. +For more details, see the documentation for `scroll-other-window'. */) + (Lisp_Object arg) +{ + ptrdiff_t count = SPECPDL_INDEX (); + scroll_command (Fother_window_for_scrolling (), arg, -1); + unbind_to (count, Qnil); return Qnil; } @@ -7831,6 +7835,7 @@ displayed after a scrolling operation to be somewhat inaccurate. */); defsubr (&Sscroll_right); defsubr (&Sother_window_for_scrolling); defsubr (&Sscroll_other_window); + defsubr (&Sscroll_other_window_down); defsubr (&Sminibuffer_selected_window); defsubr (&Srecenter); defsubr (&Swindow_text_width); commit ae92f52c75383cf8f332db184d91f10fa8fb67cb Author: Basil L. Contovounesios Date: Tue May 1 16:05:52 2018 +0100 Simplify "other window" bob/eob motion commands * lisp/window.el (beginning-of-buffer-other-window) (end-of-buffer-other-window): Simplify via with-selected-window. (bug#30207) diff --git a/lisp/window.el b/lisp/window.el index 8055e5babc..bc2008e1d9 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -8939,19 +8939,12 @@ For more details, see the documentation for `scroll-other-window'." Leave mark at previous position. With arg N, put point N/10 of the way from the true beginning." (interactive "P") - (let ((orig-window (selected-window)) - (window (other-window-for-scrolling))) - ;; We use unwind-protect rather than save-window-excursion - ;; because the latter would preserve the things we want to change. - (unwind-protect - (progn - (select-window window) - ;; Set point and mark in that window's buffer. - (with-no-warnings - (beginning-of-buffer arg)) - ;; Set point accordingly. - (recenter '(t))) - (select-window orig-window)))) + (with-selected-window (other-window-for-scrolling) + ;; Set point and mark in that window's buffer. + (with-no-warnings + (beginning-of-buffer arg)) + ;; Set point accordingly. + (recenter '(t)))) (defun end-of-buffer-other-window (arg) "Move point to the end of the buffer in the other window. @@ -8959,15 +8952,10 @@ Leave mark at previous position. With arg N, put point N/10 of the way from the true end." (interactive "P") ;; See beginning-of-buffer-other-window for comments. - (let ((orig-window (selected-window)) - (window (other-window-for-scrolling))) - (unwind-protect - (progn - (select-window window) - (with-no-warnings - (end-of-buffer arg)) - (recenter '(t))) - (select-window orig-window)))) + (with-selected-window (other-window-for-scrolling) + (with-no-warnings + (end-of-buffer arg)) + (recenter '(t)))) (defvar mouse-autoselect-window-timer nil "Timer used by delayed window autoselection.") commit d5cf1b3160a5510198fc5dd4e28b3eca7aadf71b Author: Basil L. Contovounesios Date: Thu May 3 13:52:20 2018 +0100 Improve documentation for "other window" scrolling * doc/emacs/windows.texi (Other Window): * doc/lispref/windows.texi (Textual Scrolling): Document scroll-other-window-down. * doc/lispref/minibuf.texi (Minibuffer Misc): Cross-reference minibuffer-scroll-window with Textual Scrolling. * src/window.c (Fother_window_for_scrolling): Clarify how "other window" is determined in docstring. (Fscroll_other_window): Simplify docstring, pointing to that of Fother_window_for_scrolling. (bug#30207) diff --git a/doc/emacs/windows.texi b/doc/emacs/windows.texi index 809363305f..17ce4ad04d 100644 --- a/doc/emacs/windows.texi +++ b/doc/emacs/windows.texi @@ -157,7 +157,9 @@ this option is @code{nil}. @item C-x o Select another window (@code{other-window}). @item C-M-v -Scroll the next window (@code{scroll-other-window}). +Scroll the next window upward (@code{scroll-other-window}). +@item C-M-S-v +Scroll the next window downward (@code{scroll-other-window-down}). @item mouse-1 @kbd{mouse-1}, in the text area of a window, selects the window and moves point to the position clicked. Clicking in the mode line @@ -181,13 +183,18 @@ back and finish supplying the minibuffer argument that is requested. @kindex C-M-v @findex scroll-other-window +@kindex C-M-S-v +@findex scroll-other-window-down The usual scrolling commands (@pxref{Display}) apply to the selected -window only, but there is one command to scroll the next window. +window only, but there are also commands to scroll the next window. @kbd{C-M-v} (@code{scroll-other-window}) scrolls the window that -@kbd{C-x o} would select. It takes arguments, positive and negative, -like @kbd{C-v}. (In the minibuffer, @kbd{C-M-v} scrolls the help -window associated with the minibuffer, if any, rather than the next -window in the standard cyclic order; @pxref{Minibuffer Edit}.) +@kbd{C-x o} would select. In other respects, the command behaves like +@kbd{C-v}; both move the buffer text upward relative to the window, and +take positive and negative arguments. (In the minibuffer, @kbd{C-M-v} +scrolls the help window associated with the minibuffer, if any, rather +than the next window in the standard cyclic order; @pxref{Minibuffer +Edit}.) @kbd{C-M-S-v} (@code{scroll-other-window-down}) scrolls the +next window downward in a similar way. @vindex mouse-autoselect-window If you set @code{mouse-autoselect-window} to a non-@code{nil} value, diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi index 338e03ef74..889b64af8a 100644 --- a/doc/lispref/minibuf.texi +++ b/doc/lispref/minibuf.texi @@ -2462,7 +2462,7 @@ locally inside the minibuffer (@pxref{Help Functions}). @anchor{Definition of minibuffer-scroll-window} If the value of this variable is non-@code{nil}, it should be a window object. When the function @code{scroll-other-window} is called in the -minibuffer, it scrolls this window. +minibuffer, it scrolls this window (@pxref{Textual Scrolling}). @end defvar @defun minibuffer-selected-window diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi index f5de2fc90b..315ffd4f48 100644 --- a/doc/lispref/windows.texi +++ b/doc/lispref/windows.texi @@ -4028,6 +4028,13 @@ line reappears after the echo area momentarily displays the message @samp{End of buffer}. @end deffn +@deffn Command scroll-other-window-down &optional count +This function scrolls the text in another window downward @var{count} +lines. Negative values of @var{count}, or @code{nil}, are handled as +in @code{scroll-down}. In other respects, it behaves the same way as +@code{scroll-other-window} does. +@end deffn + @defvar other-window-scroll-buffer If this variable is non-@code{nil}, it tells @code{scroll-other-window} which buffer's window to scroll. diff --git a/src/window.c b/src/window.c index 59c9422029..af317674bb 100644 --- a/src/window.c +++ b/src/window.c @@ -5696,11 +5696,12 @@ When calling from a program, supply as argument a number, nil, or `-'. */) DEFUN ("other-window-for-scrolling", Fother_window_for_scrolling, Sother_window_for_scrolling, 0, 0, 0, doc: /* Return the other window for \"other window scroll\" commands. -If `other-window-scroll-buffer' is non-nil, a window -showing that buffer is used. If in the minibuffer, `minibuffer-scroll-window' if non-nil -specifies the window. This takes precedence over -`other-window-scroll-buffer'. */) +specifies the window. +Otherwise, if `other-window-scroll-buffer' is non-nil, a window +showing that buffer is used, popping the buffer up if necessary. +Finally, look for a neighboring window on the selected frame, +followed by all visible frames on the current terminal. */) (void) { Lisp_Object window; @@ -5739,16 +5740,14 @@ specifies the window. This takes precedence over DEFUN ("scroll-other-window", Fscroll_other_window, Sscroll_other_window, 0, 1, "P", doc: /* Scroll next window upward ARG lines; or near full screen if no ARG. A near full screen is `next-screen-context-lines' less than a full screen. -The next window is the one below the current one; or the one at the top -if the current one is at the bottom. Negative ARG means scroll downward. -If ARG is the atom `-', scroll downward by nearly full screen. -When calling from a program, supply as argument a number, nil, or `-'. - -If `other-window-scroll-buffer' is non-nil, scroll the window -showing that buffer, popping the buffer up if necessary. -If in the minibuffer, `minibuffer-scroll-window' if non-nil -specifies the window to scroll. This takes precedence over -`other-window-scroll-buffer'. */) +Negative ARG means scroll downward. If ARG is the atom `-', scroll +downward by nearly full screen. When calling from a program, supply +as argument a number, nil, or `-'. + +The next window is usually the one below the current one; +or the one at the top if the current one is at the bottom. +It is determined by the function `other-window-for-scrolling', +which see. */) (Lisp_Object arg) { Lisp_Object window; commit dc9188ada522743dd9c9a6658570d9c4973be432 Author: Basil L. Contovounesios Date: Mon Apr 30 18:02:15 2018 +0100 Limit "other window" scrolling to current terminal * src/window.c (Fother_window_for_scrolling): Limit next-window search to visible frames on the current terminal. (bug#30207) diff --git a/src/window.c b/src/window.c index e6d0280d9b..59c9422029 100644 --- a/src/window.c +++ b/src/window.c @@ -5709,8 +5709,7 @@ specifies the window. This takes precedence over && !NILP (Vminibuf_scroll_window)) window = Vminibuf_scroll_window; /* If buffer is specified and live, scroll that buffer. */ - else if (!NILP (Vother_window_scroll_buffer) - && BUFFERP (Vother_window_scroll_buffer) + else if (BUFFERP (Vother_window_scroll_buffer) && BUFFER_LIVE_P (XBUFFER (Vother_window_scroll_buffer))) { window = Fget_buffer_window (Vother_window_scroll_buffer, Qnil); @@ -5725,11 +5724,8 @@ specifies the window. This takes precedence over if (EQ (window, selected_window)) /* That didn't get us anywhere; look for a window on another - visible frame. */ - do - window = Fnext_window (window, Qnil, Qt); - while (! FRAME_VISIBLE_P (XFRAME (WINDOW_FRAME (XWINDOW (window)))) - && ! EQ (window, selected_window)); + visible frame on the current terminal. */ + window = Fnext_window (window, Qnil, Qvisible); } CHECK_LIVE_WINDOW (window);