unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#12490: 24.2; Search inside Minibuffer don't work with M-x (M-x C-s)
@ 2012-09-22 20:42 Jakub Jankiewicz
  2012-09-22 23:21 ` Juri Linkov
  0 siblings, 1 reply; 11+ messages in thread
From: Jakub Jankiewicz @ 2012-09-22 20:42 UTC (permalink / raw)
  To: 12490

[-- Attachment #1: Type: text/plain, Size: 847 bytes --]

Hi,

I want to report, that most used function stop working in Emacs 24
(tested 2 versions 24.1.1 and latest 24.2.1). I use Search in
Mini buffer a lot (don't know if people use it or not). If you call
search C-s when inside minibuffer like C-h f C-s you can search the
content of Minibuffer like search for functions or for buffer name to
switch like C-x b C-s (better then ido mode). And in Emacs 24 M-x C-s
stop working so I you can't search for interactive function to execute
anymore. It was working in 23.3 provided by Ubuntu (package
23.3+1-1ubuntu4).

Exact symptoms:
$ emacs -Q
M-x C-s
Typing any character show "Failing I-search"

I used 24.1.1 but just compile latest GNU Emacs 24.2.1
(i686-pc-linux-gnu, GTK+ Version 2.24.6) and got the same result.

Jakub

--
Jakub Jankiewicz, Web Developer
http://jcubic.pl

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 490 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#12490: 24.2; Search inside Minibuffer don't work with M-x (M-x C-s)
  2012-09-22 20:42 bug#12490: 24.2; Search inside Minibuffer don't work with M-x (M-x C-s) Jakub Jankiewicz
@ 2012-09-22 23:21 ` Juri Linkov
  2012-09-23  9:27   ` Jakub Jankiewicz
  2019-10-30 22:25   ` Stefan Kangas
  0 siblings, 2 replies; 11+ messages in thread
From: Juri Linkov @ 2012-09-22 23:21 UTC (permalink / raw)
  To: Jakub Jankiewicz; +Cc: 12490

> I want to report, that most used function stop working in Emacs 24
> (tested 2 versions 24.1.1 and latest 24.2.1). I use Search in
> Mini buffer a lot (don't know if people use it or not). If you call
> search C-s when inside minibuffer like C-h f C-s you can search the
> content of Minibuffer like search for functions or for buffer name to
> switch like C-x b C-s (better then ido mode). And in Emacs 24 M-x C-s
> stop working so I you can't search for interactive function to execute
> anymore. It was working in 23.3 provided by Ubuntu (package
> 23.3+1-1ubuntu4).

Sorry, this feature has been removed by http://debbugs.gnu.org/5214
and http://debbugs.gnu.org/5364

But it's easy to restore it with a simple patch that prepends the
current default value (a command at point) to the sorted list of
all available command names:

=== modified file 'lisp/simple.el'
--- lisp/simple.el	2012-09-22 20:53:16 +0000
+++ lisp/simple.el	2012-09-22 23:20:41 +0000
@@ -1352,9 +1352,15 @@ (defun read-extended-command ()
 	     (lambda ()
 	       ;; Get a command name at point in the original buffer
 	       ;; to propose it after M-n.
-	       (with-current-buffer (window-buffer (minibuffer-selected-window))
-		 (and (commandp (function-called-at-point))
-		      (format "%S" (function-called-at-point)))))))
+	       (let ((def (with-current-buffer
+			      (window-buffer (minibuffer-selected-window))
+			    (and (commandp (function-called-at-point))
+				 (format "%S" (function-called-at-point)))))
+		     (all (sort (minibuffer-default-add-completions)
+				(lambda (a b) (string< a b)))))
+		 (if def
+		     (cons def (delete def all))
+		   all)))))
     ;; Read a string, completing from and restricting to the set of
     ;; all defined commands.  Don't provide any initial input.
     ;; Save the command read on the extended-command history list.





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#12490: 24.2; Search inside Minibuffer don't work with M-x (M-x C-s)
  2012-09-22 23:21 ` Juri Linkov
@ 2012-09-23  9:27   ` Jakub Jankiewicz
  2019-10-30 22:25   ` Stefan Kangas
  1 sibling, 0 replies; 11+ messages in thread
From: Jakub Jankiewicz @ 2012-09-23  9:27 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 12490

[-- Attachment #1: Type: text/plain, Size: 2230 bytes --]

Awesome thanks, it work. I didn't want to modify the file so I put whole
function to my .emacs file.

On Sun, 23 Sep 2012 02:21:39 +0300
Juri Linkov <juri@jurta.org> wrote:

> > I want to report, that most used function stop working in Emacs 24
> > (tested 2 versions 24.1.1 and latest 24.2.1). I use Search in
> > Mini buffer a lot (don't know if people use it or not). If you call
> > search C-s when inside minibuffer like C-h f C-s you can search the
> > content of Minibuffer like search for functions or for buffer name
> > to switch like C-x b C-s (better then ido mode). And in Emacs 24
> > M-x C-s stop working so I you can't search for interactive function
> > to execute anymore. It was working in 23.3 provided by Ubuntu
> > (package 23.3+1-1ubuntu4).
> 
> Sorry, this feature has been removed by http://debbugs.gnu.org/5214
> and http://debbugs.gnu.org/5364
> 
> But it's easy to restore it with a simple patch that prepends the
> current default value (a command at point) to the sorted list of
> all available command names:
> 
> === modified file 'lisp/simple.el'
> --- lisp/simple.el	2012-09-22 20:53:16 +0000
> +++ lisp/simple.el	2012-09-22 23:20:41 +0000
> @@ -1352,9 +1352,15 @@ (defun read-extended-command ()
>  	     (lambda ()
>  	       ;; Get a command name at point in the original buffer
>  	       ;; to propose it after M-n.
> -	       (with-current-buffer (window-buffer
> (minibuffer-selected-window))
> -		 (and (commandp (function-called-at-point))
> -		      (format "%S" (function-called-at-point)))))))
> +	       (let ((def (with-current-buffer
> +			      (window-buffer
> (minibuffer-selected-window))
> +			    (and (commandp
> (function-called-at-point))
> +				 (format
> "%S" (function-called-at-point)))))
> +		     (all (sort (minibuffer-default-add-completions)
> +				(lambda (a b) (string< a b)))))
> +		 (if def
> +		     (cons def (delete def all))
> +		   all)))))
>      ;; Read a string, completing from and restricting to the set of
>      ;; all defined commands.  Don't provide any initial input.
>      ;; Save the command read on the extended-command history list.

--
Jakub Jankiewicz, Web Developer
http://jcubic.pl

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 490 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#12490: 24.2; Search inside Minibuffer don't work with M-x (M-x C-s)
  2012-09-22 23:21 ` Juri Linkov
  2012-09-23  9:27   ` Jakub Jankiewicz
@ 2019-10-30 22:25   ` Stefan Kangas
  2019-11-23 14:41     ` Lars Ingebrigtsen
  1 sibling, 1 reply; 11+ messages in thread
From: Stefan Kangas @ 2019-10-30 22:25 UTC (permalink / raw)
  To: Juri Linkov; +Cc: Jakub Jankiewicz, 12490

Juri Linkov <juri@jurta.org> writes:

>> I want to report, that most used function stop working in Emacs 24
>> (tested 2 versions 24.1.1 and latest 24.2.1). I use Search in
>> Mini buffer a lot (don't know if people use it or not). If you call
>> search C-s when inside minibuffer like C-h f C-s you can search the
>> content of Minibuffer like search for functions or for buffer name to
>> switch like C-x b C-s (better then ido mode). And in Emacs 24 M-x C-s
>> stop working so I you can't search for interactive function to execute
>> anymore. It was working in 23.3 provided by Ubuntu (package
>> 23.3+1-1ubuntu4).
>
> Sorry, this feature has been removed by http://debbugs.gnu.org/5214
> and http://debbugs.gnu.org/5364
>
> But it's easy to restore it with a simple patch that prepends the
> current default value (a command at point) to the sorted list of
> all available command names:
>
> === modified file 'lisp/simple.el'
> --- lisp/simple.el	2012-09-22 20:53:16 +0000
> +++ lisp/simple.el	2012-09-22 23:20:41 +0000
> @@ -1352,9 +1352,15 @@ (defun read-extended-command ()
>  	     (lambda ()
>  	       ;; Get a command name at point in the original buffer
>  	       ;; to propose it after M-n.
> -	       (with-current-buffer (window-buffer (minibuffer-selected-window))
> -		 (and (commandp (function-called-at-point))
> -		      (format "%S" (function-called-at-point)))))))
> +	       (let ((def (with-current-buffer
> +			      (window-buffer (minibuffer-selected-window))
> +			    (and (commandp (function-called-at-point))
> +				 (format "%S" (function-called-at-point)))))
> +		     (all (sort (minibuffer-default-add-completions)
> +				(lambda (a b) (string< a b)))))
> +		 (if def
> +		     (cons def (delete def all))
> +		   all)))))
>      ;; Read a string, completing from and restricting to the set of
>      ;; all defined commands.  Don't provide any initial input.
>      ;; Save the command read on the extended-command history list.

I tested this patch.  It works, and the behaviour seems better than
what we have now.

Should it perhaps be installed?

Best regards,
Stefan Kangas





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#12490: 24.2; Search inside Minibuffer don't work with M-x (M-x C-s)
  2019-10-30 22:25   ` Stefan Kangas
@ 2019-11-23 14:41     ` Lars Ingebrigtsen
  2019-11-30 21:43       ` Juri Linkov
  0 siblings, 1 reply; 11+ messages in thread
From: Lars Ingebrigtsen @ 2019-11-23 14:41 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: Jakub Jankiewicz, 12490

Stefan Kangas <stefan@marxist.se> writes:

> I tested this patch.  It works, and the behaviour seems better than
> what we have now.
>
> Should it perhaps be installed?

I haven't tested the patch, but if it works like I imagine (i.e., it
allows searching in the M-x history), then that sounds very nice.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#12490: 24.2; Search inside Minibuffer don't work with M-x (M-x C-s)
  2019-11-23 14:41     ` Lars Ingebrigtsen
@ 2019-11-30 21:43       ` Juri Linkov
  2019-11-30 23:41         ` Drew Adams
  2019-12-01  7:36         ` Stefan Kangas
  0 siblings, 2 replies; 11+ messages in thread
From: Juri Linkov @ 2019-11-30 21:43 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Jakub Jankiewicz, 12490, Stefan Kangas

>> I tested this patch.  It works, and the behaviour seems better than
>> what we have now.
>>
>> Should it perhaps be installed?
>
> I haven't tested the patch, but if it works like I imagine (i.e., it
> allows searching in the M-x history), then that sounds very nice.

Actually, searching in the M-x history is already implemented.

This patch allows searching thru all commands available via M-x,
i.e. it's like using isearch in the *Completions* buffer like

  M-x TAB <PgUp> C-s command

with without opening the *Completions* buffer, with just

  M-x C-s command

to search commands available with M-x M-n M-n M-n ...

The problem why this patch is not installed is the need to decide
in what order to sort these commands.  The patch sorts alphabetically,
but maybe better to sort by command usage frequency, or somesuch.





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#12490: 24.2; Search inside Minibuffer don't work with M-x (M-x C-s)
  2019-11-30 21:43       ` Juri Linkov
@ 2019-11-30 23:41         ` Drew Adams
  2019-12-01  7:36         ` Stefan Kangas
  1 sibling, 0 replies; 11+ messages in thread
From: Drew Adams @ 2019-11-30 23:41 UTC (permalink / raw)
  To: Juri Linkov, Lars Ingebrigtsen; +Cc: Jakub Jankiewicz, 12490, Stefan Kangas

> This patch allows searching thru all commands available via M-x,

That's not "searching" - certainly not isearching.

> i.e. it's like using isearch in the *Completions* buffer like
>   M-x TAB <PgUp> C-s command

That _is_ isearching (in buffer *Completions*).

> with without opening the *Completions* buffer, with just
>   M-x C-s command
> to search commands available with M-x M-n M-n M-n ...

It's not searching.  We use a different key, such
as `M-s' or `M-r', to insert a matching history
element.  `M-s' is `next-matching history-element'.
It has nothing in common with Isearch.

IMHO, we should never bind `C-s' in the minibuffer
to anything.  Why?  Because the minibuffer is a
buffer where text editing and cursor movment are
allowed/encouraged/normal.  We shouldn't remove
the ability to use Isearch there (using the global
`C-s' binding).

`C-s' in the minibuffer should, as it has before
(prior to Emacs 23, it seems), provide Isearch on
the minibuffer contents, just like it does in other
buffers.

I see now that someone changed this in Emacs 23,
at least for `read-buffer', to make `C-s' do what
has been described in this thread.  IMHO, that was
a step backward, not forward.  (I didn't notice it
because I have my own `read-buffer' code.)

It's fine to have other keys to find and retrieve
past inputs, completion candidates, defaults, etc.
That's something we've always done (`M-s', `M-n',
etc.).

Co-opting `C-s' to do that kind of thing was (and
is) misguided, IMO.  Spreading it from `C-x b' to
`M-x' will be yet another step backward.

My FWIW vote is to remove any default bindings of
`C-s' in the minibuffer, to let it do its useful
job there of `isearch-forward'.





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#12490: 24.2; Search inside Minibuffer don't work with M-x (M-x C-s)
  2019-11-30 21:43       ` Juri Linkov
  2019-11-30 23:41         ` Drew Adams
@ 2019-12-01  7:36         ` Stefan Kangas
  2019-12-01 22:38           ` Juri Linkov
  1 sibling, 1 reply; 11+ messages in thread
From: Stefan Kangas @ 2019-12-01  7:36 UTC (permalink / raw)
  To: Juri Linkov; +Cc: Jakub Jankiewicz, Lars Ingebrigtsen, 12490

Juri Linkov <juri@jurta.org> writes:

> The problem why this patch is not installed is the need to decide
> in what order to sort these commands.  The patch sorts alphabetically,
> but maybe better to sort by command usage frequency, or somesuch.

One possibility would be to install it and improve the ordering later.

BTW, do we have a mechanism for sorting by command frequency?

Best regards,
Stefan Kangas





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#12490: 24.2; Search inside Minibuffer don't work with M-x (M-x C-s)
  2019-12-01  7:36         ` Stefan Kangas
@ 2019-12-01 22:38           ` Juri Linkov
  2019-12-02 22:51             ` Juri Linkov
  2020-08-19 13:52             ` Lars Ingebrigtsen
  0 siblings, 2 replies; 11+ messages in thread
From: Juri Linkov @ 2019-12-01 22:38 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: Jakub Jankiewicz, Lars Ingebrigtsen, 12490

>> The problem why this patch is not installed is the need to decide
>> in what order to sort these commands.  The patch sorts alphabetically,
>> but maybe better to sort by command usage frequency, or somesuch.
>
> One possibility would be to install it and improve the ordering later.

I agree.

> BTW, do we have a mechanism for sorting by command frequency?

One possibility is to use the minibuffer history to sort by the number
of occurrences of each history element, but this method doesn't work
when history-delete-duplicates is customized to non-nil, so there are
no duplicates in the history.

Although I noticed that icomplete.el often proposes the most
relevant elements first, but I never investigated how it does this,
maybe by frequency?





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#12490: 24.2; Search inside Minibuffer don't work with M-x (M-x C-s)
  2019-12-01 22:38           ` Juri Linkov
@ 2019-12-02 22:51             ` Juri Linkov
  2020-08-19 13:52             ` Lars Ingebrigtsen
  1 sibling, 0 replies; 11+ messages in thread
From: Juri Linkov @ 2019-12-02 22:51 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: Jakub Jankiewicz, Lars Ingebrigtsen, 12490

>> BTW, do we have a mechanism for sorting by command frequency?
>
> One possibility is to use the minibuffer history to sort by the number
> of occurrences of each history element, but this method doesn't work
> when history-delete-duplicates is customized to non-nil, so there are
> no duplicates in the history.
>
> Although I noticed that icomplete.el often proposes the most
> relevant elements first, but I never investigated how it does this,
> maybe by frequency?

Another place worth looking at https://github.com/nonsequitur/smex
It seems using ido to sort commands by frequency?





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#12490: 24.2; Search inside Minibuffer don't work with M-x (M-x C-s)
  2019-12-01 22:38           ` Juri Linkov
  2019-12-02 22:51             ` Juri Linkov
@ 2020-08-19 13:52             ` Lars Ingebrigtsen
  1 sibling, 0 replies; 11+ messages in thread
From: Lars Ingebrigtsen @ 2020-08-19 13:52 UTC (permalink / raw)
  To: Juri Linkov; +Cc: Jakub Jankiewicz, 12490, Stefan Kangas

Juri Linkov <juri@jurta.org> writes:

>> One possibility would be to install it and improve the ordering later.
>
> I agree.

It seems that everybody here agreed that this was a good patch (even if
some tweaking might be nice), so I've applied it to Emacs 28.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2020-08-19 13:52 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-22 20:42 bug#12490: 24.2; Search inside Minibuffer don't work with M-x (M-x C-s) Jakub Jankiewicz
2012-09-22 23:21 ` Juri Linkov
2012-09-23  9:27   ` Jakub Jankiewicz
2019-10-30 22:25   ` Stefan Kangas
2019-11-23 14:41     ` Lars Ingebrigtsen
2019-11-30 21:43       ` Juri Linkov
2019-11-30 23:41         ` Drew Adams
2019-12-01  7:36         ` Stefan Kangas
2019-12-01 22:38           ` Juri Linkov
2019-12-02 22:51             ` Juri Linkov
2020-08-19 13:52             ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).