reddit / emacs

init.el question for Emas 28.1

LinuxTenderFoot · 2022-05-14 00:06
I was trying to start to setup an init.el. I'm going through a YouTube video breaking down the init.el to start with. I know that I have the font right because I can change the font and run M-x eval-buffer and the font size changes, and scroll bar, menu and tooltips are all disabled. The package archive reloading doesn't happen at least I think. I was under the impression that there will be lines in \*Messages\* saying the packages that are reloaded but I don't see them. below is my init.el file. please let me know if something is wrong, because after 5 times through, I don't see anything. (setq inhibit-startup-message t) (scroll-bar-mode -1) ; Diable visible scroll bar (tool-bar-mode -1) ; Disable the toolbar (tooltip-mode -1) ; Disable tooltips (set-fringe-mode 10) ; give some breathing room (menu-bar-mode -1) ; Disable the menu bar ;; Set up the visible bell (setq visible-bell t) (set-face-attribute 'default nil :font "Fira Code Retina" :height 118) (load-theme 'tango-dark) ;; Initialize package sources (require 'package) (setq package-archives '(("melpa" . "https://melpa.org/packages/") ("org" . "https://orgmode.org/elpa/") ("elpa" . "https://elpa.gnu.org/packages/"))) (package-initialize) (unless package-archive-contents (package-refresh-contents)) ;; Initialize use-package on non-Linux platforms (unless (package-installed-p 'use-package) (package-install 'use-package)) (require 'use-package) (setq use-package-always-ensure t)
Alan_Shutko · 2022-05-14 00:48
What are you trying to have happen? If I understand things correctly, (package-initialize) initializes the package system and reads cached archive file for all archives. That sets package-archive-contents. (unless package-archive-contents (package-refresh-contents)) This will do nothing if package-archive-contents is set (because it's `unless`). But it's not clear to me what you want to happen: update the list of packages? Update the packages?
thetemp_ · 2022-05-14 01:58
Just an aside that the video you're following might be outdated. You don't need the "org" package archive unless for some reason you're trying to use an *older* version of org-mode. From [https://orgmode.org/elpa.html](https://orgmode.org/elpa.html): >Beware that no new Org versions will be released on Org ELPA after 9.5. But Emacs 28.1 [comes with org version 9.5.3](https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/org/org.el?h=emacs-28). Also, there's a new package archive called "nongnu" that's included by default in Emacs 28.1. The `(setq package-archives '(...))` statement in your init.el would overwrite that archive, removing access to it. If you just want to add "melpa" to package-archives, you can replace that statement with this: (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
LinuxTenderFoot · 2022-05-14 02:04
I'm trying to learn how to use emacs and I was parroting someone's instructions, once I removed the unless condition (package-refresh-contents) worked. Thanks!
AnugNef4 · 2022-05-14 02:41
You want to call `use-package` on packages you want to have loaded and running in your emacs instance. You aren't doing that. E.g., I use `rainbow-delimiters`, and I have this after `(require 'use-package)` (use-package rainbow-delimiters :ensure t :config (add-hook 'prog-mode-hook 'rainbow-delimiters-mode))
LinuxTenderFoot · 2022-05-14 11:05
Thanks for the information! It turns out that while copying the package I must have gotten a set of empty lists because of typos and such. So, the (unless package-archive-contents line was causing me issues. Once I made it not conditional, I got the list. I need the practice, so I'm going to look up rainbow-delimiters on my own. It will also verify my lists are now complete. Thanks again!
LinuxTenderFoot · 2022-05-14 11:11
so I swap out the whole setq line for the add-to-list line you provided?
thetemp_ · 2022-05-14 13:53
You would replace this part: (setq package-archives '(("melpa" . "https://melpa.org/packages/") ("org" . "https://orgmode.org/elpa/") ("elpa" . "https://elpa.gnu.org/packages/"))) with this: (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/")) You can see the current value of the `package-archives` variable by doing "C-h v package-archives RET".
Bodertz · 2022-05-14 14:51
I'd recommend against disabling the menu bar if you are just starting out. It's useful for discovering what commands are available. If you really don't like it, you can still access the menu using `F10` or `M-``. Alternatively, you could install [La Carte](https://www.emacswiki.org/emacs/LaCarte), which allows you to access the menu bar commands without the menu bar being visible. To install it, just download the `lacarte.el` file into some directory, and in your init file, do: (add-to-list 'load-path "/path/to/the/directory") (require 'lacarte) ; maybe not necessary ;; bind the command lacarte-execute-menu-command ;; keep it at <f10> or change that to whatever key sequence you want (global-set-key (kbd "<f10>") 'lacarte-execute-menu-command)
LinuxTenderFoot · 2022-05-14 17:44
This is my first shot at an init.el but I've gotten a lot of good ideas that I'm going to tuck away for options later. One thing about emacs is it's crazy configurable, I've come to find Thanks for info!
LinuxTenderFoot · 2022-05-14 17:44
awesome! Thanks for the info!