unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* dabbrev-expand for the minibuffer
@ 2008-02-23 22:59 Dan Nicolaescu
  2008-02-24  9:26 ` Leo
                   ` (2 more replies)
  0 siblings, 3 replies; 24+ messages in thread
From: Dan Nicolaescu @ 2008-02-23 22:59 UTC (permalink / raw)
  To: emacs-devel


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.  

Thanks

        --dan




^ permalink raw reply	[flat|nested] 24+ messages in thread
* Re: dabbrev-expand for the minibuffer
@ 2008-03-01 13:31 Richard Stallman
  2008-07-21 15:55 ` Drew Adams
  0 siblings, 1 reply; 24+ messages in thread
From: Richard Stallman @ 2008-03-01 13:31 UTC (permalink / raw)
  To: Juri Linkov; +Cc: emacs-devel

When I tried

    (global-set-key (kbd "M-/") 'hippie-expand)
    (setq hippie-expand-try-functions-list
          '(try-expand-dabbrev
            try-expand-dabbrev-all-buffers
            try-expand-dabbrev-from-kill))

I found it broke the feature that you can type M-SPC M-/ to pull
in successive words.  I use that often, so this proved
unacceptable.

Maybe that feature can be put into hippie-expand.




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

end of thread, other threads:[~2008-07-21 16:48 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-23 22:59 dabbrev-expand for the minibuffer Dan Nicolaescu
2008-02-24  9:26 ` Leo
2008-02-27 22:49   ` Juri Linkov
2008-02-27 23:22     ` Leo
2008-02-27 23:54     ` Miles Bader
2008-02-28  0:08       ` Jason Rumney
2008-02-28  0:35         ` Miles Bader
2008-02-28  8:21           ` Jason Rumney
2008-02-28  8:29             ` Leo
2008-02-28 16:41       ` Richard Stallman
2008-02-28 21:14         ` Leo
2008-02-29 19:54           ` Richard Stallman
2008-02-24 17:35 ` Juri Linkov
2008-02-25  8:13   ` Bastien
2008-02-27  0:18 ` Johan Bockgård
2008-02-27  1:06   ` Dan Nicolaescu
2008-02-27 11:28     ` Johan Bockgård
2008-02-27 14:38       ` Dan Nicolaescu
2008-02-27 15:04         ` Johan Bockgård
2008-02-27 15:30           ` Dan Nicolaescu
  -- strict thread matches above, loose matches on Subject: below --
2008-03-01 13:31 Richard Stallman
2008-07-21 15:55 ` Drew Adams
2008-07-21 16:47   ` Lennart Borgman (gmail)
2008-07-21 16:48     ` Lennart Borgman (gmail)

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).