From 5abac8bf81ea4f5d7a9f7b008852c4d80d806c88 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 23 Jun 2018 10:26:33 +0300 Subject: [PATCH 1/6] * lisp/doc-view.el: Fix typos in the commentary. (Bug#31937) --- lisp/doc-view.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/doc-view.el b/lisp/doc-view.el index dfc4d887ae3..4a4862f8280 100644 --- a/lisp/doc-view.el +++ b/lisp/doc-view.el @@ -39,7 +39,7 @@ ;; ;; C-x C-f ~/path/to/document RET ;; -;; and the document will be converted and displayed, if your emacs supports png +;; and the document will be converted and displayed, if your emacs supports PNG ;; images. With `C-c C-c' you can toggle between the rendered images ;; representation and the source text representation of the document. ;; @@ -50,7 +50,7 @@ ;; `doc-view-clear-cache'. To open the cache with dired, so that you can tidy ;; it out use `doc-view-dired-cache'. ;; -;; When conversion in underway the first page will be displayed as soon as it +;; When conversion is underway the first page will be displayed as soon as it ;; is available and the available pages are refreshed every ;; `doc-view-conversion-refresh-interval' seconds. If that variable is nil the ;; pages won't be displayed before conversion of the document finished From decdfedf029904c3ecaa082e59e2501572ec77c9 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 23 Jun 2018 10:38:44 +0300 Subject: [PATCH 2/6] Clarify wording about functions' argument lists * doc/lispref/functions.texi (Argument List): Clarify the wording. (Bug#31872) --- doc/lispref/functions.texi | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/doc/lispref/functions.texi b/doc/lispref/functions.texi index 86181f1b491..93059e8e3a6 100644 --- a/doc/lispref/functions.texi +++ b/doc/lispref/functions.texi @@ -412,10 +412,14 @@ variables that tell you whether an argument was explicitly passed. binds @code{a} and @code{b} to the first two actual arguments, which are required. If one or two more arguments are provided, @code{c} and @code{d} are bound to them respectively; any arguments after the first -four are collected into a list and @code{e} is bound to that list. If -there are only two arguments, @code{c} is @code{nil}; if two or three -arguments, @code{d} is @code{nil}; if four arguments or fewer, @code{e} -is @code{nil}. +four are collected into a list and @code{e} is bound to that list. +Thus, if there are only two arguments, @code{c}, @code{d} and @code{e} +are @code{nil}; if two or three arguments, @code{d} and @code{e} are +@code{nil}; if four arguments or fewer, @code{e} is @code{nil}. Note +that exactly five arguments with an explicit @code{nil} argument +provided for @code{e} will cause that @code{nil} argument to be passed +as a list with one element, @code{(nil)}, as with any other single +value for @code{e}. There is no way to have required arguments following optional ones---it would not make sense. To see why this must be so, suppose From 8182d648cb18fb048495c761db7c21fbf3c2a624 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 23 Jun 2018 10:50:58 +0300 Subject: [PATCH 3/6] Improve documentation of 'server-start' and friends * lisp/server.el (server-start, server-running-p): Document how to reliably check that the current Emacs process started the server. (Bug#31859) --- lisp/server.el | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lisp/server.el b/lisp/server.el index ac0d7018513..270eff55dcd 100644 --- a/lisp/server.el +++ b/lisp/server.el @@ -599,7 +599,10 @@ running, ask the user for confirmation first, unless optional argument INHIBIT-PROMPT is non-nil. To force-start a server, do \\[server-force-delete] and then -\\[server-start]." +\\[server-start]. + +To check from a Lisp program whether a server is running, use +the `server-process' variable." (interactive "P") (when (or (not server-clients) ;; Ask the user before deleting existing clients---except @@ -725,7 +728,11 @@ Return values: nil the server is definitely not running. t the server seems to be running. something else we cannot determine whether it's running without using - commands which may have to wait for a long time." + commands which may have to wait for a long time. + +This function can return non-nil if the server was started by some other +Emacs process. To check from a Lisp program whether a server was started +by the current Emacs process, use the `server-process' variable." (unless name (setq name server-name)) (condition-case nil (if server-use-tcp From ecc29fbd5a73b55d4624c240b8a2d0a01d699e47 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 23 Jun 2018 14:03:10 +0300 Subject: [PATCH 4/6] Improve responsiveness while in 'replace-buffer-contents' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * src/editfns.c (buffer_chars_equal): Avoid calling buf_charpos_to_bytepos when the buffer is plain-ASCII. Suggested by Milan Stanojević . Call maybe_quit to improve responsiveness. (Freplace_buffer_contents): Call maybe_quit. Warn in the doc string that the function could be slow. (Bug#31888) --- src/editfns.c | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/src/editfns.c b/src/editfns.c index d15ae59029d..7c58391eb18 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -3147,7 +3147,9 @@ SOURCE can be a buffer or a string that names a buffer. Interactively, prompt for SOURCE. As far as possible the replacement is non-destructive, i.e. existing buffer contents, markers, properties, and overlays in the current -buffer stay intact. */) +buffer stay intact. +Warning: this function can be slow if there's a large number of small +differences between the two buffers. */) (Lisp_Object source) { struct buffer *a = current_buffer; @@ -3227,11 +3229,16 @@ buffer stay intact. */) walk backwards, we don’t have to keep the positions in sync. */ while (i >= 0 || j >= 0) { + /* Allow the user to quit if this gets too slow. */ + maybe_quit (); + /* Check whether there is a change (insertion or deletion) before the current position. */ if ((i > 0 && bit_is_set (ctx.deletions, i - 1)) || (j > 0 && bit_is_set (ctx.insertions, j - 1))) { + maybe_quit (); + ptrdiff_t end_a = min_a + i; ptrdiff_t end_b = min_b + j; /* Find the beginning of the current change run. */ @@ -3305,14 +3312,20 @@ buffer_chars_equal (struct context *ctx, eassert (pos_b >= BUF_BEGV (ctx->buffer_b)); eassert (pos_b < BUF_ZV (ctx->buffer_b)); + bool a_unibyte = BUF_ZV (ctx->buffer_a) == BUF_ZV_BYTE (ctx->buffer_a); + bool b_unibyte = BUF_ZV (ctx->buffer_b) == BUF_ZV_BYTE (ctx->buffer_b); + + /* Allow the user to escape out of a slow compareseq call. */ + maybe_quit (); + ptrdiff_t bpos_a = - NILP (BVAR (ctx->buffer_a, enable_multibyte_characters)) - ? pos_a - : buf_charpos_to_bytepos (ctx->buffer_a, pos_a); + a_unibyte ? pos_a : buf_charpos_to_bytepos (ctx->buffer_a, pos_a); ptrdiff_t bpos_b = - NILP (BVAR (ctx->buffer_b, enable_multibyte_characters)) - ? pos_b - : buf_charpos_to_bytepos (ctx->buffer_b, pos_b); + b_unibyte ? pos_b : buf_charpos_to_bytepos (ctx->buffer_b, pos_b); + + if (a_unibyte && b_unibyte) + return BUF_FETCH_BYTE (ctx->buffer_a, bpos_a) + == BUF_FETCH_BYTE (ctx->buffer_b, bpos_b); return BUF_FETCH_CHAR_AS_MULTIBYTE (ctx->buffer_a, bpos_a) == BUF_FETCH_CHAR_AS_MULTIBYTE (ctx->buffer_b, bpos_b); From 7caeef1622114d62570d507c4b4ba0f647bb4491 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 23 Jun 2018 15:34:14 +0300 Subject: [PATCH 5/6] * src/editfns.c (Fformat): Make %x easier to spot in doc string. (Bug#31945) --- src/editfns.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/editfns.c b/src/editfns.c index 7c58391eb18..4fba68692bf 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -4105,7 +4105,8 @@ the next available argument, or the argument explicitly specified: %s means print a string argument. Actually, prints any object, with `princ'. %d means print as signed number in decimal. -%o means print as unsigned number in octal, %x as unsigned number in hex. +%o means print as unsigned number in octal. +%x means print as unsigned number in hex. %X is like %x, but uses upper case. %e means print a number in exponential notation. %f means print a number in decimal-point notation. From bbc9d3793d86b855045ed322253f687fcd82aa68 Mon Sep 17 00:00:00 2001 From: Leo Liu Date: Tue, 12 Jun 2018 12:24:09 +0800 Subject: [PATCH 6/6] Fix previous change in minibuffer-default-add-dired-shell-commands The mailcap minibuffer completion used dynamic binding. Locally set a dynamic variable. * lisp/dired-aux.el (minibuffer-default-add-dired-shell-commands): Store list of files in 'minibuffer-completion-table'. (Bug#31794) --- lisp/dired-aux.el | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index c336103f80b..516cd2c5672 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -614,14 +614,16 @@ with a prefix argument." (declare-function mailcap-file-default-commands "mailcap" (files)) +(defvar dired-aux-files) + (defun minibuffer-default-add-dired-shell-commands () "Return a list of all commands associated with current dired files. This function is used to add all related commands retrieved by `mailcap' to the end of the list of defaults just after the default value." (interactive) - (let* ((files minibuffer-completion-table) - (commands (and (require 'mailcap nil t) - (mailcap-file-default-commands files)))) + (let ((commands (and (boundp 'dired-aux-files) + (require 'mailcap nil t) + (mailcap-file-default-commands dired-aux-files)))) (if (listp minibuffer-default) (append minibuffer-default commands) (cons minibuffer-default commands)))) @@ -639,9 +641,9 @@ This normally reads using `read-shell-command', but if the offer a smarter default choice of shell command." (minibuffer-with-setup-hook (lambda () - (set (make-local-variable 'minibuffer-completion-table) files) - (set (make-local-variable 'minibuffer-default-add-function) - 'minibuffer-default-add-dired-shell-commands)) + (setq-local dired-aux-files files) + (setq-local minibuffer-default-add-function + #'minibuffer-default-add-dired-shell-commands)) (setq prompt (format prompt (dired-mark-prompt arg files))) (if (functionp 'dired-guess-shell-command) (dired-mark-pop-up nil 'shell files