curiosity in value of "source-directory" in function "autoload-generated-file" and in the containing file "autoload.el.gz"

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

curiosity in value of "source-directory" in function "autoload-generated-file" and in the containing file "autoload.el.gz"

Alan-114
I find it curious that the file "/Applications/Emacs.app/Contents/Resources/lisp/emacs-lisp/autoload.el.gz" has the following code:

(defun autoload-generated-file ()
  (expand-file-name generated-autoload-file
                    ;; File-local settings of generated-autoload-file should
                    ;; be interpreted relative to the file's location,
                    ;; of course.
                    (if (not (local-variable-p 'generated-autoload-file))
                        (expand-file-name "lisp" source-directory))))

and "source-directory" in this code has no other mention in this file, except in a comment.

I am debugging difficulties creating the file "vm-autoloads.el" using the View Mail machinery that allows one to update to the lastest trunk version of VM.  In doing so I run into a situation where "source-directory" has the value

"/Users/build/workspace/Emacs-Multi-Build/label/mavericks/emacs-source/lisp/vm-autoloads.el"

& this directory is unavailable (for good reason).

My system is:

Mac Book Air running OS X 10.12.5 Sierra

GNU Emacs 25.1.1 (x86_64-apple-darwin13.4.0, NS appkit-1265.21 Version 10.9.5 (Build 13F1911)) of 2016-09-20

I won't try to describe what I am doing to resolve the issues getting "vm-autoloads.el" built properly.  I only stop to remark about this curiosity that I see in the value of "source=directlry" when "autoload-generated-file" gets used.

For what it is worth, the posting at URL "https://stackoverflow.com/questions/10535529/emacs-elisp-expand-file-name-behaviour-on-windows" shows a similar difficulty with the value of "source-directory" in this function.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: curiosity in value of "source-directory" in function "autoload-generated-file" and in the containing file "autoload.el.gz"

Drew Adams
> I find it curious that the file
> "/Applications/Emacs.app/Contents/Resources/lisp/emacs-lisp/autoload.el.gz"
> has the following code:
>
> (defun autoload-generated-file ()
>   (expand-file-name generated-autoload-file
>                     (if (not (local-variable-p 'generated-autoload-file))
>                         (expand-file-name "lisp" source-directory))))
>
> and "source-directory" in this code has no other mention in this file,
> except in a comment.

`source-directory' is a predefined global variable.  `C-h v' tells
you this (where ... is filled in):

  source-directory is a variable defined in `C source code'.
  Its value is "..."

  Documentation:
  Directory in which Emacs sources were found when Emacs was built.
  You cannot count on them to still be there!

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: curiosity in value of "source-directory" in function "autoload-generated-file" and in the containing file "autoload.el.gz"

Eli Zaretskii
In reply to this post by Alan-114
> Date: Sun, 18 Jun 2017 09:51:37 -0700 (PDT)
> From: Alan <[hidden email]>
> Injection-Date: Sun, 18 Jun 2017 16:51:37 +0000
>
> I find it curious that the file "/Applications/Emacs.app/Contents/Resources/lisp/emacs-lisp/autoload.el.gz" has the following code:
>
> (defun autoload-generated-file ()
>   (expand-file-name generated-autoload-file
>                     ;; File-local settings of generated-autoload-file should
>                     ;; be interpreted relative to the file's location,
>                     ;; of course.
>                     (if (not (local-variable-p 'generated-autoload-file))
>                         (expand-file-name "lisp" source-directory))))
>
> and "source-directory" in this code has no other mention in this file, except in a comment.

source-directory is a built-in variable, defined in C.  The above
snippet is needed when building Emacs and when running it uninstalled,
i.e. from its build tree.  I think.

Loading...