Emacs is a lisp machine (a byte-code interpreter) which happens to have a few layers of DLSs for editing text.

Learning, using and customizing Emacs is the practice of problem solving using the right principles, the right language and right aesthetics. Emacs is classy as fuck.

Aside from that there are packages: python-mode, cc-mode, rust-mode, org-mode and pdf-tools, which eliminate some of suffering inherent in mundane programming tasks.

see also Emacs


Getting the sources.

git clone --depth=1

Some hardening.

export CFLAGS="-Wformat -Wformat-security -Werror=format-security \
    -Wstack-protector -fstack-protector-all --param ssp-buffer-size=1 \
    -fPIE \
    -fno-omit-frame-pointer \
    -Wstrict-aliasing=2 -fno-strict-aliasing \
    -fasynchronous-unwind-tables \
    -m64 -D_FILE_OFFSET_BITS=64 \
    -pthread -D_REENTRANT \
    -march=native -mtune=native -O3 \
    -fopenmp=libomp \
    -ffunction-sections -fdata-sections \
export LDFLAGS="-L/usr/local/lib \
    -pthread \
    -rtlib=compiler-rt \
    -fopenmp=libomp \
    -lm \
    -fPIE -pie \
    -Wl,--gc-sections -Wl,--as-needed \
    -Wl,-z,relro -Wl,-z,now -Wl,-z,noexecstack"


cd emacs
mkdir build
cd build
../configure --prefix=/usr/local \
    --with-wide-int \
    --with-xft \
    --with-xim \
    --with-x \
    --with-x-toolkit=gtk3 \

make -s -j3 bootstrap
sudo make -s install

Essential configuration

Do not install ready-made configs, like Doom-emacs or Centaur or whatever. Get the understanding first, then look how they did it.

Notice how declarative instead of imperative approach works in practice.

(tool-bar-mode -1)
(menu-bar-mode -1)
(scroll-bar-mode -1)

(add-to-list 'default-frame-alist '(fullscreen . maximized))

(setq inhibit-startup-screen t)
(setq initial-scratch-message "")

(setq initial-major-mode 'emacs-lisp-mode)

(setq-default font-lock-maximum-decoration t)

(set-frame-font "SF Mono Light 16" t t)

  (require 'package)
  (add-to-list 'package-archives
               '("melpa" . "") t)
  (setq package-user-dir (expand-file-name "elpa" user-emacs-directory))

(setq load-prefer-newer t
      package-enable-at-startup nil)

  (unless (package-installed-p 'use-package)
    (package-install 'use-package)
    (package-install 'diminish)))

(require 'diminish)                ;; if you use :diminish
(require 'bind-key)                ;; if you use any :bind variant

(require 'use-package)

(setq use-package-always-defer nil
      use-package-always-ensure nil)

(use-package solarized-theme
  :ensure t
  (setq solarized-use-variable-pitch nil)
  (load-theme 'solarized-dark t))

(use-package guru-mode
  :ensure t
  :diminish (guru-mode)
  (guru-global-mode t))

(use-package which-key
  :ensure t
  :diminish (which-key-mode)
  (which-key-mode t))


Essential packages


(use-package smartparens
  :ensure t
  :diminish (smartparens-mode)
  (smartparens-global-mode t))
(use-package rainbow-delimiters
  :ensure t
  (rainbow-delimiters-mode t))


Documentation (built-in package)

(use-package eldoc
  :diminish (eldoc-mode)
  (eldoc-mode t))



(use-package flycheck
  :ensure t
  (global-flycheck-mode t))



(use-package company
  :ensure t
  :diminish (company-mode)
  (global-company-mode t))


(use-package lsp-mode
  :ensure t
  :hook (programming-mode . lsp)
  (setq lsp-prefer-flymake nil)
  (setq lsp-auto-guess-root t)
  (setq lsp-keep-workspace-alive nil)
  (require 'lsp)
  (require 'lsp-clients)
  (add-hook 'programming-mode-hook 'lsp)
  (add-hook 'lsp-after-open-hook 'lsp-enable-imenu))

(use-package lsp-ui
  :ensure t
  :after lsp
  :hook (lsp-mode . lsp-ui-mode)
  (setq lsp-ui-sideline-enable t)
  (setq lsp-ui-doc-enable t)
  (setq lsp-ui-peek-enable t)
  (setq lsp-ui-peek-always-show t))
(use-package company-lsp
  :ensure t
  :after company lsp-mode
  (push 'company-lsp company-backends))
Last modified 6 months ago Last modified on Aug 31, 2019, 3:11:06 AM
Note: See TracWiki for help on using the wiki.