From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Roy Liu Newsgroups: gmane.emacs.bugs Subject: bug#7872: Possible fix for relative pathnames given through the command line Date: Wed, 19 Jan 2011 21:48:56 -0500 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=000e0cd17bbec9794a049a3e2cbb X-Trace: dough.gmane.org 1295492547 10652 80.91.229.12 (20 Jan 2011 03:02:27 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 20 Jan 2011 03:02:27 +0000 (UTC) To: 7872@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Jan 20 04:02:24 2011 Return-path: Envelope-to: geb-bug-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 1Pfkn0-0000bA-Le for geb-bug-gnu-emacs@m.gmane.org; Thu, 20 Jan 2011 04:02:23 +0100 Original-Received: from localhost ([127.0.0.1]:34681 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pfkn0-0003M6-1b for geb-bug-gnu-emacs@m.gmane.org; Wed, 19 Jan 2011 22:02:22 -0500 Original-Received: from [140.186.70.92] (port=41073 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pfkfc-0001HY-1j for bug-gnu-emacs@gnu.org; Wed, 19 Jan 2011 21:54:45 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pfkfb-0000SH-3m for bug-gnu-emacs@gnu.org; Wed, 19 Jan 2011 21:54:43 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:54365) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pfkfb-0000SD-2I for bug-gnu-emacs@gnu.org; Wed, 19 Jan 2011 21:54:43 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1PfkUH-0001uX-Vt; Wed, 19 Jan 2011 21:43:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Roy Liu Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 20 Jan 2011 02:43:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 7872 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.12954913797335 (code B ref -1); Thu, 20 Jan 2011 02:43:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 20 Jan 2011 02:42:59 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PfkUE-0001uF-M4 for submit@debbugs.gnu.org; Wed, 19 Jan 2011 21:42:59 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PfkSV-0001rn-Qd for submit@debbugs.gnu.org; Wed, 19 Jan 2011 21:41:12 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pfka5-0008Ex-9a for submit@debbugs.gnu.org; Wed, 19 Jan 2011 21:49:02 -0500 Original-Received: from lists.gnu.org ([199.232.76.165]:57148) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pfka5-0008Et-7K for submit@debbugs.gnu.org; Wed, 19 Jan 2011 21:49:01 -0500 Original-Received: from [140.186.70.92] (port=38196 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pfka3-00089n-JI for bug-gnu-emacs@gnu.org; Wed, 19 Jan 2011 21:49:01 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pfka2-0008EL-E9 for bug-gnu-emacs@gnu.org; Wed, 19 Jan 2011 21:48:59 -0500 Original-Received: from mail-pw0-f41.google.com ([209.85.160.41]:61869) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pfka2-0008EA-9O for bug-gnu-emacs@gnu.org; Wed, 19 Jan 2011 21:48:58 -0500 Original-Received: by pwj8 with SMTP id 8so40316pwj.0 for ; Wed, 19 Jan 2011 18:48:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:date:message-id:subject:from:to :content-type; bh=ZSrOuNf/4yBzaGydspS5opRkecTk6A0nK5pfOv2tzSI=; b=PoBpXB+jMP6iWGbJpXqj8+5QsYSIqsA74wGzU/WKoF0UTtUVw0IPP6Xtkm2KWbcQQ3 1w1m9KuWTiqH8ybXsD48ch8fCvTS9V5UChi92gX18YhHH7XzKyepIqgtg6qN+Ia5aR8e tqEAkjX0p3lzahlmOwEqA6VjfwKP6rHdnz9Zg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=sHpYDnguP0SU30DjEOTtSAbA8f79HiIEded5cEzuvvgFcRwKNVI0H8jQEQcn6Fd9Om oQnhDLAOfYjCuxaJ8fgbnTS5SQ9rbNSw/mLMVM+02/lsVoOO/pyd9kZFCe3K5uAiv7UI 19F0Jp49pWqGbg1YgI7Ivl0Gu8W11B89EiTCM= Original-Received: by 10.142.43.12 with SMTP id q12mr1582052wfq.34.1295491736893; Wed, 19 Jan 2011 18:48:56 -0800 (PST) Original-Received: by 10.142.222.13 with HTTP; Wed, 19 Jan 2011 18:48:56 -0800 (PST) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Mailman-Approved-At: Wed, 19 Jan 2011 21:42:57 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Wed, 19 Jan 2011 21:43:01 -0500 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Mailman-Approved-At: Wed, 19 Jan 2011 22:02:18 -0500 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:43472 Archived-At: --000e0cd17bbec9794a049a3e2cbb Content-Type: text/plain; charset=ISO-8859-1 I've noticed that Emacs.app opens up relative pathnames twice -- once for the actual file, and once for the relative pathname appended to the directory of the current buffer. For example, trying to open by "a/b/text.txt" opens "a/b/text.txt" and attempts to open "a/b/a/b/text.txt". I wonder if the following patch corrects the problem: --- lisp/term/ns-win.el.orig 2010-12-12 23:31:04.000000000 -0500 +++ lisp/term/ns-win.el 2010-12-12 23:32:00.000000000 -0500 @@ -785,7 +785,7 @@ "Do a `find-file' with the `ns-input-file' as argument." (interactive) (let ((f) (file) (bufwin1) (bufwin2)) - (setq f (file-truename (car ns-input-file))) + (setq f (file-truename (expand-file-name (car ns-input-file) command-line-default-directory))) (setq ns-input-file (cdr ns-input-file)) (setq file (find-file-noselect f)) (setq bufwin1 (get-buffer-window file 'visible)) Here, the input filename is expanded according to the current working directory when Emacs was invoked. Since I'm no expert, I don't know if this breaks something else. Thanks for your time! --000e0cd17bbec9794a049a3e2cbb Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable I've noticed that Emacs.app opens up relative pathnames twice -- once f= or the actual file, and once for the relative pathname appended to the dire= ctory of the current buffer.
For example, trying to open by "a/b/t= ext.txt" opens=A0"a/b/text.txt" and attempts to open=A0"= ;a/b/a/b/text.txt".

I wonder if t= he following patch corrects the problem:

--- = lisp/term/ns-win.el.orig =A0 =A02010-12-12 23:31:04.000000000 -0500
+++ lisp/term/ns-win.el 2010-12-12 23:32:00.000000000 -0500
@@ -785,7 +785,7 @@
=A0=A0 "Do a `find-file' with t= he `ns-input-file' as argument."
=A0=A0 (interactive)
=A0=A0 (let ((f) (file) (bufwin1) (bufwin2))
- =A0 =A0(se= tq f (file-truename (car ns-input-file)))
+ =A0 =A0(setq f (file-truename (expand-file-name (car ns-input-file) = command-line-default-directory)))
=A0=A0 =A0 (setq ns-input-file = (cdr ns-input-file))
=A0=A0 =A0 (setq file (find-file-noselect f)= )
=A0=A0 =A0 (setq bufwin1 (get-buffer-window file 'visible))
=

Here, the input filename is expanded according to the c= urrent working directory when Emacs was invoked. =A0Since I'm no expert= , I don't know if this breaks something else.

Thanks for your time!

--000e0cd17bbec9794a049a3e2cbb--