commit f069ea4f84a94bfbbd444073729f81fdd27c9445 (HEAD, refs/remotes/origin/master) Merge: 03e1012be4 408862f02a Author: Glenn Morris Date: Wed Nov 29 17:12:56 2017 -0800 Merge from origin/emacs-26 408862f02a (origin/emacs-26) ; * lisp/emacs-lisp/bytecomp.el: Tweak m... 9964db4c34 Restore obsolete method of changing byte-compile-dest-file 3dd25aeecb Some minor Tramp corrections d670a15f25 * doc/misc/url.texi (http/https): Fix typo 99d07e8d5e Remove some bogus definition-prefixes from loaddefs 6067f0c702 Shell-quote wildcards when invoking 'vc-git-grep' 0540df10e6 Update documentation of '.dir-locals-2.el' f2441ab320 ; Fix some tiny doc and comment typos 22ff46e6d8 ; Fix some comment typos # Conflicts: # etc/NEWS commit 03e1012be4028e653bd88c93846b17172b5c0faa Merge: 328a275305 340f74daa8 Author: Glenn Morris Date: Wed Nov 29 17:12:06 2017 -0800 ; Merge from origin/emacs-26 The following commit was skipped: 340f74daa8 * src/w32heap.c (DUMPED_HEAP_SIZE) [_WIN64]: Bump to 22 MiB. commit 328a2753057076f38c0678ba9c5b1b86af7a8b24 Merge: fefd7f21f3 f2e6961a1b Author: Glenn Morris Date: Wed Nov 29 17:12:06 2017 -0800 Merge from origin/emacs-26 f2e6961a1b ; * lisp/emacs-lisp/bytecomp.el (byte-compile-dest-file): ... 1c8bd8a119 A few small doc fixes for bytecomp.el commit fefd7f21f3a5ad6ce5c09da5b7cbacd84457e9eb Merge: 7aedb6116f 37f3a6b216 Author: Glenn Morris Date: Wed Nov 29 17:12:06 2017 -0800 ; Merge from origin/emacs-26 The following commit was skipped: 37f3a6b216 * src/lread.c (syms_of_lread): Fix thinko in commit b1573a... commit 7aedb6116ffaa6590c86e70380f533385c1ced58 Merge: 728d259243 02d114d6b8 Author: Glenn Morris Date: Wed Nov 29 17:12:05 2017 -0800 Merge from origin/emacs-26 02d114d6b8 * lisp/tree-widget.el (tree-widget-end-guide): Escape it. ... 0a85d12474 Fix ELisp "Warning Tips" 06d05fec84 Fix Bug#29163 ac64fdb248 Harden exec_byte_code against redefining 'error' 700f74e4c8 Fix Edebug specs for if-let* and and-let* (Bug#29236) 0ded1b41a9 Fix Edebug's handling of dotted specs (bug#6415) 16358d4fcb Improve documentation of "constant" symbols commit 728d259243206136387b6b59c2efb7de8cd9f6ed Author: Stefan Monnier Date: Wed Nov 29 17:38:46 2017 -0500 * lisp/gnus/message.el: Use pcase and cl-lib (message-check-news-body-syntax): Avoid string-to-multibyte. diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index 445911fc6d..1f1302e3fc 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -28,8 +28,7 @@ ;;; Code: -(eval-when-compile - (require 'cl)) +(eval-when-compile (require 'cl-lib)) (require 'mailheader) (require 'gmm-utils) @@ -2444,7 +2443,7 @@ Return the number of headers removed." (not (looking-at regexp)) (looking-at regexp)) (progn - (incf number) + (cl-incf number) (when first (setq last t)) (delete-region @@ -2469,10 +2468,10 @@ Return the number of headers removed." (save-excursion (goto-char (point-min)) (while (re-search-forward regexp nil t) - (incf count))) + (cl-incf count))) (while (> count 1) (message-remove-header header nil t) - (decf count)))) + (cl-decf count)))) (defun message-narrow-to-headers () "Narrow the buffer to the head of the message." @@ -3227,13 +3226,13 @@ or in the synonym headers, defined by `message-header-synonyms'." (dolist (header headers) (let* ((header-name (symbol-name (car header))) (new-header (cdr header)) - (synonyms (loop for synonym in message-header-synonyms - when (memq (car header) synonym) return synonym)) + (synonyms (cl-loop for synonym in message-header-synonyms + when (memq (car header) synonym) return synonym)) (old-header - (loop for synonym in synonyms - for old-header = (mail-fetch-field (symbol-name synonym)) - when (and old-header (string-match new-header old-header)) - return synonym))) + (cl-loop for synonym in synonyms + for old-header = (mail-fetch-field (symbol-name synonym)) + when (and old-header (string-match new-header old-header)) + return synonym))) (if old-header (message "already have `%s' in `%s'" new-header old-header) (when (and (message-position-on-field header-name) @@ -3593,7 +3592,7 @@ text was killed." "Create a rot table with offset N." (let ((i -1) (table (make-string 256 0))) - (while (< (incf i) 256) + (while (< (cl-incf i) 256) (aset table i i)) (concat (substring table 0 ?A) @@ -3761,13 +3760,13 @@ To use this automatically, you may add this function to (goto-char (mark t)) (insert-before-markers ?\n) (goto-char pt)))) - (case message-cite-reply-position - (above + (pcase message-cite-reply-position + ('above (message-goto-body) (insert body-text) (insert (if (bolp) "\n" "\n\n")) (message-goto-body)) - (below + ('below (message-goto-signature))) ;; Add a `message-setup-very-last-hook' here? ;; Add `gnus-article-highlight-citation' here? @@ -4612,9 +4611,9 @@ This function could be useful in `message-setup-hook'." (with-current-buffer mailbuf message-courtesy-message))) ;; Let's make sure we encoded all the body. - (assert (save-excursion - (goto-char (point-min)) - (not (re-search-forward "[^\000-\377]" nil t)))) + (cl-assert (save-excursion + (goto-char (point-min)) + (not (re-search-forward "[^\000-\377]" nil t)))) (mm-disable-multibyte) (if (or (not message-send-mail-partially-limit) (< (buffer-size) message-send-mail-partially-limit) @@ -4768,7 +4767,7 @@ to find out how to use this." (replace-match "\n") (run-hooks 'message-send-mail-hook) ;; send the message - (case + (pcase (let ((coding-system-for-write message-send-coding-system)) (apply 'call-process-region (point-min) (point-max) @@ -4799,7 +4798,7 @@ to find out how to use this." (100 (error "qmail-inject reported permanent failure")) (111 (error "qmail-inject reported transient failure")) ;; should never happen - (t (error "qmail-inject reported unknown failure")))) + (_ (error "qmail-inject reported unknown failure")))) (defvar mh-previous-window-config) @@ -5322,7 +5321,9 @@ Otherwise, generate and save a value for `canlock-password' first." ;; Check for control characters. (message-check 'control-chars (if (re-search-forward - (string-to-multibyte "[\000-\007\013\015-\032\034-\037\200-\237]") + (eval-when-compile + (decode-coding-string "[\000-\007\013\015-\032\034-\037\200-\237]" + 'binary)) nil t) (y-or-n-p "The article contains control characters. Really post? ") @@ -5849,10 +5850,10 @@ subscribed address (and not the additional To and Cc header contents)." message-subscribed-address-functions)))) (save-match-data (let ((list - (loop for recipient in recipients - when (loop for regexp in mft-regexps - thereis (string-match regexp recipient)) - return recipient))) + (cl-loop for recipient in recipients + when (cl-loop for regexp in mft-regexps + thereis (string-match regexp recipient)) + return recipient))) (when list (if only-show-subscribed list @@ -6201,7 +6202,7 @@ they are." (when (> count maxcount) (let ((surplus (- count maxcount))) (message-shorten-1 refs cut surplus) - (decf count surplus))) + (cl-decf count surplus))) ;; When sending via news, make sure the total folded length will ;; be less than 998 characters. This is to cater to broken INN @@ -6726,9 +6727,9 @@ The function is called with one parameter, a cons cell ..." ;; Gmane renames "To". Look at "Original-To", too, if it is present in ;; message-header-synonyms. (setq to (or (message-fetch-field "to") - (and (loop for synonym in message-header-synonyms - when (memq 'Original-To synonym) - return t) + (and (cl-loop for synonym in message-header-synonyms + when (memq 'Original-To synonym) + return t) (message-fetch-field "original-to"))) cc (message-fetch-field "cc") extra (when message-extra-wide-headers @@ -8133,11 +8134,12 @@ From headers in the original article." (message-tokenize-header (mail-strip-quoted-names (mapconcat 'message-fetch-reply-field fields ",")))) - (email (cond ((functionp message-alternative-emails) - (car (cl-remove-if-not message-alternative-emails emails))) - (t (loop for email in emails - if (string-match-p message-alternative-emails email) - return email))))) + (email + (cond ((functionp message-alternative-emails) + (car (cl-remove-if-not message-alternative-emails emails))) + (t (cl-loop for email in emails + if (string-match-p message-alternative-emails email) + return email))))) (unless (or (not email) (equal email user-mail-address)) (message-remove-header "From") (goto-char (point-max)) commit 408862f02a874dcd9cfc2599adb35dec522b3ef4 (refs/remotes/origin/emacs-26) Author: Glenn Morris Date: Wed Nov 29 15:27:06 2017 -0500 ; * lisp/emacs-lisp/bytecomp.el: Tweak message formatting in previous. diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 9cbbfdcd7a..e5a1ea782e 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -175,7 +175,9 @@ are found in the same directory is hard-coded in various places in Emacs.)" ;; Sadly automake relies on this misfeature up to at least version 1.15.1. (if (fboundp 'byte-compile-dest-file) (or (featurep 'bytecomp) - (display-warning 'bytecomp "Redefining `byte-compile-dest-file' is obsolete (as of 23.2); set `byte-compile-dest-file-function' instead.")) + (display-warning 'bytecomp (format-message "\ +Changing `byte-compile-dest-file' is obsolete (as of 23.2); +set `byte-compile-dest-file-function' instead."))) (defun byte-compile-dest-file (filename) "Convert an Emacs Lisp source file name to a compiled file name. If `byte-compile-dest-file-function' is non-nil, uses that commit 9964db4c34bc01b319f70983400b9820be046cf2 Author: Glenn Morris Date: Wed Nov 29 15:11:01 2017 -0500 Restore obsolete method of changing byte-compile-dest-file * lisp/emacs-lisp/bytecomp.el (byte-compile-dest-file): Restore seven-year obsolete feature that was removed for six months, since automake uses it. diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index e4d8a202a3..9cbbfdcd7a 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -172,6 +172,10 @@ are found in the same directory is hard-coded in various places in Emacs.)" (funcall handler 'byte-compiler-base-file-name filename) filename))) +;; Sadly automake relies on this misfeature up to at least version 1.15.1. +(if (fboundp 'byte-compile-dest-file) + (or (featurep 'bytecomp) + (display-warning 'bytecomp "Redefining `byte-compile-dest-file' is obsolete (as of 23.2); set `byte-compile-dest-file-function' instead.")) (defun byte-compile-dest-file (filename) "Convert an Emacs Lisp source file name to a compiled file name. If `byte-compile-dest-file-function' is non-nil, uses that @@ -186,6 +190,7 @@ otherwise adds \".elc\"." (cond ((string-match emacs-lisp-file-regexp filename) (concat (substring filename 0 (match-beginning 0)) ".elc")) (t (concat filename ".elc"))))) +) ;; This can be the 'byte-compile property of any symbol. (autoload 'byte-compile-inline-expand "byte-opt") commit 3dd25aeecb157d562f8ab3c3abca9f3f89dec7ae Author: Michael Albinus Date: Wed Nov 29 09:37:42 2017 +0100 Some minor Tramp corrections * lisp/net/tramp.el (tramp-handle-directory-file-name): Handle several trailing slashes correctly. (tramp-handle-file-selinux-context): New defun. * lisp/net/tramp-adb.el (tramp-adb-file-name-handler-alist): * lisp/net/tramp-gvfs.el (tramp-gvfs-file-name-handler-alist): * lisp/net/tramp-smb.el (tramp-smb-file-name-handler-alist): Use `tramp-handle-file-selinux-context'. * test/lisp/net/tramp-tests.el (tramp-test06-directory-file-name): Extend test. (tramp-test17-insert-directory): Make check more robust. (tramp-test42-auto-load): Combine several let forms. (tramp-test42-delay-load, tramp-test42-recursive-load) (tramp-test42-remote-load-path, tramp-test43-unload): Rename. diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el index bf21db2e8d..8399c02923 100644 --- a/lisp/net/tramp-adb.el +++ b/lisp/net/tramp-adb.el @@ -137,7 +137,7 @@ It is used for TCP/IP devices." (file-readable-p . tramp-handle-file-exists-p) (file-regular-p . tramp-handle-file-regular-p) (file-remote-p . tramp-handle-file-remote-p) - (file-selinux-context . ignore) + (file-selinux-context . tramp-handle-file-selinux-context) (file-symlink-p . tramp-handle-file-symlink-p) (file-system-info . tramp-adb-handle-file-system-info) (file-truename . tramp-adb-handle-file-truename) diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el index 404af983b5..fe5a98909e 100644 --- a/lisp/net/tramp-gvfs.el +++ b/lisp/net/tramp-gvfs.el @@ -517,7 +517,7 @@ Every entry is a list (NAME ADDRESS).") (file-readable-p . tramp-gvfs-handle-file-readable-p) (file-regular-p . tramp-handle-file-regular-p) (file-remote-p . tramp-handle-file-remote-p) - (file-selinux-context . ignore) + (file-selinux-context . tramp-handle-file-selinux-context) (file-symlink-p . tramp-handle-file-symlink-p) (file-system-info . tramp-gvfs-handle-file-system-info) (file-truename . tramp-handle-file-truename) diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el index f35c10b58a..eb0d6b5073 100644 --- a/lisp/net/tramp-smb.el +++ b/lisp/net/tramp-smb.el @@ -253,7 +253,7 @@ See `tramp-actions-before-shell' for more info.") (file-readable-p . tramp-handle-file-exists-p) (file-regular-p . tramp-handle-file-regular-p) (file-remote-p . tramp-handle-file-remote-p) - ;; `file-selinux-context' performed by default handler. + (file-selinux-context . tramp-handle-file-selinux-context) (file-symlink-p . tramp-handle-file-symlink-p) (file-system-info . tramp-smb-handle-file-system-info) (file-truename . tramp-handle-file-truename) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 13277ec6f3..6b0b1da6eb 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -2937,14 +2937,13 @@ User is always nil." "Like `directory-file-name' for Tramp files." ;; If localname component of filename is "/", leave it unchanged. ;; Otherwise, remove any trailing slash from localname component. - ;; Method, host, etc, are unchanged. Does it make sense to try - ;; to avoid parsing the filename? - (with-parsed-tramp-file-name directory nil - (if (and (not (zerop (length localname))) - (eq (aref localname (1- (length localname))) ?/) - (not (string= localname "/"))) - (substring directory 0 -1) - directory))) + ;; Method, host, etc, are unchanged. + (while (with-parsed-tramp-file-name directory nil + (and (not (zerop (length localname))) + (eq (aref localname (1- (length localname))) ?/) + (not (string= localname "/")))) + (setq directory (substring directory 0 -1))) + directory) (defun tramp-handle-directory-files (directory &optional full match nosort) "Like `directory-files' for Tramp files." @@ -3172,6 +3171,11 @@ User is always nil." (t (tramp-make-tramp-file-name method user domain host port "" hop))))))))) +(defun tramp-handle-file-selinux-context (_filename) + "Like `file-selinux-context' for Tramp files." + ;; Return nil context. + '(nil nil nil nil)) + (defun tramp-handle-file-symlink-p (filename) "Like `file-symlink-p' for Tramp files." (let ((x (tramp-compat-file-attribute-type (file-attributes filename)))) diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index 2141f52cb2..8a551db778 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -1683,6 +1683,10 @@ This checks also `file-name-as-directory', `file-name-directory', (string-equal (directory-file-name "/method:host:/path/to/file/") "/method:host:/path/to/file")) + (should + (string-equal + (directory-file-name "/method:host:/path/to/file//") + "/method:host:/path/to/file")) (should (string-equal (file-name-as-directory "/method:host:/path/to/file") @@ -2341,7 +2345,10 @@ This tests also `file-directory-p' and `file-accessible-directory-p'." ;; There might be a summary line. "\\(total.+[[:digit:]]+\n\\)?" ;; We don't know in which order ".", ".." and "foo" appear. - "\\(.+ \\(\\.?\\.\\|foo\\)\n\\)\\{3\\}"))))) + (format + "\\(.+ %s\\( ->.+\\)?\n\\)\\{%d\\}" + (regexp-opt (directory-files tmp-name1)) + (length (directory-files tmp-name1)))))))) ;; Cleanup. (ignore-errors (delete-directory tmp-name1 'recursive)))))) @@ -4445,8 +4452,8 @@ Use the `ls' command." ;; Since Emacs 27.1. (skip-unless (fboundp 'file-system-info)) - ;; `file-system-info' exists since Emacs 27. We don't - ;; want to see compiler warnings for older Emacsen. + ;; `file-system-info' exists since Emacs 27. We don't want to see + ;; compiler warnings for older Emacsen. (let ((fsi (with-no-warnings (file-system-info tramp-test-temporary-file-directory)))) (skip-unless fsi) @@ -4611,22 +4618,50 @@ process sentinels. They shall not disturb each other." (skip-unless (tramp--test-enabled)) (skip-unless (not (tramp--test-mock-p))) - (let ((default-directory (expand-file-name temporary-file-directory))) - (let ((code - (format - "(message \"Tramp loaded: %%s\" (consp (file-attributes \"%s\")))" - tramp-test-temporary-file-directory))) + (let ((default-directory (expand-file-name temporary-file-directory)) + (code + (format + "(message \"Tramp loaded: %%s\" (consp (file-attributes %S)))" + tramp-test-temporary-file-directory))) + (should + (string-match + "Tramp loaded: t[\n\r]+" + (shell-command-to-string + (format + "%s -batch -Q -L %s --eval %s" + (expand-file-name invocation-name invocation-directory) + (mapconcat 'shell-quote-argument load-path " -L ") + (shell-quote-argument code))))))) + +(ert-deftest tramp-test42-delay-load () + "Check that Tramp is loaded lazily, only when needed." + ;; Tramp is neither loaded at Emacs startup, nor when completing a + ;; non-Tramp file name like "/foo". Completing a Tramp-alike file + ;; name like "/foo:" autoloads Tramp, when `tramp-mode' is t. + (let ((default-directory (expand-file-name temporary-file-directory)) + (code + "(progn \ + (setq tramp-mode %s) \ + (message \"Tramp loaded: %%s\" (featurep 'tramp)) \ + (file-name-all-completions \"/foo\" \"/\") \ + (message \"Tramp loaded: %%s\" (featurep 'tramp)) \ + (file-name-all-completions \"/foo:\" \"/\") \ + (message \"Tramp loaded: %%s\" (featurep 'tramp)))")) + ;; Tramp doesn't load when `tramp-mode' is nil since Emacs 26.1. + (dolist (tm (if (tramp--test-emacs26-p) '(t nil) '(nil))) (should (string-match - "Tramp loaded: t[\n\r]+" + (format + "Tramp loaded: nil[\n\r]+Tramp loaded: nil[\n\r]+Tramp loaded: %s[\n\r]+" + tm) (shell-command-to-string (format "%s -batch -Q -L %s --eval %s" (expand-file-name invocation-name invocation-directory) (mapconcat 'shell-quote-argument load-path " -L ") - (shell-quote-argument code)))))))) + (shell-quote-argument (format code tm))))))))) -(ert-deftest tramp-test43-recursive-load () +(ert-deftest tramp-test42-recursive-load () "Check that Tramp does not fail due to recursive load." (skip-unless (tramp--test-enabled)) @@ -4649,7 +4684,7 @@ process sentinels. They shall not disturb each other." (mapconcat 'shell-quote-argument load-path " -L ") (shell-quote-argument code)))))))) -(ert-deftest tramp-test44-remote-load-path () +(ert-deftest tramp-test42-remote-load-path () "Check that Tramp autoloads its packages with remote `load-path'." ;; `tramp-cleanup-all-connections' is autoloaded from tramp-cmds.el. ;; It shall still work, when a remote file name is in the @@ -4672,34 +4707,7 @@ process sentinels. They shall not disturb each other." (mapconcat 'shell-quote-argument load-path " -L ") (shell-quote-argument code))))))) -(ert-deftest tramp-test45-delay-load () - "Check that Tramp is loaded lazily, only when needed." - ;; Tramp is neither loaded at Emacs startup, nor when completing a - ;; non-Tramp file name like "/foo". Completing a Tramp-alike file - ;; name like "/foo:" autoloads Tramp, when `tramp-mode' is t. - (let ((code - "(progn \ - (setq tramp-mode %s) \ - (message \"Tramp loaded: %%s\" (featurep 'tramp)) \ - (file-name-all-completions \"/foo\" \"/\") \ - (message \"Tramp loaded: %%s\" (featurep 'tramp)) \ - (file-name-all-completions \"/foo:\" \"/\") \ - (message \"Tramp loaded: %%s\" (featurep 'tramp)))")) - ;; Tramp doesn't load when `tramp-mode' is nil since Emacs 26.1. - (dolist (tm (if (tramp--test-emacs26-p) '(t nil) '(nil))) - (should - (string-match - (format - "Tramp loaded: nil[\n\r]+Tramp loaded: nil[\n\r]+Tramp loaded: %s[\n\r]+" - tm) - (shell-command-to-string - (format - "%s -batch -Q -L %s --eval %s" - (expand-file-name invocation-name invocation-directory) - (mapconcat 'shell-quote-argument load-path " -L ") - (shell-quote-argument (format code tm))))))))) - -(ert-deftest tramp-test46-unload () +(ert-deftest tramp-test43-unload () "Check that Tramp and its subpackages unload completely. Since it unloads Tramp, it shall be the last test to run." :tags '(:expensive-test) @@ -4745,6 +4753,12 @@ Since it unloads Tramp, it shall be the last test to run." (ignore-errors (all-completions "tramp" (symbol-value x))) (ert-fail (format "Hook `%s' still contains Tramp function" x))))))) +(defun tramp-test-all (&optional interactive) + "Run all tests for \\[tramp]." + (interactive "p") + (funcall + (if interactive 'ert-run-tests-interactively 'ert-run-tests-batch) "^tramp")) + ;; TODO: ;; * dired-compress-file @@ -4758,11 +4772,5 @@ Since it unloads Tramp, it shall be the last test to run." ;; * Fix `tramp-test30-interrupt-process', timeout doesn't work reliably. ;; * Fix Bug#16928 in `tramp-test41-asynchronous-requests'. -(defun tramp-test-all (&optional interactive) - "Run all tests for \\[tramp]." - (interactive "p") - (funcall - (if interactive 'ert-run-tests-interactively 'ert-run-tests-batch) "^tramp")) - (provide 'tramp-tests) ;;; tramp-tests.el ends here commit d670a15f254e2f077fa528b3e76d31d2ca415e69 Author: Tino Calancha Date: Wed Nov 29 11:42:11 2017 +0900 * doc/misc/url.texi (http/https): Fix typo diff --git a/doc/misc/url.texi b/doc/misc/url.texi index e98fab4e01..075d0f6fed 100644 --- a/doc/misc/url.texi +++ b/doc/misc/url.texi @@ -401,7 +401,7 @@ gateway method to be used. @xref{Gateways in general}. @defopt url-honor-refresh-requests If this option is non-@code{nil} (the default), the @code{url} library honors the HTTP @samp{Refresh} header, which is used by servers to -direct clients to reload documents from the same URL or a or different +direct clients to reload documents from the same URL or a different one. If the value is @code{nil}, the @samp{Refresh} header is ignored; any other value means to ask the user on each request. @end defopt commit 99d07e8d5e2d79c21915f1dbb8d1307a5d818b39 Author: Glenn Morris Date: Tue Nov 28 19:58:32 2017 -0500 Remove some bogus definition-prefixes from loaddefs * lisp/emacs-lisp/autoload.el (autoload-generate-file-autoloads): Don't register a definition prefix from define-erc-module, which adds an erc- prefix to its argument. diff --git a/lisp/emacs-lisp/autoload.el b/lisp/emacs-lisp/autoload.el index 27426c4530..7299ae9d20 100644 --- a/lisp/emacs-lisp/autoload.el +++ b/lisp/emacs-lisp/autoload.el @@ -761,6 +761,7 @@ FILE's modification time." "def-edebug-spec" ;; Hmm... this is getting ugly: "define-widget" + "define-erc-module" "define-erc-response-handler" "defun-rcirc-command")))) (push (match-string 2) defs)) commit 6067f0c702e3652a9d489852752f038320cb91ae Author: Robert Pluim Date: Tue Nov 28 19:46:38 2017 +0200 Shell-quote wildcards when invoking 'vc-git-grep' * lisp/vc/vc-git.el (vc-git-grep): Apply shell quoting to filename wildcards to ensure globbing is done by git rather than the shell. (Bug#29303) diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index 6b6f0f8d12..8b18c0add0 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -1430,7 +1430,9 @@ This command shares argument histories with \\[rgrep] and \\[grep]." nil nil 'grep-history) nil)) (t (let* ((regexp (grep-read-regexp)) - (files (grep-read-files regexp)) + (files + (mapconcat #'shell-quote-argument + (split-string (grep-read-files regexp)) " ")) (dir (read-directory-name "In directory: " nil default-directory t))) (list regexp files dir)))))) commit 0540df10e63ba624a775cfe1bba4124456591cf5 Author: Kaushal Modi Date: Tue Nov 28 19:17:48 2017 +0200 Update documentation of '.dir-locals-2.el' See https://lists.gnu.org/r/emacs-devel/2017-11/msg00649.html for more details. * lisp/files.el (dir-locals-file-2): Remove unused constant. * lisp/files.el (dir-locals-file): Mention ".dir-locals-2.el" in the doc string. * doc/lispref/variables.texi (Directory Local Variables): Mention ".dir-locals-2.el". * etc/NEWS: Replace `dir-locals-file-2' mention with `dir-locals-file'. diff --git a/doc/lispref/variables.texi b/doc/lispref/variables.texi index a871352b00..5bee0f9d82 100644 --- a/doc/lispref/variables.texi +++ b/doc/lispref/variables.texi @@ -1919,7 +1919,12 @@ settings to any file in that directory or any of its subdirectories (optionally, you can exclude subdirectories; see below). If some of the subdirectories have their own @file{.dir-locals.el} files, Emacs uses the settings from the deepest file it finds starting -from the file's directory and moving up the directory tree. The file +from the file's directory and moving up the directory tree. This +constant is also used to derive the name of a second dir-locals file +@file{.dir-locals-2.el}. If this second dir-locals file is present, +then that is loaded instead of @file{.dir-locals.el}. This is useful +when @file{.dir-locals.el} is under version control in a shared +repository and cannot be used for personal customizations. The file specifies local variables as a specially formatted list; see @ref{Directory Variables, , Per-directory Local Variables, emacs, The GNU Emacs Manual}, for more details. diff --git a/etc/NEWS b/etc/NEWS index f7a9feb6e4..4ccf468693 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -366,7 +366,7 @@ These local variables will thus not vanish on setting a major mode. +++ ** A second dir-local file (.dir-locals-2.el) is now accepted. -See the variable 'dir-locals-file-2' for more information. +See the doc string of 'dir-locals-file' for more information. +++ ** Connection-local variables can be used to specify local variables diff --git a/lisp/files.el b/lisp/files.el index d8b38a9f16..8021e1bbed 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -3905,16 +3905,16 @@ VARIABLES list of the class. The list is processed in order. "File that contains directory-local variables. It has to be constant to enforce uniform values across different environments and users. -See also `dir-locals-file-2', whose values override this one's. -See Info node `(elisp)Directory Local Variables' for details.") -(defconst dir-locals-file-2 ".dir-locals-2.el" - "File that contains directory-local variables. -This essentially a second file that can be used like -`dir-locals-file', so that users can have specify their personal -dir-local variables even if the current directory already has a -`dir-locals-file' that is shared with other users (such as in a -git repository). +A second dir-locals file can be used by a user to specify their +personal dir-local variables even if the current directory +already has a `dir-locals-file' that is shared with other +users (such as in a git repository). The name of this second +file is derived by appending \"-2\" to the base name of +`dir-locals-file'. With the default value of `dir-locals-file', +a \".dir-locals-2.el\" file in the same directory will override +the \".dir-locals.el\". + See Info node `(elisp)Directory Local Variables' for details.") (defun dir-locals--all-files (directory) commit f2441ab3204274cba16f5cab19e98db61d468fb7 Author: Glenn Morris Date: Tue Nov 28 08:50:05 2017 -0800 ; Fix some tiny doc and comment typos diff --git a/lisp/gnus/gnus-cus.el b/lisp/gnus/gnus-cus.el index 600b33f226..cae0372aa4 100644 --- a/lisp/gnus/gnus-cus.el +++ b/lisp/gnus/gnus-cus.el @@ -454,7 +454,7 @@ Set variables local to the group you are entering. If you want to turn threading off in `news.answers', you could put `(gnus-show-threads nil)' in the group parameters of that group. `gnus-show-threads' will be made into a local variable in the summary -buffer you enter, and the form nil will be `eval'ed there. +buffer you enter, and the form nil will be `eval'uated there. This can also be used as a group-specific hook function, if you'd like. If you want to hear a beep when you enter a group, you could @@ -535,7 +535,7 @@ These files will not be loaded, even though they would normally be so, for some reason or other.") (eval (sexp :tag "Eval" :value nil) "\ -The value of this entry will be `eval'el. +The value of this entry will be `eval'uated. This element will be ignored when handling global score files.") (read-only (boolean :tag "Read-only" :value t) "\ diff --git a/lisp/htmlfontify.el b/lisp/htmlfontify.el index a4c68d329b..cb4c83d33e 100644 --- a/lisp/htmlfontify.el +++ b/lisp/htmlfontify.el @@ -461,7 +461,7 @@ and so on." optimization - If on, preserve overlay highlighting (cf ediff or goo-font-lock) as well as basic faces.\n body-text-only : Emit only body-text. In concrete terms, - 1. Suppress calls to `hfy-page-header'and + 1. Suppress calls to `hfy-page-header' and `hfy-page-footer' 2. Pretend that `div-wrapper' option above is turned off diff --git a/lisp/net/mailcap.el b/lisp/net/mailcap.el index 86587466ef..b4b38707c8 100644 --- a/lisp/net/mailcap.el +++ b/lisp/net/mailcap.el @@ -323,7 +323,7 @@ means the viewer is always valid. If it is a Lisp function, it is called with a list of items from any extra fields from the Content-Type header as argument to return a boolean value for the validity. Otherwise, if it is a non-function Lisp symbol or list -whose car is a symbol, it is `eval'led to yield the validity. If it +whose car is a symbol, it is `eval'uated to yield the validity. If it is a string or list of strings, it represents a shell command to run to return a true or false shell value for the validity.") (put 'mailcap-mime-data 'risky-local-variable t) diff --git a/lisp/progmodes/ebnf2ps.el b/lisp/progmodes/ebnf2ps.el index a813d42356..f3d7d98f28 100644 --- a/lisp/progmodes/ebnf2ps.el +++ b/lisp/progmodes/ebnf2ps.el @@ -1136,7 +1136,7 @@ Please send all bug fixes and enhancements to ;; Thanks to Drew Adams for suggestions: ;; - `ebnf-arrow-extra-width', `ebnf-arrow-scale', ;; `ebnf-production-name-p', `ebnf-stop-on-error', -;; `ebnf-file-suffix-regexp'and `ebnf-special-show-delimiter' variables. +;; `ebnf-file-suffix-regexp' and `ebnf-special-show-delimiter' variables. ;; - `ebnf-delete-style', `ebnf-eps-file' and `ebnf-eps-directory' ;; commands. ;; - some docs fix. diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el index 241ea00d64..c6345aa968 100644 --- a/lisp/progmodes/flymake.el +++ b/lisp/progmodes/flymake.el @@ -125,7 +125,7 @@ If nil, never start checking buffer automatically like this." "it no longer has any effect." "26.1") (defcustom flymake-start-on-flymake-mode t - "Start syntax check when `flymake-mode'is enabled. + "Start syntax check when `flymake-mode' is enabled. Specifically, start it when the buffer is actually displayed." :type 'boolean) commit 22ff46e6d85e3f023eb84ef7e8fe3de8947caf81 Author: Glenn Morris Date: Mon Nov 27 19:28:28 2017 -0500 ; Fix some comment typos diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index d9f3427b95..22de7fee81 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -4775,7 +4775,7 @@ to find out how to use this." message-qmail-inject-program nil nil nil ;; qmail-inject's default behavior is to look for addresses on the ;; command line; if there're none, it scans the headers. - ;; yes, it does The Right Thing w.r.t. Resent-To and it's kin. + ;; yes, it does The Right Thing w.r.t. Resent-To and its kin. ;; ;; in general, ALL of qmail-inject's defaults are perfect for simply ;; reading a formatted (i. e., at least a To: or Resent-To header) @@ -4793,7 +4793,7 @@ to find out how to use this." (if (functionp message-qmail-inject-args) (funcall message-qmail-inject-args) message-qmail-inject-args))) - ;; qmail-inject doesn't say anything on it's stdout/stderr, + ;; qmail-inject doesn't say anything on its stdout/stderr, ;; we have to look at the retval instead (0 nil) (100 (error "qmail-inject reported permanent failure")) diff --git a/lisp/gnus/mm-decode.el b/lisp/gnus/mm-decode.el index c6ac0567fb..82b378e627 100644 --- a/lisp/gnus/mm-decode.el +++ b/lisp/gnus/mm-decode.el @@ -676,7 +676,7 @@ MIME-Version header before proceeding." (mm-alist-to-plist (cdr ctl)) (car ctl)) ;; what really needs to be done here is a way to link a - ;; MIME handle back to it's parent MIME handle (in a multilevel + ;; MIME handle back to its parent MIME handle (in a multilevel ;; MIME article). That would probably require changing ;; the mm-handle API so we simply store the multipart buffer ;; name as a text property of the "multipart/whatever" string. diff --git a/lisp/gnus/smime.el b/lisp/gnus/smime.el index f62b65a066..21f8c09e1c 100644 --- a/lisp/gnus/smime.el +++ b/lisp/gnus/smime.el @@ -67,7 +67,7 @@ ;; ;; To be able to verify messages you need to build up trust with ;; someone. Perhaps you trust the CA that issued your certificate, at -;; least I did, so I export it's certificates from my PKCS#12 +;; least I did, so I export its certificates from my PKCS#12 ;; certificate with: ;; ;; $ openssl pkcs12 -in mykey.p12 -cacerts -nodes > cacert.pem commit 340f74daa8ac5fab0efc35d12ef5cf5cb3507b22 Author: Noam Postavsky Date: Tue Nov 21 14:12:55 2017 -0500 * src/w32heap.c (DUMPED_HEAP_SIZE) [_WIN64]: Bump to 22 MiB. diff --git a/src/w32heap.c b/src/w32heap.c index 85ed050d99..4115049d71 100644 --- a/src/w32heap.c +++ b/src/w32heap.c @@ -116,7 +116,7 @@ typedef struct _RTL_HEAP_PARAMETERS { to build only the first bootstrap-emacs.exe with the large size, and reset that to a lower value afterwards. */ #if defined _WIN64 || defined WIDE_EMACS_INT -# define DUMPED_HEAP_SIZE (21*1024*1024) +# define DUMPED_HEAP_SIZE (22*1024*1024) #else # define DUMPED_HEAP_SIZE (13*1024*1024) #endif commit f2e6961a1b849e6a026db30a4f7d09b6f0753b02 Author: Glenn Morris Date: Mon Nov 27 14:25:35 2017 -0500 ; * lisp/emacs-lisp/bytecomp.el (byte-compile-dest-file): Fix typo in previous. diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 7b17d9f290..e4d8a202a3 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -177,7 +177,7 @@ are found in the same directory is hard-coded in various places in Emacs.)" If `byte-compile-dest-file-function' is non-nil, uses that function to do the work. Otherwise, if FILENAME matches `emacs-lisp-file-regexp' (by default, files with the extension \".el\"), -replaces the matching part (and anything after it) with \"\.elc\"; +replaces the matching part (and anything after it) with \".elc\"; otherwise adds \".elc\"." (if byte-compile-dest-file-function (funcall byte-compile-dest-file-function filename) commit 1c8bd8a119b9c96763d3b6c5447d9e9e26a6f922 Author: Glenn Morris Date: Mon Nov 27 14:10:34 2017 -0500 A few small doc fixes for bytecomp.el * lisp/emacs-lisp/bytecomp.el (emacs-lisp-file-regexp) (byte-compile-dest-file-function, byte-compile-dest-file): Doc fixes. diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 590db570c5..7b17d9f290 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -144,14 +144,20 @@ (defcustom emacs-lisp-file-regexp "\\.el\\'" "Regexp which matches Emacs Lisp source files. -If you change this, you might want to set `byte-compile-dest-file-function'." +If you change this, you might want to set `byte-compile-dest-file-function'. +\(Note that the assumption of a \".elc\" suffix for compiled files +is hard-coded in various places in Emacs.)" + ;; Eg is_elc in Fload. :group 'bytecomp :type 'regexp) (defcustom byte-compile-dest-file-function nil "Function for the function `byte-compile-dest-file' to call. It should take one argument, the name of an Emacs Lisp source -file name, and return the name of the compiled file." +file name, and return the name of the compiled file. +\(Note that the assumption that the source and compiled files +are found in the same directory is hard-coded in various places in Emacs.)" + ;; Eg load-prefer-newer, documentation lookup IIRC. :group 'bytecomp :type '(choice (const nil) function) :version "23.2") @@ -170,8 +176,9 @@ file name, and return the name of the compiled file." "Convert an Emacs Lisp source file name to a compiled file name. If `byte-compile-dest-file-function' is non-nil, uses that function to do the work. Otherwise, if FILENAME matches -`emacs-lisp-file-regexp' (by default, files with the extension `.el'), -adds `c' to it; otherwise adds `.elc'." +`emacs-lisp-file-regexp' (by default, files with the extension \".el\"), +replaces the matching part (and anything after it) with \"\.elc\"; +otherwise adds \".elc\"." (if byte-compile-dest-file-function (funcall byte-compile-dest-file-function filename) (setq filename (file-name-sans-versions commit 37f3a6b216f385b1aef5310bff0ea5abb24f7637 Author: Stefan Monnier Date: Mon Nov 27 13:53:23 2017 -0500 * src/lread.c (syms_of_lread): Fix thinko in commit b1573a97e17b5 diff --git a/src/lread.c b/src/lread.c index b056f4aaf3..597ff56c8f 100644 --- a/src/lread.c +++ b/src/lread.c @@ -4769,7 +4769,7 @@ to find all the symbols in an obarray, use `mapatoms'. */); DEFVAR_LISP ("values", Vvalues, doc: /* List of values of all expressions which were read, evaluated and printed. Order is reverse chronological. */); - XSYMBOL (intern ("values"))->u.s.declared_special = true; + XSYMBOL (intern ("values"))->u.s.declared_special = false; DEFVAR_LISP ("standard-input", Vstandard_input, doc: /* Stream for read to get input from. commit 02d114d6b85e02132d5f99ead517b69dbdd77e35 Author: Glenn Morris Date: Mon Nov 27 13:52:07 2017 -0500 * lisp/tree-widget.el (tree-widget-end-guide): Escape it. (Bug#27797) diff --git a/lisp/tree-widget.el b/lisp/tree-widget.el index 130d8af07e..9599cc7f06 100644 --- a/lisp/tree-widget.el +++ b/lisp/tree-widget.el @@ -504,7 +504,7 @@ Handle mouse button 1 click on buttons.") (define-widget 'tree-widget-end-guide 'item "End of a vertical guide line." - :tag " `" + :tag " \\=`" ;;:tag-glyph (tree-widget-find-image "end-guide") :format "%t" ) commit 0a85d12474e6551581bcf87de9129359c0f8c233 Author: Eli Zaretskii Date: Mon Nov 27 18:24:29 2017 +0200 Fix ELisp "Warning Tips" * doc/lispref/tips.texi (Warning Tips): Clarify when to use 'require' wrapped by 'eval-when-compile'. (Bug#29462) diff --git a/doc/lispref/tips.texi b/doc/lispref/tips.texi index 17fd4a1027..42a68677f5 100644 --- a/doc/lispref/tips.texi +++ b/doc/lispref/tips.texi @@ -534,9 +534,17 @@ that you know @emph{will} be defined, use a @code{declare-function} statement (@pxref{Declaring Functions}). @item -If you use many functions and variables from a certain file, you can -add a @code{require} for that package to avoid compilation warnings -for them. For instance, +If you use many functions, macros, and variables from a certain file, +you can add a @code{require} (@pxref{Named Features, require}) for +that package to avoid compilation warnings for them, like this: + +@example +(require 'foo) +@end example + +@noindent +If you need only macros from some file, you can require it only at +compile time (@pxref{Eval During Compile}). For instance, @example (eval-when-compile commit 06d05fec84ded5d48aafc8649f861884afdec0b7 Author: Michael Albinus Date: Mon Nov 27 13:31:53 2017 +0100 Fix Bug#29163 * lisp/net/tramp.el (tramp-autoload-file-name-regexp): Do not use "\\'" in regexp. (Bug#29163) (top) Do not run (tramp-register-autoload-file-name-handlers) when loading tramp.el. * test/lisp/net/tramp-tests.el (tramp--test-mock-p): New defun. (tramp-test32-environment-variables-and-port-numbers) (tramp-test41-asynchronous-requests): Use it. (tramp-test42-auto-load): New test. (tramp-test43-recursive-load, tramp-test44-remote-load-path) (tramp-test45-delay-load, tramp-test46-unload): Rename. diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index efd31b26be..13277ec6f3 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -1055,7 +1055,7 @@ Also see `tramp-file-name-structure'.") "\\(-\\|[^/|:]\\{2,\\}\\)" ;; At least one character for method. "[^/|:]+") - ":\\'") + ":") "Regular expression matching file names handled by Tramp autoload. It must match the initial `tramp-syntax' settings. It should not match file names at root of the underlying local file system, @@ -2323,8 +2323,7 @@ Falls back to normal file name handler if no Tramp file name handler exists." 'tramp-autoload-file-name-handler)) (put 'tramp-autoload-file-name-handler 'safe-magic t))) -;;;###autoload -(tramp-register-autoload-file-name-handlers) +;;;###autoload (tramp-register-autoload-file-name-handlers) (defun tramp-use-absolute-autoload-file-names () "Change Tramp autoload objects to use absolute file names. diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index 08c58c8027..2141f52cb2 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -3627,11 +3627,8 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." (skip-unless (tramp--test-enabled)) ;; We test it only for the mock-up connection; otherwise there might ;; be problems with the used ports. - (skip-unless - (and - (eq tramp-syntax 'default) - (string-equal - "mock" (file-remote-p tramp-test-temporary-file-directory 'method)))) + (skip-unless (and (eq tramp-syntax 'default) + (tramp--test-mock-p))) ;; We force a reconnect, in order to have a clean environment. (dolist (dir `(,tramp-test-temporary-file-directory @@ -4041,6 +4038,12 @@ Several special characters do not work properly there." (file-truename tramp-test-temporary-file-directory) nil (string-match "^HP-UX" (tramp-get-connection-property v "uname" "")))) +(defun tramp--test-mock-p () + "Check, whether the mock method is used. +This does not support external Emacs calls." + (string-equal + "mock" (file-remote-p tramp-test-temporary-file-directory 'method))) + (defun tramp--test-rsync-p () "Check, whether the rsync method is used. This does not support special file names." @@ -4495,8 +4498,7 @@ process sentinels. They shall not disturb each other." ;; We must distinguish due to performance reasons. (timer-operation (cond - ((string-equal "mock" (file-remote-p tmp-name 'method)) - 'vc-registered) + ((tramp--test-mock-p) 'vc-registered) (t 'file-attributes))) timer buffers kill-buffer-query-functions) @@ -4604,7 +4606,27 @@ process sentinels. They shall not disturb each other." (ignore-errors (cancel-timer timer)) (ignore-errors (delete-directory tmp-name 'recursive)))))) -(ert-deftest tramp-test42-recursive-load () +(ert-deftest tramp-test42-auto-load () + "Check that Tramp autoloads properly." + (skip-unless (tramp--test-enabled)) + (skip-unless (not (tramp--test-mock-p))) + + (let ((default-directory (expand-file-name temporary-file-directory))) + (let ((code + (format + "(message \"Tramp loaded: %%s\" (consp (file-attributes \"%s\")))" + tramp-test-temporary-file-directory))) + (should + (string-match + "Tramp loaded: t[\n\r]+" + (shell-command-to-string + (format + "%s -batch -Q -L %s --eval %s" + (expand-file-name invocation-name invocation-directory) + (mapconcat 'shell-quote-argument load-path " -L ") + (shell-quote-argument code)))))))) + +(ert-deftest tramp-test43-recursive-load () "Check that Tramp does not fail due to recursive load." (skip-unless (tramp--test-enabled)) @@ -4627,7 +4649,7 @@ process sentinels. They shall not disturb each other." (mapconcat 'shell-quote-argument load-path " -L ") (shell-quote-argument code)))))))) -(ert-deftest tramp-test43-remote-load-path () +(ert-deftest tramp-test44-remote-load-path () "Check that Tramp autoloads its packages with remote `load-path'." ;; `tramp-cleanup-all-connections' is autoloaded from tramp-cmds.el. ;; It shall still work, when a remote file name is in the @@ -4650,7 +4672,7 @@ process sentinels. They shall not disturb each other." (mapconcat 'shell-quote-argument load-path " -L ") (shell-quote-argument code))))))) -(ert-deftest tramp-test44-delay-load () +(ert-deftest tramp-test45-delay-load () "Check that Tramp is loaded lazily, only when needed." ;; Tramp is neither loaded at Emacs startup, nor when completing a ;; non-Tramp file name like "/foo". Completing a Tramp-alike file @@ -4677,7 +4699,7 @@ process sentinels. They shall not disturb each other." (mapconcat 'shell-quote-argument load-path " -L ") (shell-quote-argument (format code tm))))))))) -(ert-deftest tramp-test45-unload () +(ert-deftest tramp-test46-unload () "Check that Tramp and its subpackages unload completely. Since it unloads Tramp, it shall be the last test to run." :tags '(:expensive-test) commit ac64fdb248d791b204cf579f878f8542ded0d067 Author: Paul Eggert Date: Sun Nov 26 19:15:14 2017 -0800 Harden exec_byte_code against redefining 'error' Problem discovered by configuring with --enable-gcc-warnings on Ubuntu 17.10 x86-64 with gcc (Ubuntu 7.2.0-8ubuntu3). * src/bytecode.c (exec_byte_code): Call the C error function instead of the Lisp one, so that the Emacs interpreter does not go haywire if the user redefines the Lisp error function. diff --git a/src/bytecode.c b/src/bytecode.c index ebaf3c3a7f..8746568f16 100644 --- a/src/bytecode.c +++ b/src/bytecode.c @@ -1346,10 +1346,8 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, /* Actually this is Bstack_ref with offset 0, but we use Bdup for that instead. */ /* CASE (Bstack_ref): */ - call3 (Qerror, - build_string ("Invalid byte opcode: op=%s, ptr=%d"), - make_number (op), - make_number (pc - 1 - bytestr_data)); + error ("Invalid byte opcode: op=%d, ptr=%"pD"d", + op, pc - 1 - bytestr_data); /* Handy byte-codes for lexical binding. */ CASE (Bstack_ref1): commit 700f74e4c8d1b33cdf96dab9586dc41ebccaba7d Author: Gemini Lasswell Date: Sun Nov 5 21:36:58 2017 -0800 Fix Edebug specs for if-let* and and-let* (Bug#29236) * test/lisp/emacs-lisp/subr-x.el (if-let*, if-let): Change Edebug spec to cause Edebug to instrument tests the results of which are not bound to symbols (the (VALUEFORM) case). (and-let*): Change Edebug spec to allow empty body. *test/lisp/emacs-lisp/subr-x-tests.el: (subr-x-and-let*-test-group-1): Add missing quote to erroneous form so Edebug will work on this test. diff --git a/lisp/emacs-lisp/subr-x.el b/lisp/emacs-lisp/subr-x.el index 9ff742c433..37bcfc2003 100644 --- a/lisp/emacs-lisp/subr-x.el +++ b/lisp/emacs-lisp/subr-x.el @@ -133,7 +133,7 @@ be of the form (VALUEFORM), which is evaluated and checked for nil; i.e. SYMBOL can be omitted if only the test result is of interest." (declare (indent 2) - (debug ((&rest [&or symbolp (symbolp form) (sexp)]) + (debug ((&rest [&or symbolp (symbolp form) (form)]) form body))) (if varlist `(let* ,(setq varlist (internal--build-bindings varlist)) @@ -156,7 +156,9 @@ VARLIST is the same as in `if-let*'." "Bind variables according to VARLIST and conditionally eval BODY. Like `when-let*', except if BODY is empty and all the bindings are non-nil, then the result is non-nil." - (declare (indent 1) (debug when-let*)) + (declare (indent 1) + (debug ((&rest [&or symbolp (symbolp form) (form)]) + body))) (let (res) (if varlist `(let* ,(setq varlist (internal--build-bindings varlist)) @@ -168,7 +170,7 @@ are non-nil, then the result is non-nil." "Bind variables according to SPEC and eval THEN or ELSE. Like `if-let*' except SPEC can have the form (SYMBOL VALUEFORM)." (declare (indent 2) - (debug ([&or (&rest [&or symbolp (symbolp form) (sexp)]) + (debug ([&or (&rest [&or symbolp (symbolp form) (form)]) (symbolp form)] form body)) (obsolete "use `if-let*' instead." "26.1")) diff --git a/test/lisp/emacs-lisp/subr-x-tests.el b/test/lisp/emacs-lisp/subr-x-tests.el index 0e8871d9a9..0187f39d15 100644 --- a/test/lisp/emacs-lisp/subr-x-tests.el +++ b/test/lisp/emacs-lisp/subr-x-tests.el @@ -403,7 +403,7 @@ (should-error (eval '(and-let* (nil (x 1))) lexical-binding) :type 'setting-constant) (should (equal nil (and-let* ((nil) (x 1))))) - (should-error (eval (and-let* (2 (x 1))) lexical-binding) + (should-error (eval '(and-let* (2 (x 1))) lexical-binding) :type 'wrong-type-argument) (should (equal 1 (and-let* ((2) (x 1))))) (should (equal 2 (and-let* ((x 1) (2))))) commit 0ded1b41a986229eaa4218095d9c78d1800c0b27 Author: Gemini Lasswell Date: Wed Nov 1 21:13:02 2017 -0700 Fix Edebug's handling of dotted specs (bug#6415) * lisp/emacs-lisp/cl-macs.el (cl-destructuring-bind): Use cl-macro-list1 instead of cl-macro-list in Edebug spec. * lisp/emacs-lisp/edebug.el (edebug-after-dotted-spec): Delete unused variable. (edebug-dotted-spec): Add docstring. (edebug-match-specs): Allow &optional and &rest specs to match nothing at the tail of a dotted form. Handle matches of dotted form tails which return non-lists. * test/lisp/emacs-lisp/edebug-tests.el (edebug-tests-dotted-forms): New test. * test/lisp/emacs-lisp/edebug-resources/edebug-test-code.el: (edebug-test-code-use-destructuring-bind): New function. diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index e313af2497..5535100d4a 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el @@ -684,7 +684,7 @@ its argument list allows full Common Lisp conventions." (defmacro cl-destructuring-bind (args expr &rest body) "Bind the variables in ARGS to the result of EXPR and execute BODY." (declare (indent 2) - (debug (&define cl-macro-list def-form cl-declarations def-body))) + (debug (&define cl-macro-list1 def-form cl-declarations def-body))) (let* ((cl--bind-lets nil) (cl--bind-forms nil) (cl--bind-defs nil) (cl--bind-block 'cl-none) (cl--bind-enquote nil)) (cl--do-arglist (or args '(&aux)) expr) diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el index d00b14e803..217bc2c906 100644 --- a/lisp/emacs-lisp/edebug.el +++ b/lisp/emacs-lisp/edebug.el @@ -950,7 +950,8 @@ circular objects. Let `read' read everything else." ;;; Cursors for traversal of list and vector elements with offsets. -(defvar edebug-dotted-spec nil) +(defvar edebug-dotted-spec nil + "Set to t when matching after the dot in a dotted spec list.") (defun edebug-new-cursor (expressions offsets) ;; Return a new cursor for EXPRESSIONS with OFFSETS. @@ -1494,8 +1495,6 @@ expressions; a `progn' form will be returned enclosing these forms." ;;; Matching of specs. -(defvar edebug-after-dotted-spec nil) - (defvar edebug-matching-depth 0) ;; initial value @@ -1556,36 +1555,48 @@ expressions; a `progn' form will be returned enclosing these forms." (let ((edebug-dotted-spec t));; Containing spec list was dotted. (edebug-match-specs cursor (list specs) remainder-handler))) - ;; Is the form dotted? - ((not (listp (edebug-cursor-expressions cursor)));; allow nil + ;; The reason for processing here &optional, &rest, and vectors + ;; which might contain them even when the form is dotted is to + ;; allow them to match nothing, so we can advance to the dotted + ;; part of the spec. + ((or (listp (edebug-cursor-expressions cursor)) + (vectorp (car specs)) + (memq (car specs) '(&optional &rest))) ; Process normally. + ;; (message "%scursor=%s specs=%s" + ;; (make-string edebug-matching-depth ?|) cursor (car specs)) + (let* ((spec (car specs)) + (rest) + (first-char (and (symbolp spec) (aref (symbol-name spec) 0))) + (match (cond + ((eq ?& first-char);; "&" symbols take all following specs. + (funcall (get-edebug-spec spec) cursor (cdr specs))) + ((eq ?: first-char);; ":" symbols take one following spec. + (setq rest (cdr (cdr specs))) + (funcall (get-edebug-spec spec) cursor (car (cdr specs)))) + (t;; Any other normal spec. + (setq rest (cdr specs)) + (edebug-match-one-spec cursor spec))))) + ;; The first match result may not be a list, which can happen + ;; when matching the tail of a dotted list. In that case + ;; there is no remainder. + (if (listp match) + (nconc match + (funcall remainder-handler cursor rest remainder-handler)) + match))) + + ;; Must be a dotted form, with no remaining &rest or &optional specs to + ;; match. + (t (if (not edebug-dotted-spec) (edebug-no-match cursor "Dotted spec required.")) ;; Cancel dotted spec and dotted form. (let ((edebug-dotted-spec) - (this-form (edebug-cursor-expressions cursor)) - (this-offset (edebug-cursor-offsets cursor))) - ;; Wrap the form in a list, (by changing the cursor??)... + (this-form (edebug-cursor-expressions cursor)) + (this-offset (edebug-cursor-offsets cursor))) + ;; Wrap the form in a list, by changing the cursor. (edebug-set-cursor cursor (list this-form) this-offset) - ;; and process normally, then unwrap the result. - (car (edebug-match-specs cursor specs remainder-handler)))) - - (t;; Process normally. - (let* ((spec (car specs)) - (rest) - (first-char (and (symbolp spec) (aref (symbol-name spec) 0)))) - ;;(message "spec = %s first char = %s" spec first-char) (sit-for 1) - (nconc - (cond - ((eq ?& first-char);; "&" symbols take all following specs. - (funcall (get-edebug-spec spec) cursor (cdr specs))) - ((eq ?: first-char);; ":" symbols take one following spec. - (setq rest (cdr (cdr specs))) - (funcall (get-edebug-spec spec) cursor (car (cdr specs)))) - (t;; Any other normal spec. - (setq rest (cdr specs)) - (edebug-match-one-spec cursor spec))) - (funcall remainder-handler cursor rest remainder-handler))))))) - + ;; Process normally, then unwrap the result. + (car (edebug-match-specs cursor specs remainder-handler))))))) ;; Define specs for all the symbol specs with functions used to process them. ;; Perhaps we shouldn't be doing this with edebug-form-specs since the diff --git a/test/lisp/emacs-lisp/edebug-resources/edebug-test-code.el b/test/lisp/emacs-lisp/edebug-resources/edebug-test-code.el index f52a2b1896..ca49dcd213 100644 --- a/test/lisp/emacs-lisp/edebug-resources/edebug-test-code.el +++ b/test/lisp/emacs-lisp/edebug-resources/edebug-test-code.el @@ -126,5 +126,9 @@ !start!(with-current-buffer (get-buffer-create "*edebug-test-code-buffer*") !body!(format "current-buffer: %s" (current-buffer)))) +(defun edebug-test-code-use-destructuring-bind () + (let ((two 2) (three 3)) + (cl-destructuring-bind (x . y) (cons two three) (+ x!x! y!y!)))) + (provide 'edebug-test-code) ;;; edebug-test-code.el ends here diff --git a/test/lisp/emacs-lisp/edebug-tests.el b/test/lisp/emacs-lisp/edebug-tests.el index 02f4d1c5ab..f6c016cdf8 100644 --- a/test/lisp/emacs-lisp/edebug-tests.el +++ b/test/lisp/emacs-lisp/edebug-tests.el @@ -899,5 +899,19 @@ test and possibly others should be updated." "@g" (should (equal edebug-tests-@-result '(#("abcd" 1 3 (face italic)) 511)))))) +(ert-deftest edebug-tests-dotted-forms () + "Edebug can instrument code matching the tail of a dotted spec (Bug#6415)." + (edebug-tests-with-normal-env + (edebug-tests-setup-@ "use-destructuring-bind" nil t) + (edebug-tests-run-kbd-macro + "@ SPC SPC SPC SPC SPC SPC" + (edebug-tests-should-be-at "use-destructuring-bind" "x") + (edebug-tests-should-match-result-in-messages "2 (#o2, #x2, ?\\C-b)") + "SPC" + (edebug-tests-should-be-at "use-destructuring-bind" "y") + (edebug-tests-should-match-result-in-messages "3 (#o3, #x3, ?\\C-c)") + "g" + (should (equal edebug-tests-@-result 5))))) + (provide 'edebug-tests) ;;; edebug-tests.el ends here commit 16358d4fcbad3fa60ff36167ae666b1ec7e7c02a Author: Eli Zaretskii Date: Sun Nov 26 20:23:15 2017 +0200 Improve documentation of "constant" symbols * src/font.c (syms_of_font) : * src/data.c (syms_of_data) : * src/buffer.c (syms_of_buffer) : Mention in the doc strings that these variables are read-only. * doc/lispref/variables.texi (Creating Buffer-Local): Document that making a constant variable buffer-local signals an error. * doc/lispref/variables.texi (Constant Variables): * doc/lispref/errors.texi (Standard Errors): More accurate and up-to-date documentation of which symbols cannot be assigned values. diff --git a/doc/lispref/errors.texi b/doc/lispref/errors.texi index 1f67819c34..cd22b70800 100644 --- a/doc/lispref/errors.texi +++ b/doc/lispref/errors.texi @@ -172,8 +172,11 @@ The message is @samp{Search failed}. @xref{Searching and Matching}. @item setting-constant The message is @samp{Attempt to set a constant symbol}. This happens -when attempting to assign values to @code{nil}, @code{t}, and keyword -symbols. @xref{Constant Variables}. +when attempting to assign values to @code{nil}, @code{t}, +@code{most-positive-fixnum}, @code{most-negative-fixnum}, and keyword +symbols. It also happens when attempting to assign values to +@code{enable-multibyte-characters} and some other symbols whose direct +assignment is not allowed for some reason. @xref{Constant Variables}. @c simple.el @item text-read-only diff --git a/doc/lispref/variables.texi b/doc/lispref/variables.texi index 99bbfc9124..a871352b00 100644 --- a/doc/lispref/variables.texi +++ b/doc/lispref/variables.texi @@ -139,6 +139,13 @@ Variables}). A @code{defconst} form serves to inform human readers that you do not intend to change the value of a variable, but Emacs does not raise an error if you actually change it. +@cindex read-only variables +A small number of additional symbols are made read-only for various +practical reasons. These include @code{enable-multibyte-characters}, +@code{most-positive-fixnum}, @code{most-negative-fixnum}, and a few +others. Any attempt to set or bind these also signals a +@code{setting-constant} error. + @node Local Variables @section Local Variables @cindex binding local variables @@ -1355,6 +1362,9 @@ is not current either on entry to or exit from the @code{let}. This is because @code{let} does not distinguish between different kinds of bindings; it knows only which variable the binding was made for. +It is an error to make a constant or a read-only variable +buffer-local. @xref{Constant Variables}. + If the variable is terminal-local (@pxref{Multiple Terminals}), this function signals an error. Such variables cannot have buffer-local bindings as well. @@ -1394,6 +1404,9 @@ in a void buffer-local value and leave the default value unaffected. The value returned is @var{variable}. +It is an error to make a constant or a read-only variable +buffer-local. @xref{Constant Variables}. + @strong{Warning:} Don't assume that you should use @code{make-variable-buffer-local} for user-option variables, simply because users @emph{might} want to customize them differently in diff --git a/src/buffer.c b/src/buffer.c index 6e3412c3d0..c6f9eb28e2 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -5620,6 +5620,8 @@ file I/O and the behavior of various editing commands. This variable is buffer-local but you cannot set it directly; use the function `set-buffer-multibyte' to change a buffer's representation. +To prevent any attempts to set it or make it buffer-local, Emacs will +signal an error in those cases. See also Info node `(elisp)Text Representations'. */); make_symbol_constant (intern_c_string ("enable-multibyte-characters")); diff --git a/src/data.c b/src/data.c index b4f6fd5c65..d54c46d72b 100644 --- a/src/data.c +++ b/src/data.c @@ -3880,12 +3880,14 @@ syms_of_data (void) set_symbol_function (Qwholenump, XSYMBOL (Qnatnump)->u.s.function); DEFVAR_LISP ("most-positive-fixnum", Vmost_positive_fixnum, - doc: /* The largest value that is representable in a Lisp integer. */); + doc: /* The largest value that is representable in a Lisp integer. +This variable cannot be set; trying to do so will signal an error. */); Vmost_positive_fixnum = make_number (MOST_POSITIVE_FIXNUM); make_symbol_constant (intern_c_string ("most-positive-fixnum")); DEFVAR_LISP ("most-negative-fixnum", Vmost_negative_fixnum, - doc: /* The smallest value that is representable in a Lisp integer. */); + doc: /* The smallest value that is representable in a Lisp integer. +This variable cannot be set; trying to do so will signal an error. */); Vmost_negative_fixnum = make_number (MOST_NEGATIVE_FIXNUM); make_symbol_constant (intern_c_string ("most-negative-fixnum")); diff --git a/src/font.c b/src/font.c index 51625b49fa..f7cebdce78 100644 --- a/src/font.c +++ b/src/font.c @@ -5421,19 +5421,22 @@ gets the repertory information by an opened font and ENCODING. */); doc: /* Vector of valid font weight values. Each element has the form: [NUMERIC-VALUE SYMBOLIC-NAME ALIAS-NAME ...] -NUMERIC-VALUE is an integer, and SYMBOLIC-NAME and ALIAS-NAME are symbols. */); +NUMERIC-VALUE is an integer, and SYMBOLIC-NAME and ALIAS-NAME are symbols. +This variable cannot be set; trying to do so will signal an error. */); Vfont_weight_table = BUILD_STYLE_TABLE (weight_table); make_symbol_constant (intern_c_string ("font-weight-table")); DEFVAR_LISP_NOPRO ("font-slant-table", Vfont_slant_table, doc: /* Vector of font slant symbols vs the corresponding numeric values. -See `font-weight-table' for the format of the vector. */); +See `font-weight-table' for the format of the vector. +This variable cannot be set; trying to do so will signal an error. */); Vfont_slant_table = BUILD_STYLE_TABLE (slant_table); make_symbol_constant (intern_c_string ("font-slant-table")); DEFVAR_LISP_NOPRO ("font-width-table", Vfont_width_table, doc: /* Alist of font width symbols vs the corresponding numeric values. -See `font-weight-table' for the format of the vector. */); +See `font-weight-table' for the format of the vector. +This variable cannot be set; trying to do so will signal an error. */); Vfont_width_table = BUILD_STYLE_TABLE (width_table); make_symbol_constant (intern_c_string ("font-width-table"));