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-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))
                        :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.


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-process-keywords name rest state)
     `(,@(mapcar (lambda (arglist)
                   `(general-def :keymaps '(global aiern-insert-state-map aiern-normal-state-map) ,@arglist))

  (defalias 'use-package-autoloads/:gone #'use-package-autoloads/:ghook)
  (defalias 'use-package-normalize/:gone #'use-package-normalize/:ghook)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.