all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Alexander Shukaev <haroogan@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: Correct Path to Emacs C Sources after Installation
Date: Wed, 05 Nov 2014 18:53:40 +0200	[thread overview]
Message-ID: <834mudvbaj.fsf@gnu.org> (raw)
In-Reply-To: <CAKu-7WwE42dMK_4iky=w6MC7dZ=NBW9KD4zTB24CGc6=ej4yFQ@mail.gmail.com>

> Date: Wed, 5 Nov 2014 17:23:35 +0100
> From: Alexander Shukaev <haroogan@gmail.com>
> 
>     Unless I'm missing something, this unconditionally sets the value of
>     source-directory to /usr/local/share/emacs/VERSION/etc/ in the
>     installed binary, is that right? If so, I don't think this can be
>     acceptable, because it disallows the current practice of leaving the
>     sources where Emacs was built.
> 
> It sets the default to "/usr/local/share/emacs/VERSION/" only when Emacs is
> installed.

What happens in the installed Emacs _is_ the focus in this discussion.

Like I said, I don't think it's acceptable to break the current
behavior, because some people (like myself, for example) leave the
source tree of an installed Emacs around for a very long time, in the
same place where Emacs was compiled.  We must continue supporting this
use case.  There's no reason to stop supporting it.

> So that sources would end up under "/usr/local/share/emacs/VERSION/src".

They will not be found there, unless Emacs is configured with the
(proposed) option of installing the sources.  So by disabling the
current behavior, you break an existing feature, which I don't think
is acceptable, or even justified.

>     As I said earlier, I like Stefan's suggestion of changing the users of
>     this variable, so that they could look in alternative places if the C
>     sources in source-directory are not accessible.
> 
> They can tweak it by changing this variable manually to point to those
> alternative places.

Who are "they"?  By "users" I meant here the code that uses this
variable, I didn't mean people.

What I'm saying is that instead of changing the value of
source-directory, make the functions which use it look in other places
if the file they look for is not found under source-directory.  This
way, the existing behavior is preserved, and your optional behavior
becomes possible, _if_ the sources aren't in the place where Emacs was
built.  I think this gives you the best of both worlds.

> Here we're considering only reasonable default. By the way
> this default complies with how "load-path" is initialized.

The way load-path is used and its purpose are very different.

>     After all, it might
>     well be that the sources are being removed while Emacs is running, so
>     a one-time computation might still cause failure.
>     
> 
> After all, it might be that "lisp" and "site-lisp" sources are removed too and
> then Emacs would fail too. It's not about 1 time computation here. If ones
> moves sources, then one is responsible to change the value of the variable
> manually through Emacs Lisp. Once again the discussion is about default. Anyway
> what's your point here?

My point is that moving the solution to the functions that use this
variable solves your problem, and in addition (a) doesn't break
existing behavior, and (b) can support the use case where Someone(TM)
removes the source tree while SomeoneElse(TM) has an Emacs session
running on the same system.  The latter might not be a big deal, but
it's an advantage that you get for free.

>     There are only 2 users of source-directory now: find-func.el and
>     check-declare.el. All you need is to teach them to look in
>     data-directory if the files cannot be found in source-directory. I
>     think this will be much easier, and perhaps should also use some
>     defcustom that users could customize (e.g., Emacs could look in a list
>     of directories, not just one particular place).
>     
> 
> This haven't been done before, i.e. there was only a hard coded path to sources
> during build and nobody cared. Why would we need to do that now and why is this
> easier than the proposed patch, could you elaborate?

See above: it preserves the existing behavior, it doesn't change the
semantics of source-directory, and it solves your problem in a cleaner
way.

Put it another way: your original problem was that Emacs was unable to
show the implementation of Emacs primitives when the original source
directory was unavailable for some reason.  I say: solve that problem,
where it happens, i.e. in find-func.el, which looks for a C file to
show the function.

> You don't like C code changes?

It is true that we generally prefer to add features in Lisp rather
than in C.  But that's not the main issue in this case, at least not
IMO.



      reply	other threads:[~2014-11-05 16:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]

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=834mudvbaj.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=haroogan@gmail.com \
    /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.