From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Jeff Dwork" Newsgroups: gmane.emacs.bugs Subject: Re: It is prompting me for a filename. I would like to fill in the current filename. Date: Tue, 23 Apr 2002 15:03:55 -0700 Sender: bug-gnu-emacs-admin@gnu.org Message-ID: <15557.55883.921872.508013@localhost.localdomain> References: NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: main.gmane.org 1019599592 2521 127.0.0.1 (23 Apr 2002 22:06:32 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Tue, 23 Apr 2002 22:06:32 +0000 (UTC) Return-path: Original-Received: from fencepost.gnu.org ([199.232.76.164]) by main.gmane.org with esmtp (Exim 3.33 #1 (Debian)) id 1708Qh-0000eY-00 for ; Wed, 24 Apr 2002 00:06:31 +0200 Original-Received: from localhost ([127.0.0.1] helo=fencepost.gnu.org) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 1708Qg-0002ib-00; Tue, 23 Apr 2002 18:06:30 -0400 Original-Received: from amdext.amd.com ([139.95.251.1]) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 1708OF-0002Zf-00 for ; Tue, 23 Apr 2002 18:03:59 -0400 Original-Received: from ssvlgs01.amd.com (ssvlgs01.amd.com [139.95.250.16]) by amdext.amd.com (8.9.3/8.9.3/AMD) with SMTP id PAA19903 for ; Tue, 23 Apr 2002 15:03:57 -0700 (PDT) Original-Received: from 139.95.250.1 by ssvlgs01.amd.com with ESMTP (Tumbleweed MMS SMTP Relay (MMS v4.7)); Tue, 23 Apr 2002 15:03:56 -0700 X-Server-Uuid: 02753650-11b0-11d5-bbc5-00508bf987eb Original-Received: from carmel.amd.com (carmel.amd.com [139.95.74.141]) by amdint.amd.com (8.9.3/8.9.3/AMD) with ESMTP id PAA11075 for ; Tue, 23 Apr 2002 15:03:56 -0700 (PDT) Original-Received: from localhost.localdomain.amd.com (shambala.amd.com [139.95.74.26]) by carmel.amd.com (8.11.4/8.11.4) with SMTP id g3NM3uP19286 for ; Tue, 23 Apr 2002 15:03:56 -0700 (PDT) X-Mailer: emacs 19.34.1 (via feedmail 10 I); VM 7.01 under Emacs 19.34.1 Original-To: bug-gnu-emacs@gnu.org Original-Newsgroups: gnu.emacs.bug In-Reply-To: X-WSS-ID: 10DB05C6910344-01-01 Errors-To: bug-gnu-emacs-admin@gnu.org X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.0.9 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Bug reports for GNU Emacs, the Swiss army knife of text editors List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.bugs:893 X-Report-Spam: http://spam.gmane.org/gmane.emacs.bugs:893 I wrote this many years ago. It never made it into the elisp archives, but it is in Google's gnu.emacs.sources archive as "mini-ibfn.el". I just tested it on emacs 21.1 and it still works. It's short, so I'll include it here: ;;; mini-ibfn.el --- insert buffer-file-name (with or without directory) into minibuffer. ;; Copyright (C) 1994 Jeff Dwork. ;; Author: Jeff Dwork ;; Version: 1.00 ;; Date: 06-Nov-94 ;;; This file is not part of GNU Emacs. ;;; This program is free software; you can redistribute it and/or modify ;;; it under the terms of the GNU General Public License as published by ;;; the Free Software Foundation; either version 2, or (at your option) ;;; any later version. ;;; This program is distributed in the hope that it will be useful, ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; You should have received a copy of the GNU General Public License ;;; along with GNU Emacs; see the file COPYING. If not, write to ;;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. ;;; Commentary: ;; Purpose: ;; ;; To provide a quick way to insert the current buffer-file-name into ;; the minibuffer. If the current buffer is a dired buffer, inserts ;; the filename point is on. ;; ;; Very useful for finding related files, doing copies or renames, etc. ;; ;; Installation: ;; ;; Put this file somewhere where Emacs can find it (i.e., in one of the paths ;; in your `load-path'), `byte-compile-file' it, and put something like this ;; in your ~/.emacs: ;; ;; (load "mini-ibfn" nil t) ;; (define-key minibuffer-local-map "\C-c\C-f" 'minibuffer-ins-buffer-file-name) ;; (define-key minibuffer-local-ns-map "\C-c\C-f" 'minibuffer-ins-buffer-file-name) ;; (define-key minibuffer-local-completion-map "\C-c\C-f" 'minibuffer-ins-buffer-file-name) ;; (define-key minibuffer-local-must-match-map "\C-c\C-f" 'minibuffer-ins-buffer-file-name) ;; ;; minibuffer-ins-buffer-file-name has been tested on FSF Emacs 18.59 and 19.28. ;; ;; Feedback: ;; ;; Please send me bug reports, bug fixes, and extensions, so that I can ;; merge them into the master source. ;; - Jeff Dwork (jeff.dwork@amd.com) ;; History: ;; ;; Based on code from Pete Halverson and Piet van Oostrum ;; (defun minibuffer-ins-buffer-file-name (arg) "Insert the non-dir file name of the current buffer into the minibuffer. Insert full file name if called with arg. If current buffer is in dired-mode, insert filename point is on." (interactive "P") ;; We assume that the first entry in the buffer list with a non-nil ;; buffer-file-name or which is in dired-mode is the "real" current buffer, ;; since "(current-buffer)" just returns the minibuffer we're in. (let ((cbf (cdr (buffer-list))) b-f-name in-dired-mode) (while (and cbf (not (or (setq b-f-name (buffer-file-name (car cbf))) (save-excursion (set-buffer (car cbf)) (if (eq major-mode 'dired-mode) (setq in-dired-mode t)))))) (setq cbf (cdr cbf))) (if (or b-f-name in-dired-mode) (progn (if in-dired-mode (save-excursion (set-buffer (car cbf)) (setq b-f-name (dired-get-filename)))) (if arg (insert b-f-name) (insert (file-name-nondirectory b-f-name)))) (beep)))) ;; end of mini-ibfn.el Dan Jacobson writes: > To: gnu-emacs-bug@moderators.isc.org > Subject: Re: It is prompting me for a filename. I would like to fill in > the current filename. > Date: 10 Apr 2002 15:28:47 +0800 > > And there it was, on M-n. That means I wasted all your times. > Sorry. Maybe I did M-p M-p M-p M-n M-n so thought I checked all > around not thinking that it was hiding on the first M-n. > ... > > Anyways, M-n will blot out anything else that you have typed in > already on that line in the minibuffer. Also it isn't a general > solution in case we aren't in the minibuffer. > -- > http://jidanni.org/ Taiwan(04)25854780 > > _______________________________________________ > Bug-gnu-emacs mailing list > Bug-gnu-emacs@gnu.org > http://mail.gnu.org/mailman/listinfo/bug-gnu-emacs -- Jeff Dwork | jeff.dwork@amd.com Advanced Micro Devices, M/S 45 | 408-749-5216 (voice) 408-774-8448 (fax) PO Box 3453 |---------------------------------------- Sunnyvale, Ca 94088-3453 |