Skip to content

Instantly share code, notes, and snippets.

@g-gundam

g-gundam/init.el Secret

Created October 1, 2022 15:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save g-gundam/06f54e13fc41ca50dc6ad5933d4d4f04 to your computer and use it in GitHub Desktop.
Save g-gundam/06f54e13fc41ca50dc6ad5933d4d4f04 to your computer and use it in GitHub Desktop.
Setting up emacs from scratch
;; melpa
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(package-initialize)
;; package installation and configuration
(use-package olivetti
:ensure t)
(use-package exotica-theme
:ensure t)
;; the rest...
(defun my/initial-layout ()
"Create my initial screen layout."
(interactive)
;; 1. to have exotica theme mode enabled, along with
(load-theme 'exotica t)
;; 2. having org-mode launch in scratch buffer from the beginning, and
(switch-to-buffer "*scratch*")
(org-mode)
(org-indent-mode)
;; 3. to have olivetti mode enabled too.
(olivetti-mode)
(delete-other-windows)
)
(my/initial-layout)
;; Everything below this was added by emacs.
(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.
'(inhibit-startup-screen t)
'(package-selected-packages '(exotica-theme use-package olivetti)))
(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.
)
@g-gundam
Copy link
Author

g-gundam commented Oct 1, 2022

MELPA and use-package

The first thing I did was create ~/.emacs.d/init.el and setup MELPA which lets me install more packages.

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

This let me use M-x package-install to install use-package. Once that's installed, I can install packages with use-package declarations.

;; package installation and configuration
(use-package olivetti
  :ensure t)

(use-package exotica-theme
  :ensure t)

Configuration

With all the prerequisites installed, I was able to finish writing a config that would solve this question on emacs.stackexchange.org.

;; the rest...
(defun my/initial-layout ()
  "Create my initial screen layout."
  (interactive)
  ;; 1. to have exotica theme mode enabled, along with
  (load-theme 'exotica t)
  ;; 2. having org-mode launch in scratch buffer from the beginning, and
  (switch-to-buffer "*scratch*")
  (org-mode)
  (org-indent-mode)
  ;; 3. to have olivetti mode enabled too.
  (olivetti-mode)
  (delete-other-windows)
  )

(my/initial-layout)

The end result looks like this:

exotica,org-mode,olivetti-mode

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment