From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Kaushal Modi Newsgroups: gmane.emacs.devel Subject: Default share/ and lisp/ directories? Date: Tue, 20 Feb 2018 18:09:43 +0000 Message-ID: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="94eb2c035a90ab64bc0565a8b7dd" X-Trace: blaine.gmane.org 1519151027 1534 195.159.176.226 (20 Feb 2018 18:23:47 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 20 Feb 2018 18:23:47 +0000 (UTC) To: Emacs developers Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Feb 20 19:23:42 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 1eoCZp-0008I8-A1 for ged-emacs-devel@m.gmane.org; Tue, 20 Feb 2018 19:23:41 +0100 Original-Received: from localhost ([::1]:57104 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eoCbp-0001pY-NR for ged-emacs-devel@m.gmane.org; Tue, 20 Feb 2018 13:25:45 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55363) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eoCMW-00068W-SZ for emacs-devel@gnu.org; Tue, 20 Feb 2018 13:09:58 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eoCMV-0005CM-AN for emacs-devel@gnu.org; Tue, 20 Feb 2018 13:09:56 -0500 Original-Received: from mail-yw0-x232.google.com ([2607:f8b0:4002:c05::232]:36570) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eoCMV-0005BF-2K for emacs-devel@gnu.org; Tue, 20 Feb 2018 13:09:55 -0500 Original-Received: by mail-yw0-x232.google.com with SMTP id t129so5122617ywc.3 for ; Tue, 20 Feb 2018 10:09:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=n0i3etMtsvWmU444qMJj7/oS+Wk0plVZQuwVZpGxlM8=; b=QwCyN+oSnDsSerVNbwY2bzj4e4PJMule2TIxnzymlPkOrVDmxkTWxV7iXcGvaSqTpj /WY43McKd8ay7vY6ruYjEbTGj6QDEanILGFo3NK2rFhlDFEdmdASdLw1oEnAql6Qvpgp aEdqfFMPdwNUf2VH7fTHEJOT/rAo4aGh73Xpp3MCuFPnSHXQGiXsJYTT/Z0HpeCwFQtR wna5FEcZnwHHfQvE5I7rEObGZrc/Rhr88czy22c/vhY8Az4JFLe13hvFSKTK6MvMpRt0 4SMZX3gYzuLsxK6tATEvgf4Vw3V1vEifx5nDSKwFUS8NV/wknokzGpcQ0QMnI96BO6Yu C3zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=n0i3etMtsvWmU444qMJj7/oS+Wk0plVZQuwVZpGxlM8=; b=g9HgBW6vUr6KVmPiDeRV9NSi7VW3UrQY+uqgoKy5xE0huJ9yAMTkK9jG05DQuoRrLL dhVHhzdYDZDveMs0H2XKbD8EzYNI5nW1j2M2BvjafSNn4NyDnOlZj1HsQlinIBhmqMRy 8aNQBKLuCZk1+pGvDIHQiu8kyCZSR1XcxXKhuXjVxyUN9aVRsmuXS9tQ1ll69eSRci7C 6lL70jN06eW3YBoJ6dH/e0jWKUepNKNwzcumLda+LOyKSNNLr3MeRTCuwCymMr7f6g+q GWWSAiFWZdOBap+uQ+TyHpDsPY2noggNBI/WTusVbYPvcmf8aityM4NgPNWMDn7SSXde rVNA== X-Gm-Message-State: APf1xPAmt6W8c9+0dFA93ysJvulr1nbSBH+a/AjLLdkqUvuSmocN0pDM TwJQFQDJUg9uSw0upEeU76doc6eAc1PKymuZY28= X-Google-Smtp-Source: AH8x224CO1Fl6jgTWRefnCIGFnVRGqqC7/OmRmNx6IArwk2YlDeZRtlkdHWYEAPkU+1WAq9msi9vNe6XJXgiMx3YdWo= X-Received: by 10.13.243.198 with SMTP id c189mr441741ywf.141.1519150193925; Tue, 20 Feb 2018 10:09:53 -0800 (PST) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4002:c05::232 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:222938 Archived-At: --94eb2c035a90ab64bc0565a8b7dd Content-Type: text/plain; charset="UTF-8" I have probably heavily over-engineered this; it helps me derive the default path for "share/" and "lisp/" directories. I couldn't find any internal variable that holds those values. Here's the code: (let* ((bin-dir (when (and invocation-directory (file-exists-p invocation-directory)) (file-truename invocation-directory))) (prefix-dir (when bin-dir (replace-regexp-in-string "bin/\\'" "" bin-dir))) (share-dir (when prefix-dir (concat prefix-dir "share/"))) (lisp-dir-1 (when share-dir ;Possibility where the lisp dir is something like ../emacs/26.0.50/lisp/ (concat share-dir "emacs/" ;; If `emacs-version' is x.y.z.w, remove the ".w" portion ;; Though, this is not needed and also will do nothing in emacs 26+ ;; http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=22b2207471807bda86534b4faf1a29b3a6447536 (replace-regexp-in-string "\\([0-9]+\\.[0-9]+\\.[0-9]+\\).*" "\\1" emacs-version) "/lisp/"))) (lisp-dir-2 (when share-dir ;Possibility where the lisp dir is something like ../emacs/25.2/lisp/ (concat share-dir "emacs/" (replace-regexp-in-string "\\([0-9]+\\.[0-9]+\\).*" "\\1" emacs-version) "/lisp/")))) (defvar modi/default-share-directory (when (file-exists-p share-dir) share-dir) "Share directory for this Emacs installation.") (defvar modi/default-lisp-directory (cond ((file-exists-p lisp-dir-1) lisp-dir-1) ((file-exists-p lisp-dir-2) lisp-dir-2) (t nil)) "Directory containing lisp files for the Emacs installation. This value must match the path to the lisp/ directory of the Emacs installation. If Emacs is installed using --prefix=\"${PREFIX_DIR}\" this value would typically be \"${PREFIX_DIR}/share/emacs//lisp/\".")) - Are there internal variables that hold those values? - Is there a better way to do the same? -- Kaushal Modi --94eb2c035a90ab64bc0565a8b7dd Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: base64 PGRpdiBkaXI9Imx0ciI+PGRpdj48ZGl2PjxkaXY+SSBoYXZlIHByb2JhYmx5IGhlYXZpbHkgb3Zl ci1lbmdpbmVlcmVkIHRoaXM7IGl0IGhlbHBzIG1lIGRlcml2ZSB0aGUgZGVmYXVsdCBwYXRoIGZv ciAmcXVvdDtzaGFyZS8mcXVvdDsgYW5kICZxdW90O2xpc3AvJnF1b3Q7IGRpcmVjdG9yaWVzLjxi cj48YnI+PC9kaXY+SSBjb3VsZG4mIzM5O3QgZmluZCBhbnkgaW50ZXJuYWwgdmFyaWFibGUgdGhh dCBob2xkcyB0aG9zZSB2YWx1ZXMuPGJyPjxicj48L2Rpdj5IZXJlJiMzOTtzIHRoZSBjb2RlOjxi cj48YnI+KGxldCogKChiaW4tZGlyICh3aGVuIChhbmQgaW52b2NhdGlvbi1kaXJlY3Rvcnk8YnI+ wqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoCAoZmls ZS1leGlzdHMtcCBpbnZvY2F0aW9uLWRpcmVjdG9yeSkpPGJyPsKgwqDCoMKgwqDCoMKgwqDCoMKg wqDCoMKgwqDCoMKgwqAgKGZpbGUtdHJ1ZW5hbWUgaW52b2NhdGlvbi1kaXJlY3RvcnkpKSk8YnI+ wqDCoMKgwqDCoMKgIChwcmV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