From: Michael Albinus Date: Fri, 5 Feb 2021 13:32:41 +0000 (+0100) Subject: Add command 'dbus-monitor' X-Git-Tag: emacs-28.0.90~3917 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=d5b1deb62e7fe56ccd88348e885a589ff8098106;p=emacs.git Add command 'dbus-monitor' * doc/misc/dbus.texi: (Monitoring Messages): Document 'dbus-monitor'. * etc/NEWS: Mention 'dbus-monitor' but 'dbus-register-monitor'. Fix typos and other oddities. * lisp/net/dbus.el (dbus-monitor): New command. * test/lisp/net/dbus-tests.el (dbus--test-register-service): Extend test. --- diff --git a/doc/misc/dbus.texi b/doc/misc/dbus.texi index e8e99db76ba..64636877938 100644 --- a/doc/misc/dbus.texi +++ b/doc/misc/dbus.texi @@ -2151,6 +2151,11 @@ And this form restricts the monitoring on D-Bus errors: @end lisp @end defun +@deffn Command dbus-monitor &optional bus +This command invokes @code{dbus-register-monitor} interactively, and +switches to the monitor buffer. +@end deffn + @node Index @unnumbered Index diff --git a/etc/NEWS b/etc/NEWS index 61efdc7b612..fb776884701 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -85,7 +85,7 @@ useful on systems such as FreeBSD which ships only with "etc/termcap". * Changes in Emacs 28.1 -** The new NonGNU ELPA archive is enabled by default alongside GNU ELPA +** The new NonGNU ELPA archive is enabled by default alongside GNU ELPA. ** Minibuffer scrolling is now conservative by default. This is controlled by the new variable 'scroll-minibuffer-conservatively'. @@ -221,10 +221,10 @@ It is not enabled by default. +++ ** Modifiers now go outside angle brackets in pretty-printed key bindings. -For example, with Control and Meta modifiers is now shown as -C-M- instead of . Either variant can be used as -input; functions such as 'kbd' and 'read-kbd-macro' accept both styles -as equivalent (they have done so for a long time). +For example, 'RET' with Control and Meta modifiers is now shown as +'C-M-' instead of ''. Either variant can be used +as input; functions such as 'kbd' and 'read-kbd-macro' accept both +styles as equivalent (they have done so for a long time). +++ ** New user option 'lazy-highlight-no-delay-length'. @@ -257,7 +257,7 @@ forms, but this command has now been changed to work more like When 'M-y' is typed not after a yank command, it activates the minibuffer where you can browse previous kills using the minibuffer history or completion. In Isearch, you can bind 'C-s M-y' to the command -`isearch-yank-pop' that uses the minibuffer with completion on +'isearch-yank-pop' that uses the minibuffer with completion on previous kills to read a string and append it to the search string. --- @@ -341,9 +341,10 @@ It used to be enabled when Emacs is started in GUI mode but not when started in text mode. The cursor still only actually blinks in GUI frames. ** pcase + +++ -*** The `pred` pattern can now take the form (pred (not FUN)). -This is like (pred (lambda (x) (not (FUN x)))) but results +*** The 'pred' pattern can now take the form '(pred (not FUN))'. +This is like '(pred (lambda (x) (not (FUN x))))' but results in better code. +++ @@ -403,7 +404,7 @@ disabled entirely. ** Windows +++ -*** New 'display-buffer' function 'display-buffer-use-least-recent-window' +*** New 'display-buffer' function 'display-buffer-use-least-recent-window'. This is like 'display-buffer-use-some-window', but won't reuse the current window, and when called repeatedly will try not to reuse a previously selected window. @@ -736,7 +737,7 @@ not. --- *** Respect 'message-forward-ignored-headers' more. -Previously, this variable would not be consulted if +Previously, this user option would not be consulted if 'message-forward-show-mml' was nil and forwarding as MIME. +++ @@ -857,7 +858,7 @@ deprecated. Errors in the Inscript method were corrected. --- *** New input method 'cham'. -There's also a Cham greeting in 'etc/HELLO'. +There's also a Cham greeting in "etc/HELLO". ** Ispell @@ -1395,13 +1396,13 @@ have been renamed to have "proper" public names and documented 'xref-show-definitions-buffer-at-bottom'). *** New command 'xref-quit-and-pop-marker-stack' and a binding for it -in Xref buffers ('M-,'). This combination is easy to press +in "*xref*" buffers ('M-,'). This combination is easy to press semi-accidentally if the user wants to go back in the middle of choosing the exact definition to go to, and this should do TRT. --- -*** New value 'project-relative' for 'xref-file-name-display' -If chosen, file names in *xref* buffers will be displayed relative +*** New value 'project-relative' for 'xref-file-name-display'. +If chosen, file names in "*xref*" buffers will be displayed relative to the 'project-root' of the current project, when available. ** json.el @@ -1424,9 +1425,9 @@ https://www.w3.org/TR/xml/#charsets). Now it rejects such strings. --- *** erc-services.el now supports NickServ passwords from auth-source. -The 'erc-use-auth-source-for-nickserv-password' variable enables querying -auth-source for NickServ passwords. To enable this, add the following -to your init file: +The 'erc-use-auth-source-for-nickserv-password' user option enables +querying auth-source for NickServ passwords. To enable this, add the +following to your init file: (setq erc-prompt-for-nickserv-password nil erc-use-auth-source-for-nickserv-password t) @@ -1591,18 +1592,18 @@ that makes it a valid button. 'string-clean-whitespace', 'string-fill', 'string-limit', 'string-lines', 'string-pad' and 'string-chop-newline'. -*** New macro `named-let` that provides Scheme's "named let" looping construct +*** New macro 'named-let' that provides Scheme's "named let" looping construct. ** thingatpt +++ *** New variable 'thing-at-point-provider-alist'. -This allows mode-specific alterations to how `thing-at-point' works. +This allows mode-specific alterations to how 'thing-at-point' works. ** Miscellaneous +++ -*** New command `C-x C-k Q' to force redisplay in keyboard macros. +*** New command 'C-x C-k Q' to force redisplay in keyboard macros. --- *** New user option 'remember-diary-regexp'. @@ -1616,8 +1617,8 @@ This function returns some statistics about the line lengths in a buffer. +++ *** New variable 'inhibit-interaction' to make user prompts signal an error. If this is bound to something non-nil, functions like -`read-from-minibuffer', `read-char' (and related) will signal an -`inhibited-interaction' error. +'read-from-minibuffer', 'read-char' (and related) will signal an +'inhibited-interaction' error. --- *** 'process-attributes' now works under OpenBSD, too. @@ -1888,14 +1889,12 @@ Otherwise, it will use 'xwidget-webkit-last-session'. +++ *** New user options to customize Flymake's mode-line. - -The new customization variable 'flymake-mode-line-format' is a mix of -strings and symbols like 'flymake-mode-line-title' , -'flymake-mode-line-exception' and 'flymake-mode-line-counters'. The -new customization variable 'flymake-mode-line-counter-format' is a mix -of strings and symbols like 'flymake-mode-line-error-counter', -'flymake-mode-line-warning-counter' and -'flymake-mode-line-note-counter'. +The new user option 'flymake-mode-line-format' is a mix of strings and +symbols like 'flymake-mode-line-title', 'flymake-mode-line-exception' +and 'flymake-mode-line-counters'. The new user option +'flymake-mode-line-counter-format' is a mix of strings and symbols +like 'flymake-mode-line-error-counter', +'flymake-mode-line-warning-counter' and 'flymake-mode-line-note-counter'. ** Flyspell mode @@ -1954,7 +1953,7 @@ type symbols. Both functions propagate D-Bus errors. messages, contain the error name of that message now. +++ -*** D-Bus messages can be monitored with new function 'dbus-register-monitor'. +*** D-Bus messages can be monitored with the new command 'dbus-monitor'. +++ *** D-Bus events have changed their internal structure. @@ -2178,13 +2177,13 @@ ledit.el, lmenu.el, lucid.el and old-whitespace.el. 'vcursor-toggle-vcursor-map', 'w32-focus-frame', 'w32-select-font', 'wisent-lex-make-token-table'. -** The 'when' argument of `make-obsolete` and related functions is mandatory. -The use of those functions without a 'when' argument was marked -obsolete back in Emacs-23.1. The affected functions are: -make-obsolete, define-obsolete-function-alias, make-obsolete-variable, -define-obsolete-variable-alias. +** The WHEN argument of 'make-obsolete' and related functions is mandatory. +The use of those functions without a WHEN argument was marked obsolete +back in Emacs 23.1. The affected functions are: 'make-obsolete', +'define-obsolete-function-alias', 'make-obsolete-variable', +'define-obsolete-variable-alias'. -** The variable 'keyboard-type' is obsolete and not dynamically scoped any more +** The variable 'keyboard-type' is obsolete and not dynamically scoped any more. * Lisp Changes in Emacs 28.1 diff --git a/lisp/net/dbus.el b/lisp/net/dbus.el index 195ddc6bbac..a9de35c814f 100644 --- a/lisp/net/dbus.el +++ b/lisp/net/dbus.el @@ -2171,6 +2171,23 @@ has been handled by this function." (when eobp (goto-char (point-max)))))) +;;;###autoload +(defun dbus-monitor (&optional bus) + "Invoke `dbus-register-monitor' interactively, and switch to the buffer. +BUS is either a Lisp keyword, `:system' or `:session', or a +string denoting the bus address. The value nil defaults to `:session'." + (interactive + (list + (let ((input + (completing-read + (format-prompt "Enter bus symbol or name" :session) + '(:system :session) nil nil nil nil :session))) + (if (and (stringp input) + (string-match-p "^\\(:session\\|:system\\)$" input)) + (intern input) input)))) + (dbus-register-monitor (or bus :session)) + (switch-to-buffer (get-buffer-create "*D-Bus Monitor*"))) + (defun dbus-handle-bus-disconnect () "React to a bus disconnection. BUS is the bus that disconnected. This routine unregisters all diff --git a/test/lisp/net/dbus-tests.el b/test/lisp/net/dbus-tests.el index 34a2af188f0..53c786ada48 100644 --- a/test/lisp/net/dbus-tests.el +++ b/test/lisp/net/dbus-tests.el @@ -465,6 +465,14 @@ (should (eq (dbus-unregister-service bus dbus--test-service) :non-existent)) (should-not (member dbus--test-service (dbus-list-known-names bus))) + ;; A service name is a string, constructed of at least two words + ;; separated by ".". + (should + (equal + (butlast + (should-error (dbus-register-service bus "s"))) + `(dbus-error ,dbus-error-invalid-args))) + ;; `dbus-service-dbus' is reserved for the BUS itself. (should (equal