ox-hugo icon indicating copy to clipboard operation
ox-hugo copied to clipboard

void-function update-directory-autoload

Open vinurs opened this issue 1 year ago • 5 comments

i use the latest Emacs in https://github.com/emacs-mirror/emacs

Actual Behavior

make md

Expected Behavior

export the org files to md files

How to Reproduce the Issue

git clone https://github.com/kaushalmodi/ox-hugo.git
cd ox-hugo
make md

Example Org File

Generated Markdown File or Error

Loading /Users/vinurs/tmp/ox-hugo/test/setup-ox-hugo.el (source)...
Debug on Error enabled globally
Debugger entered--Lisp error: (void-function update-directory-autoloads)
  (update-directory-autoloads ox-hugo-site-git-root)
  (let ((generated-autoload-file ox-hugo-autoloads-file)) (update-directory-autoloads ox-hugo-site-git-root) (load-file ox-hugo-autoloads-file))
  (progn (setq load-prefer-newer t) (setq package-user-dir (format "%selpa_%s/" ox-hugo-tmp-dir emacs-major-version)) (require 'package) (let* ((no-ssl (and (memq system-type '(windows-nt ms-dos)) (not (gnutls-available-p)))) (protocol (if no-ssl "http" "https")) (melpa-url (concat protocol "://melpa.org/packages/"))) (let* ((x (cons "melpa" melpa-url))) (if (member x package-archives) package-archives (setq package-archives (append package-archives (list x)))))) (setq package-archives (delq (assoc "nongnu" package-archives) package-archives)) (let ((generated-autoload-file ox-hugo-autoloads-file)) (update-directory-autoloads ox-hugo-site-git-root) (load-file ox-hugo-autoloads-file)) (package-initialize) (add-to-list 'load-path (concat ox-hugo-site-git-root "doc/")) (add-to-list 'load-path ox-hugo-site-git-root) (defvar ox-hugo-missing-packages 'nil "List populated at each startup that contains the l...") (let ((--dolist-tail-- ox-hugo-packages) p) (while --dolist-tail-- (setq p (car --dolist-tail--)) (if (package-installed-p p) nil (if (member p ox-hugo-missing-packages) ox-hugo-missing-packages (setq ox-hugo-missing-packages (append ox-hugo-missing-packages (list p))))) (setq --dolist-tail-- (cdr --dolist-tail--)))) (if ox-hugo-missing-packages (progn (message "Emacs is now refreshing its package database...") (package-refresh-contents) (let ((--dolist-tail-- ox-hugo-missing-packages) p) (while --dolist-tail-- (setq p (car --dolist-tail--)) (message "Installing `%s' .." p) (package-install p) (setq --dolist-tail-- (cdr --dolist-tail--)))) (setq ox-hugo-missing-packages 'nil))))
  (if (and (stringp ox-hugo-tmp-dir) (file-exists-p ox-hugo-tmp-dir)) (progn (setq load-prefer-newer t) (setq package-user-dir (format "%selpa_%s/" ox-hugo-tmp-dir emacs-major-version)) (require 'package) (let* ((no-ssl (and (memq system-type '...) (not (gnutls-available-p)))) (protocol (if no-ssl "http" "https")) (melpa-url (concat protocol "://melpa.org/packages/"))) (let* ((x (cons "melpa" melpa-url))) (if (member x package-archives) package-archives (setq package-archives (append package-archives (list x)))))) (setq package-archives (delq (assoc "nongnu" package-archives) package-archives)) (let ((generated-autoload-file ox-hugo-autoloads-file)) (update-directory-autoloads ox-hugo-site-git-root) (load-file ox-hugo-autoloads-file)) (package-initialize) (add-to-list 'load-path (concat ox-hugo-site-git-root "doc/")) (add-to-list 'load-path ox-hugo-site-git-root) (defvar ox-hugo-missing-packages 'nil "List populated at each startup that contains the l...") (let ((--dolist-tail-- ox-hugo-packages) p) (while --dolist-tail-- (setq p (car --dolist-tail--)) (if (package-installed-p p) nil (if (member p ox-hugo-missing-packages) ox-hugo-missing-packages (setq ox-hugo-missing-packages (append ox-hugo-missing-packages ...)))) (setq --dolist-tail-- (cdr --dolist-tail--)))) (if ox-hugo-missing-packages (progn (message "Emacs is now refreshing its package database...") (package-refresh-contents) (let ((--dolist-tail-- ox-hugo-missing-packages) p) (while --dolist-tail-- (setq p (car --dolist-tail--)) (message "Installing `%s' .." p) (package-install p) (setq --dolist-tail-- (cdr --dolist-tail--)))) (setq ox-hugo-missing-packages 'nil)))) (error "The environment variable OX_HUGO_TMP_DIR needs to ..."))
  load-with-code-conversion("/Users/vinurs/tmp/ox-hugo/test/setup-ox-hugo.el" "/Users/vinurs/tmp/ox-hugo/test/setup-ox-hugo.el" nil nil)
  load-file("/Users/vinurs/tmp/ox-hugo/test/setup-ox-hugo.el")
  (progn (setenv "OX_HUGO_TMP_DIR" "/tmp/vinurs/ox-hugo-dev") (load-file (expand-file-name "setup-ox-hugo.el" "/Users/vinurs/tmp/ox-hugo/test")) (print-emacs-org-versions))
  command-line-1(("--eval" "(progn(setenv \"OX_HUGO_TMP_DIR\" \"/tmp/vinurs/ox-hu..." "--kill"))
  command-line()
  normal-top-level()

make: *** [vcheck_emacs] Error 255

vinurs avatar Aug 14 '22 07:08 vinurs

The update-directory-autoloads is a core Emacs function that's been there for many years. It's present is the latest commit to master (as of today 2022/08/14) as well: https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/emacs-lisp/autoload.el?id=6f36b67e4146ef4610916b7903fd292e1308daf5#n1027. It's part of the Emacs core library autoload.el.

make md gets called during ox-hugo auto testing on GitHub Actions as well. I haven't noticed this error yet.

Can you review your Emacs installation? What changed between the last time this worked and now?

kaushalmodi avatar Aug 14 '22 12:08 kaushalmodi

it seems there is no lisp/emacs-lisp/autoload.el file in the master https://github.com/emacs-mirror/emacs

vinurs avatar Aug 14 '22 13:08 vinurs

I am not aware of that mirror. Can you clone from the official repo https://git.savannah.gnu.org/cgit/emacs.git/ ?

kaushalmodi avatar Aug 14 '22 13:08 kaushalmodi

Actually, you are right! It looks like that autoload.el has been moved/changed on that master branch: https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/emacs-lisp

Let me know if you find an alternative for update-directory-autoloads on the master branch. You can ask about this on the Emacs devel mailing list or review the commit history and NEWS file.

kaushalmodi avatar Aug 14 '22 13:08 kaushalmodi

https://git.savannah.gnu.org/cgit/emacs.git/tree/etc/NEWS?id=d6831d1b0a18882d688a842721dd1592884a06e2#n487

The autoload.el is now obsolete. I'll add some workaround for this. Thanks for opening this issue.

kaushalmodi avatar Aug 14 '22 13:08 kaushalmodi

@vinurs Hello, does this patch fix this issue for you?

diff --git a/test/setup-ox-hugo.el b/test/setup-ox-hugo.el
index e19fb93..4d8b030 100644
--- a/test/setup-ox-hugo.el
+++ b/test/setup-ox-hugo.el
@@ -155,9 +155,11 @@ Emacs installation.  If Emacs is installed using
       (setq package-archives (delq (assoc "nongnu" package-archives) package-archives))
 
       ;; Generate/update and load the autoloads for ox-hugo.el and co.
-      (let ((generated-autoload-file ox-hugo-autoloads-file))
-        (update-directory-autoloads ox-hugo-site-git-root)
-        (load-file ox-hugo-autoloads-file))
+      (if (fboundp #'loaddefs-generate) ;Emacs 29+
+          (loaddefs-generate ox-hugo-site-git-root ox-hugo-autoloads-file)
+        (let ((generated-autoload-file ox-hugo-autoloads-file)) ;Emacs 28.x and older
+          (update-directory-autoloads ox-hugo-site-git-root)))
+      (load-file ox-hugo-autoloads-file)
 
       ;; Load emacs packages and activate them.
       ;; Don't delete this line.

I don't have Emacs 29 built, so I cannot test it.

kaushalmodi avatar Oct 07 '22 19:10 kaushalmodi

@vinurs I have closed this issue as the change in https://github.com/kaushalmodi/ox-hugo/pull/676 passed the CI run on emacs 29 as well. Let me know if this fix doesn't work for you and I'll reopen this issue.

kaushalmodi avatar Oct 07 '22 20:10 kaushalmodi

@kaushalmodi sorry for late reply, i tested it just now, it has beed fixed, thanks for ur help ^_^

vinurs avatar Oct 10 '22 03:10 vinurs

Thanks for confirming.

kaushalmodi avatar Oct 10 '22 12:10 kaushalmodi