From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dirk-Jan C. Binnema Newsgroups: gmane.emacs.help Subject: Re: insert name of current file Date: Wed, 26 Jan 2011 00:09:42 +0200 Organization: DJCBSoftware Message-ID: <20110125220942.50B8F39C207@djcbsoftware.nl> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII X-Trace: dough.gmane.org 1296022133 798 80.91.229.12 (26 Jan 2011 06:08:53 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 26 Jan 2011 06:08:53 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Gradivus Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Jan 26 07:08:49 2011 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PhyYg-0001RU-Nc for geh-help-gnu-emacs@m.gmane.org; Wed, 26 Jan 2011 07:08:49 +0100 Original-Received: from localhost ([127.0.0.1]:49374 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PhyYU-0006gQ-EJ for geh-help-gnu-emacs@m.gmane.org; Wed, 26 Jan 2011 01:08:34 -0500 Original-Received: from [140.186.70.92] (port=60059 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Phr5m-0007R0-BV for help-gnu-emacs@gnu.org; Tue, 25 Jan 2011 17:10:31 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Phr5A-0006Db-SP for help-gnu-emacs@gnu.org; Tue, 25 Jan 2011 17:09:50 -0500 Original-Received: from vs10.mail.saunalahti.fi ([195.197.172.105]:42785) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Phr5A-0006D7-J7 for help-gnu-emacs@gnu.org; Tue, 25 Jan 2011 17:09:48 -0500 Original-Received: from saunalahti-vams (localhost [127.0.0.1]) by vs10.mail.saunalahti.fi (Postfix) with SMTP id 8C1AF1A4063; Wed, 26 Jan 2011 00:09:45 +0200 (EET) Original-Received: from vs10.mail.saunalahti.fi ([127.0.0.1]) by vs10.mail.saunalahti.fi ([195.197.172.105]) with SMTP (gateway) id A07BC5894E6; Wed, 26 Jan 2011 00:09:45 +0200 Original-Received: from gw02.mail.saunalahti.fi (gw02.mail.saunalahti.fi [195.197.172.116]) by vs10.mail.saunalahti.fi (Postfix) with ESMTP id 7FA181A4063; Wed, 26 Jan 2011 00:09:45 +0200 (EET) Original-Received: from djcbsoftware.nl (a88-114-89-247.elisa-laajakaista.fi [88.114.89.247]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by gw02.mail.saunalahti.fi (Postfix) with ESMTP id 3DE40139641; Wed, 26 Jan 2011 00:09:43 +0200 (EET) Original-Received: from cthulhu.mindcrime.djcbsoftware.nl (localhost.localdomain [127.0.0.1]) by djcbsoftware.nl (Postfix) with ESMTP id 50B8F39C207; Wed, 26 Jan 2011 00:09:42 +0200 (EET) In-Reply-To: Mail-Reply-To: djcb@djcbsoftware.nl User-Agent: Wanderlust/2.15.9 (Almost Unreal) Emacs/24.0 Mule/6.0 (HANACHIRUSATO) X-Antivirus: VAMS X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Mailman-Approved-At: Wed, 26 Jan 2011 01:05:03 -0500 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:78749 Archived-At: >>>>> On Tue, 25 Jan 2011 16:59:03 -0500, Gradivus wrote: > [1 ] > Hi, > Sorry I'm a noob. > I wonder if someone knows how I can insert the current file's name > (i.e., the name of the file I'm editing) at the cursor, and without the full > path. M-: (insert-string (file-name-nondirectory (buffer-file-name))) RET If you need it more often, you can of course write a function for it. Best wishes, Dirk. -- Dirk-Jan C. Binnema Helsinki, Finland e:djcb@djcbsoftware.nl w:www.djcbsoftware.nl pgp: D09C E664 897D 7D39 5047 A178 E96A C7A1 017D DA3C