From f5d036023494dc0d757d062f086a6adb6728f364 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Tue, 12 Dec 2017 23:18:35 -0800 Subject: [PATCH 01/40] Escape column-zero doc parens * lisp/htmlfontify.el (hfy-display-class): * lisp/calendar/icalendar.el (icalendar--do-create-ical-alarm): * lisp/net/shr.el (shr-external-rendering-functions): * lisp/progmodes/cc-vars.el (c-asymmetry-fontification-flag): * lisp/textmodes/tildify.el (tildify-tildify): Escape column-zero doc parens. A shame bug#21871 remains unfixed. --- lisp/calendar/icalendar.el | 2 +- lisp/htmlfontify.el | 2 +- lisp/net/shr.el | 2 +- lisp/progmodes/cc-vars.el | 2 +- lisp/textmodes/tildify.el | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lisp/calendar/icalendar.el b/lisp/calendar/icalendar.el index 129cd6d9ad3..27f1b0324e3 100644 --- a/lisp/calendar/icalendar.el +++ b/lisp/calendar/icalendar.el @@ -1310,7 +1310,7 @@ Returns an alist." Argument ADVANCE-TIME is a number giving the time when the alarm fires (minutes before the respective event). Argument ALARM-SPEC is a list which must be one of (audio), (display) or -(email (ADDRESS1 ...)), see `icalendar-export-alarms'. Argument +\(email (ADDRESS1 ...)), see `icalendar-export-alarms'. Argument SUMMARY is a string which contains a short description for the alarm." (let* ((action (car alarm-spec)) diff --git a/lisp/htmlfontify.el b/lisp/htmlfontify.el index cb4c83d33e0..0c5a2477e5d 100644 --- a/lisp/htmlfontify.el +++ b/lisp/htmlfontify.el @@ -426,7 +426,7 @@ Some valid class specification elements are:\n (type lucid) Multiple values for a tag may be combined, to indicate that any one or more of these values in the specification key constitutes a match, eg:\n -((class color grayscale) (type tty)) would match any of:\n +\((class color grayscale) (type tty)) would match any of:\n ((class color)) ((class grayscale)) ((class color grayscale)) diff --git a/lisp/net/shr.el b/lisp/net/shr.el index ad5d869531c..8a64f7549f2 100644 --- a/lisp/net/shr.el +++ b/lisp/net/shr.el @@ -149,7 +149,7 @@ cid: URL as the argument.") "Alist of tag/function pairs used to alter how shr renders certain tags. For instance, eww uses this to alter rendering of title, forms and other things: -((title . eww-tag-title) +\((title . eww-tag-title) (form . eww-tag-form) ...)") diff --git a/lisp/progmodes/cc-vars.el b/lisp/progmodes/cc-vars.el index c4213797636..51caef2fc30 100644 --- a/lisp/progmodes/cc-vars.el +++ b/lisp/progmodes/cc-vars.el @@ -1641,7 +1641,7 @@ In the fontification engine, it is sometimes impossible to determine whether a construct is a declaration or an expression. This happens particularly in C++, due to ambiguities in the language. When such a construct is like \"foo * bar\" or \"foo &bar\", and this variable is non-nil -(the default), the construct will be fontified as a declaration if there is +\(the default), the construct will be fontified as a declaration if there is white space either before or after the operator, but not both." :type 'boolean :group 'c) diff --git a/lisp/textmodes/tildify.el b/lisp/textmodes/tildify.el index 0d7b15dfc6b..f25dfbcc75d 100644 --- a/lisp/textmodes/tildify.el +++ b/lisp/textmodes/tildify.el @@ -350,7 +350,7 @@ If ASK is nil, perform replace without asking user for confirmation. Returns (count . response) cons where count is number of string replacements done and response is one of symbols: t (all right), nil -(quit), force (replace without further questions)." +\(quit), force (replace without further questions)." (save-excursion (goto-char beg) (let ((regexp tildify-pattern) From 52d2a690f66de135fbfbcf5a195014e24be64170 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Tue, 12 Dec 2017 23:21:24 -0800 Subject: [PATCH 02/40] Add missing :version tags revealed by cusver-check * lisp/comint.el (comint-move-point-for-matching-input): * lisp/epa.el (epa-replace-original-text): * lisp/image-dired.el (image-dired-cmd-optipng-program) (image-dired-cmd-optipng-options): * lisp/emacs-lisp/bytecomp.el (byte-compile-cond-use-jump-table): * lisp/gnus/gnus-cloud.el (gnus-cloud-storage-method) (gnus-cloud-interactive): * lisp/net/mailcap.el (mailcap-user-mime-data): * lisp/progmodes/cc-vars.el (c-asymmetry-fontification-flag) (c-noise-macro-names, c-noise-macro-with-parens-names): * lisp/progmodes/flymake.el (flymake-start-on-flymake-mode) (flymake-wrap-around): * lisp/progmodes/grep.el (grep-use-null-filename-separator): * lisp/progmodes/js.el (js-indent-align-list-continuation): * lisp/progmodes/perl-mode.el (perl-flymake-command): * lisp/progmodes/python.el (python-flymake-command) (python-flymake-command-output-pattern, python-flymake-msg-alist): * lisp/progmodes/ruby-mode.el (ruby-flymake-use-rubocop-if-available) (ruby-rubocop-config): * lisp/textmodes/less-css-mode.el (less-css): * lisp/textmodes/tex-mode.el (tex-chktex-program) (tex-chktex-extra-flags): Add missing :version tags. --- lisp/comint.el | 1 + lisp/emacs-lisp/bytecomp.el | 1 + lisp/epa.el | 1 + lisp/gnus/gnus-cloud.el | 2 ++ lisp/image-dired.el | 2 ++ lisp/net/mailcap.el | 1 + lisp/progmodes/cc-vars.el | 3 +++ lisp/progmodes/flymake.el | 2 ++ lisp/progmodes/grep.el | 1 + lisp/progmodes/js.el | 1 + lisp/progmodes/perl-mode.el | 1 + lisp/progmodes/python.el | 3 +++ lisp/progmodes/ruby-mode.el | 2 ++ lisp/textmodes/less-css-mode.el | 1 + lisp/textmodes/tex-mode.el | 2 ++ 15 files changed, 24 insertions(+) diff --git a/lisp/comint.el b/lisp/comint.el index aa7dab28f32..dcf1ff794f9 100644 --- a/lisp/comint.el +++ b/lisp/comint.el @@ -290,6 +290,7 @@ If `after-input', point will be positioned after the input typed by the user, but before the rest of the history entry that has been inserted. If `end-of-line', point will be positioned at the end of the current logical (not visual) line after insertion." + :version "26.1" :type '(radio (const :tag "Stay after input" after-input) (const :tag "Move to end of line" end-of-line)) :group 'comint) diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index f69ac7f342a..d62d8128c11 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -236,6 +236,7 @@ This includes variable references and calls to functions such as `car'." (defcustom byte-compile-cond-use-jump-table t "Compile `cond' clauses to a jump table implementation (using a hash-table)." + :version "26.1" :group 'bytecomp :type 'boolean) diff --git a/lisp/epa.el b/lisp/epa.el index 6e908e1aa3b..da5a894d804 100644 --- a/lisp/epa.el +++ b/lisp/epa.el @@ -40,6 +40,7 @@ If t, replace the original text without any confirmation. If nil, don't replace the original text and show the result in a new buffer. If neither t nor nil, ask user for confirmation." + :version "26.1" :type '(choice (const :tag "Never" nil) (const :tag "Ask the user" ask) (const :tag "Always" t)) diff --git a/lisp/gnus/gnus-cloud.el b/lisp/gnus/gnus-cloud.el index 5ea2d691f15..34d54ec3cae 100644 --- a/lisp/gnus/gnus-cloud.el +++ b/lisp/gnus/gnus-cloud.el @@ -51,6 +51,7 @@ (defcustom gnus-cloud-storage-method (if (featurep 'epg) 'epg 'base64-gzip) "Storage method for cloud data, defaults to EPG if that's available." + :version "26.1" :group 'gnus-cloud :type '(radio (const :tag "No encoding" nil) (const :tag "Base64" base64) @@ -59,6 +60,7 @@ (defcustom gnus-cloud-interactive t "Whether Gnus Cloud changes should be confirmed." + :version "26.1" :group 'gnus-cloud :type 'boolean) diff --git a/lisp/image-dired.el b/lisp/image-dired.el index 175d9df5e8c..e8046af3c0b 100644 --- a/lisp/image-dired.el +++ b/lisp/image-dired.el @@ -305,6 +305,7 @@ temporary file name (typically generated by pnqnq)" (defcustom image-dired-cmd-optipng-program (executable-find "optipng") "The file name of the `optipng' program." + :version "26.1" :type '(choice (const :tag "Not Set" nil) file) :group 'image-dired) @@ -312,6 +313,7 @@ temporary file name (typically generated by pnqnq)" "Arguments passed to `image-dired-optipng-program'. Available format specifiers are described in `image-dired-cmd-create-thumbnail-options'." + :version "26.1" :type '(repeat (string :tag "Argument")) :link '(url-link "man:optipng(1)") :group 'image-dired) diff --git a/lisp/net/mailcap.el b/lisp/net/mailcap.el index b4b38707c89..be1a171cd48 100644 --- a/lisp/net/mailcap.el +++ b/lisp/net/mailcap.el @@ -99,6 +99,7 @@ When selecting a viewer for a given MIME type, the first viewer in this list with a matching MIME-TYPE and successful TEST is selected. Only if none matches, the standard `mailcap-mime-data' is consulted." + :version "26.1" :type '(repeat (list (choice (function :tag "Function or mode") diff --git a/lisp/progmodes/cc-vars.el b/lisp/progmodes/cc-vars.el index 51caef2fc30..37d6675821e 100644 --- a/lisp/progmodes/cc-vars.el +++ b/lisp/progmodes/cc-vars.el @@ -1643,6 +1643,7 @@ particularly in C++, due to ambiguities in the language. When such a construct is like \"foo * bar\" or \"foo &bar\", and this variable is non-nil \(the default), the construct will be fontified as a declaration if there is white space either before or after the operator, but not both." + :version "26.1" :type 'boolean :group 'c) @@ -1658,6 +1659,7 @@ identifiers. If you change this variable's value, call the function `c-make-noise-macro-regexps' to set the necessary internal variables (or do this implicitly by reinitializing C/C++/Objc Mode on any buffer)." + :version "26.1" :type '(repeat :tag "List of names" string) :group 'c) (put 'c-noise-macro-names 'safe-local-variable #'c-string-list-p) @@ -1666,6 +1668,7 @@ this implicitly by reinitializing C/C++/Objc Mode on any buffer)." "A list of names of macros \(or compiler extensions like \"__attribute__\") which optionally have arguments in parentheses, and which expand to nothing. These are recognized by CC Mode only in declarations." + :version "26.1" :type '(regexp :tag "List of names (possibly empty)" string) :group 'c) (put 'c-noise-macro-with-parens-names 'safe-local-variable #'c-string-list-p) diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el index c6345aa9680..66d1497b406 100644 --- a/lisp/progmodes/flymake.el +++ b/lisp/progmodes/flymake.el @@ -127,6 +127,7 @@ If nil, never start checking buffer automatically like this." (defcustom flymake-start-on-flymake-mode t "Start syntax check when `flymake-mode' is enabled. Specifically, start it when the buffer is actually displayed." + :version "26.1" :type 'boolean) (define-obsolete-variable-alias 'flymake-start-syntax-check-on-find-file @@ -141,6 +142,7 @@ Specifically, start it when the buffer is actually displayed." (defcustom flymake-wrap-around t "If non-nil, moving to errors wraps around buffer boundaries." + :version "26.1" :type 'boolean) (when (fboundp 'define-fringe-bitmap) diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el index c2d80223541..dac3726bb14 100644 --- a/lisp/progmodes/grep.el +++ b/lisp/progmodes/grep.el @@ -162,6 +162,7 @@ Customize or call the function `grep-apply-setting'." (defcustom grep-use-null-filename-separator 'auto-detect "If non-nil, use `grep's `--null' option. This is done to disambiguate file names in `grep's output." + :version "26.1" :type '(choice (const :tag "Do Not Use `--null'" nil) (const :tag "Use `--null'" t) (other :tag "Not Set" auto-detect)) diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el index 1f86909362e..5cdabd03beb 100644 --- a/lisp/progmodes/js.el +++ b/lisp/progmodes/js.el @@ -477,6 +477,7 @@ This applies to function movement, marking, and so on." (defcustom js-indent-align-list-continuation t "Align continuation of non-empty ([{ lines in `js-mode'." + :version "26.1" :type 'boolean :group 'js) diff --git a/lisp/progmodes/perl-mode.el b/lisp/progmodes/perl-mode.el index f3cb8109133..fecdb720f58 100644 --- a/lisp/progmodes/perl-mode.el +++ b/lisp/progmodes/perl-mode.el @@ -587,6 +587,7 @@ create a new comment." This is a non empty list of strings, the checker tool possibly followed by required arguments. Once launched it will receive the Perl source to be checked as its standard input." + :version "26.1" :group 'perl :type '(repeat string)) diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 9d3e428e23c..2de40c4ab88 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -5165,6 +5165,7 @@ This is a non empty list of strings, the checker tool possibly followed by required arguments. Once launched it will receive the Python source to be checked as its standard input. To use `flake8' you would set this to (\"flake8\" \"-\")." + :version "26.1" :group 'python-flymake :type '(repeat string)) @@ -5186,6 +5187,7 @@ MESSAGE'th gives the message text itself. If COLUMN or TYPE are nil or that index didn't match, that information is not present on the matched line and a default will be used." + :version "26.1" :group 'python-flymake :type '(list regexp (integer :tag "Line's index") @@ -5209,6 +5211,7 @@ For example, when using `flake8' a possible configuration could be: (\"^[EW][0-9]+\" . :note)) By default messages are considered errors." + :version "26.1" :group 'python-flymake :type `(alist :key-type (regexp) :value-type (symbol))) diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el index dc1b0f8e2da..1c7df7e35a2 100644 --- a/lisp/progmodes/ruby-mode.el +++ b/lisp/progmodes/ruby-mode.el @@ -2314,12 +2314,14 @@ See `font-lock-syntax-table'.") (defcustom ruby-flymake-use-rubocop-if-available t "Non-nil to use the Rubocop Flymake backend. Only takes effect if Rubocop is installed." + :version "26.1" :type 'boolean :group 'ruby :safe 'booleanp) (defcustom ruby-rubocop-config ".rubocop.yml" "Configuration file for `ruby-flymake-rubocop'." + :version "26.1" :type 'string :group 'ruby :safe 'stringp) diff --git a/lisp/textmodes/less-css-mode.el b/lisp/textmodes/less-css-mode.el index d31414e3a4b..387d1c2fd57 100644 --- a/lisp/textmodes/less-css-mode.el +++ b/lisp/textmodes/less-css-mode.el @@ -78,6 +78,7 @@ (defgroup less-css nil "Less CSS mode." + :version "26.1" :prefix "less-css-" :group 'css) diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el index 5c585ea46ca..f228e28b740 100644 --- a/lisp/textmodes/tex-mode.el +++ b/lisp/textmodes/tex-mode.el @@ -266,12 +266,14 @@ measured relative to that of the normal text." (defcustom tex-chktex-program "chktex" "ChkTeX executable to use for linting TeX files." + :version "26.1" :type 'string :link '(url-link "man:chktex(1)") :group 'tex-flymake) (defcustom tex-chktex-extra-flags nil "Extra command line flags for `tex-chktex-program'." + :version "26.1" :type '(repeat string) :group 'tex-flymake) From 7e2f4d3d416fc06a4462c8c4c38ec1b54b02611a Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Wed, 13 Dec 2017 13:55:29 -0500 Subject: [PATCH 03/40] * lisp/htmlfontify.el (hfy-which-etags): Fix it. --- lisp/htmlfontify.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/htmlfontify.el b/lisp/htmlfontify.el index 0c5a2477e5d..aa7cf430a4d 100644 --- a/lisp/htmlfontify.el +++ b/lisp/htmlfontify.el @@ -370,8 +370,8 @@ commands in `hfy-etags-cmd-alist'." (when (eq (call-process hfy-etags-bin nil t nil "--version") 0) (goto-char (point-min)) (cond - ((looking-at-p "exube") "exuberant ctags") - ((looking-at-p "GNU E") "emacs etags"))) + ((search-forward "exube" nil t) "exuberant ctags") + ((search-forward "GNU E" nil t) "emacs etags"))) ;; Return nil if the etags binary isn't executable (Bug#25468). (file-error nil)))) From aacd1e14fc6ab872bc2c588d8c6077c88ce8a310 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Wed, 13 Dec 2017 15:25:56 -0500 Subject: [PATCH 04/40] * lisp/net/newst-backend.el (newsticker--raw-url-list-defaults): Update. --- lisp/net/newst-backend.el | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/lisp/net/newst-backend.el b/lisp/net/newst-backend.el index d1ce0e2af73..0fb347fc4e9 100644 --- a/lisp/net/newst-backend.el +++ b/lisp/net/newst-backend.el @@ -64,9 +64,12 @@ considered to be running if the newsticker timer list is not empty." "Aggregator for RSS and Atom feeds." :group 'applications) +;; Hard-coding URLs like this is a recipe for propagating obsolete info. (defconst newsticker--raw-url-list-defaults - '(("CNET News.com" - "http://export.cnet.com/export/feeds/news/rss/1,11176,,00.xml") + '( + ;; 2017/12: no response. +;;; ("CNET News.com" +;;; "http://export.cnet.com/export/feeds/news/rss/1,11176,,00.xml") ("Debian Security Advisories" "http://www.debian.org/security/dsa.en.rdf") ("Debian Security Advisories - Long format" @@ -76,23 +79,24 @@ considered to be running if the newsticker timer list is not empty." nil 3600) ("LWN (Linux Weekly News)" - "http://lwn.net/headlines/rss") - ("NY Times: Technology" - "http://partners.userland.com/nytRss/technology.xml") - ("NY Times" - "http://partners.userland.com/nytRss/nytHomepage.xml") + "https://lwn.net/headlines/rss") + ;; Not updated since 2010. +;;; ("NY Times: Technology" +;;; "http://www.nytimes.com/services/xml/rss/userland/Technology.xml") +;;; ("NY Times" +;;; "http://www.nytimes.com/services/xml/rss/userland/HomePage.xml") ("Quote of the day" - "http://www.quotationspage.com/data/qotd.rss" + "http://feeds.feedburner.com/quotationspage/qotd" "07:00" 86400) ("The Register" - "http://www.theregister.co.uk/tonys/slashdot.rdf") + "https://www.theregister.co.uk/headlines.rss") ("slashdot" - "http://slashdot.org/index.rss" + "http://rss.slashdot.org/Slashdot/slashdot" nil 3600) ;/. will ban you if under 3600 seconds! ("Wired News" - "http://www.wired.com/news_drop/netcenter/netcenter.rdf") + "https://www.wired.com/feed/rss") ("Heise News (german)" "http://www.heise.de/newsticker/heise.rdf") ("Tagesschau (german)" From ce31e726adbb4d24557b3d1ff067cc4c04d94446 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Wed, 13 Dec 2017 15:29:24 -0500 Subject: [PATCH 05/40] Fixes for defcustoms, prompted by cus-test-opts * lisp/files.el (save-some-buffers-default-predicate): * lisp/time.el (display-time-world-list): * lisp/gnus/gnus-art.el (gnus-article-show-cursor): * lisp/progmodes/cc-vars.el (c-noise-macro-with-parens-names): * lisp/progmodes/verilog-mode.el (verilog-auto-wire-type): * lisp/textmodes/less-css-mode.el (less-css-output-directory) (less-css-output-file-name, less-css-input-file-name): * lisp/vc/emerge.el (emerge-metachars): * lisp/vc/vc-hg.el (vc-hg-symbolic-revision-styles): Fix :types. * lisp/net/newst-backend.el (newsticker-url-list-defaults): Fix url. --- lisp/files.el | 4 +++- lisp/gnus/gnus-art.el | 2 +- lisp/net/newst-backend.el | 2 +- lisp/progmodes/cc-vars.el | 2 +- lisp/progmodes/verilog-mode.el | 8 ++++---- lisp/textmodes/less-css-mode.el | 6 +++--- lisp/time.el | 4 +++- lisp/vc/emerge.el | 6 ++---- lisp/vc/vc-hg.el | 2 +- 9 files changed, 19 insertions(+), 17 deletions(-) diff --git a/lisp/files.el b/lisp/files.el index 4b6d4e88acb..90c865782f3 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -5195,7 +5195,9 @@ Before and after saving the buffer, this function runs This allows you to stop `save-some-buffers' from asking about certain files that you'd usually rather not save." :group 'auto-save - :type 'function + ;; FIXME nil should not be a valid option, let alone the default, + ;; eg so that add-function can be used. + :type '(choice (const :tag "Default" nil) function) :version "26.1") (defun save-some-buffers (&optional arg pred) diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el index c130dc1b6c6..e9cc09ce9b8 100644 --- a/lisp/gnus/gnus-art.el +++ b/lisp/gnus/gnus-art.el @@ -527,7 +527,7 @@ each invocation of the saving commands." "If non-nil, show the cursor in the Article buffer even when not selected." :version "25.1" :group 'gnus-article - :type 'bool) + :type 'boolean) (defcustom gnus-saved-headers gnus-visible-headers "Headers to keep if `gnus-save-all-headers' is nil. diff --git a/lisp/net/newst-backend.el b/lisp/net/newst-backend.el index 0fb347fc4e9..ed60a8a3aea 100644 --- a/lisp/net/newst-backend.el +++ b/lisp/net/newst-backend.el @@ -162,7 +162,7 @@ value effective." (defcustom newsticker-url-list-defaults '(("Emacs Wiki" - "http://www.emacswiki.org/cgi-bin/wiki.pl?action=rss" + "https://www.emacswiki.org/emacs?action=rss" nil 3600)) "A customizable list of news feeds to select from. diff --git a/lisp/progmodes/cc-vars.el b/lisp/progmodes/cc-vars.el index 37d6675821e..f7bfe7c672a 100644 --- a/lisp/progmodes/cc-vars.el +++ b/lisp/progmodes/cc-vars.el @@ -1669,7 +1669,7 @@ this implicitly by reinitializing C/C++/Objc Mode on any buffer)." which optionally have arguments in parentheses, and which expand to nothing. These are recognized by CC Mode only in declarations." :version "26.1" - :type '(regexp :tag "List of names (possibly empty)" string) + :type '(repeat :tag "List of names (possibly empty)" string) :group 'c) (put 'c-noise-macro-with-parens-names 'safe-local-variable #'c-string-list-p) diff --git a/lisp/progmodes/verilog-mode.el b/lisp/progmodes/verilog-mode.el index 10a1edc3ee0..1baac1d4204 100644 --- a/lisp/progmodes/verilog-mode.el +++ b/lisp/progmodes/verilog-mode.el @@ -764,14 +764,14 @@ mode is experimental." :version "24.1" ; rev670 :group 'verilog-mode-actions :type 'boolean) -(put 'verilog-auto-declare-nettype 'safe-local-variable `stringp) +(put 'verilog-auto-declare-nettype 'safe-local-variable 'stringp) (defcustom verilog-auto-wire-comment t "Non-nil indicates to insert to/from comments with `verilog-auto-wire' etc." :version "25.1" :group 'verilog-mode-actions :type 'boolean) -(put 'verilog-auto-wire-comment 'safe-local-variable `verilog-booleanp) +(put 'verilog-auto-wire-comment 'safe-local-variable 'verilog-booleanp) (defcustom verilog-auto-wire-type nil "Non-nil specifies the data type to use with `verilog-auto-wire' etc. @@ -781,8 +781,8 @@ this is generally only appropriate when making a non-SystemVerilog wrapper containing SystemVerilog cells." :version "24.1" ; rev673 :group 'verilog-mode-actions - :type 'string) -(put 'verilog-auto-wire-type 'safe-local-variable `stringp) + :type '(choice (const nil) string)) +(put 'verilog-auto-wire-type 'safe-local-variable 'stringp) (defcustom verilog-auto-endcomments t "Non-nil means insert a comment /* ... */ after `end's. diff --git a/lisp/textmodes/less-css-mode.el b/lisp/textmodes/less-css-mode.el index 387d1c2fd57..c2846ac926b 100644 --- a/lisp/textmodes/less-css-mode.el +++ b/lisp/textmodes/less-css-mode.el @@ -106,7 +106,7 @@ Use \"-x\" to minify output." This path is expanded relative to the directory of the Less file using `expand-file-name', so both relative and absolute paths will work as expected." - :type 'directory) + :type '(choice (const :tag "Same as Less file" nil) directory)) ;;;###autoload (put 'less-css-output-directory 'safe-local-variable 'stringp) @@ -116,7 +116,7 @@ This can be also be set to a full path, or a relative path. If the path is relative, it will be relative to the value of `less-css-output-dir', if set, or the current directory by default." - :type 'file) + :type '(choice (const :tag "Default" nil) file)) (make-variable-buffer-local 'less-css-output-file-name) (defcustom less-css-input-file-name nil @@ -132,7 +132,7 @@ variables. This can be also be set to a full path, or a relative path. If the path is relative, it will be relative to the current directory by default." - :type 'file) + :type '(choice (const nil) file)) ;;;###autoload (put 'less-css-input-file-name 'safe-local-variable 'stringp) (make-variable-buffer-local 'less-css-input-file-name) diff --git a/lisp/time.el b/lisp/time.el index c8726a9a1b0..7f85b866880 100644 --- a/lisp/time.el +++ b/lisp/time.el @@ -173,7 +173,9 @@ If the value is t instead of an alist, use the value of `legacy-style-world-list' otherwise." :group 'display-time - :type '(repeat (list string string)) + :type '(choice (const :tag "Default" t) + (repeat :tag "List of zones and labels" + (list (string :tag "Zone") (string :tag "Label")))) :version "23.1") (defun time--display-world-list () diff --git a/lisp/vc/emerge.el b/lisp/vc/emerge.el index 9c25ec43321..3f945bbb2bf 100644 --- a/lisp/vc/emerge.el +++ b/lisp/vc/emerge.el @@ -3171,11 +3171,9 @@ See also `auto-save-file-name-p'." (setq limit (1+ (match-end 0))))) s) -;; Metacharacters that have to be protected from the shell when executing -;; a diff/diff3 command. (defcustom emerge-metachars nil - "Obsolete, emerge now uses `shell-quote-argument'." - :type 'regexp + "No longer used. Emerge now uses `shell-quote-argument'." + :type '(choice (const nil) regexp) :group 'emerge) (make-obsolete-variable 'emerge-metachars nil "26.1") diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el index 99c8869ae06..a404626fba2 100644 --- a/lisp/vc/vc-hg.el +++ b/lisp/vc/vc-hg.el @@ -278,7 +278,7 @@ within the repository. If no list entry produces a useful revision, return `nil'." :type '(repeat (choice - (const :tag "Active bookmark" 'bookmark) + (const :tag "Active bookmark" builtin-active-bookmark) (string :tag "Hg template") (function :tag "Custom"))) :version "26.1" From 4cb8696e4754d815efd5fd5e26f2b6b2567a11fe Mon Sep 17 00:00:00 2001 From: Alan Mackenzie Date: Wed, 13 Dec 2017 20:55:03 +0000 Subject: [PATCH 06/40] Don't misfontify "foo ()" inside C++ initialization parentheses as a type Also recognize and handle function names introduced by "extern" inside a function. * lisp/progmodes/cc-engine.el (c-forward-decl-or-cast-1): Add a new element to the result list which is t when our declaration is, or is to be treated as, being at top level. * lisp/progmodes/cc-fonts.el (c-get-fontification-context): Detect being inside a C++ uniform initialization and return (not-decl nil) for this case. (c-font-lock-declarations): Use the new element 4 of the result of c-forward-decl-or-cast-1. * lisp/progmodes/cc-langs.el (c-make-top-level-kwds, c-make-top-level-key): New lang consts/vars. --- lisp/progmodes/cc-engine.el | 25 +++++++++++++++++-------- lisp/progmodes/cc-fonts.el | 14 +++++++++++++- lisp/progmodes/cc-langs.el | 10 ++++++++++ 3 files changed, 40 insertions(+), 9 deletions(-) diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index ab0204cb961..138a0e5da21 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el @@ -8167,9 +8167,9 @@ comment at the start of cc-engine.el for more info." ;; If a declaration is parsed: ;; ;; The point is left at the first token after the first complete - ;; declarator, if there is one. The return value is a list of 4 elements, + ;; declarator, if there is one. The return value is a list of 5 elements, ;; where the first is the position of the first token in the declarator. - ;; (See below for the other three.) + ;; (See below for the other four.) ;; Some examples: ;; ;; void foo (int a, char *b) stuff ... @@ -8210,7 +8210,9 @@ comment at the start of cc-engine.el for more info." ;; ;; The third element of the return value is non-nil when the declaration ;; parsed might be an expression. The fourth element is the position of - ;; the start of the type identifier. + ;; the start of the type identifier. The fifth element is t if either + ;; CONTEXT was 'top, or the declaration is detected to be treated as top + ;; level (e.g. with the keyword "extern"). ;; ;; If a cast is parsed: ;; @@ -8308,6 +8310,9 @@ comment at the start of cc-engine.el for more info." ;; Set when the symbol before `preceding-token-end' is known to ;; terminate the previous construct, or when we're at point-min. at-decl-start + ;; Set when we have encountered a keyword (e.g. "extern") which + ;; causes the following declaration to be treated as though top-level. + make-top ;; Save `c-record-type-identifiers' and ;; `c-record-ref-identifiers' since ranges are recorded ;; speculatively and should be thrown away if it turns out @@ -8339,7 +8344,9 @@ comment at the start of cc-engine.el for more info." (cond ;; Look for a specifier keyword clause. - ((or (looking-at c-prefix-spec-kwds-re) + ((or (and (looking-at c-make-top-level-key) + (setq make-top t)) + (looking-at c-prefix-spec-kwds-re) (and (c-major-mode-is 'java-mode) (looking-at "@[A-Za-z0-9]+"))) (save-match-data @@ -8609,7 +8616,7 @@ comment at the start of cc-engine.el for more info." ;; construct here in C, since we want to recognize this as a ;; typeless function declaration. (not (and (c-major-mode-is 'c-mode) - (eq context 'top) + (or (eq context 'top) make-top) (eq (char-after) ?\))))) (if (eq (char-after) ?\)) (when (> paren-depth 0) @@ -8657,7 +8664,7 @@ comment at the start of cc-engine.el for more info." ;; Recognize a top-level typeless ;; function declaration in C. (and (c-major-mode-is 'c-mode) - (eq context 'top) + (or (eq context 'top) make-top) (eq (char-after) ?\)))))))) (setq pos (c-up-list-forward (point))) (eq (char-before pos) ?\))) @@ -8914,6 +8921,7 @@ comment at the start of cc-engine.el for more info." (when (and got-identifier (looking-at c-after-suffixed-type-decl-key) (or (eq context 'top) + make-top (and (eq context nil) (match-beginning 1))) (if (and got-parens @@ -9080,7 +9088,7 @@ comment at the start of cc-engine.el for more info." ;; CASE 19 (or (eq context 'decl) (and (c-major-mode-is 'c-mode) - (eq context 'top)))))) + (or (eq context 'top) make-top)))))) ;; The point is now after the type decl expression. @@ -9185,7 +9193,8 @@ comment at the start of cc-engine.el for more info." (and (or at-type-decl at-typedef) (cons at-type-decl at-typedef)) maybe-expression - type-start)) + type-start + (or (eq context 'top) make-top))) (t ;; False alarm. Restore the recorded ranges. diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el index d352e5b08c9..7b99c2f54e5 100644 --- a/lisp/progmodes/cc-fonts.el +++ b/lisp/progmodes/cc-fonts.el @@ -1251,6 +1251,17 @@ casts and declarations are fontified. Used on level 2 and higher." ;; Got a cached hit in some other type of arglist. (type (cons 'arglist t)) + ;; We're at a C++ uniform initialization. + ((and (c-major-mode-is 'c++-mode) + (eq (char-before match-pos) ?\() + (save-excursion + (goto-char match-pos) + (and + (zerop (c-backward-token-2 2)) + (looking-at c-identifier-start) + (c-got-face-at (point) + '(font-lock-variable-name-face))))) + (cons 'not-decl nil)) ((and not-front-decl ;; The point is within the range of a previously ;; encountered type decl expression, so the arglist @@ -1589,7 +1600,8 @@ casts and declarations are fontified. Used on level 2 and higher." (setq max-type-decl-end (point)))) (goto-char start-pos) (c-font-lock-single-decl limit decl-or-cast match-pos - context toplev)) + context + (or toplev (nth 4 decl-or-cast)))) (t t)))) diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el index 227b3e16485..869048bee31 100644 --- a/lisp/progmodes/cc-langs.el +++ b/lisp/progmodes/cc-langs.el @@ -2355,6 +2355,16 @@ construct it's part of continues." t nil (c c++ objc) '("extern")) +(c-lang-defconst c-make-top-level-kwds + "Keywords which make declarations they introduce be handled as top-level." + t nil + (c c++ objc) '("extern")) + +(c-lang-defconst c-make-top-level-key + ;; A regexp which matches any `c-make-top-level-kwds' keyword. + t (c-make-keywords-re t (c-lang-const c-make-top-level-kwds))) +(c-lang-defvar c-make-top-level-key (c-lang-const c-make-top-level-key)) + (c-lang-defconst c-type-list-kwds "Keywords that may be followed by a comma separated list of type identifiers, where each optionally can be prefixed by keywords. (Can From e7b1111155b3116d0c7b137e0e1d312db0f1ca80 Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Mon, 13 Nov 2017 12:46:13 -0500 Subject: [PATCH 07/40] Mention new strictness for &optional, &rest in arglists (Bug#29165) * etc/NEWS: Explain that '&optional' not followed by a variable is now an error. * lisp/emacs-lisp/cl-macs.el (cl--transform-lambda, cl--do-&aux) (cl--do-arglist): Also reject '&optional', '&rest', or '&aux' not followed by a variable for consistency. * test/lisp/emacs-lisp/cl-macs-tests.el (cl-macs-bad-arglist): New test. --- etc/NEWS | 11 ++++++++ lisp/emacs-lisp/cl-macs.el | 38 +++++++++++++++++++-------- test/lisp/emacs-lisp/cl-macs-tests.el | 31 ++++++++++++++++++++++ 3 files changed, 69 insertions(+), 11 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index 64b53d88c83..5324a0944ea 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1462,6 +1462,17 @@ them through 'format' first. Even that is discouraged: for ElDoc support, you should set 'eldoc-documentation-function' instead of calling 'eldoc-message' directly. +--- +** Using '&rest' or '&optional' incorrectly is now an error. +For example giving '&optional' without a following variable, or +passing '&optional' multiple times: + + (defun foo (&optional &rest x)) + (defun bar (&optional &optional x)) + +Previously, Emacs would just ignore the extra keyword, or give +incorrect results in certain cases. + * Lisp Changes in Emacs 26.1 diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index 5535100d4ae..6aed060cb50 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el @@ -281,8 +281,13 @@ FORM is of the form (ARGS . BODY)." (or (not optional) ;; Optional args whose default is nil are simple. (null (nth 1 (assq (car args) (cdr cl--bind-defs))))) - (not (and (eq (car args) '&optional) (setq optional t) - (car cl--bind-defs)))) + (not (and (eq (car args) '&optional) + (progn + (when (memq (cadr args) + '(nil &rest &body &key &aux)) + (error "Variable missing after &optional")) + (setq optional t) + (car cl--bind-defs))))) (push (pop args) simple-args)) (when optional (if args (push '&optional args)) @@ -534,14 +539,17 @@ its argument list allows full Common Lisp conventions." arglist)))) (defun cl--do-&aux (args) - (while (and (eq (car args) '&aux) (pop args)) - (while (and args (not (memq (car args) cl--lambda-list-keywords))) - (if (consp (car args)) - (if (and cl--bind-enquote (cl-cadar args)) - (cl--do-arglist (caar args) - `',(cadr (pop args))) - (cl--do-arglist (caar args) (cadr (pop args)))) - (cl--do-arglist (pop args) nil)))) + (when (eq (car args) '&aux) + (pop args) + (when (null args) + (error "Variable missing after &aux"))) + (while (and args (not (memq (car args) cl--lambda-list-keywords))) + (if (consp (car args)) + (if (and cl--bind-enquote (cl-cadar args)) + (cl--do-arglist (caar args) + `',(cadr (pop args))) + (cl--do-arglist (caar args) (cadr (pop args)))) + (cl--do-arglist (pop args) nil))) (if args (error "Malformed argument list ends with: %S" args))) (defun cl--do-arglist (args expr &optional num) ; uses cl--bind-* @@ -558,6 +566,9 @@ its argument list allows full Common Lisp conventions." (keys nil) (laterarg nil) (exactarg nil) minarg) (or num (setq num 0)) + (when (and restarg (or (null (cdr restarg)) + (memq (cadr restarg) cl--lambda-list-keywords))) + (error "Variable missing after &rest")) (setq restarg (if (listp (cadr restarg)) (make-symbol "--cl-rest--") (cadr restarg))) @@ -609,7 +620,12 @@ its argument list allows full Common Lisp conventions." `',cl--bind-block) (+ ,num (length ,restarg))))) cl--bind-forms))) - (while (and (eq (car args) '&key) (pop args)) + (while (eq (car args) '&key) + (pop args) + (when (or (null args) (memq (car args) cl--lambda-list-keywords)) + (error "Missing variable after &key")) + (when keys + (error "Multiple occurrences of &key")) (while (and args (not (memq (car args) cl--lambda-list-keywords))) (let ((arg (pop args))) (or (consp arg) (setq arg (list arg))) diff --git a/test/lisp/emacs-lisp/cl-macs-tests.el b/test/lisp/emacs-lisp/cl-macs-tests.el index 575f170af6c..bf2e7e12759 100644 --- a/test/lisp/emacs-lisp/cl-macs-tests.el +++ b/test/lisp/emacs-lisp/cl-macs-tests.el @@ -497,4 +497,35 @@ collection clause." vconcat (vector (1+ x))) [2 3 4 5 6]))) + +;;; cl-lib lambda list handling + +(ert-deftest cl-macs-bad-arglist () + "Check that `cl-defun' and friends reject weird argument lists. +See Bug#29165, and similar `eval-tests--bugs-24912-and-24913' in +eval-tests.el." + (dolist (args (cl-mapcan + ;; For every &rest and &optional variant, check also + ;; the same thing with &key and &aux respectively + ;; instead. + (lambda (arglist) + (let ((arglists (list arglist))) + (when (memq '&rest arglist) + (push (cl-subst '&key '&rest arglist) arglists)) + (when (memq '&optional arglist) + (push (cl-subst '&aux '&optional arglist) arglists)) + arglists)) + '((&optional) (&rest) (&optional &rest) (&rest &optional) + (&optional &rest _a) (&optional _a &rest) + (&rest _a &optional) (&rest &optional _a) + (&optional &optional) (&optional &optional _a) + (&optional _a &optional _b) + (&rest &rest) (&rest &rest _a) + (&rest _a &rest _b)))) + (ert-info ((prin1-to-string args) :prefix "arglist: ") + (should-error (eval `(funcall (cl-function (lambda ,args))) t)) + (should-error (cl--transform-lambda (cons args t))) + (let ((byte-compile-debug t)) + (should-error (eval `(byte-compile (cl-function (lambda ,args))) t)))))) + ;;; cl-macs-tests.el ends here From 3f9aac68d7ec9854a2998e9b5e7d77fbc18bf2d0 Mon Sep 17 00:00:00 2001 From: "Basil L. Contovounesios" Date: Thu, 14 Dec 2017 04:45:21 +0000 Subject: [PATCH 08/40] Don't raise an extraneous frame (bug#29696) * lisp/gnus/gnus-art.el (gnus-article-read-summary-keys): Lookup summary buffer keys from article buffer without affecting window configuration (bug#29696). --- lisp/gnus/gnus-art.el | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el index e9cc09ce9b8..65d3bbe71ca 100644 --- a/lisp/gnus/gnus-art.el +++ b/lisp/gnus/gnus-art.el @@ -6712,8 +6712,7 @@ not have a face in `gnus-article-boring-faces'." (member keys nosave-but-article) (member keys nosave-in-article)) (let (func) - (save-window-excursion - (pop-to-buffer gnus-article-current-summary) + (with-current-buffer gnus-article-current-summary ;; We disable the pick minor mode commands. (let (gnus-pick-mode) (setq func (key-binding keys t)))) From 232c6465ce789f980da16063a865ac915b060ca4 Mon Sep 17 00:00:00 2001 From: Martin Rudalics Date: Thu, 14 Dec 2017 09:38:06 +0100 Subject: [PATCH 09/40] Fix doc-string of Fbuffer_list * src/buffer.c (Fbuffer_list): Fix doc-string. --- src/buffer.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/buffer.c b/src/buffer.c index c6f9eb28e25..7ae889decf7 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -386,9 +386,9 @@ Value is nil if OBJECT is not a buffer or if it has been killed. */) } DEFUN ("buffer-list", Fbuffer_list, Sbuffer_list, 0, 1, 0, - doc: /* Return a list of all existing live buffers. -If the optional arg FRAME is a frame, we return the buffer list in the -proper order for that frame: the buffers show in FRAME come first, + doc: /* Return a list of all live buffers. +If the optional arg FRAME is a frame, return the buffer list in the +proper order for that frame: the buffers shown in FRAME come first, followed by the rest of the buffers. */) (Lisp_Object frame) { From f838210b018b74b5dd86800aba807c78c921fc3a Mon Sep 17 00:00:00 2001 From: Alan Mackenzie Date: Thu, 14 Dec 2017 17:55:59 +0000 Subject: [PATCH 10/40] Fix misfontification of C++ member initialization list after "throw" * lisp/progmodes/cc-engine.el (c-forward-type): Stop recognizing a "type" starting with "throw", by using c-opt-type-modifier-prefix-key. * lisp/progmodes/cc-langs.el (c-type-modifier-prefix-kwds): New lang const which, in C++, doesn't contain "throw", otherwise like c-type-modifier-kwds. (c-opt-type-modifier-prefix-key): New lang const and var, a regexp matching any keyword in the previous lang const. --- lisp/progmodes/cc-engine.el | 4 ++-- lisp/progmodes/cc-langs.el | 28 ++++++++++++++++++++++------ 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index 138a0e5da21..881209c286e 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el @@ -7572,8 +7572,8 @@ comment at the start of cc-engine.el for more info." ;; Skip leading type modifiers. If any are found we know it's a ;; prefix of a type. - (when c-opt-type-modifier-key ; e.g. "const" "volatile", but NOT "typedef" - (while (looking-at c-opt-type-modifier-key) + (when c-opt-type-modifier-prefix-key ; e.g. "const" "volatile", but NOT "typedef" + (while (looking-at c-opt-type-modifier-prefix-key) (goto-char (match-end 1)) (c-forward-syntactic-ws) (setq res 'prefix))) diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el index 869048bee31..169b61c3dd3 100644 --- a/lisp/progmodes/cc-langs.el +++ b/lisp/progmodes/cc-langs.el @@ -1925,16 +1925,32 @@ on one of the `*-decl-kwds' lists." t (c-make-keywords-re t (c-lang-const c-type-prefix-kwds))) (c-lang-defvar c-type-prefix-key (c-lang-const c-type-prefix-key)) -(c-lang-defconst c-type-modifier-kwds - "Type modifier keywords. These can occur almost anywhere in types -but they don't build a type of themselves. Unlike the keywords on -`c-primitive-type-kwds', they are fontified with the keyword face and -not the type face." +(c-lang-defconst c-type-modifier-prefix-kwds + "Type modifier keywords which can appear in front of a type. These can +also occur almost anywhere in types but they don't build a type of +themselves. Unlike the keywords on `c-primitive-type-kwds', they are +fontified with the keyword face and not the type face." t nil c '("const" "restrict" "volatile") - c++ '("const" "noexcept" "volatile" "throw") + c++ '("const" "noexcept" "volatile") objc '("const" "volatile")) +(c-lang-defconst c-opt-type-modifier-prefix-key + ;; Adorned regexp matching `c-type-modifier-prefix-kwds', or nil in + ;; languages without such keywords. + t (and (c-lang-const c-type-modifier-prefix-kwds) + (c-make-keywords-re t (c-lang-const c-type-modifier-prefix-kwds)))) +(c-lang-defvar c-opt-type-modifier-prefix-key + (c-lang-const c-opt-type-modifier-prefix-key)) + +(c-lang-defconst c-type-modifier-kwds + "Type modifier keywords. These can occur almost anywhere in types except +at the start, but they don't build a type of themselves. Unlike the keywords +on `c-primitive-type-kwds', they are fontified with the keyword face and not +the type face." + t (c-lang-const c-type-modifier-prefix-kwds) + c++ (append (c-lang-const c-type-modifier-prefix-kwds) '("throw"))) + (c-lang-defconst c-opt-type-modifier-key ;; Adorned regexp matching `c-type-modifier-kwds', or nil in ;; languages without such keywords. From aa66da220cdb6aaab5b347093fd40f0e1580913b Mon Sep 17 00:00:00 2001 From: "Charles A. Roelli" Date: Thu, 14 Dec 2017 20:53:35 +0100 Subject: [PATCH 11/40] * src/data.c (Fadd_variable_watcher): Doc fix. --- src/data.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/data.c b/src/data.c index d54c46d72bf..841a295fbee 100644 --- a/src/data.c +++ b/src/data.c @@ -1481,7 +1481,7 @@ SYMBOL is the variable being changed. NEWVAL is the value it will be changed to. OPERATION is a symbol representing the kind of change, one of: `set', `let', `unlet', `makunbound', and `defvaralias'. -WHERE is a buffer if the buffer-local value of the variable being +WHERE is a buffer if the buffer-local value of the variable is being changed, nil otherwise. All writes to aliases of SYMBOL will call WATCH-FUNCTION too. */) From e220d6e112e33f3f897c305d0d5d278d83191774 Mon Sep 17 00:00:00 2001 From: Alan Mackenzie Date: Thu, 14 Dec 2017 21:04:39 +0000 Subject: [PATCH 12/40] Fix fontification of first declaration within a C++ lambda form. * lisp/progmodes/cc-engine.el (c-looking-at-or-maybe-in-bracelist): Cease spuriously recognizing the braces of a lambda form as a brace list when there is an "=" preceding the introductory brackets. --- lisp/progmodes/cc-engine.el | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index 881209c286e..12ec8f74fea 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el @@ -10440,7 +10440,7 @@ comment at the start of cc-engine.el for more info." c-decl-block-key)) (braceassignp 'dontknow) inexpr-brace-list bufpos macro-start res pos after-type-id-pos - in-paren) + in-paren parens-before-brace) (setq res (c-backward-token-2 1 t lim)) ;; Checks to do only on the first sexp before the brace. @@ -10458,6 +10458,9 @@ comment at the start of cc-engine.el for more info." ((and (looking-at c-symbol-start) (not (looking-at c-keywords-regexp))) (setq after-type-id-pos (point))) + ((eq (char-after) ?\() + (setq parens-before-brace t) + nil) (t nil)) (save-excursion (cond @@ -10506,6 +10509,14 @@ comment at the start of cc-engine.el for more info." ;; Single identifier between '(' and '{'. We have a bracelist. (cons after-type-id-pos 'in-paren)) + ;; Are we at the parens of a C++ lambda expression? + ((and parens-before-brace + (save-excursion + (and + (zerop (c-backward-token-2 1 t lim)) + (c-looking-at-c++-lambda-capture-list)))) + nil) ; a lambda expression isn't a brace list. + (t (goto-char pos) ;; Checks to do on all sexps before the brace, up to the From 541a60108d8777119430953245ee530665e603ff Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Thu, 14 Dec 2017 21:01:08 -0500 Subject: [PATCH 13/40] Fix some custom groups * lisp/vc/vc-hooks.el (vc-faces): Rename from vc-state-faces. * lisp/vc/cvs-status.el (cvs-status): Unused, remove. --- lisp/eshell/em-tramp.el | 2 ++ lisp/eshell/em-xtra.el | 2 ++ lisp/vc/cvs-status.el | 5 ----- lisp/vc/vc-hooks.el | 4 ++-- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/lisp/eshell/em-tramp.el b/lisp/eshell/em-tramp.el index e322cea1e21..e2da3468aba 100644 --- a/lisp/eshell/em-tramp.el +++ b/lisp/eshell/em-tramp.el @@ -32,6 +32,8 @@ (require 'eshell) (require 'tramp)) +;; There are no items in this custom group, but eshell modules (ab)use +;; custom groups. ;;;###autoload (progn (defgroup eshell-tramp nil diff --git a/lisp/eshell/em-xtra.el b/lisp/eshell/em-xtra.el index 7b80f64d629..89814467d1f 100644 --- a/lisp/eshell/em-xtra.el +++ b/lisp/eshell/em-xtra.el @@ -29,6 +29,8 @@ (require 'pcomplete)) (require 'compile) +;; There are no items in this custom group, but eshell modules (ab)use +;; custom groups. ;;;###autoload (progn (defgroup eshell-xtra nil diff --git a/lisp/vc/cvs-status.el b/lisp/vc/cvs-status.el index 770791a3c09..3124a61422b 100644 --- a/lisp/vc/cvs-status.el +++ b/lisp/vc/cvs-status.el @@ -33,11 +33,6 @@ ;;; -(defgroup cvs-status nil - "Major mode for browsing `cvs status' output." - :group 'pcl-cvs - :prefix "cvs-status-") - (easy-mmode-defmap cvs-status-mode-map '(("n" . next-line) ("p" . previous-line) diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el index 99c8211ad5f..394b86c024b 100644 --- a/lisp/vc/vc-hooks.el +++ b/lisp/vc/vc-hooks.el @@ -34,9 +34,9 @@ ;; Faces -(defgroup vc-state-faces nil +(defgroup vc-faces nil "Faces used in the mode line by the VC state indicator." - :group 'vc-faces + :group 'vc :group 'mode-line :version "25.1") From 780407cff13149c73085c5797c14dc0b7469fbcd Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Thu, 14 Dec 2017 21:31:28 -0500 Subject: [PATCH 14/40] Small fixes prompted by make check-declare * lisp/frame.el (x-focus-frame): Update declaration. (ns-mouse-absolute-pixel-position): Fix declaration. * lisp/vc/diff-mode.el (diff-refine-hunk): Use smerge-refine-regions rather than obsolete alias. (smerge-refine-subst): Remove declaration, no longer relevant. --- lisp/frame.el | 4 ++-- lisp/vc/diff-mode.el | 9 +++------ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/lisp/frame.el b/lisp/frame.el index 2e925325a9e..6f8d6a1cc9a 100644 --- a/lisp/frame.el +++ b/lisp/frame.el @@ -800,7 +800,7 @@ the user during startup." (nreverse frame-initial-geometry-arguments)) (cdr param-list)) -(declare-function x-focus-frame "frame.c" (frame)) +(declare-function x-focus-frame "frame.c" (frame &optional noactivate)) (defun select-frame-set-input-focus (frame &optional norecord) "Select FRAME, raise it, and set input focus, if possible. @@ -1484,7 +1484,7 @@ FRAME." (declare-function w32-mouse-absolute-pixel-position "w32fns.c") (declare-function x-mouse-absolute-pixel-position "xfns.c") -(declare-function ns-mouse-absolute-pixel-position "nsfns.c") +(declare-function ns-mouse-absolute-pixel-position "nsfns.m") (defun mouse-absolute-pixel-position () "Return absolute position of mouse cursor in pixels. diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el index df9627abdf0..df33d10ed0c 100644 --- a/lisp/vc/diff-mode.el +++ b/lisp/vc/diff-mode.el @@ -2005,9 +2005,6 @@ For use in `add-log-current-defun-function'." (replace-match (cdr (assq (char-before) '((?+ . "-") (?> . "<")))))) ) -(declare-function smerge-refine-subst "smerge-mode" - (beg1 end1 beg2 end2 props-c &optional preproc props-r props-a)) - (defun diff--forward-while-leading-char (char bound) "Move point until reaching a line not starting with CHAR. Return new point, if it was moved." @@ -2049,13 +2046,13 @@ Return new point, if it was moved." (diff--forward-while-leading-char ?+ end) (progn (diff--forward-while-leading-char ?\\ end) (setq end-add (point)))) - (smerge-refine-subst beg-del beg-add beg-add end-add + (smerge-refine-regions beg-del beg-add beg-add end-add nil 'diff-refine-preproc props-r props-a))))) (`context (let* ((middle (save-excursion (re-search-forward "^---"))) (other middle)) (while (re-search-forward "^\\(?:!.*\n\\)+" middle t) - (smerge-refine-subst (match-beginning 0) (match-end 0) + (smerge-refine-regions (match-beginning 0) (match-end 0) (save-excursion (goto-char other) (re-search-forward "^\\(?:!.*\n\\)+" end) @@ -2070,7 +2067,7 @@ Return new point, if it was moved." (let ((beg1 (1+ (point)))) (when (re-search-forward "^---.*\n" end t) ;; It's a combined add&remove, so there's something to do. - (smerge-refine-subst beg1 (match-beginning 0) + (smerge-refine-regions beg1 (match-beginning 0) (match-end 0) end nil 'diff-refine-preproc props-r props-a))))))))) From a21dac18bb17d23c9d6958149800c054687f8373 Mon Sep 17 00:00:00 2001 From: Ted Zlatanov Date: Thu, 14 Dec 2017 23:16:38 -0500 Subject: [PATCH 15/40] Add %DUMBFW to the default GnuTLS priority strings * lisp/net/gnutls.el (gnutls-boot-parameters): Add %DUMBFW to the default priority strings (Bug#25061). * etc/NEWS: Mention it. * doc/misc/emacs-gnutls.texi (Help For Users): Point to the GnuTLS priority string documentation URL. --- doc/misc/emacs-gnutls.texi | 6 ++++-- etc/NEWS | 3 +++ lisp/net/gnutls.el | 6 +++--- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/doc/misc/emacs-gnutls.texi b/doc/misc/emacs-gnutls.texi index 92846a924c5..1715c83a0d2 100644 --- a/doc/misc/emacs-gnutls.texi +++ b/doc/misc/emacs-gnutls.texi @@ -116,9 +116,11 @@ information. The @code{gnutls-algorithm-priority} variable sets the GnuTLS priority string. This is global, not per host name (although @code{gnutls-negotiate} supports a priority string per connection so -it could be done if needed). The priority string syntax is in the +it could be done if needed). For details see the @uref{https://www.gnu.org/software/gnutls/documentation.html, GnuTLS -documentation}. +documentation} and the +@uref{https://gnutls.org/manual/html_node/Priority-Strings.html, +GnuTLS priority string syntax and description}. @end defvar @defvar gnutls-trustfiles diff --git a/etc/NEWS b/etc/NEWS index 5324a0944ea..8080e10c7e5 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -431,6 +431,9 @@ You can enable this by customizing 'mwheel-tilt-scroll-p'. If you want to reverse the direction of the scroll, customize 'mwheel-flip-direction'. ++++ +** The default GnuTLS priority string now includes %DUMBFW. + ** Emacsclient changes +++ diff --git a/lisp/net/gnutls.el b/lisp/net/gnutls.el index 98f7b585588..a406b0b07fd 100644 --- a/lisp/net/gnutls.el +++ b/lisp/net/gnutls.el @@ -217,7 +217,7 @@ For the meaning of the rest of the parameters, see `gnutls-boot-parameters'." TYPE is `gnutls-x509pki' (default) or `gnutls-anon'. Use nil for the default. HOSTNAME is the remote hostname. It must be a valid string. -PRIORITY-STRING is as per the GnuTLS docs, default is \"NORMAL\". +PRIORITY-STRING is as per the GnuTLS docs, default is based on \"NORMAL\". TRUSTFILES is a list of CA bundles. It defaults to `gnutls-trustfiles'. CRLFILES is a list of CRL files. KEYLIST is an alist of (client key file, client cert file) pairs. @@ -265,11 +265,11 @@ defaults to GNUTLS_VERIFY_ALLOW_X509_V1_CA_CRT." (priority-string (or priority-string (cond ((eq type 'gnutls-anon) - "NORMAL:+ANON-DH:!ARCFOUR-128") + "NORMAL:+ANON-DH:!ARCFOUR-128:%DUMBFW") ((eq type 'gnutls-x509pki) (if gnutls-algorithm-priority (upcase gnutls-algorithm-priority) - "NORMAL"))))) + "NORMAL:%DUMBFW"))))) (verify-error (or verify-error ;; this uses the value of `gnutls-verify-error' (cond From b1788705284048382a3ef51783525b37e5443b1f Mon Sep 17 00:00:00 2001 From: Ted Zlatanov Date: Fri, 15 Dec 2017 00:17:30 -0500 Subject: [PATCH 16/40] Remember password change for IMAP in Gnus (Bug#29692) Reported by Trey Jackson . * lisp/gnus/mail-source.el (mail-source-fetch-imap): Check `mail-source-password-cache' for password. --- lisp/gnus/mail-source.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/gnus/mail-source.el b/lisp/gnus/mail-source.el index 93f03be72d0..ef34c492545 100644 --- a/lisp/gnus/mail-source.el +++ b/lisp/gnus/mail-source.el @@ -1097,7 +1097,8 @@ This only works when `display-time' is enabled." ;; remember password (with-current-buffer buf (when (and imap-password - (not (assoc from mail-source-password-cache))) + (not (member (cons from imap-password) + mail-source-password-cache))) (push (cons from imap-password) mail-source-password-cache))) ;; if predicate is nil, use all uids (dolist (uid (imap-search (or predicate "1:*") buf)) From c2a88ec8e8f3246c0f5051b208337205f7f96cca Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Thu, 14 Dec 2017 22:01:32 -0800 Subject: [PATCH 17/40] * lisp/textmodes/tex-mode.el: Ensure uncompiled file is loadable. --- lisp/textmodes/tex-mode.el | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el index f228e28b740..432a779b4a8 100644 --- a/lisp/textmodes/tex-mode.el +++ b/lisp/textmodes/tex-mode.el @@ -1014,9 +1014,10 @@ Inherits `shell-mode-map' with a few additions.") ;; This is a) ugly, and b) cheating, but this was the last ;; remaining warning from byte-compiling all of Emacs... (eval-when-compile - (setq byte-compile-function-environment - (delq (assq 'tex-mode byte-compile-function-environment) - byte-compile-function-environment))) + (if (boundp 'byte-compile-function-environment) + (setq byte-compile-function-environment + (delq (assq 'tex-mode byte-compile-function-environment) + byte-compile-function-environment)))) ;;;###autoload (defun tex-mode () From 9bf66c6beec81927e960d31e78b7b3bad060c63e Mon Sep 17 00:00:00 2001 From: Martin Rudalics Date: Fri, 15 Dec 2017 08:30:09 +0100 Subject: [PATCH 18/40] Don't run FOR_EACH_FRAME when there's no frame left (Bug#29961) This does not fix Bug#29961 but avoids that Emacs segfaults when trying to shut down because it lost connection to the X server. * src/dispnew.c (check_glyph_memory): * src/frame.c (delete_frame): Don't run FOR_EACH_FRAME when there's no frame left (Bug#29961). --- src/dispnew.c | 5 +++-- src/frame.c | 8 +++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/dispnew.c b/src/dispnew.c index b0fc5c31fa1..d07864718c3 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -2260,8 +2260,9 @@ check_glyph_memory (void) Lisp_Object tail, frame; /* Free glyph memory for all frames. */ - FOR_EACH_FRAME (tail, frame) - free_glyphs (XFRAME (frame)); + if (!NILP (Vframe_list)) + FOR_EACH_FRAME (tail, frame) + free_glyphs (XFRAME (frame)); #if defined GLYPH_DEBUG && defined ENABLE_CHECKING /* Check that nothing is left allocated. */ diff --git a/src/frame.c b/src/frame.c index 5bafbeddcce..66d1b5c759e 100644 --- a/src/frame.c +++ b/src/frame.c @@ -2058,7 +2058,7 @@ delete_frame (Lisp_Object frame, Lisp_Object force) /* If we've deleted the last_nonminibuf_frame, then try to find another one. */ - if (f == last_nonminibuf_frame) + if (f == last_nonminibuf_frame && !NILP (Vframe_list)) { last_nonminibuf_frame = 0; @@ -2076,7 +2076,7 @@ delete_frame (Lisp_Object frame, Lisp_Object force) /* If there's no other frame on the same kboard, get out of single-kboard state if we're in it for this kboard. */ - if (kb != NULL) + if (kb != NULL && !NILP (Vframe_list)) { /* Some frame we found on the same kboard, or nil if there are none. */ Lisp_Object frame_on_same_kboard = Qnil; @@ -2093,7 +2093,9 @@ delete_frame (Lisp_Object frame, Lisp_Object force) /* If we've deleted this keyboard's default_minibuffer_frame, try to find another one. Prefer minibuffer-only frames, but also notice frames with other windows. */ - if (kb != NULL && EQ (frame, KVAR (kb, Vdefault_minibuffer_frame))) + if (kb != NULL + && EQ (frame, KVAR (kb, Vdefault_minibuffer_frame)) + && !NILP (Vframe_list)) { /* The last frame we saw with a minibuffer, minibuffer-only or not. */ Lisp_Object frame_with_minibuf = Qnil; From 95606af8b06129f82efef54714bb95d6e95c0836 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Fri, 15 Dec 2017 09:37:42 +0100 Subject: [PATCH 19/40] Fix Bug#29712 in tramp-tests.el * test/lisp/net/tramp-tests.el (tramp-test32-environment-variables-and-port-numbers): Skip for macOS. (Bug#29712) --- test/lisp/net/tramp-tests.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index 1261a81378d..c1577008d31 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -3637,6 +3637,8 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." (ert-deftest tramp-test32-environment-variables-and-port-numbers () "Check that two connections with separate ports are different." (skip-unless (tramp--test-enabled)) + ;; Bug#29712. + (skip-unless (not (eq system-type 'darwin))) ;; 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) From ffb50eace65c67656ad9c20be40e91e19cacb064 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 15 Dec 2017 10:50:22 +0200 Subject: [PATCH 20/40] ; * etc/NEWS: Fix last change. --- etc/NEWS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/etc/NEWS b/etc/NEWS index 8080e10c7e5..6151543ee4e 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -433,6 +433,8 @@ want to reverse the direction of the scroll, customize +++ ** The default GnuTLS priority string now includes %DUMBFW. +This is to avoid bad behavior in some firewalls, which causes the +connection to be closed by the remote host. ** Emacsclient changes From a2697fac0ec0d4dd915b619bb76792121514acfa Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 15 Dec 2017 10:59:33 +0200 Subject: [PATCH 21/40] * lisp/menu-bar.el (menu-bar-mode): Doc fix. --- lisp/menu-bar.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el index 2b38cb5f2b0..5c96663316e 100644 --- a/lisp/menu-bar.el +++ b/lisp/menu-bar.el @@ -2294,8 +2294,8 @@ It must accept a buffer as its only required argument.") (define-minor-mode menu-bar-mode "Toggle display of a menu bar on each frame (Menu Bar mode). With a prefix argument ARG, enable Menu Bar mode if ARG is -positive, and disable it otherwise. If called from Lisp, enable -Menu Bar mode if ARG is omitted or nil. +positive, and disable it otherwise. If called from Lisp, also +enable Menu Bar mode if ARG is omitted or nil. This command applies to all frames that exist and frames to be created in the future." From 889f07c352f7e0deccf59353a60a45f2716551d8 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 15 Dec 2017 11:06:07 +0200 Subject: [PATCH 22/40] Better support utf-8-with-signature and utf-8-hfs in XML/HTML * lisp/international/mule.el (sgml-xml-auto-coding-function): Support UTF-8 with BOM and utf-8-hfs as variants of UTF-8, and obey the buffer's encoding if it is one of these variants, instead of re-encoding in UTF-8 proper. (Bug#20623) --- lisp/international/mule.el | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/lisp/international/mule.el b/lisp/international/mule.el index 857fa800eb4..81c04db90e9 100644 --- a/lisp/international/mule.el +++ b/lisp/international/mule.el @@ -2493,7 +2493,17 @@ This function is intended to be added to `auto-coding-functions'." (let* ((match (match-string 1)) (sym (intern (downcase match)))) (if (coding-system-p sym) - sym + ;; If the encoding tag is UTF-8 and the buffer's + ;; encoding is one of the variants of UTF-8, use the + ;; buffer's encoding. This allows, e.g., saving an + ;; XML file as UTF-8 with BOM when the tag says UTF-8. + (let ((sym-type (coding-system-type sym)) + (bfcs-type + (coding-system-type buffer-file-coding-system))) + (if (and (coding-system-equal 'utf-8 sym-type) + (coding-system-equal 'utf-8 bfcs-type)) + buffer-file-coding-system + sym)) (message "Warning: unknown coding system \"%s\"" match) nil)) ;; Files without an encoding tag should be UTF-8. But users @@ -2506,7 +2516,8 @@ This function is intended to be added to `auto-coding-functions'." (coding-system-base (detect-coding-region (point-min) size t))))) ;; Pure ASCII always comes back as undecided. - (if (memq detected '(utf-8 undecided)) + (if (memq detected + '(utf-8 'utf-8-with-signature 'utf-8-hfs undecided)) 'utf-8 (warn "File contents detected as %s. Consider adding an encoding attribute to the xml declaration, From 8ed529f0f300487600ac49cff22cce09c45db94b Mon Sep 17 00:00:00 2001 From: Allen Li Date: Fri, 15 Dec 2017 11:30:25 +0200 Subject: [PATCH 23/40] Add option to configure comint TERM * lisp/comint.el (comint-terminfo-terminal): New defcustom. (comint-term-environment): New function for setting terminal options (comint-exec-1): Use comint-term-environment. (Bug#29583) * lisp/progmodes/compile.el (compilation-start): Use comint-term-environment. * etc/NEWS: * doc/emacs/misc.texi (Shell Options): Document the new option. --- doc/emacs/misc.texi | 9 +++++++++ etc/NEWS | 7 +++++++ lisp/comint.el | 35 ++++++++++++++++++++++------------- lisp/progmodes/compile.el | 8 +------- 4 files changed, 39 insertions(+), 20 deletions(-) diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi index 6ad5fbafdd6..b6b396af8f5 100644 --- a/doc/emacs/misc.texi +++ b/doc/emacs/misc.texi @@ -1396,6 +1396,15 @@ directory stack if they are not already on it (@code{shell-pushd-dunique}). The values you choose should match the underlying shell, of course. +@vindex comint-terminfo-terminal +Comint mode sets the @env{TERM} environment variable to a safe default +value, but this value disables some useful features. For example, +color is disabled for applications that use @env{TERM} to determine if +color is supported. Therefore, Emacs provides an option +@code{comint-terminfo-terminal}, which you can set to a terminal that +is present in your system's terminfo database, in order to take +advantage of advanced features of that terminal. + @node Terminal emulator @subsection Emacs Terminal Emulator @findex term diff --git a/etc/NEWS b/etc/NEWS index 6151543ee4e..784c608041b 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -812,6 +812,13 @@ whose content matches a regexp; bound to '% g'. *** New user option 'comint-move-point-for-matching-input' to control where to place point after 'C-c M-r' and 'C-c M-s'. ++++ +*** New user option 'comint-terminfo-terminal'. +This option allows control of the value of the TERM environment +variable Emacs puts into the environment of the Comint mode and its +derivatives, such as Shell mode and Compilation Shell minor-mode. The +default is "dumb", for compatibility with previous behavior. + ** Compilation mode --- diff --git a/lisp/comint.el b/lisp/comint.el index dcf1ff794f9..7c56c259c49 100644 --- a/lisp/comint.el +++ b/lisp/comint.el @@ -459,6 +459,11 @@ executed once when the buffer is created." :type 'hook :group 'comint) +(defcustom comint-terminfo-terminal "dumb" + "Value to use for TERM when the system uses terminfo." + :type 'string + :group 'comint) + (defvar comint-mode-map (let ((map (make-sparse-keymap))) ;; Keys: @@ -817,19 +822,7 @@ series of processes in the same Comint buffer. The hook (defun comint-exec-1 (name buffer command switches) (let ((process-environment (nconc - ;; If using termcap, we specify `emacs' as the terminal type - ;; because that lets us specify a width. - ;; If using terminfo, we specify `dumb' because that is - ;; a defined terminal type. `emacs' is not a defined terminal type - ;; and there is no way for us to define it here. - ;; Some programs that use terminfo get very confused - ;; if TERM is not a valid terminal type. - ;; ;; There is similar code in compile.el. - (if (and (boundp 'system-uses-terminfo) system-uses-terminfo) - (list "TERM=dumb" "TERMCAP=" - (format "COLUMNS=%d" (window-width))) - (list "TERM=emacs" - (format "TERMCAP=emacs:co#%d:tc=unknown:" (window-width)))) + (comint-term-environment) (list (format "INSIDE_EMACS=%s,comint" emacs-version)) process-environment)) (default-directory @@ -858,6 +851,22 @@ series of processes in the same Comint buffer. The hook (set-process-coding-system proc decoding encoding)) proc)) +(defun comint-term-environment () + "Return an environment variable list for terminal configuration." + ;; If using termcap, we specify `emacs' as the terminal type + ;; because that lets us specify a width. + ;; If using terminfo, we default to `dumb' because that is + ;; a defined terminal type. `emacs' is not a defined terminal type + ;; and there is no way for us to define it here. + ;; Some programs that use terminfo get very confused + ;; if TERM is not a valid terminal type. + (if (and (boundp 'system-uses-terminfo) system-uses-terminfo) + (list (format "TERM=%s" comint-terminfo-terminal) + "TERMCAP=" + (format "COLUMNS=%d" (window-width))) + (list "TERM=emacs" + (format "TERMCAP=emacs:co#%d:tc=unknown:" (window-width))))) + (defun comint-nonblank-p (str) "Return non-nil if STR contains non-whitespace syntax." (not (string-match "\\`\\s *\\'" str))) diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index 4cce47e5d8c..c68001d2366 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el @@ -1746,13 +1746,7 @@ Returns the compilation buffer created." (let ((process-environment (append compilation-environment - (if (if (boundp 'system-uses-terminfo);`If' for compiler warning. - system-uses-terminfo) - (list "TERM=dumb" "TERMCAP=" - (format "COLUMNS=%d" (window-width))) - (list "TERM=emacs" - (format "TERMCAP=emacs:co#%d:tc=unknown:" - (window-width)))) + (comint-term-environment) (list (format "INSIDE_EMACS=%s,compile" emacs-version)) (copy-sequence process-environment)))) (set (make-local-variable 'compilation-arguments) From 12ad276d1586b2fe3cff9620538e2542773bc0f1 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 15 Dec 2017 11:45:22 +0200 Subject: [PATCH 24/40] Improve documentation of TERM environment variable * doc/emacs/trouble.texi (Checklist): * doc/emacs/building.texi (Compilation Shell): * doc/emacs/misc.texi (Shell Options): Improve indexing of TERM. * doc/emacs/building.texi (Compilation Shell): Mention 'comint-terminfo-terminal' in conjunction with the TERM value. --- doc/emacs/building.texi | 5 +++++ doc/emacs/misc.texi | 3 ++- doc/emacs/trouble.texi | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/doc/emacs/building.texi b/doc/emacs/building.texi index 87ac61bac3b..e108a4e7c10 100644 --- a/doc/emacs/building.texi +++ b/doc/emacs/building.texi @@ -303,6 +303,11 @@ And here's how to do it in csh: if ($?prompt) set prompt = @dots{} @end example +@vindex TERM, environment variable, in compilation mode + If you want to customize the value of the @env{TERM} environment +variable passed to the compilation subshell, customize the variable +@code{comint-terminfo-terminal} (@pxref{Shell Options}). + Emacs does not expect a compiler process to launch asynchronous subprocesses; if it does, and they keep running after the main compiler process has terminated, Emacs may kill them or their output diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi index b6b396af8f5..e4be004ae52 100644 --- a/doc/emacs/misc.texi +++ b/doc/emacs/misc.texi @@ -1397,9 +1397,10 @@ directory stack if they are not already on it underlying shell, of course. @vindex comint-terminfo-terminal +@vindex TERM, environment variable, in sub-shell Comint mode sets the @env{TERM} environment variable to a safe default value, but this value disables some useful features. For example, -color is disabled for applications that use @env{TERM} to determine if +color is disabled in applications that use @env{TERM} to determine if color is supported. Therefore, Emacs provides an option @code{comint-terminfo-terminal}, which you can set to a terminal that is present in your system's terminfo database, in order to take diff --git a/doc/emacs/trouble.texi b/doc/emacs/trouble.texi index 4a836c3224b..e98322d74e2 100644 --- a/doc/emacs/trouble.texi +++ b/doc/emacs/trouble.texi @@ -780,7 +780,7 @@ the dribble file. @item @findex open-termscript @cindex termscript file -@cindex @env{TERM} environment variable +@vindex TERM, environment variable, and display bugs For possible display bugs, the terminal type (the value of environment variable @env{TERM}), the complete termcap entry for the terminal from @file{/etc/termcap} (since that file is not identical on all machines), From 2494c14e7659af10b3db0e4bd765850328a976f7 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 15 Dec 2017 11:50:11 +0200 Subject: [PATCH 25/40] ; * lisp/comint.el (comint-terminfo-terminal): Add a :version tag. --- lisp/comint.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/comint.el b/lisp/comint.el index 7c56c259c49..5ee4e48d636 100644 --- a/lisp/comint.el +++ b/lisp/comint.el @@ -462,7 +462,8 @@ executed once when the buffer is created." (defcustom comint-terminfo-terminal "dumb" "Value to use for TERM when the system uses terminfo." :type 'string - :group 'comint) + :group 'comint + :version "26.1") (defvar comint-mode-map (let ((map (make-sparse-keymap))) From b1efbe656477bcda66de1bfab028e4e39bace055 Mon Sep 17 00:00:00 2001 From: "Basil L. Contovounesios" Date: Fri, 15 Dec 2017 12:18:43 +0200 Subject: [PATCH 26/40] Update message.el obsolete face aliases * lisp/gnus/message.el: (message-header-to, message-header-cc) (message-header-subject, message-header-newsgroups) (message-header-other, message-header-name, message-header-xheader) (message-separator, message-cited-text, message-mml): Use define-obsolete-face-alias. (Bug#29405) --- lisp/gnus/message.el | 50 ++++++++++++++++++-------------------------- 1 file changed, 20 insertions(+), 30 deletions(-) diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index fa5f47be30a..508d725a78d 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -1436,9 +1436,8 @@ starting with `not' and followed by regexps." (:bold t :italic t))) "Face used for displaying To headers." :group 'message-faces) -;; backward-compatibility alias -(put 'message-header-to-face 'face-alias 'message-header-to) -(put 'message-header-to-face 'obsolete-face "22.1") +(define-obsolete-face-alias 'message-header-to-face + 'message-header-to "22.1") (defface message-header-cc '((((class color) @@ -1451,9 +1450,8 @@ starting with `not' and followed by regexps." (:bold t))) "Face used for displaying Cc headers." :group 'message-faces) -;; backward-compatibility alias -(put 'message-header-cc-face 'face-alias 'message-header-cc) -(put 'message-header-cc-face 'obsolete-face "22.1") +(define-obsolete-face-alias 'message-header-cc-face + 'message-header-cc "22.1") (defface message-header-subject '((((class color) @@ -1466,9 +1464,8 @@ starting with `not' and followed by regexps." (:bold t))) "Face used for displaying Subject headers." :group 'message-faces) -;; backward-compatibility alias -(put 'message-header-subject-face 'face-alias 'message-header-subject) -(put 'message-header-subject-face 'obsolete-face "22.1") +(define-obsolete-face-alias 'message-header-subject-face + 'message-header-subject "22.1") (defface message-header-newsgroups '((((class color) @@ -1481,9 +1478,8 @@ starting with `not' and followed by regexps." (:bold t :italic t))) "Face used for displaying Newsgroups headers." :group 'message-faces) -;; backward-compatibility alias -(put 'message-header-newsgroups-face 'face-alias 'message-header-newsgroups) -(put 'message-header-newsgroups-face 'obsolete-face "22.1") +(define-obsolete-face-alias 'message-header-newsgroups-face + 'message-header-newsgroups "22.1") (defface message-header-other '((((class color) @@ -1496,9 +1492,8 @@ starting with `not' and followed by regexps." (:bold t :italic t))) "Face used for displaying other headers." :group 'message-faces) -;; backward-compatibility alias -(put 'message-header-other-face 'face-alias 'message-header-other) -(put 'message-header-other-face 'obsolete-face "22.1") +(define-obsolete-face-alias 'message-header-other-face + 'message-header-other "22.1") (defface message-header-name '((((class color) @@ -1511,9 +1506,8 @@ starting with `not' and followed by regexps." (:bold t))) "Face used for displaying header names." :group 'message-faces) -;; backward-compatibility alias -(put 'message-header-name-face 'face-alias 'message-header-name) -(put 'message-header-name-face 'obsolete-face "22.1") +(define-obsolete-face-alias 'message-header-name-face + 'message-header-name "22.1") (defface message-header-xheader '((((class color) @@ -1526,9 +1520,8 @@ starting with `not' and followed by regexps." (:bold t))) "Face used for displaying X-Header headers." :group 'message-faces) -;; backward-compatibility alias -(put 'message-header-xheader-face 'face-alias 'message-header-xheader) -(put 'message-header-xheader-face 'obsolete-face "22.1") +(define-obsolete-face-alias 'message-header-xheader-face + 'message-header-xheader "22.1") (defface message-separator '((((class color) @@ -1541,9 +1534,8 @@ starting with `not' and followed by regexps." (:bold t))) "Face used for displaying the separator." :group 'message-faces) -;; backward-compatibility alias -(put 'message-separator-face 'face-alias 'message-separator) -(put 'message-separator-face 'obsolete-face "22.1") +(define-obsolete-face-alias 'message-separator-face + 'message-separator "22.1") (defface message-cited-text '((((class color) @@ -1556,9 +1548,8 @@ starting with `not' and followed by regexps." (:bold t))) "Face used for displaying cited text names." :group 'message-faces) -;; backward-compatibility alias -(put 'message-cited-text-face 'face-alias 'message-cited-text) -(put 'message-cited-text-face 'obsolete-face "22.1") +(define-obsolete-face-alias 'message-cited-text-face + 'message-cited-text "22.1") (defface message-mml '((((class color) @@ -1571,9 +1562,8 @@ starting with `not' and followed by regexps." (:bold t))) "Face used for displaying MML." :group 'message-faces) -;; backward-compatibility alias -(put 'message-mml-face 'face-alias 'message-mml) -(put 'message-mml-face 'obsolete-face "22.1") +(define-obsolete-face-alias 'message-mml-face + 'message-mml "22.1") (defun message-font-lock-make-header-matcher (regexp) (let ((form From 92b2604a7f1757e0b2487451441c39a48f989c19 Mon Sep 17 00:00:00 2001 From: "Basil L. Contovounesios" Date: Fri, 15 Dec 2017 12:20:38 +0200 Subject: [PATCH 27/40] Modernise message.el face spec syntax * lisp/gnus/message.el (message-header-to, message-header-cc) (message-header-subject, message-header-newsgroups) (message-header-other, message-header-name, message-header-xheader) (message-separator, message-cited-text, message-mml): Use (DISPLAY . PLIST) face spec syntax as recommended in `(elisp) Defining Faces'. (Bug#29405) --- lisp/gnus/message.el | 60 ++++++++++++++++++++++---------------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index 508d725a78d..750958dab7d 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -1428,12 +1428,12 @@ starting with `not' and followed by regexps." (defface message-header-to '((((class color) (background dark)) - (:foreground "DarkOliveGreen1" :bold t)) + :foreground "DarkOliveGreen1" :bold t) (((class color) (background light)) - (:foreground "MidnightBlue" :bold t)) + :foreground "MidnightBlue" :bold t) (t - (:bold t :italic t))) + :bold t :italic t)) "Face used for displaying To headers." :group 'message-faces) (define-obsolete-face-alias 'message-header-to-face @@ -1442,12 +1442,12 @@ starting with `not' and followed by regexps." (defface message-header-cc '((((class color) (background dark)) - (:foreground "chartreuse1" :bold t)) + :foreground "chartreuse1" :bold t) (((class color) (background light)) - (:foreground "MidnightBlue")) + :foreground "MidnightBlue") (t - (:bold t))) + :bold t)) "Face used for displaying Cc headers." :group 'message-faces) (define-obsolete-face-alias 'message-header-cc-face @@ -1456,12 +1456,12 @@ starting with `not' and followed by regexps." (defface message-header-subject '((((class color) (background dark)) - (:foreground "OliveDrab1")) + :foreground "OliveDrab1") (((class color) (background light)) - (:foreground "navy blue" :bold t)) + :foreground "navy blue" :bold t) (t - (:bold t))) + :bold t)) "Face used for displaying Subject headers." :group 'message-faces) (define-obsolete-face-alias 'message-header-subject-face @@ -1470,12 +1470,12 @@ starting with `not' and followed by regexps." (defface message-header-newsgroups '((((class color) (background dark)) - (:foreground "yellow" :bold t :italic t)) + :foreground "yellow" :bold t :italic t) (((class color) (background light)) - (:foreground "blue4" :bold t :italic t)) + :foreground "blue4" :bold t :italic t) (t - (:bold t :italic t))) + :bold t :italic t)) "Face used for displaying Newsgroups headers." :group 'message-faces) (define-obsolete-face-alias 'message-header-newsgroups-face @@ -1484,12 +1484,12 @@ starting with `not' and followed by regexps." (defface message-header-other '((((class color) (background dark)) - (:foreground "VioletRed1")) + :foreground "VioletRed1") (((class color) (background light)) - (:foreground "steel blue")) + :foreground "steel blue") (t - (:bold t :italic t))) + :bold t :italic t)) "Face used for displaying other headers." :group 'message-faces) (define-obsolete-face-alias 'message-header-other-face @@ -1498,12 +1498,12 @@ starting with `not' and followed by regexps." (defface message-header-name '((((class color) (background dark)) - (:foreground "green")) + :foreground "green") (((class color) (background light)) - (:foreground "cornflower blue")) + :foreground "cornflower blue") (t - (:bold t))) + :bold t)) "Face used for displaying header names." :group 'message-faces) (define-obsolete-face-alias 'message-header-name-face @@ -1512,12 +1512,12 @@ starting with `not' and followed by regexps." (defface message-header-xheader '((((class color) (background dark)) - (:foreground "DeepSkyBlue1")) + :foreground "DeepSkyBlue1") (((class color) (background light)) - (:foreground "blue")) + :foreground "blue") (t - (:bold t))) + :bold t)) "Face used for displaying X-Header headers." :group 'message-faces) (define-obsolete-face-alias 'message-header-xheader-face @@ -1526,12 +1526,12 @@ starting with `not' and followed by regexps." (defface message-separator '((((class color) (background dark)) - (:foreground "LightSkyBlue1")) + :foreground "LightSkyBlue1") (((class color) (background light)) - (:foreground "brown")) + :foreground "brown") (t - (:bold t))) + :bold t)) "Face used for displaying the separator." :group 'message-faces) (define-obsolete-face-alias 'message-separator-face @@ -1540,12 +1540,12 @@ starting with `not' and followed by regexps." (defface message-cited-text '((((class color) (background dark)) - (:foreground "LightPink1")) + :foreground "LightPink1") (((class color) (background light)) - (:foreground "red")) + :foreground "red") (t - (:bold t))) + :bold t)) "Face used for displaying cited text names." :group 'message-faces) (define-obsolete-face-alias 'message-cited-text-face @@ -1554,12 +1554,12 @@ starting with `not' and followed by regexps." (defface message-mml '((((class color) (background dark)) - (:foreground "MediumSpringGreen")) + :foreground "MediumSpringGreen") (((class color) (background light)) - (:foreground "ForestGreen")) + :foreground "ForestGreen") (t - (:bold t))) + :bold t)) "Face used for displaying MML." :group 'message-faces) (define-obsolete-face-alias 'message-mml-face From d64b88da2fcc23cb0676fca382b4ddc7d1b68020 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 15 Dec 2017 12:30:30 +0200 Subject: [PATCH 28/40] * src/font.c (Ffont_info): Doc fix. (Bug#29682) --- src/font.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/font.c b/src/font.c index 441652b0951..69efd7d56d2 100644 --- a/src/font.c +++ b/src/font.c @@ -5055,10 +5055,10 @@ DEFUN ("font-info", Ffont_info, Sfont_info, 1, 2, 0, doc: /* Return information about a font named NAME on frame FRAME. If FRAME is omitted or nil, use the selected frame. -The returned value is a vector: +The returned value is a vector of 14 elements: [ OPENED-NAME FULL-NAME SIZE HEIGHT BASELINE-OFFSET RELATIVE-COMPOSE DEFAULT-ASCENT MAX-WIDTH ASCENT DESCENT SPACE-WIDTH AVERAGE-WIDTH - CAPABILITY ] + FILENAME CAPABILITY ] where OPENED-NAME is the name used for opening the font, FULL-NAME is the full name of the font, @@ -5068,12 +5068,12 @@ where RELATIVE-COMPOSE and DEFAULT-ASCENT are the numbers controlling how to compose characters, MAX-WIDTH is the maximum advance width of the font, - ASCENT, DESCENT, SPACE-WIDTH, AVERAGE-WIDTH are metrics of the font - in pixels, + ASCENT, DESCENT, SPACE-WIDTH, and AVERAGE-WIDTH are metrics of + the font in pixels, FILENAME is the font file name, a string (or nil if the font backend doesn't provide a file name). CAPABILITY is a list whose first element is a symbol representing the - font format, one of x, opentype, truetype, type1, pcf, or bdf. + font format, one of `x', `opentype', `truetype', `type1', `pcf', or `bdf'. The remaining elements describe the details of the font capabilities, as follows: From e019c35df60a306750e1025db99c36701a726ecb Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 15 Dec 2017 09:07:52 -0800 Subject: [PATCH 29/40] FOR_EACH_FRAME no longer assumes frame-list This cleans up a recent fix related to Bug#29661. Suggested by Stefan Monnier in: https://lists.gnu.org/r/emacs-devel/2017-12/msg00544.html * src/frame.c (next_frame, prev_frame, delete_frame): Restore debugging checks that Vframe_list is non-nil, as FOR_EACH_FRAME no longer has these checks. (delete_frame): Remove no-longer-needed checks that Vframe_list is non-nil, as FOR_EACH_FRAME no longer assumes that. * src/frame.h (FOR_EACH_FRAME): Do not assume Vframe_list is non-nil. --- src/frame.c | 13 ++++++++----- src/frame.h | 5 ++--- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/frame.c b/src/frame.c index 66d1b5c759e..63fa8abb7da 100644 --- a/src/frame.c +++ b/src/frame.c @@ -1607,6 +1607,8 @@ next_frame (Lisp_Object frame, Lisp_Object minibuf) Lisp_Object f, tail; int passed = 0; + eassume (CONSP (Vframe_list)); + while (passed < 2) FOR_EACH_FRAME (tail, f) { @@ -1629,6 +1631,8 @@ prev_frame (Lisp_Object frame, Lisp_Object minibuf) { Lisp_Object f, tail, prev = Qnil; + eassume (CONSP (Vframe_list)); + FOR_EACH_FRAME (tail, f) { if (EQ (frame, f) && !NILP (prev)) @@ -1914,6 +1918,7 @@ delete_frame (Lisp_Object frame, Lisp_Object force) if (f == sf) { Lisp_Object tail; + eassume (CONSP (Vframe_list)); /* Look for another visible frame on the same terminal. Do not call next_frame here because it may loop forever. @@ -2058,7 +2063,7 @@ delete_frame (Lisp_Object frame, Lisp_Object force) /* If we've deleted the last_nonminibuf_frame, then try to find another one. */ - if (f == last_nonminibuf_frame && !NILP (Vframe_list)) + if (f == last_nonminibuf_frame) { last_nonminibuf_frame = 0; @@ -2076,7 +2081,7 @@ delete_frame (Lisp_Object frame, Lisp_Object force) /* If there's no other frame on the same kboard, get out of single-kboard state if we're in it for this kboard. */ - if (kb != NULL && !NILP (Vframe_list)) + if (kb != NULL) { /* Some frame we found on the same kboard, or nil if there are none. */ Lisp_Object frame_on_same_kboard = Qnil; @@ -2093,9 +2098,7 @@ delete_frame (Lisp_Object frame, Lisp_Object force) /* If we've deleted this keyboard's default_minibuffer_frame, try to find another one. Prefer minibuffer-only frames, but also notice frames with other windows. */ - if (kb != NULL - && EQ (frame, KVAR (kb, Vdefault_minibuffer_frame)) - && !NILP (Vframe_list)) + if (kb != NULL && EQ (frame, KVAR (kb, Vdefault_minibuffer_frame))) { /* The last frame we saw with a minibuffer, minibuffer-only or not. */ Lisp_Object frame_with_minibuf = Qnil; diff --git a/src/frame.h b/src/frame.h index a3b77636435..a5d4e4fc88b 100644 --- a/src/frame.h +++ b/src/frame.h @@ -1149,8 +1149,7 @@ default_pixels_per_inch_y (void) /* FOR_EACH_FRAME (LIST_VAR, FRAME_VAR) followed by a statement is a `for' loop which iterates over the elements of Vframe_list. The loop will set FRAME_VAR, a Lisp_Object, to each frame in - Vframe_list in succession and execute the statement. Vframe_list - should be nonempty, so the body is executed at least once. LIST_VAR + Vframe_list in succession and execute the statement. LIST_VAR should be a Lisp_Object too; it is used to iterate through the Vframe_list. Note that this macro walks over child frames and the tooltip frame as well. @@ -1160,7 +1159,7 @@ default_pixels_per_inch_y (void) something which executes the statement once. */ #define FOR_EACH_FRAME(list_var, frame_var) \ - for ((list_var) = (eassume (CONSP (Vframe_list)), Vframe_list); \ + for ((list_var) = Vframe_list; \ (CONSP (list_var) \ && (frame_var = XCAR (list_var), true)); \ list_var = XCDR (list_var)) From 5a7d0095a49faf6c71800bfde61c42eb6edd0125 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Fri, 15 Dec 2017 13:35:25 -0500 Subject: [PATCH 30/40] * lisp/vc/smerge-mode.el (smerge-refine): Replace obsolete alias. --- lisp/vc/smerge-mode.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/vc/smerge-mode.el b/lisp/vc/smerge-mode.el index b988463de1e..f1a8ed48c75 100644 --- a/lisp/vc/smerge-mode.el +++ b/lisp/vc/smerge-mode.el @@ -919,7 +919,7 @@ Its behavior has mainly two restrictions: after the newline. This only matters if `smerge-refine-ignore-whitespace' is nil. - it needs to be unaffected by changes performed by the `preproc' argument - to `smerge-refine-subst'. + to `smerge-refine-regions'. This only matters if `smerge-refine-weight-hack' is nil.") (defvar smerge-refine-ignore-whitespace t @@ -1188,7 +1188,7 @@ repeating the command will highlight other two parts." (put-text-property (match-beginning 0) (1+ (match-beginning 0)) 'smerge-refine-part (cons (buffer-chars-modified-tick) part))) - (smerge-refine-subst (match-beginning n1) (match-end n1) + (smerge-refine-regions (match-beginning n1) (match-end n1) (match-beginning n2) (match-end n2) (if smerge-use-changed-face '((smerge . refine) (face . smerge-refined-change))) From ad17db7964a1022fb0f646b35a00ffc5fb70ec30 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Fri, 15 Dec 2017 13:40:06 -0500 Subject: [PATCH 31/40] * lisp/vc/smerge-mode.el (smerge-refine): Respect font-lock-mode. --- lisp/vc/smerge-mode.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lisp/vc/smerge-mode.el b/lisp/vc/smerge-mode.el index f1a8ed48c75..ea1e0c726fd 100644 --- a/lisp/vc/smerge-mode.el +++ b/lisp/vc/smerge-mode.el @@ -1191,12 +1191,12 @@ repeating the command will highlight other two parts." (smerge-refine-regions (match-beginning n1) (match-end n1) (match-beginning n2) (match-end n2) (if smerge-use-changed-face - '((smerge . refine) (face . smerge-refined-change))) + '((smerge . refine) (font-lock-face . smerge-refined-change))) nil (unless smerge-use-changed-face - '((smerge . refine) (face . smerge-refined-removed))) + '((smerge . refine) (font-lock-face . smerge-refined-removed))) (unless smerge-use-changed-face - '((smerge . refine) (face . smerge-refined-added)))))) + '((smerge . refine) (font-lock-face . smerge-refined-added)))))) (defun smerge-swap () "Swap the \"Upper\" and the \"Lower\" chunks. From 777fe9466168d935e9055c7592b943cd4d2d2ff9 Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Fri, 15 Dec 2017 23:20:25 -0500 Subject: [PATCH 32/40] Partially revert "Mention new strictness for &optional, &rest..." The changes to cl argument parsing are not backwards compatible, and cause inconvenience when writing macros (e.g., instead of doing '&aux ,@auxargs', some more complicated conditionals would be required). The `cl-defstruct' macro makes use of this convenience when defining empty structs (Bug#29728). * lisp/emacs-lisp/cl-macs.el (cl--transform-lambda): (cl--do-&aux, cl--do-arglist): Undo strict checking of &rest, &key, and &aux. * test/lisp/emacs-lisp/cl-macs-tests.el (cl-macs-bad-arglist): Remove test. --- lisp/emacs-lisp/cl-macs.el | 38 ++++++++------------------- test/lisp/emacs-lisp/cl-macs-tests.el | 31 ---------------------- 2 files changed, 11 insertions(+), 58 deletions(-) diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index 6aed060cb50..5535100d4ae 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el @@ -281,13 +281,8 @@ FORM is of the form (ARGS . BODY)." (or (not optional) ;; Optional args whose default is nil are simple. (null (nth 1 (assq (car args) (cdr cl--bind-defs))))) - (not (and (eq (car args) '&optional) - (progn - (when (memq (cadr args) - '(nil &rest &body &key &aux)) - (error "Variable missing after &optional")) - (setq optional t) - (car cl--bind-defs))))) + (not (and (eq (car args) '&optional) (setq optional t) + (car cl--bind-defs)))) (push (pop args) simple-args)) (when optional (if args (push '&optional args)) @@ -539,17 +534,14 @@ its argument list allows full Common Lisp conventions." arglist)))) (defun cl--do-&aux (args) - (when (eq (car args) '&aux) - (pop args) - (when (null args) - (error "Variable missing after &aux"))) - (while (and args (not (memq (car args) cl--lambda-list-keywords))) - (if (consp (car args)) - (if (and cl--bind-enquote (cl-cadar args)) - (cl--do-arglist (caar args) - `',(cadr (pop args))) - (cl--do-arglist (caar args) (cadr (pop args)))) - (cl--do-arglist (pop args) nil))) + (while (and (eq (car args) '&aux) (pop args)) + (while (and args (not (memq (car args) cl--lambda-list-keywords))) + (if (consp (car args)) + (if (and cl--bind-enquote (cl-cadar args)) + (cl--do-arglist (caar args) + `',(cadr (pop args))) + (cl--do-arglist (caar args) (cadr (pop args)))) + (cl--do-arglist (pop args) nil)))) (if args (error "Malformed argument list ends with: %S" args))) (defun cl--do-arglist (args expr &optional num) ; uses cl--bind-* @@ -566,9 +558,6 @@ its argument list allows full Common Lisp conventions." (keys nil) (laterarg nil) (exactarg nil) minarg) (or num (setq num 0)) - (when (and restarg (or (null (cdr restarg)) - (memq (cadr restarg) cl--lambda-list-keywords))) - (error "Variable missing after &rest")) (setq restarg (if (listp (cadr restarg)) (make-symbol "--cl-rest--") (cadr restarg))) @@ -620,12 +609,7 @@ its argument list allows full Common Lisp conventions." `',cl--bind-block) (+ ,num (length ,restarg))))) cl--bind-forms))) - (while (eq (car args) '&key) - (pop args) - (when (or (null args) (memq (car args) cl--lambda-list-keywords)) - (error "Missing variable after &key")) - (when keys - (error "Multiple occurrences of &key")) + (while (and (eq (car args) '&key) (pop args)) (while (and args (not (memq (car args) cl--lambda-list-keywords))) (let ((arg (pop args))) (or (consp arg) (setq arg (list arg))) diff --git a/test/lisp/emacs-lisp/cl-macs-tests.el b/test/lisp/emacs-lisp/cl-macs-tests.el index bf2e7e12759..575f170af6c 100644 --- a/test/lisp/emacs-lisp/cl-macs-tests.el +++ b/test/lisp/emacs-lisp/cl-macs-tests.el @@ -497,35 +497,4 @@ collection clause." vconcat (vector (1+ x))) [2 3 4 5 6]))) - -;;; cl-lib lambda list handling - -(ert-deftest cl-macs-bad-arglist () - "Check that `cl-defun' and friends reject weird argument lists. -See Bug#29165, and similar `eval-tests--bugs-24912-and-24913' in -eval-tests.el." - (dolist (args (cl-mapcan - ;; For every &rest and &optional variant, check also - ;; the same thing with &key and &aux respectively - ;; instead. - (lambda (arglist) - (let ((arglists (list arglist))) - (when (memq '&rest arglist) - (push (cl-subst '&key '&rest arglist) arglists)) - (when (memq '&optional arglist) - (push (cl-subst '&aux '&optional arglist) arglists)) - arglists)) - '((&optional) (&rest) (&optional &rest) (&rest &optional) - (&optional &rest _a) (&optional _a &rest) - (&rest _a &optional) (&rest &optional _a) - (&optional &optional) (&optional &optional _a) - (&optional _a &optional _b) - (&rest &rest) (&rest &rest _a) - (&rest _a &rest _b)))) - (ert-info ((prin1-to-string args) :prefix "arglist: ") - (should-error (eval `(funcall (cl-function (lambda ,args))) t)) - (should-error (cl--transform-lambda (cons args t))) - (let ((byte-compile-debug t)) - (should-error (eval `(byte-compile (cl-function (lambda ,args))) t)))))) - ;;; cl-macs-tests.el ends here From 804b37ca63ecd68c5359febbedbec120c06918af Mon Sep 17 00:00:00 2001 From: Aaron Jensen Date: Sat, 16 Dec 2017 09:36:35 +0100 Subject: [PATCH 33/40] Save and restore text-pixel height and width of frames (Bug#28442) * lisp/frameset.el (frameset--record-relationships): Record text-pixel-height and text-pixel-width of frame. (frameset--restore-frame): Restore text-pixel-height and text-pixel-width of frame if available. (Bug#28442) --- lisp/frameset.el | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/lisp/frameset.el b/lisp/frameset.el index 16940f814a9..e2d26411e96 100644 --- a/lisp/frameset.el +++ b/lisp/frameset.el @@ -745,6 +745,8 @@ The relationships recorded for each frame are - `delete-before' via `frameset--delete-before' - `parent-frame' via `frameset--parent-frame' - `mouse-wheel-frame' via `frameset--mouse-wheel-frame' +- `text-pixel-width' via `frameset--text-pixel-width' +- `text-pixel-height' via `frameset--text-pixel-height' Internal use only." ;; Record frames with their own minibuffer @@ -791,7 +793,23 @@ Internal use only." 'frameset--mini (cons nil (and mb-frame - (frameset-frame-id mb-frame)))))))))) + (frameset-frame-id mb-frame))))))))) + ;; Now store text-pixel width and height if it differs from the calculated + ;; width and height and the frame is not fullscreen. + (dolist (frame frame-list) + (unless (frame-parameter frame 'fullscreen) + (unless (eq (* (frame-parameter frame 'width) + (frame-char-width frame)) + (frame-text-width frame)) + (set-frame-parameter + frame 'frameset--text-pixel-width + (frame-text-width frame))) + (unless (eq (* (frame-parameter frame 'height) + (frame-char-height frame)) + (frame-text-height frame)) + (set-frame-parameter + frame 'frameset--text-pixel-height + (frame-text-height frame)))))) ;;;###autoload (cl-defun frameset-save (frame-list @@ -1002,6 +1020,14 @@ Internal use only." (display (cdr (assq 'display filtered-cfg))) ;; post-filtering alt-cfg frame) + ;; Use text-pixels for height and width, if available. + (let ((text-pixel-width (cdr (assq 'frameset--text-pixel-width parameters))) + (text-pixel-height (cdr (assq 'frameset--text-pixel-height parameters)))) + (when text-pixel-width + (setf (alist-get 'width filtered-cfg) (cons 'text-pixels text-pixel-width))) + (when text-pixel-height + (setf (alist-get 'height filtered-cfg) (cons 'text-pixels text-pixel-height)))) + (when fullscreen ;; Currently Emacs has the limitation that it does not record the size ;; and position of a frame before maximizing it, so we cannot save & From 63b6281fdd9c00c6d968e936289c1e32aa9d0dd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simen=20Heggest=C3=B8yl?= Date: Sat, 16 Dec 2017 09:37:11 +0100 Subject: [PATCH 34/40] Fix off-by-one error in 'css--hex-color' * lisp/textmodes/css-mode.el (css--hex-color): Fix off-by-one error. * test/lisp/textmodes/css-mode-tests.el (css-test-hex-color): New test for 'css--hex-color'. --- lisp/textmodes/css-mode.el | 2 +- test/lisp/textmodes/css-mode-tests.el | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el index 1de4ff0fca9..f2481da8aa1 100644 --- a/lisp/textmodes/css-mode.el +++ b/lisp/textmodes/css-mode.el @@ -1037,7 +1037,7 @@ This recognizes CSS-color-4 extensions." STR is the incoming CSS hex color. This function simply drops any transparency." ;; Either #RGB or #RRGGBB, drop the "A" or "AA". - (if (> (length str) 4) + (if (> (length str) 5) (substring str 0 7) (substring str 0 4))) diff --git a/test/lisp/textmodes/css-mode-tests.el b/test/lisp/textmodes/css-mode-tests.el index 47cf5f9244b..1e58751f140 100644 --- a/test/lisp/textmodes/css-mode-tests.el +++ b/test/lisp/textmodes/css-mode-tests.el @@ -295,6 +295,12 @@ (insert input ")")) (should (equal (css--hsl-color) "#ff0000"))))) +(ert-deftest css-test-hex-color () + (should (equal (css--hex-color "#abc") "#abc")) + (should (equal (css--hex-color "#abcd") "#abc")) + (should (equal (css--hex-color "#aabbcc") "#aabbcc")) + (should (equal (css--hex-color "#aabbccdd") "#aabbcc"))) + (ert-deftest css-test-named-color () (dolist (text '("@mixin black" "@include black")) (with-temp-buffer From a1327bbc645efa42f14024785da4fed88aa7ec21 Mon Sep 17 00:00:00 2001 From: Martin Rudalics Date: Sat, 16 Dec 2017 10:14:29 +0100 Subject: [PATCH 35/40] Remove one more check that Vframe_list is non-nil * src/dispnew.c (check_glyph_memory): Remove no-longer-needed check that Vframe_list is non-nil, as FOR_EACH_FRAME no longer assumes that. --- src/dispnew.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/dispnew.c b/src/dispnew.c index d07864718c3..b0fc5c31fa1 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -2260,9 +2260,8 @@ check_glyph_memory (void) Lisp_Object tail, frame; /* Free glyph memory for all frames. */ - if (!NILP (Vframe_list)) - FOR_EACH_FRAME (tail, frame) - free_glyphs (XFRAME (frame)); + FOR_EACH_FRAME (tail, frame) + free_glyphs (XFRAME (frame)); #if defined GLYPH_DEBUG && defined ENABLE_CHECKING /* Check that nothing is left allocated. */ From 78908644131e70f20de28fed08ef4dc2878878a3 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 16 Dec 2017 12:15:06 +0200 Subject: [PATCH 36/40] Improve documentation of 'invisible-p' * doc/lispref/display.texi (Invisible Text): Document the return value of 'invisible-p'. * src/xdisp.c (Finvisible_p): Rename the argument POS. Doc fix. (Bug#29721) --- doc/lispref/display.texi | 7 ++++++- src/xdisp.c | 28 +++++++++++++++++----------- 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index 7af8d9efb7c..50069e3d1da 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi @@ -929,13 +929,18 @@ major mode should use the mode's own name as an element of @defun invisible-p pos-or-prop If @var{pos-or-prop} is a marker or number, this function returns a -non-@code{nil} value if the text at that position is invisible. +non-@code{nil} value if the text at that position is currently +invisible. If @var{pos-or-prop} is any other kind of Lisp object, that is taken to mean a possible value of the @code{invisible} text or overlay property. In that case, this function returns a non-@code{nil} value if that value would cause text to become invisible, based on the current value of @code{buffer-invisibility-spec}. + +The return value of this function is @code{t} if the text would be +completely hidden on display, or a non-@code{nil}, non-@code{t} value +if the text would be replaced by an ellipsis. @end defun @vindex line-move-ignore-invisible diff --git a/src/xdisp.c b/src/xdisp.c index 0a37013c560..7601e26a902 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -25086,19 +25086,25 @@ invisible_prop (Lisp_Object propval, Lisp_Object list) } DEFUN ("invisible-p", Finvisible_p, Sinvisible_p, 1, 1, 0, - doc: /* Non-nil if the property makes the text invisible. -POS-OR-PROP can be a marker or number, in which case it is taken to be -a position in the current buffer and the value of the `invisible' property -is checked; or it can be some other value, which is then presumed to be the -value of the `invisible' property of the text of interest. -The non-nil value returned can be t for truly invisible text or something -else if the text is replaced by an ellipsis. */) - (Lisp_Object pos_or_prop) + doc: /* Non-nil if text properties at POS cause text there to be currently invisible. +POS should be a marker or a buffer position; the value of the `invisible' +property at that position in the current buffer is examined. +POS can also be the actual value of the `invisible' text or overlay +property of the text of interest, in which case the value itself is +examined. + +The non-nil value returned can be t for currently invisible text that is +entirely hidden on display, or some other non-nil, non-t value if the +text is replaced by an ellipsis. + +Note that whether text with `invisible' property is actually hidden on +display may depend on `buffer-invisibility-spec', which see. */) + (Lisp_Object pos) { Lisp_Object prop - = (NATNUMP (pos_or_prop) || MARKERP (pos_or_prop) - ? Fget_char_property (pos_or_prop, Qinvisible, Qnil) - : pos_or_prop); + = (NATNUMP (pos) || MARKERP (pos) + ? Fget_char_property (pos, Qinvisible, Qnil) + : pos); int invis = TEXT_PROP_MEANS_INVISIBLE (prop); return (invis == 0 ? Qnil : invis == 1 ? Qt From f274cbd185ddab4e414ccecf6c0b30e6fd3ef303 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 16 Dec 2017 16:09:41 +0200 Subject: [PATCH 37/40] Avoid reordering of output in 'shr-insert-document' * lisp/net/shr.el (shr-string-pixel-width): Preserve point across shr-pixel-column invocations. (Bug#29734) --- lisp/net/shr.el | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lisp/net/shr.el b/lisp/net/shr.el index 8a64f7549f2..c505f25a5a9 100644 --- a/lisp/net/shr.el +++ b/lisp/net/shr.el @@ -591,9 +591,14 @@ size, and full-buffer size." (defun shr-string-pixel-width (string) (if (not shr-use-fonts) (length string) - (with-temp-buffer - (insert string) - (shr-pixel-column)))) + ;; Save and restore point across with-temp-buffer, since + ;; shr-pixel-column uses save-window-excursion, which can reset + ;; point to 1. + (let ((pt (point))) + (with-temp-buffer + (insert string) + (shr-pixel-column)) + (goto-char pt)))) (defsubst shr--translate-insertion-chars () ;; Remove soft hyphens. From ffd4771560bf91eb4f52970b9e7119ff7b804aed Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 16 Dec 2017 16:54:32 +0200 Subject: [PATCH 38/40] * doc/lispref/sequences.texi (Sequence Functions): Improve indexing. --- doc/lispref/sequences.texi | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/doc/lispref/sequences.texi b/doc/lispref/sequences.texi index 4fba880803e..8d56e022d8f 100644 --- a/doc/lispref/sequences.texi +++ b/doc/lispref/sequences.texi @@ -425,6 +425,7 @@ useful example of @code{sort}. @cindex sequence functions in seq @cindex seq library +@cindex sequences, generalized The @file{seq.el} library provides the following additional sequence manipulation macros and functions, prefixed with @code{seq-}. To use them, you must first load the @file{seq} library. @@ -859,6 +860,7 @@ it is a function of two arguments to use instead of the default @code{equal}. @end defun @defun seq-subseq sequence start &optional end +@cindex sub-sequence This function returns a subset of @var{sequence} from @var{start} to @var{end}, both integers (@var{end} defaults to the last element). If @var{start} or @var{end} is negative, it counts from the end of @@ -926,6 +928,8 @@ contain less elements than @var{n}. @var{n} must be an integer. If @end defun @defun seq-intersection sequence1 sequence2 &optional function +@cindex sequences, intersection of +@cindex intersection of sequences This function returns a list of the elements that appear both in @var{sequence1} and @var{sequence2}. If the optional argument @var{function} is non-@code{nil}, it is a function of two arguments to @@ -972,6 +976,10 @@ of @var{sequence}. Keys are compared using @code{equal}. @end defun @defun seq-into sequence type +@cindex convert sequence to another type +@cindex list to vector +@cindex vector to list +@cindex string to vector This function converts the sequence @var{sequence} into a sequence of type @var{type}. @var{type} can be one of the following symbols: @code{vector}, @code{string} or @code{list}. @@ -993,6 +1001,8 @@ of type @var{type}. @var{type} can be one of the following symbols: @end defun @defun seq-min sequence +@cindex minimum value of sequence +@cindex sequence minimum This function returns the smallest element of @var{sequence}. The elements of @var{sequence} must be numbers or markers (@pxref{Markers}). @@ -1010,6 +1020,8 @@ elements of @var{sequence} must be numbers or markers @end defun @defun seq-max sequence +@cindex maximum value of sequence +@cindex sequence maximum This function returns the largest element of @var{sequence}. The elements of @var{sequence} must be numbers or markers. @@ -1027,6 +1039,7 @@ elements of @var{sequence} must be numbers or markers. @defmac seq-doseq (var sequence) body@dots{} @cindex sequence iteration +@cindex iteration over vector or string This macro is like @code{dolist} (@pxref{Iteration, dolist}), except that @var{sequence} can be a list, vector or string. This is primarily useful for side-effects. From ac53084f9b8a6ae7369f1de24003575d60e40614 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Sat, 16 Dec 2017 16:40:03 +0100 Subject: [PATCH 39/40] Improve fix for Bug#29712 * test/lisp/net/tramp-tests.el (tramp-test32-environment-variables-and-port-numbers): Adapt check for systems which do not support "echo -n". (Bug#29712) --- test/lisp/net/tramp-tests.el | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index c1577008d31..d4f568feddd 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -3637,8 +3637,6 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." (ert-deftest tramp-test32-environment-variables-and-port-numbers () "Check that two connections with separate ports are different." (skip-unless (tramp--test-enabled)) - ;; Bug#29712. - (skip-unless (not (eq system-type 'darwin))) ;; 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) @@ -3663,7 +3661,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." (format "%s=%d" envvar port) tramp-remote-process-environment))) (should - (string-equal + (string-match (number-to-string port) (shell-command-to-string (format "echo -n $%s" envvar)))))) From 28e0261890e6335cb49cc03c47c206ce9c022448 Mon Sep 17 00:00:00 2001 From: Alan Mackenzie Date: Sat, 16 Dec 2017 16:01:49 +0000 Subject: [PATCH 40/40] * lisp/progmodes/cc-defs.el (c-version): Update to 5.33.1. --- lisp/progmodes/cc-defs.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/progmodes/cc-defs.el b/lisp/progmodes/cc-defs.el index bff1c9eb65d..973d97c2560 100644 --- a/lisp/progmodes/cc-defs.el +++ b/lisp/progmodes/cc-defs.el @@ -87,7 +87,7 @@ ;;; Variables also used at compile time. -(defconst c-version "5.33" +(defconst c-version "5.33.1" "CC Mode version number.") (defconst c-version-sym (intern c-version))