Crandel / tempel-collection

Collection tempel templates
GNU General Public License v3.0
77 stars 27 forks source link

Feature request: Show config example that does not depend on use-package #33

Closed jgarte closed 1 year ago

jgarte commented 1 year ago

It would be cool to have configuration instructions in vanilla elisp.

What would that look like for this tempel-collection?

Crandel commented 1 year ago

Fill free to make PR with elisp instructions.

jgarte commented 1 year ago

Fill free to make PR with elisp instructions.

I'm asking because I don't know what it would be but I can do some research.

idlip commented 1 year ago

Run emacs-lisp-macroexpand on sexp, and you would see the underlying code. Use-package is just a macro that is for convenience.

(use-package tempel-collection
  :ensure t
  :after tempel
)

when (setq use-package-expand-minimally t) is set, it expands to ==>

(progn
  (use-package-ensure-elpa 'tempel-collection
                           '(t)
                           'nil)
  (eval-after-load 'tempel
    '(require 'tempel-collection nil nil)))

When (setq use-package-expand-minimally nil) is set, it expands to =>

(progn
  (use-package-ensure-elpa 'tempel-collection
                           '(t)
                           'nil)
  (defvar use-package--warning2
    #'(lambda
        (keyword err)
        (let
            ((msg
              (format "%s/%s: %s" 'tempel-collection keyword
                      (error-message-string err))))
          (display-warning 'use-package msg :error))))
  (condition-case-unless-debug err
      (eval-after-load 'tempel
        '(let
             ((now
               (current-time)))
           (message "%s..." "Loading package tempel-collection")
           (prog1
               (if
                   (not
                    (require 'tempel-collection nil t))
                   (display-warning 'use-package
                                    (format "Cannot load %s" 'tempel-collection)
                                    :error))
             (let
                 ((elapsed
                   (float-time
                    (time-subtract
                     (current-time)
                     now))))
               (if
                   (> elapsed 0.1)
                   (message "%s...done (%.3fs)" "Loading package tempel-collection" elapsed)
                 (message "%s...done" "Loading package tempel-collection"))))))
    (error
     (funcall use-package--warning2 :catch err))))

Hope you get some idea, you can read docstring from the symbol at point. Recommend to Use helpful package!

idlip commented 1 year ago

But i guess, this is enough

(eval-after-load 'tempel
  '(require 'tempel-collection))
jgarte commented 1 year ago

But i guess, this is enough

(eval-after-load 'tempel
  '(require 'tempel-collection))

🤯🤯🤯

jgarte commented 1 year ago

Recommend to Use helpful package!

TIL

jgarte commented 1 year ago

Closing as solved.