Skip to content

Instantly share code, notes, and snippets.

@madmo
Created June 29, 2021 08:51
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 madmo/402c41f98b4e353157bfb85004e6a91e to your computer and use it in GitHub Desktop.
Save madmo/402c41f98b4e353157bfb85004e6a91e to your computer and use it in GitHub Desktop.
emacs config
(require 'cl-lib)
(require 'package)
;; add melpa as package source
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(package-initialize)
;; list of packages to install
(defvar my-packages
'(smart-tabs-mode smart-tab company flycheck lsp-mode lsp-ui rustic)
"A list of packages to ensure are installed at launch.")
(defun my-packages-installed-p ()
(cl-loop for p in my-packages
when (not (package-installed-p p)) do (cl-return nil)
finally (cl-return t)))
(unless (my-packages-installed-p)
;; check for new packages (package versions)
(package-refresh-contents)
;; install the missing packages
(dolist (p my-packages)
(when (not (package-installed-p p))
(package-install p))))
;; utf-8
(prefer-coding-system 'utf-8)
(set-default-coding-systems 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
;; This from a japanese individual. I hope it works.
(setq default-buffer-file-coding-system 'utf-8)
;; From Emacs wiki
(setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING))
;;no splash
(setq inhibit-startup-message t)
;; make backspace work again wtf!!
(global-set-key "\C-h" 'delete-backward-char)
;; no backup files
(setq make-backup-files nil)
;; case insentitive search
(setq case-fold-search t)
;; tab width of 3
(setq-default tab-width 3)
;; C Indention settings
(setq c-default-style "k&r" c-basic-offset 3)
;;real smart tabs!!!
(global-smart-tab-mode 1)
;;show whitespaces
(setq-default show-trailing-whitespace t)
;; tags hilight
(font-lock-add-keywords 'c-mode
'(("\\<\\(FIXME\\|HACK\\|XXX\\|TODO\\)" 1 font-lock-warning-face prepend)))
;; clean interface
(if (fboundp 'scroll-bar-mode) (scroll-bar-mode -1))
(if (fboundp 'tool-bar-mode) (tool-bar-mode -1))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment