Emacs: Best-practice for lazy loading modes in .emacs?

后端 未结 2 2043
温柔的废话
温柔的废话 2020-12-30 08:54

Is there a best practice around lazily loading modes when encountering a relevant file extension?

At this point I have roughly 25 different Emacs modes installed, a

相关标签:
2条回答
  • 2020-12-30 09:33

    This is one way,

    (provide 'my-slime)
    (eval-after-load "slime"
      '(progn
         (setq slime-lisp-implementations
               '((sbcl ("/usr/bin/sbcl"))
                 (clisp ("/usr/bin/clisp")))
               common-lisp-hyperspec-root "/home/sujoy/documents/hyperspec/")
         (slime-setup '(slime-asdf
                        slime-autodoc
                        slime-editing-commands
                        slime-fancy-inspector
                        slime-fontifying-fu
                        slime-fuzzy
                        slime-indentation
                        slime-mdot-fu
                        slime-package-fu
                        slime-references
                        slime-repl
                        slime-sbcl-exts
                        slime-scratch
                        slime-xref-browser))
         (slime-autodoc-mode)
         (setq slime-complete-symbol*-fancy t)
         (setq slime-complete-symbol-function 'slime-fuzzy-complete-symbol)
    (add-hook 'lisp-mode-hook (lambda () (slime-mode t)))))
    
    (require 'slime)
    

    along with,

    ;; slime mode
    (autoload 'slime "my-slime" "Slime mode." t)
    (autoload 'slime-connect "my-slime" "Slime mode." t)
    
    0 讨论(0)
  • 2020-12-30 09:42

    The facility you want is called autoloading. The clojure-mode source file, clojure-mode.el, includes a comment for how to arrange this:

    ;;     Add these lines to your .emacs:
    ;;       (autoload 'clojure-mode "clojure-mode" "A major mode for Clojure" t)
    ;;       (add-to-list 'auto-mode-alist '("\\.clj$" . clojure-mode))
    0 讨论(0)
提交回复
热议问题