From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.help Subject: Re: How to prevent Emacs from translating beginning of file path into "~"? Date: Fri, 10 Apr 2015 11:01:56 +0300 Message-ID: <83bniwv2bv.fsf@gnu.org> References: <55277571.4060106@arlsoft.com> NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1428652946 22425 80.91.229.3 (10 Apr 2015 08:02:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 10 Apr 2015 08:02:26 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Apr 10 10:02:17 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YgTtI-0005Xh-JR for geh-help-gnu-emacs@m.gmane.org; Fri, 10 Apr 2015 10:02:16 +0200 Original-Received: from localhost ([::1]:37962 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YgTtI-0002M7-3U for geh-help-gnu-emacs@m.gmane.org; Fri, 10 Apr 2015 04:02:16 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55235) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YgTt5-0002Ld-PE for help-gnu-emacs@gnu.org; Fri, 10 Apr 2015 04:02:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YgTt0-0002AZ-N7 for help-gnu-emacs@gnu.org; Fri, 10 Apr 2015 04:02:03 -0400 Original-Received: from mtaout24.012.net.il ([80.179.55.180]:49395) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YgTt0-0002AC-Ew for help-gnu-emacs@gnu.org; Fri, 10 Apr 2015 04:01:58 -0400 Original-Received: from conversion-daemon.mtaout24.012.net.il by mtaout24.012.net.il (HyperSendmail v2007.08) id <0NMK00200YZ1YV00@mtaout24.012.net.il> for help-gnu-emacs@gnu.org; Fri, 10 Apr 2015 10:53:24 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by mtaout24.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NMK00PJ2Z902H30@mtaout24.012.net.il> for help-gnu-emacs@gnu.org; Fri, 10 Apr 2015 10:53:24 +0300 (IDT) In-reply-to: <55277571.4060106@arlsoft.com> X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 80.179.55.180 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:103622 Archived-At: > Date: Fri, 10 Apr 2015 03:02:09 -0400 > From: MBR > > The Emacs command ^x-^f (find-file) fills the mini-buffer with the full > path to the current directory and then waits for you to type the > filename. I often I find it a useful way to copy the current directory > to the system's clipboard so I can paste the path into some other > application. For example, in Emacs I'll type: > > ^x-^f (put path to current directory into mini-buffer) > ^a (go to beginning of line) > ^k (kill from beginning to end of mini-buffer, with the > side effect of putting that string into the system clipboard) > ^g (cancel out of mini-buffer) > > At this point I can paste the path into any non-Emacs application by > typing CMD-v (in OS-X) or CTRL-v (in Windows or Linux). > > But there's a problem. Current versions of Emacs (I'm currently running > Emacs 24.3.1 under OS-X) try to be smart and replace the beginning of > the path with "~" if it matches the logged in user's home directory. > Unfortunately, some applications don't understand paths that begin with "~". > > Is it possible to configure Emacs to put the full path (beginning with > "/") into the mini-buffer, rather than just the path from the home > directory (beginning with "~")? What you need instead of this complicated method is a simple command that will copy the current buffer's default-directory to the clipboard. That command should use expand-file-name, which will expand any "~" into its full absolute file name.