Change default fill-column to 100

This commit is contained in:
Wojciech Kozlowski 2020-11-22 11:17:49 +01:00
parent a37c544beb
commit 5906f63920
10 changed files with 306 additions and 331 deletions

View File

@ -13,7 +13,7 @@
;;; Commentary: ;;; Commentary:
;; ;;
;; This package serves to help further automate package management with ;; This package serves to help further automate package management with
;; `package'. The aim of this package is to expose a simple API which when ;; `package'. The aim of this package is to expose a simple API which when
;; provided with a list of desired packages will (i) install them and remove ;; provided with a list of desired packages will (i) install them and remove
;; any redundant packages, (ii) upgrade them, (iii) restore previous state. ;; any redundant packages, (ii) upgrade them, (iii) restore previous state.
;; ;;
@ -42,15 +42,15 @@ This buffer will be erased whenever
(defcustom emodule/error-log "*EModule-Error-Log*" (defcustom emodule/error-log "*EModule-Error-Log*"
"Buffer to which error logs will be printed by `emodule'. "Buffer to which error logs will be printed by `emodule'.
This buffer will be erased whenever This buffer will be erased whenever \\[emodule/install-packages]
\\[emodule/install-packages] is called." is called."
:type 'string) :type 'string)
(defcustom emodule/install-attempts 2 (defcustom emodule/install-attempts 2
"How many times to attempt a package installation. "How many times to attempt a package installation.
This only matters if for some reason a package fails to install This only matters if for some reason a package fails to install
on the first attempt. Sometimes re-attempting the installation on the first attempt. Sometimes re-attempting the installation
may fix the problem. Note that subsequent attempts are only made may fix the problem. Note that subsequent attempts are only made
after attempting to install all other packages first." after attempting to install all other packages first."
:type 'integer) :type 'integer)
@ -162,11 +162,11 @@ Log errors to `emodule/error-log'."
(defun emodule/delete-pkgs (delete-pkgs) (defun emodule/delete-pkgs (delete-pkgs)
"Delete all packages in DELETE-PKGS. "Delete all packages in DELETE-PKGS.
This will attempt to delete all installed versions. Log errors This will attempt to delete all installed versions. Log errors to
to `emodule/error-log'. This assumes all DELETE-PKGS can `emodule/error-log'. This assumes all DELETE-PKGS can be removed,
be removed, including packages that are dependencies as it is including packages that are dependencies as it is assumed they
assumed they would not be dependencies once all packages in would not be dependencies once all packages in DELETE-PKGS are
DELETE-PKGS are removed." removed."
(dolist (p delete-pkgs nil) (dolist (p delete-pkgs nil)
(emodule/print-deleting p) (emodule/print-deleting p)
(condition-case err (condition-case err
@ -192,9 +192,9 @@ dependency of one that is."
"Install DESIRED-PKGS and remove redundant packages. "Install DESIRED-PKGS and remove redundant packages.
First, any missing packages will be installed followed by the First, any missing packages will be installed followed by the
deletion of all packages that are not dependencies of anything in deletion of all packages that are not dependencies of anything in
DESIRED-PKGS. Information logs will be printed to the DESIRED-PKGS. Information logs will be printed to the
`emodule/log' buffer whilst error messages will be printed `emodule/log' buffer whilst error messages will be printed to the
to the `emodule/error-log' buffer. Finally the `emodule/error-log' buffer. Finally the
`package-selected-packages' custom variable will be set to `package-selected-packages' custom variable will be set to
DESIRED-PKGS unless NO-SET-SELECTED is non-nil" DESIRED-PKGS unless NO-SET-SELECTED is non-nil"
@ -219,8 +219,7 @@ DESIRED-PKGS unless NO-SET-SELECTED is non-nil"
(emodule/print-log "*** Install packages ***") (emodule/print-log "*** Install packages ***")
(emodule/print-log "--- Refreshing package archives ---") (emodule/print-log "--- Refreshing package archives ---")
(package-refresh-contents)) (package-refresh-contents))
(emodule/print-log (emodule/print-log "--- Re-attempt installation of failed packages ---"))
"--- Re-attempt installation of failed packages ---"))
(emodule/install-pkgs install-pkgs) (emodule/install-pkgs install-pkgs)
(setq attempt (1+ attempt)))) (setq attempt (1+ attempt))))
@ -248,9 +247,7 @@ DESIRED-PKGS unless NO-SET-SELECTED is non-nil"
"Load all definitions for module MOD. "Load all definitions for module MOD.
This function expects the module to be located in a file called This function expects the module to be located in a file called
MOD.el in the `emodule/modules-dir' directory." MOD.el in the `emodule/modules-dir' directory."
(load (expand-file-name (format "%s/%s.el" (load (expand-file-name (format "%s/%s.el" emodule/modules-dir (symbol-name mod)))))
emodule/modules-dir
(symbol-name mod)))))
(defun emodule/load-module-list (modlist) (defun emodule/load-module-list (modlist)
"Load all modules in MODLIST." "Load all modules in MODLIST."
@ -305,8 +302,7 @@ this macro."
(dir "elpa") (dir "elpa")
(archive (format "%s.tar.xz" dir))) (archive (format "%s.tar.xz" dir)))
(emodule/unset-logs-read-only) (emodule/unset-logs-read-only)
(emodule/print (format "*** Backing up %s into %s ***\n" dir archive) (emodule/print (format "*** Backing up %s into %s ***\n" dir archive) emodule/log)
emodule/log)
(let* ((cmd (format "XZ_OPT=-9 tar -cJf %s %s" archive dir)) (let* ((cmd (format "XZ_OPT=-9 tar -cJf %s %s" archive dir))
(res (shell-command cmd nil emodule/error-log))) (res (shell-command cmd nil emodule/error-log)))
(unless (zerop res) (unless (zerop res)
@ -333,8 +329,7 @@ this macro."
(dir-bkp (format "%s.bkp" dir)) (dir-bkp (format "%s.bkp" dir))
(archive (format "%s.tar.xz" dir))) (archive (format "%s.tar.xz" dir)))
(emodule/unset-logs-read-only) (emodule/unset-logs-read-only)
(emodule/print (format "*** Restoring %s back from %s ***\n" dir archive) (emodule/print (format "*** Restoring %s back from %s ***\n" dir archive) emodule/log)
emodule/log)
(when (file-directory-p dir) (when (file-directory-p dir)
(emodule/clean-move-dir dir dir-bkp)) (emodule/clean-move-dir dir dir-bkp))
(let* ((cmd (format "tar -xJf %s" archive)) (let* ((cmd (format "tar -xJf %s" archive))

91
init.el
View File

@ -11,44 +11,43 @@
;;; Code: ;;; Code:
;; ---------------------------------------------------------------------------- ;; -------------------------------------------------------------------------------------------------
;; Run init without garbage collection. ;; Run init without garbage collection.
;; ---------------------------------------------------------------------------- ;; -------------------------------------------------------------------------------------------------
(let ((gc-cons-threshold most-positive-fixnum)) (let ((gc-cons-threshold most-positive-fixnum))
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; Helper function to get correct configuration directory. ;; Helper function to get correct configuration directory.
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(defun emacs-dir (rel) (defun emacs-dir (rel)
"Obtain full path to REL." "Obtain full path to REL."
(concat (file-name-as-directory user-emacs-directory) rel)) (concat (file-name-as-directory user-emacs-directory) rel))
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; Initialise and setup `package'. ;; Initialise and setup `package'.
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(require 'package) (require 'package)
(add-to-list 'package-archives (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
'("melpa" . "https://melpa.org/packages/") t)
(package-initialize) (package-initialize)
;; External .el files that are not available from MELPA. ;; External .el files that are not available from MELPA.
(add-to-list 'load-path (emacs-dir "external")) (add-to-list 'load-path (emacs-dir "external"))
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; Load `emodule'. ;; Load `emodule'.
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(add-to-list 'load-path (emacs-dir "emodule")) (add-to-list 'load-path (emacs-dir "emodule"))
(require 'emodule) (require 'emodule)
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; Visual configuration. ;; Visual configuration.
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; Font --------------------------------------------------------------------- ;; Font ------------------------------------------------------------------------------------------
(let* ((font-name "Source Code Pro") (let* ((font-name "Source Code Pro")
(font-size 10) (font-size 10)
@ -59,14 +58,14 @@
(set-face-attribute 'italic nil ;; Emacs does not set italic face (set-face-attribute 'italic nil ;; Emacs does not set italic face
:family (concat font-name "-Italic"))) :family (concat font-name "-Italic")))
;; Visual clutter ----------------------------------------------------------- ;; Visual clutter --------------------------------------------------------------------------------
(scroll-bar-mode -1) (scroll-bar-mode -1)
(tool-bar-mode -1) (tool-bar-mode -1)
(menu-bar-mode -1) (menu-bar-mode -1)
(blink-cursor-mode -1) (blink-cursor-mode -1)
;; Theme -------------------------------------------------------------------- ;; Theme -----------------------------------------------------------------------------------------
;; Add the necessary paths. ;; Add the necessary paths.
(add-to-list 'load-path (emacs-dir "themes")) (add-to-list 'load-path (emacs-dir "themes"))
@ -75,7 +74,7 @@
;; Load the dark theme by default. ;; Load the dark theme by default.
(load-theme 'havoc-dark t) ;; Load personal theme (load-theme 'havoc-dark t) ;; Load personal theme
;; Splash screen ------------------------------------------------------------ ;; Splash screen ---------------------------------------------------------------------------------
;; Add path. ;; Add path.
(add-to-list 'load-path (emacs-dir "init-buffer")) (add-to-list 'load-path (emacs-dir "init-buffer"))
@ -84,30 +83,30 @@
;; Set the initial buffer. ;; Set the initial buffer.
(setq-default init-buffer-choice 'init-buffer/goto-buffer) (setq-default init-buffer-choice 'init-buffer/goto-buffer)
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; Change file in which custom variable changes are saved. ;; Change file in which custom variable changes are saved.
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(setq-default custom-file (emacs-dir "custom.el")) (setq-default custom-file (emacs-dir "custom.el"))
;; *********************************************************************** ;; ;; ******************************************************************************************** ;;
;; ;; ;; ;;
;; MODULES ;; ;; MODULES ;;
;; ;; ;; ;;
;; ----------------------------------------------------------------------- ;; ;; -------------------------------------------------------------------------------------------- ;;
;; ;; ;; ;;
;; ;; ;; ;;
;; Visual configuration must come before this point so that the frame can ;; ;; Visual configuration must come before this point so that the frame can be set up before any ;;
;; be set up before any time consuming package management. ;; ;; time consuming package management. ;;
;; ;; ;; ;;
;; ;; ;; ;;
;; *********************************************************************** ;; ;; ******************************************************************************************** ;;
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; Load modules. ;; Load modules.
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(emodule/init '( (emodule/init '(
emacs emacs
@ -121,22 +120,22 @@
)) ))
;; *********************************************************************** ;; ;; ******************************************************************************************** ;;
;; ;; ;; ;;
;; ;; ;; ;;
;; Any configuration that is not in a module or needs to override module ;; ;; Any configuration that is not in a module or needs to override module settings should be set ;;
;; settings should be set below this point. ;; ;; below this point. ;;
;; ;; ;; ;;
;; ;; ;; ;;
;; ----------------------------------------------------------------------- ;; ;; -------------------------------------------------------------------------------------------- ;;
;; ;; ;; ;;
;; END MODULES ;; ;; END MODULES ;;
;; ;; ;; ;;
;; *********************************************************************** ;; ;; ******************************************************************************************** ;;
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; Load any custom variables. ;; Load any custom variables.
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(load custom-file 'noerror) (load custom-file 'noerror)

View File

@ -56,9 +56,9 @@
(defun emodule/emacs-init () (defun emodule/emacs-init ()
"Initialise the `emacs' module." "Initialise the `emacs' module."
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; Basic editor settings. ;; Basic editor settings.
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(setq-default (setq-default
;; This slows down cursor scrolling. ;; This slows down cursor scrolling.
@ -81,8 +81,7 @@
whitespace-line-column fill-column) whitespace-line-column fill-column)
;; Backup settings. ;; Backup settings.
(defvar backup-directory (defvar backup-directory (concat (file-name-as-directory user-emacs-directory) "backups"))
(concat (file-name-as-directory user-emacs-directory) "backups"))
(if (not (file-exists-p backup-directory)) (if (not (file-exists-p backup-directory))
(make-directory backup-directory t)) (make-directory backup-directory t))
@ -142,26 +141,23 @@
;; Add directories to exec-path. ;; Add directories to exec-path.
(let ((home-dir (getenv "HOME"))) (let ((home-dir (getenv "HOME")))
(setq exec-path (setq exec-path (append exec-path `(,(concat home-dir "/.local/bin")
(append exec-path `(,(concat home-dir "/.local/bin") ,(concat home-dir "/.cask/bin")))))
,(concat home-dir "/.cask/bin")))))
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; Configure garbage collection. ;; Configure garbage collection.
;; ;;
;; Based on advice from: ;; Based on advice from:
;; http://bling.github.io/blog/2016/01/18/why-are-you-changing-gc-cons-threshold/ ;; http://bling.github.io/blog/2016/01/18/why-are-you-changing-gc-cons-threshold/
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(add-hook 'minibuffer-setup-hook (add-hook 'minibuffer-setup-hook (lambda () (setq gc-cons-threshold most-positive-fixnum)))
(lambda () (setq gc-cons-threshold most-positive-fixnum)))
(add-hook 'minibuffer-exit-hook (add-hook 'minibuffer-exit-hook (lambda () (setq gc-cons-threshold 800000)))
(lambda () (setq gc-cons-threshold 800000)))
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; Additional key-bindings. ;; Additional key-bindings.
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; Toggle whitespace mode. ;; Toggle whitespace mode.
(global-set-key (kbd "C-c w") 'whitespace-mode) (global-set-key (kbd "C-c w") 'whitespace-mode)
@ -170,10 +166,9 @@
(global-set-key (kbd "M-s M-o") 'occur) (global-set-key (kbd "M-s M-o") 'occur)
;; Kill current buffer without prompting. ;; Kill current buffer without prompting.
(global-set-key (kbd "C-x k") (global-set-key (kbd "C-x k") (lambda ()
(lambda () (interactive)
(interactive) (let (kill-buffer-query-functions) (kill-buffer))))
(let (kill-buffer-query-functions) (kill-buffer))))
;; Scroll up/down, but keep point in place. ;; Scroll up/down, but keep point in place.
(global-set-key (kbd "C-<") (lambda() (global-set-key (kbd "C-<") (lambda()
@ -185,9 +180,9 @@
(let ((scroll-preserve-screen-position nil)) (let ((scroll-preserve-screen-position nil))
(scroll-up 1)))) (scroll-up 1))))
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; Dark/light theme switch. ;; Dark/light theme switch.
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(defun refresh-non-face-colours () (defun refresh-non-face-colours ()
"Restart modes that use colours not set with face variables. "Restart modes that use colours not set with face variables.
@ -198,7 +193,7 @@
highlight-parentheses-mode) highlight-parentheses-mode)
(highlight-parentheses-mode 1))) (highlight-parentheses-mode 1)))
;; Key-bindings ------------------------------------------------------------- ;; Key-bindings ----------------------------------------------------------------------------------
(global-set-key (kbd "C-x t l") (lambda () (global-set-key (kbd "C-x t l") (lambda ()
(interactive) (interactive)
@ -209,10 +204,9 @@
(load-theme 'havoc-dark t) (load-theme 'havoc-dark t)
(refresh-non-face-colours))) (refresh-non-face-colours)))
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; Toggle indent-tabs-mode. Useful for working with source code ;; Toggle indent-tabs-mode. Useful for working with source code that have a different tab policy.
;; that have a different tab policy. ;; -----------------------------------------------------------------------------------------------
;; --------------------------------------------------------------------------
(defun toggle-indent-tabs-mode () (defun toggle-indent-tabs-mode ()
"Toggle a indent-tabs-mode between a defined and undefined state." "Toggle a indent-tabs-mode between a defined and undefined state."
@ -220,17 +214,17 @@
(setq indent-tabs-mode (not indent-tabs-mode)) (setq indent-tabs-mode (not indent-tabs-mode))
(setq-default indent-tabs-mode indent-tabs-mode)) (setq-default indent-tabs-mode indent-tabs-mode))
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; Beginning of line. ;; Beginning of line.
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(defun x-move-beginning-of-line (arg) (defun x-move-beginning-of-line (arg)
"Move point back to indentation of beginning of line. "Move point back to indentation of beginning of line.
Move point to the first non-whitespace character on this Move point to the first non-whitespace character on this
line. If point is already there, move to the beginning of line. If point is already there, move to the beginning of the
the line. Effectively toggle between the first line. Effectively toggle between the first non-whitespace
non-whitespace character and the beginning of the line. character and the beginning of the line.
If ARG is not nil or 1, move forward ARG - 1 lines first. If If ARG is not nil or 1, move forward ARG - 1 lines first. If
point reaches the beginning or end of the buffer, stop point reaches the beginning or end of the buffer, stop
@ -249,14 +243,14 @@
(when (= orig-point (point)) (when (= orig-point (point))
(move-beginning-of-line 1)))) (move-beginning-of-line 1))))
;; Key-bindings ------------------------------------------------------------- ;; Key-bindings ----------------------------------------------------------------------------------
;; Override the beginning of line key-binding. ;; Override the beginning of line key-binding.
(global-set-key (kbd "C-a") 'x-move-beginning-of-line) (global-set-key (kbd "C-a") 'x-move-beginning-of-line)
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; Transpose lines. ;; Transpose lines.
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(defun transpose-lines-down () (defun transpose-lines-down ()
"Transpose the current line with the one below." "Transpose the current line with the one below."
@ -271,14 +265,14 @@
(transpose-lines 1) (transpose-lines 1)
(forward-line -2)) (forward-line -2))
;; Key-bindings ------------------------------------------------------------- ;; Key-bindings ----------------------------------------------------------------------------------
(global-set-key (kbd "M-<down>") 'transpose-lines-down) (global-set-key (kbd "M-<down>") 'transpose-lines-down)
(global-set-key (kbd "M-<up>") 'transpose-lines-up) (global-set-key (kbd "M-<up>") 'transpose-lines-up)
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; Indent buffer. ;; Indent buffer.
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(defun indent-buffer () (defun indent-buffer ()
"Indent the currently visited buffer." "Indent the currently visited buffer."
@ -302,14 +296,14 @@
(indent-buffer) (indent-buffer)
(whitespace-cleanup))))) (whitespace-cleanup)))))
;; Key-bindings ------------------------------------------------------------- ;; Key-bindings ----------------------------------------------------------------------------------
;; Override the indent-region key-binding ;; Override the indent-region key-binding
(global-set-key (kbd "C-M-\\") 'indent-region-or-buffer) (global-set-key (kbd "C-M-\\") 'indent-region-or-buffer)
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; Unfill paragraph - inverse of fill paragraph. ;; Unfill paragraph - inverse of fill paragraph.
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(defun unfill-paragraph (&optional region) (defun unfill-paragraph (&optional region)
"Takes a multi-line paragraph and makes it into a single line of text." "Takes a multi-line paragraph and makes it into a single line of text."
@ -319,33 +313,33 @@
(emacs-lisp-docstring-fill-column t)) (emacs-lisp-docstring-fill-column t))
(fill-paragraph nil region))) (fill-paragraph nil region)))
;; Key-bindings ------------------------------------------------------------- ;; Key-bindings ----------------------------------------------------------------------------------
(global-set-key (kbd "M-Q") 'unfill-paragraph) (global-set-key (kbd "M-Q") 'unfill-paragraph)
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; `ace-jump-mode' ;; `ace-jump-mode'
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(use-package ace-jump-mode (use-package ace-jump-mode
:bind (("C-c SPC" . ace-jump-mode))) :bind (("C-c SPC" . ace-jump-mode)))
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; `ace-window' ;; `ace-window'
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(use-package ace-window (use-package ace-window
:bind (("M-o" . ace-window))) :bind (("M-o" . ace-window)))
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; `deadgrep' ;; `deadgrep'
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(use-package deadgrep (use-package deadgrep
:init :init
(setq deadgrep-project-root-function (setq deadgrep-project-root-function
(lambda () (read-directory-name "Base directory: " (lambda ()
nil default-directory t))) (read-directory-name "Base directory: " nil default-directory t)))
:bind :bind
(("C-x C-g" . deadgrep)) (("C-x C-g" . deadgrep))
(:map deadgrep-mode-map (:map deadgrep-mode-map
@ -361,9 +355,9 @@
(unless (executable-find "rg") (unless (executable-find "rg")
(global-set-key (kbd "C-x C-g") 'rgrep)) (global-set-key (kbd "C-x C-g") 'rgrep))
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; `dired' ;; `dired'
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(use-package dired (use-package dired
:config :config
@ -414,31 +408,31 @@
:after dired :after dired
:hook (dired-mode . treemacs-icons-dired-mode)) :hook (dired-mode . treemacs-icons-dired-mode))
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; `discover' ;; `discover'
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(use-package discover (use-package discover
:init (global-discover-mode)) :init (global-discover-mode))
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; `discover-my-major' ;; `discover-my-major'
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(use-package discover-my-major (use-package discover-my-major
:bind :bind
(("C-h M" . discover-my-major))) (("C-h M" . discover-my-major)))
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; `duplicate-thing' ;; `duplicate-thing'
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(use-package duplicate-thing (use-package duplicate-thing
:bind (("M-C" . duplicate-thing))) :bind (("M-C" . duplicate-thing)))
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; `expand-region' ;; `expand-region'
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(use-package expand-region (use-package expand-region
:bind (("C-'" . er/expand-region))) :bind (("C-'" . er/expand-region)))
@ -450,9 +444,9 @@
(setq eyebrowse-default-workspace-slot 0) (setq eyebrowse-default-workspace-slot 0)
(eyebrowse-mode)) (eyebrowse-mode))
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; `flyspell' ;; `flyspell'
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------x
(use-package flyspell (use-package flyspell
:bind :bind
@ -461,35 +455,29 @@
(((text-mode org-mode) . flyspell-mode) (((text-mode org-mode) . flyspell-mode)
(prog-mode . flyspell-prog-mode)) (prog-mode . flyspell-prog-mode))
:config :config
(if (executable-find "aspell")
(progn
(setq-default ispell-program-name "aspell")
(setq-default ispell-extra-args '("--sug-mode=ultra")))
(setq-default ispell-program-name "ispell"))
(unbind-key "C-M-i" flyspell-mode-map)) (unbind-key "C-M-i" flyspell-mode-map))
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; `highlight-parentheses' - this package does not use faces for colours, ;; `highlight-parentheses' - this package does not use faces for colours, instead it uses the
;; instead it uses the `hl-parens-colors' variable. This can be set in the ;; `hl-parens-colors' variable. This can be set in the theme file, but the mode has to be reloaded
;; theme file, but the mode has to be reloaded whenever the theme changes. ;; whenever the theme changes.
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(use-package highlight-parentheses (use-package highlight-parentheses
:hook :hook
(prog-mode . highlight-parentheses-mode)) (prog-mode . highlight-parentheses-mode))
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; `ibuffer-vc' ;; `ibuffer-vc'
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(use-package ibuffer-vc (use-package ibuffer-vc
:defer t :defer t
:init :init
(add-hook 'ibuffer-hook (add-hook 'ibuffer-hook (lambda ()
(lambda () (ibuffer-vc-set-filter-groups-by-vc-root)
(ibuffer-vc-set-filter-groups-by-vc-root) (unless (eq ibuffer-sorting-mode 'alphabetic)
(unless (eq ibuffer-sorting-mode 'alphabetic) (ibuffer-do-sort-by-alphabetic))))
(ibuffer-do-sort-by-alphabetic))))
:config :config
(setq ibuffer-formats (setq ibuffer-formats
'((mark modified read-only vc-status-mini " " '((mark modified read-only vc-status-mini " "
@ -503,16 +491,16 @@
" " " "
filename-and-process)))) filename-and-process))))
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; `iedit' ;; `iedit'
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(use-package iedit (use-package iedit
:bind (("C-;" . iedit-mode))) :bind (("C-;" . iedit-mode)))
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; `mail-mode'. ;; `mail-mode'.
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(use-package mail-mode (use-package mail-mode
:mode "\\evo.*\\'" :mode "\\evo.*\\'"
@ -520,9 +508,9 @@
((mail-mode . auto-fill-mode) ((mail-mode . auto-fill-mode)
(mail-mode . (lambda () (setq fill-column 71))))) (mail-mode . (lambda () (setq fill-column 71)))))
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; `impatient-mode' ;; `impatient-mode'
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; To preview markdown, start an HTTP daemon `httpd-start' and enable ;; To preview markdown, start an HTTP daemon `httpd-start' and enable
;; `impatient-mode'. Then, in a browser, visit http://localhost:8080/imp. ;; `impatient-mode'. Then, in a browser, visit http://localhost:8080/imp.
@ -537,25 +525,25 @@
:hook ((markdown-mode . (lambda () (setq imp-user-filter :hook ((markdown-mode . (lambda () (setq imp-user-filter
'markdown-html))))) 'markdown-html)))))
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; `pdf-tools' - use instead of DocView. ;; `pdf-tools' - use instead of DocView.
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(use-package pdf-tools (use-package pdf-tools
:config :config
(pdf-tools-install)) (pdf-tools-install))
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; `perspective' ;; `perspective'
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(use-package perspective (use-package perspective
:config :config
(persp-mode)) (persp-mode))
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; `projectile' ;; `projectile'
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(use-package projectile (use-package projectile
:defer nil :defer nil
@ -564,38 +552,38 @@
:config :config
(projectile-mode)) (projectile-mode))
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; `rainbow-delimiters' - colours are set by theme. ;; `rainbow-delimiters' - colours are set by theme.
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(use-package rainbow-delimiters (use-package rainbow-delimiters
:hook :hook
(prog-mode . rainbow-delimiters-mode)) (prog-mode . rainbow-delimiters-mode))
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; `rainbow-mode' ;; `rainbow-mode'
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(use-package rainbow-mode (use-package rainbow-mode
:defer t) :defer t)
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; `recentf-ext' ;; `recentf-ext'
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(use-package recentf-ext) (use-package recentf-ext)
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; `saveplace' - remember location in file. ;; `saveplace' - remember location in file.
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(use-package saveplace (use-package saveplace
:init :init
(save-place-mode 1)) (save-place-mode 1))
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; `smartparens' ;; `smartparens'
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(use-package smartparens (use-package smartparens
:config :config
@ -604,7 +592,7 @@
(smartparens-global-mode t) (smartparens-global-mode t)
(show-smartparens-global-mode t) (show-smartparens-global-mode t)
;; Key-bindings ----------------------------------------------------------- ;; Key-bindings --------------------------------------------------------------------------------
(define-key smartparens-mode-map (kbd "C-M-f") 'sp-forward-sexp) (define-key smartparens-mode-map (kbd "C-M-f") 'sp-forward-sexp)
(define-key smartparens-mode-map (kbd "C-M-b") 'sp-backward-sexp) (define-key smartparens-mode-map (kbd "C-M-b") 'sp-backward-sexp)
@ -650,7 +638,7 @@
(sp-local-pair "`" nil :actions nil) (sp-local-pair "`" nil :actions nil)
(sp-local-pair "``" "``")) (sp-local-pair "``" "``"))
;; Smartparens custom settings -------------------------------------------- ;; Smartparens custom settings -----------------------------------------------------------------
(setq-default (setq-default
;; Jump to closing parenthesis when closing symbol is typed. ;; Jump to closing parenthesis when closing symbol is typed.
@ -661,20 +649,18 @@
;; Do not highlight space between parentheses. ;; Do not highlight space between parentheses.
sp-highlight-pair-overlay nil)) sp-highlight-pair-overlay nil))
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; `tramp' ;; `tramp'
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(use-package tramp (use-package tramp
:defer t :defer t
:config :config
(setq-default tramp-default-method "ssh") (setq-default tramp-default-method "ssh")
;; This line proxies all sudo connections via an ssh connection to the ;; This line proxies all sudo connections via an ssh connection to the provided hostname.
;; provided hostname.
(add-to-list 'tramp-default-proxies-alist '(nil "\\`root\\'" "/ssh:%h:")) (add-to-list 'tramp-default-proxies-alist '(nil "\\`root\\'" "/ssh:%h:"))
;; This rule is an exception to the above so that local sudo does not proxy ;; This rule is an exception to the above so that local sudo does not proxy via ssh. This has to
;; via ssh. This has to be added last so that it is the first element of ;; be added last so that it is the first element of the list.
;; the list.
(add-to-list 'tramp-default-proxies-alist '("localhost" "\\`root\\'" nil)) (add-to-list 'tramp-default-proxies-alist '("localhost" "\\`root\\'" nil))
(defun sudo () (defun sudo ()
@ -685,42 +671,42 @@
(concat "/sudo:root@localhost:" (concat "/sudo:root@localhost:"
buffer-file-name))))) buffer-file-name)))))
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; `undo-tree' - to undo "C-\", to redo "C-_", undo tree "C-x u". ;; `undo-tree' - to undo "C-\", to redo "C-_", undo tree "C-x u".
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(use-package undo-tree (use-package undo-tree
:config :config
(global-undo-tree-mode)) (global-undo-tree-mode))
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; `vlf' - view large files. ;; `vlf' - view large files.
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(use-package vlf-integrate (use-package vlf-integrate
:defer t :defer t
:init :init
(setq-default vlf-application 'dont-ask)) (setq-default vlf-application 'dont-ask))
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; `volatile-highlights' - highlight changes caused by undo, yank, etc. ;; `volatile-highlights' - highlight changes caused by undo, yank, etc.
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(use-package volatile-highlights (use-package volatile-highlights
:config :config
(volatile-highlights-mode t)) (volatile-highlights-mode t))
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; `winner' - undo/redo window configuration. ;; `winner' - undo/redo window configuration.
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(use-package winner (use-package winner
:init (winner-mode 1) :init (winner-mode 1)
:bind (("C-z" . winner-undo))) :bind (("C-z" . winner-undo)))
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; `which-key' ;; `which-key'
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(use-package which-key (use-package which-key
:init :init
@ -729,27 +715,26 @@
:config :config
(which-key-mode 1)) (which-key-mode 1))
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; `whole-line-or-region' - kill line when calling kill-region without a ;; `whole-line-or-region' - kill line when calling kill-region without a selected region.
;; selected region. ;; -----------------------------------------------------------------------------------------------
;; --------------------------------------------------------------------------
(use-package whole-line-or-region (use-package whole-line-or-region
:config :config
(define-key whole-line-or-region-local-mode-map [remap comment-dwim] nil) (define-key whole-line-or-region-local-mode-map [remap comment-dwim] nil)
(whole-line-or-region-global-mode t)) (whole-line-or-region-global-mode t))
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; `ws-butler' - will cleanup whitespace on all modified files on save. ;; `ws-butler' - will cleanup whitespace on all modified files on save.
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(use-package ws-butler (use-package ws-butler
:config :config
(ws-butler-global-mode)) (ws-butler-global-mode))
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; `zoom-window'. ;; `zoom-window'.
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(use-package zoom-window (use-package zoom-window
:bind (("C-x C-z" . zoom-window-zoom))) :bind (("C-x C-z" . zoom-window-zoom)))

View File

@ -32,9 +32,9 @@
(defun emodule/helm-init () (defun emodule/helm-init ()
"Initialise the `helm' module." "Initialise the `helm' module."
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; `ace-jump-helm-line' ;; `ace-jump-helm-line'
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(use-package ace-jump-helm-line (use-package ace-jump-helm-line
:after helm :after helm
@ -42,9 +42,9 @@
(:map helm-map (:map helm-map
("C-'" . ace-jump-helm-line))) ("C-'" . ace-jump-helm-line)))
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; `helm' ;; `helm'
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(use-package helm (use-package helm
:init :init
@ -61,15 +61,15 @@
:config :config
(helm-mode 1) (helm-mode 1)
;; Helm prefix ------------------------------------------------------------ ;; Helm prefix ---------------------------------------------------------------------------------
;; The default "C-x c" is quite close to "C-x C-c", which quits Emacs. ;; The default "C-x c" is quite close to "C-x C-c", which quits Emacs. Changed to "C-c h". Note:
;; Changed to "C-c h". Note: We must set "C-c h" globally, because we ;; We must set "C-c h" globally, because we cannot change `helm-command-prefix-key' once
;; cannot change `helm-command-prefix-key' once `helm-config' is loaded. ;; `helm-config' is loaded.
(global-set-key (kbd "C-c h") 'helm-command-prefix) (global-set-key (kbd "C-c h") 'helm-command-prefix)
(global-unset-key (kbd "C-x c")) (global-unset-key (kbd "C-x c"))
;; Helm settings ---------------------------------------------------------- ;; Helm settings -------------------------------------------------------------------------------
(setq-default (setq-default
;; Open helm buffer inside current window, not occupy whole other window. ;; Open helm buffer inside current window, not occupy whole other window.
@ -93,7 +93,7 @@
;; While auresize is disabled these variable are in use. ;; While auresize is disabled these variable are in use.
helm-display-buffer-default-height 0.35) helm-display-buffer-default-height 0.35)
;; Hide minibuffer -------------------------------------------------------- ;; Hide minibuffer -----------------------------------------------------------------------------
(defun x-helm-hide-minibuffer-maybe () (defun x-helm-hide-minibuffer-maybe ()
"Hide minibuffer in Helm session if we use the header line "Hide minibuffer in Helm session if we use the header line
@ -108,7 +108,7 @@
(add-hook 'helm-minibuffer-set-up-hook 'x-helm-hide-minibuffer-maybe) (add-hook 'helm-minibuffer-set-up-hook 'x-helm-hide-minibuffer-maybe)
;; Key-bindings ----------------------------------------------------------- ;; Key-bindings --------------------------------------------------------------------------------
;; Rebind tab to run persistent action. ;; Rebind tab to run persistent action.
(define-key helm-map (kbd "<tab>") 'helm-execute-persistent-action) (define-key helm-map (kbd "<tab>") 'helm-execute-persistent-action)
@ -116,21 +116,21 @@
;; List actions using C-z. ;; List actions using C-z.
(define-key helm-map (kbd "C-z") 'helm-select-action) (define-key helm-map (kbd "C-z") 'helm-select-action)
;; Change some Helm default key-bindings. Due to the `helm-config' require ;; Change some Helm default key-bindings. Due to the `helm-config' require these have to
;; these have to overridden here rather than with other keys in `:bind'. ;; overridden here rather than with other keys in `:bind'.
(global-set-key (kbd "C-c h x") 'helm-register) (global-set-key (kbd "C-c h x") 'helm-register)
(global-set-key (kbd "C-c h M-o") 'helm-occur)) (global-set-key (kbd "C-c h M-o") 'helm-occur))
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; `helm-flyspell' ;; `helm-flyspell'
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(use-package helm-flyspell (use-package helm-flyspell
:bind (("C-c C-'" . helm-flyspell-correct))) :bind (("C-c C-'" . helm-flyspell-correct)))
;; ------------------------------------------------------------------------ ;; ---------------------------------------------------------------------------------------------
;; `helm-projectile' ;; `helm-projectile'
;; ------------------------------------------------------------------------ ;; ---------------------------------------------------------------------------------------------
(use-package helm-projectile (use-package helm-projectile
:after projectile :after projectile
@ -138,9 +138,9 @@
(setq-default projectile-completion-system 'helm) (setq-default projectile-completion-system 'helm)
(helm-projectile-on)) (helm-projectile-on))
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; `swiper-helm' ;; `swiper-helm'
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(use-package swiper-helm (use-package swiper-helm
:after helm :after helm

View File

@ -52,24 +52,24 @@
(defun emodule/languages-init () (defun emodule/languages-init ()
"Initialise the `languages' module." "Initialise the `languages' module."
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; Antlr. ;; Antlr.
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(use-package antlr-mode (use-package antlr-mode
:init (autoload 'antlr-v4-mode "antlr-mode" nil t) :init (autoload 'antlr-v4-mode "antlr-mode" nil t)
:mode ("\\.g4\\'" . antlr-v4-mode)) :mode ("\\.g4\\'" . antlr-v4-mode))
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; CMake. ;; CMake.
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(use-package cmake-mode (use-package cmake-mode
:defer t) :defer t)
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; C/C++. ;; C/C++.
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(use-package ccls (use-package ccls
:hook ((c-mode c++-mode objc-mode) . :hook ((c-mode c++-mode objc-mode) .
@ -86,50 +86,50 @@
:map objc-mode-map :map objc-mode-map
("C-c C-f" . clang-format-buffer))) ("C-c C-f" . clang-format-buffer)))
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; Dockerfile. ;; Dockerfile.
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(use-package dockerfile-mode (use-package dockerfile-mode
:defer t) :defer t)
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; JSON. ;; JSON.
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(setq-default js-indent-level 2) (setq-default js-indent-level 2)
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; kOS. ;; kOS.
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(use-package kos-mode (use-package kos-mode
:mode "\\.ks\\'") :mode "\\.ks\\'")
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; LaTeX. ;; LaTeX.
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(add-hook 'latex-mode-hook 'auto-fill-mode) (add-hook 'latex-mode-hook 'auto-fill-mode)
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; Makefile settings. ;; Makefile settings.
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(add-hook 'makefile-mode-hook (lambda () (setq indent-tabs-mode t))) (add-hook 'makefile-mode-hook (lambda () (setq indent-tabs-mode t)))
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; P4. ;; P4.
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; Note needs xcscope ;; Note needs xcscope
(use-package p4_16-mode (use-package p4_16-mode
:mode (("\\.p4\\'" . p4_16-mode) :mode (("\\.p4\\'" . p4_16-mode)
("\\.p4i\\'" . p4_16-mode))) ("\\.p4i\\'" . p4_16-mode)))
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; PlantUML. ;; PlantUML.
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(use-package plantuml-mode (use-package plantuml-mode
:mode "\\.pu\\'" :mode "\\.pu\\'"
@ -137,16 +137,16 @@
(setq plantuml-default-exec-mode 'executable) (setq plantuml-default-exec-mode 'executable)
(setq plantuml-output-type "png")) (setq plantuml-output-type "png"))
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; Protobuf. ;; Protobuf.
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(use-package protobuf-mode (use-package protobuf-mode
:defer t) :defer t)
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; Python. ;; Python.
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(use-package cython-mode (use-package cython-mode
:defer t) :defer t)
@ -169,9 +169,9 @@
(use-package pyvenv (use-package pyvenv
:defer t) :defer t)
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; Rust. ;; Rust.
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(defun rust-new-project (project-name project-type) (defun rust-new-project (project-name project-type)
(let ((rust-cargo-bin "cargo")) (let ((rust-cargo-bin "cargo"))
@ -217,9 +217,9 @@
(use-package toml-mode (use-package toml-mode
:mode "\\.lock\\'") :mode "\\.lock\\'")
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; YAML. ;; YAML.
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(use-package yaml-mode (use-package yaml-mode
:config :config

View File

@ -29,19 +29,18 @@
(defun emodule/modeline-init () (defun emodule/modeline-init ()
"Initialise the `modeline' module." "Initialise the `modeline' module."
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; `anzu' ;; `anzu'
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(use-package anzu (use-package anzu
:config :config
(global-anzu-mode 1)) (global-anzu-mode 1))
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; `doom-modeline' - note that doom-modeline requires all-the-icons which in ;; `doom-modeline' - note that doom-modeline requires all-the-icons which in turn require the user
;; turn require the user to manually install the fonts with the command `M-x ;; to manually install the fonts with the command `M-x all-the-icons-install-fonts'.
;; all-the-icons-install-fonts'. ;; -----------------------------------------------------------------------------------------------
;; --------------------------------------------------------------------------
(use-package doom-modeline (use-package doom-modeline
:hook :hook

View File

@ -31,9 +31,9 @@
(defun emodule/org-init () (defun emodule/org-init ()
"Initialise the `org' module." "Initialise the `org' module."
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; `elfeed' ;; `elfeed'
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(use-package elfeed (use-package elfeed
:bind :bind
@ -44,9 +44,9 @@
(elfeed-load-opml elfeed-feeds-file) (elfeed-load-opml elfeed-feeds-file)
(run-at-time nil 3600 'elfeed-update)))) (run-at-time nil 3600 'elfeed-update))))
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; `org' ;; `org'
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(use-package org (use-package org
:hook :hook
@ -57,9 +57,9 @@
("C-c c" . org-capture) ("C-c c" . org-capture)
("C-c l" . org-store-link)) ("C-c l" . org-store-link))
:config :config
;; ------------------------------------------------------------------------ ;; ---------------------------------------------------------------------------------------------
;; Set variables. ;; Set variables.
;; ------------------------------------------------------------------------ ;; ---------------------------------------------------------------------------------------------
(setq (setq
;; Do not hide special characters for italics/bold/underline. ;; Do not hide special characters for italics/bold/underline.
@ -76,9 +76,9 @@
(tags . " %i %b") (tags . " %i %b")
(search . " %i %b"))) (search . " %i %b")))
;; ------------------------------------------------------------------------ ;; ---------------------------------------------------------------------------------------------
;; Set workflow states. ;; Set workflow states.
;; ------------------------------------------------------------------------ ;; ---------------------------------------------------------------------------------------------
(setq org-todo-keywords (setq org-todo-keywords
(quote ((sequence "TODO(t)" (quote ((sequence "TODO(t)"
@ -90,14 +90,13 @@
"|" "|"
"UNPLANNED(c@/!)")))) "UNPLANNED(c@/!)"))))
(setq org-todo-keyword-faces (setq org-todo-keyword-faces (quote (("NEXT" :foreground "#96DEFA" :weight bold)
(quote (("NEXT" :foreground "#96DEFA" :weight bold) ("WAIT" :foreground "#798A9B" :weight bold)
("WAIT" :foreground "#798A9B" :weight bold) ("HOLD" :foreground "#798A9B" :weight bold))))
("HOLD" :foreground "#798A9B" :weight bold))))
;; ------------------------------------------------------------------------ ;; ---------------------------------------------------------------------------------------------
;; Better bullet points. ;; Better bullet points.
;; ------------------------------------------------------------------------ ;; ---------------------------------------------------------------------------------------------
(font-lock-add-keywords 'org-mode (font-lock-add-keywords 'org-mode
'(("^ +\\(*\\) " '(("^ +\\(*\\) "
@ -106,15 +105,15 @@
(match-end 1) (match-end 1)
"")))))) ""))))))
;; ------------------------------------------------------------------------ ;; ---------------------------------------------------------------------------------------------
;; LaTeX font size. ;; LaTeX font size.
;; ------------------------------------------------------------------------ ;; ---------------------------------------------------------------------------------------------
(plist-put org-format-latex-options :scale 2.0) (plist-put org-format-latex-options :scale 2.0)
;; ------------------------------------------------------------------------ ;; ---------------------------------------------------------------------------------------------
;; Setup agenda and capture files. ;; Setup agenda and capture files.
;; ------------------------------------------------------------------------ ;; ---------------------------------------------------------------------------------------------
(setq (setq
;; File for org-capture ;; File for org-capture
@ -122,16 +121,16 @@
;; Org-agenda files ;; Org-agenda files
org-agenda-files '("~/Workspace/agenda.org"))) org-agenda-files '("~/Workspace/agenda.org")))
;; ------------------------------------------------------------------------ ;; -----------------------------------------------------------------------------------------------
;; Better header bullets ;; Better header bullets
;; ------------------------------------------------------------------------ ;; -----------------------------------------------------------------------------------------------
(use-package org-bullets (use-package org-bullets
:hook (org-mode . org-bullets-mode)) :hook (org-mode . org-bullets-mode))
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; Org-noter. ;; Org-noter.
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(use-package org-noter (use-package org-noter
:defer t) :defer t)

View File

@ -41,9 +41,9 @@
(defun emodule/programming-init () (defun emodule/programming-init ()
"Initialise the `programming' module." "Initialise the `programming' module."
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; Line numbers. ;; Line numbers.
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(setq-default (setq-default
display-line-numbers-width-start 4 display-line-numbers-width-start 4
@ -51,23 +51,23 @@
(add-hook 'prog-mode-hook 'display-line-numbers-mode) (add-hook 'prog-mode-hook 'display-line-numbers-mode)
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; Fill-column indicator. ;; Fill-column indicator.
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(add-hook 'prog-mode-hook 'display-fill-column-indicator-mode) (add-hook 'prog-mode-hook 'display-fill-column-indicator-mode)
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; Trailing whitespace. ;; Trailing whitespace.
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(add-hook 'prog-mode-hook (lambda () (add-hook 'prog-mode-hook (lambda ()
(interactive) (interactive)
(setq show-trailing-whitespace t))) (setq show-trailing-whitespace t)))
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; Automatically indent yanked text in programming mode. ;; Automatically indent yanked text in programming mode.
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(defvar yank-indent-modes (defvar yank-indent-modes
'(LaTeX-mode TeX-mode) '(LaTeX-mode TeX-mode)
@ -108,9 +108,9 @@
(let ((transient-mark-mode nil)) (let ((transient-mark-mode nil))
(yank-advised-indent-function (region-beginning) (region-end))))) (yank-advised-indent-function (region-beginning) (region-end)))))
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; Box comments. ;; Box comments.
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(defvar box-comment-char/emacs-lisp-mode ";; ") (defvar box-comment-char/emacs-lisp-mode ";; ")
(defvar box-comment-char/lisp-interaction-mode ";; ") (defvar box-comment-char/lisp-interaction-mode ";; ")
@ -129,30 +129,30 @@
(let ((comm-start (box-comment-char)) (let ((comm-start (box-comment-char))
beg indent len) beg indent len)
;; ---------------------------------------------------------------------- ;; -------------------------------------------------------------------------------------------
;; Find beginning of comment. ;; Find beginning of comment.
;; ---------------------------------------------------------------------- ;; -------------------------------------------------------------------------------------------
(end-of-line) (end-of-line)
(unless (search-backward comm-start nil t) (unless (search-backward comm-start nil t)
(error "Not in comment!")) (error "Not in comment!"))
;; ---------------------------------------------------------------------- ;; -------------------------------------------------------------------------------------------
;; Reformat into a single line. ;; Reformat into a single line.
;; ---------------------------------------------------------------------- ;; -------------------------------------------------------------------------------------------
(unfill-paragraph) (unfill-paragraph)
(end-of-line) (end-of-line)
(search-backward comm-start nil t) (search-backward comm-start nil t)
;; ---------------------------------------------------------------------- ;; -------------------------------------------------------------------------------------------
;; Set variables. ;; Set variables.
;; ---------------------------------------------------------------------- ;; -------------------------------------------------------------------------------------------
(setq beg (point)) (setq beg (point))
(setq indent (current-column)) (setq indent (current-column))
(setq len (- (- fill-column (length comm-start)) indent)) (setq len (- (- fill-column (length comm-start)) indent))
;; ---------------------------------------------------------------------- ;; -------------------------------------------------------------------------------------------
;; Reformat comment text in place. ;; Reformat comment text in place.
;; ---------------------------------------------------------------------- ;; -------------------------------------------------------------------------------------------
(goto-char beg) (goto-char beg)
(insert comm-start (make-string len ?-)) (insert comm-start (make-string len ?-))
(newline) (newline)
@ -167,9 +167,9 @@
(global-set-key (kbd "M-'") 'make-box-comment) (global-set-key (kbd "M-'") 'make-box-comment)
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; `company' - complete anything. ;; `company' - complete anything.
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(use-package company (use-package company
:hook :hook
@ -194,9 +194,9 @@
:config :config
(setq company-lsp-cache-candidates 'auto)) (setq company-lsp-cache-candidates 'auto))
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; `compile' ;; `compile'
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(use-package compile (use-package compile
:init :init
@ -237,9 +237,9 @@
(ansi-color-apply-on-region compilation-filter-start (point-max)))) (ansi-color-apply-on-region compilation-filter-start (point-max))))
(add-hook 'compilation-filter-hook 'my-colorize-compilation-buffer))) (add-hook 'compilation-filter-hook 'my-colorize-compilation-buffer)))
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; `gud' - GDB options. ;; `gud' - GDB options.
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(use-package gud (use-package gud
:defer t :defer t
@ -252,16 +252,16 @@
;; Display source file containing main. ;; Display source file containing main.
gdb-show-main t) gdb-show-main t)
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; `fic-mode' - highlight to-do keywords. ;; `fic-mode' - highlight to-do keywords.
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(use-package fic-mode (use-package fic-mode
:hook :hook
(prog-mode . fic-mode)) (prog-mode . fic-mode))
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; `flycheck' ;; `flycheck'
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(use-package flycheck (use-package flycheck
:hook (after-init . global-flycheck-mode)) :hook (after-init . global-flycheck-mode))
@ -270,16 +270,16 @@
:after flycheck :after flycheck
:config (flycheck-pos-tip-mode)) :config (flycheck-pos-tip-mode))
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; `highlight-numbers' ;; `highlight-numbers'
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(use-package highlight-numbers (use-package highlight-numbers
:hook (prog-mode . highlight-numbers-mode)) :hook (prog-mode . highlight-numbers-mode))
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; `highlight-symbol' ;; `highlight-symbol'
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(use-package highlight-symbol (use-package highlight-symbol
:hook :hook
@ -292,9 +292,9 @@
(setq highlight-symbol-idle-delay 0.2 (setq highlight-symbol-idle-delay 0.2
highlight-symbol-on-navigation-p t)) highlight-symbol-on-navigation-p t))
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; `lsp-mode' ;; `lsp-mode'
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(use-package lsp-mode (use-package lsp-mode
:commands lsp :commands lsp
@ -316,16 +316,16 @@
(define-key lsp-ui-mode-map (define-key lsp-ui-mode-map
[remap xref-find-references] #'lsp-ui-peek-find-references)) [remap xref-find-references] #'lsp-ui-peek-find-references))
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; `semantic' ;; `semantic'
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(use-package semantic (use-package semantic
:hook (prog-mode . semantic-mode)) :hook (prog-mode . semantic-mode))
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; Enable yasnippet. ;; Enable yasnippet.
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(use-package yasnippet (use-package yasnippet
:config :config

View File

@ -29,9 +29,9 @@
(defun emodule/terminal-init () (defun emodule/terminal-init ()
"Initialise the `terminal' module." "Initialise the `terminal' module."
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; `eshell' ;; `eshell'
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(use-package eshell (use-package eshell
:config :config
@ -97,9 +97,9 @@
(setq eshell-visual-commands (nconc eshell-visual-commands '("htop" (setq eshell-visual-commands (nconc eshell-visual-commands '("htop"
"tmux")))) "tmux"))))
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; `vterm' ;; `vterm'
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(use-package vterm (use-package vterm
:init :init

View File

@ -30,13 +30,12 @@
(defun emodule/vcs-init () (defun emodule/vcs-init ()
"Initialise the `vcs' module." "Initialise the `vcs' module."
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; `diff-hl' ;; `diff-hl'
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; The `magit-post-refresh-hook' doesn't work very well if it's not the ;; The `magit-post-refresh-hook' doesn't work very well if it's not the first in the list of
;; first in the list of hooks. Therefore, we guarantee that in a hacky way ;; hooks. Therefore, we guarantee that in a hacky way by loading it after 0 seconds of idle time.
;; by loading it after 0 seconds of idle time.
(use-package diff-hl (use-package diff-hl
:defer 0 :defer 0
:config :config
@ -44,9 +43,9 @@
(add-hook 'dired-mode-hook 'diff-hl-dired-mode) (add-hook 'dired-mode-hook 'diff-hl-dired-mode)
(add-hook 'magit-post-refresh-hook 'diff-hl-magit-post-refresh)) (add-hook 'magit-post-refresh-hook 'diff-hl-magit-post-refresh))
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; `diff-mode' ;; `diff-mode'
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(use-package diff-mode (use-package diff-mode
:init :init
@ -68,10 +67,10 @@
:config :config
;; Extra functions -------------------------------------------------------- ;; Extra functions -----------------------------------------------------------------------------
;; Display source in other window whilst keeping point in the diff file. ;; Display source in other window whilst keeping point in the diff file. Based on the code for
;; Based on the code for `diff-goto-source. ;; `diff-goto-source.
(defun x-diff-display-source (&optional other-file event) (defun x-diff-display-source (&optional other-file event)
"Display the corresponding source line in another window. "Display the corresponding source line in another window.
`diff-jump-to-old-file' (or its opposite if the OTHER-FILE `diff-jump-to-old-file' (or its opposite if the OTHER-FILE
@ -82,9 +81,8 @@
invocations." invocations."
(interactive (list current-prefix-arg last-input-event)) (interactive (list current-prefix-arg last-input-event))
;; When pointing at a removal line, we probably want to jump to ;; When pointing at a removal line, we probably want to jump to the old location, and else to
;; the old location, and else to the new (i.e. as if reverting). ;; the new (i.e. as if reverting). This is a convenient detail when using smerge-diff.
;; This is a convenient detail when using smerge-diff.
(if event (posn-set-point (event-end event))) (if event (posn-set-point (event-end event)))
(let ((rev (not (save-excursion (beginning-of-line) (let ((rev (not (save-excursion (beginning-of-line)
(looking-at "[-<]"))))) (looking-at "[-<]")))))
@ -96,7 +94,7 @@
(goto-char (+ (car pos) (cdr src))) (goto-char (+ (car pos) (cdr src)))
(diff-hunk-status-msg line-offset (diff-xor rev switched) t)))))) (diff-hunk-status-msg line-offset (diff-xor rev switched) t))))))
;; Key-bindings ----------------------------------------------------------- ;; Key-bindings --------------------------------------------------------------------------------
;; This shadows new global key-binding for other-window. ;; This shadows new global key-binding for other-window.
(define-key diff-mode-map (kbd "M-o") nil) (define-key diff-mode-map (kbd "M-o") nil)
@ -105,17 +103,17 @@
;; source in another window. ;; source in another window.
(define-key diff-mode-map (kbd "C-o") 'x-diff-display-source)) (define-key diff-mode-map (kbd "C-o") 'x-diff-display-source))
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; `ediff' ;; `ediff'
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(setq ediff-diff-options "-w" (setq ediff-diff-options "-w"
ediff-split-window-function 'split-window-horizontally ediff-split-window-function 'split-window-horizontally
ediff-window-setup-function 'ediff-setup-windows-plain) ediff-window-setup-function 'ediff-setup-windows-plain)
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; Load and configure `magit'. ;; Load and configure `magit'.
;; -------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(use-package magit (use-package magit
:bind :bind