commit c50643cebd762ca77c6f2bc90264e4ef04dcb43d (HEAD, refs/remotes/origin/master) Author: Andrew G Cohen Date: Wed Sep 9 09:58:39 2020 +0800 Add Gnus function to make a persistent group from a search result * lisp/gnus/gnus-sum.el (gnus-summary-make-group-from-search): New command (bound to C-c C-p in summary buffers). * doc/misc/gnus.texi (What is nnir?): Document it. Correct previous errors. * etc/NEWS (Gnus): Mention it. diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi index 60441669d8..176411a64b 100644 --- a/doc/misc/gnus.texi +++ b/doc/misc/gnus.texi @@ -21452,19 +21452,29 @@ maintained outside of Gnus. @subsection Basic Usage In the group buffer typing @kbd{G G} will search the group on the -current line by calling @code{gnus-group-make-search-group}. This prompts -for a query string, creates an ephemeral @code{nnselect} group containing -the articles that match this query, and takes you to a summary buffer -showing these articles. Articles may then be read, moved and deleted -using the usual commands. - -The @code{nnselect} group made in this way is an @code{ephemeral} -group, and will disappear upon exit from the group. However changes -made in the group are permanently reflected in the real groups from -which the articles are drawn. It is occasionally convenient to view -articles found through searching in their original group. You can -@emph{warp} (i.e., jump) to the original group for the article on the -current line with @kbd{A W}, aka @code{gnus-warp-to-article}. +current line by calling @code{gnus-group-read-ephemeral-search-group}. +This prompts for a query string, creates an ephemeral @code{nnselect} +group containing the articles that match this query, and takes you to +a summary buffer showing these articles. Articles may then be read, +moved and deleted using the usual commands. + +The @code{nnselect} group made in this way is @code{ephemeral}: it +will disappear upon exit from the group. However changes made in the +group are permanently reflected in the real groups from which the +articles are drawn. If you want to create a @emph{persistent} group +that sticks around after exit from the summary buffer, you can call +@code{gnus-group-make-search-group} (bound to @kbd{G g}). + +So you just performed a search whose results are so fabulous you +wished you had done a persistent search rather than an ephemeral one? +No problem; you can create such a group by calling +@code{gnus-summary-make-group-from-search} (bound to @kbd{C-c C-p}) +from the ephemeral summary buffer. + +It is occasionally convenient to view articles found through searching +in their original group. You can @emph{warp} (i.e., jump) to the +original group for the article on the current line with @kbd{A W}, aka +@code{gnus-warp-to-article}. You say you want to search more than just the group on the current line? No problem: just process-mark the groups you want to search. You want @@ -21472,16 +21482,17 @@ even more? Calling for an nnir search with the cursor on a topic heading will search all the groups under that heading. Still not enough? OK, in the server buffer -@code{gnus-group-make-search-group} (now bound to @kbd{G}) will search -all groups from the server on the current line. Too much? Want to -ignore certain groups when searching, like spam groups? Just +@code{gnus-group-read-ephemeral-search-group} (now bound to @kbd{G}) +will search all groups from the server on the current line. Too much? +Want to ignore certain groups when searching, like spam groups? Just customize @code{nnir-ignored-newsgroups}. One more thing: individual search engines may have special search -features. You can access these special features by giving a prefix-arg -to @code{gnus-group-make-search-group}. If you are searching multiple -groups with different search engines you will be prompted for the -special search features for each engine separately. +features. You can access these special features by giving a +prefix-arg to @code{gnus-group-read-ephemeral-search-group}. If you +are searching multiple groups with different search engines you will +be prompted for the special search features for each engine +separately. @node Setting up nnir diff --git a/etc/NEWS b/etc/NEWS index fd6cdbe3b4..76f44f2ce6 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -333,12 +333,18 @@ arbitrary list of articles that may come from multiple groups and servers. These groups generally behave like any other group: they may be ephemeral or persistent, and allow article marking, moving, deletion, etc. 'nnselect' groups may be created like any other group, -but there is also a convenience function for the common case of +but there are three convenience functions for the common case of obtaining the list of articles as a result of a search: 'gnus-group-make-search-group' ('G g') that will prompt for an 'nnir' -search query and create a dedicated group for that search. As part of -this addition, the user option 'nnir-summary-line-format' has been -removed; its functionality is now available directly in the +search query and create a persistent group for that search; +'gnus-group-read-ephemeral-search-group' ('G G') that will prompt for +an 'nnir' search query and create an ephemeral group for that search; +and 'gnus-summary-make-group-from-search' ('C-c C-p') that will create +a persistent group with the search parameters of a current ephemeral +search group. + +As part of this addition, the user option 'nnir-summary-line-format' +has been removed; its functionality is now available directly in the 'gnus-summary-line-format' specs '%G' and '%g'. The user option 'gnus-refer-thread-use-nnir' has been renamed to 'gnus-refer-thread-use-search'. diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el index 80427434bd..45397b518c 100644 --- a/lisp/gnus/gnus-sum.el +++ b/lisp/gnus/gnus-sum.el @@ -87,6 +87,7 @@ (autoload 'gnus-article-outlook-rearrange-citation "deuglify" nil t) (autoload 'nnselect-article-rsv "nnselect" nil nil) (autoload 'nnselect-article-group "nnselect" nil nil) +(autoload 'gnus-nnselect-group-p "nnselect" nil nil) (defcustom gnus-kill-summary-on-exit t "If non-nil, kill the summary buffer when you exit from it. @@ -1989,6 +1990,7 @@ increase the score of each group you read." "\M-K" gnus-summary-edit-global-kill ;; "V" gnus-version "\C-c\C-d" gnus-summary-describe-group + "\C-c\C-p" gnus-summary-make-group-from-search "q" gnus-summary-exit "Q" gnus-summary-exit-no-update "\C-c\C-i" gnus-info-find-node @@ -7120,6 +7122,21 @@ The prefix argument ALL means to select all articles." (setq info (copy-sequence (gnus-get-info group)) info (delq (gnus-info-params info) info)))))))))) +(defun gnus-summary-make-group-from-search () + "Make a persistent group from the current ephemeral search group." + (interactive) + (if (not (gnus-nnselect-group-p gnus-newsgroup-name)) + (gnus-message 3 "%s is not a search group" gnus-newsgroup-name) + (let ((name (gnus-read-group "Group name: "))) + (with-current-buffer gnus-group-buffer + (gnus-group-make-group + name + (list 'nnselect "nnselect") + nil + (list (cons 'nnselect-specs + (gnus-group-get-parameter gnus-newsgroup-name + 'nnselect-specs t)))))))) + (defun gnus-summary-save-newsrc (&optional force) "Save the current number of read/marked articles in the dribble buffer. The dribble buffer will then be saved. commit 45c0bbb9215eacf9627478a0d60bfb3b716bf657 Author: Lars Ingebrigtsen Date: Tue Sep 8 23:10:50 2020 +0200 Allow DEFAULT in format-prompt to be a list * doc/lispref/minibuf.texi (Text from Minibuffer): Document it. * lisp/minibuffer.el (format-prompt): Allow DEFAULT to be a list (and use the first element). This is how many of the prompting functions interpret their default parameters. diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi index cca06c70a5..d30114f768 100644 --- a/doc/lispref/minibuf.texi +++ b/doc/lispref/minibuf.texi @@ -440,6 +440,8 @@ case no default values are displayed. If @var{default} is @code{nil}, there is no default value, and therefore no ``default value'' string is included in the result value. +If @var{default} is a non-@code{nil} list, the first element of the +list is used in the prompt. @end defun @node Object from Minibuffer diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index 6deb1eb077..62a33f3e2d 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -3859,6 +3859,9 @@ FORMAT-ARGS is non-nil, PROMPT is used as a format control string, and FORMAT-ARGS are the arguments to be substituted into it. See `format' for details. +If DEFAULT is a list, the first element is used as the default. +If not, the element is used as is. + If DEFAULT is nil, no \"default value\" string is included in the return value." (concat @@ -3866,7 +3869,10 @@ return value." prompt (apply #'format prompt format-args)) (and default - (format minibuffer-default-prompt-format default)) + (format minibuffer-default-prompt-format + (if (consp default) + (car default) + default))) ": ")) (provide 'minibuffer) commit 9c42f1f7f0a34dcfaee92c10964a61ee49770ac3 Author: Win Treese Date: Tue Sep 8 15:32:15 2020 -0400 Fix crash from clicking on menu bar (bug#34762, bug#26982) * src/nsmenu.m (ns_update_menubar): Remove extraneous use of autorelease pool. diff --git a/src/nsmenu.m b/src/nsmenu.m index e313fc03f4..a286a80da1 100644 --- a/src/nsmenu.m +++ b/src/nsmenu.m @@ -122,7 +122,6 @@ /*fprintf (stderr, "ns_update_menubar: frame: %p\tdeep: %d\tsub: %p\n", f, deep_p, submenu); */ block_input (); - pool = [[NSAutoreleasePool alloc] init]; /* Menu may have been created automatically; if so, discard it. */ if ([menu isKindOfClass: [EmacsMenu class]] == NO) @@ -240,7 +239,6 @@ [[submenu title] UTF8String]); discard_menu_items (); unbind_to (specpdl_count, Qnil); - [pool release]; unblock_input (); return; } @@ -298,7 +296,6 @@ free_menubar_widget_value_tree (first_wv); discard_menu_items (); unbind_to (specpdl_count, Qnil); - [pool release]; unblock_input (); return; } @@ -364,7 +361,6 @@ if (NILP (items)) { free_menubar_widget_value_tree (first_wv); - [pool release]; unblock_input (); return; } @@ -395,7 +391,6 @@ if (i == n) { free_menubar_widget_value_tree (first_wv); - [pool release]; unblock_input (); return; } @@ -454,7 +449,6 @@ if (needsSet) [NSApp setMainMenu: menu]; - [pool release]; unblock_input (); } commit 60de60b35079eecbadf65e2fa71d1098f9040055 Author: Lars Ingebrigtsen Date: Tue Sep 8 22:41:33 2020 +0200 Revert "Use format-prompt in calls to read-from-minibuffer with default value" This reverts commit 1921d2176bb9127d2483a1c8a470abfc3f4eec33. The DEFAULT-VALUE here isn't really a default value (since READ is nil), so don't say there's a default. diff --git a/lisp/simple.el b/lisp/simple.el index 86db34a5c5..3b2b5c92e9 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -2200,12 +2200,12 @@ Normally, history elements are matched case-insensitively if makes the search case-sensitive." (interactive (let* ((enable-recursive-minibuffers t) - (regexp (read-from-minibuffer - (format-prompt "Next element matching (regexp)" - (car minibuffer-history-search-history)) - nil minibuffer-local-map nil - 'minibuffer-history-search-history - (car minibuffer-history-search-history)))) + (regexp (read-from-minibuffer "Next element matching (regexp): " + nil + minibuffer-local-map + nil + 'minibuffer-history-search-history + (car minibuffer-history-search-history)))) ;; Use the last regexp specified, by default, if input is empty. (list (if (string= regexp "") (if minibuffer-history-search-history diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index 56c936e773..d8f932e7a4 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el @@ -1028,7 +1028,7 @@ function `tab-bar-tab-name-function'." (tab-index (or current-prefix-arg (1+ (tab-bar--current-tab-index tabs)))) (tab-name (alist-get 'name (nth (1- tab-index) tabs)))) (list (read-from-minibuffer - (format-prompt "New name for tab" tab-name) + "New name for tab (leave blank for automatic naming): " nil nil nil nil tab-name) current-prefix-arg))) (let* ((tabs (funcall tab-bar-tabs-function)) @@ -1057,7 +1057,7 @@ function `tab-bar-tab-name-function'." (alist-get 'name tab)) (funcall tab-bar-tabs-function))))) (list tab-name (read-from-minibuffer - (format-prompt "New name for tab" tab-name) + "New name for tab (leave blank for automatic naming): " nil nil nil nil tab-name)))) (tab-bar-rename-tab new-name (1+ (tab-bar--tab-index-by-name tab-name)))) commit e90054bc3105feaba6544b214ecd60980e8a8722 Author: Lars Ingebrigtsen Date: Tue Sep 8 22:07:17 2020 +0200 Doc string update for tramp-password-prompt-regexp * lisp/net/tramp.el (tramp-password-prompt-regexp): Mention password-word-equivalents in the doc string. diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 96446399dd..2ae28b8758 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -584,6 +584,11 @@ This regexp must match both `tramp-initial-end-of-output' and "Regexp matching password-like prompts. The regexp should match at end of buffer. +This variable is, by default, initialised from +`password-word-equivalents' when tramp is loaded, and it is +usually more convenient to add new passphrases to that variable +instead of altering this variable. + The `sudo' program appears to insert a `^@' character into the prompt." :version "24.4" :type 'regexp) commit 3e5259a268d423ef3b6a0ffcfe05ac623bbe7f25 Author: Daniel Martín Date: Tue Sep 8 14:18:17 2020 +0200 Use mouse-wheel-up-event in mwheel-tests.el Enabling mouse-wheel-mode binds two different mouse events, depending on the operating system. The correct way to check for those events is by checking mouse-wheel-up-event, as explained in the ELisp manual. * test/lisp/mwheel-tests.el (mwheel-test-enable/disable): Check mouse-wheel-up-event instead of mouse-4 to make the test work irrespective of the platform it's running. diff --git a/test/lisp/mwheel-tests.el b/test/lisp/mwheel-tests.el index fd998fd4f0..315f25edae 100644 --- a/test/lisp/mwheel-tests.el +++ b/test/lisp/mwheel-tests.el @@ -24,9 +24,9 @@ (ert-deftest mwheel-test-enable/disable () (mouse-wheel-mode 1) - (should (eq (lookup-key (current-global-map) '[mouse-4]) 'mwheel-scroll)) + (should (eq (lookup-key (current-global-map) `[,mouse-wheel-up-event]) 'mwheel-scroll)) (mouse-wheel-mode -1) - (should (eq (lookup-key (current-global-map) '[mouse-4]) nil))) + (should (eq (lookup-key (current-global-map) `[,mouse-wheel-up-event]) nil))) (ert-deftest mwheel-test--create-scroll-keys () (should (equal (mouse-wheel--create-scroll-keys 10 'mouse-4) commit 7865b4044d7520bcf4053ef5d763019dae499a08 Author: Glenn Morris Date: Tue Sep 8 07:43:53 2020 -0700 Skip failing cperl test on hydra * test/lisp/progmodes/cperl-mode-tests.el (cperl-mode-test-bug-10483): Skip on hydra.nixos.org. diff --git a/test/lisp/progmodes/cperl-mode-tests.el b/test/lisp/progmodes/cperl-mode-tests.el index 4e477a40e8..2eaf633d17 100644 --- a/test/lisp/progmodes/cperl-mode-tests.el +++ b/test/lisp/progmodes/cperl-mode-tests.el @@ -110,11 +110,13 @@ indentation actually takes place.." (message "%s" (buffer-string))))) (ert-deftest cperl-mode-test-bug-10483 () - "Verifies that a piece of code which ends in a paren without a -statement terminato ron tne same line does not loop forever. The -test starts an asynchronous Emacs batch process under timeout -control." + "Check that indenting certain perl code does not loop forever. +This verifies that indenting a piece of code that ends in a paren +without a statement terminator on the same line does not loop +forever. The test starts an asynchronous Emacs batch process +under timeout control." (interactive) + (skip-unless (not (getenv "EMACS_HYDRA_CI"))) ; FIXME times out (let* ((emacs (concat invocation-directory invocation-name)) (test-function 'cperl-mode-test--run-bug-10483) (test-function-name (symbol-name test-function)) commit 6f3067936560c1a91917eb797fcc0e3d61283b60 Author: Michael Albinus Date: Tue Sep 8 16:24:22 2020 +0200 * etc/NEWS: Add D-Bus changes. diff --git a/etc/NEWS b/etc/NEWS index 407e1c4198..fd6cdbe3b4 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -953,9 +953,9 @@ window after starting). This variable defaults to nil. ** Miscellaneous --- -*** 'icomplete-show-matches-on-no-input' behavior change +*** 'icomplete-show-matches-on-no-input' behavior change. Previously, choosing a different completion with commands like 'C-.' -and then hitting enter would choose the default completion. Doing +and then hitting 'RET' would choose the default completion. Doing this will now choose the completion under point. +++ @@ -1083,12 +1083,21 @@ The old names are now obsolete. ** D-Bus ++++ +*** Property values can be typed explicitly. +'dbus-register-property' and 'dbus-set-property' accept now optional +type symbols. + +++ *** Registered properties can have the new access type ':write'. +++ *** In case of problems, handlers can emit proper D-Bus error messages now. +--- +*** D-Bus errors, which have been converted from incoming D-Bus error +messages, contain the error name of that message now. + * New Modes and Packages in Emacs 28.1 commit 39230fadbc7eb5428246334d7e41936e5c06254d Author: Michael Albinus Date: Tue Sep 8 16:24:11 2020 +0200 Implement typed D-Bus properties (Bug#43252) * doc/misc/dbus.texi (Properties and Annotations) (Receiving Method Call): Document optional type symbol in `dbus-set-property' and `dbus-register-property'. * lisp/net/dbus.el (dbus-error-unknown-interface) (dbus-error-unknown-method, dbus-error-unknown-object) (dbus-error-unknown-property): New defconsts. (dbus-peer-handler): Improve error handling. (dbus-introspect-get-signature): Handle also properties. (dbus-set-property, dbus-register-property): Allow optional TYPE symbol for VALUE. (Bug#43252) (dbus-property-handler): Implement property types. Improve error handling. * src/dbusbind.c (dbus-message-internal, dbus-registered-objects-table): Fix docstring. * test/lisp/net/dbus-tests.el (dbus-test05-register-property): Extend test. (dbus-test05-register-property-several-paths): New test. diff --git a/doc/misc/dbus.texi b/doc/misc/dbus.texi index a68cb26a3e..4b2a5dc212 100644 --- a/doc/misc/dbus.texi +++ b/doc/misc/dbus.texi @@ -744,16 +744,17 @@ result can be any valid D-Bus value, or @code{nil} if there is no @end lisp @end defun -@defun dbus-set-property bus service path interface property value +@defun dbus-set-property bus service path interface property [type] value This function sets the value of @var{property} of @var{interface} to @var{value}. It will be checked at @var{bus}, @var{service}, -@var{path}. When the value is successfully set, this function returns -@var{value}. Otherwise, it returns @code{nil}. Example: +@var{path}. @var{value} can be preceded by a @var{type} symbol. When +the value is successfully set, this function returns @var{value}. +Otherwise, it returns @code{nil}. Example: @lisp (dbus-set-property :session "org.kde.kaccess" "/MainApplication" - "com.trolltech.Qt.QApplication" "doubleClickInterval" 500) + "com.trolltech.Qt.QApplication" "doubleClickInterval" :uint16 500) @result{} 500 @end lisp @@ -1561,7 +1562,7 @@ The test then runs @end example @end defun -@defun dbus-register-property bus service path interface property access value &optional emits-signal dont-register-service +@defun dbus-register-property bus service path interface property access [type] value &optional emits-signal dont-register-service With this function, an application declares a @var{property} on the D-Bus @var{bus}. @@ -1579,9 +1580,11 @@ discussion of @var{dont-register-service} below). @var{access} indicates, whether the property can be changed by other services via D-Bus. It must be either the symbol @code{:read}, -@code{:write} or @code{:readwrite}. @var{value} is the initial value -of the property, it can be of any valid type (@xref{dbus-call-method}, -for details). +@code{:write} or @code{:readwrite}. + +@var{value} is the initial value of the property, it can be of any +valid type (@xref{dbus-call-method}, for details). @var{value} can be +preceded by a @var{type} symbol. If @var{property} already exists on @var{path}, it will be overwritten. For properties with access type @code{:read} this is the diff --git a/lisp/net/dbus.el b/lisp/net/dbus.el index ba6a66d79c..525036caed 100644 --- a/lisp/net/dbus.el +++ b/lisp/net/dbus.el @@ -168,6 +168,19 @@ See /usr/include/dbus-1.0/dbus/dbus-protocol.h.") (concat dbus-error-dbus ".PropertyReadOnly") "Property you tried to set is read-only.") +(defconst dbus-error-unknown-interface + (concat dbus-error-dbus ".UnknownInterface") + "Interface you invoked a method on isn't known by the object.") + +(defconst dbus-error-unknown-method (concat dbus-error-dbus ".UnknownMethod") + "Method name you invoked isn't known by the object you invoked it on.") + +(defconst dbus-error-unknown-object (concat dbus-error-dbus ".UnknownObject") + "Object you invoked a method on isn't known.") + +(defconst dbus-error-unknown-property (concat dbus-error-dbus ".UnknownProperty") + "Property you tried to access isn't known by the object.") + ;;; Emacs defaults. (defconst dbus-service-emacs "org.gnu.Emacs" @@ -1184,7 +1197,8 @@ check whether SERVICE is already running, you can instead write "Default handler for the \"org.freedesktop.DBus.Peer\" interface. It will be registered for all objects created by `dbus-register-service'." (let* ((last-input-event last-input-event) - (method (dbus-event-member-name last-input-event))) + (method (dbus-event-member-name last-input-event)) + (path (dbus-event-path-name last-input-event))) (cond ;; "Ping" does not return an output parameter. ((string-equal method "Ping") @@ -1194,7 +1208,11 @@ It will be registered for all objects created by `dbus-register-service'." (signal 'dbus-error (list - (format "%s.GetMachineId not implemented" dbus-interface-peer))))))) + (format "%s.GetMachineId not implemented" dbus-interface-peer)))) + (t `(:error ,dbus-error-unknown-method + ,(format-message + "No such method \"%s.%s\" at path \"%s\"" + dbus-interface-peer method path)))))) ;;; D-Bus introspection. @@ -1386,37 +1404,38 @@ string and a member of the list returned by (defun dbus-introspect-get-signature (bus service path interface name &optional direction) - "Return signature of a `method' or `signal' represented by NAME as a string. + "Return signature of a `method', `property' or `signal' represented by NAME. If NAME is a `method', DIRECTION can be either \"in\" or \"out\". If DIRECTION is nil, \"in\" is assumed. -If NAME is a `signal', and DIRECTION is non-nil, DIRECTION must -be \"out\"." +If NAME is a `signal' or a `property', DIRECTION is ignored." ;; For methods, we use "in" as default direction. (let ((object (or (dbus-introspect-get-method bus service path interface name) (dbus-introspect-get-signal + bus service path interface name) + (dbus-introspect-get-property bus service path interface name)))) - (when (and (string-equal - "method" (dbus-introspect-get-attribute object "name")) - (not (stringp direction))) + (when (and (eq 'method (car object)) (not (stringp direction))) (setq direction "in")) ;; In signals, no direction is given. - (when (string-equal "signal" (dbus-introspect-get-attribute object "name")) + (when (eq 'signal (car object)) (setq direction nil)) ;; Collect the signatures. - (mapconcat - (lambda (x) - (let ((arg (dbus-introspect-get-argument - bus service path interface name x))) - (if (or (not (stringp direction)) - (string-equal - direction - (dbus-introspect-get-attribute arg "direction"))) - (dbus-introspect-get-attribute arg "type") - ""))) - (dbus-introspect-get-argument-names bus service path interface name) - ""))) + (if (eq 'property (car object)) + (dbus-introspect-get-attribute object "type") + (mapconcat + (lambda (x) + (let ((arg (dbus-introspect-get-argument + bus service path interface name x))) + (if (or (not (stringp direction)) + (string-equal + direction + (dbus-introspect-get-attribute arg "direction"))) + (dbus-introspect-get-attribute arg "type") + ""))) + (dbus-introspect-get-argument-names bus service path interface name) + "")))) ;;; D-Bus properties. @@ -1432,20 +1451,23 @@ valid D-Bus value, or nil if there is no PROPERTY, or PROPERTY cannot be read." bus service path dbus-interface-properties "Get" :timeout 500 interface property)))) -(defun dbus-set-property (bus service path interface property value) +(defun dbus-set-property (bus service path interface property &rest args) "Set value of PROPERTY of INTERFACE to VALUE. -It will be checked at BUS, SERVICE, PATH. When the value is -successfully set return VALUE. Otherwise, return nil." +It will be checked at BUS, SERVICE, PATH. VALUE can be preceded +by a TYPE symbol. When the value is successfully set return +VALUE. Otherwise, return nil. + +\(dbus-set-property BUS SERVICE PATH INTERFACE PROPERTY [TYPE] VALUE)" (dbus-ignore-errors ;; "Set" requires a variant. (dbus-call-method bus service path dbus-interface-properties - "Set" :timeout 500 interface property (list :variant value)) + "Set" :timeout 500 interface property (cons :variant args)) ;; Return VALUE. The property could have the `:write' access type, ;; so we ignore errors in `dbus-get-property'. - (or - (dbus-ignore-errors (dbus-get-property bus service path interface property)) - value))) + (dbus-ignore-errors + (or (dbus-get-property bus service path interface property) + (if (symbolp (car args)) (cadr args) (car args)))))) (defun dbus-get-all-properties (bus service path interface) "Return all properties of INTERFACE at BUS, SERVICE, PATH. @@ -1481,8 +1503,7 @@ Filter out matching PATH." dbus-registered-objects-table))) (defun dbus-register-property - (bus service path interface property access value - &optional emits-signal dont-register-service) + (bus service path interface property access &rest args) "Register PROPERTY on the D-Bus BUS. BUS is either a Lisp symbol, `:system' or `:session', or a string @@ -1496,9 +1517,11 @@ discussion of DONT-REGISTER-SERVICE below). INTERFACE is the name of the interface used at PATH, PROPERTY is the name of the property of INTERFACE. ACCESS indicates, whether the property can be changed by other services via D-Bus. It must be either -the symbol `:read', `:write' or `:readwrite'. VALUE is the -initial value of the property, it can be of any valid type (see -`dbus-call-method' for details). +the symbol `:read', `:write' or `:readwrite'. + +VALUE is the initial value of the property, it can be of any +valid type (see `dbus-call-method' for details). VALUE can be +preceded by a TYPE symbol. If PROPERTY already exists on PATH, it will be overwritten. For properties with access type `:read' this is the only way to @@ -1516,52 +1539,72 @@ not registered. This means that other D-Bus clients have no way of noticing the newly registered property. When interfaces are constructed incrementally by adding single methods or properties at a time, DONT-REGISTER-SERVICE can be used to prevent other -clients from discovering the still incomplete interface." - (unless (member access '(:read :write :readwrite)) - (signal 'wrong-type-argument (list "Access type invalid" access))) - - ;; Add handlers for the three property-related methods. - (dbus-register-method - bus service path dbus-interface-properties "Get" - #'dbus-property-handler 'dont-register) - (dbus-register-method - bus service path dbus-interface-properties "GetAll" - #'dbus-property-handler 'dont-register) - (dbus-register-method - bus service path dbus-interface-properties "Set" - #'dbus-property-handler 'dont-register) - - ;; Register SERVICE. - (unless (or dont-register-service (member service (dbus-list-names bus))) - (dbus-register-service bus service)) - - ;; Send the PropertiesChanged signal. - (when emits-signal - (dbus-send-signal - bus service path dbus-interface-properties "PropertiesChanged" - (if (member access '(:read :readwrite)) - `(:array (:dict-entry ,property (:variant ,value))) - '(:array: :signature "{sv}")) - (if (eq access :write) - `(:array ,property) - '(:array)))) - - ;; Create a hash table entry. We use nil for the unique name, - ;; because the property might be accessed from anybody. - (let ((key (list :property bus interface property)) - (val - (cons - (list - nil service path - (cons - (if emits-signal (list access :emits-signal) (list access)) - value)) - (dbus-get-other-registered-properties - bus service path interface property)))) - (puthash key val dbus-registered-objects-table) - - ;; Return the object. - (list key (list service path)))) +clients from discovering the still incomplete interface. + +\(dbus-register-property BUS SERVICE PATH INTERFACE PROPERTY ACCESS \ +[TYPE] VALUE &optional EMITS-SIGNAL DONT-REGISTER-SERVICE)" + (let ((type (when (symbolp (car args)) (pop args))) + (value (pop args)) + (emits-signal (pop args)) + (dont-register-service (pop args))) + (unless (member access '(:read :write :readwrite)) + (signal 'wrong-type-argument (list "Access type invalid" access))) + (unless type + (setq type + (cond + ((memq value '(t nil)) :boolean) + ((natnump value) :uint32) + ((fixnump value) :int32) + ((floatp value) :double) + ((stringp value) :string) + (t + (signal 'wrong-type-argument (list "Value type invalid" value)))))) + + ;; Add handlers for the three property-related methods. + (dbus-register-method + bus service path dbus-interface-properties "Get" + #'dbus-property-handler 'dont-register) + (dbus-register-method + bus service path dbus-interface-properties "GetAll" + #'dbus-property-handler 'dont-register) + (dbus-register-method + bus service path dbus-interface-properties "Set" + #'dbus-property-handler 'dont-register) + + ;; Register SERVICE. + (unless (or dont-register-service (member service (dbus-list-names bus))) + (dbus-register-service bus service)) + + ;; Send the PropertiesChanged signal. + (when emits-signal + (dbus-send-signal + bus service path dbus-interface-properties "PropertiesChanged" + (if (member access '(:read :readwrite)) + `(:array + (:dict-entry + ,property + ,(if type (list :variant type value) (list :variant value)))) + '(:array: :signature "{sv}")) + (if (eq access :write) + `(:array ,property) + '(:array)))) + + ;; Create a hash table entry. We use nil for the unique name, + ;; because the property might be accessed from anybody. + (let ((key (list :property bus interface property)) + (val + (cons + (list + nil service path + (cons + (if emits-signal (list access :emits-signal) (list access)) + (if type (list type value) (list value)))) + (dbus-get-other-registered-properties + bus service path interface property)))) + (puthash key val dbus-registered-objects-table) + + ;; Return the object. + (list key (list service path))))) (defun dbus-property-handler (&rest args) "Default handler for the \"org.freedesktop.DBus.Properties\" interface. @@ -1580,7 +1623,7 @@ It will be registered for all objects created by `dbus-register-property'." (object (car (last (car entry))))) (cond ((not (consp object)) - `(:error ,dbus-error-invalid-args + `(:error ,dbus-error-unknown-property ,(format-message "No such property \"%s\" at path \"%s\"" property path))) ((memq :write (car object)) @@ -1588,7 +1631,7 @@ It will be registered for all objects created by `dbus-register-property'." ,(format-message "Property \"%s\" at path \"%s\" is not readable" property path))) ;; Return the result. - (t `((:variant ,(cdar (last (car entry))))))))) + (t (list :variant (cdar (last (car entry)))))))) ;; "Set" expects a variant. ((string-equal method "Set") @@ -1598,7 +1641,7 @@ It will be registered for all objects created by `dbus-register-property'." (object (car (last (car entry))))) (cond ((not (consp object)) - `(:error ,dbus-error-invalid-args + `(:error ,dbus-error-unknown-property ,(format-message "No such property \"%s\" at path \"%s\"" property path))) ((memq :read (car object)) @@ -1606,8 +1649,10 @@ It will be registered for all objects created by `dbus-register-property'." ,(format-message "Property \"%s\" at path \"%s\" is not writable" property path))) (t (puthash (list :property bus interface property) - (cons (append (butlast (car entry)) - (list (cons (car object) value))) + (cons (append + (butlast (car entry)) + ;; Reuse ACCESS und TYPE from registration. + (list (list (car object) (cadr object) value))) (dbus-get-other-registered-properties bus service path interface property)) dbus-registered-objects-table) @@ -1639,11 +1684,16 @@ It will be registered for all objects created by `dbus-register-property'." (push (list :dict-entry (car (last key)) - (list :variant (cdar (last item)))) + (cons :variant (cdar (last item)))) result))))) dbus-registered-objects-table) ;; Return the result, or an empty array. - (list :array (or result '(:signature "{sv}")))))))) + (list :array (or result '(:signature "{sv}"))))) + + (t `(:error ,dbus-error-unknown-method + ,(format-message + "No such method \"%s.%s\" at path \"%s\"" + dbus-interface-properties method path)))))) ;;; D-Bus object manager. @@ -1849,6 +1899,8 @@ this connection to those buses." ;; * Implement org.freedesktop.DBus.ObjectManager.InterfacesAdded and ;; org.freedesktop.DBus.ObjectManager.InterfacesRemoved. ;; +;; * Cache introspection data. +;; ;; * Run handlers in own threads. ;;; dbus.el ends here diff --git a/src/dbusbind.c b/src/dbusbind.c index b637c0e58a..af294afe92 100644 --- a/src/dbusbind.c +++ b/src/dbusbind.c @@ -1252,7 +1252,7 @@ The following usages are expected: `dbus-method-error-internal': (dbus-message-internal - dbus-message-type-error BUS SERVICE SERIAL &rest ARGS) + dbus-message-type-error BUS SERVICE SERIAL ERROR-NAME &rest ARGS) usage: (dbus-message-internal &rest REST) */) (ptrdiff_t nargs, Lisp_Object *args) @@ -1572,10 +1572,9 @@ xd_read_message_1 (DBusConnection *connection, Lisp_Object bus) EVENT_INIT (event); event.kind = DBUS_EVENT; event.frame_or_window = Qnil; - event.arg = - Fcons (value, - (mtype == DBUS_MESSAGE_TYPE_ERROR) - ? (Fcons (build_string (error_name), args)) : args); + event.arg = Fcons (value, + (mtype == DBUS_MESSAGE_TYPE_ERROR) + ? (Fcons (build_string (error_name), args)) : args); } else /* DBUS_MESSAGE_TYPE_METHOD_CALL, DBUS_MESSAGE_TYPE_SIGNAL. */ @@ -1748,7 +1747,8 @@ syms_of_dbusbind (void) DEFSYM (QCstruct, ":struct"); DEFSYM (QCdict_entry, ":dict-entry"); - /* Lisp symbols of objects in `dbus-registered-objects-table'. */ + /* Lisp symbols of objects in `dbus-registered-objects-table'. + `:property', which does exist there as well, is not used here. */ DEFSYM (QCserial, ":serial"); DEFSYM (QCmethod, ":method"); DEFSYM (QCsignal, ":signal"); @@ -1826,8 +1826,8 @@ registered methods and properties, UNAME is nil. PATH is the object path of the sending object. All of them can be nil, which means a wildcard then. OBJECT is either the handler to be called when a D-Bus message, which matches the key criteria, arrives (TYPE `:method' and -`:signal'), or a cons cell containing the value of the property (TYPE -`:property'). +`:signal'), or a list containing the value of the property and its +attributes (TYPE `:property'). For entries of type `:signal', there is also a fifth element RULE, which keeps the match string the signal is registered with. diff --git a/test/lisp/net/dbus-tests.el b/test/lisp/net/dbus-tests.el index 5e72145997..cc4bdc11ec 100644 --- a/test/lisp/net/dbus-tests.el +++ b/test/lisp/net/dbus-tests.el @@ -259,6 +259,12 @@ This includes initialization and closing the bus." (property2 "Property2") (property3 "Property3")) + ;; Not registered property. + (should-not + (dbus-get-property + :session dbus--test-service dbus--test-path + dbus--test-interface property1)) + ;; `:read' property. (should (equal @@ -307,12 +313,12 @@ This includes initialization and closing the bus." :session dbus--test-service dbus--test-path dbus--test-interface property2)) - ;; `:readwrite' property. + ;; `:readwrite' property, typed value (Bug#43252). (should (equal (dbus-register-property :session dbus--test-service dbus--test-path - dbus--test-interface property3 :readwrite "baz") + dbus--test-interface property3 :readwrite :object-path "/baz") `((:property :session "org.gnu.Emacs.TestDBus" ,property3) (,dbus--test-service ,dbus--test-path)))) (should @@ -320,19 +326,19 @@ This includes initialization and closing the bus." (dbus-get-property :session dbus--test-service dbus--test-path dbus--test-interface property3) - "baz")) + "/baz")) (should (string-equal (dbus-set-property :session dbus--test-service dbus--test-path - dbus--test-interface property3 "bazbaz") - "bazbaz")) + dbus--test-interface property3 :object-path "/baz/baz") + "/baz/baz")) (should (string-equal (dbus-get-property :session dbus--test-service dbus--test-path dbus--test-interface property3) - "bazbaz")) + "/baz/baz")) ;; `dbus-get-all-properties'. We cannot retrieve a value for ;; the property with `:write' access type. @@ -341,7 +347,7 @@ This includes initialization and closing the bus." :session dbus--test-service dbus--test-path dbus--test-interface))) (should (string-equal (cdr (assoc property1 result)) "foo")) - (should (string-equal (cdr (assoc property3 result)) "bazbaz")) + (should (string-equal (cdr (assoc property3 result)) "/baz/baz")) (should-not (assoc property2 result)))) ;; FIXME: This is wrong! The properties are missing. @@ -357,6 +363,142 @@ This includes initialization and closing the bus." ;; Cleanup. (dbus-unregister-service :session dbus--test-service))) +;; The following test is inspired by Bug#43146. +(ert-deftest dbus-test05-register-property-several-paths () + "Check property registration for an own service at several paths." + (skip-unless dbus--test-enabled-session-bus) + (dbus-ignore-errors (dbus-unregister-service :session dbus--test-service)) + + (unwind-protect + (let ((property1 "Property1") + (property2 "Property2") + (property3 "Property3")) + + ;; First path. + (should + (equal + (dbus-register-property + :session dbus--test-service dbus--test-path + dbus--test-interface property1 :readwrite "foo") + `((:property :session "org.gnu.Emacs.TestDBus" ,property1) + (,dbus--test-service ,dbus--test-path)))) + (should + (equal + (dbus-register-property + :session dbus--test-service dbus--test-path + dbus--test-interface property2 :readwrite "bar") + `((:property :session "org.gnu.Emacs.TestDBus" ,property2) + (,dbus--test-service ,dbus--test-path)))) + (should + (string-equal + (dbus-get-property + :session dbus--test-service dbus--test-path + dbus--test-interface property1) + "foo")) + (should + (string-equal + (dbus-get-property + :session dbus--test-service dbus--test-path + dbus--test-interface property2) + "bar")) + + (should + (string-equal + (dbus-set-property + :session dbus--test-service dbus--test-path + dbus--test-interface property1 "foofoo") + "foofoo")) + (should + (string-equal + (dbus-set-property + :session dbus--test-service dbus--test-path + dbus--test-interface property2 "barbar") + "barbar")) + (should + (string-equal + (dbus-get-property + :session dbus--test-service dbus--test-path + dbus--test-interface property1) + "foofoo")) + (should + (string-equal + (dbus-get-property + :session dbus--test-service dbus--test-path + dbus--test-interface property2) + "barbar")) + + ;; Second path. + (should + (equal + (dbus-register-property + :session dbus--test-service (concat dbus--test-path dbus--test-path) + dbus--test-interface property2 :readwrite "foo") + `((:property :session "org.gnu.Emacs.TestDBus" ,property2) + (,dbus--test-service ,(concat dbus--test-path dbus--test-path))))) + (should + (equal + (dbus-register-property + :session dbus--test-service (concat dbus--test-path dbus--test-path) + dbus--test-interface property3 :readwrite "bar") + `((:property :session "org.gnu.Emacs.TestDBus" ,property3) + (,dbus--test-service ,(concat dbus--test-path dbus--test-path))))) + (should + (string-equal + (dbus-get-property + :session dbus--test-service (concat dbus--test-path dbus--test-path) + dbus--test-interface property2) + "foo")) + (should + (string-equal + (dbus-get-property + :session dbus--test-service (concat dbus--test-path dbus--test-path) + dbus--test-interface property3) + "bar")) + + (should + (string-equal + (dbus-set-property + :session dbus--test-service (concat dbus--test-path dbus--test-path) + dbus--test-interface property2 "foofoo") + "foofoo")) + (should + (string-equal + (dbus-set-property + :session dbus--test-service (concat dbus--test-path dbus--test-path) + dbus--test-interface property3 "barbar") + "barbar")) + (should + (string-equal + (dbus-get-property + :session dbus--test-service (concat dbus--test-path dbus--test-path) + dbus--test-interface property2) + "foofoo")) + (should + (string-equal + (dbus-get-property + :session dbus--test-service (concat dbus--test-path dbus--test-path) + dbus--test-interface property3) + "barbar")) + + ;; Everything is still fine, tested with `dbus-get-all-properties'. + (let ((result + (dbus-get-all-properties + :session dbus--test-service dbus--test-path + dbus--test-interface))) + (should (string-equal (cdr (assoc property1 result)) "foofoo")) + (should (string-equal (cdr (assoc property2 result)) "barbar")) + (should-not (assoc property3 result))) + (let ((result + (dbus-get-all-properties + :session dbus--test-service + (concat dbus--test-path dbus--test-path) dbus--test-interface))) + (should (string-equal (cdr (assoc property2 result)) "foofoo")) + (should (string-equal (cdr (assoc property3 result)) "barbar")) + (should-not (assoc property1 result)))) + + ;; Cleanup. + (dbus-unregister-service :session dbus--test-service))) + (defun dbus-test-all (&optional interactive) "Run all tests for \\[dbus]." (interactive "p") commit 65565a16cfb16881c625f4431fd8d8f85a892ecc Author: Lars Ingebrigtsen Date: Tue Sep 8 12:34:42 2020 +0200 Revert "Explain in the tab-always-indent doc how to make TAB insert a TAB" This reverts commit 4b2371631167e509668b6268334e324fdd2f0327. overriding-terminal-local-map should apparently not be used for minor stuff like this. diff --git a/lisp/indent.el b/lisp/indent.el index 9f32cedfa4..0a0dd99ce0 100644 --- a/lisp/indent.el +++ b/lisp/indent.el @@ -53,16 +53,7 @@ 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. Some programming language modes have their own variable to control this, -e.g., `c-tab-always-indent', and do not respect this variable. - -If you want the TAB key to always insert a literal TAB character, -this can't be controlled by setting this variable. Instead you -could say something like: - -\(setq overriding-terminal-local-map - (let ((map (make-sparse-keymap))) - (define-key map [?\t] 'self-insert-command) - map))" +e.g., `c-tab-always-indent', and do not respect this variable." :group 'indent :type '(choice (const :tag "Always indent" t) commit 2630bbbcdf4a775d826c18c3209e7adb7a726ef6 Author: Alex Bochannek Date: Tue Sep 8 11:47:28 2020 +0200 Introduce a new Gnus scoring method (for article age) * doc/misc/gnus.texi (Score File Format): Document it. * lisp/gnus/gnus-score.el (gnus-score-check-syntax): Add support for the new date methods < and > (bug#43270). (gnus-score-date): Allow scoring on dates by age. diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi index 789b1dea52..60441669d8 100644 --- a/doc/misc/gnus.texi +++ b/doc/misc/gnus.texi @@ -20347,6 +20347,24 @@ this will match articles that were posted when it was April 1st where the article was posted from. Time zones are such wholesome fun for the whole family, eh?) +Finally, two actually useful match types for dates: @code{<} and +@code{>}. These will allow scoring on the relative age (in days) of +the articles. Here's an example score file using the method: + +@example +(("date" + (7 10 nil <) + (7 -10 nil >) + (14 -10 nil >))) +@end example + +This results in articles less than a week old getting a 10 point +increase, articles older than a week getting a 10 point decrease, and +articles older than two weeks getting a cumulative 20 point decrease. + +The day can also be a floating point number: To score articles less +than an hour old, you can say @samp{(0.04 10 nil <)}. + @item Head, Body, All These three match keys use the same match types as the @code{From} (etc.)@: header uses. diff --git a/etc/NEWS b/etc/NEWS index 09f7da4953..407e1c4198 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -321,6 +321,11 @@ tags to be considered as well. ** Gnus ++++ +*** New scoring types for the Date header. +You can now score based on the relative age of an article with the new +'<' and '>' date scoring types. + +++ *** New backend 'nnselect'. The newly added 'nnselect' backend allows creating groups from an diff --git a/lisp/gnus/gnus-score.el b/lisp/gnus/gnus-score.el index 46b70eaf27..c5156a195a 100644 --- a/lisp/gnus/gnus-score.el +++ b/lisp/gnus/gnus-score.el @@ -1370,9 +1370,12 @@ If FORMAT, also format the current score file." (setq err (cond - ((if (member (downcase type) '("lines" "chars")) - (not (numberp (car s))) - (not (stringp (car s)))) + ((cond ((member (downcase type) '("lines" "chars")) + (not (numberp (car s)))) + ((string= (downcase type) "date") + (not (or (numberp (car s)) + (stringp (car s))))) + (t (not (stringp (car s))))) (format "Invalid match %s in %s" (car s) file)) ((and (cadr s) (not (integerp (cadr s)))) (format "Non-integer score %s in %s" (cadr s) file)) @@ -1690,9 +1693,19 @@ score in `gnus-newsgroup-scored' by SCORE." ((eq type 'after) (setq match-func 'string< match (gnus-date-iso8601 (nth 0 kill)))) + ((eq type '<) + (setq type 'after + match-func 'gnus-string> + match (gnus-time-iso8601 + (time-add (current-time) (* 86400 (nth 0 kill)))))) ((eq type 'before) (setq match-func 'gnus-string> match (gnus-date-iso8601 (nth 0 kill)))) + ((eq type '>) + (setq type 'before + match-func 'gnus-string> + match (gnus-time-iso8601 + (time-add (current-time) (* -86400 (nth 0 kill)))))) ((eq type 'at) (setq match-func 'string= match (gnus-date-iso8601 (nth 0 kill)))) commit 0fb54254423cd62aea12ab3c76c1da6912e988e1 Author: João Távora Date: Sun Sep 6 19:03:52 2020 +0100 Change icomplete-show-matches-on-no-input behaviour for Icomplete only Fixes: bug#19032, bug#43120 Previous fixes to bug#19032 introduced bugs in Fido mode. This fix relies on a new command bound to RET. * etc/NEWS (Miscellaneous): Mention icomplete-show-matches-on-no-input. * lisp/icomplete.el (icomplete-show-matches-on-no-input): Add comment. (icomplete-minibuffer-map): Rebind minibuffer-complete-and-exit to icomplete-ret. (icomplete-ret): New command. diff --git a/etc/NEWS b/etc/NEWS index ebae168842..09f7da4953 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -947,6 +947,12 @@ window after starting). This variable defaults to nil. ** Miscellaneous +--- +*** 'icomplete-show-matches-on-no-input' behavior change +Previously, choosing a different completion with commands like 'C-.' +and then hitting enter would choose the default completion. Doing +this will now choose the completion under point. + +++ *** The user can now customize how "default" values are prompted for. The new utility function 'format-prompt' has been added which uses the diff --git a/lisp/icomplete.el b/lisp/icomplete.el index eea5580408..93514d2cc8 100644 --- a/lisp/icomplete.el +++ b/lisp/icomplete.el @@ -75,7 +75,11 @@ everything preceding the ~/ is discarded so the interactive selection process starts again from the user's $HOME.") (defcustom icomplete-show-matches-on-no-input nil - "When non-nil, show completions when first prompting for input." + "When non-nil, show completions when first prompting for input. +This also means that if you traverse the list of completions with +commands like `C-.' and just hit RET without typing any +characters, the match under point will be chosen instead of the +default." :type 'boolean :version "24.4") @@ -153,12 +157,22 @@ icompletion is occurring." (defvar icomplete-minibuffer-map (let ((map (make-sparse-keymap))) (define-key map [?\M-\t] 'icomplete-force-complete) + (define-key map [remap minibuffer-complete-and-exit] 'icomplete-ret) (define-key map [?\C-j] 'icomplete-force-complete-and-exit) (define-key map [?\C-.] 'icomplete-forward-completions) (define-key map [?\C-,] 'icomplete-backward-completions) map) "Keymap used by `icomplete-mode' in the minibuffer.") +(defun icomplete-ret () + "Exit minibuffer for icomplete." + (interactive) + (if (and icomplete-show-matches-on-no-input + (car completion-all-sorted-completions) + (eql (icomplete--field-end) (icomplete--field-beg))) + (icomplete-force-complete-and-exit) + (exit-minibuffer))) + (defun icomplete-force-complete-and-exit () "Complete the minibuffer with the longest possible match and exit. Use the first of the matches if there are any displayed, and use commit 627e9c191ea57fa7ba69f30a98207c782b84bcdd Author: João Távora Date: Sun Sep 6 18:17:13 2020 +0100 Revert two commits for bug#19032 This reverts: - commit 585fe00557489e49188b6a301f001ef01ff15dcb, which is titled "Fix up previous icomplete-show-matches-on-no-input change" - commit 1b8d369c381b5a63e40529d0d95dfa75d94b8e09, which is titled "Change icomplete-show-matches-on-no-input behavior". A simpler, less intrusive fix follows shortly after this commit. diff --git a/lisp/icomplete.el b/lisp/icomplete.el index 38115ab2c8..eea5580408 100644 --- a/lisp/icomplete.el +++ b/lisp/icomplete.el @@ -75,11 +75,7 @@ everything preceding the ~/ is discarded so the interactive selection process starts again from the user's $HOME.") (defcustom icomplete-show-matches-on-no-input nil - "When non-nil, show completions when first prompting for input. -This also means that if you traverse the list of completions with -commands like `C-.' and just hit `C-j' (enter) without typing any -characters, the match under point will be chosen instead of the -default." + "When non-nil, show completions when first prompting for input." :type 'boolean :version "24.4") @@ -755,10 +751,7 @@ matches exist." (push comp prospects) (setq limit t)))) (setq prospects (nreverse prospects)) - ;; Return the first match if the user hits enter. - (when icomplete-show-matches-on-no-input - (setq-local completion-content-when-empty (car prospects))) - ;; Decorate first of the prospects. + ;; Decorate first of the prospects. (when prospects (let ((first (copy-sequence (pop prospects)))) (put-text-property 0 (length first) diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index 864726e3cc..6deb1eb077 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -1119,7 +1119,6 @@ completion candidates than this number." (defvar-local completion-all-sorted-completions nil) (defvar-local completion--all-sorted-completions-location nil) (defvar completion-cycling nil) ;Function that takes down the cycling map. -(defvar completion-content-when-empty nil) (defvar completion-fail-discreetly nil "If non-nil, stay quiet when there is no match.") @@ -1504,13 +1503,8 @@ If `minibuffer-completion-confirm' is `confirm-after-completion', COMPLETION-FUNCTION is called if the current buffer's content does not appear to be a match." (cond - ;; Allow user to specify null string. In the case that - ;; `completion-content-when-empty' is set, use that instead. - ((= beg end) - (when completion-content-when-empty - (completion--replace beg end completion-content-when-empty)) - (funcall exit-function)) - + ;; Allow user to specify null string + ((= beg end) (funcall exit-function)) ((test-completion (buffer-substring beg end) minibuffer-completion-table minibuffer-completion-predicate)