From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.devel Subject: RE: Default share/ and lisp/ directories? Date: Tue, 20 Feb 2018 10:48:45 -0800 (PST) Message-ID: <31b4fa70-3cbf-4d75-8d62-4f27c8272d49@default> References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1519152938 9029 195.159.176.226 (20 Feb 2018 18:55:38 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 20 Feb 2018 18:55:38 +0000 (UTC) To: Kaushal Modi , Emacs developers Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Feb 20 19:55:34 2018 Return-path: Envelope-to: ged-emacs-devel@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 1eoD4g-0001lZ-3B for ged-emacs-devel@m.gmane.org; Tue, 20 Feb 2018 19:55:34 +0100 Original-Received: from localhost ([::1]:57328 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eoD6i-0000Tj-99 for ged-emacs-devel@m.gmane.org; Tue, 20 Feb 2018 13:57:40 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38274) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eoCyS-0002kp-Hj for emacs-devel@gnu.org; Tue, 20 Feb 2018 13:49:09 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eoCyO-0005Ii-G5 for emacs-devel@gnu.org; Tue, 20 Feb 2018 13:49:08 -0500 Original-Received: from aserp2120.oracle.com ([141.146.126.78]:41336) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eoCyO-0005I4-8q for emacs-devel@gnu.org; Tue, 20 Feb 2018 13:49:04 -0500 Original-Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w1KIkkNK100523; Tue, 20 Feb 2018 18:48:50 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=mime-version : message-id : date : from : sender : to : subject : references : in-reply-to : content-type : content-transfer-encoding; s=corp-2017-10-26; bh=FPbW+1dqYdYZcr4XMFzlyk+pAJLjRsLK1HcyiHtASyY=; b=RJFv1KeWOoxOXcbsRK23NFu3JcRqhUKcl+7d5nFN/Yw1nCYeCSzgfIxL+KBHEXzCWgZ3 NqCw2pLxsM6wZh4U3fmMFFzaepVxBmScsdE8lbxcQP9i1QrlE3CxKObZ7XaOD6ckNxR7 WuzvzqYJb/fNB82U65B+s2THFlc+x6gsjYMXkmo/KHuYMq7YVMNjfmm+sps9WRyuJfQs PYQOgao8txSWMSvV9q3qQqoiyw5qVoNCS5VU9fM6yD4DQXyBjYvkn7aepYjeTrul58wZ 938kI1NA0Y//PeLdTTMO483RzEwDUxS30RlS+DHgWu4+j3RiHke7hj3C76RppRI5Jsqp dg== Original-Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp2120.oracle.com with ESMTP id 2g8pqxs1s2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 20 Feb 2018 18:48:50 +0000 Original-Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w1KImoRW013452 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 20 Feb 2018 18:48:50 GMT Original-Received: from abhmp0015.oracle.com (abhmp0015.oracle.com [141.146.116.21]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w1KImkBq003313; Tue, 20 Feb 2018 18:48:46 GMT In-Reply-To: X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 16.0.4654.0 (x86)] X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8810 signatures=668675 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=395 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1802200225 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 141.146.126.78 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:222941 Archived-At: Suggestion: use functions for manipulating file/dir names. > (let* ((bin-dir (when (and invocation-directory > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 (file-exists-p invocation-directory)) > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (file-truename invocation-directory))) > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (prefix-dir (when bin-dir > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (replace-regexp-in-string = "bin/\\'" "" bin-dir))) Use (file-name-directory (directory-file-name (expand-file-name file))) More generally (from dired+.el): (defun parent-dir (file &optional relativep) "Return the parent directory of FILE, or nil if none. Optional arg RELATIVEP non-nil means return a relative name, that is, just the parent component." (let ((parent (file-name-directory (directory-file-name (expand-file-nam= e file)))) relparent) (when relativep (setq relparent (file-name-nondirectory (directory-fil= e-name parent)))) (and (not (equal parent file)) (or relparent parent)))) > (when prefix-dir (concat prefix-dir "share/")) Use (file-name-as-directory (expand-file-name "share" prefix-dir))