Article View: gnu.emacs.help
Article #189238Re: Insertion of pathname in minibuffer
From: Pete Halverson
Date: Tue, 16 Apr 1991 18:42
Date: Tue, 16 Apr 1991 18:42
37 lines
2202 bytes
2202 bytes
In article <2074@seti.inria.fr> gs@ynetfrsp.inria.fr (gs@ynetfrsp.inria.fr) writes:
>Hi,
>How can I insert , within a minibuffer command, the pathname of the file
>contained in the current buffer ?
>Any help appreciated,
>Thanks !
>
Well, something like the following seems to work:
(defun minibuffer-ins-buffer-file-name ()
"Insert the file name of the current buffer into the minibuffer."
(interactive)
;; We assume that the second entry in the buffer list is the "real"
;; current buffer, since "(current-buffer)" just returns the
;; minibuffer we're in. This is obviously wrong for recursive
;; minibuffer excursions.
(insert (or (buffer-file-name (car (cdr (buffer-list))))
(beep) "")))
(define-key minibuffer-local-map "\C-c\C-f" 'ins-buffer-file-name)
(define-key minibuffer-local-ns-map "\C-c\C-f" 'ins-buffer-file-name)
(define-key minibuffer-local-must-match-map "\C-c\C-f" 'ins-buffer-file-name)
(define-key minibuffer-local-completion-map "\C-c\C-f" 'ins-buffer-file-name)
Besides the caveat about identifying the "current" buffer, note that there
may be other keymaps used in the minibuffer; those updated above are only
the most frequently-used.
Hope this helps,
Pete
--
===============================================================================
Pete Halverson INET: halverson@crd.ge.com
GE Corporate R&D Center UUCP: uunet!crd.ge.com!halverson
Schenectady, NY
Technical Details
Message-ID:
<18561@crdgw1.crd.ge.com>Path:
arc1-ca.pugleaf.net!gmdzi!unido!unidui!math.fu-berlin.de!fauern!ira.uka.de!sol.ctr.columbia.edu!zaphod.mps.ohio-state.edu!rpi!crdgw1!altair!halversReferences:
<2074@seti.inria.fr>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103b8b,b1c7cc470582c4dd X-Google-Attributes: gid103b8b,public X-Google-ArrivalTime: 1991-04-16 23:38:56 PST Path: arc1-ca.pugleaf.net!gmdzi!unido!unidui!math.fu-berlin.de!fauern!ira.uka.de!sol.ctr.columbia.edu!zaphod.mps.ohio-state.edu!rpi!crdgw1!altair!halvers From: halvers@altair.crd.ge.com (Pete Halverson) Newsgroups: gnu.emacs.help Subject: Re: Insertion of pathname in minibuffer Message-ID: <18561@crdgw1.crd.ge.com> Date: 16 Apr 91 18:42:14 GMT References: <2074@seti.inria.fr> Sender: news@crdgw1.crd.ge.com Reply-To: halverson@crd.ge.com (Pete Halverson) Organization: General Electric Corporate R&D Center Lines: 37