jwiegley / use-package

A use-package declaration for simplifying your .emacs
https://jwiegley.github.io/use-package
GNU General Public License v3.0
4.39k stars 259 forks source link

Add autoloading keywords to a fork of general.el #938

Open shadowrylander opened 3 years ago

shadowrylander commented 3 years ago

Hello!

As in the title; I have forked general.el to add a few autoloaded keywords of my own, by using the :general keyword use-package functions as a template. However, this bit of code, originally used for :general, is not working (read "not being autoloaded"):

    (defun use-package-handler/:gone (name _keyword args rest state)
        "Use-package handler for :gone."
        (use-package-concat
         (use-package-process-keywords name rest state)
         `(,@(mapcar (lambda (arglist)
                       ;; Note: prefix commands are not valid functions
                       (if (or (functionp (car arglist))
                               (macrop (car arglist)))
                           `(,@arglist :package ',name)
                         `(general-def (:keymaps '(global aiern-insert-state-map aiern-normal-state-map))
                            ,@arglist
                            :package ',name)))
                     (plist-get args :arglists)))))

The part I have changed is the general-def bit, by adding (:keymaps '(global aiern-insert-state-map aiern-normal-state-map)). When demanding the package, it works fine. Am I missing anything here? I've also copied the use-package-autoloads/:general and use-package-handler/:general functions as well, which are exactly the same, and renamed them appropriately.

Thank you kindly for the help!

shadowrylander commented 3 years ago

So, I've found the solution! ... Use the normalizer, handler, and autoloader for :ghook instead...


  (defun use-package-handler/:gone (name _keyword arglists rest state)
    "Use-package handler for :gone"
    (use-package-concat
     (use-package-process-keywords name rest state)
     `(,@(mapcar (lambda (arglist)
                   arglist
                   `(general-def :keymaps '(global aiern-insert-state-map aiern-normal-state-map) ,@arglist))
                 arglists))))

  (defalias 'use-package-autoloads/:gone #'use-package-autoloads/:ghook)
  (defalias 'use-package-normalize/:gone #'use-package-normalize/:ghook)
shadowrylander commented 3 years ago

Actually, no; it still doesn't autoload.