Score:0

How to install emacs with magit on Ubuntu 20.04 (clean example)

je flag

I try to find an easy way to install emacs with magit on Ubuntu. Sounds easy, right?

Here is what didn't work:

  • sudo apt install emacs

then

  1. sudo apt install magit # --> no magit
  2. emacs . -> M+x -> list-packages -> search for "magit" (cannot be found in list)
  3. add a file ~/.emacs.d/init.el with the following content:

init.el:

;;re package
(require 'package)
    
;; add melpa stable
(add-to-list 'package-archives
                     '("melpa-stable" . "https://stable.melpa.org/packages/"))

(add-to-list 'package-archives
             (cons "gnu-devel" "https://elpa-gnu.org/devel/")
             t)

;; add melpa
;;(add-to-list 'package-archives
;;                   '("melpa" . "https://melpa.milkbox.net/packages/"))      
    
;; Initialise packages
(package-initialize)
    
;; get latest package information
(package-refresh-contents)
    
;; add use package
;; so packages can automatically be installed
;; required for reuse across computer or docker containers
(package-install 'use-package)
    
;; add magit for git
(use-package magit
               :ensure t
                   :pin melpa-stable)
(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(package-selected-packages (quote (magit use-package))))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 )

The last way is not particulary clean or easy either, so something less error prone way would be nice.

UPDATE
So apparantly the 3. option was installing magit, it was just not working with the usual keybindings, as described here. Unfortunately the 3. option (creating a custom init.el) file is causing emacs to take >10 seconds for opening. Apparantly every time I open emacs now it connects to all those servers specified in init.el even though there aren't any updates...

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.