unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Correct Path to Emacs C Sources after Installation
@ 2014-11-04 21:43 Alexander Shukaev
  2014-11-05  1:39 ` Stephen J. Turnbull
  2014-11-05 15:56 ` Eli Zaretskii
  0 siblings, 2 replies; 6+ messages in thread
From: Alexander Shukaev @ 2014-11-04 21:43 UTC (permalink / raw)
  To: emacs-devel


[-- 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 */
     {

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-11-05 16:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-04 21:43 Correct Path to Emacs C Sources after Installation Alexander Shukaev
2014-11-05  1:39 ` 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

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).