unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Alexander Shukaev <haroogan@gmail.com>
To: emacs-devel <emacs-devel@gnu.org>
Subject: Correct Path to Emacs C Sources after Installation
Date: Tue, 4 Nov 2014 22:43:08 +0100	[thread overview]
Message-ID: <CAKu-7WxBryD9WeDQe4fhB3+tNrYCB5asoL_LxSXMWedTjPF8xg@mail.gmail.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 1720 bytes --]

Hello everyone,

I've raised a discussion about the "source-directory" variable on another
mailing list and we've come to some intermediate conclusion which might be
satisfying for everyone, so I think it is time to consider implementation
details.

Motivation is as follows. Currently, there is the following code:

  DEFVAR_LISP ("source-directory", Vsource_directory,
       doc: /* Directory in which Emacs sources were found when Emacs was
built.
You cannot count on them to still be there!  */);
  Vsource_directory
    = Fexpand_file_name (build_string ("../"),
 Fcar (decode_env_path (0, PATH_DUMPLOADSEARCH, 0)));


and "Vsource_directory", i.e. this is the default. Notice that
"PATH_DUMPLOADSEARCH" is a hard coded path to the root directory containing
Emacs sources during build. It means that in overwhelming number of cases
this directory already does not exist when Emacs is installed and used.
Why? Consider the following cases:

   1. Emacs sources were relocated/deleted after build;
   2. Emacs is being built on some build machine and then distributed as a
   prebuilt package to end users (the most common and convenient way to obtain
   Emacs for users today on all platforms), i.e. that path does not even exist
   on users' machines.

To summarize:

You cannot count on them to still be there!


I find this default annoying and I believe it can be improved. Here is the
solution that I see.

For the installation phase we add the *optional* "--install-sources" flag
which would trigger copying of C sources under "${etcdir}/../src" (which in
fact is "<datadir>/emacs/VERSION/src"). We also apply the attached patch.

Looking forward to your feedback. Thanks in advance.

Kind regards,
Alexander

[-- Attachment #1.2: Type: text/html, Size: 2545 bytes --]

[-- Attachment #2: lread.c.diff --]
[-- Type: text/plain, Size: 506 bytes --]

--- src/lread.c.orig	2014-11-04 20:29:22.129549000 +0100
+++ src/lread.c	2014-11-04 22:33:07.346414100 +0100
@@ -4351,6 +4351,12 @@
             } /* Vinstallation_directory != Vsource_directory */
 
         } /* if Vinstallation_directory */
+      else
+        {
+          Vsource_directory
+            = Fexpand_file_name (build_string ("../"),
+                                 Fcar (decode_env_path (0, PATH_DATA, 0)));
+        }
     }
   else                          /* !initialized */
     {

             reply	other threads:[~2014-11-04 21:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-04 21:43 Alexander Shukaev [this message]
2014-11-05  1:39 ` Correct Path to Emacs C Sources after Installation Stephen J. Turnbull
2014-11-05 12:59   ` Alexander Shukaev
2014-11-05 15:56 ` Eli Zaretskii
2014-11-05 16:23   ` Alexander Shukaev
2014-11-05 16:53     ` Eli Zaretskii

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAKu-7WxBryD9WeDQe4fhB3+tNrYCB5asoL_LxSXMWedTjPF8xg@mail.gmail.com \
    --to=haroogan@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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).