From b07e3b1d97e73c5cf0cd60edf4838b555530bbf0 Mon Sep 17 00:00:00 2001 From: "Basil L. Contovounesios" Date: Thu, 28 May 2020 00:53:42 +0100 Subject: [PATCH 01/13] Improve format-spec documentation (bug#41571) * doc/lispref/text.texi (Interpolated Strings): Move from here... * doc/lispref/strings.texi (Custom Format Strings): ...to here, renaming the node and clarifying the documentation. (Formatting Strings): End node with sentence referring to the next one. * lisp/format-spec.el (format-spec): Clarify docstring. --- doc/lispref/strings.texi | 176 +++++++++++++++++++++++++++++++++++++++ doc/lispref/text.texi | 64 -------------- lisp/format-spec.el | 49 ++++++----- 3 files changed, 206 insertions(+), 83 deletions(-) diff --git a/doc/lispref/strings.texi b/doc/lispref/strings.texi index 70c3b3cf4be..4a7bda57c4e 100644 --- a/doc/lispref/strings.texi +++ b/doc/lispref/strings.texi @@ -28,6 +28,7 @@ keyboard character events. * Text Comparison:: Comparing characters or strings. * String Conversion:: Converting to and from characters and strings. * Formatting Strings:: @code{format}: Emacs's analogue of @code{printf}. +* Custom Format Strings:: Formatting custom @code{format} specifications. * Case Conversion:: Case conversion functions. * Case Tables:: Customizing case conversion. @end menu @@ -1122,6 +1123,181 @@ may be problematic; for example, @samp{%d} and @samp{%g} can mishandle NaNs and can lose precision and type, and @samp{#x%x} and @samp{#o%o} can mishandle negative integers. @xref{Input Functions}. +The functions described in this section accept a fixed set of +specification characters. The next section describes a function +@code{format-spec} which can accept custom specification characters, +such as @samp{%a} or @samp{%z}. + +@node Custom Format Strings +@section Custom Format Strings +@cindex custom format string +@cindex custom @samp{%}-sequence in format + +Sometimes it is useful to allow users and Lisp programs alike to +control how certain text is generated via custom format control +strings. For example, a format string could control how to display +someone's forename, surname, and email address. Using the function +@code{format} described in the previous section, the format string +could be something like @w{@code{"%s %s <%s>"}}. This approach +quickly becomes impractical, however, as it can be unclear which +specification character corresponds to which piece of information. + +A more convenient format string for such cases would be something like +@w{@code{"%f %l <%e>"}}, where each specification character carries +more semantic information and can easily be rearranged relative to +other specification characters, making such format strings more easily +customizable by the user. + +The function @code{format-spec} described in this section performs a +similar function to @code{format}, except it operates on format +control strings that use arbitrary specification characters. + +@defun format-spec template spec-alist &optional only-present +This function returns a string produced from the format string +@var{template} according to conversions specified in @var{spec-alist}, +which is an alist (@pxref{Association Lists}) of the form +@w{@code{(@var{letter} . @var{replacement})}}. Each specification +@code{%@var{letter}} in @var{template} will be replaced by +@var{replacement} when formatting the resulting string. + +The characters in @var{template}, other than the format +specifications, are copied directly into the output, including their +text properties, if any. Any text properties of the format +specifications are copied to their replacements. + +Using an alist to specify conversions gives rise to some useful +properties: + +@itemize @bullet +@item +If @var{spec-alist} contains more unique @var{letter} keys than there +are unique specification characters in @var{template}, the unused keys +are simply ignored. +@item +If @var{spec-alist} contains more than one association with the same +@var{letter}, the closest one to the start of the list is used. +@item +If @var{template} contains the same specification character more than +once, then the same @var{replacement} found in @var{spec-alist} is +used as a basis for all of that character's substitutions. +@item +The order of specifications in @var{template} need not correspond to +the order of associations in @var{spec-alist}. +@end itemize + +The optional argument @var{only-present} indicates how to handle +specification characters in @var{template} that are not found in +@var{spec-alist}. If it is @code{nil} or omitted, the function +signals an error. Otherwise, those format specifications and any +occurrences of @samp{%%} in @var{template} are left verbatim in the +output, including their text properties, if any. +@end defun + +The syntax of format specifications accepted by @code{format-spec} is +similar, but not identical, to that accepted by @code{format}. In +both cases, a format specification is a sequence of characters +beginning with @samp{%} and ending with an alphabetic letter such as +@samp{s}. + +Unlike @code{format}, which assigns specific meanings to a fixed set +of specification characters, @code{format-spec} accepts arbitrary +specification characters and treats them all equally. For example: + +@example +@group +(setq my-site-info + (list (cons ?s system-name) + (cons ?t (symbol-name system-type)) + (cons ?c system-configuration) + (cons ?v emacs-version) + (cons ?e invocation-name) + (cons ?p (number-to-string (emacs-pid))) + (cons ?a user-mail-address) + (cons ?n user-full-name))) + +(format-spec "%e %v (%c)" my-site-info) + @result{} "emacs 27.1 (x86_64-pc-linux-gnu)" + +(format-spec "%n <%a>" my-site-info) + @result{} "Emacs Developers " +@end group +@end example + +A format specification can include any number of the following flag +characters immediately after the @samp{%} to modify aspects of the +substitution. + +@table @samp +@item 0 +This flag causes any padding specified by the width to consist of +@samp{0} characters instead of spaces. + +@item - +This flag causes any padding specified by the width to be inserted on +the right rather than the left. + +@item < +This flag causes the substitution to be truncated on the left to the +given width, if specified. + +@item > +This flag causes the substitution to be truncated on the right to the +given width, if specified. + +@item ^ +This flag converts the substituted text to upper case (@pxref{Case +Conversion}). + +@item _ +This flag converts the substituted text to lower case (@pxref{Case +Conversion}). +@end table + +The result of using contradictory flags (for instance, both upper and +lower case) is undefined. + +As is the case with @code{format}, a format specification can include +a width, which is a decimal number that appears after any flags. If a +substitution contains fewer characters than its specified width, it is +padded on the left: + +@example +@group +(format-spec "%8a is padded on the left with spaces" + '((?a . "alpha"))) + @result{} " alpha is padded on the left with spaces" +@end group +@end example + +Here is a more complicated example that combines several +aforementioned features: + +@example +@group +(setq my-battery-info + (list (cons ?p "73") ; Percentage + (cons ?L "Battery") ; Status + (cons ?t "2:23") ; Remaining time + (cons ?c "24330") ; Capacity + (cons ?r "10.6"))) ; Rate of discharge + +(format-spec "%>^-3L : %3p%% (%05t left)" my-battery-info) + @result{} "BAT : 73% (02:23 left)" + +(format-spec "%>^-3L : %3p%% (%05t left)" + (cons (cons ?L "AC") + my-battery-info)) + @result{} "AC : 73% (02:23 left)" +@end group +@end example + +As the examples in this section illustrate, @code{format-spec} is +often used for selectively formatting an assortment of different +pieces of information. This is useful in programs that provide +user-customizable format strings, as the user can choose to format +with a regular syntax and in any desired order only a subset of the +information that the program makes available. + @node Case Conversion @section Case Conversion in Lisp @cindex upper case diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi index de436fa9e61..a14867e1d1a 100644 --- a/doc/lispref/text.texi +++ b/doc/lispref/text.texi @@ -58,7 +58,6 @@ the character after point. of another buffer. * Decompression:: Dealing with compressed data. * Base 64:: Conversion to or from base 64 encoding. -* Interpolated Strings:: Formatting Customizable Strings. * Checksum/Hash:: Computing cryptographic hashes. * GnuTLS Cryptography:: Cryptographic algorithms imported from GnuTLS. * Parsing HTML/XML:: Parsing HTML and XML. @@ -4662,69 +4661,6 @@ If optional argument @var{base64url} is non-@code{nil}, then padding is optional, and the URL variant of base 64 encoding is used. @end defun - -@node Interpolated Strings -@section Formatting Customizable Strings - -It is, in some circumstances, useful to present users with a string to -be customized that can then be expanded programmatically. For -instance, @code{erc-header-line-format} is @code{"%n on %t (%m,%l) -%o"}, and each of those characters after the percent signs are -expanded when the header line is computed. To do this, the -@code{format-spec} function is used: - -@defun format-spec format specification &optional only-present -@var{format} is the format specification string as in the example -above. @var{specification} is an alist that has elements where the -@code{car} is a character and the @code{cdr} is the substitution. - -If @var{only-present} is @code{nil}, errors will be signaled if a -format character has been used that's not present in -@var{specification}. If it's non-@code{nil}, that format -specification is left verbatim in the result. -@end defun - -Here's a trivial example: - -@example -(format-spec "su - %u %l" - `((?u . ,(user-login-name)) - (?l . "ls"))) - @result{} "su - foo ls" -@end example - -In addition to allowing padding/limiting to a certain length, the -following modifiers can be used: - -@table @asis -@item @samp{0} -Pad with zeros instead of the default spaces. - -@item @samp{-} -Pad to the right. - -@item @samp{^} -Use upper case. - -@item @samp{_} -Use lower case. - -@item @samp{<} -If the length needs to be limited, remove characters from the left. - -@item @samp{>} -Same as previous, but remove characters from the right. -@end table - -If contradictory modifiers are used (for instance, both upper and -lower case), then what happens is undefined. - -As an example, @samp{"%<010b"} means ``insert the @samp{b} expansion, -but pad with leading zeros if it's less than ten characters, and if -it's more than ten characters, shorten by removing characters from the -left.'' - - @node Checksum/Hash @section Checksum/Hash @cindex MD5 checksum diff --git a/lisp/format-spec.el b/lisp/format-spec.el index f418cea4259..9278bd74c42 100644 --- a/lisp/format-spec.el +++ b/lisp/format-spec.el @@ -29,35 +29,46 @@ (defun format-spec (format specification &optional only-present) "Return a string based on FORMAT and SPECIFICATION. -FORMAT is a string containing `format'-like specs like \"su - %u %k\", -while SPECIFICATION is an alist mapping from format spec characters -to values. +FORMAT is a string containing `format'-like specs like \"su - %u %k\". +SPECIFICATION is an alist mapping format specification characters +to their substitutions. For instance: (format-spec \"su - %u %l\" - `((?u . ,(user-login-name)) + \\=`((?u . ,(user-login-name)) (?l . \"ls\"))) -Each format spec can have modifiers, where \"%<010b\" means \"if -the expansion is shorter than ten characters, zero-pad it, and if -it's longer, chop off characters from the left side\". +Each %-spec may contain optional flag and width modifiers, as +follows: -The following modifiers are allowed: + %character -* 0: Use zero-padding. -* -: Pad to the right. -* ^: Upper-case the expansion. -* _: Lower-case the expansion. -* <: Limit the length by removing chars from the left. -* >: Limit the length by removing chars from the right. +The following flags are allowed: -Any text properties on a %-spec itself are propagated to the text -that it generates. +* 0: Pad to the width, if given, with zeros instead of spaces. +* -: Pad to the width, if given, on the right instead of the left. +* <: Truncate to the width, if given, on the left. +* >: Truncate to the width, if given, on the right. +* ^: Convert to upper case. +* _: Convert to lower case. -If ONLY-PRESENT, format spec characters not present in -SPECIFICATION are ignored, and the \"%\" characters are left -where they are, including \"%%\" strings." +The width modifier behaves like the corresponding one in `format' +when applied to %s. + +For example, \"%<010b\" means \"substitute into the output the +value associated with ?b in SPECIFICATION, either padding it with +leading zeros or truncating leading characters until it's ten +characters wide\". + +Any text properties of FORMAT are copied to the result, with any +text properties of a %-spec itself copied to its substitution. + +ONLY-PRESENT indicates how to handle %-spec characters not +present in SPECIFICATION. If it is nil or omitted, emit an +error; otherwise leave those %-specs and any occurrences of +\"%%\" in FORMAT verbatim in the result, including their text +properties, if any." (with-temp-buffer (insert format) (goto-char (point-min)) From cf473e742fdd0cce75f8e43a62307612b929461d Mon Sep 17 00:00:00 2001 From: "Basil L. Contovounesios" Date: Tue, 2 Jun 2020 21:05:28 +0100 Subject: [PATCH 02/13] * test/lisp/battery-tests.el: New file. --- test/lisp/battery-tests.el | 58 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 test/lisp/battery-tests.el diff --git a/test/lisp/battery-tests.el b/test/lisp/battery-tests.el new file mode 100644 index 00000000000..052ae49a800 --- /dev/null +++ b/test/lisp/battery-tests.el @@ -0,0 +1,58 @@ +;;; battery-tests.el --- tests for battery.el -*- lexical-binding: t -*- + +;; Copyright (C) 2020 Free Software Foundation, Inc. + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Code: + +(require 'battery) + +(ert-deftest battery-linux-proc-apm-regexp () + "Test `battery-linux-proc-apm-regexp'." + (let ((str "1.16 1.2 0x07 0x01 0xff 0x80 -1% -1 ?")) + (should (string-match battery-linux-proc-apm-regexp str)) + (should (equal (match-string 0 str) str)) + (should (equal (match-string 1 str) "1.16")) + (should (equal (match-string 2 str) "1.2")) + (should (equal (match-string 3 str) "07")) + (should (equal (match-string 4 str) "01")) + (should (equal (match-string 5 str) "ff")) + (should (equal (match-string 6 str) "80")) + (should (equal (match-string 7 str) "-1")) + (should (equal (match-string 8 str) "-1")) + (should (equal (match-string 9 str) "?"))) + (let ((str "1.16 1.2 0x03 0x00 0x00 0x01 99% 1792 min")) + (should (string-match battery-linux-proc-apm-regexp str)) + (should (equal (match-string 0 str) str)) + (should (equal (match-string 1 str) "1.16")) + (should (equal (match-string 2 str) "1.2")) + (should (equal (match-string 3 str) "03")) + (should (equal (match-string 4 str) "00")) + (should (equal (match-string 5 str) "00")) + (should (equal (match-string 6 str) "01")) + (should (equal (match-string 7 str) "99")) + (should (equal (match-string 8 str) "1792")) + (should (equal (match-string 9 str) "min")))) + +(ert-deftest battery-format () + "Test `battery-format'." + (should (equal (battery-format "" ()) "")) + (should (equal (battery-format "" '((?b . "-"))) "")) + (should (equal (battery-format "%a%b%p%%" '((?b . "-") (?p . "99"))) + "-99%"))) + +;;; battery-tests.el ends here From 7d323f07c0b540547c4aab38069972a918eff9d3 Mon Sep 17 00:00:00 2001 From: "Basil L. Contovounesios" Date: Tue, 2 Jun 2020 23:14:23 +0100 Subject: [PATCH 03/13] Silence some byte-compiler warnings in tests * test/lisp/emacs-lisp/cl-generic-tests.el: * test/lisp/progmodes/elisp-mode-tests.el: Declare functions referred to within macroexpansions. (xref-elisp-overloadable-no-default) (xref-elisp-overloadable-co-located-default) (xref-elisp-overloadable-separate-default): Prefix unused arguments with underscore. * test/lisp/international/ccl-tests.el: * test/lisp/wdired-tests.el: * test/lisp/emacs-lisp/package-tests.el: Declare functions used. (package-test-update-archives, package-test-signed): Use revert-buffer in place of its obsolete alias package-menu-refresh. * test/lisp/eshell/eshell-tests.el: * test/lisp/mail/footnote-tests.el: * test/src/buffer-tests.el: Require dependencies used. * test/lisp/image/exif-tests.el: Remove unneeded (require 'seq). (test-exit-direct-ascii-value): Actually perform the test. * test/lisp/progmodes/sql-tests.el (sql-test-add-existing-product): Fix typo. * test/lisp/simple-tests.el (with-shell-command-dont-erase-buffer): * test/src/data-tests.el (test-bool-vector-bv-from-hex-string) (test-bool-vector-apply-mock-op): Remove unused local variables. --- test/lisp/emacs-lisp/cl-generic-tests.el | 8 +++++++- test/lisp/emacs-lisp/package-tests.el | 13 +++++++++---- test/lisp/eshell/eshell-tests.el | 1 + test/lisp/image/exif-tests.el | 5 ++--- test/lisp/international/ccl-tests.el | 3 +++ test/lisp/mail/footnote-tests.el | 6 ++---- test/lisp/progmodes/elisp-mode-tests.el | 11 ++++++----- test/lisp/progmodes/sql-tests.el | 2 +- test/lisp/simple-tests.el | 3 +-- test/lisp/wdired-tests.el | 2 ++ test/src/buffer-tests.el | 1 + test/src/data-tests.el | 6 +++--- 12 files changed, 38 insertions(+), 23 deletions(-) diff --git a/test/lisp/emacs-lisp/cl-generic-tests.el b/test/lisp/emacs-lisp/cl-generic-tests.el index d9f1cb9ec43..51c9884ddc8 100644 --- a/test/lisp/emacs-lisp/cl-generic-tests.el +++ b/test/lisp/emacs-lisp/cl-generic-tests.el @@ -23,9 +23,15 @@ ;;; Code: -(eval-when-compile (require 'ert)) ;Don't indirectly require cl-lib at run-time. (require 'cl-generic) +;; Don't indirectly require `cl-lib' at run-time. +(eval-when-compile (require 'ert)) +(declare-function ert--should-signal-hook "ert") +(declare-function ert--signal-should-execution "ert") +(declare-function ert-fail "ert") +(declare-function ert-set-test "ert") + (fmakunbound 'cl--generic-1) (cl-defgeneric cl--generic-1 (x y)) (cl-defgeneric (setf cl--generic-1) (v y z) "My generic doc.") diff --git a/test/lisp/emacs-lisp/package-tests.el b/test/lisp/emacs-lisp/package-tests.el index 7d354d6ecde..4fcaf0e84c2 100644 --- a/test/lisp/emacs-lisp/package-tests.el +++ b/test/lisp/emacs-lisp/package-tests.el @@ -267,6 +267,9 @@ Must called from within a `tar-mode' buffer." (should (package-installed-p 'simple-single)) (should (package-installed-p 'simple-depend)))) +(declare-function macro-problem-func "macro-problem" ()) +(declare-function macro-problem-10-and-90 "macro-problem" ()) + (ert-deftest package-test-macro-compilation () "Install a package which includes a dependency." (with-package-test (:basedir "package-resources") @@ -391,7 +394,7 @@ Must called from within a `tar-mode' buffer." "Test updating package archives." (with-package-test () (let ((buf (package-list-packages))) - (package-menu-refresh) + (revert-buffer) (search-forward-regexp "^ +simple-single") (package-menu-mark-install) (package-menu-execute) @@ -399,7 +402,7 @@ Must called from within a `tar-mode' buffer." (let ((package-test-data-dir (expand-file-name "package-resources/newer-versions" package-test-file-dir))) (setq package-archives `(("gnu" . ,package-test-data-dir))) - (package-menu-refresh) + (revert-buffer) ;; New version should be available and old version should be installed (goto-char (point-min)) @@ -411,7 +414,7 @@ Must called from within a `tar-mode' buffer." (package-menu-mark-upgrades) (package-menu-execute) - (package-menu-refresh) + (revert-buffer) (should (package-installed-p 'simple-single '(1 4))))))) (ert-deftest package-test-update-archives-async () @@ -541,6 +544,8 @@ Must called from within a `tar-mode' buffer." (let ((process-environment (cons (concat "HOME=" homedir) process-environment))) + (require 'epg-config) + (defvar epg-config--program-alist) (epg-find-configuration 'OpenPGP nil ;; By default we require gpg2 2.1+ due to some @@ -573,7 +578,7 @@ Must called from within a `tar-mode' buffer." (should (progn (package-install 'signed-bad) 'noerror))) ;; Check if the installed package status is updated. (let ((buf (package-list-packages))) - (package-menu-refresh) + (revert-buffer) (should (re-search-forward "^\\s-+signed-good\\s-+\\(\\S-+\\)\\s-+\\(\\S-+\\)\\s-" nil t)) diff --git a/test/lisp/eshell/eshell-tests.el b/test/lisp/eshell/eshell-tests.el index 026818ab067..70694309443 100644 --- a/test/lisp/eshell/eshell-tests.el +++ b/test/lisp/eshell/eshell-tests.el @@ -26,6 +26,7 @@ ;;; Code: (require 'ert) +(require 'esh-mode) (require 'eshell) (defmacro with-temp-eshell (&rest body) diff --git a/test/lisp/image/exif-tests.el b/test/lisp/image/exif-tests.el index 8a2231106f0..9e5da46b508 100644 --- a/test/lisp/image/exif-tests.el +++ b/test/lisp/image/exif-tests.el @@ -21,7 +21,6 @@ (require 'ert) (require 'exif) -(require 'seq) (defun test-image-file (name) (expand-file-name @@ -49,7 +48,7 @@ (should (equal (exif-elem exif 'artist) "z")))) (ert-deftest test-exit-direct-ascii-value () - (equal (exif--direct-ascii-value 28005 2 t) (string ?e ?m 0)) - (equal (exif--direct-ascii-value 28005 2 nil) (string ?m ?e 0))) + (should (equal (exif--direct-ascii-value 28005 2 t) (string ?e ?m 0))) + (should (equal (exif--direct-ascii-value 28005 2 nil) (string ?m ?e 0)))) ;;; exif-tests.el ends here diff --git a/test/lisp/international/ccl-tests.el b/test/lisp/international/ccl-tests.el index 3581cd784f0..c8a5512d6f0 100644 --- a/test/lisp/international/ccl-tests.el +++ b/test/lisp/international/ccl-tests.el @@ -94,6 +94,9 @@ At EOF: (ccl-dump prog-pgg-code) (should (equal (buffer-string) prog-pgg-dump)))) +(defvar pgg-parse-crc24) +(declare-function pgg-parse-crc24-string "pgg-parse" (string)) + (ert-deftest pgg-parse-crc24 () ;; Compiler (require 'pgg) diff --git a/test/lisp/mail/footnote-tests.el b/test/lisp/mail/footnote-tests.el index 458964c306e..79f48072391 100644 --- a/test/lisp/mail/footnote-tests.el +++ b/test/lisp/mail/footnote-tests.el @@ -18,12 +18,10 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program. If not, see . -;;; Commentary: - -;; - ;;; Code: +(require 'footnote) + (ert-deftest footnote-tests-same-place () (with-temp-buffer (footnote-mode 1) diff --git a/test/lisp/progmodes/elisp-mode-tests.el b/test/lisp/progmodes/elisp-mode-tests.el index b793f7389b4..2ba00656862 100644 --- a/test/lisp/progmodes/elisp-mode-tests.el +++ b/test/lisp/progmodes/elisp-mode-tests.el @@ -598,16 +598,17 @@ to (xref-elisp-test-descr-to-target xref)." ;; Define some mode-local overloadable/overridden functions for xref to find (require 'mode-local) +(declare-function xref-elisp-overloadable-no-methods-default "elisp-mode-tests") +(declare-function xref-elisp-overloadable-no-default-default "elisp-mode-tests") + (define-overloadable-function xref-elisp-overloadable-no-methods () "doc string overloadable no-methods") (define-overloadable-function xref-elisp-overloadable-no-default () "doc string overloadable no-default") -;; FIXME: byte compiler complains about unused lexical arguments -;; generated by this macro. (define-mode-local-override xref-elisp-overloadable-no-default c-mode - (start end &optional nonterminal depth returnonerror) + (_start _end &optional _nonterminal _depth _returnonerror) "doc string overloadable no-default c-mode." "result overloadable no-default c-mode.") @@ -616,7 +617,7 @@ to (xref-elisp-test-descr-to-target xref)." "result overloadable co-located-default.") (define-mode-local-override xref-elisp-overloadable-co-located-default c-mode - (start end &optional nonterminal depth returnonerror) + (_start _end &optional _nonterminal _depth _returnonerror) "doc string overloadable co-located-default c-mode." "result overloadable co-located-default c-mode.") @@ -628,7 +629,7 @@ to (xref-elisp-test-descr-to-target xref)." "result overloadable separate-default.") (define-mode-local-override xref-elisp-overloadable-separate-default c-mode - (start end &optional nonterminal depth returnonerror) + (_start _end &optional _nonterminal _depth _returnonerror) "doc string overloadable separate-default c-mode." "result overloadable separate-default c-mode.") diff --git a/test/lisp/progmodes/sql-tests.el b/test/lisp/progmodes/sql-tests.el index d6f89341bed..65ed76bfb5d 100644 --- a/test/lisp/progmodes/sql-tests.el +++ b/test/lisp/progmodes/sql-tests.el @@ -193,7 +193,7 @@ Perform ACTION and validate results" "Add a product that already exists." (sql-test-product-feature-harness - (should-error (sql-add-feature 'a "Aaa")) + (should-error (sql-add-product 'a "Aaa")) (should (equal (pp-to-string (assoc 'a sql-product-alist)) "(a :X 1 :Y 2 :Z sql-test-feature-value-a)\n")))) diff --git a/test/lisp/simple-tests.el b/test/lisp/simple-tests.el index 03f7260f551..c8b913b3f1c 100644 --- a/test/lisp/simple-tests.el +++ b/test/lisp/simple-tests.el @@ -716,8 +716,7 @@ See Bug#21722." (defmacro with-shell-command-dont-erase-buffer (str output-buffer-is-current &rest body) (declare (debug (sexp form body)) (indent 2)) - (let ((expected (make-symbol "expected")) - (command (make-symbol "command")) + (let ((command (make-symbol "command")) (caller-buf (make-symbol "caller-buf")) (output-buf (make-symbol "output-buf"))) `(let* ((,caller-buf (generate-new-buffer "caller-buf")) diff --git a/test/lisp/wdired-tests.el b/test/lisp/wdired-tests.el index baa547758ef..5b01c54cf24 100644 --- a/test/lisp/wdired-tests.el +++ b/test/lisp/wdired-tests.el @@ -129,6 +129,8 @@ wdired-mode." (delete-directory test-dir t))))) (defvar server-socket-dir) +(declare-function dired-smart-shell-command "dired-x" + (command &optional output-buffer error-buffer)) (ert-deftest wdired-test-bug34915 () "Test editing when dired-listing-switches includes -F. diff --git a/test/src/buffer-tests.el b/test/src/buffer-tests.el index 1c356698f66..60d29dd3a12 100644 --- a/test/src/buffer-tests.el +++ b/test/src/buffer-tests.el @@ -20,6 +20,7 @@ ;;; Code: (require 'ert) +(require 'seq) (eval-when-compile (require 'cl-lib)) (ert-deftest overlay-modification-hooks-message-other-buf () diff --git a/test/src/data-tests.el b/test/src/data-tests.el index 3cebb3dfa57..ed092039078 100644 --- a/test/src/data-tests.el +++ b/test/src/data-tests.el @@ -174,7 +174,7 @@ most-positive-fixnum, which is just less than a power of 2.") sum 1)) (defun test-bool-vector-bv-from-hex-string (desc) - (let (bv nchars nibbles) + (let (bv nibbles) (dolist (c (string-to-list desc)) (push (string-to-number (char-to-string c) @@ -244,9 +244,9 @@ comparing the subr with a much slower lisp implementation." (defun test-bool-vector-apply-mock-op (mock a b c) "Compute (slowly) the correct result of a bool-vector set operation." - (let (changed nv) + (let (changed) (cl-assert (eql (length b) (length c))) - (if a (setf nv a) + (unless a (setf a (make-bool-vector (length b) nil)) (setf changed t)) From 30a7ee505aca3cc285699bae1630a28185519d99 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 5 Jun 2020 10:56:01 +0300 Subject: [PATCH 04/13] Fix Arabic shaping when eww/shr fill the text to be rendered * src/hbfont.c (hbfont_shape): Don't use DIRECTION if the current buffer has bidi reordering disabled. (Bug#41005) --- src/hbfont.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/hbfont.c b/src/hbfont.c index 576c5fe7f60..4b3f64ef504 100644 --- a/src/hbfont.c +++ b/src/hbfont.c @@ -26,6 +26,7 @@ along with GNU Emacs. If not, see . */ #include "composite.h" #include "font.h" #include "dispextern.h" +#include "buffer.h" #ifdef HAVE_NTGUI @@ -438,7 +439,11 @@ hbfont_shape (Lisp_Object lgstring, Lisp_Object direction) /* If the caller didn't provide a meaningful DIRECTION, let HarfBuzz guess it. */ - if (!NILP (direction)) + if (!NILP (direction) + /* If they bind bidi-display-reordering to nil, the DIRECTION + they provide is meaningless, and we should let HarfBuzz guess + the real direction. */ + && !NILP (BVAR (current_buffer, bidi_display_reordering))) { hb_direction_t dir = HB_DIRECTION_LTR; if (EQ (direction, QL2R)) From 73749efa131dea3ac39f46d08f1ed98bf04830af Mon Sep 17 00:00:00 2001 From: Andrii Kolomoiets Date: Wed, 3 Jun 2020 14:14:57 +0300 Subject: [PATCH 05/13] Update Ukrainian transliteration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * lisp/language/cyril-util.el (standard-display-cyrillic-translit): Add missing letter "ґ"; tweak letter "г". (Bug#41683) --- lisp/language/cyril-util.el | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lisp/language/cyril-util.el b/lisp/language/cyril-util.el index e7a12675905..a3a6f3fdd94 100644 --- a/lisp/language/cyril-util.el +++ b/lisp/language/cyril-util.el @@ -152,6 +152,7 @@ If the argument is nil, we return the display table to its standard state." (aset standard-display-table ?љ [?l ?j]) (aset standard-display-table ?њ [?n ?j]) (aset standard-display-table ?џ [?d ?z]) + (aset standard-display-table ?ґ [?g]) (aset standard-display-table ?Є [?Y ?e]) (aset standard-display-table ?Ї [?Y ?i]) @@ -166,6 +167,7 @@ If the argument is nil, we return the display table to its standard state." (aset standard-display-table ?Љ [?L ?j]) (aset standard-display-table ?Њ [?N ?j]) (aset standard-display-table ?Џ [?D ?j]) + (aset standard-display-table ?Ґ [?G]) (when (equal cyrillic-language "Bulgarian") (aset standard-display-table ?щ [?s ?h ?t]) @@ -182,7 +184,9 @@ If the argument is nil, we return the display table to its standard state." (aset standard-display-table ?й [?i]) (aset standard-display-table ?Й [?Y]) (aset standard-display-table ?ю [?i ?u]) - (aset standard-display-table ?я [?i ?a])))) + (aset standard-display-table ?я [?i ?a]) + (aset standard-display-table ?г [?h]) + (aset standard-display-table ?Г [?H])))) ;; (provide 'cyril-util) From bf09106256f9212d3162a4335c18fd2ef876066d Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 5 Jun 2020 11:30:03 +0300 Subject: [PATCH 06/13] Improve documentation of 'sort-subr' * doc/lispref/text.texi (Sorting): Clarify the meaning and use of PREDICATE argument to 'sort-subr'. (Bug#41706) --- doc/lispref/text.texi | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi index a14867e1d1a..0bbb0aa8dc0 100644 --- a/doc/lispref/text.texi +++ b/doc/lispref/text.texi @@ -2028,8 +2028,15 @@ non-@code{nil} value. @end enumerate The argument @var{predicate} is the function to use to compare keys. -If keys are numbers, it defaults to @code{<}; otherwise it defaults to -@code{string<}. +It is called with two arguments, the keys to compare, and should +return non-@code{nil} if the first key should come before the second +in the sorting order. What exactly are the key arguments depends on +what @var{startkeyfun} and @var{endkeyfun} return. If @var{predicate} +is omitted or @code{nil}, it defaults to @code{<} if the keys are +numbers, to @code{compare-buffer-substrings} if the keys are cons +cells (whose @code{car} and @code{cdr} are start and end buffer +positions of the key), and to @code{string<} otherwise (with keys +assumed to be strings). As an example of @code{sort-subr}, here is the complete function definition for @code{sort-lines}: From cc35b197c7720e0687c6a994df9a4cf767298712 Mon Sep 17 00:00:00 2001 From: "Basil L. Contovounesios" Date: Fri, 5 Jun 2020 14:02:41 +0100 Subject: [PATCH 07/13] Update package-menu-quick-help * lisp/emacs-lisp/package.el (package--quick-help-keys): Filtering is now bound to the prefix '/', not the key 'f' (bug#41721). Advertise only the standard 'g' binding now that both it and 'r' are bound to revert-buffer (bug#35504). (package--prettify-quick-help-key): Avoid modifying string literals. (package-menu-filter): Reintroduce as obsolete alias of package-menu-filter-by-keyword for backward compatibility (bug#36981). --- lisp/emacs-lisp/package.el | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 7af40247f30..7d6be3cf4e2 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -3279,7 +3279,7 @@ If optional arg BUTTON is non-nil, describe its associated package." '(("install," "delete," "unmark," ("execute" . 1)) ("next," "previous") ("Hide-package," "(-toggle-hidden") - ("refresh-contents," "g-redisplay," "filter," "help"))) + ("g-refresh-contents," "/-filter," "help"))) (defun package--prettify-quick-help-key (desc) "Prettify DESC to be displayed as a help menu." @@ -3287,7 +3287,7 @@ If optional arg BUTTON is non-nil, describe its associated package." (if (listp (cdr desc)) (mapconcat #'package--prettify-quick-help-key desc " ") (let ((place (cdr desc)) - (out (car desc))) + (out (copy-sequence (car desc)))) (add-text-properties place (1+ place) '(face (bold font-lock-warning-face)) out) @@ -3719,6 +3719,9 @@ Statuses available include \"incompat\", \"available\", (list keyword) keyword))) +(define-obsolete-function-alias + 'package-menu-filter #'package-menu-filter-by-keyword "27.1") + (defun package-menu-filter-by-name (name) "Filter the \"*Packages*\" buffer by NAME. Show only those items whose name matches the regular expression From 3916e63f9e98269930c4935dd5b3b88c4d940a62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20T=C3=A1vora?= Date: Fri, 5 Jun 2020 23:36:55 +0100 Subject: [PATCH 08/13] Have Fido mode also imitate Ido mode in ignore-case options Suggested by Sean Whitton . * lisp/icomplete.el (icomplete--fido-mode-setup): Set ignore-case options. --- lisp/icomplete.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lisp/icomplete.el b/lisp/icomplete.el index c12f3901f09..60ef0247bae 100644 --- a/lisp/icomplete.el +++ b/lisp/icomplete.el @@ -330,7 +330,10 @@ if that doesn't produce a completion match." icomplete-hide-common-prefix nil completion-styles '(flex) completion-flex-nospace nil - completion-category-defaults nil))) + completion-category-defaults nil + completion-ignore-case t + read-buffer-completion-ignore-case t + read-file-name-completion-ignore-case t))) ;;;###autoload (define-minor-mode fido-mode From d8593fd19ffdb1fa62f0b0c4b971cfdb325fbe1d Mon Sep 17 00:00:00 2001 From: "Basil L. Contovounesios" Date: Wed, 3 Jun 2020 17:31:44 +0100 Subject: [PATCH 09/13] Minor improvements to EDE and EIEIO manuals For discussion, see the following threads: https://lists.gnu.org/archive/html/emacs-devel/2020-05/msg00630.html https://lists.gnu.org/archive/html/emacs-devel/2020-06/msg00099.html * doc/misc/ede.texi (ede-generic-project): Clean up example. * doc/misc/eieio.texi (Accessing Slots): Document slot-value as a generalized variable and set-slot-value as obsolete. (Predicates): Fix typo. (Introspection): Document eieio-class-slots in place of the obsolete object-slots. --- doc/misc/ede.texi | 10 ++++------ doc/misc/eieio.texi | 17 ++++++++++++----- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/doc/misc/ede.texi b/doc/misc/ede.texi index 584b0d7ee50..412176986cc 100644 --- a/doc/misc/ede.texi +++ b/doc/misc/ede.texi @@ -955,18 +955,16 @@ The example for Makefiles looks like this: ;;; MAKEFILE (defclass ede-generic-makefile-project (ede-generic-project) - ((buildfile :initform "Makefile") - ) + ((buildfile :initform "Makefile")) "Generic Project for makefiles.") (defmethod ede-generic-setup-configuration ((proj ede-generic-makefile-project) config) - "Setup a configuration for Make." + "Set up a configuration for Make." (oset config build-command "make -k") - (oset config debug-command "gdb ") - ) + (oset config debug-command "gdb ")) (ede-generic-new-autoloader "generic-makefile" "Make" - "Makefile" 'ede-generic-makefile-project) + "Makefile" 'ede-generic-makefile-project) @end example This example project will detect any directory with the file diff --git a/doc/misc/eieio.texi b/doc/misc/eieio.texi index 3943c544c7d..aceaff051e3 100644 --- a/doc/misc/eieio.texi +++ b/doc/misc/eieio.texi @@ -734,14 +734,21 @@ slot values, and use the previously mentioned set/ref routines. @anchor{slot-value} This function retrieves the value of @var{slot} from @var{object}. Unlike @code{oref}, the symbol for @var{slot} must be quoted. + +This is a generalized variable that can be used with @code{setf} to +modify the value stored in @var{slot}. @xref{Generalized +Variables,,,elisp,GNU Emacs Lisp Reference Manual}. @end defun @defun set-slot-value object slot value @anchor{set-slot-value} -This is not a CLOS function, but is the setter for @code{slot-value} -used by the @code{setf} macro. This -function sets the value of @var{slot} from @var{object}. Unlike +This function sets the value of @var{slot} from @var{object}. Unlike @code{oset}, the symbol for @var{slot} must be quoted. + +This is not a CLOS function, but is the obsolete setter for +@code{slot-value} used by the @code{setf} macro. It is therefore +recommended to use @w{@code{(setf (slot-value @var{object} @var{slot}) +@var{value})}} instead. @end defun @defun slot-makeunbound object slot @@ -1062,7 +1069,7 @@ Return a string of the form @samp{#} for @var{obj}. This should look like Lisp symbols from other parts of Emacs such as buffers and processes, and is shorter and cleaner than printing the object's record. It is more useful to use @code{object-print} to get -and object's print form, as this allows the object to add extra display +an object's print form, as this allows the object to add extra display information into the symbol. @end defun @@ -1217,7 +1224,7 @@ objects on top of records, and thus everything is technically visible, some functions have been provided. None of these functions are a part of CLOS. -@defun object-slots obj +@defun eieio-class-slots obj Return the list of public slots for @var{obj}. @end defun From fbd49f969eac74a3f34d5505618280ee61be25b7 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 6 Jun 2020 19:53:08 +0300 Subject: [PATCH 10/13] * src/xdisp.c (Fwindow_text_pixel_size): Doc fix. (Bug#41737) --- src/xdisp.c | 56 +++++++++++++++++++++++++++++++---------------------- 1 file changed, 33 insertions(+), 23 deletions(-) diff --git a/src/xdisp.c b/src/xdisp.c index 684b4679d81..a280b48de99 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -10401,33 +10401,43 @@ in_display_vector_p (struct it *it) DEFUN ("window-text-pixel-size", Fwindow_text_pixel_size, Swindow_text_pixel_size, 0, 6, 0, doc: /* Return the size of the text of WINDOW's buffer in pixels. WINDOW must be a live window and defaults to the selected one. The -return value is a cons of the maximum pixel-width of any text line and -the maximum pixel-height of all text lines. +return value is a cons of the maximum pixel-width of any text line +and the pixel-height of all the text lines in the accessible portion +of buffer text. + +This function exists to allow Lisp programs to adjust the dimensions +of WINDOW to the buffer text it needs to display. The optional argument FROM, if non-nil, specifies the first text -position and defaults to the minimum accessible position of the buffer. -If FROM is t, use the minimum accessible position that starts a -non-empty line. TO, if non-nil, specifies the last text position and -defaults to the maximum accessible position of the buffer. If TO is t, -use the maximum accessible position that ends a non-empty line. +position to consider, and defaults to the minimum accessible position +of the buffer. If FROM is t, it stands for the minimum accessible +position that starts a non-empty line. TO, if non-nil, specifies the +last text position and defaults to the maximum accessible position of +the buffer. If TO is t, it stands for the maximum accessible position +that ends a non-empty line. -The optional argument X-LIMIT, if non-nil, specifies the maximum text -width that can be returned. X-LIMIT nil or omitted, means to use the -pixel-width of WINDOW's body; use this if you want to know how high -WINDOW should be become in order to fit all of its buffer's text with -the width of WINDOW unaltered. Use the maximum width WINDOW may assume -if you intend to change WINDOW's width. In any case, text whose -x-coordinate is beyond X-LIMIT is ignored. Since calculating the width -of long lines can take some time, it's always a good idea to make this -argument as small as possible; in particular, if the buffer contains -long lines that shall be truncated anyway. +The optional argument X-LIMIT, if non-nil, specifies the maximum X +coordinate beyond which the text should be ignored. It is therefore +also the maximum width that the function can return. X-LIMIT nil or +omitted means to use the pixel-width of WINDOW's body. This default +means text of truncated lines wider than the window will be ignored; +specify a large value for X-LIMIT if lines are truncated and you need +to account for the truncated text. Use nil for X-LIMIT if you want to +know how high WINDOW should become in order to fit all of its buffer's +text with the width of WINDOW unaltered. Use the maximum width WINDOW +may assume if you intend to change WINDOW's width. Since calculating +the width of long lines can take some time, it's always a good idea to +make this argument as small as possible; in particular, if the buffer +contains long lines that shall be truncated anyway. -The optional argument Y-LIMIT, if non-nil, specifies the maximum text -height (excluding the height of the mode- or header-line, if any) that -can be returned. Text lines whose y-coordinate is beyond Y-LIMIT are -ignored. Since calculating the text height of a large buffer can take -some time, it makes sense to specify this argument if the size of the -buffer is large or unknown. +The optional argument Y-LIMIT, if non-nil, specifies the maximum Y +coordinate beyond which the text is to be ignored; it is therefore +also the maxcomp height that the function can return (excluding the +height of the mode- or header-line, if any). Y-LIMIT nil or omitted +means consider all of the accessible portion of buffer text up to the +position specified by TO. Since calculating the text height of a +large buffer can take some time, it makes sense to specify this +argument if the size of the buffer is large or unknown. Optional argument MODE-AND-HEADER-LINE nil or omitted means do not include the height of the mode- or header-line of WINDOW in the return From dd366b5d3bc528b0e3520516f67baa523ffae956 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 6 Jun 2020 20:10:37 +0300 Subject: [PATCH 11/13] Improve documentation of 'window-text-pixel-size' * doc/lispref/display.texi (Size of Displayed Text): Clarify the description of 'window-text-pixel-size'. --- doc/lispref/display.texi | 53 +++++++++++++++++++++++----------------- 1 file changed, 31 insertions(+), 22 deletions(-) diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index 588e2217b9b..707a1a8dc04 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi @@ -2023,36 +2023,45 @@ it contains. @defun window-text-pixel-size &optional window from to x-limit y-limit mode-and-header-line This function returns the size of the text of @var{window}'s buffer in -pixels. @var{window} must be a live window and defaults to the selected -one. The return value is a cons of the maximum pixel-width of any text -line and the maximum pixel-height of all text lines. +pixels. @var{window} must be a live window and defaults to the +selected one. The return value is a cons of the maximum pixel-width +of any text line and the maximum pixel-height of all text lines. This +function exists to allow Lisp programs to adjust the dimensions of +@var{window} to the buffer text it needs to display. -The optional argument @var{from}, if non-@code{nil}, specifies the first -text position to consider and defaults to the minimum accessible -position of the buffer. If @var{from} is @code{t}, it uses the minimum -accessible position that is not a newline character. The optional -argument @var{to}, if non-@code{nil}, specifies the last text position -to consider and defaults to the maximum accessible position of the -buffer. If @var{to} is @code{t}, it uses the maximum accessible -position that is not a newline character. +The optional argument @var{from}, if non-@code{nil}, specifies the +first text position to consider, and defaults to the minimum +accessible position of the buffer. If @var{from} is @code{t}, it +stands for the minimum accessible position that is not a newline +character. The optional argument @var{to}, if non-@code{nil}, +specifies the last text position to consider, and defaults to the +maximum accessible position of the buffer. If @var{to} is @code{t}, +it stands for the maximum accessible position that is not a newline +character. The optional argument @var{x-limit}, if non-@code{nil}, specifies the -maximum pixel-width that can be returned. @var{x-limit} @code{nil} or -omitted, means to use the pixel-width of @var{window}'s body -(@pxref{Window Sizes}); this is useful when the caller does not intend -to change the width of @var{window}. Otherwise, the caller should -specify here the maximum width @var{window}'s body may assume. Text -whose x-coordinate is beyond @var{x-limit} is ignored. Since +maximum X coordinate beyond which text should be ignored; it is +therefore also the largest value of pixel-width that the function can +return. If @var{x-limit} @code{nil} or omitted, it means to use the +pixel-width of @var{window}'s body (@pxref{Window Sizes}); this +default means that text of truncated lines wider than the window will +be ignored. This default is useful when the caller does not intend to +change the width of @var{window}. Otherwise, the caller should +specify here the maximum width @var{window}'s body may assume; in +particular, if truncated lines are expected and their text needs to be +accounted for, @var{x-limit} should be set to a large value. Since calculating the width of long lines can take some time, it's always a good idea to make this argument as small as needed; in particular, if the buffer might contain long lines that will be truncated anyway. The optional argument @var{y-limit}, if non-@code{nil}, specifies the -maximum pixel-height that can be returned. Text lines whose -y-coordinate is beyond @var{y-limit} are ignored. Since calculating the -pixel-height of a large buffer can take some time, it makes sense to -specify this argument; in particular, if the caller does not know the -size of the buffer. +maximum Y coordinate beyond which text is to be ignored; it is +therefore also the maximum pixel-height that the function can return. +If @var{y-limit} is nil or omitted, it means to considers all the +lines of text till the buffer position specified by @var{to}. Since +calculating the pixel-height of a large buffer can take some time, it +makes sense to specify this argument; in particular, if the caller +does not know the size of the buffer. The optional argument @var{mode-and-header-line} @code{nil} or omitted means to not include the height of the mode- or header-line of From 1af0e95fec0d9c63b92ea081d6ca15ecd82d1ade Mon Sep 17 00:00:00 2001 From: Tassilo Horn Date: Sun, 7 Jun 2020 10:01:41 +0200 Subject: [PATCH 12/13] Gnus nnir-summary-line-format has no effect * lisp/gnus/nnir.el (nnir-mode): Update summary format specs if nnir-summary-line-format is set and different from gnus-summary-line-format. (nnir-open-server): Run nnir-mode in gnus-summary-generate-hook instead of gnus-summary-prepared-hook. --- lisp/gnus/nnir.el | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lisp/gnus/nnir.el b/lisp/gnus/nnir.el index 823bc2b423e..f1e31a0cd10 100644 --- a/lisp/gnus/nnir.el +++ b/lisp/gnus/nnir.el @@ -662,7 +662,7 @@ A non-nil `specs' arg must be an alist with `nnir-query-spec' and (let ((backend (car (gnus-server-to-method server)))) (if backend (nnoo-change-server backend server definitions) - (add-hook 'gnus-summary-prepared-hook 'nnir-mode) + (add-hook 'gnus-summary-generate-hook 'nnir-mode) (nnoo-change-server 'nnir server definitions)))) (deffoo nnir-request-group (group &optional server dont-check _info) @@ -1849,8 +1849,11 @@ is also searched." (defun nnir-mode () (when (eq (car (gnus-find-method-for-group gnus-newsgroup-name)) 'nnir) - (setq gnus-summary-line-format - (or nnir-summary-line-format gnus-summary-line-format)) + (when (and nnir-summary-line-format + (not (string= nnir-summary-line-format + gnus-summary-line-format))) + (setq gnus-summary-line-format nnir-summary-line-format) + (gnus-update-format-specifications nil 'summary)) (when (bound-and-true-p gnus-registry-enabled) (remove-hook 'gnus-summary-article-delete-hook 'gnus-registry-action t) (remove-hook 'gnus-summary-article-move-hook 'gnus-registry-action t) From 35661ef943d261f6c43e93e475ddd8516f4a4b62 Mon Sep 17 00:00:00 2001 From: "Basil L. Contovounesios" Date: Sun, 7 Jun 2020 16:46:12 +0100 Subject: [PATCH 13/13] Fix typo in "(elisp) Type Keywords" * doc/lispref/customize.texi (Type Keywords): Fix typo of 'choice' composite type. (Bug#41749) --- doc/lispref/customize.texi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/lispref/customize.texi b/doc/lispref/customize.texi index 172809b29d8..2a72276bc56 100644 --- a/doc/lispref/customize.texi +++ b/doc/lispref/customize.texi @@ -1156,7 +1156,7 @@ in that value. The usual reason to specify a documentation string for a type is to provide more information about the meanings of alternatives inside a -@code{:choice} type or the parts of some other composite type. +@code{choice} type or the parts of some other composite type. @item :help-echo @var{motion-doc} @kindex help-echo@r{, customization keyword}