mbj4668 / yang-mode

Emacs mode for YANG (RFC 7950)
10 stars 4 forks source link

autoload not working with GNU Emacs 25.2.1/use-package #4

Closed hutchjw closed 6 years ago

hutchjw commented 7 years ago

---------------Using commit version 0d5d5df86dbb6cbb2de3c0f2d0d5f8c8f29d0695, results in autoload.el with

;;;***
^L ;;;### (autoloads nil "yang-mode/yang-mode" "yang-mode/yang-mode.el"
;;;;;; (22740 3656 0 0))
;;; Generated autoloads from yang-mode/yang-mode.el
(autoload 'yang-mode "yang-mode" "" t nil)

(add-to-list 'auto-mode-alist '("\.yang\'" . yang-mode))

---------------------after making the following workaround, I was able to get it to work:

diff --git a/yang-mode.el b/yang-mode.el index 6d405a2..18811f3 100644 --- a/yang-mode.el +++ b/yang-mode.el @@ -358,8 +358,8 @@ (defmacro yang-define-derived-mode (mode &rest args) `(define-derived-mode ,mode nil ,@args)))

-;;;###autoload(autoload 'yang-mode "yang-mode" "" t nil) -(yang-define-derived-mode yang-mode "YANG" +;;;###autoload +(define-derived-mode yang-mode nil "YANG" "Major mode for editing YANG modules.

The hook `c-mode-common-hook' is run with no args at mode

----------------now the autoload.el looks like:

;;;***
^L ;;;### (autoloads nil "yang-mode/yang-mode" "yang-mode/yang-mode.el"
;;;;;; (22879 51536 0 0))
;;; Generated autoloads from yang-mode/yang-mode.el

(autoload 'yang-mode "yang-mode/yang-mode" "\
Major mode for editing YANG modules.

The hook c-mode-common-hook' is run with no args at mode initialization, thenyang-mode-hook'.

Key bindings:
\{yang-mode-map}

(fn)" t nil)

(add-to-list 'auto-mode-alist '("\.yang\'" . yang-mode))

daviderestivo commented 7 years ago

Hi hutchjw,

I have the following config in my init.el

;; YANG mode
(use-package yang-mode
  :ensure t)

I was successful in loading the yang-mode by removing yang-mode.elc:

xxxxxx@yyyyyyy ~/.emacs.d/elpa $ cd yang-mode-20170323.1104/
xxxxxx@yyyyyyy ~/.emacs.d/elpa/yang-mode-20170323.1104 $ ls
yang-mode-autoloads.el yang-mode-pkg.el       yang-mode.el           yang-mode.elc
xxxxxx@yyyyyyy ~/.emacs.d/elpa/yang-mode-20170323.1104 $ rm yang-mode.elc

I hope this help.

Regards, Davide

nickbroon commented 6 years ago

I also need to use the work around to get yang-mode to work.

rm ~/.emacs.d/elpa/yang-mode-20170323.1104/yang-mode.elc

I'm not sure what the underlying bug is.

mbj4668 commented 6 years ago

Fixed by aafb38e.