From 4beb850efb99b881fb8b648ad7bb43c6539a2431 Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Tue, 24 Dec 2019 20:48:49 +0100 Subject: add native support to the build system --- lisp/emacs-lisp/autoload.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lisp/emacs-lisp/autoload.el') diff --git a/lisp/emacs-lisp/autoload.el b/lisp/emacs-lisp/autoload.el index 785e350e0e5..53d353858b3 100644 --- a/lisp/emacs-lisp/autoload.el +++ b/lisp/emacs-lisp/autoload.el @@ -1045,7 +1045,7 @@ write its autoloads into the specified file instead." ;; we don't want to depend on whether Emacs was ;; built with or without modules support, nor ;; what is the suffix for the underlying OS. - (unless (string-match "\\.\\(elc\\|so\\|dll\\)" suf) + (unless (string-match "\\.\\(elc\\|eln\\|so\\|dll\\)" suf) (push suf tmp))) (concat "^[^=.].*" (regexp-opt tmp t) "\\'"))) (files (apply #'nconc -- cgit v1.2.3 From 8db8c851ad1568d61ed50a4d087e6de2b475cf5f Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Tue, 14 Apr 2020 19:58:41 +0100 Subject: Always set `load-true-file-name' where `load-file-name' is set too. Fix bug#40620. * lisp/cus-dep.el (custom-make-dependencies): Set load-true-file-name. * lisp/emacs-lisp/package.el (package-quickstart-refresh): Likewise. * lisp/international/mule.el (load-with-code-conversion): Likewise. * lisp/loadup.el (load-true-file-name): Likewise. --- lisp/cus-dep.el | 1 + lisp/emacs-lisp/autoload.el | 4 +++- lisp/emacs-lisp/package.el | 3 ++- lisp/international/mule.el | 5 +++-- lisp/loadup.el | 1 + 5 files changed, 10 insertions(+), 4 deletions(-) (limited to 'lisp/emacs-lisp/autoload.el') diff --git a/lisp/cus-dep.el b/lisp/cus-dep.el index fd307a5c04e..e2c2ebe5f42 100644 --- a/lisp/cus-dep.el +++ b/lisp/cus-dep.el @@ -90,6 +90,7 @@ Usage: emacs -batch -l ./cus-dep.el -f custom-make-dependencies DIRS" (string-match "\\`\\(.*\\)\\.el\\'" file) (let ((name (or generated-autoload-load-name ; see bug#5277 (file-name-nondirectory (match-string 1 file)))) + (load-true-file-name file) (load-file-name file)) (if (save-excursion (re-search-forward diff --git a/lisp/emacs-lisp/autoload.el b/lisp/emacs-lisp/autoload.el index 6180bee2aa7..d9a43c23299 100644 --- a/lisp/emacs-lisp/autoload.el +++ b/lisp/emacs-lisp/autoload.el @@ -167,7 +167,9 @@ expression, in which case we want to handle forms differently." define-inline cl-defun cl-defmacro cl-defgeneric cl-defstruct pcase-defmacro)) (macrop car) - (setq expand (let ((load-file-name file)) (macroexpand form))) + (setq expand (let ((load-true-file-name file) + (load-file-name file)) + (macroexpand form))) (memq (car expand) '(progn prog1 defalias))) (make-autoload expand file 'expansion)) ;Recurse on the expansion. diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 4312ab9ca9a..b33e4897a01 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -3965,7 +3965,8 @@ activations need to be changed, such as when `package-load-list' is modified." (let ((load-suffixes '(".el" ".elc"))) (locate-library (package--autoloads-file-name pkg)))) (pfile (prin1-to-string file))) - (insert "(let ((load-file-name " pfile "))\n") + (insert "(let ((load-true-file-name " pfile ")\ +(load-file-name " pfile "))\n") (insert-file-contents file) ;; Fixup the special #$ reader form and throw away comments. (while (re-search-forward "#\\$\\|^;\\(.*\n\\)" nil 'move) diff --git a/lisp/international/mule.el b/lisp/international/mule.el index 72e8cad9d62..363df13dfe6 100644 --- a/lisp/international/mule.el +++ b/lisp/international/mule.el @@ -320,8 +320,9 @@ Return t if file exists." (when purify-flag (push (purecopy file) preloaded-file-list)) (unwind-protect - (let ((load-file-name fullname) - (set-auto-coding-for-load t) + (let ((load-true-file-name fullname) + (load-file-name fullname) + (set-auto-coding-for-load t) (inhibit-file-name-operation nil)) (with-current-buffer buffer ;; So that we don't get completely screwed if the diff --git a/lisp/loadup.el b/lisp/loadup.el index 3cc47bc91fa..7cf2cb01c33 100644 --- a/lisp/loadup.el +++ b/lisp/loadup.el @@ -566,6 +566,7 @@ lost after dumping"))) ;; Don't keep `load-file-name' set during the top-level session! ;; Otherwise, it breaks a lot of code which does things like ;; (or load-file-name byte-compile-current-file). +(setq load-true-file-name nil) (setq load-file-name nil) (eval top-level) -- cgit v1.2.3 From a06fe08e8e8177ae3ccd6e2677b40237cd86ae9d Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Mon, 28 Sep 2020 17:20:55 +0200 Subject: Clean-up some now unnecessary diff against master * lisp/emacs-lisp/autoload.el (update-directory-autoloads): .eln files have been moved so remove the '.eln' match. * lisp/emacs-lisp/bytecomp.el (byte-compile-refresh-preloaded): Likewise. * lisp/emacs-lisp/find-func.el (find-library-suffixes): Clean-up as '.eln' is no more in `load-suffixes'. * lisp/help-fns.el (find-lisp-object-file-name): Clean-up as `symbol-file' will return the '.elc' file. * src/lread.c (Fget_load_suffixes): Remove logic as '.eln' is not anymore in load-suffixes. (openp): Two spaces. --- lisp/emacs-lisp/autoload.el | 2 +- lisp/emacs-lisp/bytecomp.el | 3 +-- lisp/emacs-lisp/find-func.el | 3 +-- lisp/help-fns.el | 11 +++-------- src/lread.c | 23 +++-------------------- 5 files changed, 9 insertions(+), 33 deletions(-) (limited to 'lisp/emacs-lisp/autoload.el') diff --git a/lisp/emacs-lisp/autoload.el b/lisp/emacs-lisp/autoload.el index 4bdbc95081f..5ee0a14273f 100644 --- a/lisp/emacs-lisp/autoload.el +++ b/lisp/emacs-lisp/autoload.el @@ -1047,7 +1047,7 @@ write its autoloads into the specified file instead." ;; we don't want to depend on whether Emacs was ;; built with or without modules support, nor ;; what is the suffix for the underlying OS. - (unless (string-match "\\.\\(elc\\|eln\\|so\\|dll\\)" suf) + (unless (string-match "\\.\\(elc\\|so\\|dll\\)" suf) (push suf tmp))) (concat "\\`[^=.].*" (regexp-opt tmp t) "\\'"))) (files (apply #'nconc diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 4a2a8c62cbc..b0e3158df32 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -5180,8 +5180,7 @@ Use with caution." (message "Can't find %s to refresh preloaded Lisp files" argv0) (dolist (f (reverse load-history)) (setq f (car f)) - (when (string-match "el[cn]\\'" f) - (setq f (substring f 0 -1))) + (if (string-match "elc\\'" f) (setq f (substring f 0 -1))) (when (and (file-readable-p f) (file-newer-than-file-p f emacs-file) ;; Don't reload the source version of the files below diff --git a/lisp/emacs-lisp/find-func.el b/lisp/emacs-lisp/find-func.el index a4577a53164..9e4d8cf1aa8 100644 --- a/lisp/emacs-lisp/find-func.el +++ b/lisp/emacs-lisp/find-func.el @@ -167,8 +167,7 @@ See the functions `find-function' and `find-variable'." (defun find-library-suffixes () (let ((suffixes nil)) (dolist (suffix (get-load-suffixes) (nreverse suffixes)) - (unless (string-match "el[cn]" suffix) - (push suffix suffixes))))) + (unless (string-match "elc" suffix) (push suffix suffixes))))) (defun find-library--load-name (library) (let ((name library)) diff --git a/lisp/help-fns.el b/lisp/help-fns.el index 88984ec453e..9fee156f18f 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el @@ -323,17 +323,12 @@ found via `load-path'. The return value can also be `C-source', which means that OBJECT is a function or variable defined in C. If no suitable file is found, return nil." (let* ((autoloaded (autoloadp type)) - (true-name (or (and autoloaded (nth 1 type)) + (file-name (or (and autoloaded (nth 1 type)) (symbol-file ;; FIXME: Why do we have this weird "If TYPE is the ;; value returned by `symbol-function' for a function ;; symbol" exception? - object (or (if (symbolp type) type) 'defun)))) - (file-name (if (and true-name - (string-match "[.]eln\\'" true-name)) - (gethash (file-name-nondirectory true-name) - comp-eln-to-el-h) - true-name))) + object (or (if (symbolp type) type) 'defun))))) (cond (autoloaded ;; An autoloaded function: Locate the file since `symbol-function' @@ -392,7 +387,7 @@ suitable file is found, return nil." ((let ((lib-name (if (string-match "[.]elc\\'" file-name) (substring-no-properties file-name 0 -1) - file-name))) + file-name))) (or (and (file-readable-p lib-name) lib-name) ;; The library might be compressed. (and (file-readable-p (concat lib-name ".gz")) lib-name)))) diff --git a/src/lread.c b/src/lread.c index d32f5755e98..ea31131b755 100644 --- a/src/lread.c +++ b/src/lread.c @@ -1056,25 +1056,8 @@ This uses the variables `load-suffixes' and `load-file-rep-suffixes'. */) { Lisp_Object exts = Vload_file_rep_suffixes; Lisp_Object suffix = XCAR (suffixes); - bool native_code_suffix = - NATIVE_COMP_FLAG - && strcmp (NATIVE_ELISP_SUFFIX, SSDATA (suffix)) == 0; - -#ifdef HAVE_MODULES - native_code_suffix = - native_code_suffix || strcmp (MODULES_SUFFIX, SSDATA (suffix)) == 0; -#ifdef MODULES_SECONDARY_SUFFIX - native_code_suffix = - native_code_suffix - || strcmp (MODULES_SECONDARY_SUFFIX, SSDATA (suffix)) == 0; -#endif -#endif - - if (native_code_suffix) - lst = Fcons (suffix, lst); - else - FOR_EACH_TAIL (exts) - lst = Fcons (concat2 (suffix, XCAR (exts)), lst); + FOR_EACH_TAIL (exts) + lst = Fcons (concat2 (suffix, XCAR (exts)), lst); } return Fnreverse (lst); } @@ -1698,6 +1681,7 @@ openp (Lisp_Object path, Lisp_Object str, Lisp_Object suffixes, int last_errno = ENOENT; int save_fd = -1; USE_SAFE_ALLOCA; + /* The last-modified time of the newest matching file found. Initialize it to something less than all valid timestamps. */ struct timespec save_mtime = make_timespec (TYPE_MINIMUM (time_t), -1); @@ -1898,7 +1882,6 @@ openp (Lisp_Object path, Lisp_Object str, Lisp_Object suffixes, /* We succeeded; return this descriptor and filename. */ if (storeptr) *storeptr = string; - SAFE_FREE (); return fd; } -- cgit v1.2.3