this post was submitted on 17 Nov 2023
1 points (100.0% liked)

Emacs

313 readers
3 users here now

A community for the timeless and infinitely powerful editor. Want to see what Emacs is capable of?!

Get Emacs

Rules

  1. Posts should be emacs related
  2. Be kind please
  3. Yes, we already know: Google results for "emacs" and "vi" link to each other. We good.

Emacs Resources

Emacs Tutorials

Useful Emacs configuration files and distributions

Quick pain-saver tip

founded 1 year ago
MODERATORS
 

emacs noob here.

I'm rewriting my init.el file from scratch using use-package macro. In my existing init file I use require to configure MELPA package archive.

(require 'package)

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

(package-initialize)

Can I rewrite this using use-package macro?

you are viewing a single comment's thread
view the rest of the comments
[–] mekeor@alien.top 1 points 1 year ago

I don't use use-package myself, but maybe you could write:

(use-package package
  :init
  (add-to-list 'package-archives '("MELPA" . "http://melpa.org/packages/")))

I'd expect it to understand that you are referring to package.el, where package-archives variable is defined.