commit 39c0795ef2d592d4632516ee57f1cf51a2159608 (HEAD, refs/remotes/origin/master) Author: Glenn Morris Date: Tue Apr 2 21:40:56 2019 -0700 ; Copyright years and license copyedits diff --git a/test/lisp/gnus/gnus-test-headers.el b/test/lisp/gnus/gnus-test-headers.el index 805a300333..abf3d4f271 100644 --- a/test/lisp/gnus/gnus-test-headers.el +++ b/test/lisp/gnus/gnus-test-headers.el @@ -1,21 +1,23 @@ ;;; gnus-test-headers.el --- Tests for Gnus header-related functions -*- lexical-binding: t; -*- -;; Copyright (C) 2018 Free Software Foundation, Inc. +;; Copyright (C) 2018-2019 Free Software Foundation, Inc. ;; Author: Eric Abrahamsen -;; This program is free software; you can redistribute it and/or modify +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. -;; This program is distributed in the hope that it will be useful, +;; GNU Emacs is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . +;; along with GNU Emacs. If not, see . ;;; Commentary: commit b36913d803ee22a314f2e0a27523fbadeb60dd2c Author: Noam Postavsky Date: Sat Oct 27 17:45:00 2018 -0400 Allow partial decompression (Bug#33133) * src/decompress.c (Fzlib_decompress_region): Add optional ALLOW-PARTIAL parameter. * lisp/url/url-http.el (url-handle-content-transfer-encoding): Use it. * doc/lispref/text.texi (Decompression): Document it. * etc/NEWS: Announce it. diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi index b430adf597..86f9fa0e5f 100644 --- a/doc/lispref/text.texi +++ b/doc/lispref/text.texi @@ -4513,14 +4513,17 @@ This function returns non-@code{nil} if built-in zlib decompression is available. @end defun -@defun zlib-decompress-region start end +@defun zlib-decompress-region start end &optional allow-partial This function decompresses the region between @var{start} and @var{end}, using built-in zlib decompression. The region should contain data that were compressed with gzip or zlib. On success, the function replaces the contents of the region with the decompressed -data. On failure, the function leaves the region unchanged and -returns @code{nil}. This function can be called only in unibyte -buffers. +data. If @var{allow-partial} is @code{nil} or omitted, then on +failure, the function leaves the region unchanged and returns +@code{nil}. Otherwise, it returns the number of bytes that were not +decompressed and replaces the region text by whatever data was +successfully decompressed. This function can be called only in +unibyte buffers. @end defun diff --git a/etc/NEWS b/etc/NEWS index 7f6aeab73f..2bf2b4972a 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1672,6 +1672,12 @@ are implemented in C using the Jansson library. and 'flatten' it such that the result is a list of all the terminal nodes. ++++ +** 'zlib-decompress-region' can partially decompress corrupted data. +If the new optional ALLOW-PARTIAL argument is passed, then the data +that was decompressed successfully before failing will be inserted +into the buffer. + ** Mailcap --- diff --git a/lisp/url/url-http.el b/lisp/url/url-http.el index 1fbc087073..cf1952066a 100644 --- a/lisp/url/url-http.el +++ b/lisp/url/url-http.el @@ -939,7 +939,8 @@ should be shown to the user." (goto-char (point-min)) success)) -(declare-function zlib-decompress-region "decompress.c" (start end)) +(declare-function zlib-decompress-region "decompress.c" + (start end &optional allow-partial)) (defun url-handle-content-transfer-encoding () (let ((encoding (mail-fetch-field "content-encoding"))) @@ -951,7 +952,7 @@ should be shown to the user." (widen) (goto-char (point-min)) (when (search-forward "\n\n") - (zlib-decompress-region (point) (point-max))))))) + (zlib-decompress-region (point) (point-max) t)))))) ;; Miscellaneous (defun url-http-activate-callback () diff --git a/src/decompress.c b/src/decompress.c index e66e4798b1..4ca6a50b2a 100644 --- a/src/decompress.c +++ b/src/decompress.c @@ -120,12 +120,18 @@ DEFUN ("zlib-available-p", Fzlib_available_p, Szlib_available_p, 0, 0, 0, DEFUN ("zlib-decompress-region", Fzlib_decompress_region, Szlib_decompress_region, - 2, 2, 0, + 2, 3, 0, doc: /* Decompress a gzip- or zlib-compressed region. Replace the text in the region by the decompressed data. -On failure, return nil and leave the data in place. + +If optional parameter ALLOW-PARTIAL is nil or omitted, then on +failure, return nil and leave the data in place. Otherwise, return +the number of bytes that were not decompressed and replace the region +text by whatever data was successfully decompressed (similar to gzip). +If decompression is completely successful return t. + This function can be called only in unibyte buffers. */) - (Lisp_Object start, Lisp_Object end) + (Lisp_Object start, Lisp_Object end, Lisp_Object allow_partial) { ptrdiff_t istart, iend, pos_byte; z_stream stream; @@ -206,8 +212,14 @@ This function can be called only in unibyte buffers. */) } while (inflate_status == Z_OK); + Lisp_Object ret = Qt; if (inflate_status != Z_STREAM_END) - return unbind_to (count, Qnil); + { + if (!NILP (allow_partial)) + ret = make_int (iend - pos_byte); + else + return unbind_to (count, Qnil); + } unwind_data.start = 0; @@ -218,7 +230,7 @@ This function can be called only in unibyte buffers. */) signal_after_change (istart, iend - istart, unwind_data.nbytes); update_compositions (istart, istart, CHECK_HEAD); - return unbind_to (count, Qt); + return unbind_to (count, ret); } commit 2bd3e484041b2b7ea47c236b86f59610d971b609 Author: Basil L. Contovounesios Date: Mon Mar 25 20:14:40 2019 +0000 * lisp/gnus/gnus-dup.el: Use lexical-binding (gnus-dup-list-dirty): Add docstring. (gnus-dup-open): Allocate gnus-dup-hashtb more conservatively now that it is no longer an obarray. (gnus-dup-enter-articles): Fix off-by-one error. (gnus-dup-suppress-articles): DRY. For discussion, see thread starting at: https://lists.gnu.org/archive/html/emacs-devel/2019-03/msg00974.html diff --git a/lisp/gnus/gnus-dup.el b/lisp/gnus/gnus-dup.el index 8b876489e1..49022124e9 100644 --- a/lisp/gnus/gnus-dup.el +++ b/lisp/gnus/gnus-dup.el @@ -1,4 +1,4 @@ -;;; gnus-dup.el --- suppression of duplicate articles in Gnus +;;; gnus-dup.el --- suppression of duplicate articles in Gnus -*- lexical-binding: t -*- ;; Copyright (C) 1996-2019 Free Software Foundation, Inc. @@ -57,10 +57,12 @@ seen in the same session." (defvar gnus-dup-list nil "List of seen message IDs, as strings.") + (defvar gnus-dup-hashtb nil "Hash table of seen message IDs, for fast lookup.") -(defvar gnus-dup-list-dirty nil) +(defvar gnus-dup-list-dirty nil + "Non-nil if `gnus-dup-list' needs to be saved.") ;;; ;;; Starting and stopping @@ -80,7 +82,7 @@ seen in the same session." (if gnus-save-duplicate-list (gnus-dup-read) (setq gnus-dup-list nil)) - (setq gnus-dup-hashtb (gnus-make-hashtable gnus-duplicate-list-length)) + (setq gnus-dup-hashtb (gnus-make-hashtable)) ;; Enter all Message-IDs into the hash table. (dolist (g gnus-dup-list) (puthash g t gnus-dup-hashtb))) @@ -121,11 +123,13 @@ seen in the same session." (not (gethash msgid gnus-dup-hashtb))) (push msgid gnus-dup-list) (puthash msgid t gnus-dup-hashtb)))) - ;; Chop off excess Message-IDs from the list. - (let ((end (nthcdr gnus-duplicate-list-length gnus-dup-list))) + ;; Remove excess Message-IDs from the list and hash table. + (let* ((dups (cons nil gnus-dup-list)) + (end (nthcdr gnus-duplicate-list-length dups))) (when end (mapc (lambda (id) (remhash id gnus-dup-hashtb)) (cdr end)) - (setcdr end nil)))) + (setcdr end nil)) + (setq gnus-dup-list (cdr dups)))) (defun gnus-dup-suppress-articles () "Mark duplicate articles as read." @@ -137,10 +141,9 @@ seen in the same session." number) (dolist (header gnus-newsgroup-headers) (when (and (gethash (mail-header-id header) gnus-dup-hashtb) - (gnus-summary-article-unread-p (mail-header-number header))) - (setq gnus-newsgroup-unreads - (delq (setq number (mail-header-number header)) - gnus-newsgroup-unreads)) + (setq number (mail-header-number header)) + (gnus-summary-article-unread-p number)) + (setq gnus-newsgroup-unreads (delq number gnus-newsgroup-unreads)) (if (not auto) (push (cons number gnus-duplicate-mark) gnus-newsgroup-reads) (push number gnus-newsgroup-expirable) commit e25e7d812f2f3f9a195b7b201b8bd99a5228b108 Author: Wilson Snyder Date: Tue Apr 2 20:05:16 2019 -0400 Fix verilog-mode vmm statements and AUTOINPUTREG ignores. * lisp/progmodes/verilog-mode.el (verilog-vmm-statement-re): Fix vmm statement regexps. Reported by Mattias Engdegard. (verilog-auto-reg-input) (verilog-auto-reg-input-assigned-ignore-regexp): For AUTOINPUTREG, allow ignoring assignments with new `verilog-auto-reg-input-assigned-ignore-regexp' variable, bug1401. Reported by David Rogoff. diff --git a/lisp/progmodes/verilog-mode.el b/lisp/progmodes/verilog-mode.el index f55cf0002d..7b9c3921fb 100644 --- a/lisp/progmodes/verilog-mode.el +++ b/lisp/progmodes/verilog-mode.el @@ -121,7 +121,7 @@ ;; ;; This variable will always hold the version number of the mode -(defconst verilog-mode-version "2019-03-05-39b4dac-vpo-GNU" +(defconst verilog-mode-version "2019-04-02-5d62d3f-vpo-GNU" "Version of this Verilog mode.") (defconst verilog-mode-release-emacs t "If non-nil, this version of Verilog mode was released with Emacs itself.") @@ -1285,6 +1285,13 @@ See the \\[verilog-faq] for examples on using this." :type '(choice (const nil) regexp)) (put 'verilog-auto-input-ignore-regexp 'safe-local-variable 'stringp) +(defcustom verilog-auto-reg-input-assigned-ignore-regexp nil + "If non-nil, when creating AUTOINPUTREG, ignore signals matching this regexp." + :version "27.1" + :group 'verilog-mode-auto + :type '(choice (const nil) regexp)) +(put 'verilog-auto-reg-input-assigned-ignore-regexp 'safe-local-variable 'stringp) + (defcustom verilog-auto-inout-ignore-regexp nil "If non-nil, when creating AUTOINOUT, ignore signals matching this regexp. See the \\[verilog-faq] for examples on using this." @@ -2144,14 +2151,7 @@ find the errors." ) nil ) ) ) (defconst verilog-vmm-statement-re - (eval-when-compile - (verilog-regexp-opt - '( - "`vmm_\\(data\\|env\\|scenario\\|subenv\\|xactor\\)_member_\\(scalar\\|string\\|enum\\|vmm_data\\|channel\\|xactor\\|subenv\\|user_defined\\)\\(_array\\)?" - ;; "`vmm_xactor_member_enum_array" - ;; "`vmm_xactor_member_scalar_array" - ;; "`vmm_xactor_member_scalar" - ) nil ))) + "`vmm_\\(data\\|env\\|scenario\\|subenv\\|xactor\\)_member_\\(scalar\\|string\\|enum\\|vmm_data\\|channel\\|xactor\\|subenv\\|user_defined\\)\\(_array\\)?") (defconst verilog-ovm-statement-re (eval-when-compile @@ -2973,7 +2973,8 @@ find the errors." ;; `timescale time_unit / time_precision "\\<\\(`timescale\\)\\>\\s-+10\\{0,2\\}\\s-*[munpf]?s\\s-*/\\s-*10\\{0,2\\}\\s-*[munpf]?s" "\\)\\|\\(?:" - ;; `define and `if can span multiple lines if line ends in '\'. NOTE: `if is not IEEE 1800-2012 + ;; `define and `if can span multiple lines if line ends in '\'. + ;; NOTE: `if is not IEEE 1800-2012. ;; from http://www.emacswiki.org/emacs/MultilineRegexp (concat "\\<\\(`define\\|`if\\)\\>" ; directive "\\s-+" ; separator @@ -12078,15 +12079,18 @@ Typing \\[verilog-auto] will make this into: (defun verilog-auto-reg-input () "Expand AUTOREGINPUT statements, as part of \\[verilog-auto]. -Make reg statements instantiation inputs that aren't already declared. -This is useful for making a top level shell for testing the module that is -to be instantiated. +Make reg statements instantiation inputs that aren't already +declared or assigned to. This is useful for making a top level +shell for testing the module that is to be instantiated. Limitations: This ONLY detects inputs of AUTOINSTants (see `verilog-read-sub-decls'). This does NOT work on memories, declare those yourself. + Assignments cause the assigned-to variable not to be declared unless + the name matches `verilog-auto-reg-input-assigned-ignore-regexp'. + An example (see `verilog-auto-inst' for what else is going on here): module ExampRegInput (o,i); @@ -12124,7 +12128,9 @@ Typing \\[verilog-auto] will make this into: (append (verilog-subdecls-get-inputs modsubdecls) (verilog-subdecls-get-inouts modsubdecls)) (append (verilog-decls-get-signals moddecls) - (verilog-decls-get-assigns moddecls)))))) + (verilog-signals-not-matching-regexp + (verilog-decls-get-assigns moddecls) + verilog-auto-reg-input-assigned-ignore-regexp)))))) (when sig-list (verilog-forward-or-insert-line) (verilog-insert-indent "// Beginning of automatic reg inputs (for undeclared instantiated-module inputs)\n") commit f9ff60e0d7288e30cdbd1e43225059f1374441f1 Author: Paul Eggert Date: Tue Apr 2 15:00:59 2019 -0700 Improve regexp advice again, and unchain ranges * doc/lispref/searching.texi (Regexp Special): Mention char classes earlier, in a more-logical place. Advise sticking to ASCII letters and digits in ranges. Reword negative advice to make it clearer that it’s negative. * lisp/files.el (make-auto-save-file-name): * lisp/gnus/message.el (message-mailer-swallows-blank-line): * lisp/gnus/nndoc.el (nndoc-lanl-gov-announce-type-p) (nndoc-generate-lanl-gov-head): * lisp/org/org-eshell.el (org-eshell-open): * lisp/org/org.el (org-deadline-time-hour-regexp) (org-scheduled-time-hour-regexp): * lisp/progmodes/bat-mode.el (bat-font-lock-keywords): * lisp/progmodes/bug-reference.el (bug-reference-bug-regexp): * lisp/textmodes/less-css-mode.el (less-css-font-lock-keywords): * lisp/vc/vc-cvs.el (vc-cvs-valid-symbolic-tag-name-p): * lisp/vc/vc-svn.el (vc-svn-valid-symbolic-tag-name-p): Avoid attempts to chain ranges, as this can be confusing. For example, instead of [0-9-_.], use [0-9_.-]. diff --git a/doc/lispref/searching.texi b/doc/lispref/searching.texi index 72ee9233a3..8775254dd0 100644 --- a/doc/lispref/searching.texi +++ b/doc/lispref/searching.texi @@ -395,9 +395,18 @@ or @samp{$}, @samp{%} or period. However, the ending character of one range should not be the starting point of another one; for example, @samp{[a-m-z]} should be avoided. +A character alternative can also specify named character classes +(@pxref{Char Classes}). This is a POSIX feature. For example, +@samp{[[:ascii:]]} matches any @acronym{ASCII} character. +Using a character class is equivalent to mentioning each of the +characters in that class; but the latter is not feasible in practice, +since some classes include thousands of different characters. +A character class should not appear as the lower or upper bound +of a range. + The usual regexp special characters are not special inside a character alternative. A completely different set of characters is -special inside character alternatives: @samp{]}, @samp{-} and @samp{^}. +special: @samp{]}, @samp{-} and @samp{^}. To include @samp{]} in a character alternative, put it at the beginning. To include @samp{^}, put it anywhere but at the beginning. To include @samp{-}, put it at the end. Thus, @samp{[]^-]} matches @@ -430,33 +439,36 @@ matches only @samp{/} rather than the likely-intended four characters. @end enumerate Some kinds of character alternatives are not the best style even -though they are standardized by POSIX and are portable. They include: +though they have a well-defined meaning in Emacs. They include: @enumerate @item -A character alternative can include duplicates. For example, -@samp{[XYa-yYb-zX]} is less clear than @samp{[XYa-z]}. +Although a range's bound can be almost any character, it is better +style to stay within natural sequences of ASCII letters and digits +because most people have not memorized character code tables. +For example, @samp{[.-9]} is less clear than @samp{[./0-9]}, +and @samp{[`-~]} is less clear than @samp{[`a-z@{|@}~]}. +Unicode character escapes can help here; for example, for most programmers +@samp{[ก-ฺ฿-๛]} is less clear than @samp{[\u0E01-\u0E3A\u0E3F-\u0E5B]}. @item -A range can denote just one, two, or three characters. For example, -@samp{[(-(]} is less clear than @samp{[(]}, @samp{[*-+]} is less clear -than @samp{[*+]}, and @samp{[*-,]} is less clear than @samp{[*+,]}. +Although a character alternative can include duplicates, it is better +style to avoid them. For example, @samp{[XYa-yYb-zX]} is less clear +than @samp{[XYa-z]}. @item -A @samp{-} also appear at the beginning of a character alternative, or -as the upper bound of a range. For example, although @samp{[-a-z]} is -valid, @samp{[a-z-]} is better style; and although @samp{[!--/]} is -valid, @samp{[!-,/-]} is clearer. -@end enumerate +Although a range can denote just one, two, or three characters, it +is simpler to list the characters. For example, +@samp{[a-a0]} is less clear than @samp{[a0]}, @samp{[i-j]} is less clear +than @samp{[ij]}, and @samp{[i-k]} is less clear than @samp{[ijk]}. -A character alternative can also specify named character classes -(@pxref{Char Classes}). This is a POSIX feature. For example, -@samp{[[:ascii:]]} matches any @acronym{ASCII} character. -Using a character class is equivalent to mentioning each of the -characters in that class; but the latter is not feasible in practice, -since some classes include thousands of different characters. -A character class should not appear as the lower or upper bound -of a range. +@item +Although a @samp{-} can appear at the beginning of a character +alternative or as the upper bound of a range, it is better style to +put @samp{-} by itself at the end of a character alternative. For +example, although @samp{[-a-z]} is valid, @samp{[a-z-]} is better +style; and although @samp{[*--]} is valid, @samp{[*+,-]} is clearer. +@end enumerate @item @samp{[^ @dots{} ]} @cindex @samp{^} in regexp diff --git a/lisp/files.el b/lisp/files.el index 77a194b085..1dae57593a 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -6316,7 +6316,7 @@ See also `auto-save-file-name-p'." ;; We do this on all platforms, because even if we are not ;; running on DOS/Windows, the current directory may be on a ;; mounted VFAT filesystem, such as a USB memory stick. - (while (string-match "[^A-Za-z0-9-_.~#+]" buffer-name limit) + (while (string-match "[^A-Za-z0-9_.~#+-]" buffer-name limit) (let* ((character (aref buffer-name (match-beginning 0))) (replacement ;; For multibyte characters, this will produce more than diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index dae4b0dced..c8b6f0ee68 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -1288,7 +1288,7 @@ called and its result is inserted." ;; According to RFC 822 and its successors, the field name must ;; consist of printable US-ASCII characters other than colon, ;; i.e., decimal 33-56 and 59-126. - '(looking-at "[ \t]\\|[][!\"#$%&'()*+,-./0-9;<=>?@A-Z\\^_`a-z{|}~]+:")) + '(looking-at "[ \t]\\|[][!\"#$%&'()*+,./0-9;<=>?@A-Z\\^_`a-z{|}~-]+:")) "Set this non-nil if the system's mailer runs the header and body together. \(This problem exists on Sunos 4 when sendmail is run in remote mode.) The value should be an expression to test whether the problem will diff --git a/lisp/gnus/nndoc.el b/lisp/gnus/nndoc.el index 8f1217b127..532ba11fa0 100644 --- a/lisp/gnus/nndoc.el +++ b/lisp/gnus/nndoc.el @@ -701,7 +701,7 @@ from the document.") (defun nndoc-lanl-gov-announce-type-p () (when (let ((case-fold-search nil)) - (re-search-forward "^\\\\\\\\\n\\(Paper\\( (\\*cross-listing\\*)\\)?: [a-zA-Z-\\.]+/[0-9]+\\|arXiv:\\)" nil t)) + (re-search-forward "^\\\\\\\\\n\\(Paper\\( (\\*cross-listing\\*)\\)?: [a-zA-Z\\.-]+/[0-9]+\\|arXiv:\\)" nil t)) t)) (defun nndoc-transform-lanl-gov-announce (article) @@ -732,7 +732,7 @@ from the document.") (save-restriction (narrow-to-region (car entry) (nth 1 entry)) (goto-char (point-min)) - (when (looking-at "^\\(Paper.*: \\|arXiv:\\)\\([0-9a-zA-Z-\\./]+\\)") + (when (looking-at "^\\(Paper.*: \\|arXiv:\\)\\([0-9a-zA-Z\\./-]+\\)") (setq subject (concat " (" (match-string 2) ")")) (when (re-search-forward "^From: \\(.*\\)" nil t) (setq from (concat "<" diff --git a/lisp/org/org-eshell.el b/lisp/org/org-eshell.el index bb27d92e12..2251a1b892 100644 --- a/lisp/org/org-eshell.el +++ b/lisp/org/org-eshell.el @@ -37,7 +37,7 @@ eshell buffer) or a command line prefixed by a buffer name followed by a colon." (let* ((buffer-and-command - (if (string-match "\\([A-Za-z0-9-+*]+\\):\\(.*\\)" link) + (if (string-match "\\([A-Za-z0-9+*-]+\\):\\(.*\\)" link) (list (match-string 1 link) (match-string 2 link)) (list eshell-buffer-name link))) diff --git a/lisp/org/org.el b/lisp/org/org.el index bf7e305b7a..ce6dd24a83 100644 --- a/lisp/org/org.el +++ b/lisp/org/org.el @@ -430,7 +430,7 @@ Matched keyword is in group 1.") (defconst org-deadline-time-hour-regexp (concat "\\<" org-deadline-string - " *<\\([^>]+[0-9]\\{1,2\\}:[0-9]\\{2\\}[0-9-+:hdwmy \t.]*\\)>") + " *<\\([^>]+[0-9]\\{1,2\\}:[0-9]\\{2\\}[0-9+:hdwmy \t.-]*\\)>") "Matches the DEADLINE keyword together with a time-and-hour stamp.") (defconst org-deadline-line-regexp @@ -446,7 +446,7 @@ Matched keyword is in group 1.") (defconst org-scheduled-time-hour-regexp (concat "\\<" org-scheduled-string - " *<\\([^>]+[0-9]\\{1,2\\}:[0-9]\\{2\\}[0-9-+:hdwmy \t.]*\\)>") + " *<\\([^>]+[0-9]\\{1,2\\}:[0-9]\\{2\\}[0-9+:hdwmy \t.-]*\\)>") "Matches the SCHEDULED keyword together with a time-and-hour stamp.") (defconst org-closed-time-regexp diff --git a/lisp/progmodes/bat-mode.el b/lisp/progmodes/bat-mode.el index 6c85ff9905..a8b002be59 100644 --- a/lisp/progmodes/bat-mode.el +++ b/lisp/progmodes/bat-mode.el @@ -78,7 +78,7 @@ "goto" "gtr" "if" "in" "leq" "lss" "neq" "not" "start")) (UNIX '("bash" "cat" "cp" "fgrep" "grep" "ls" "sed" "sh" "mv" "rm"))) - `(("\\_<\\(call\\|goto\\)\\_>[ \t]+%?\\([A-Za-z0-9-_\\:.]+\\)%?" + `(("\\_<\\(call\\|goto\\)\\_>[ \t]+%?\\([A-Za-z0-9_\\:.-]+\\)%?" (2 font-lock-constant-face t)) ("^:[^:].*" . 'bat-label-face) diff --git a/lisp/progmodes/bug-reference.el b/lisp/progmodes/bug-reference.el index 8baf74854f..759db1f568 100644 --- a/lisp/progmodes/bug-reference.el +++ b/lisp/progmodes/bug-reference.el @@ -69,7 +69,7 @@ so that it is considered safe, see `enable-local-variables'.") (get s 'bug-reference-url-format))))) (defcustom bug-reference-bug-regexp - "\\([Bb]ug ?#?\\|[Pp]atch ?#\\|RFE ?#\\|PR [a-z-+]+/\\)\\([0-9]+\\(?:#[0-9]+\\)?\\)" + "\\([Bb]ug ?#?\\|[Pp]atch ?#\\|RFE ?#\\|PR [a-z+-]+/\\)\\([0-9]+\\(?:#[0-9]+\\)?\\)" "Regular expression matching bug references. The second subexpression should match the bug reference (usually a number)." :type 'string diff --git a/lisp/textmodes/less-css-mode.el b/lisp/textmodes/less-css-mode.el index b4c7f28985..4077789eb1 100644 --- a/lisp/textmodes/less-css-mode.el +++ b/lisp/textmodes/less-css-mode.el @@ -194,10 +194,10 @@ directory by default." ;; - custom faces. (defconst less-css-font-lock-keywords '(;; Variables - ("@[a-z_-][a-z-_0-9]*" . font-lock-variable-name-face) + ("@[a-z_-][a-z_0-9-]*" . font-lock-variable-name-face) ("&" . font-lock-preprocessor-face) ;; Mixins - ("\\(?:[ \t{;]\\|^\\)\\(\\.[a-z_-][a-z-_0-9]*\\)[ \t]*;" . + ("\\(?:[ \t{;]\\|^\\)\\(\\.[a-z_-][a-z_0-9-]*\\)[ \t]*;" . (1 font-lock-keyword-face)))) (defvar less-css-mode-syntax-table diff --git a/lisp/vc/vc-cvs.el b/lisp/vc/vc-cvs.el index 3bbd0ed49b..626e190c1e 100644 --- a/lisp/vc/vc-cvs.el +++ b/lisp/vc/vc-cvs.el @@ -1087,7 +1087,7 @@ CVS/Entries should only be accessed through this function." ;; an uppercase or lowercase letter and can contain uppercase and ;; lowercase letters, digits, `-', and `_'. (and (string-match "^[a-zA-Z]" tag) - (not (string-match "[^a-z0-9A-Z-_]" tag)))) + (not (string-match "[^a-z0-9A-Z_-]" tag)))) (defun vc-cvs-valid-revision-number-p (tag) "Return non-nil if TAG is a valid revision number." diff --git a/lisp/vc/vc-svn.el b/lisp/vc/vc-svn.el index 618f03eedc..3c50c8fff6 100644 --- a/lisp/vc/vc-svn.el +++ b/lisp/vc/vc-svn.el @@ -759,7 +759,7 @@ Set file properties accordingly. If FILENAME is non-nil, return its status." ;; an uppercase or lowercase letter and can contain uppercase and ;; lowercase letters, digits, `-', and `_'. (and (string-match "^[a-zA-Z]" tag) - (not (string-match "[^a-z0-9A-Z-_]" tag)))) + (not (string-match "[^a-z0-9A-Z_-]" tag)))) (defun vc-svn-valid-revision-number-p (tag) "Return non-nil if TAG is a valid revision number." commit bb669166ba6b33cd1a927c772c87ee2240a10f89 Author: Eli Zaretskii Date: Tue Apr 2 20:08:08 2019 +0300 Fix documentation of last change * doc/misc/cl.texi (Structures): Document :noinline. * etc/NEWS: Mark the entry for :noinline as documented. diff --git a/doc/misc/cl.texi b/doc/misc/cl.texi index 32b5076c90..eb06791ba9 100644 --- a/doc/misc/cl.texi +++ b/doc/misc/cl.texi @@ -4149,7 +4149,7 @@ package, @code{cl-typep} simply looks for a function called only if they used the default predicate name. @item :include -This option implements a very limited form of C++-style inheritance. +This option implements a very limited form of C@t{++}-style inheritance. The argument is the name of another structure type previously created with @code{cl-defstruct}. The effect is to cause the new structure type to inherit all of the included structure's slots @@ -4194,6 +4194,10 @@ of a @code{person}, plus extra slots that are specific to astronauts. Operations that work on people (like @code{person-name}) work on astronauts just like other people. +@item :noinline +If this option is present, this structure's functions will not be +inlined, even functions that normally would. + @item :print-function In full Common Lisp, this option allows you to specify a function that is called to print an instance of the structure type. The diff --git a/etc/NEWS b/etc/NEWS index db8dc1e49c..7f6aeab73f 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -386,6 +386,7 @@ current and the previous or the next line, as before. * Changes in Specialized Modes and Packages in Emacs 27.1 ** cl-lib ++++ *** cl-defstruct has a new :noinline argument to prevent inlining its functions ** doc-view-mode commit 144b2243b7cee4adbc3217d871c575921f95af54 Author: Stefan Monnier Date: Tue Apr 2 12:24:52 2019 -0400 * lisp/emacs-lisp/cl-macs.el: Don't always inline struct functions (cl--struct-inline): New var. (cl-defstruct): Obey it along with a new :noinline keyword argument. diff --git a/etc/NEWS b/etc/NEWS index 836dd2bb1a..db8dc1e49c 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -385,6 +385,9 @@ current and the previous or the next line, as before. * Changes in Specialized Modes and Packages in Emacs 27.1 +** cl-lib +*** cl-defstruct has a new :noinline argument to prevent inlining its functions + ** doc-view-mode *** New commands doc-view-presentation and doc-view-fit-window-to-page *** Added support for password-protected PDF files diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index 5faa055f99..16e9bd6a75 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el @@ -2687,6 +2687,9 @@ The function's arguments should be treated as immutable. ;; for bootstrapping reasons. (defvar cl--struct-default-parent nil) +(defvar cl--struct-inline t + "If non-nil, `cl-defstruct' will define inlinable functions.") + ;;;###autoload (defmacro cl-defstruct (struct &rest descs) "Define a struct type. @@ -2698,7 +2701,7 @@ You can use the accessors to set the corresponding slots, via `setf'. NAME may instead take the form (NAME OPTIONS...), where each OPTION is either a single keyword or (KEYWORD VALUE) where KEYWORD can be one of :conc-name, :constructor, :copier, :predicate, -:type, :named, :initial-offset, :print-function, or :include. +:type, :named, :initial-offset, :print-function, :noinline, or :include. Each SLOT may instead take the form (SNAME SDEFAULT SOPTIONS...), where SDEFAULT is the default value of that slot and SOPTIONS are keyword-value @@ -2757,6 +2760,8 @@ non-nil value, that slot cannot be set via `setf'. (include-name nil) (type nil) ;nil here means not specified explicitly. (named nil) + (cldefsym (if cl--struct-inline 'cl-defsubst 'cl-defun)) + (defsym (if cl--struct-inline 'cl-defsubst 'defun)) (forms nil) (docstring (if (stringp (car descs)) (pop descs))) pred-form pred-check) @@ -2803,6 +2808,8 @@ non-nil value, that slot cannot be set via `setf'. (error "Invalid :type specifier: %s" type))) ((eq opt :named) (setq named t)) + ((eq opt :noinline) + (setq defsym 'defun) (setq cldefsym 'cl-defun)) ((eq opt :initial-offset) (setq descs (nconc (make-list (car args) '(cl-skip-slot)) descs))) @@ -2861,7 +2868,7 @@ non-nil value, that slot cannot be set via `setf'. (cons 'and (cl-cdddr pred-form)) `(,predicate cl-x)))) (when pred-form - (push `(cl-defsubst ,predicate (cl-x) + (push `(,defsym ,predicate (cl-x) (declare (side-effect-free error-free)) ,(if (eq (car pred-form) 'and) (append pred-form '(t)) @@ -2884,7 +2891,7 @@ non-nil value, that slot cannot be set via `setf'. (push (pop desc) defaults) ;; The arg "cl-x" is referenced by name in eg pred-form ;; and pred-check, so changing it is not straightforward. - (push `(cl-defsubst ,accessor (cl-x) + (push `(,defsym ,accessor (cl-x) ,(format "Access slot \"%s\" of `%s' struct CL-X." slot struct) (declare (side-effect-free t)) @@ -2955,7 +2962,7 @@ non-nil value, that slot cannot be set via `setf'. (let* ((anames (cl--arglist-args args)) (make (cl-mapcar (function (lambda (s d) (if (memq s anames) s d))) slots defaults))) - (push `(cl-defsubst ,cname + (push `(,cldefsym ,cname (&cl-defs (nil ,@descs) ,@args) ,(if (stringp doc) doc (format "Constructor for objects of type `%s'." name)) commit 84616144ca206ef9a92bd0cd2507376f42bfe3e6 Author: Stefan Monnier Date: Tue Apr 2 09:51:20 2019 -0400 * lisp/subr.el (prog2): Define as a macro * src/eval.c (Fprog2): Delete function. (syms_of_eval): Don't register it. * lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker): * lisp/emacs-lisp/generator.el (cps--transform-1): Remove `prog2` case. * lisp/emacs-lisp/bytecomp.el (prog2): Remove handlers. (byte-compile-prog2): Delete. * lisp/emacs-lisp/lisp-mode.el (prog2): Remove property. diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el index 4418c9a1bf..33d4964763 100644 --- a/lisp/emacs-lisp/byte-opt.el +++ b/lisp/emacs-lisp/byte-opt.el @@ -436,11 +436,6 @@ (cons (byte-optimize-form (nth 1 form) for-effect) (byte-optimize-body (cdr (cdr form)) t))) (byte-optimize-form (nth 1 form) for-effect))) - ((eq fn 'prog2) - (cons 'prog2 - (cons (byte-optimize-form (nth 1 form) t) - (cons (byte-optimize-form (nth 2 form) for-effect) - (byte-optimize-body (cdr (cdr (cdr form))) t))))) ((memq fn '(save-excursion save-restriction save-current-buffer)) ;; those subrs which have an implicit progn; it's not quite good diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 9dd5151963..8bbe6292d9 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -2501,9 +2501,8 @@ list that represents a doc string reference. (put 'progn 'byte-hunk-handler 'byte-compile-file-form-progn) (put 'prog1 'byte-hunk-handler 'byte-compile-file-form-progn) -(put 'prog2 'byte-hunk-handler 'byte-compile-file-form-progn) (defun byte-compile-file-form-progn (form) - (mapc 'byte-compile-file-form (cdr form)) + (mapc #'byte-compile-file-form (cdr form)) ;; Return nil so the forms are not output twice. nil) @@ -3971,7 +3970,6 @@ discarding." (byte-defop-compiler-1 inline byte-compile-progn) (byte-defop-compiler-1 progn) (byte-defop-compiler-1 prog1) -(byte-defop-compiler-1 prog2) (byte-defop-compiler-1 if) (byte-defop-compiler-1 cond) (byte-defop-compiler-1 and) @@ -3988,11 +3986,6 @@ discarding." (byte-compile-form-do-effect (car (cdr form))) (byte-compile-body (cdr (cdr form)) t)) -(defun byte-compile-prog2 (form) - (byte-compile-form (nth 1 form) t) - (byte-compile-form-do-effect (nth 2 form)) - (byte-compile-body (cdr (cdr (cdr form))) t)) - (defmacro byte-compile-goto-if (cond discard tag) `(byte-compile-goto (if ,cond diff --git a/lisp/emacs-lisp/cconv.el b/lisp/emacs-lisp/cconv.el index e658270cd5..58ca9d5f57 100644 --- a/lisp/emacs-lisp/cconv.el +++ b/lisp/emacs-lisp/cconv.el @@ -556,7 +556,7 @@ places where they originally did not directly appear." (`(,func . ,forms) ;; First element is function or whatever function-like forms are: or, and, - ;; if, catch, progn, prog1, prog2, while, until + ;; if, catch, progn, prog1, while, until `(,func . ,(mapcar (lambda (form) (cconv-convert form env extend)) forms))) diff --git a/lisp/emacs-lisp/generator.el b/lisp/emacs-lisp/generator.el index 3fd66bfa80..caf5fed154 100644 --- a/lisp/emacs-lisp/generator.el +++ b/lisp/emacs-lisp/generator.el @@ -374,13 +374,6 @@ don't yield.") `(setf ,cps--value-symbol ,temp-var-symbol ,cps--state-symbol ,next-state)))))))) - ;; Process `prog2'. - - (`(prog2 ,form1 ,form2 . ,body) - (cps--transform-1 - `(progn ,form1 (prog1 ,form2 ,@body)) - next-state)) - ;; Process `unwind-protect': If we're inside an unwind-protect, we ;; have a block of code UNWINDFORMS which we would like to run ;; whenever control flows away from the main piece of code, diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index 30a43d8827..4c7a8bea3f 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -1183,7 +1183,6 @@ Lisp function does not specify a special indentation." (put 'autoload 'lisp-indent-function 'defun) ;Elisp (put 'progn 'lisp-indent-function 0) (put 'prog1 'lisp-indent-function 1) -(put 'prog2 'lisp-indent-function 2) (put 'save-excursion 'lisp-indent-function 0) ;Elisp (put 'save-restriction 'lisp-indent-function 0) ;Elisp (put 'save-current-buffer 'lisp-indent-function 0) ;Elisp diff --git a/lisp/subr.el b/lisp/subr.el index 6a9492a3a7..8d51474b0c 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -118,6 +118,13 @@ BODY should be a list of Lisp expressions. ;; depend on backquote.el. (list 'function (cons 'lambda cdr))) +(defmacro prog2 (form1 form2 &rest body) + "Eval FORM1, FORM2 and BODY sequentially; return value from FORM2. +The value of FORM2 is saved during the evaluation of the +remaining args, whose values are discarded." + (declare (indent 2) (debug t)) + `(progn ,form1 (prog1 ,form2 ,@body))) + (defmacro setq-default (&rest args) "Set the default value of variable VAR to VALUE. VAR, the variable name, is literal (not evaluated); diff --git a/src/eval.c b/src/eval.c index 49d6460e6e..e9f118c5cb 100644 --- a/src/eval.c +++ b/src/eval.c @@ -495,17 +495,6 @@ usage: (prog1 FIRST BODY...) */) return val; } -DEFUN ("prog2", Fprog2, Sprog2, 2, UNEVALLED, 0, - doc: /* Eval FORM1, FORM2 and BODY sequentially; return value from FORM2. -The value of FORM2 is saved during the evaluation of the -remaining args, whose values are discarded. -usage: (prog2 FORM1 FORM2 BODY...) */) - (Lisp_Object args) -{ - eval_sub (XCAR (args)); - return Fprog1 (XCDR (args)); -} - DEFUN ("setq", Fsetq, Ssetq, 0, UNEVALLED, 0, doc: /* Set each SYM to the value of its VAL. The symbols SYM are variables; they are literal (not evaluated). @@ -4219,7 +4208,6 @@ alist of active lexical bindings. */); defsubr (&Scond); defsubr (&Sprogn); defsubr (&Sprog1); - defsubr (&Sprog2); defsubr (&Ssetq); defsubr (&Squote); defsubr (&Sfunction); commit 3e8f9482fe2288baedd9cc5026e25ffc543683ab Author: Michael Albinus Date: Tue Apr 2 15:17:17 2019 +0200 Suppress timers in tramp-send-string * lisp/net/tramp.el (tramp-send-string): Suppress timers. Use `with-local-quit'. diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 5b50d39a0d..7206d8eb8a 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -3881,7 +3881,7 @@ of." (tramp-check-for-regexp proc tramp-password-prompt-regexp) (tramp-message vec 3 "Sending %s" (match-string 1)) ;; We don't call `tramp-send-string' in order to hide the - ;; password from the debug buffer. + ;; password from the debug buffer and the traces. (process-send-string proc (concat (tramp-read-passwd proc) tramp-local-end-of-line)) ;; Hide password prompt. @@ -4171,12 +4171,20 @@ The STRING is expected to use Unix line-endings, but the lines sent to the remote host use line-endings as defined in the variable `tramp-rsh-end-of-line'. The communication buffer is erased before sending." (let* ((p (tramp-get-connection-process vec)) - (chunksize (tramp-get-connection-property p "chunksize" nil))) + (chunksize (tramp-get-connection-property p "chunksize" nil)) + ;; We do not want to run timers. + (tl timer-list) + (stimers (with-timeout-suspend)) + timer-list timer-idle-list) (unless p (tramp-error vec 'file-error "Can't send string to remote host -- not logged in")) (tramp-set-connection-property p "last-cmd-time" (current-time)) (tramp-message vec 10 "%s" string) + ;; Enable our progress reporter. + (dolist (timer tl) + (if (eq (timer--function timer) #'tramp-progress-reporter-update) + (push timer timer-list))) (with-current-buffer (tramp-get-connection-buffer vec) ;; Clean up the buffer. We cannot call `erase-buffer' because ;; narrowing might be in effect. @@ -4189,17 +4197,20 @@ the remote host use line-endings as defined in the variable (string-equal (substring string -1) tramp-rsh-end-of-line)) (setq string (concat string tramp-rsh-end-of-line))) ;; Send the string. - (if (and chunksize (not (zerop chunksize))) - (let ((pos 0) - (end (length string))) - (while (< pos end) - (tramp-message - vec 10 "Sending chunk from %s to %s" - pos (min (+ pos chunksize) end)) - (process-send-string - p (substring string pos (min (+ pos chunksize) end))) - (setq pos (+ pos chunksize)))) - (process-send-string p string))))) + (with-local-quit + (if (and chunksize (not (zerop chunksize))) + (let ((pos 0) + (end (length string))) + (while (< pos end) + (tramp-message + vec 10 "Sending chunk from %s to %s" + pos (min (+ pos chunksize) end)) + (process-send-string + p (substring string pos (min (+ pos chunksize) end))) + (setq pos (+ pos chunksize)))) + (process-send-string p string))) + ;; Reenable the timers. + (with-timeout-unsuspend stimers)))) (defun tramp-get-inode (vec) "Returns the virtual inode number. commit 52e3d3d4c42c999d749d56958c03f1acc301df19 Author: Michael Albinus Date: Tue Apr 2 10:48:39 2019 +0200 Give example for configuration in tramp.texi * doc/misc/tramp.texi (Configuration): Explain how to call Tramp configuration functions in the init file. diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi index ac5aa680d5..264a64b26a 100644 --- a/doc/misc/tramp.texi +++ b/doc/misc/tramp.texi @@ -584,6 +584,13 @@ installed and loaded: (customize-set-variable 'tramp-verbose 6 "Enable remote command traces") @end lisp +For functions used to configure @value{tramp}, the following clause +might be used in your init file: + +@lisp +(with-eval-after-load 'tramp (tramp-change-syntax 'simplified)) +@end lisp + @menu * Connection types:: Types of connections to remote hosts.