From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Deniz Dogan Newsgroups: gmane.emacs.help Subject: Re: insert name of current file Date: Tue, 25 Jan 2011 23:10:05 +0100 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: dough.gmane.org 1295993500 15883 80.91.229.12 (25 Jan 2011 22:11:40 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 25 Jan 2011 22:11:40 +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 Tue Jan 25 23:11:34 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 1Phr6f-0002kr-2m for geh-help-gnu-emacs@m.gmane.org; Tue, 25 Jan 2011 23:11:32 +0100 Original-Received: from localhost ([127.0.0.1]:56002 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Phr6P-00086p-U9 for geh-help-gnu-emacs@m.gmane.org; Tue, 25 Jan 2011 17:11:05 -0500 Original-Received: from [140.186.70.92] (port=60287 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Phr62-00083U-VE for help-gnu-emacs@gnu.org; Tue, 25 Jan 2011 17:10:46 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Phr5w-0006KQ-Pe for help-gnu-emacs@gnu.org; Tue, 25 Jan 2011 17:10:37 -0500 Original-Received: from mail-iw0-f169.google.com ([209.85.214.169]:52611) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Phr5w-0006KF-Km for help-gnu-emacs@gnu.org; Tue, 25 Jan 2011 17:10:36 -0500 Original-Received: by iwn40 with SMTP id 40so315770iwn.0 for ; Tue, 25 Jan 2011 14:10:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; bh=QMZX3ZuSWuB7S9JSAaAqMGAFqUKtrOhS2jG1HcVFNqk=; b=WvH0gFUgSwDleReH0PHyYuC73Qiz7xLlQGl3AgCaRM4FnbSaV8/lyPpt2a3tSPiLTL Sv7xhN9rYt+PPg3Ub668GDrzEu0Sr8rAaQRWPdAbZDoadWWewvgSYn5dKU4tozYlCdFC KnRrPUDX3GpMxyqcb64Zn49XjrkxO4yo49hdo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; b=ayVHnMv9toAbyvzMaQl5jMYhroWlUbK7uYNsKG7jvE3FaHz7vb72jAUwgfPsGAVsFj woIpuF0PM+kq9yVfQ2gWxWRZkeEhmeEpfYxEdGxW6vobG7PeAiJ3epnpMFYh3/QOwvjM tZoE0e914KCnSBAVQksd0biAl8QUb57fTTDX8= Original-Received: by 10.231.13.138 with SMTP id c10mr7300911iba.97.1295993435851; Tue, 25 Jan 2011 14:10:35 -0800 (PST) Original-Received: by 10.231.32.197 with HTTP; Tue, 25 Jan 2011 14:10:05 -0800 (PST) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) 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:78744 Archived-At: 2011/1/25 Gradivus : > > Hi, > > Sorry I'm a noob. > You're excused! > 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. > As far as I know, there is no such functionality by default, but put this in your init file to bind "C-c i f" to it: (defun insert-buffer-file-name () "Inserts the name of the file for the current buffer." (interactive) (if buffer-file-name (insert (file-name-nondirectory buffer-file-name)) (message "No file associated with buffer."))) (global-set-key (kbd "C-c i f") 'insert-buffer-file-name) Hope that helps, Deniz Dogan