commit 241ae7a151c0cc8c09ab82d096a8b68eae16133a (HEAD, refs/remotes/origin/master) Author: Noam Postavsky Date: Sat Oct 22 15:55:21 2016 -0400 Avoid infinite hscrolling in redisplay * src/xdisp.c (redisplay_internal): Add a counter to avoid horizontal scrolling (e.g., caused by pre-redisplay-functions) triggering infinite redisplay (Bug #24633). diff --git a/src/xdisp.c b/src/xdisp.c index 3af5ea4..1a27c4c 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -13528,6 +13528,12 @@ redisplay_internal (void) bool polling_stopped_here = false; Lisp_Object tail, frame; + /* Set a limit to the number of retries we perform due to horizontal + scrolling, this avoids getting stuck in an uninterruptible + infinite loop (Bug #24633). */ + enum { MAX_HSCROLL_RETRIES = 16 }; + int hscroll_retries = 0; + /* True means redisplay has to consider all windows on all frames. False, only selected_window is considered. */ bool consider_all_windows_p; @@ -14044,8 +14050,12 @@ redisplay_internal (void) if (!f->already_hscrolled_p) { f->already_hscrolled_p = true; - if (hscroll_windows (f->root_window)) - goto retry_frame; + if (hscroll_retries <= MAX_HSCROLL_RETRIES + && hscroll_windows (f->root_window)) + { + hscroll_retries++; + goto retry_frame; + } } /* If the frame's redisplay flag was not set before @@ -14143,8 +14153,12 @@ redisplay_internal (void) if (FRAME_VISIBLE_P (sf) && !FRAME_OBSCURED_P (sf)) { - if (hscroll_windows (selected_window)) - goto retry; + if (hscroll_retries <= MAX_HSCROLL_RETRIES + && hscroll_windows (selected_window)) + { + hscroll_retries++; + goto retry; + } XWINDOW (selected_window)->must_be_updated_p = true; pending = update_frame (sf, false, false); @@ -14164,8 +14178,12 @@ redisplay_internal (void) XWINDOW (mini_window)->must_be_updated_p = true; pending |= update_frame (mini_frame, false, false); mini_frame->cursor_type_changed = false; - if (!pending && hscroll_windows (mini_window)) - goto retry; + if (!pending && hscroll_retries <= MAX_HSCROLL_RETRIES + && hscroll_windows (mini_window)) + { + hscroll_retries++; + goto retry; + } } } commit abd1642e1e4615c0bf7abc5014ebbd760f037883 Author: Michael Albinus Date: Sat Oct 22 13:54:56 2016 +0200 Fix error codes in Tramp * lisp/net/tramp-compat.el (tramp-compat-user-error): New defsubst, taken from tramp.el. (tramp-file-missing): New defconst. * lisp/net/tramp.el (tramp-user-error): Remove it. (tramp-check-proper-method-and-host) (tramp-dissect-file-name, tramp-debug-message) (tramp-handle-shell-command): * lisp/net/tramp-adb.el (tramp-adb-handle-shell-command): * lisp/net/tramp-gvfs.el (tramp-gvfs-file-name-handler): Use `tramp-compat-user-error'. * lisp/net/tramp.el (tramp-handle-insert-file-contents) (tramp-handle-load): * lisp/net/tramp-adb.el (tramp-adb-handle-file-local-copy): * lisp/net/tramp-gvfs.el (tramp-gvfs-handle-file-local-copy) * lisp/net/tramp-sh.el (tramp-sh-handle-file-local-copy): * lisp/net/tramp-smb.el (tramp-smb-handle-file-local-copy): Use `tramp-file-missing'. (Bug#24714) * lisp/net/tramp-sh.el (tramp-sh-handle-add-name-to-file): * lisp/net/tramp-smb.el (tramp-smb-handle-make-symbolic-link): Use `file-already-exists'. diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el index 3eb1bc4..259b1cb 100644 --- a/lisp/net/tramp-adb.el +++ b/lisp/net/tramp-adb.el @@ -571,7 +571,7 @@ Emacs dired can't find files." (with-parsed-tramp-file-name filename nil (unless (file-exists-p (file-truename filename)) (tramp-error - v 'file-error + v tramp-file-missing "Cannot make local copy of non-existing file `%s'" filename)) (let ((tmpfile (tramp-compat-make-temp-file filename))) (with-tramp-progress-reporter @@ -897,7 +897,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored." (when p (if (yes-or-no-p "A command is running. Kill it? ") (ignore-errors (kill-process p)) - (tramp-user-error p "Shell command in progress"))) + (tramp-compat-user-error p "Shell command in progress"))) (if current-buffer-p (progn diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el index e953170..4ebae79 100644 --- a/lisp/net/tramp-compat.el +++ b/lisp/net/tramp-compat.el @@ -23,8 +23,9 @@ ;;; Commentary: -;; Tramp's main Emacs version for development is Emacs 25. This -;; package provides compatibility functions for Emacs 23 and Emacs 24. +;; Tramp's main Emacs version for development is Emacs 26. This +;; package provides compatibility functions for Emacs 23, Emacs 24 and +;; Emacs 25. ;;; Code: @@ -261,6 +262,13 @@ process." (memq (process-status process) '(run open listen connect stop)))))) +;; `user-error' has appeared in Emacs 24.3. +(defsubst tramp-compat-user-error (vec-or-proc format &rest args) + "Signal a pilot error." + (apply + 'tramp-error vec-or-proc + (if (fboundp 'user-error) 'user-error 'error) format args)) + ;; `file-attribute-*' are introduced in Emacs 25.1. (if (fboundp 'file-attribute-type) @@ -328,6 +336,11 @@ This is a string of ten letters or dashes as in ls -l." (unless (fboundp 'format-message) (defalias 'format-message 'format)) +;; `file-missing' is introduced in Emacs 26. +(defconst tramp-file-missing + (if (get 'file-missing 'error-conditions) 'file-missing 'file-error) + "The error symbol for the `file-missing' error.") + (add-hook 'tramp-unload-hook (lambda () (unload-feature 'tramp-loaddefs 'force) diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el index 3d8d366..637c2a7 100644 --- a/lisp/net/tramp-gvfs.el +++ b/lisp/net/tramp-gvfs.el @@ -541,7 +541,7 @@ Operations not mentioned here will be handled by the default Emacs primitives.") First arg specifies the OPERATION, second arg is a list of arguments to pass to the OPERATION." (unless tramp-gvfs-enabled - (tramp-user-error nil "Package `tramp-gvfs' not supported")) + (tramp-compat-user-error nil "Package `tramp-gvfs' not supported")) (let ((fn (assoc operation tramp-gvfs-file-name-handler-alist))) (if fn (save-match-data (apply (cdr fn) args)) @@ -1033,7 +1033,7 @@ file names." (let ((tmpfile (tramp-compat-make-temp-file filename))) (unless (file-exists-p filename) (tramp-error - v 'file-error + v tramp-file-missing "Cannot make local copy of non-existing file `%s'" filename)) (copy-file filename tmpfile 'ok-if-already-exists 'keep-time) tmpfile))) diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 6196b15..555e371 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -1960,7 +1960,8 @@ tramp-sh-handle-file-name-all-completions: internal error accessing `%s': `%s'" "File %s already exists; make it a new name anyway? " newname))) (tramp-error - v2 'file-error "add-name-to-file: file %s already exists" newname)) + v2 'file-already-exists + "add-name-to-file: file %s already exists" newname)) (when ok-if-already-exists (setq ln (concat ln " -f"))) (tramp-flush-file-property v2 (file-name-directory v2-localname)) (tramp-flush-file-property v2 v2-localname) @@ -3130,7 +3131,7 @@ the result will be a local, non-Tramp, file name." (with-parsed-tramp-file-name filename nil (unless (file-exists-p filename) (tramp-error - v 'file-error + v tramp-file-missing "Cannot make local copy of non-existing file `%s'" filename)) (let* ((size (tramp-compat-file-attribute-size diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el index fe24edb..0c8ecf4 100644 --- a/lisp/net/tramp-smb.el +++ b/lisp/net/tramp-smb.el @@ -902,7 +902,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored." (with-parsed-tramp-file-name filename nil (unless (file-exists-p filename) (tramp-error - v 'file-error + v tramp-file-missing "Cannot make local copy of non-existing file `%s'" filename)) (let ((tmpfile (tramp-compat-make-temp-file filename))) (with-tramp-progress-reporter @@ -1125,7 +1125,7 @@ target of the symlink differ." "File %s already exists; make it a new name anyway? " linkname))) (tramp-error - v2 'file-error + v2 'file-already-exists "make-symbolic-link: file %s already exists" linkname)) (unless (tramp-smb-get-cifs-capabilities v1) (tramp-error v2 'file-error "make-symbolic-link not supported")) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 7af40a8..730972e 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -1068,13 +1068,6 @@ calling HANDLER.") ;;; Internal functions which must come first: -;; `user-error' has appeared in Emacs 24.3. -(defsubst tramp-user-error (vec-or-proc format &rest args) - "Signal a pilot error." - (apply - 'tramp-error vec-or-proc - (if (fboundp 'user-error) 'user-error 'error) format args)) - ;; Conversion functions between external representation and ;; internal data structure. Convenience functions for internal ;; data structure. @@ -1230,13 +1223,14 @@ This is HOST, if non-nil. Otherwise, it is `tramp-default-host'." (methods (mapcar 'car tramp-methods))) (when (and method (not (member method methods))) (tramp-cleanup-connection vec) - (tramp-user-error vec "Unknown method \"%s\"" method)) + (tramp-compat-user-error vec "Unknown method \"%s\"" method)) (when (and (equal tramp-syntax 'ftp) host (or (null method) (get-text-property 0 'tramp-default method)) (or (null user) (get-text-property 0 'tramp-default user)) (member host methods)) (tramp-cleanup-connection vec) - (tramp-user-error vec "Host name must not match method \"%s\"" host)))) + (tramp-compat-user-error + vec "Host name must not match method \"%s\"" host)))) (defun tramp-dissect-file-name (name &optional nodefault) "Return a `tramp-file-name' structure. @@ -1246,7 +1240,8 @@ non-nil, the file name parts are not expanded to their default values." (save-match-data (let ((match (string-match (nth 0 tramp-file-name-structure) name))) - (unless match (tramp-user-error nil "Not a Tramp file name: \"%s\"" name)) + (unless match + (tramp-compat-user-error nil "Not a Tramp file name: \"%s\"" name)) (let ((method (match-string (nth 1 tramp-file-name-structure) name)) (user (match-string (nth 2 tramp-file-name-structure) name)) (host (match-string (nth 3 tramp-file-name-structure) name)) @@ -1434,12 +1429,12 @@ ARGUMENTS to actually emit the message (if applicable)." '("tramp-backtrace" "tramp-compat-condition-case-unless-debug" "tramp-compat-funcall" + "tramp-compat-user-error" "tramp-condition-case-unless-debug" "tramp-debug-message" "tramp-error" "tramp-error-with-buffer" - "tramp-message" - "tramp-user-error") + "tramp-message") t) "$") fn))) @@ -3035,7 +3030,8 @@ User is always nil." (unwind-protect (if (not (file-exists-p filename)) (tramp-error - v 'file-error "File `%s' not found on remote host" filename) + v tramp-file-missing + "File `%s' not found on remote host" filename) (with-tramp-progress-reporter v 3 (format-message "Inserting `%s'" filename) @@ -3160,7 +3156,8 @@ User is always nil." "File `%s' does not include a `.el' or `.elc' suffix" file))) (unless noerror (when (not (file-exists-p file)) - (tramp-error v 'file-error "Cannot load nonexistent file `%s'" file))) + (tramp-error + v tramp-file-missing "Cannot load nonexistent file `%s'" file))) (if (not (file-exists-p file)) nil (let ((tramp-message-show-message (not nomessage))) @@ -3221,7 +3218,7 @@ User is always nil." (when p (if (yes-or-no-p "A command is running. Kill it? ") (ignore-errors (kill-process p)) - (tramp-user-error p "Shell command in progress"))) + (tramp-compat-user-error p "Shell command in progress"))) (if current-buffer-p (progn commit d4a32c4d5955ac04c5017a43042d873e42b3ebec Author: Jorgen Schaefer Date: Sat Oct 22 13:07:32 2016 +0200 Autoload all commands from misc.el Only two of the commands there were autoloaded, one of which is an easter egg. * lisp/miscl.el (copy-from-above-command): * lisp/miscl.el (zap-up-to-char): * lisp/miscl.el (mark-beginning-of-buffer): * lisp/miscl.el (mark-end-of-buffer): * lisp/miscl.el (upcase-char): * lisp/miscl.el (forward-to-word): * lisp/miscl.el (backward-to-word): Add autoload cookie. diff --git a/lisp/misc.el b/lisp/misc.el index 5fc3e7d..3a73977 100644 --- a/lisp/misc.el +++ b/lisp/misc.el @@ -28,6 +28,7 @@ (eval-when-compile (require 'tabulated-list)) +;;;###autoload (defun copy-from-above-command (&optional arg) "Copy characters from previous nonblank line, starting just above point. Copy ARG characters, but not past the end of that line. @@ -62,6 +63,7 @@ The characters copied are inserted in the buffer before point." ;; Variation of `zap-to-char'. +;;;###autoload (defun zap-up-to-char (arg char) "Kill up to, but not including ARGth occurrence of CHAR. Case is ignored if `case-fold-search' is non-nil in the current buffer. @@ -80,22 +82,26 @@ Ignores CHAR at point." ;; These were added with an eye to making possible a more CCA-compatible ;; command set; but that turned out not to be interesting. +;;;###autoload (defun mark-beginning-of-buffer () "Set mark at the beginning of the buffer." (interactive) (push-mark (point-min))) +;;;###autoload (defun mark-end-of-buffer () "Set mark at the end of the buffer." (interactive) (push-mark (point-max))) +;;;###autoload (defun upcase-char (arg) "Uppercasify ARG chars starting from point. Point doesn't move." (interactive "p") (save-excursion (upcase-region (point) (progn (forward-char arg) (point))))) +;;;###autoload (defun forward-to-word (arg) "Move forward until encountering the beginning of a word. With argument, do this that many times." @@ -103,6 +109,7 @@ With argument, do this that many times." (or (re-search-forward (if (> arg 0) "\\W\\b" "\\b\\W") nil t arg) (goto-char (if (> arg 0) (point-max) (point-min))))) +;;;###autoload (defun backward-to-word (arg) "Move backward until encountering the end of a word. With argument, do this that many times." commit d45be6bc45a321b7fd934c20e382509f9daf3f49 Author: Martin Rudalics Date: Sat Oct 22 11:52:39 2016 +0200 On terminal frames ignore minibuffer frame parameter (Bug#24758) * src/frame.c (Fmake_terminal_frame): Don't complain when the caller asks for a deviant minibuffer setting (Bug#24758). diff --git a/src/frame.c b/src/frame.c index a1c2199..f3a548c 100644 --- a/src/frame.c +++ b/src/frame.c @@ -1067,6 +1067,10 @@ affects all frames on the same terminal device. */) (t->display_info.tty->name ? build_string (t->display_info.tty->name) : Qnil)); + /* On terminal frames the `minibuffer' frame parameter is always + virtually t. Avoid that a different value in parms causes + complaints, see Bug#24758. */ + store_in_alist (&parms, Qminibuffer, Qt); Fmodify_frame_parameters (frame, parms); /* Make the frame face alist be frame-specific, so that each