From: "Jeff Dwork" <jeff.dwork@amd.com>
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 [thread overview]
Message-ID: <15557.55883.921872.508013@localhost.localdomain> (raw)
In-Reply-To: <m2r8lo57ww.fsf@jidanni.org>
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 <jeff.dwork@amd.com>
;; 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 |
next prev parent reply other threads:[~2002-04-23 22:03 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-04-07 9:41 It is prompting me for a filename. I would like to fill in the current filename Dan Jacobson
2002-04-07 16:48 ` Andreas Schwab
2002-04-08 17:49 ` D. Goel
2002-04-09 10:07 ` Andreas Schwab
2002-04-09 14:11 ` D. Goel
2002-04-09 14:31 ` Miles Bader
2002-04-09 14:50 ` Andreas Schwab
2002-04-09 16:58 ` D. Goel
2002-04-10 7:28 ` Dan Jacobson
2002-04-10 16:46 ` Kevin Rodgers
2002-04-23 22:03 ` Jeff Dwork [this message]
2002-04-09 16:03 ` Kai Großjohann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=15557.55883.921872.508013@localhost.localdomain \
--to=jeff.dwork@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.