commit 1ee5a4cb1afe5a55d78e35cab2ad8651196c8967 (HEAD, refs/remotes/origin/master) Author: Ernesto Alfonso Date: Wed Oct 14 07:45:21 2020 +0200 Add option to highlight the 'next-error' error message * lisp/simple.el (next-error-message-highlight): (next-error-message): New faces (bug#32676). (next-error--message-highlight-overlay): New internal variable. (next-error-message-highlight): New function. (next-error-found): Call the function. diff --git a/doc/emacs/building.texi b/doc/emacs/building.texi index 5f7d9b7ab8..573b7ad71a 100644 --- a/doc/emacs/building.texi +++ b/doc/emacs/building.texi @@ -213,6 +213,8 @@ Select a buffer to be used by next invocation of @code{next-error} and @kindex M-g n @kindex C-x ` @findex next-error +@findex next-error-message +@vindex next-error-message-highlight @vindex next-error-highlight @vindex next-error-highlight-no-select To visit errors sequentially, type @w{@kbd{C-x `}} diff --git a/etc/NEWS b/etc/NEWS index 334d782a1f..0ee69d9af9 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1134,6 +1134,11 @@ window after starting). This variable defaults to nil. ** Miscellaneous ++++ +*** New user option 'next-error-message-highlight'. +In addition to a fringe arrow, 'next-error' error may now optionally +highlight the current error message in the 'next-error' buffer. + +++ *** New user option 'tab-first-completion'. If 'tab-always-indent' is 'complete', this new option can be used to diff --git a/lisp/simple.el b/lisp/simple.el index b6d4e0603e..a24f2844aa 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -118,6 +118,23 @@ If non-nil, the value is passed directly to `recenter'." :group 'next-error :version "23.1") +(defcustom next-error-message-highlight nil + "If non-nil, highlight the current error message in the `next-error' buffer." + :type 'boolean + :group 'next-error + :version "28.1") + +(defface next-error-message + '((t (:inherit highlight))) + "Face used to highlight the current error message in the `next-error' buffer." + :group 'next-error + :version "28.1") + +(defvar next-error--message-highlight-overlay + nil + "Overlay highlighting the current error message in the `next-error' buffer.") +(make-variable-buffer-local 'next-error--message-highlight-overlay) + (defcustom next-error-hook nil "List of hook functions run by `next-error' after visiting source file." :type 'hook @@ -376,6 +393,7 @@ and TO-BUFFER is a target buffer." (when next-error-recenter (recenter next-error-recenter)) (funcall next-error-found-function from-buffer to-buffer) + (next-error-message-highlight) (run-hooks 'next-error-hook)) (defun next-error-select-buffer (buffer) @@ -460,6 +478,21 @@ buffer causes automatic display of the corresponding source code location." (next-error-no-select 0)) (error t)))) +(defun next-error-message-highlight () + "Highlight the current error message in the ‘next-error’ buffer." + (when next-error-message-highlight + (with-current-buffer next-error-last-buffer + (when next-error--message-highlight-overlay + (delete-overlay next-error--message-highlight-overlay)) + (save-excursion + (goto-char compilation-current-error) + (let ((ol (make-overlay (line-beginning-position) (line-end-position)))) + ;; do not override region highlighting + (overlay-put ol 'priority -50) + (overlay-put ol 'face 'next-error-message) + (overlay-put ol 'window (get-buffer-window)) + (setf next-error--message-highlight-overlay ol)))))) + ;;; commit 64c8511664420498b9769b098a31300e2ab58c2d Author: Alex Branham Date: Wed Oct 14 07:26:58 2020 +0200 Add a new variable tab-first-completion * doc/emacs/indent.texi (Indent Convenience): Mention it. * doc/lispref/text.texi (Mode-Specific Indent): Document it. * lisp/indent.el (tab-first-completion): New variable (bug#34787). (indent-for-tab-command): Use it. diff --git a/doc/emacs/indent.texi b/doc/emacs/indent.texi index d0360ac333..d6395ef155 100644 --- a/doc/emacs/indent.texi +++ b/doc/emacs/indent.texi @@ -250,6 +250,13 @@ Completion}). If the value is @code{nil}, then @key{TAB} indents the current line only if point is at the left margin or in the line's indentation; otherwise, it inserts a tab character. +@vindex tab-first-completion + If @code{tab-always-indent} is @code{complete}, whether to expand or +indent can be further customized via the @code{tab-first-completion} +variable. For instance, if that variable is @code{eol}, only complete +if point is at the end of a line. @xref{Mode-Specific Indent,,, +elisp, The Emacs Lisp Reference Manual} for further details. + @cindex Electric Indent mode @cindex mode, Electric Indent @findex electric-indent-mode diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi index 722c044b1a..559b2b1c97 100644 --- a/doc/lispref/text.texi +++ b/doc/lispref/text.texi @@ -2427,6 +2427,30 @@ already indented, it calls @code{completion-at-point} to complete the text at point (@pxref{Completion in Buffers}). @end defopt +@defopt tab-first-completion +If @code{tab-always-indent} is @code{complete}, whether to expand or +indent can be further customized via the @code{tab-first-completion} +variable. The following values can be used: +@table @code +@item eol +Only complete if point is at the end of a line. + +@item word +Complete unless the next character has word syntax. + +@item word-or-paren +Complete unless the next character has word syntax or is a +parenthesis. + +@item word-or-paren-or-punct +Complete unless the next character has word syntax, or is a +parenthesis, or is punctuation. +@end table + +In any case, typing @kbd{TAB} a second time always results in +completion. +@end defopt + @cindex literate programming @cindex multi-mode indentation Some major modes need to support embedded regions of text whose diff --git a/etc/NEWS b/etc/NEWS index d8e19a967a..334d782a1f 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1134,6 +1134,11 @@ window after starting). This variable defaults to nil. ** Miscellaneous ++++ +*** New user option 'tab-first-completion'. +If 'tab-always-indent' is 'complete', this new option can be used to +further tweak whether to complete or indent. + --- *** 'zap-up-to-char' now uses 'read-char-from-minibuffer'. This allows navigating through the history of characters that have diff --git a/lisp/indent.el b/lisp/indent.el index 0a0dd99ce0..e436d140e7 100644 --- a/lisp/indent.el +++ b/lisp/indent.el @@ -52,6 +52,8 @@ or in the line's indentation, otherwise it inserts a \"real\" TAB character. If `complete', TAB first tries to indent the current line, and if the line was already indented, then try to complete the thing at point. +Also see `tab-first-completion'. + Some programming language modes have their own variable to control this, e.g., `c-tab-always-indent', and do not respect this variable." :group 'indent @@ -60,6 +62,27 @@ e.g., `c-tab-always-indent', and do not respect this variable." (const :tag "Indent if inside indentation, else TAB" nil) (const :tag "Indent, or if already indented complete" complete))) +(defcustom tab-first-completion nil + "Governs the behavior of TAB completion on the first press of the key. +When nil, complete. When `eol', only complete if point is at the +end of a line. When `word', complete unless the next character +has word syntax (according to `syntax-after'). When +`word-or-paren', complete unless the next character is part of a +word or a parenthesis. When `word-or-paren-or-punct', complete +unless the next character is part of a word, parenthesis, or +punctuation. Typing TAB a second time always results in +completion. + +This variable has no effect unless `tab-always-indent' is `complete'." + :group 'indent + :type '(choice + (const :tag "Always complete" nil) + (const :tag "Unless at the end of a line" 'eol) + (const :tag "Unless looking at a word" 'word) + (const :tag "Unless at a word or parenthesis" 'word-or-paren) + (const :tag "Unless at a word, parenthesis, or punctuation." 'word-or-paren-or-punct)) + :version "27.1") + (defun indent-according-to-mode () "Indent line in proper way for current major mode. @@ -113,7 +136,7 @@ or performs symbol completion, depending on `tab-always-indent'. The function called to actually indent the line or insert a tab is given by the variable `indent-line-function'. -If a prefix argument is given, after this function indents the +If a prefix argument is given (ARG), after this function indents the current line or inserts a tab, it also rigidly indents the entire balanced expression which starts at the beginning of the current line, to reflect the current line's indentation. @@ -141,7 +164,8 @@ prefix argument is ignored." (t (let ((old-tick (buffer-chars-modified-tick)) (old-point (point)) - (old-indent (current-indentation))) + (old-indent (current-indentation)) + (syn `(,(syntax-after (point))))) ;; Indent the line. (or (not (eq (indent--funcall-widened indent-line-function) 'noindent)) @@ -154,7 +178,20 @@ prefix argument is ignored." ;; If the text was already indented right, try completion. ((and (eq tab-always-indent 'complete) (eq old-point (point)) - (eq old-tick (buffer-chars-modified-tick))) + (eq old-tick (buffer-chars-modified-tick)) + (or (null tab-first-completion) + (eq last-command this-command) + (and (equal tab-first-completion 'eol) + (eolp)) + (and (member tab-first-completion + '(word word-or-paren word-or-paren-or-punct)) + (not (member 2 syn))) + (and (member tab-first-completion + '(word-or-paren word-or-paren-or-punct)) + (not (or (member 4 syn) + (member 5 syn)))) + (and (equal tab-first-completion 'word-or-paren-or-punct) + (not (member 1 syn))))) (completion-at-point)) ;; If a prefix argument was given, rigidly indent the following commit 5474603c4c83a0ae2c4a156dd61fd3ea103049ee Author: Lars Ingebrigtsen Date: Wed Oct 14 07:01:46 2020 +0200 Rename dired-filename-at-point to avoid confusion * lisp/dired-x.el (dired-x-guess-filename-at-point): Rename (bug#43961). (dired-filename-at-point): Made into an obsolete alias, since the name can be confused with the unrelated dired-file-name-at-point function. diff --git a/lisp/dired-x.el b/lisp/dired-x.el index b09ef900c1..55077e7188 100644 --- a/lisp/dired-x.el +++ b/lisp/dired-x.el @@ -1483,7 +1483,9 @@ a prefix argument, when it offers the filename near point as a default." ;;; Internal functions. ;; Fixme: This should probably use `thing-at-point'. -- fx -(defun dired-filename-at-point () +(define-obsolete-function-alias 'dired-filename-at-point + #'dired-x-guess-file-name-at-point "28.1") +(defun dired-x-guess-file-name-at-point () "Return the filename closest to point, expanded. Point should be in or after a filename." (save-excursion @@ -1517,7 +1519,7 @@ Point should be in or after a filename." "Return filename prompting with PROMPT with completion. If `current-prefix-arg' is non-nil, uses name at point as guess." (if current-prefix-arg - (let ((guess (dired-filename-at-point))) + (let ((guess (dired-x-guess-file-name-at-point))) (read-file-name prompt (file-name-directory guess) guess commit 14e00d95c4edb724bd12357e37dd443d785c1170 Author: Philipp Klaus Krause Date: Wed Oct 14 06:19:33 2020 +0200 Mark the return value from strerror as a constant * src/emacs.c (main): Mark the return from strerror as a constant, since it shouldn't be changed (bug#43982). * lib-src/movemail.c (pfatal_and_delete): Ditto. Copyright-paperwork-exempt: yes diff --git a/lib-src/movemail.c b/lib-src/movemail.c index 8016a4e373..4f9abc998a 100644 --- a/lib-src/movemail.c +++ b/lib-src/movemail.c @@ -580,7 +580,7 @@ pfatal_with_name (char *name) static void pfatal_and_delete (char *name) { - char *s = strerror (errno); + const char *s = strerror (errno); unlink (name); fatal ("%s for %s", s, name); } diff --git a/src/emacs.c b/src/emacs.c index 6ed970b9fd..e9e9661c39 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -1273,7 +1273,7 @@ main (int argc, char **argv) || (fcntl (STDIN_FILENO, F_DUPFD_CLOEXEC, STDOUT_FILENO) != STDOUT_FILENO)) { - char *errstring = strerror (errno); + const char *errstring = strerror (errno); fprintf (stderr, "%s: %s: %s\n", argv[0], term, errstring); exit (EXIT_FAILURE); } commit f256687bd4f0de8a09c1372ecf0bef917ff56277 Author: Masahiro Nakamura Date: Wed Oct 14 06:14:33 2020 +0200 Improve package install/delete button action * lisp/emacs-lisp/package.el (package-install-button-action) (package-delete-button-action): Run describe-package instead of revert-buffer in order to use newer package-desc (bug#43983). diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 1f81e07754..5b7735125f 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -2630,8 +2630,7 @@ Used for the `action' property of buttons in the buffer created by (when (y-or-n-p (format-message "Install package `%s'? " (package-desc-full-name pkg-desc))) (package-install pkg-desc nil) - (revert-buffer nil t) - (goto-char (point-min))))) + (describe-package (package-desc-name pkg-desc))))) (defun package-delete-button-action (button) "Run `package-delete' on the package BUTTON points to. @@ -2641,8 +2640,7 @@ Used for the `action' property of buttons in the buffer created by (when (y-or-n-p (format-message "Delete package `%s'? " (package-desc-full-name pkg-desc))) (package-delete pkg-desc) - (revert-buffer nil t) - (goto-char (point-min))))) + (describe-package (package-desc-name pkg-desc))))) (defun package-keyword-button-action (button) "Show filtered \"*Packages*\" buffer for BUTTON. commit e88d75a6b621418604d4e90c20a61ead37e34361 Author: Lars Ingebrigtsen Date: Wed Oct 14 05:57:55 2020 +0200 Fix name of the module .h files in the comments * src/emacs-module.c: Fix the name of the .h file in the comments. diff --git a/src/emacs-module.c b/src/emacs-module.c index ba9de58de5..23b8e8620c 100644 --- a/src/emacs-module.c +++ b/src/emacs-module.c @@ -41,7 +41,7 @@ If you want to change the module API, please abide to the following module-env-VER.h. Add functions solely at the end of the fragment file for the next (not yet released) major version of Emacs. For example, if the current Emacs release is 26.2, add functions only to - emacs-env-27.h. + module-env-27.h. - emacs-module.h should only depend on standard C headers. In particular, don't include config.h or lisp.h from emacs-module.h. @@ -55,7 +55,7 @@ If you want to change the module API, please abide to the following To add a new module function, proceed as follows: -1. Add a new function pointer field at the end of the emacs-env-*.h +1. Add a new function pointer field at the end of the module-env-*.h file for the next major version of Emacs. 2. Run config.status or configure to regenerate emacs-module.h. commit a8d810780092cecfbc30fdaeb433aee44ab9f67d Author: Lars Ingebrigtsen Date: Wed Oct 14 05:57:05 2020 +0200 Move the new module unibyte function to the correct module-env.h file * src/module-env-28.h: Moved here from the -25.h file. diff --git a/src/module-env-25.h b/src/module-env-25.h index 01c06d5400..97c7787da3 100644 --- a/src/module-env-25.h +++ b/src/module-env-25.h @@ -102,11 +102,6 @@ const char *str, ptrdiff_t len) EMACS_ATTRIBUTE_NONNULL(1, 2); - /* Create a unibyte Lisp string from a string. */ - emacs_value (*make_unibyte_string) (emacs_env *env, - const char *str, ptrdiff_t len) - EMACS_ATTRIBUTE_NONNULL(1, 2); - /* Embedded pointer type. */ emacs_value (*make_user_ptr) (emacs_env *env, void (*fin) (void *) EMACS_NOEXCEPT, diff --git a/src/module-env-28.h b/src/module-env-28.h index 40b03b92b5..f8820b0606 100644 --- a/src/module-env-28.h +++ b/src/module-env-28.h @@ -16,3 +16,8 @@ void (*make_interactive) (emacs_env *env, emacs_value function, emacs_value spec) EMACS_ATTRIBUTE_NONNULL (1); + + /* Create a unibyte Lisp string from a string. */ + emacs_value (*make_unibyte_string) (emacs_env *env, + const char *str, ptrdiff_t len) + EMACS_ATTRIBUTE_NONNULL(1, 2); commit db0c016dc5c2441048076a3c7d9d1914e4a41bd6 Author: Mattias Engdegård Date: Tue Oct 13 20:01:51 2020 +0200 * etc/NEWS (Calc): Note new precedence of '/' in TeX input mode. diff --git a/etc/NEWS b/etc/NEWS index aa1582f0e7..d8e19a967a 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1108,6 +1108,10 @@ operations such as shifts and bitwise XOR. A word size of zero, set by 'b w', makes the operation have effect on the whole argument values and the result is not truncated in any way. +--- +*** The '/' operator now has higher precedence in (La)TeX input mode. +It no longer has lower precedence than '+' and '-'. + ** term-mode --- commit b058caca72d123b6a21912f1a3b3e43490f05c9c Author: Paul Eggert Date: Tue Oct 13 10:21:40 2020 -0700 nnimap MODSEQ cleanup * lisp/gnus/nnimap.el (nnimap-parse-flags): Remove old hack that deletes MODSEQ entries in the buffer, as Emacs now has bignums and so won't misparse MODSEQs (Bug#38938). diff --git a/lisp/gnus/nnimap.el b/lisp/gnus/nnimap.el index d797e893f5..8a88e0e6e6 100644 --- a/lisp/gnus/nnimap.el +++ b/lisp/gnus/nnimap.el @@ -1772,11 +1772,6 @@ If LIMIT, first try to limit the search to the N last articles." ;; read it. (subst-char-in-region (point-min) (point-max) ?\\ ?% t) - ;; Remove any MODSEQ entries in the buffer, because they may contain - ;; numbers that are too large for 32-bit Emacsen. - (while (re-search-forward " MODSEQ ([0-9]+)" nil t) - (replace-match "" t t)) - (goto-char (point-min)) (let (start end articles groups uidnext elems permanent-flags uidvalidity vanished highestmodseq) (dolist (elem sequences) @@ -1803,8 +1798,9 @@ If LIMIT, first try to limit the search to the N last articles." (setq uidvalidity (and (re-search-forward "UIDVALIDITY \\([0-9]+\\)" end t) - ;; Store UIDVALIDITY as a string, as it's - ;; too big for 32-bit Emacsen, usually. + ;; Store UIDVALIDITY as a string; before bignums, + ;; it was usually too big for 32-bit Emacsen, + ;; and we don't want to change the format now. (match-string 1))) (goto-char start) (setq vanished commit 60d6e3fead4eca9e6da94d4a2a80ca196dc480c5 Author: Paul Eggert Date: Tue Oct 13 10:04:21 2020 -0700 eql doc improvements * doc/lispref/numbers.texi (Comparison of Numbers): Copy some useful text from eql help string. * src/fns.c (Feql): In doc string, say that eql also compares integers by value. diff --git a/doc/lispref/numbers.texi b/doc/lispref/numbers.texi index f018ef4c7c..9a5bff5a5b 100644 --- a/doc/lispref/numbers.texi +++ b/doc/lispref/numbers.texi @@ -450,6 +450,10 @@ numbers. It compares numbers by type and numeric value, so that @code{(eql 1.0 1)} returns @code{nil}, but @code{(eql 1.0 1.0)} and @code{(eql 1 1)} both return @code{t}. This can be used to compare large integers as well as small ones. +Floating-point values with the same sign, exponent and fraction are @code{eql}. +This differs from numeric comparison: @code{(eql 0.0 -0.0)} returns +@code{nil} and @code{(eql 0.0e+NaN 0.0e+NaN)} returns @code{t}, +whereas @code{=} does the opposite. @end defun @defun /= number-or-marker1 number-or-marker2 diff --git a/src/fns.c b/src/fns.c index 4003fe8a81..f50bf8ecb7 100644 --- a/src/fns.c +++ b/src/fns.c @@ -2295,6 +2295,7 @@ The PLIST is modified by side effects. */) DEFUN ("eql", Feql, Seql, 2, 2, 0, doc: /* Return t if the two args are `eq' or are indistinguishable numbers. +Integers with the same value are `eql'. Floating-point values with the same sign, exponent and fraction are `eql'. This differs from numeric comparison: (eql 0.0 -0.0) returns nil and \(eql 0.0e+NaN 0.0e+NaN) returns t, whereas `=' does the opposite. */) commit 993116eec9a09555c0e725c4672863a1776bbd0f Author: Eli Zaretskii Date: Tue Oct 13 19:39:11 2020 +0300 Fix documentation of Outline cycling commands * lisp/outline.el (outline-mode-map): Fix wording of a comment. * doc/emacs/text.texi (Outline Visibility): Fix wording and markup of a recently added paragraph. Improve indexing. * etc/NEWS: Fix whitespace of a recently added entry. diff --git a/doc/emacs/text.texi b/doc/emacs/text.texi index 9c2822ce15..c77dcf7fbc 100644 --- a/doc/emacs/text.texi +++ b/doc/emacs/text.texi @@ -1207,15 +1207,16 @@ everything except the top @var{n} levels of heading lines. Note that it completely reveals all the @var{n} top levels and the body lines before the first heading. +@cindex cycle visibility, in Outline mode @findex outline-cycle @findex outline-cycle-buffer Outline also provides two convenience commands to cycle the -visibility of each section and the whole buffer. Typing @kbd{TAB} on -a heading invokes @code{outline-cycle}, which cycles the current -section between "hide all", "subheadings", and "show all" state. -Typing @kbd{S-TAB} invokes @code{outline-cycle-buffer}, which cycles -the whole buffer between "only top-level headings", "all headings and -subheadings", and "show all" states. +visibility of each section and the whole buffer. Typing +@kbd{@key{TAB}} (@code{outline-cycle}) on a heading cycles the current +section between ``hide all'', ``subheadings'', and ``show all'' +states. Typing @kbd{S-@key{TAB}} (@code{outline-cycle-buffer}) cycles +the whole buffer between ``only top-level headings'', ``all headings +and subheadings'', and ``show all'' states. @anchor{Outline Search} @findex reveal-mode diff --git a/etc/NEWS b/etc/NEWS index 6abf6c5ae5..aa1582f0e7 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -238,7 +238,7 @@ trying to be non-destructive. +++ *** New commands to cycle heading visibility. Typing 'TAB' on a heading cycles the current section between "hide -all", "subheadings", and "show all" state. Typing 'S-TAB' anywhere in +all", "subheadings", and "show all" state. Typing 'S-TAB' anywhere in the buffer cycles the whole buffer between "only top-level headings", "all headings and subheadings", and "show all" states. diff --git a/lisp/outline.el b/lisp/outline.el index 95670e0493..a4ce9afb44 100644 --- a/lisp/outline.el +++ b/lisp/outline.el @@ -179,7 +179,7 @@ in the file it applies to.") (let ((map (make-sparse-keymap))) (define-key map "\C-c" outline-mode-prefix-map) (define-key map [menu-bar] outline-mode-menu-bar-map) - ;; Only takes effect if the point is on a heading. + ;; Only takes effect if point is on a heading. (define-key map (kbd "TAB") `(menu-item "" outline-cycle :filter ,(lambda (cmd) commit 60845174eb59271e85041389a57c266e69309d75 Author: Eli Zaretskii Date: Tue Oct 13 19:30:31 2020 +0300 * etc/NEWS: Mention 'make_unibyte_string'; reformat modules entries. diff --git a/etc/NEWS b/etc/NEWS index aab96cae8f..6abf6c5ae5 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1576,23 +1576,29 @@ file mode specification into symbolic form. ** The variable 'force-new-style-backquotes' has been removed. This removes the final remaining trace of old-style backquotes. -** The module header 'emacs-module.h' now contains type aliases +** Changes in handling dynamic modules + +*** The module header 'emacs-module.h' now contains type aliases 'emacs_function' and 'emacs_finalizer' for module functions and finalizers, respectively. -** Module functions can now be made interactive. +*** Module functions can now be made interactive. Use 'make_interactive' to give a module function an interactive specification. -** Module functions can now install an optional finalizer that is +*** Module functions can now install an optional finalizer that is called when the function object is garbage-collected. Use 'set_function_finalizer' to set the finalizer and 'get_function_finalizer' to retrieve it. -** Modules can now open a channel to an existing pipe process using +*** Modules can now open a channel to an existing pipe process using the new module function 'open_channel'. Modules can use this functionality to asynchronously send data back to Emacs. +*** A new module API 'make_unibyte_string' is provided. +It can be used to create Lisp strings with arbitrary byte sequences +(a.k.a. "raw bytes"). + ** 'file-modes', 'set-file-modes', and 'set-file-times' now have an optional argument specifying whether to follow symbolic links. commit cf407958886e46881216a510efebb8bc029de50c Author: Mattias Engdegård Date: Sat Oct 10 18:02:49 2020 +0200 Calc: allow infinite binary word size (bug#43764) Setting the word size ("b w") to 0 removes the word size clipping for all bit operations (effectively as if a word size of -∞ had been set). Rotation is disallowed; logical and arithmetic shifts behave identically. After a suggestion by Vincent Belaïche. * lisp/calc/calc-bin.el (calc-word-size, math-binary-arg) (math-binary-modulo-args, calcFunc-lsh, calcFunc-ash, calcFunc-rot) (math-clip, math-format-twos-complement): Allow a word size of 0, meaning -∞. * test/lisp/calc/calc-tests.el (calc-tests--not, calc-tests--and, calc-tests--or, calc-tests--xor) (calc-tests--diff): New functions. (calc-tests--clip, calc-tests--rot, calc-shift-binary): Extend to cover word size 0. (calc-bit-ops): New test. * doc/misc/calc.texi (Binary Functions): Update manual. * etc/NEWS: Announce the change. diff --git a/doc/misc/calc.texi b/doc/misc/calc.texi index a356cecf2b..6a6f585ce2 100644 --- a/doc/misc/calc.texi +++ b/doc/misc/calc.texi @@ -18077,7 +18077,7 @@ zeros with @kbd{d z}. @xref{Radix Modes}. @cindex Word size for binary operations The Calculator maintains a current @dfn{word size} @expr{w}, an -arbitrary positive or negative integer. For a positive word size, all +arbitrary integer. For a positive word size, all of the binary operations described here operate modulo @expr{2^w}. In particular, negative arguments are converted to positive integers modulo @expr{2^w} by all binary functions. @@ -18092,6 +18092,9 @@ to inclusive. Either mode accepts inputs in any range; the sign of @expr{w} affects only the results produced. +If the word size is zero, binary operations work on the entire number +without clipping, as if the word size had been negative infinity. + @kindex b c @pindex calc-clip @tindex clip @@ -18221,6 +18224,10 @@ and @samp{rash} operations is totally independent from whether the word size is positive or negative.) With a negative prefix argument, this performs a standard left shift. +When the word size is zero, logical and arithmetic shift operations +are identical: a negative value shifted right remains negative, since +there is an infinite supply of ones to shift in. + @kindex b t @pindex calc-rotate-binary @tindex rot @@ -18230,6 +18237,8 @@ word size) is dropped off the left and shifted in on the right. With a numeric prefix argument, the number is rotated that many bits to the left or right. +Rotation is not possible with a zero word size. + @xref{Set Operations}, for the @kbd{b p} and @kbd{b u} commands that pack and unpack binary integers into sets. (For example, @kbd{b u} unpacks the number @samp{2#11001} to the set of bit-numbers diff --git a/etc/NEWS b/etc/NEWS index 79a8d119f3..aab96cae8f 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1101,6 +1101,13 @@ work more traditionally, with 'C-d' deleting the next character. Likewise, point isn't moved to the end of the string before inserting digits. ++++ +*** Setting the word size to zero disables word clipping. +The word size normally clips the results of certain bit-oriented +operations such as shifts and bitwise XOR. A word size of zero, set +by 'b w', makes the operation have effect on the whole argument values +and the result is not truncated in any way. + ** term-mode --- diff --git a/lisp/calc/calc-bin.el b/lisp/calc/calc-bin.el index 20dd1d441b..60dd17e5ed 100644 --- a/lisp/calc/calc-bin.el +++ b/lisp/calc/calc-bin.el @@ -145,9 +145,10 @@ (setq math-half-2-word-size (math-power-of-2 (1- (math-abs n)))) (calc-do-refresh) (calc-refresh-evaltos) - (if (< n 0) - (message "Binary word size is %d bits (two's complement)" (- n)) - (message "Binary word size is %d bits" n)))) + (cond + ((< n 0) (message "Binary word size is %d bits (two's complement)" (- n))) + ((> n 0) (message "Binary word size is %d bits" n)) + (t (message "No fixed binary word size"))))) @@ -262,9 +263,10 @@ (defun math-binary-arg (a w) (if (not (Math-integerp a)) (setq a (math-trunc a))) - (if (< a 0) - (logand a (1- (ash 1 (if w (math-trunc w) calc-word-size)))) - a)) + (let ((w (if w (math-trunc w) calc-word-size))) + (if (and (< a 0) (not (zerop w))) + (logand a (1- (ash 1 w))) + a))) (defun math-binary-modulo-args (f a b w) (let (mod) @@ -285,7 +287,7 @@ (let ((bits (math-integer-log2 mod))) (if bits (if w - (if (/= w bits) + (if (and (/= w bits) (not (zerop w))) (calc-record-why "*Warning: Modulus inconsistent with word size")) (setq w bits)) @@ -371,11 +373,12 @@ (math-clip (calcFunc-lsh a n (- w)) w) (if (Math-integer-negp a) (setq a (math-clip a w))) - (cond ((or (Math-lessp n (- w)) - (Math-lessp w n)) + (cond ((and (or (Math-lessp n (- w)) + (Math-lessp w n)) + (not (zerop w))) 0) ((< n 0) - (math-quotient (math-clip a w) (math-power-of-2 (- n)))) + (ash (math-clip a w) n)) (t (math-clip (math-mul a (math-power-of-2 n)) w)))))) @@ -403,7 +406,8 @@ (setq a (math-clip a w))) (let ((two-to-sizem1 (math-power-of-2 (1- w))) (sh (calcFunc-lsh a n w))) - (cond ((zerop (logand a two-to-sizem1)) + (cond ((or (zerop w) + (zerop (logand a two-to-sizem1))) sh) ((Math-lessp n (- 1 w)) (math-add (math-mul two-to-sizem1 2) -1)) @@ -421,6 +425,8 @@ (if (eq (car-safe a) 'mod) (math-binary-modulo-args 'calcFunc-rot a n w) (setq w (if w (math-trunc w) calc-word-size)) + (when (zerop w) + (error "Rotation requires a nonzero word size")) (or (integerp w) (math-reject-arg w 'fixnump)) (or (Math-integerp a) @@ -452,6 +458,8 @@ (if (Math-natnum-lessp a (math-power-of-2 (- -1 w))) a (math-sub a (math-power-of-2 (- w))))) + ((math-zerop w) + a) ((Math-negp a) (math-binary-arg a w)) ((integerp a) @@ -682,6 +690,8 @@ (defun math-format-twos-complement (a) "Format an integer in two's complement mode." + (when (zerop calc-word-size) + (error "Nonzero word size required")) (let* (;(calc-leading-zeros t) (num (cond diff --git a/test/lisp/calc/calc-tests.el b/test/lisp/calc/calc-tests.el index fd161027a9..b59f4dc988 100644 --- a/test/lisp/calc/calc-tests.el +++ b/test/lisp/calc/calc-tests.el @@ -569,15 +569,35 @@ An existing calc stack is reused, otherwise a new one is created." 86400)))) (should (equal (math-format-date d-1991-01-09-0600) "663400800"))))) -;; Reference implementations of binary shift functions: +;; Reference implementations of bit operations: (defun calc-tests--clip (x w) "Clip X to W bits, signed if W is negative, otherwise unsigned." - (if (>= w 0) - (logand x (- (ash 1 w) 1)) - (let ((y (calc-tests--clip x (- w))) - (msb (ash 1 (- (- w) 1)))) - (- y (ash (logand y msb) 1))))) + (cond ((zerop w) x) + ((> w 0) (logand x (- (ash 1 w) 1))) + (t (let ((y (calc-tests--clip x (- w))) + (msb (ash 1 (- (- w) 1)))) + (- y (ash (logand y msb) 1)))))) + +(defun calc-tests--not (x w) + "Bitwise complement of X, word size W." + (calc-tests--clip (lognot x) w)) + +(defun calc-tests--and (x y w) + "Bitwise AND of X and W, word size W." + (calc-tests--clip (logand x y) w)) + +(defun calc-tests--or (x y w) + "Bitwise OR of X and Y, word size W." + (calc-tests--clip (logior x y) w)) + +(defun calc-tests--xor (x y w) + "Bitwise XOR of X and Y, word size W." + (calc-tests--clip (logxor x y) w)) + +(defun calc-tests--diff (x y w) + "Bitwise AND of X and NOT Y, word size W." + (calc-tests--clip (logand x (lognot y)) w)) (defun calc-tests--lsh (x n w) "Logical shift left X by N steps, word size W." @@ -611,6 +631,8 @@ An existing calc stack is reused, otherwise a new one is created." (defun calc-tests--rot (x n w) "Rotate X left by N steps, word size W." + (when (zerop w) + (error "Undefined")) (let* ((aw (abs w)) (y (calc-tests--clip x aw)) (steps (mod n aw))) @@ -618,7 +640,7 @@ An existing calc stack is reused, otherwise a new one is created." w))) (ert-deftest calc-shift-binary () - (dolist (w '(16 32 -16 -32)) + (dolist (w '(16 32 -16 -32 0)) (dolist (x '(0 1 #x1234 #x8000 #xabcd #xffff #x12345678 #xabcdef12 #x80000000 #xffffffff #x1234567890ab #x1234967890ab @@ -633,8 +655,38 @@ An existing calc stack is reused, otherwise a new one is created." (calc-tests--ash x n w))) (should (equal (calcFunc-rash x n w) (calc-tests--rash x n w))) - (should (equal (calcFunc-rot x n w) - (calc-tests--rot x n w))))))) + (unless (zerop w) + (should (equal (calcFunc-rot x n w) + (calc-tests--rot x n w))))))) + (should-error (calcFunc-rot 1 1 0))) + +(ert-deftest calc-bit-ops () + (dolist (w '(16 32 -16 -32 0)) + (dolist (x '(0 1 #x1234 #x8000 #xabcd #xffff + #x12345678 #xabcdef12 #x80000000 #xffffffff + #x1234567890ab #x1234967890ab + -1 -14 #x-8000 #x-ffff #x-8001 #x-10000 + #x-80000000 #x-ffffffff #x-80000001 #x-100000000)) + (should (equal (calcFunc-not x w) + (calc-tests--not x w))) + + (dolist (n '(0 1 4 16 32 -1 -4 -16 -32)) + (equal (calcFunc-clip x n) + (calc-tests--clip x n))) + + (dolist (y '(0 1 #x1234 #x8000 #xabcd #xffff + #x12345678 #xabcdef12 #x80000000 #xffffffff + #x1234567890ab #x1234967890ab + -1 -14 #x-8000 #x-ffff #x-8001 #x-10000 + #x-80000000 #x-ffffffff #x-80000001 #x-100000000)) + (should (equal (calcFunc-and x y w) + (calc-tests--and x y w))) + (should (equal (calcFunc-or x y w) + (calc-tests--or x y w))) + (should (equal (calcFunc-xor x y w) + (calc-tests--xor x y w))) + (should (equal (calcFunc-diff x y w) + (calc-tests--diff x y w))))))) (ert-deftest calc-latex-input () ;; Check precedence of "/" in LaTeX input mode. commit add1314195b193f04164cebe558d7a185b61de96 Author: Mattias Engdegård Date: Sun Oct 11 18:28:39 2020 +0200 Calc: revert to old precedence of '/' in (La)TeX input mode Make the '/' precedence higher than that of '+' and '-' again, partially reverting fda9b316f84 (bug#43902). * lisp/calc/calc-lang.el (tex): Change precedence of '/'. * test/lisp/calc/calc-tests.el (calc-latex-input): New test. diff --git a/lisp/calc/calc-lang.el b/lisp/calc/calc-lang.el index 1c270cfc24..bde5abe649 100644 --- a/lisp/calc/calc-lang.el +++ b/lisp/calc/calc-lang.el @@ -468,10 +468,10 @@ ( "\\times" * 191 190 ) ( "*" * 191 190 ) ( "2x" * 191 190 ) + ( "/" / 185 186 ) ( "+" + 180 181 ) ( "-" - 180 181 ) ( "\\over" / 170 171 ) - ( "/" / 170 171 ) ( "\\choose" calcFunc-choose 170 171 ) ( "\\mod" % 170 171 ) ( "<" calcFunc-lt 160 161 ) diff --git a/test/lisp/calc/calc-tests.el b/test/lisp/calc/calc-tests.el index d08a1f605b..fd161027a9 100644 --- a/test/lisp/calc/calc-tests.el +++ b/test/lisp/calc/calc-tests.el @@ -636,6 +636,25 @@ An existing calc stack is reused, otherwise a new one is created." (should (equal (calcFunc-rot x n w) (calc-tests--rot x n w))))))) +(ert-deftest calc-latex-input () + ;; Check precedence of "/" in LaTeX input mode. + (should (equal (math-read-exprs "a+b/c*d") + '((+ (var a var-a) (/ (var b var-b) + (* (var c var-c) (var d var-d))))))) + (unwind-protect + (progn + (calc-set-language 'latex) + (should (equal (math-read-exprs "a+b/c*d") + '((+ (var a var-a) (/ (var b var-b) + (* (var c var-c) (var d var-d))))))) + (should (equal (math-read-exprs "a+b\\over c*d") + '((/ (+ (var a var-a) (var b var-b)) + (* (var c var-c) (var d var-d)))))) + (should (equal (math-read-exprs "a/b/c") + '((/ (/ (var a var-a) (var b var-b)) + (var c var-c)))))) + (calc-set-language nil))) + (provide 'calc-tests) ;;; calc-tests.el ends here commit 721b8468d28fec84a63bbef9da9f2016670decdc Author: Mattias Engdegård Date: Sun Oct 11 11:24:03 2020 +0200 Calc: make tests less chatty * test/lisp/calc/calc-tests.el (calc-extract-units, calc-convert-units) (calc-matrix-determinant, calc-choose): Remove "Working..." messages. (calc-tests--check-choose, calc-tests--explain-choose): Eliminate. diff --git a/test/lisp/calc/calc-tests.el b/test/lisp/calc/calc-tests.el index fe37c424d5..d08a1f605b 100644 --- a/test/lisp/calc/calc-tests.el +++ b/test/lisp/calc/calc-tests.el @@ -67,19 +67,22 @@ An existing calc stack is reused, otherwise a new one is created." (should (calc-tests-equal (calc-tests-simple #'calc-remove-units "-1 m") -1))) (ert-deftest calc-extract-units () - (should (calc-tests-equal (calc-tests-simple #'calc-extract-units "-1 m") - '(var m var-m))) - (should (calc-tests-equal (calc-tests-simple #'calc-extract-units "-1 m*cm") - '(* (float 1 -2) (^ (var m var-m) 2))))) + (let ((calc-display-working-message nil)) + (should (calc-tests-equal (calc-tests-simple #'calc-extract-units "-1 m") + '(var m var-m))) + (should (calc-tests-equal (calc-tests-simple #'calc-extract-units "-1 m*cm") + '(* (float 1 -2) (^ (var m var-m) 2)))))) (ert-deftest calc-convert-units () - ;; Used to ask for `(The expression is unitless when simplified) Old Units: '. - (should (calc-tests-equal (calc-tests-simple #'calc-convert-units "-1 m" nil "cm") - '(* -100 (var cm var-cm)))) - ;; Gave wrong result. - (should (calc-tests-equal (calc-tests-simple #'calc-convert-units "-1 m" - (math-read-expr "1m") "cm") - '(* -100 (var cm var-cm))))) + (let ((calc-display-working-message nil)) + ;; Used to ask `(The expression is unitless when simplified) Old Units: '. + (should (calc-tests-equal (calc-tests-simple #'calc-convert-units "-1 m" + nil "cm") + '(* -100 (var cm var-cm)))) + ;; Gave wrong result. + (should (calc-tests-equal (calc-tests-simple #'calc-convert-units "-1 m" + (math-read-expr "1m") "cm") + '(* -100 (var cm var-cm)))))) (ert-deftest calc-imaginary-i () "Test `math-imaginary-i' for non-special-const values." @@ -340,27 +343,28 @@ An existing calc stack is reused, otherwise a new one is created." (should-not (Math-num-integerp nil))) (ert-deftest calc-matrix-determinant () - (should (equal (calcFunc-det '(vec (vec 3))) - 3)) - (should (equal (calcFunc-det '(vec (vec 2 3) (vec 6 7))) - -4)) - (should (equal (calcFunc-det '(vec (vec 1 2 3) (vec 4 5 7) (vec 9 6 2))) - 15)) - (should (equal (calcFunc-det '(vec (vec 0 5 7 3) - (vec 0 0 2 0) - (vec 1 2 3 4) - (vec 0 0 0 3))) - 30)) - (should (equal (calcFunc-det '(vec (vec (var a var-a)))) - '(var a var-a))) - (should (equal (calcFunc-det '(vec (vec 2 (var a var-a)) - (vec 7 (var a var-a)))) - '(* -5 (var a var-a)))) - (should (equal (calcFunc-det '(vec (vec 1 0 0 0) - (vec 0 1 0 0) - (vec 0 0 0 1) - (vec 0 0 (var a var-a) 0))) - '(neg (var a var-a))))) + (let ((calc-display-working-message nil)) + (should (equal (calcFunc-det '(vec (vec 3))) + 3)) + (should (equal (calcFunc-det '(vec (vec 2 3) (vec 6 7))) + -4)) + (should (equal (calcFunc-det '(vec (vec 1 2 3) (vec 4 5 7) (vec 9 6 2))) + 15)) + (should (equal (calcFunc-det '(vec (vec 0 5 7 3) + (vec 0 0 2 0) + (vec 1 2 3 4) + (vec 0 0 0 3))) + 30)) + (should (equal (calcFunc-det '(vec (vec (var a var-a)))) + '(var a var-a))) + (should (equal (calcFunc-det '(vec (vec 2 (var a var-a)) + (vec 7 (var a var-a)))) + '(* -5 (var a var-a)))) + (should (equal (calcFunc-det '(vec (vec 1 0 0 0) + (vec 0 1 0 0) + (vec 0 0 0 1) + (vec 0 0 (var a var-a) 0))) + '(neg (var a var-a)))))) (ert-deftest calc-gcd () (should (equal (calcFunc-gcd 3 4) 1)) @@ -419,17 +423,6 @@ An existing calc stack is reused, otherwise a new one is created." (calc-tests--fac k))) (t (error "case not covered")))) -(defun calc-tests--check-choose (n k) - (equal (calcFunc-choose n k) - (calc-tests--choose n k))) - -(defun calc-tests--explain-choose (n k) - (let ((got (calcFunc-choose n k)) - (expected (calc-tests--choose n k))) - (format "(calcFunc-choose %d %d) => %S, expected %S" n k got expected))) - -(put 'calc-tests--check-choose 'ert-explainer 'calc-tests--explain-choose) - (defun calc-tests--calc-to-number (x) "Convert a Calc object to a Lisp number." (pcase x @@ -440,23 +433,25 @@ An existing calc stack is reused, otherwise a new one is created." (ert-deftest calc-choose () "Test computation of binomial coefficients (bug#16999)." - ;; Integral arguments - (dolist (n (number-sequence -6 6)) - (dolist (k (number-sequence -6 6)) - (should (calc-tests--check-choose n k)))) - - ;; Fractional n, natural k - (should (equal (calc-tests--calc-to-number - (calcFunc-choose '(frac 15 2) 3)) - (calc-tests--choose 7.5 3))) - - (should (equal (calc-tests--calc-to-number - (calcFunc-choose '(frac 1 2) 2)) - (calc-tests--choose 0.5 2))) - - (should (equal (calc-tests--calc-to-number - (calcFunc-choose '(frac -15 2) 3)) - (calc-tests--choose -7.5 3)))) + (let ((calc-display-working-message nil)) + ;; Integral arguments + (dolist (n (number-sequence -6 6)) + (dolist (k (number-sequence -6 6)) + (should (equal (calcFunc-choose n k) + (calc-tests--choose n k))))) + + ;; Fractional n, natural k + (should (equal (calc-tests--calc-to-number + (calcFunc-choose '(frac 15 2) 3)) + (calc-tests--choose 7.5 3))) + + (should (equal (calc-tests--calc-to-number + (calcFunc-choose '(frac 1 2) 2)) + (calc-tests--choose 0.5 2))) + + (should (equal (calc-tests--calc-to-number + (calcFunc-choose '(frac -15 2) 3)) + (calc-tests--choose -7.5 3))))) (ert-deftest calc-business-days () (cl-flet ((m (s) (math-parse-date s)) commit 12175a339e2a2214fdd0ab4e16d8d8b1e92a78d3 Author: Lars Ingebrigtsen Date: Tue Oct 13 06:51:06 2020 +0200 Allow creating unibyte strings from Emacs modules * doc/lispref/internals.texi (Module Values): Document make_unibyte_string (bug#34873). * src/emacs-module.c (module_make_unibyte_string): New function. (initialize_environment): Export it. * src/module-env-25.h: Define it. * test/data/emacs-module/mod-test.c (Fmod_test_return_unibyte): Test it. * test/src/emacs-module-tests.el (module/unibyte): Test it. diff --git a/doc/lispref/internals.texi b/doc/lispref/internals.texi index fed9612e32..bb25983aa4 100644 --- a/doc/lispref/internals.texi +++ b/doc/lispref/internals.texi @@ -1854,6 +1854,12 @@ raises the @code{overflow-error} error condition if @var{len} is negative or exceeds the maximum length of an Emacs string. @end deftypefn +@deftypefn Function emacs_value make_unibyte_string (emacs_env *@var{env}, const char *@var{str}, ptrdiff_t @var{len}) +This function is like @code{make_string}, but has no restrictions on +the values of the bytes in the C string, and can be used to pass +binary data to Emacs in the form of a unibyte string. +@end deftypefn + The @acronym{API} does not provide functions to manipulate Lisp data structures, for example, create lists with @code{cons} and @code{list} (@pxref{Building Lists}), extract list members with @code{car} and diff --git a/src/emacs-module.c b/src/emacs-module.c index 3581daad11..ba9de58de5 100644 --- a/src/emacs-module.c +++ b/src/emacs-module.c @@ -790,6 +790,18 @@ module_make_string (emacs_env *env, const char *str, ptrdiff_t len) return lisp_to_value (env, lstr); } +static emacs_value +module_make_unibyte_string (emacs_env *env, const char *str, ptrdiff_t length) +{ + MODULE_FUNCTION_BEGIN (NULL); + if (! (0 <= length && length <= STRING_BYTES_BOUND)) + overflow_error (); + Lisp_Object lstr = make_uninit_string (length); + memcpy (SDATA (lstr), str, length); + SDATA (lstr)[length] = 0; + return lisp_to_value (env, lstr); +} + static emacs_value module_make_user_ptr (emacs_env *env, emacs_finalizer fin, void *ptr) { @@ -1464,6 +1476,7 @@ initialize_environment (emacs_env *env, struct emacs_env_private *priv) env->make_float = module_make_float; env->copy_string_contents = module_copy_string_contents; env->make_string = module_make_string; + env->make_unibyte_string = module_make_unibyte_string; env->make_user_ptr = module_make_user_ptr; env->get_user_ptr = module_get_user_ptr; env->set_user_ptr = module_set_user_ptr; diff --git a/src/module-env-25.h b/src/module-env-25.h index 97c7787da3..01c06d5400 100644 --- a/src/module-env-25.h +++ b/src/module-env-25.h @@ -102,6 +102,11 @@ const char *str, ptrdiff_t len) EMACS_ATTRIBUTE_NONNULL(1, 2); + /* Create a unibyte Lisp string from a string. */ + emacs_value (*make_unibyte_string) (emacs_env *env, + const char *str, ptrdiff_t len) + EMACS_ATTRIBUTE_NONNULL(1, 2); + /* Embedded pointer type. */ emacs_value (*make_user_ptr) (emacs_env *env, void (*fin) (void *) EMACS_NOEXCEPT, diff --git a/test/data/emacs-module/mod-test.c b/test/data/emacs-module/mod-test.c index da298d4e39..258a679b20 100644 --- a/test/data/emacs-module/mod-test.c +++ b/test/data/emacs-module/mod-test.c @@ -268,6 +268,16 @@ Fmod_test_string_a_to_b (emacs_env *env, ptrdiff_t nargs, emacs_value args[], } +/* Return a unibyte string. */ +static emacs_value +Fmod_test_return_unibyte (emacs_env *env, ptrdiff_t nargs, emacs_value args[], + void *data) +{ + const char *string = "foo\x00zot"; + return env->make_unibyte_string (env, string, 7); +} + + /* Embedded pointers in lisp objects. */ /* C struct (pointer to) that will be embedded. */ @@ -750,6 +760,7 @@ emacs_module_init (struct emacs_runtime *ert) DEFUN ("mod-test-globref-reordered", Fmod_test_globref_reordered, 0, 0, NULL, NULL); DEFUN ("mod-test-string-a-to-b", Fmod_test_string_a_to_b, 1, 1, NULL, NULL); + DEFUN ("mod-test-return-unibyte", Fmod_test_return_unibyte, 0, 0, NULL, NULL); DEFUN ("mod-test-userptr-make", Fmod_test_userptr_make, 1, 1, NULL, NULL); DEFUN ("mod-test-userptr-get", Fmod_test_userptr_get, 1, 1, NULL, NULL); DEFUN ("mod-test-vector-fill", Fmod_test_vector_fill, 2, 2, NULL, NULL); diff --git a/test/src/emacs-module-tests.el b/test/src/emacs-module-tests.el index 1eebb418cf..621229c62a 100644 --- a/test/src/emacs-module-tests.el +++ b/test/src/emacs-module-tests.el @@ -500,4 +500,10 @@ See Bug#36226." (should (eq (mod-test-identity 123) 123)) (should-not (call-interactively #'mod-test-identity))) +(ert-deftest module/unibyte () + (let ((result (mod-test-return-unibyte))) + (should (stringp result)) + (should (not (multibyte-string-p (mod-test-return-unibyte)))) + (should (equal result "foo\x00zot")))) + ;;; emacs-module-tests.el ends here commit 45cb0403deeba1cc121147b1884e7fea6cd15338 Author: Lars Ingebrigtsen Date: Tue Oct 13 05:48:13 2020 +0200 Partially revert previous patch to emacs.service * etc/emacs.service (ExecStop): Partially revert previous patch for bug#37847, since: "This appears to break packages that rely on `invocation-name' to be executable." diff --git a/etc/emacs.service b/etc/emacs.service index 0dc2418269..c99c6779f5 100644 --- a/etc/emacs.service +++ b/etc/emacs.service @@ -8,7 +8,7 @@ Documentation=info:emacs man:emacs(1) https://gnu.org/software/emacs/ [Service] Type=notify -ExecStart=@emacs emacsd --fg-daemon +ExecStart=emacs --fg-daemon ExecStop=emacsclient --eval "(kill-emacs)" # The location of the SSH auth socket varies by distribution, and some # set it from PAM, so don't override by default. commit 1b45079ffa2d0b8f66f77cdcf1af2d3d08a5515b Author: Yuan Fu Date: Tue Oct 13 05:14:21 2020 +0200 Add cycling commands to outline * lisp/outline.el (outline--cycle-state, outline-has-subheading-p) (outline-cycle, outline-cycle-buffer): New functions. (outline-mode-map): Add key bindings for the two new commands. (outline--cycle-buffer-state): New variable. * doc/emacs/text.text (Outline Visibility): Add 'outline-cycle' and 'outline-cycle-buffer'. * etc/NEWS (Outline): Record the change (bug#41130). diff --git a/doc/emacs/text.texi b/doc/emacs/text.texi index 281e24421c..9c2822ce15 100644 --- a/doc/emacs/text.texi +++ b/doc/emacs/text.texi @@ -1207,6 +1207,16 @@ everything except the top @var{n} levels of heading lines. Note that it completely reveals all the @var{n} top levels and the body lines before the first heading. +@findex outline-cycle +@findex outline-cycle-buffer + Outline also provides two convenience commands to cycle the +visibility of each section and the whole buffer. Typing @kbd{TAB} on +a heading invokes @code{outline-cycle}, which cycles the current +section between "hide all", "subheadings", and "show all" state. +Typing @kbd{S-TAB} invokes @code{outline-cycle-buffer}, which cycles +the whole buffer between "only top-level headings", "all headings and +subheadings", and "show all" states. + @anchor{Outline Search} @findex reveal-mode @vindex search-invisible diff --git a/etc/NEWS b/etc/NEWS index 071edc5208..79a8d119f3 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -233,6 +233,15 @@ preserving markers, properties and overlays. The new variable number of seconds that 'revert-buffer-with-fine-grain' should spend trying to be non-destructive. +** Outline + ++++ +*** New commands to cycle heading visibility. +Typing 'TAB' on a heading cycles the current section between "hide +all", "subheadings", and "show all" state. Typing 'S-TAB' anywhere in +the buffer cycles the whole buffer between "only top-level headings", +"all headings and subheadings", and "show all" states. + * Changes in Specialized Modes and Packages in Emacs 28.1 diff --git a/lisp/outline.el b/lisp/outline.el index 6158ed594e..95670e0493 100644 --- a/lisp/outline.el +++ b/lisp/outline.el @@ -179,6 +179,12 @@ in the file it applies to.") (let ((map (make-sparse-keymap))) (define-key map "\C-c" outline-mode-prefix-map) (define-key map [menu-bar] outline-mode-menu-bar-map) + ;; Only takes effect if the point is on a heading. + (define-key map (kbd "TAB") + `(menu-item "" outline-cycle + :filter ,(lambda (cmd) + (when (outline-on-heading-p) cmd)))) + (define-key map (kbd "") #'outline-cycle-buffer) map)) (defvar outline-font-lock-keywords @@ -1125,6 +1131,83 @@ convenient way to make a table of contents of the buffer." (insert "\n\n")))))) (kill-new (buffer-string))))))) +(defun outline--cycle-state () + "Return the cycle state of current heading. +Return either 'hide-all, 'headings-only, or 'show-all." + (save-excursion + (let (start end ov-list heading-end) + (outline-back-to-heading) + (setq start (point)) + (outline-end-of-heading) + (setq heading-end (point)) + (outline-end-of-subtree) + (setq end (point)) + (setq ov-list (cl-remove-if-not + (lambda (o) (eq (overlay-get o 'invisible) 'outline)) + (overlays-in start end))) + (cond ((eq ov-list nil) 'show-all) + ;; (eq (length ov-list) 1) wouldn’t work: what if there is + ;; one folded subheading? + ((and (eq (overlay-end (car ov-list)) end) + (eq (overlay-start (car ov-list)) heading-end)) + 'hide-all) + (t 'headings-only))))) + +(defun outline-has-subheading-p () + "Return t if this heading has subheadings, nil otherwise." + (save-excursion + (outline-back-to-heading) + (< (save-excursion (outline-next-heading) (point)) + (save-excursion (outline-end-of-subtree) (point))))) + +(defun outline-cycle () + "Cycle between `hide all', `headings only' and `show all'. + +`Hide all' means hide all subheadings and their bodies. +`Headings only' means show sub headings but not their bodies. +`Show all' means show all subheadings and their bodies." + (interactive) + (pcase (outline--cycle-state) + ('hide-all + (if (outline-has-subheading-p) + (progn (outline-show-children) + (message "Only headings")) + (outline-show-subtree) + (message "Show all"))) + ('headings-only + (outline-show-subtree) + (message "Show all")) + ('show-all + (outline-hide-subtree) + (message "Hide all")))) + +(defvar-local outline--cycle-buffer-state 'show-all + "Internal variable used for tracking buffer cycle state.") + +(defun outline-cycle-buffer () + "Cycle the whole buffer like in `outline-cycle'." + (interactive) + (pcase outline--cycle-buffer-state + ('show-all + (save-excursion + (let ((start-point (point))) + (while (not (eq (point) start-point)) + (outline-up-heading 1)) + (outline-hide-sublevels + (progn (outline-back-to-heading) + (funcall 'outline-level))))) + (setq outline--cycle-buffer-state 'top-level) + (message "Top level headings")) + ('top-level + (outline-show-all) + (outline-hide-region-body (point-min) (point-max)) + (setq outline--cycle-buffer-state 'all-heading) + (message "All headings")) + ('all-heading + (outline-show-all) + (setq outline--cycle-buffer-state 'show-all) + (message "Show all")))) + (provide 'outline) (provide 'noutline) commit b31e48d4efb030b59a9058796c2da53357c379a3 Author: Lars Ingebrigtsen Date: Tue Oct 13 04:59:11 2020 +0200 Make read-char-choice less modal * lisp/subr.el (read-char-choice): Use `read-char-from-minibuffer' here (bug#42708) so that we're not as modal (and users can copy the help buffer, if they should so want). diff --git a/lisp/subr.el b/lisp/subr.el index 07cab5909d..867c9f0bfb 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -2622,7 +2622,15 @@ keyboard-quit events while waiting for a valid input." (unless (get-text-property 0 'face prompt) (setq prompt (propertize prompt 'face 'minibuffer-prompt))) (setq char (let ((inhibit-quit inhibit-keyboard-quit)) - (read-key prompt))) + (read-char-from-minibuffer + prompt + ;; If we have a dynamically bound `help-form' + ;; here, then the `C-h' (i.e., `help-char') + ;; character should output that instead of + ;; being a command char. + (if help-form + (cons help-char chars) + chars)))) (and show-help (buffer-live-p (get-buffer helpbuf)) (kill-buffer helpbuf)) (cond commit 94b870dfa38548c3bb4b5a471a3dbf5819646b44 Author: Lars Ingebrigtsen Date: Tue Oct 13 04:10:43 2020 +0200 Make diary fontify headers correctly (if the date has been customized) * lisp/calendar/diary-lib.el (diary-fancy-display): Insert the heading with the correct face, so that it doesn't have to be re-matched later (which is generally impossible) (bug#13072). (diary-fancy-date-pattern, diary-fancy-date-matcher): Make obsolete. (diary-fancy-font-lock-keywords): Don't use. (diary-fancy-font-lock-fontify-region-function): Don't use. diff --git a/lisp/calendar/diary-lib.el b/lisp/calendar/diary-lib.el index da98e44926..fbc13f59b2 100644 --- a/lisp/calendar/diary-lib.el +++ b/lisp/calendar/diary-lib.el @@ -1092,7 +1092,9 @@ This is an option for `diary-display-function'." (if (calendar-date-equal date (car h)) (setq date-holiday-list (append date-holiday-list (cdr h))))) - (insert (if (bobp) "" ?\n) (calendar-date-string date)) + (insert (if (bobp) "" ?\n) + (propertize (calendar-date-string date) + 'font-lock-face 'diary)) (if date-holiday-list (insert ": ")) (setq cc (current-column)) (insert (mapconcat (lambda (x) @@ -1100,7 +1102,10 @@ This is an option for `diary-display-function'." x) date-holiday-list (concat "\n" (make-string cc ?\s)))) - (insert ?\n (make-string (+ cc longest) ?=) ?\n))) + (insert ?\n + (propertize (make-string (+ cc longest) ?=) + 'font-lock-face 'diary) + ?\n))) (let ((this-entry (cadr entry)) this-loc marks temp-face) (unless (zerop (length this-entry)) @@ -2394,6 +2399,7 @@ return a font-lock pattern matching array of MONTHS and marking SYMBOL." (defun diary-fancy-date-pattern () "Return a regexp matching the first line of a fancy diary date header. This depends on the calendar date style." + (declare (obsolete nil "28.1")) (concat (calendar-dlet* ((dayname (diary-name-pattern calendar-day-name-array nil t)) @@ -2414,15 +2420,17 @@ This depends on the calendar date style." (defun diary-fancy-date-matcher (limit) "Search for a fancy diary data header, up to LIMIT." + (declare (obsolete nil "28.1")) ;; Any number of " other holiday name" lines, followed by "==" line. - (when (re-search-forward - (format "%s\\(\n +.*\\)*\n=+$" (diary-fancy-date-pattern)) limit t) - (put-text-property (match-beginning 0) (match-end 0) 'font-lock-multiline t) - t)) + (with-suppressed-warnings ((obsolete diary-fancy-date-pattern)) + (when (re-search-forward + (format "%s\\(\n +.*\\)*\n=+$" (diary-fancy-date-pattern)) limit t) + (put-text-property (match-beginning 0) (match-end 0) + 'font-lock-multiline t) + t))) (defvar diary-fancy-font-lock-keywords - `((diary-fancy-date-matcher . 'diary) - ("^.*\\([aA]nniversary\\|[bB]irthday\\).*$" . 'diary-anniversary) + `(("^.*\\([aA]nniversary\\|[bB]irthday\\).*$" . 'diary-anniversary) ("^.*Yahrzeit.*$" . font-lock-constant-face) ("^\\(Erev \\)?Rosh Hodesh.*" . font-lock-function-name-face) ("^Day.*omer.*$" . font-lock-builtin-face) @@ -2443,9 +2451,6 @@ Fontify the region between BEG and END, quietly unless VERBOSE is non-nil." (if (looking-at "=+$") (forward-line -1)) (while (and (looking-at " +[^ ]") (zerop (forward-line -1)))) - ;; This check not essential. - (if (looking-at (diary-fancy-date-pattern)) - (setq beg (line-beginning-position))) (goto-char end) (forward-line 0) (while (and (looking-at " +[^ ]") commit 13e5c1db681ec0324d951b2ccc30de1e201426c5 Author: Mauro Aranda Date: Tue Oct 13 03:32:17 2020 +0200 Don't bind sort-fold-case when saving the custom-file * lisp/cus-edit.el (custom-save-variables, custom-save-faces): These functions sort a list, not buffer text, so they don't need to use sort-fold-case at all. Remove the let-binding for sort-fold-case (bug#43919). diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el index 9c5d89f89f..3c93753495 100644 --- a/lisp/cus-edit.el +++ b/lisp/cus-edit.el @@ -4681,15 +4681,12 @@ This function does not save the buffer." (setq pos (line-beginning-position)))) (goto-char pos))))) -(defvar sort-fold-case) ; defined in sort.el - (defun custom-save-variables () "Save all customized variables in `custom-file'." (save-excursion (custom-save-delete 'custom-set-variables) (let ((standard-output (current-buffer)) - (saved-list (make-list 1 0)) - sort-fold-case) + (saved-list (make-list 1 0))) ;; First create a sorted list of saved variables. (mapatoms (lambda (symbol) @@ -4771,8 +4768,7 @@ This function does not save the buffer." (custom-save-delete 'custom-reset-faces) (custom-save-delete 'custom-set-faces) (let ((standard-output (current-buffer)) - (saved-list (make-list 1 0)) - sort-fold-case) + (saved-list (make-list 1 0))) ;; First create a sorted list of saved faces. (mapatoms (lambda (symbol) commit af367a9d5971367caabf82a2193e80f1ec6ba244 Author: Lars Ingebrigtsen Date: Tue Oct 13 03:25:36 2020 +0200 Have header-line-highlight inherit from mode-line-highlight * lisp/faces.el (header-line-highlight): Inherit from mode-line-highlight instead of highlight (bug#43926). This is consistent with header-line inheriting from mode-line. diff --git a/lisp/faces.el b/lisp/faces.el index 5b7e0a5aee..0ce9532270 100644 --- a/lisp/faces.el +++ b/lisp/faces.el @@ -2637,9 +2637,9 @@ Use the face `mode-line-highlight' for features that can be selected." :version "21.1" :group 'basic-faces) -(defface header-line-highlight '((t :inherit highlight)) +(defface header-line-highlight '((t :inherit mode-line-highlight)) "Basic header line face for highlighting." - :version "26.1" + :version "28.1" :group 'basic-faces) (defface vertical-border commit 85e81721ea106432d6107627ee3e1107915b3dee Author: Lars Ingebrigtsen Date: Tue Oct 13 03:17:12 2020 +0200 message-insert-signature doc fix * lisp/gnus/message.el (message-insert-signature): Clarify what FORCE means. diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index a906e56aac..7d89739197 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -3615,7 +3615,14 @@ Message buffers and is not meant to be called directly." (do-auto-fill)))) (defun message-insert-signature (&optional force) - "Insert a signature. See documentation for variable `message-signature'." + "Insert a signature at the end of the buffer. + +See the documentation for the `message-signature' variable for +more information. + +If FORCE is 0 (or when called interactively), the global values +of the signature variables will be consulted if the local ones +are null." (interactive (list 0)) (let ((message-signature message-signature) (message-signature-file message-signature-file)) commit ec9523a6ae240d219b43b7539100e7f8b6b92bfd Author: Boruch Baum Date: Tue Oct 13 03:09:19 2020 +0200 Add a keybinding to the help menu to display manuals * lisp/help.el (help-for-help-internal): Add a keybinding to prompt for and display a manual (bug#43956). diff --git a/etc/NEWS b/etc/NEWS index cc8733c2c0..071edc5208 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -562,6 +562,11 @@ skipped. +++ *** New command 'describe-keymap' describes keybindings in a keymap. +--- +*** New keybinding in 'help-for-help' to display a manual. +The 'R' keybinding after 'C-h C-h' will prompt for a manual name and +then display it. + +++ ** New command 'lossage-size'. It allows users to set the maximum number of keystrokes and commands diff --git a/lisp/help.el b/lisp/help.el index edef78d207..9b7355c6b6 100644 --- a/lisp/help.el +++ b/lisp/help.el @@ -101,6 +101,7 @@ (define-key map "p" 'finder-by-keyword) (define-key map "P" 'describe-package) (define-key map "r" 'info-emacs-manual) + (define-key map "R" 'info-display-manual) (define-key map "s" 'describe-syntax) (define-key map "t" 'help-with-tutorial) (define-key map "w" 'where-is) @@ -223,6 +224,7 @@ o SYMBOL Display the given function or variable's documentation and value. p TOPIC Find packages matching a given topic keyword. P PACKAGE Describe the given Emacs Lisp package. r Display the Emacs manual in Info mode. +R Prompt for a manual and then display it in Info mode. s Display contents of current syntax table, plus explanations. S SYMBOL Show the section for the given symbol in the Info manual for the programming language used in this buffer. commit f2fb69f08ed7783406639de09747529c24416983 Author: Juri Linkov Date: Mon Oct 12 22:56:35 2020 +0300 * lisp/isearch.el (isearch-search): Set isearch-match-data in the right place. diff --git a/lisp/isearch.el b/lisp/isearch.el index 1efd9b2130..0879f948cf 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el @@ -3451,10 +3451,10 @@ Optional third argument, if t, means if fail just return nil (no error). (match-beginning 0) (match-end 0))) (setq retry nil))) (setq isearch-just-started nil) - (setq isearch-match-data (match-data t)) - (if isearch-success - (setq isearch-other-end - (if isearch-forward (match-beginning 0) (match-end 0))))) + (when isearch-success + (setq isearch-other-end + (if isearch-forward (match-beginning 0) (match-end 0))) + (setq isearch-match-data (match-data t)))) (quit (isearch-unread ?\C-g) (setq isearch-success nil)) commit a6c22271bcd0d7827e9ef5644bde1322f021fd0f Author: Stefan Kangas Date: Mon Oct 12 20:59:14 2020 +0200 Fix man page title lines and timestamps * doc/man/ebrowse.1: * doc/man/emacs.1.in: * doc/man/emacsclient.1: * doc/man/etags.1: Update date to match last significant change. Set file local variable time-stamp-pattern. Fix title line to match the recommendations in "man man-pages". Ref: https://lists.gnu.org/r/emacs-devel/2020-09/msg01002.html diff --git a/doc/man/ebrowse.1 b/doc/man/ebrowse.1 index 686658b20f..330c1ea523 100644 --- a/doc/man/ebrowse.1 +++ b/doc/man/ebrowse.1 @@ -1,5 +1,5 @@ .\" See section COPYING for copyright and redistribution information. -.TH EBROWSE 1 +.TH EBROWSE 1 "2008-12-14" "GNU Emacs" "GNU" .SH NAME ebrowse \- create a class hierarchy database .SH SYNOPSIS @@ -98,3 +98,7 @@ document into another language, under the above conditions for modified versions, except that this permission notice may be stated in a translation approved by the Free Software Foundation. . + +.\" Local Variables: +.\" time-stamp-pattern: "3/.TH EBROWSE 1 \"%Y-%02m-%02d\" \"GNU Emacs\" \"GNU\"$" +.\" End: diff --git a/doc/man/emacs.1.in b/doc/man/emacs.1.in index 5a164e98cd..3a5758e1aa 100644 --- a/doc/man/emacs.1.in +++ b/doc/man/emacs.1.in @@ -1,5 +1,5 @@ .\" See section COPYING for copyright and redistribution information. -.TH EMACS 1 "2007 April 13" "GNU Emacs @version@" +.TH EMACS 1 "2020-04-05" "GNU Emacs @version@" "GNU" . . .SH NAME @@ -673,3 +673,7 @@ document into another language, under the above conditions for modified versions, except that this permission notice may be stated in a translation approved by the Free Software Foundation. . + +.\" Local Variables: +.\" time-stamp-pattern: "3/.TH EMACS 1 \"%Y-%02m-%02d\" \"GNU Emacs @version@\" \"GNU\"$" +.\" End: diff --git a/doc/man/emacsclient.1 b/doc/man/emacsclient.1 index 3bdaafbfc5..9d14d0fe75 100644 --- a/doc/man/emacsclient.1 +++ b/doc/man/emacsclient.1 @@ -1,5 +1,5 @@ .\" See section COPYING for conditions for redistribution. -.TH EMACSCLIENT 1 +.TH EMACSCLIENT 1 "2019-08-02" "GNU Emacs" "GNU" .\" NAME should be all caps, SECTION should be 1-8, maybe w/ subsection .\" other params are allowed: see man(7), man(1) .SH NAME @@ -114,3 +114,7 @@ This manual page was written by Stephane Bortzmeyer , for the Debian GNU/Linux system (but may be used by others). .SH COPYING This manual page is in the public domain. + +.\" Local Variables: +.\" time-stamp-pattern: "3/.TH EMACSCLIENT 1 \"%Y-%02m-%02d\" \"GNU Emacs\" \"GNU\"$" +.\" End: diff --git a/doc/man/etags.1 b/doc/man/etags.1 index e10fb840ca..8053e863fc 100644 --- a/doc/man/etags.1 +++ b/doc/man/etags.1 @@ -1,5 +1,5 @@ .\" See section COPYING for copyright and redistribution information. -.TH etags 1 "23nov2001" "GNU Tools" "GNU Tools" +.TH ETAGS 1 "2019-06-24" "GNU Tools" "GNU" .de BP .sp .ti -.2i @@ -296,3 +296,7 @@ Permission is granted to copy and distribute translations of this document into another language, under the above conditions for modified versions, except that this permission notice may be stated in a translation approved by the Free Software Foundation. + +.\" Local Variables: +.\" time-stamp-pattern: "3/.TH ETAGS 1 \"%Y-%02m-%02d\" \"GNU Tools\" \"GNU\"$" +.\" End: commit 3ec6dcfab8af3714482d02f05ff6fb6d6af34606 Author: Michael Albinus Date: Mon Oct 12 11:41:54 2020 +0200 ; Fix dbus-tests.el formatting diff --git a/test/lisp/net/dbus-tests.el b/test/lisp/net/dbus-tests.el index f75f107dfb..4d34a1afd0 100644 --- a/test/lisp/net/dbus-tests.el +++ b/test/lisp/net/dbus-tests.el @@ -1118,10 +1118,12 @@ is in progress." (with-timeout (1 (dbus--test-timeout-handler)) (while (null dbus--test-signal-received) (read-event nil nil 0.1))) - ;; It returns three arguments, interface (a string), + ;; It returns three arguments, "interface" (a string), ;; "changed_properties" (an array of dict entries) and ;; "invalidated_properties" (an array of strings). - (should (equal dbus--test-signal-received `(,dbus--test-interface ((,property ("foo"))) ()))) + (should + (equal dbus--test-signal-received + `(,dbus--test-interface ((,property ("foo"))) ()))) (should (equal commit 2f92177f80fb375fdf38d6db0af9853e951e9b83 Author: Hugh Daschbach Date: Mon Oct 12 11:37:27 2020 +0200 Add interface arg to D-Bus PropertiesChanged signal. * lisp/net/dbus.el (dbus-register-property, dbus-property-handler): Fix signal generation. (Bug#43936) * test/lisp/net/dbus-tests.el (dbus-test06-register-property-emits-signal): Fix test. diff --git a/lisp/net/dbus.el b/lisp/net/dbus.el index 77ba5266dc..bb2420e1f4 100644 --- a/lisp/net/dbus.el +++ b/lisp/net/dbus.el @@ -1740,6 +1740,7 @@ clients from discovering the still incomplete interface. (when emits-signal (dbus-send-signal bus service path dbus-interface-properties "PropertiesChanged" + interface ;; changed_properties. (if (eq access :write) '(:array: :signature "{sv}") @@ -1818,6 +1819,7 @@ It will be registered for all objects created by `dbus-register-property'." (when (nth 1 object) (dbus-send-signal bus service path dbus-interface-properties "PropertiesChanged" + interface ;; changed_properties. (if (eq :write (car object)) '(:array: :signature "{sv}") diff --git a/test/lisp/net/dbus-tests.el b/test/lisp/net/dbus-tests.el index cd2e166c10..f75f107dfb 100644 --- a/test/lisp/net/dbus-tests.el +++ b/test/lisp/net/dbus-tests.el @@ -1118,10 +1118,10 @@ is in progress." (with-timeout (1 (dbus--test-timeout-handler)) (while (null dbus--test-signal-received) (read-event nil nil 0.1))) - ;; It returns two arguments, "changed_properties" (an array of - ;; dict entries) and "invalidated_properties" (an array of - ;; strings). - (should (equal dbus--test-signal-received `(((,property ("foo"))) ()))) + ;; It returns three arguments, interface (a string), + ;; "changed_properties" (an array of dict entries) and + ;; "invalidated_properties" (an array of strings). + (should (equal dbus--test-signal-received `(,dbus--test-interface ((,property ("foo"))) ()))) (should (equal @@ -1144,7 +1144,8 @@ is in progress." (read-event nil nil 0.1))) (should (equal - dbus--test-signal-received `(((,property ((1 2 3)))) ()))) + dbus--test-signal-received + `(,dbus--test-interface ((,property ((1 2 3)))) ()))) (should (equal