From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dan Nicolaescu Newsgroups: gmane.emacs.devel Subject: dabbrev-expand for the minibuffer Date: Sat, 23 Feb 2008 14:59:06 -0800 Message-ID: <200802232259.m1NMx6rY027848@sallyv1.ics.uci.edu> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1203807700 31436 80.91.229.12 (23 Feb 2008 23:01:40 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 23 Feb 2008 23:01:40 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Feb 24 00:02:04 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JT3Nc-0005oT-2W for ged-emacs-devel@m.gmane.org; Sun, 24 Feb 2008 00:02:04 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JT3N6-0000Nd-4x for ged-emacs-devel@m.gmane.org; Sat, 23 Feb 2008 18:01:32 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JT3N2-0000NU-Ns for emacs-devel@gnu.org; Sat, 23 Feb 2008 18:01:28 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JT3N2-0000NG-2V for emacs-devel@gnu.org; Sat, 23 Feb 2008 18:01:28 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JT3N1-0000ND-VE for emacs-devel@gnu.org; Sat, 23 Feb 2008 18:01:28 -0500 Original-Received: from sallyv1.ics.uci.edu ([128.195.1.109]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA1:24) (Exim 4.60) (envelope-from ) id 1JT3N1-0007oP-EJ for emacs-devel@gnu.org; Sat, 23 Feb 2008 18:01:27 -0500 X-ICS-MailScanner-Watermark: 1204412346.58253@hs3z8F1GkoHVJ/aVj1FkWA Original-Received: from mothra.ics.uci.edu (mothra.ics.uci.edu [128.195.6.93]) by sallyv1.ics.uci.edu (8.13.7+Sun/8.13.7) with ESMTP id m1NMx6rY027848 for ; Sat, 23 Feb 2008 14:59:06 -0800 (PST) Original-Lines: 38 X-ICS-MailScanner: Found to be clean X-ICS-MailScanner-SpamCheck: not spam, SpamAssassin (score=-1.44, required 5, autolearn=disabled, ALL_TRUSTED -1.44) X-ICS-MailScanner-From: dann@mothra.ics.uci.edu X-detected-kernel: by monty-python.gnu.org: Solaris 10 (beta) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:90176 Archived-At: 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