From: Kaushal Modi <kaushal.modi@gmail.com>
To: Emacs developers <emacs-devel@gnu.org>
Subject: Default share/ and lisp/ directories?
Date: Tue, 20 Feb 2018 18:09:43 +0000 [thread overview]
Message-ID: <CAFyQvY3Z_vcH2OY2CkpAw8FguOwqZqGdyozaSwM2ECK9T549zA@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 2421 bytes --]
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/<VERSION>/lisp/\"."))
- Are there internal variables that hold those values?
- Is there a better way to do the same?
--
Kaushal Modi
[-- Attachment #2: Type: text/html, Size: 3648 bytes --]
next reply other threads:[~2018-02-20 18:09 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-20 18:09 Kaushal Modi [this message]
2018-02-20 18:48 ` Default share/ and lisp/ directories? Drew Adams
2018-02-20 20:27 ` Kaushal Modi
2018-02-20 21:06 ` Noam Postavsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAFyQvY3Z_vcH2OY2CkpAw8FguOwqZqGdyozaSwM2ECK9T549zA@mail.gmail.com \
--to=kaushal.modi@gmail.com \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.