Subject: Re: bug#12490: 24.2; Search inside Minibuffer don't work with M-x (M-x C-s)

From: Jakub Jankiewicz <[email-masked]>
Date: Sun, 23 Sep 2012 11:27:13 +0200

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 <[email-masked]> 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