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

91
init.el
View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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