From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Alexander Klimov Newsgroups: gmane.emacs.devel Subject: insert-file-name-into-minibuffer Date: Sat, 9 Feb 2019 14:39:36 +0000 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="64511"; mail-complaints-to="usenet@blaine.gmane.org" To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Feb 09 15:40:08 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gsTnb-000GeR-4r for ged-emacs-devel@m.gmane.org; Sat, 09 Feb 2019 15:40:07 +0100 Original-Received: from localhost ([127.0.0.1]:46202 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gsTna-00060Q-2r for ged-emacs-devel@m.gmane.org; Sat, 09 Feb 2019 09:40:06 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:52533) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gsTnU-00060D-FT for emacs-devel@gnu.org; Sat, 09 Feb 2019 09:40:01 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gsTnS-0005Mp-Fi for emacs-devel@gnu.org; Sat, 09 Feb 2019 09:40:00 -0500 Original-Received: from smtp3.mail.ru ([94.100.179.58]:55818) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gsTnO-00057a-GY for emacs-devel@gnu.org; Sat, 09 Feb 2019 09:39:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=inbox.ru; s=mail; h=Content-Type:MIME-Version:Message-ID:Subject:To:From:Date; bh=tYC/nw90aJVqrd1D/9eDvUVkhslA/3R2uEUDOWeZziY=; b=eYs4KFhgplXrkb8tlibXk+XdmmS8EmiK/sSrOlG42FvFILi9Ggz6u6CY4K09Cl6QQCas7n+oYI3WsbZj9eB1bwJbhRsVbtp3/E+kKgecZnQLp99aF9kWzoR6R1Um+1vCRI+rcsumG1twN8KcU+ylPUazx/yEsoiGTcstXgnMKPA=; Original-Received: by smtp3.mail.ru with esmtpa (envelope-from ) id 1gsTnC-0006sZ-I6 for emacs-devel@gnu.org; Sat, 09 Feb 2019 17:39:43 +0300 Authentication-Results: smtp3.mail.ru; auth=pass smtp.auth=alserkli@inbox.ru smtp.mailfrom=alserkli@inbox.ru X-77F55803: 3FFC80838138E3AB5A78504BD2AC2941F7BEC2B511800C06E4D6EE16C5B0B32FB407846C1A402BA6158D82618898719E X-7FA49CB5: 0D63561A33F958A5F4C04CAD04C94CC45A9EDD91EE1961CA9A3407AD3F2919648941B15DA834481FA18204E546F3947C989FD0BDF65E50FBF6B57BC7E64490618DEB871D839B7333395957E7521B51C2545D4CF71C94A83E9FA2833FD35BB23D27C277FBC8AE2E8B60CDF180582EB8FBA471835C12D1D977C4224003CC8364767815B9869FA544D8D32BA5DBAC0009BE9E8FC8737B5C2249AFFDA16987AEDD6B3AA81AA40904B5D9CF19DD082D7633A0E7DDDDC251EA7DABD81D268191BDAD3D78DA827A17800CE7F06F277DF7B2D6EDCD04E86FAF290E2D40A5AABA2AD3711975ECD9A6C639B01B78DA827A17800CE7A33D3744355F30C4AF14FFE2F9F2FCD975ECD9A6C639B01B4E70A05D1297E1BBC6867C52282FAC85D9B7C4F32B44FF57D4B828FA1BC0F1ACBD9CCCA9EDD067B1EDA766A37F9254B7 X-Mailru-Sender: 7A9A33E86992913287677A6A84364F8B03518272CBEF2A1FAB2EFBCB7153444DE11A6E312C87D21DA7A2F54F497AA9E7B52423DB74AF18EAF4688292F5328C65EAB4BC95F72C04283CDA0F3B3F5B9367 X-Mras: OK X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 94.100.179.58 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:233166 Archived-At: It is quite common to insert the name of the current file into the argument of shell-command or compile command (both use read-shell-command). I wonder what it the preferred way to do it? I currently use the following to allow M-. or C-u M-. to be used to insert the file name or its full path: (defun insert-file-name-into-minibuffer (full-path) (interactive "P") (let ((path (buffer-file-name (window-buffer (minibuffer-selected-window))))) (insert (if full-path path (file-name-nondirectory path))))) (define-key minibuffer-local-map (kbd "M-.") 'insert-file-name-into-minibuffer) -- Regards, ASK