From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Pierre Lorenzon Newsgroups: gmane.emacs.help Subject: Re: dired-make-relative-symlink Date: Tue, 04 Jul 2017 17:21:33 +0200 (CEST) Message-ID: <20170704.172133.1757667556293342530.devel@pollock-nageoire.net> References: <20170704.161038.773751553356814485.devel@pollock-nageoire.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: blaine.gmane.org 1499182889 368 195.159.176.226 (4 Jul 2017 15:41:29 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 4 Jul 2017 15:41:29 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: rfrancoise@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Jul 04 17:41:20 2017 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dSPwy-0007qv-GH for geh-help-gnu-emacs@m.gmane.org; Tue, 04 Jul 2017 17:41:16 +0200 Original-Received: from localhost ([::1]:41984 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dSPx3-0004CL-KF for geh-help-gnu-emacs@m.gmane.org; Tue, 04 Jul 2017 11:41:21 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54773) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dSPwc-0004Bx-NO for help-gnu-emacs@gnu.org; Tue, 04 Jul 2017 11:40:55 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dSPwZ-00043F-J7 for help-gnu-emacs@gnu.org; Tue, 04 Jul 2017 11:40:54 -0400 Original-Received: from smtp13.smtpout.orange.fr ([80.12.242.135]:51061 helo=smtp.smtpout.orange.fr) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dSPwZ-000427-7D for help-gnu-emacs@gnu.org; Tue, 04 Jul 2017 11:40:51 -0400 Original-Received: from localhost ([90.92.44.219]) by mwinf5d75 with ME id gfgm1v00J4jjhYA03fgm42; Tue, 04 Jul 2017 17:40:48 +0200 X-ME-Helo: localhost X-ME-Date: Tue, 04 Jul 2017 17:40:48 +0200 X-ME-IP: 90.92.44.219 In-Reply-To: <20170704.161038.773751553356814485.devel@pollock-nageoire.net> X-Mailer: Mew version 6.7 on Emacs 26.0.50 / Mule 6.0 (HANACHIRUSATO) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x [fuzzy] X-Received-From: 80.12.242.135 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 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" Xref: news.gmane.org gmane.emacs.help:113695 Archived-At: Hi, Here is a very compact and short implementation (defun dired-make-relative-symlink (file1 file2 &optional ok-if-already-exists) "Make a symbolic link (pointing to FILE1) in FILE2. The link is relative (if possible), for example \"/vol/tex/bin/foo\" \"/vol/local/bin/foo\" results in \"../../tex/bin/foo\" \"/vol/local/bin/foo\"" (interactive "FRelSymLink: \nFRelSymLink %s: \np") (let ((file1 (expand-file-name file1)) (file2 (expand-file-name file2))) (make-symbolic-link (directory-file-name (file-relative-name file1 (file-name-directory file2))) file2 ok-if-already-exists))) I did not yet notice bugs but maybe there are some ! If you think it is accurate to replace the code in dired-x.el fell free to do it ! Regards Pierre From: Pierre Lorenzon Subject: dired-make-relative-symlink Date: Tue, 04 Jul 2017 16:10:38 +0200 (CEST) > > > Hi, > > I wonder why the function dired-make-relative-symlink > recalculate the relative name of the file instead of using > file-relative-name of the files.el library. > > Making a few tests it seems that both codes produce the same > result. Anyway maybe these tests are not torturing the code > enough. > > files.el library seems to be very old and it looks strange to > me that when dired-x.el was developped files.el was not known. > > I did not report that as a bug since it is not a bug but I > think that a system is more maintainable when code is not > duplicated. > > Regards > > PS/ Sory if I did not notice an evident reason for which the > code is so ! >