emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: dabbrev-expand for the minibuffer


From: Leo
Subject: Re: dabbrev-expand for the minibuffer
Date: Sun, 24 Feb 2008 09:26:13 +0000
User-agent: Gnus/5.130000 Emacs/23.0.60 (20080222) Fedora 8 (gnu/linux)

On 2008-02-23 22:59 +0000, Dan Nicolaescu wrote:
> A lot of times when using dabbrev-expand in the minibuffer, the most
> desirable expansion is something from the minibuffer history.
> But dabbrev-expand does not search the minibuffer history...
> If for example you use M-x compile a lot with a lot of very complex
> command lines, having dabbrev-expand look in the minibuffer history is
> very useful.
> (This is not unlike what you suffer from when using bash: no dabbrev-expand 
> at all).
>
> So a long time ago I wrote this hack to put the minibuffer history in a
> buffer and tell dabbrev to search it too.
>
> (setq dabbrev-select-buffers-function 'my-minibuffer-setup-dabbrev-buffers)
>
> (defun my-minibuffer-setup-dabbrev-buffers ()
>   (let ((buf (get-buffer-create " *dabbrev history* ")))
>     (save-excursion 
>       (set-buffer buf)
>       (erase-buffer)
>       ;; dabbrev looks for text only in buffers.  Put the minibuffer
>       ;; history in a buffer, so that dabbrev can look at it.
>       (mapc (lambda (arg) 
>             (insert arg "\n")) 
>                 (if minibuffer-history-variable 
>                     (eval minibuffer-history-variable)
>                           minibuffer-history)))
>     ;; Put the minibuffer history at the beginning of the buffer list
>     ;; that dabbrev will look at.
>     (append (list buf) (dabbrev--select-buffers))))
>
> I am not sure what is the proper way to integrate this functionality,
> it would be great if someone that knows dabbrev could either add
> something similar to this code, or do it in a better way and provide it
> by default.  

It looks like the best way to integrate this is with hippie-expand,
probably not dabbrev-expand. Just a thought.

>
> Thanks
>
>         --dan

-- 
.:  Leo  :.  [ sdl.web AT gmail.com ]  .:  [ GPG Key: 9283AA3F ]  :.

          Use the best OS -- http://www.fedoraproject.org/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]