6

I'm interested in trying out the features of the htmlize.el package that I read about here. The article does not explain how I can import it into emacs. What is the best way to do this?

  • I think replacing import an elisp program by installing an emacs package in the title is perhaps more descriptive. – Name Aug 20 '15 at 21:35
  • @Name Done. I guess my problem was that the documentation didn't make it clear that I could install the package via melpa, though admittedly this could be due to my own ignorance. – Brian Fitzpatrick Aug 20 '15 at 21:36
12

You can use the package manager to install a package and keep it up to date. htmlize isn't in the default archive, but you can easily add new ones (Marmalade and MELPA are the two most popular):

(add-to-list 'package-archives
             '("marmalade" . "http://marmalade-repo.org/packages/"))
(add-to-list 'package-archives
             '("melpa" . "http://melpa.org/packages/"))

Once you have the repositories set up, M-x package-install htmlize will install the package, M-x list-packages will list the available packages (and let you get updates on installed packages).

  • 2
    I'm making this the new accepted answer as it is what I ended up using. Thanks! – Brian Fitzpatrick Aug 21 '15 at 19:59
3

People sometimes overemphasize the use of package.el, IMO. Certainly, you can use it to download and install a library.

But you can also just download it (however), put its name in your load-path, and then require it. Especially for a one-file library, this is hardly difficult to do.

(add-to-list 'load-path "DIRECTORY WHERE htmlize.el[c] IS")
(require 'htmlize)

This is one "standard", and straightforward, way to "import" a library.

  • I ended up installing it via Melpa as per @kaushalmodi's comment on ReneFroger's answer. Your answer will undoubtedly be useful for future reference. Thanks! – Brian Fitzpatrick Aug 20 '15 at 20:25
  • 1
    MELPA is great - the best of the ELPA repositories (IMHO). Certainly by far the most used and most voluminous. – Drew Aug 20 '15 at 20:27
  • 5
    -1: Maybe I'm “overemphasizing” package.el, but now that after all these years we finally have a standard way to distribute and install Emacs Lisp packages we should recommend and encourage its use, and not cling to the bad old habits of downloading and copying random Elisp to random places. Just my 2 cents. – lunaryorn Aug 21 '15 at 17:10
  • @lunaryorn: 1) I did not say that you are overemphasizing anything. 2) It's not either-or black-vs-white. The package system is a real asset, and yes, its use should be advertised. It is not the only way to obtain and load libraries, however. And it doesn't hurt some Emacs users to know that. – Drew Aug 21 '15 at 17:24

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.