Compare commits
92 Commits
Author | SHA1 | Date | |
---|---|---|---|
22dbc46233 | |||
339b0fd6d0 | |||
6ad008b9b9 | |||
a7f793b025 | |||
5a6b1fe9cb | |||
e56e405cf1 | |||
|
0cdab1766c | ||
|
b0d7e01934 | ||
|
7e860a6163 | ||
|
7d87ccd594 | ||
8f48a26530 | |||
71f7dc6b65 | |||
61cc9769a0 | |||
79719eeb2b | |||
86a951effa | |||
231538ac9e | |||
ed8d473d82 | |||
bf3719f445 | |||
751fc9c328 | |||
5906f63920 | |||
|
a37c544beb | ||
|
590e35de19 | ||
|
5f1e3b2cf5 | ||
f148787a95 | |||
fd7ce594cf | |||
6b72946534 | |||
55659ddbdc | |||
|
a8afdfffeb | ||
|
eb38848a12 | ||
|
754e81f612 | ||
a12a056666 | |||
c373aa8fef | |||
|
bde154fd12 | ||
|
004ede494f | ||
d3bc307fc6 | |||
3db600b630 | |||
d188301372 | |||
685ad488ca | |||
2ffd794ce3 | |||
72287e343a | |||
d89edbcec9 | |||
71efbad2de | |||
f96aeffbef | |||
d662cd1b23 | |||
9e7e0a57c3 | |||
af974d4ad4 | |||
218165ba3d | |||
6bc8c71dc8 | |||
67f65a91db | |||
|
22ff3a1ac4 | ||
|
494fcb310d | ||
59b08d19d2 | |||
b400cbcffb | |||
767b539315 | |||
8ed49aca41 | |||
90438d3073 | |||
af8460f9b2 | |||
c7e0ee9923 | |||
6370ed390c | |||
033155a1fb | |||
11d704f3bd | |||
8d652a9c5a | |||
39cfd598f3 | |||
0ec1a3b89c | |||
|
b0817e45b3 | ||
dffe2fb658 | |||
1265491990 | |||
c5df3d3f4f | |||
bbdd30fc3d | |||
c418a421fe | |||
|
22e6d1283d | ||
|
14ef54096e | ||
|
c5309015ce | ||
|
e4ceeea039 | ||
ea14a3ad61 | |||
c0d68a0230 | |||
0400af0e76 | |||
478b946d2e | |||
|
32b8f1f710 | ||
deba7b05b3 | |||
43fc591cac | |||
e4c95d9da5 | |||
409c9cd338 | |||
357c926f5d | |||
3cf8cc88d3 | |||
|
3d6dacf470 | ||
|
2b32f9b282 | ||
|
70f359f59f | ||
7f9a84cffd | |||
75109139b6 | |||
991640e7a6 | |||
acb88e2a2d |
4
.gitignore
vendored
4
.gitignore
vendored
@ -4,15 +4,19 @@ auto-save-list
|
||||
.cache
|
||||
elpa
|
||||
eshell
|
||||
projects
|
||||
semanticdb
|
||||
transient
|
||||
url
|
||||
|
||||
# Files
|
||||
bookmarks
|
||||
custom.el
|
||||
ede-projects.el
|
||||
elpa.tar.xz
|
||||
flycheck_*.elc
|
||||
.lsp-session-v1
|
||||
network-security.data
|
||||
places
|
||||
projectile-bookmarks.eld
|
||||
recentf
|
||||
|
85
README.org
85
README.org
@ -4,17 +4,54 @@
|
||||
|
||||
* Emacs version
|
||||
|
||||
This configuration is maintained only for the Emacs master branch version.
|
||||
It may work on some older version or you may have to remove the features that
|
||||
This configuration is maintained only for the Emacs master branch version. It
|
||||
may work on some older version or you may have to remove the features that
|
||||
rely on the newer Emacs versions. Currently, this configuration uses a few
|
||||
features from Emacs 26 and 27.
|
||||
|
||||
To fully leverage the features used in this configuration, Emacs must be
|
||||
compiled with the right options.
|
||||
|
||||
** Native JSON
|
||||
|
||||
This configuration uses ~lsp-mode~ for some programming languages which is
|
||||
much faster if Emacs is compiled with native JSON support. Emacs will by
|
||||
default compile with native JSON support if the ~jansson~ library is present
|
||||
(including headers).
|
||||
|
||||
** Vterm
|
||||
|
||||
*** Dynamic modules
|
||||
|
||||
~vterm~ uses dynamic modules. In order to enable dynamic modules, Emacs must
|
||||
be compiled with the ~--with-modules~ option (not enabled by default).
|
||||
|
||||
*** Pre-requisites
|
||||
|
||||
~vterm~ requires =cmake= and =libtool= to be installed.
|
||||
|
||||
*** Directory tracking
|
||||
|
||||
To enable directory tracking in vterm, put this in =.zshrc=
|
||||
|
||||
#+BEGIN_SRC
|
||||
vterm_printf(){
|
||||
printf "\e]%s\e\\" "$1"
|
||||
}
|
||||
|
||||
vterm_prompt_end() {
|
||||
vterm_printf "51;A$(whoami)@$(hostname):$(pwd)";
|
||||
}
|
||||
setopt PROMPT_SUBST
|
||||
PROMPT=$PROMPT'%{$(vterm_prompt_end)%}'
|
||||
#+END_SRC
|
||||
|
||||
* Installation
|
||||
|
||||
Clone this repository into your home directory:
|
||||
|
||||
#+BEGIN_SRC
|
||||
$ git clone https://github.com/Wojtek242/.emacs.d ~/.emacs.d
|
||||
$ git clone https://github.com/Wojtek242/.emacs.d ~/.config/emacs
|
||||
#+END_SRC
|
||||
|
||||
This configuration uses the [[https://github.com/adobe-fonts/source-code-pro][Source Code Pro]] font. If you do not have it
|
||||
@ -26,6 +63,12 @@
|
||||
$ sudo cp ~/.local/source-code-pro/OTF/*.otf /usr/local/share/fonts
|
||||
#+END_SRC
|
||||
|
||||
Once the initial setup completes, you also need to run the following in Emacs
|
||||
|
||||
#+BEGIN_SRC
|
||||
M-x all-the-icons-install-fonts
|
||||
#+END_SRC
|
||||
|
||||
* External Support for Programming Languages
|
||||
|
||||
This configuration relies uses ~lsp-mode~ for language-specific features.
|
||||
@ -34,43 +77,23 @@
|
||||
|
||||
** C/C++
|
||||
|
||||
Install =ccls= from source
|
||||
|
||||
#+BEGIN_SRC
|
||||
$ apt install clang libclang-dev
|
||||
$ git clone --depth=1 --recursive https://github.com/MaskRay/ccls
|
||||
$ cd ccls
|
||||
$ cmake -H. -BRelease
|
||||
$ cmake --build Release
|
||||
#+END_SRC
|
||||
|
||||
Ensure =Release/ccls= is in your =$PATH=.
|
||||
Emacs will automatically download ~clangd~ if it isn't installed already.
|
||||
|
||||
** Python
|
||||
|
||||
This configuration assumes =python3= and to use the auto-formatting features
|
||||
you need to have =autopep8= installed.
|
||||
|
||||
Install the Python language server using =pip3=
|
||||
|
||||
#+BEGIN_SRC
|
||||
$ pip3 install 'python-language-server[all]'
|
||||
#+END_SRC
|
||||
Emacs will automatically download ~pyright~ if it isn't installed already. Note that this
|
||||
requires ~npm~ to be installed.
|
||||
|
||||
** Rust
|
||||
|
||||
Install RLS using ~rustup~
|
||||
|
||||
#+BEGIN_SRC
|
||||
$ rustup component add rls rust-analysis rust-src
|
||||
#+END_SRC
|
||||
Install ~rust-analyzer~.
|
||||
|
||||
* Package Management
|
||||
|
||||
This =.emacs.d= uses its own small framework for package management located
|
||||
in the [[emodule][emodule]] directory. Its operation is heavily inspired by [[http://spacemacs.org/][Spacemacs]],
|
||||
but is much smaller with fewer features and thus simpler. For instructions,
|
||||
see its own [[emodule/README.org][README file]].
|
||||
This =.emacs.d= uses its own small framework for package management located in
|
||||
the [[emodule][emodule]] directory. Its operation is heavily inspired by [[http://spacemacs.org/][Spacemacs]], but is
|
||||
much smaller with fewer features and thus simpler. For instructions, see its
|
||||
own [[emodule/README.org][README file]].
|
||||
|
||||
* Theme
|
||||
|
||||
|
@ -19,12 +19,12 @@ and removal.
|
||||
Import the package:
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(add-to-list 'load-path "~/.emacs.d/emodule")
|
||||
(add-to-list 'load-path (concat (file-name-as-directory user-emacs-directory) "emodule"))
|
||||
(require 'emodule)
|
||||
#+END_SRC
|
||||
|
||||
Define one or more modules in the modules directory (by default
|
||||
=~/.emacs.d/modules=). The module =MODULE=, is expected to be
|
||||
=<user-emacs-directory>/modules=). The module =MODULE=, is expected to be
|
||||
defined in a file called =MODULE.el= which will define the list of
|
||||
required packages in ~emodule/MODULE-packages~ and any accompanying
|
||||
initialisation in the function ~emodule/MODULE-init~.
|
||||
|
@ -22,8 +22,7 @@
|
||||
;;; Code:
|
||||
|
||||
(require 'package)
|
||||
(with-no-warnings
|
||||
(require 'cl))
|
||||
(require 'cl-lib)
|
||||
|
||||
(defgroup emodule nil
|
||||
"Further automate working with `package'"
|
||||
@ -43,8 +42,8 @@ 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
|
||||
@ -55,7 +54,8 @@ may fix the problem. Note that subsequent attempts are only made
|
||||
after attempting to install all other packages first."
|
||||
:type 'integer)
|
||||
|
||||
(defcustom emodule/modules-dir "~/.emacs.d/modules/"
|
||||
(defcustom emodule/modules-dir
|
||||
(concat (file-name-as-directory user-emacs-directory) "modules")
|
||||
"Directory in which module files are to be found."
|
||||
:type 'string)
|
||||
|
||||
@ -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
|
||||
@ -183,7 +183,7 @@ dependency of one that is."
|
||||
(let ((needed (cl-loop for p in pkgs
|
||||
if (assq p package-alist)
|
||||
;; `p' and its dependencies are needed.
|
||||
append (cons p (package--get-deps p)))))
|
||||
append (cons p (package--get-deps (list p))))))
|
||||
(cl-loop for p in (mapcar #'car package-alist)
|
||||
unless (memq p needed)
|
||||
collect p)))
|
||||
@ -193,8 +193,8 @@ dependency of one that is."
|
||||
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
|
||||
`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"
|
||||
|
||||
@ -213,19 +213,18 @@ DESIRED-PKGS unless NO-SET-SELECTED is non-nil"
|
||||
(install-pkgs nil))
|
||||
(while (and (< attempt emodule/install-attempts)
|
||||
(setq install-pkgs
|
||||
(remove-if #'package-installed-p desired-pkgs)))
|
||||
(cl-remove-if #'package-installed-p desired-pkgs)))
|
||||
(if (= attempt 0)
|
||||
(progn
|
||||
(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))))
|
||||
|
||||
;; Print an error message if not all packages were installed.
|
||||
(let ((failed-pkgs (remove-if #'package-installed-p desired-pkgs)))
|
||||
(let ((failed-pkgs (cl-remove-if #'package-installed-p desired-pkgs)))
|
||||
(when failed-pkgs
|
||||
(emodule/print-error-log
|
||||
"*** WARNING: NOT ALL PACKAGES WERE INSTALLED ***")
|
||||
@ -239,8 +238,10 @@ DESIRED-PKGS unless NO-SET-SELECTED is non-nil"
|
||||
(emodule/print-log "*** Delete packages ***")
|
||||
(emodule/delete-pkgs delete-pkgs)))
|
||||
|
||||
;; Update `package-selected-packages'
|
||||
(unless no-set-selected
|
||||
(customize-save-variable 'package-selected-packages desired-pkgs)))
|
||||
(setq package-selected-packages desired-pkgs)
|
||||
(customize-save-variable 'package-selected-packages package-selected-packages)))
|
||||
|
||||
;;; Init functions:
|
||||
|
||||
@ -248,9 +249,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."
|
||||
@ -301,12 +300,11 @@ this macro."
|
||||
"Create a backup of the elpa directory in elpa.tar.xz."
|
||||
(interactive)
|
||||
(message "Backing up elpa...")
|
||||
(let* ((default-directory "~/.emacs.d")
|
||||
(let* ((default-directory user-emacs-directory)
|
||||
(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)
|
||||
@ -328,13 +326,12 @@ this macro."
|
||||
"Restore elpa directory state from backup."
|
||||
(interactive)
|
||||
(message "Restoring elpa...")
|
||||
(let* ((default-directory "~/.emacs.d")
|
||||
(let* ((default-directory user-emacs-directory)
|
||||
(dir "elpa")
|
||||
(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))
|
||||
@ -358,13 +355,16 @@ this macro."
|
||||
(let (upgrades)
|
||||
(dolist (entry package-alist)
|
||||
(let* ((pkg-desc (cadr entry))
|
||||
(pkg-name (package-desc-name pkg-desc))
|
||||
(pkg-version (package-desc-version pkg-desc))
|
||||
(pkg-name (package-desc-name pkg-desc)))
|
||||
(emodule/print-log (format "Checking package '%s' for upgrade" pkg-name))
|
||||
(let* ((pkg-version (package-desc-version pkg-desc))
|
||||
(pkg-avail (assq pkg-name package-archive-contents))
|
||||
(pkg-avail-desc (cadr pkg-avail))
|
||||
(pkg-avail-version (package-desc-version pkg-avail-desc)))
|
||||
(when (version-list-< pkg-version pkg-avail-version)
|
||||
(push pkg-name upgrades))))
|
||||
(progn
|
||||
(emodule/print-log (format "Package '%s' will be upgraded" pkg-name))
|
||||
(push pkg-name upgrades))))))
|
||||
upgrades))
|
||||
|
||||
(defun emodule/upgrade ()
|
||||
|
3422
external/antlr-mode.el
vendored
Normal file
3422
external/antlr-mode.el
vendored
Normal file
File diff suppressed because it is too large
Load Diff
122
external/eyepersp.el
vendored
Normal file
122
external/eyepersp.el
vendored
Normal file
@ -0,0 +1,122 @@
|
||||
;;; eyepersp.el --- Isolate `eyebrowse' windows in perspectives.
|
||||
;;
|
||||
;; Copyright (C) 2019 Wojciech Kozlowski
|
||||
;;
|
||||
;; Author: Wojciech Kozlowski <wk@wojciechkozlowski.eu>
|
||||
;; Created: 2019-12-18
|
||||
;;
|
||||
;; This file is not part of GNU Emacs.
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; Be default `perspective' and `eyebrowse' do not know about each other which
|
||||
;; means that window configurations are saved across perspectives. This is not
|
||||
;; only undesirable, but also problematic, because perspectives isolate
|
||||
;; buffers, but window configurations do not. This module resolves this by
|
||||
;; creating an isolated set of `eyebrowse' configurations for each perspective.
|
||||
;;
|
||||
;;; License: GPLv3
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 'perspective)
|
||||
(require 'eyebrowse)
|
||||
|
||||
(defvar eyepersp/perspectives nil)
|
||||
|
||||
(defun eyepersp/get-persp-parameters ()
|
||||
"Return alist of parameters for current perspective."
|
||||
(assoc (persp-curr) eyepersp/perspectives))
|
||||
|
||||
(defun eyepersp/delete-persp-parameters ()
|
||||
"Delete perspective state."
|
||||
(assoc-delete-all (persp-curr) eyepersp/perspectives))
|
||||
|
||||
(defun eyepersp/persp-parameter-cons (param-name)
|
||||
"Return the cons for PARAM-NAME for perspective.
|
||||
If none was set, returns nil."
|
||||
(assoc param-name (eyepersp/get-persp-parameters)))
|
||||
|
||||
(defun eyepersp/persp-parameter (param-name)
|
||||
"Return value of PARAM-NAME for perspective.
|
||||
If none was set, returns nil."
|
||||
(cdr (eyepersp/persp-parameter-cons param-name)))
|
||||
|
||||
(defun eyepersp/set-persp-parameter (param-name value)
|
||||
"Set PARAM-NAME to VALUE for current perspective."
|
||||
(let ((param (eyepersp/persp-parameter-cons param-name)))
|
||||
(when (not param)
|
||||
(let ((persp-params (eyepersp/get-persp-parameters)))
|
||||
(when (not persp-params)
|
||||
(setq eyepersp/perspectives
|
||||
(cons `(,(persp-curr) . nil) eyepersp/perspectives))
|
||||
(setq persp-params (car eyepersp/perspectives)))
|
||||
(setcdr persp-params
|
||||
(cons `(,param-name . nil) (cdr persp-params)))
|
||||
(setq param (cadr persp-params))))
|
||||
(setcdr param value)))
|
||||
|
||||
(defun eyepersp/get-persp-workspace ()
|
||||
"Get the correct workspace parameters for perspective."
|
||||
(let ((param-names '(eyepersp-eyebrowse-window-configs
|
||||
eyepersp-eyebrowse-current-slot
|
||||
eyepersp-eyebrowse-last-slot)))
|
||||
(--map (eyepersp/persp-parameter it) param-names)))
|
||||
|
||||
(defun eyepersp/set-persp-workspace (workspace-params)
|
||||
"Set workspace parameters for perspective.
|
||||
WORKSPACE-PARAMS should be a list containing 3 elements in
|
||||
this order:
|
||||
- window-configs, as returned by (eyebrowse--get 'window-configs),
|
||||
- current-slot, as returned by (eyebrowse--get 'current-slot),
|
||||
- last-slot, as returned by (eyebrowse--get 'last-slot)."
|
||||
(let ((param-names '(eyepersp-eyebrowse-window-configs
|
||||
eyepersp-eyebrowse-current-slot
|
||||
eyepersp-eyebrowse-last-slot)))
|
||||
(--zip-with (eyepersp/set-persp-parameter it other)
|
||||
param-names workspace-params)))
|
||||
|
||||
(defun eyepersp/load-eyebrowse-for-perspective ()
|
||||
"Load an eyebrowse workspace according to a perspective's parameters.
|
||||
If the perspective doesn't have a workspace, create one."
|
||||
(let* ((workspace-params (eyepersp/get-persp-workspace))
|
||||
(window-configs (nth 0 workspace-params))
|
||||
(current-slot (nth 1 workspace-params))
|
||||
(last-slot (nth 2 workspace-params)))
|
||||
(if window-configs
|
||||
(progn
|
||||
(eyebrowse--set 'window-configs window-configs)
|
||||
(eyebrowse--set 'current-slot current-slot)
|
||||
(eyebrowse--set 'last-slot last-slot)
|
||||
(eyebrowse--load-window-config current-slot))
|
||||
(eyebrowse--set 'window-configs nil)
|
||||
(eyebrowse-init)
|
||||
(eyepersp/save-eyebrowse-for-perspective))))
|
||||
|
||||
(defun eyepersp/update-eyebrowse-for-perspective (&rest _args)
|
||||
"Update and save current frame's eyebrowse workspace to its perspective."
|
||||
(let* ((current-slot (eyebrowse--get 'current-slot))
|
||||
(current-tag (nth 2 (assoc current-slot
|
||||
(eyebrowse--get 'window-configs)))))
|
||||
(eyebrowse--update-window-config-element
|
||||
(eyebrowse--current-window-config current-slot current-tag)))
|
||||
(eyepersp/save-eyebrowse-for-perspective))
|
||||
|
||||
(defun eyepersp/save-eyebrowse-for-perspective ()
|
||||
"Save FRAME's eyebrowse workspace to FRAME's perspective.
|
||||
FRAME defaults to the current frame."
|
||||
(eyepersp/set-persp-workspace (list (eyebrowse--get 'window-configs)
|
||||
(eyebrowse--get 'current-slot)
|
||||
(eyebrowse--get 'last-slot))))
|
||||
|
||||
(add-hook 'persp-before-switch-hook
|
||||
#'eyepersp/update-eyebrowse-for-perspective)
|
||||
(add-hook 'eyebrowse-post-window-switch-hook
|
||||
#'eyepersp/save-eyebrowse-for-perspective)
|
||||
(add-hook 'persp-activated-hook
|
||||
#'eyepersp/load-eyebrowse-for-perspective)
|
||||
(add-hook 'persp-killed-hook
|
||||
#'eyepersp/delete-persp-parameters)
|
||||
|
||||
(provide 'eyepersp)
|
||||
;;; eyepersp.el ends here
|
127
external/kos-mode.el
vendored
Normal file
127
external/kos-mode.el
vendored
Normal file
@ -0,0 +1,127 @@
|
||||
;;; kos-mode.el --- Summary
|
||||
;; Copyright (C) 2015 Fabian Kantereit
|
||||
;; Author: Fabian Kantereit
|
||||
;; Keywords: kOS, KerboScript, KSP, Kerbal SpaceProgram
|
||||
;;; Commentary:
|
||||
;;
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
;;;;;;;;;;;;;;;
|
||||
;; Mode hook ;;
|
||||
;;;;;;;;;;;;;;;
|
||||
(defvar kos-mode-hook nil)
|
||||
|
||||
;;;;;;;;;;;;;;
|
||||
;; Mode map ;;
|
||||
;;;;;;;;;;;;;;
|
||||
(defvar kos-mode-map
|
||||
(let ((map (make-keymap)))
|
||||
map)
|
||||
"Keymap for kOS major mode.")
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; autoload mode for ks files ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;###autoload
|
||||
(add-to-list 'auto-mode-alist '("\\.ks\\'" . kos-mode))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Language Syntax ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;
|
||||
(defconst kos-font-lock-keywords-1
|
||||
(list
|
||||
;; SHIP, STAGE, TIME, ENCOUNTER, CONFIG and TARGET
|
||||
'("\\<\\(\\(SHIP\\|STAGE\\|TARGET\\|TIME\\|ENCOUNTER\\|CONFIG\\):\\(\\w*:?\\)*\\)\\>" . font-lock-keyword-face)
|
||||
;; ALT and ETA
|
||||
'("\\<\\(ALT:\\(APOAPSIS\\|PERIAPSIS\\|RADAR\\)\\|ETA:\\(APOAPSIS\\|PERIAPSIS\\|TRANSITION\\)\\)\\>" . font-lock-keyword-face)
|
||||
;; GENERAL
|
||||
`(,(regexp-opt '("UP" "PROGRAGE" "RETROGRADE" "FACING" "MAXTHRUST" "VELOCITY" "GEOPOSITION" "THROTTLE" "STEERING" "STAGE" "SHIP" "HEADING" "LATITUDE" "LONGITUDE" "NORTH" "BODY" "ANGULARMOMENTUM" "ANGULARVEL" "ANGULARVELOCITY" "COMMRANGE" "MASS" "VERTICALSPEED" "SURFACESPEED" "AIRSPEED" "VESSELNAME" "ALTITUDE" "APOAPSIS" "PERIAPSIS" "SENSORS" "SRFPROGRADE" "SRFRETROGRADE" "OBT" "STATUS" "WHEELTHROTTLE" "WHEELSTEERING" "SAS" "RCS" "GEAR" "LEGS" "CHUTES" "LIGHTS" "PANELS" "BRAKES" "ABORT" "VERSION" "VERSION:MAJOR" "VERSION:MINOR" "SESSIONTIME" "TIME" "MAPVIEW" "WARP" "WARPMODE") 'words) . font-lock-keyword-face)
|
||||
;; Action Groups
|
||||
'("\\<AG[0-9]+\\>" . font-lock-keyword-face)
|
||||
;; Builtin Language Features
|
||||
`(,(regexp-opt '("SET" "TO" "IF" "ELSE" "UNTIL" "LOCK" "UNLOCK" "PRINT" "AT" "TOGGLE"
|
||||
"WAIT" "WHEN" "THEN" "OFF" "CLEARSCREEN" "ADD" "REMOVE" "LOG"
|
||||
"BREAK" "PRESERVE" "DECLARE" "PARAMETER" "SWITCH" "COPY" "FROM" "RENAME"
|
||||
"VOLUME" "FILE" "DELETE" "EDIT" "RUN" "COMPILE" "LIST" "REBOOT" "SHUTDOWN"
|
||||
"FOR" "UNSET" "BATCH" "DEPLOY" "IN" "ALL") 'words) . font-lock-builtin-face)
|
||||
'("\\('\\w*'\\)" . font-lock-variable-name-face))
|
||||
"Primary highlighting expressions for kOS mode.")
|
||||
|
||||
(defconst kos-font-lock-keywords-2
|
||||
(append kos-font-lock-keywords-1
|
||||
(list
|
||||
'("\\<\\(ON\\|OFF\\|TRUE\\|FALSE\\)\\>" . font-lock-constant-face) ;; ON / OFF keywords
|
||||
'("\"[^\"]+\"" . font-lock-string-face) ;; string literals
|
||||
'("\\b[-]?[0-9]+\\b" . font-lock-preprocessor-face) ;; integer literals
|
||||
'("\\b[-+]?[0-9]+\.[0-9]*\([eE][-+]?[0-9]+\)?\\b" . font-lock-preprocessor-face) ;; floating point literals
|
||||
)
|
||||
)
|
||||
"Additional Keywords to highlight in kOS (KerboScript) mode.")
|
||||
|
||||
(defvar kos-font-lock-keywords kos-font-lock-keywords-2
|
||||
"Default highlighting expressions for kOS (KerboScript) mode.")
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Syntax table for comments ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
(defvar kos-mode-syntax-table
|
||||
(let ((st (make-syntax-table)))
|
||||
(modify-syntax-entry ?_ "w" st)
|
||||
(modify-syntax-entry ?/ ". 124b" st)
|
||||
(modify-syntax-entry ?\n "> b" st)
|
||||
st)
|
||||
"Syntax table for kos-mode.")
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Indentation function ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
(defvar kos-indent-offset 4
|
||||
"Indentation offset for `kos-mode'.")
|
||||
|
||||
(defun kos-indent-line ()
|
||||
"Indent current line for any balanced-paren-mode'."
|
||||
(interactive)
|
||||
(let ((indent-col 0)
|
||||
(indentation-increasers "[{(]")
|
||||
(indentation-decreasers "[})]"))
|
||||
(save-excursion
|
||||
(beginning-of-line)
|
||||
(condition-case nil
|
||||
(while t
|
||||
(backward-up-list 1)
|
||||
(when (looking-at indentation-increasers)
|
||||
(setq indent-col (+ indent-col kos-indent-offset))))
|
||||
(error nil)))
|
||||
(save-excursion
|
||||
(back-to-indentation)
|
||||
(when (and (looking-at indentation-decreasers)
|
||||
(>= indent-col kos-indent-offset))
|
||||
(setq indent-col (- indent-col kos-indent-offset))))
|
||||
(indent-line-to indent-col)))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Major mode definition ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
(define-derived-mode kos-mode prog-mode "KerboScript"
|
||||
"Major mode for editing KerboScript Files"
|
||||
:syntax-table kos-mode-syntax-table
|
||||
;; Keymap
|
||||
(use-local-map kos-mode-map)
|
||||
;; set syntax highlighting
|
||||
(set (make-local-variable 'font-lock-defaults) '(kos-font-lock-keywords nil t))
|
||||
;; this should be case insensitive
|
||||
(set (make-local-variable 'font-lock-keywords-case-fold-search) t)
|
||||
;; indentation
|
||||
(set (make-local-variable 'indent-line-function) 'kos-indent-line)
|
||||
|
||||
;; support for comment shortcuts
|
||||
(setq comment-start "// ")
|
||||
(setq comment-end "")
|
||||
;; hook for loading additional modules
|
||||
(run-hooks 'kos-mode-hook)
|
||||
)
|
||||
|
||||
(provide 'kos-mode)
|
||||
|
||||
;;; kos-mode.el ends here
|
234
external/p4_16-mode.el
vendored
Normal file
234
external/p4_16-mode.el
vendored
Normal file
@ -0,0 +1,234 @@
|
||||
;;; p4_16-mode.el --- Support for the P4_16 programming language
|
||||
|
||||
;; Copyright (C) 2016- Barefoot Networks
|
||||
;; Author: Vladimir Gurevich <vladimir.gurevich@barefootnetworks.com>
|
||||
;; Maintainer: Vladimir Gurevich <vladimir.gurevich@barefootnetworks.com>
|
||||
;; Created: 15 April 2017
|
||||
;; Version: 0.2
|
||||
;; Keywords: languages p4_16
|
||||
;; Homepage: http://p4.org
|
||||
|
||||
;; This file is not part of GNU Emacs.
|
||||
|
||||
;; This file is free software…
|
||||
|
||||
;; This mode has preliminary support for P4_16. It covers the core language,
|
||||
;; but it is not clear yet, how we can highlight the indentifiers, defined
|
||||
;; for a particular architecture. Core library definitions are included
|
||||
|
||||
;; Placeholder for user customization code
|
||||
(defvar p4_16-mode-hook nil)
|
||||
|
||||
(defun p4_16-electric-brace (arg)
|
||||
"Insert a brace."
|
||||
(interactive "*P")
|
||||
(self-insert-command (prefix-numeric-value arg))
|
||||
(save-excursion
|
||||
(move-beginning-of-line nil)
|
||||
(indent-for-tab-command)))
|
||||
|
||||
;; Define the keymap (for now it is pretty much default)
|
||||
(defvar p4_16-mode-map
|
||||
(let ((map (make-keymap)))
|
||||
(define-key map "\C-j" 'newline-and-indent)
|
||||
(define-key map "{" 'p4_16-electric-brace)
|
||||
(define-key map "}" 'p4_16-electric-brace)
|
||||
(define-key map "\C-c\C-c" 'comment-region)
|
||||
map)
|
||||
"Keymap for P4_16 major mode")
|
||||
|
||||
;; Syntactic HighLighting
|
||||
|
||||
;; Main keywors (declarations and operators)
|
||||
(setq p4_16-keywords
|
||||
'("action" "apply"
|
||||
"control"
|
||||
"default"
|
||||
"else" "enum" "extern" "exit"
|
||||
"header" "header_union"
|
||||
"if"
|
||||
"match_kind"
|
||||
"package" "parser"
|
||||
"return"
|
||||
"select" "state" "struct" "switch"
|
||||
"table" "transition" "tuple" "typedef" "type"
|
||||
"verify"
|
||||
))
|
||||
|
||||
(setq p4_16-annotations
|
||||
'("@name" "@metadata" "@alias"
|
||||
))
|
||||
|
||||
(setq p4_16-attributes
|
||||
'("const" "in" "inout" "out"
|
||||
;; Tables
|
||||
"key" "actions" "default_action" "entries" "implementation"
|
||||
"counters" "meters"
|
||||
))
|
||||
|
||||
(setq p4_16-variables
|
||||
'("packet_in" "packet_out"
|
||||
))
|
||||
|
||||
(setq p4_16-operations
|
||||
'("&&&" ".." "++" "?" ":"))
|
||||
|
||||
(setq p4_16-constants
|
||||
'(
|
||||
;;; Don't care
|
||||
"_"
|
||||
;;; bool
|
||||
"false" "true"
|
||||
;;; error
|
||||
"NoError" "PacketTooShort" "NoMatch" "StackOutOfBounds"
|
||||
"OverwritingHeader" "HeaderTooShort" "ParserTiimeout"
|
||||
;;; match_kind
|
||||
"exact" "ternary" "lpm" "range"
|
||||
;;; We can add constants for supported architectures here
|
||||
))
|
||||
|
||||
(setq p4_16-types
|
||||
'("bit" "bool" "int" "varbit" "void" "error"
|
||||
))
|
||||
|
||||
(setq p4_16-primitives
|
||||
'(
|
||||
;;; Header methods
|
||||
"isValid" "setValid" "setInvalid"
|
||||
;;; Table Methods
|
||||
"hit" "action_run"
|
||||
;;; packet_in methods
|
||||
"extract" "lookahead" "advance" "length"
|
||||
;;; packet_out methods
|
||||
"emit"
|
||||
;;; Known parser states
|
||||
"accept" "reject"
|
||||
;;; misc
|
||||
"NoAction"
|
||||
))
|
||||
|
||||
(setq p4_16-cpp
|
||||
'("#include"
|
||||
"#define" "#undef"
|
||||
"#if" "#ifdef" "#ifndef"
|
||||
"#elif" "#else"
|
||||
"#endif"
|
||||
"defined"
|
||||
"#line" "#file"))
|
||||
|
||||
(setq p4_16-cppwarn
|
||||
'("#error" "#warning"))
|
||||
|
||||
;; Optimize the strings
|
||||
(setq p4_16-keywords-regexp (regexp-opt p4_16-keywords 'words))
|
||||
(setq p4_16-annotations-regexp (regexp-opt p4_16-annotations 1))
|
||||
(setq p4_16-attributes-regexp (regexp-opt p4_16-attributes 'words))
|
||||
(setq p4_16-variables-regexp (regexp-opt p4_16-variables 'words))
|
||||
(setq p4_16-operations-regexp (regexp-opt p4_16-operations 'words))
|
||||
(setq p4_16-constants-regexp (regexp-opt p4_16-constants 'words))
|
||||
(setq p4_16-types-regexp (regexp-opt p4_16-types 'words))
|
||||
(setq p4_16-primitives-regexp (regexp-opt p4_16-primitives 'words))
|
||||
(setq p4_16-cpp-regexp (regexp-opt p4_16-cpp 1))
|
||||
(setq p4_16-cppwarn-regexp (regexp-opt p4_16-cppwarn 1))
|
||||
|
||||
|
||||
;; create the list for font-lock.
|
||||
;; each category of keyword is given a particular face
|
||||
(defconst p4_16-font-lock-keywords
|
||||
(list
|
||||
(cons p4_16-cpp-regexp font-lock-preprocessor-face)
|
||||
(cons p4_16-cppwarn-regexp font-lock-warning-face)
|
||||
(cons p4_16-types-regexp font-lock-type-face)
|
||||
(cons p4_16-constants-regexp font-lock-constant-face)
|
||||
(cons p4_16-attributes-regexp font-lock-builtin-face)
|
||||
(cons p4_16-variables-regexp font-lock-variable-name-face)
|
||||
;;; This is a special case to distinguish the method from the keyword
|
||||
(cons "\\.apply" font-lock-function-name-face)
|
||||
(cons p4_16-primitives-regexp font-lock-function-name-face)
|
||||
(cons p4_16-operations-regexp font-lock-builtin-face)
|
||||
(cons p4_16-keywords-regexp font-lock-keyword-face)
|
||||
(cons p4_16-annotations-regexp font-lock-keyword-face)
|
||||
(cons "\\(\\w*_t +\\)" font-lock-type-face)
|
||||
(cons "[^A-Z_][A-Z] " font-lock-type-face) ;; Total hack for templates
|
||||
(cons "<[A-Z, ]*>" font-lock-type-face)
|
||||
(cons "\\(<[^>]+>\\)" font-lock-string-face)
|
||||
(cons "\\([^_A-Za-z]\\([0-9]+w\\)?0x[0-9A-Fa-f]+\\)" font-lock-constant-face)
|
||||
(cons "\\([^_A-Za-z]\\([0-9]+w\\)?0b[01]+\\)" font-lock-constant-face)
|
||||
(cons "\\([^_A-Za-z][+-]?\\([0-9]+w\\)?[0-9]+\\)" font-lock-constant-face)
|
||||
;;(cons "\\(\\w*\\)" font-lock-variable-name-face)
|
||||
)
|
||||
"Default Highlighting Expressions for P4_16")
|
||||
|
||||
(defvar p4_16-mode-syntax-table
|
||||
(let ((st (make-syntax-table)))
|
||||
(modify-syntax-entry ?_ "w" st)
|
||||
(modify-syntax-entry ?/ ". 124b" st)
|
||||
(modify-syntax-entry ?* ". 23" st)
|
||||
(modify-syntax-entry ?\n "> b" st)
|
||||
st)
|
||||
"Syntax table for p4_16-mode")
|
||||
|
||||
;;; Indentation
|
||||
(defvar p4_16-indent-offset 4
|
||||
"Indentation offset for `p4_16-mode'.")
|
||||
|
||||
(defun p4_16-indent-line ()
|
||||
"Indent current line for any balanced-paren-mode'."
|
||||
(interactive)
|
||||
(let ((indent-col 0)
|
||||
(indentation-increasers "[{(]")
|
||||
(indentation-decreasers "[})]")
|
||||
)
|
||||
(save-excursion
|
||||
(beginning-of-line)
|
||||
(condition-case nil
|
||||
(while t
|
||||
(backward-up-list 1)
|
||||
(when (looking-at indentation-increasers)
|
||||
(setq indent-col (+ indent-col p4_16-indent-offset))))
|
||||
(error nil)))
|
||||
(save-excursion
|
||||
(back-to-indentation)
|
||||
(when (and (looking-at indentation-decreasers)
|
||||
(>= indent-col p4_16-indent-offset))
|
||||
(setq indent-col (- indent-col p4_16-indent-offset))))
|
||||
(indent-line-to indent-col)))
|
||||
|
||||
;;; Imenu support
|
||||
(require 'imenu)
|
||||
(setq p4_16-imenu-generic-expression
|
||||
'(
|
||||
("Controls" "^ *control +\\([A-Za-z0-9_]*\\)" 1)
|
||||
("Externs" "^ *extern +\\([A-Za-z0-9_]*\\) *\\([A-Za-z0-9_]*\\)" 2)
|
||||
("Tables" "^ *table +\\([A-Za-z0-9_]*\\)" 1)
|
||||
("Actions" "^ *action +\\([A-Za-z0-9_]*\\)" 1)
|
||||
("Parsers" "^ *parser +\\([A-Za-z0-9_]*\\)" 1)
|
||||
("Parser States" "^ *state +\\([A-Za-z0-9_]*\\)" 1)
|
||||
("Headers" "^ *header +\\([A-Za-z0-9_]*\\)" 1)
|
||||
("Header Unions" "^ *header_union +\\([A-Za-z0-9_]*\\)" 1)
|
||||
("Structs" "^ *struct +\\([A-Za-z0-9_]*\\)" 1)
|
||||
))
|
||||
|
||||
;;; Cscope Support
|
||||
(require 'xcscope)
|
||||
|
||||
;; Put everything together
|
||||
(define-derived-mode p4_16-mode prog-mode "P4_16"
|
||||
"Major mode for editing P4_16 programs"
|
||||
:syntax-table p4_16-mode-syntax-table
|
||||
(use-local-map p4_16-mode-map)
|
||||
(set (make-local-variable 'font-lock-defaults) '(p4_16-font-lock-keywords))
|
||||
(set (make-local-variable 'indent-line-function) 'p4_16-indent-line)
|
||||
(setq imenu-generic-expression p4_16-imenu-generic-expression)
|
||||
;; Setting this to nil causes indentation to use only space
|
||||
;; characters, never tabs.
|
||||
(setq indent-tabs-mode nil)
|
||||
(setq comment-start "// ")
|
||||
(setq comment-end "")
|
||||
(imenu-add-to-menubar "P4_16")
|
||||
(cscope-minor-mode)
|
||||
(run-hooks 'p4_16-mode-hook)
|
||||
)
|
||||
|
||||
;; The most important line
|
||||
(provide 'p4_16-mode)
|
141
external/zoom-window.el
vendored
Normal file
141
external/zoom-window.el
vendored
Normal file
@ -0,0 +1,141 @@
|
||||
;;; zoom-window.el --- Zoom window like tmux -*- lexical-binding: t; -*-
|
||||
|
||||
;; Copyright (C) 2019 by Wojciech Kozlowski
|
||||
|
||||
;; Author: Wojciech Kozlowski <wk@wojciechkozlowski.eu>
|
||||
;; based on `github.com/syohex/emacs-zoom-window'
|
||||
;; by Syohei YOSHIDA <syohex@gmail.com>
|
||||
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; zoom-window.el provides functions which zooms specific window in frame and
|
||||
;; restore original window configuration. This is like tmux's zoom/unzoom
|
||||
;; features.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 'cl-lib)
|
||||
|
||||
(defgroup zoom-window nil
|
||||
"Zoom window like tmux"
|
||||
:group 'windows)
|
||||
|
||||
(defcustom zoom-window-mode-line-bg (face-background 'mode-line)
|
||||
"The face of the modeline when zoom-window is enabled."
|
||||
:type 'string)
|
||||
|
||||
(cl-defstruct zoom-window-
|
||||
(enabled nil)
|
||||
(mode-line-bg (face-background 'mode-line))
|
||||
(buffers nil)
|
||||
(window-configuration nil))
|
||||
(defvar zoom-window--cb (make-zoom-window-))
|
||||
|
||||
(defun zoom-window--save-mode-line-color ()
|
||||
"Save the original mode line color."
|
||||
(setf (zoom-window--mode-line-bg zoom-window--cb)
|
||||
(face-background 'mode-line)))
|
||||
|
||||
(defun zoom-window--save-buffers ()
|
||||
"Save the current buffer list."
|
||||
(let ((buffers (cl-loop for window in (window-list)
|
||||
collect (window-buffer window))))
|
||||
(setf (zoom-window--buffers zoom-window--cb) buffers)))
|
||||
|
||||
(defun zoom-window--get-buffers ()
|
||||
"Get the saved buffer list."
|
||||
(zoom-window--buffers zoom-window--cb))
|
||||
|
||||
(defun zoom-window--restore-mode-line-face ()
|
||||
"Restore the original mode line face."
|
||||
(set-face-background 'mode-line (zoom-window--mode-line-bg zoom-window--cb)))
|
||||
|
||||
(defun zoom-window--save-window-configuration ()
|
||||
"Save the window configuration."
|
||||
(setf (zoom-window--window-configuration zoom-window--cb)
|
||||
(list (current-window-configuration) (point-marker))))
|
||||
|
||||
(defun zoom-window--restore-window-configuration ()
|
||||
"Restore the window configuration."
|
||||
(let* ((window-context (zoom-window--window-configuration zoom-window--cb)))
|
||||
(let ((window-conf (cl-first window-context))
|
||||
(marker (cl-second window-context)))
|
||||
(set-window-configuration window-conf)
|
||||
(when (marker-buffer marker)
|
||||
(goto-char marker))
|
||||
(setf (zoom-window--window-configuration zoom-window--cb) nil))))
|
||||
|
||||
(defun zoom-window--toggle-enabled ()
|
||||
"Toggle the enabled flag."
|
||||
(let ((status (zoom-window--enabled zoom-window--cb)))
|
||||
(setf (zoom-window--enabled zoom-window--cb) (not status))))
|
||||
|
||||
(defun zoom-window--enable-p ()
|
||||
"Return t if zoom is enabled."
|
||||
(zoom-window--enabled zoom-window--cb))
|
||||
|
||||
(defsubst zoom-window--goto-line (line)
|
||||
"Go to the given LINE in the current buffer."
|
||||
(goto-char (point-min))
|
||||
(forward-line (1- line)))
|
||||
|
||||
(defun zoom-window--do-unzoom ()
|
||||
"Unzoom window."
|
||||
(let ((current-line (line-number-at-pos))
|
||||
(current-column (current-column))
|
||||
(current-buf (current-buffer)))
|
||||
(zoom-window--restore-mode-line-face)
|
||||
(zoom-window--restore-window-configuration)
|
||||
(unless (string= (buffer-name current-buf) (buffer-name))
|
||||
(switch-to-buffer current-buf))
|
||||
(zoom-window--goto-line current-line)
|
||||
(move-to-column current-column)))
|
||||
|
||||
(defun zoom-window--do-zoom ()
|
||||
"Zoom window."
|
||||
(zoom-window--save-mode-line-color)
|
||||
(zoom-window--save-buffers)
|
||||
(zoom-window--save-window-configuration)
|
||||
(delete-other-windows)
|
||||
(set-face-background 'mode-line zoom-window-mode-line-bg))
|
||||
|
||||
;;;###autoload
|
||||
(defun zoom-window-zoom ()
|
||||
"Zoom/un-zoom window."
|
||||
(interactive)
|
||||
(let ((enabled (zoom-window--enable-p)))
|
||||
(if (and (one-window-p) (not enabled))
|
||||
(message "There is only one window!!")
|
||||
(if enabled
|
||||
(with-demoted-errors "Warning: %S"
|
||||
(zoom-window--do-unzoom))
|
||||
(zoom-window--do-zoom))
|
||||
(force-mode-line-update)
|
||||
(zoom-window--toggle-enabled))))
|
||||
|
||||
(defun zoom-window-next ()
|
||||
"Switch to next buffer which is in zoomed workspace."
|
||||
(interactive)
|
||||
(let* ((buffers (zoom-window--get-buffers))
|
||||
(targets (member (current-buffer) buffers)))
|
||||
(if targets
|
||||
(if (cdr targets)
|
||||
(switch-to-buffer (cadr targets))
|
||||
(switch-to-buffer (car buffers)))
|
||||
(switch-to-buffer (car buffers)))))
|
||||
|
||||
(provide 'zoom-window)
|
||||
;;; zoom-window.el ends here
|
@ -15,7 +15,9 @@
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
(defconst init-buffer/banner-file "~/.emacs.d/init-buffer/blue-robot.png"
|
||||
(defconst init-buffer/banner-file
|
||||
(concat (file-name-as-directory user-emacs-directory)
|
||||
"init-buffer/blue-robot.png")
|
||||
"Location of the banner image to use.")
|
||||
|
||||
(defconst init-buffer/name "*GNU Emacs*"
|
||||
@ -57,7 +59,7 @@ Internal use, do not set this variable.")
|
||||
map)
|
||||
"Keymap for initial buffer mode.")
|
||||
|
||||
(define-derived-mode init-buffer-mode fundamental-mode "Initial buffer"
|
||||
(define-derived-mode init-buffer-mode fundamental-mode "Init"
|
||||
"Major mode for startup screen."
|
||||
:group 'init-buffer
|
||||
:syntax-table nil
|
||||
|
95
init.el
95
init.el
@ -11,37 +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)
|
||||
|
||||
;; Local copies of packages no longer provided by MELPA. See
|
||||
;; https://github.com/melpa/melpa/pull/5008.
|
||||
(add-to-list 'load-path "~/.emacs.d/emacswiki/")
|
||||
;; 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.d/emodule")
|
||||
(add-to-list 'load-path (emacs-dir "emodule"))
|
||||
(require 'emodule)
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; -----------------------------------------------------------------------------------------------
|
||||
;; Visual configuration.
|
||||
;; --------------------------------------------------------------------------
|
||||
;; -----------------------------------------------------------------------------------------------
|
||||
|
||||
;; Font ---------------------------------------------------------------------
|
||||
;; Font ------------------------------------------------------------------------------------------
|
||||
|
||||
(let* ((font-name "Source Code Pro")
|
||||
(font-size 10)
|
||||
@ -52,60 +58,61 @@
|
||||
(set-face-attribute 'italic nil ;; Emacs does not set italic face
|
||||
:family (concat font-name "-Italic")))
|
||||
|
||||
;; Fullscreen ---------------------------------------------------------------
|
||||
|
||||
(toggle-frame-maximized)
|
||||
(add-to-list 'default-frame-alist '(fullscreen . maximized))
|
||||
|
||||
;; 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.d/themes/")
|
||||
(add-to-list 'custom-theme-load-path "~/.emacs.d/themes/")
|
||||
(add-to-list 'load-path (emacs-dir "themes"))
|
||||
(add-to-list 'custom-theme-load-path (emacs-dir "themes"))
|
||||
|
||||
;; 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.d/init-buffer")
|
||||
(add-to-list 'load-path (emacs-dir "init-buffer"))
|
||||
(require 'init-buffer)
|
||||
|
||||
;; 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.d/custom.el")
|
||||
(setq-default custom-file (emacs-dir "custom.el"))
|
||||
|
||||
;; -----------------------------------------------------------------------------------------------
|
||||
;; Load any custom variables straight away to make sure all custom values carry over.
|
||||
;; -----------------------------------------------------------------------------------------------
|
||||
|
||||
(load custom-file 'noerror)
|
||||
|
||||
|
||||
;; *********************************************************************** ;;
|
||||
;; ******************************************************************************************** ;;
|
||||
;; ;;
|
||||
;; MODULES ;;
|
||||
;; ;;
|
||||
;; ----------------------------------------------------------------------- ;;
|
||||
;; -------------------------------------------------------------------------------------------- ;;
|
||||
;; ;;
|
||||
;; ;;
|
||||
;; Visual configuration must come before this point so that the frame can ;;
|
||||
;; be set up before any time consuming package management. ;;
|
||||
;; 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
|
||||
@ -119,24 +126,18 @@
|
||||
))
|
||||
|
||||
|
||||
;; *********************************************************************** ;;
|
||||
;; ******************************************************************************************** ;;
|
||||
;; ;;
|
||||
;; ;;
|
||||
;; Any configuration that is not in a module or needs to override module ;;
|
||||
;; settings should be set below this point. ;;
|
||||
;; 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)
|
||||
;; ******************************************************************************************** ;;
|
||||
|
||||
) ;; Reset garbage collection settings.
|
||||
|
||||
|
326
modules/emacs.el
326
modules/emacs.el
@ -20,12 +20,18 @@
|
||||
(defvar emodule/emacs-packages
|
||||
|
||||
'(ace-jump-mode
|
||||
ace-window
|
||||
deadgrep
|
||||
dired-subtree
|
||||
discover
|
||||
discover-my-major
|
||||
duplicate-thing
|
||||
expand-region
|
||||
eyebrowse
|
||||
highlight-parentheses
|
||||
ibuffer-vc
|
||||
iedit
|
||||
impatient-mode
|
||||
pdf-tools
|
||||
perspective
|
||||
projectile
|
||||
@ -40,6 +46,7 @@
|
||||
volatile-highlights
|
||||
which-key
|
||||
whole-line-or-region
|
||||
winner
|
||||
ws-butler)
|
||||
|
||||
)
|
||||
@ -49,15 +56,15 @@
|
||||
(defun emodule/emacs-init ()
|
||||
"Initialise the `emacs' module."
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; -----------------------------------------------------------------------------------------------
|
||||
;; Basic editor settings.
|
||||
;; --------------------------------------------------------------------------
|
||||
;; -----------------------------------------------------------------------------------------------
|
||||
|
||||
(setq-default
|
||||
;; This slows down cursor scrolling.
|
||||
auto-window-vscroll nil
|
||||
;; Standard fill-column width - last character is for end of line glyph.
|
||||
fill-column 79
|
||||
;; Standard fill-column width.
|
||||
fill-column 100
|
||||
;; Do not use tab characters for indentation.
|
||||
indent-tabs-mode nil
|
||||
;; Kill whole line when point at beginning of line.
|
||||
@ -66,20 +73,22 @@
|
||||
large-file-warning-threshold 10485760
|
||||
;; Keep point in same position on the screen when scrolling.
|
||||
scroll-preserve-screen-position 1
|
||||
;; sentences end with a single space
|
||||
sentence-end-double-space nil
|
||||
;; Indentation size - applies even when indent-tabs-mode is nil.
|
||||
tab-width 8
|
||||
;; Highlight lines that are too long in whitespace mode.
|
||||
whitespace-line-column fill-column)
|
||||
|
||||
;; Backup settings.
|
||||
(defvar backup-directory "~/.emacs.d/.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))
|
||||
|
||||
(setq-default
|
||||
;; Backup a file the first time it is saved.
|
||||
make-backup-files t
|
||||
;; Save backup files in ~/.emacs.d/.backups.
|
||||
;; Save backup files in <user-emacs-directory>/.backups.
|
||||
backup-directory-alist `((".*" . ,backup-directory))
|
||||
;; Copy the current file into backup directory.
|
||||
backup-by-copying t
|
||||
@ -131,25 +140,30 @@
|
||||
(setq-default max-lisp-eval-depth 24000) ;; 30x orignal value
|
||||
|
||||
;; Add directories to exec-path.
|
||||
(setq exec-path (append exec-path '("/home/wojtek/.local/bin"
|
||||
"/home/wojtek/.cask/bin")))
|
||||
(let ((home-dir (getenv "HOME")))
|
||||
(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 100000000)))
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; -----------------------------------------------------------------------------------------------
|
||||
;; Increase the amount of data which Emacs reads from the process.
|
||||
;; -----------------------------------------------------------------------------------------------
|
||||
|
||||
(setq read-process-output-max (* 1024 1024)) ;; 1 MB
|
||||
|
||||
;; -----------------------------------------------------------------------------------------------
|
||||
;; Additional key-bindings.
|
||||
;; --------------------------------------------------------------------------
|
||||
;; -----------------------------------------------------------------------------------------------
|
||||
|
||||
;; Toggle whitespace mode.
|
||||
(global-set-key (kbd "C-c w") 'whitespace-mode)
|
||||
@ -157,22 +171,11 @@
|
||||
;; Occur. More convenient than "M-s o".
|
||||
(global-set-key (kbd "M-s M-o") 'occur)
|
||||
|
||||
;; Kill other window (cyclic order).
|
||||
(global-set-key (kbd "C-z")
|
||||
(lambda ()
|
||||
(interactive)
|
||||
(quit-window t (next-window (selected-window)))))
|
||||
|
||||
;; Kill current buffer without prompting.
|
||||
(global-set-key (kbd "C-x k")
|
||||
(lambda ()
|
||||
(global-set-key (kbd "C-x k") (lambda ()
|
||||
(interactive)
|
||||
(let (kill-buffer-query-functions) (kill-buffer))))
|
||||
|
||||
;; Change active window. More convenient than "C-x o".
|
||||
(global-set-key (kbd "M-o") 'other-window)
|
||||
(global-set-key (kbd "M-O") (lambda () (interactive) (other-window -1)))
|
||||
|
||||
;; Scroll up/down, but keep point in place.
|
||||
(global-set-key (kbd "C-<") (lambda()
|
||||
(interactive)
|
||||
@ -183,9 +186,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.
|
||||
@ -196,7 +199,7 @@
|
||||
highlight-parentheses-mode)
|
||||
(highlight-parentheses-mode 1)))
|
||||
|
||||
;; Key-bindings -------------------------------------------------------------
|
||||
;; Key-bindings ----------------------------------------------------------------------------------
|
||||
|
||||
(global-set-key (kbd "C-x t l") (lambda ()
|
||||
(interactive)
|
||||
@ -207,10 +210,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."
|
||||
@ -218,17 +220,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
|
||||
@ -247,36 +249,36 @@
|
||||
(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."
|
||||
(interactive)
|
||||
(next-line)
|
||||
(forward-line 1)
|
||||
(transpose-lines 1)
|
||||
(previous-line))
|
||||
(forward-line -1))
|
||||
|
||||
(defun transpose-lines-up ()
|
||||
"Transpose the current line with the one above."
|
||||
(interactive)
|
||||
(transpose-lines 1)
|
||||
(previous-line 2))
|
||||
(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."
|
||||
@ -300,14 +302,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."
|
||||
@ -317,26 +319,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
|
||||
@ -352,9 +361,9 @@
|
||||
(unless (executable-find "rg")
|
||||
(global-set-key (kbd "C-x C-g") 'rgrep))
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; -----------------------------------------------------------------------------------------------
|
||||
;; `dired'
|
||||
;; --------------------------------------------------------------------------
|
||||
;; -----------------------------------------------------------------------------------------------
|
||||
|
||||
(use-package dired
|
||||
:config
|
||||
@ -371,6 +380,23 @@
|
||||
;; Automatically refresh dired buffer on changes.
|
||||
(add-hook 'dired-mode-hook 'auto-revert-mode))
|
||||
|
||||
(use-package dired-aux
|
||||
:after dired
|
||||
:config
|
||||
(add-to-list 'dired-compress-files-alist '("\\.tar\\'" . "tar -cf %o %i")))
|
||||
|
||||
(use-package dired-subtree
|
||||
:after dired
|
||||
:bind (:map dired-mode-map
|
||||
("TAB" . x-dired-subtree-toggle)
|
||||
("<tab>" . x-dired-subtree-toggle))
|
||||
:config
|
||||
(defun x-dired-subtree-toggle ()
|
||||
"Toggle dired subtree and revert buffer."
|
||||
(interactive)
|
||||
(dired-subtree-toggle)
|
||||
(dired-revert)))
|
||||
|
||||
(use-package dired-x
|
||||
:after dired
|
||||
:init
|
||||
@ -388,31 +414,45 @@
|
||||
: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)))
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
(use-package eyebrowse
|
||||
:after perspective
|
||||
:config
|
||||
;; (require 'eyepersp)
|
||||
(setq eyebrowse-default-workspace-slot 0)
|
||||
(eyebrowse-mode))
|
||||
|
||||
;; -----------------------------------------------------------------------------------------------
|
||||
;; `flyspell'
|
||||
;; --------------------------------------------------------------------------
|
||||
;; -----------------------------------------------------------------------------------------------x
|
||||
|
||||
(use-package flyspell
|
||||
:bind
|
||||
@ -424,29 +464,28 @@
|
||||
(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"))
|
||||
(setq-default ispell-extra-args '("--sug-mode=ultra" "--camel-case")))
|
||||
(setq-default ispell-program-name "hunspell"))
|
||||
(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 ()
|
||||
(add-hook 'ibuffer-hook (lambda ()
|
||||
(ibuffer-vc-set-filter-groups-by-vc-root)
|
||||
(unless (eq ibuffer-sorting-mode 'alphabetic)
|
||||
(ibuffer-do-sort-by-alphabetic))))
|
||||
@ -463,25 +502,58 @@
|
||||
" "
|
||||
filename-and-process))))
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; -----------------------------------------------------------------------------------------------
|
||||
;; `iedit'
|
||||
;; -----------------------------------------------------------------------------------------------
|
||||
|
||||
(use-package iedit
|
||||
:bind (("C-;" . iedit-mode)))
|
||||
|
||||
;; -----------------------------------------------------------------------------------------------
|
||||
;; `mail-mode'.
|
||||
;; -----------------------------------------------------------------------------------------------
|
||||
|
||||
(use-package mail-mode
|
||||
:mode "\\evo.*\\'"
|
||||
:hook
|
||||
((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.
|
||||
(defun markdown-html (buffer)
|
||||
(princ (with-current-buffer buffer
|
||||
(format "<!DOCTYPE html><html><title>Impatient Markdown</title><xmp theme=\"united\" style=\"display:none;\"> %s </xmp><script src=\"http://strapdownjs.com/v/0.2/strapdown.js\"></script></html>"
|
||||
(buffer-substring-no-properties (point-min)
|
||||
(point-max))))
|
||||
(current-buffer)))
|
||||
|
||||
(use-package impatient-mode
|
||||
:hook ((markdown-mode . (lambda () (imp-set-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
|
||||
@ -490,50 +562,47 @@
|
||||
: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
|
||||
(require 'smartparens-config)
|
||||
|
||||
(sp-with-modes '(c-mode c++-mode)
|
||||
(sp-local-pair "<" ">"))
|
||||
|
||||
(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)
|
||||
@ -579,7 +648,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.
|
||||
@ -590,20 +659,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 ()
|
||||
@ -614,34 +681,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
|
||||
@ -650,23 +725,30 @@
|
||||
: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)))
|
||||
|
||||
)
|
||||
|
||||
(provide 'emodule/emacs)
|
||||
|
@ -21,6 +21,8 @@
|
||||
|
||||
'(ace-jump-helm-line
|
||||
helm
|
||||
helm-flyspell
|
||||
helm-lsp
|
||||
helm-projectile
|
||||
swiper-helm)
|
||||
|
||||
@ -31,9 +33,9 @@
|
||||
(defun emodule/helm-init ()
|
||||
"Initialise the `helm' module."
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; -----------------------------------------------------------------------------------------------
|
||||
;; `ace-jump-helm-line'
|
||||
;; --------------------------------------------------------------------------
|
||||
;; -----------------------------------------------------------------------------------------------
|
||||
|
||||
(use-package ace-jump-helm-line
|
||||
:after helm
|
||||
@ -41,9 +43,9 @@
|
||||
(:map helm-map
|
||||
("C-'" . ace-jump-helm-line)))
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; -----------------------------------------------------------------------------------------------
|
||||
;; `helm'
|
||||
;; --------------------------------------------------------------------------
|
||||
;; -----------------------------------------------------------------------------------------------
|
||||
|
||||
(use-package helm
|
||||
:init
|
||||
@ -54,20 +56,21 @@
|
||||
("M-x" . helm-M-x)
|
||||
("M-y" . helm-show-kill-ring)
|
||||
("C-x b" . helm-mini)
|
||||
("C-x C-b" . helm-mini)
|
||||
("C-M-j" . helm-semantic-or-imenu)
|
||||
("C-h SPC" . helm-all-mark-rings))
|
||||
: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.
|
||||
@ -88,15 +91,10 @@
|
||||
helm-imenu-fuzzy-match t
|
||||
helm-apropos-fuzzy-match t
|
||||
helm-lisp-fuzzy-completion t
|
||||
;; Autoresize settings - by setting max = 0, these settings are used to
|
||||
;; control the helm window size.
|
||||
helm-autoresize-max-height 0
|
||||
helm-autoresize-min-height 35)
|
||||
;; While auresize is disabled these variable are in use.
|
||||
helm-display-buffer-default-height 0.35)
|
||||
|
||||
;; Enable autoresize to adjust helm window size.
|
||||
(helm-autoresize-mode 1)
|
||||
|
||||
;; Hide minibuffer --------------------------------------------------------
|
||||
;; Hide minibuffer -----------------------------------------------------------------------------
|
||||
|
||||
(defun x-helm-hide-minibuffer-maybe ()
|
||||
"Hide minibuffer in Helm session if we use the header line
|
||||
@ -111,7 +109,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)
|
||||
@ -119,14 +117,30 @@
|
||||
;; 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-lsp'
|
||||
;; -----------------------------------------------------------------------------------------------
|
||||
|
||||
(use-package helm-lsp
|
||||
:after (helm lsp-mode)
|
||||
:config
|
||||
(define-key lsp-mode-map [remap xref-find-apropos] #'helm-lsp-workspace-symbol))
|
||||
|
||||
;; ---------------------------------------------------------------------------------------------
|
||||
;; `helm-projectile'
|
||||
;; ------------------------------------------------------------------------
|
||||
;; ---------------------------------------------------------------------------------------------
|
||||
|
||||
(use-package helm-projectile
|
||||
:after projectile
|
||||
@ -134,15 +148,15 @@
|
||||
(setq-default projectile-completion-system 'helm)
|
||||
(helm-projectile-on))
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; -----------------------------------------------------------------------------------------------
|
||||
;; `swiper-helm'
|
||||
;; --------------------------------------------------------------------------
|
||||
;; -----------------------------------------------------------------------------------------------
|
||||
|
||||
(use-package swiper-helm
|
||||
:after helm
|
||||
:bind
|
||||
(("C-s" . swiper-helm)
|
||||
("M-s M-s" . isearch-forward))
|
||||
("C-c C-s" . isearch-forward))
|
||||
:config
|
||||
(setq swiper-helm-display-function 'helm-default-display-buffer))
|
||||
|
||||
|
@ -20,12 +20,23 @@
|
||||
|
||||
(defvar emodule/languages-packages
|
||||
|
||||
'(
|
||||
'(;; CMake
|
||||
cmake-mode
|
||||
;; C/C++
|
||||
ccls
|
||||
clang-format
|
||||
;; Dockerfile
|
||||
dockerfile-mode
|
||||
;; P4
|
||||
xcscope
|
||||
;; PlantUML
|
||||
plantuml-mode
|
||||
;; Protobuf
|
||||
protobuf-mode
|
||||
;; Python
|
||||
cython-mode
|
||||
lsp-pyright
|
||||
pyvenv
|
||||
py-autopep8
|
||||
;; Rust
|
||||
cargo
|
||||
@ -42,48 +53,133 @@
|
||||
(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) .
|
||||
(lambda () (require 'ccls) (lsp))))
|
||||
|
||||
(setq-default
|
||||
c-default-style "linux"
|
||||
(setq-default c-default-style "linux"
|
||||
c-basic-offset 4)
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
(use-package clang-format
|
||||
:bind (:map c-mode-map
|
||||
("C-c C-f" . clang-format-buffer)
|
||||
:map c++-mode-map
|
||||
("C-c C-f" . clang-format-buffer)
|
||||
: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\\'"
|
||||
:init
|
||||
(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)
|
||||
|
||||
(use-package python
|
||||
:init
|
||||
(setq python-shell-interpreter "python3")
|
||||
(defun x-lsp-disable-snippet ()
|
||||
"Set `lsp-enable-snippet' to nil in local buffer only."
|
||||
(make-local-variable 'lsp-enable-snippet)
|
||||
(setq lsp-enable-snippet nil))
|
||||
:hook
|
||||
(python-mode . lsp))
|
||||
(python-mode . (lambda ()
|
||||
(require 'lsp-pyright)
|
||||
(lsp)))
|
||||
(python-mode . x-lsp-disable-snippet))
|
||||
|
||||
(use-package lsp-pyright
|
||||
:defer t
|
||||
:init
|
||||
(setq lsp-pyright-venv-path (concat (getenv "HOME") "/.virtualenvs")))
|
||||
|
||||
(use-package py-autopep8
|
||||
;; Note that this package require autopep8 to be installed.
|
||||
:bind (("C-c C-f" . py-autopep8-buffer)))
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
(use-package pyvenv
|
||||
:commands pyvenv-create)
|
||||
|
||||
;; -----------------------------------------------------------------------------------------------
|
||||
;; Rust.
|
||||
;; --------------------------------------------------------------------------
|
||||
;; -----------------------------------------------------------------------------------------------
|
||||
|
||||
(defun rust-new-project (project-name project-type)
|
||||
(let ((rust-cargo-bin "cargo"))
|
||||
@ -113,7 +209,9 @@
|
||||
(rust-new-project project-name "lib"))
|
||||
|
||||
(use-package rust-mode
|
||||
:hook (rust-mode . lsp)
|
||||
;; Adding the lsp hook this way is required to ensure local variables from .dir-locals.el are
|
||||
;; passed to the LSP server.
|
||||
:hook ((hack-local-variables . (lambda () (when (derived-mode-p 'rust-mode) (lsp)))))
|
||||
:config
|
||||
(setq exec-path (append exec-path '("/home/wojtek/.cargo/bin"))))
|
||||
|
||||
@ -129,9 +227,9 @@
|
||||
(use-package toml-mode
|
||||
:mode "\\.lock\\'")
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; -----------------------------------------------------------------------------------------------
|
||||
;; YAML.
|
||||
;; --------------------------------------------------------------------------
|
||||
;; -----------------------------------------------------------------------------------------------
|
||||
|
||||
(use-package yaml-mode
|
||||
:config
|
||||
|
@ -29,48 +29,110 @@
|
||||
(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
|
||||
(after-init . doom-modeline-mode)
|
||||
:config
|
||||
(setq column-number-mode t
|
||||
doom-modeline-height 23
|
||||
doom-modeline-height 25
|
||||
doom-modeline-checker-simple-format nil
|
||||
doom-modeline-env-python-executable "python3")
|
||||
|
||||
;; Convenience function for correct active/inactive handling.
|
||||
(defun emodule/modeline-inactive-switch (str)
|
||||
"Apply inactive mode line face to STR if necessary."
|
||||
(if (doom-modeline--active)
|
||||
str
|
||||
(propertize str 'face 'mode-line-inactive)))
|
||||
|
||||
;; Custom perspective display - display only the active perspective.
|
||||
(doom-modeline-def-segment perspective-name
|
||||
"Perspectives list and selection. Requires `persp-mode' to be enabled."
|
||||
(defun emodule/modeline-persp ()
|
||||
"Return the formatted perspective name."
|
||||
(if (bound-and-true-p persp-mode)
|
||||
(persp-format-name (persp-name (persp-curr)))
|
||||
""))
|
||||
|
||||
;; Necessary to play nice with Helm.
|
||||
(add-hook 'helm-minibuffer-set-up-hook
|
||||
(lambda ()
|
||||
(advice-add #'doom-modeline--active :override (lambda () t))))
|
||||
(add-hook 'helm-cleanup-hook
|
||||
(lambda ()
|
||||
(advice-remove #'doom-modeline--active (lambda () t))))
|
||||
(doom-modeline-def-segment emodule/modeline-persp-segment
|
||||
"Currently chose perspective."
|
||||
(emodule/modeline-inactive-switch
|
||||
(concat "[" (emodule/modeline-persp) "]")))
|
||||
|
||||
;; The current eyebrowse workspace number.
|
||||
(defun emodule/modeline-eyebrowse ()
|
||||
"Return the currently active eyebrowse workspace."
|
||||
(if (bound-and-true-p eyebrowse-mode)
|
||||
(let* ((cur (eyebrowse--get 'current-slot))
|
||||
(all (--map (car it) (eyebrowse--get 'window-configs)))
|
||||
(str (--map (if (= cur it)
|
||||
(propertize (int-to-string it)
|
||||
'face
|
||||
'eyebrowse-mode-line-active)
|
||||
(int-to-string it))
|
||||
all)))
|
||||
(apply 'concat str))
|
||||
""))
|
||||
|
||||
(doom-modeline-def-segment emodule/modeline-eyebrowse-segment
|
||||
"The current workspace name or number."
|
||||
(emodule/modeline-inactive-switch (emodule/modeline-eyebrowse)))
|
||||
|
||||
;; A combined segment.
|
||||
(doom-modeline-def-segment emodule/modeline-persp-eyebrowse-segment
|
||||
(emodule/modeline-inactive-switch
|
||||
(concat "[" (emodule/modeline-persp)
|
||||
":" (emodule/modeline-eyebrowse)
|
||||
"]")))
|
||||
|
||||
;; Display active python virtualenv.
|
||||
(defface pyvenv-active-face
|
||||
'((t (:inherit persp-selected-face)))
|
||||
"The face used to highlight the active virtualenv on the modeline."
|
||||
:group 'emodule/modeline-faces)
|
||||
|
||||
(defun emodule/modeline-pyvenv ()
|
||||
"Return the formatted virtualenv name."
|
||||
(if (bound-and-true-p pyvenv-virtual-env-name)
|
||||
(propertize pyvenv-virtual-env-name 'face 'pyvenv-active-face)
|
||||
""))
|
||||
|
||||
(doom-modeline-def-segment emodule/modeline-pyvenv-segment
|
||||
"Active Python virtualenv."
|
||||
(emodule/modeline-inactive-switch (emodule/modeline-pyvenv)))
|
||||
|
||||
;; Define custom modeline.
|
||||
(doom-modeline-def-modeline 'my-line
|
||||
'(bar "[" perspective-name "]" window-number matches buffer-info remote-host buffer-position selection-info)
|
||||
'(lsp debug major-mode vcs checker bar))
|
||||
'(bar
|
||||
emodule/modeline-persp-eyebrowse-segment
|
||||
window-number matches buffer-info remote-host
|
||||
buffer-position selection-info)
|
||||
'(lsp debug emodule/modeline-pyvenv-segment major-mode vcs checker))
|
||||
|
||||
;; Project modeline (used in Dired).
|
||||
(doom-modeline-def-modeline 'project
|
||||
'(bar
|
||||
emodule/modeline-persp-eyebrowse-segment
|
||||
window-number buffer-default-directory)
|
||||
'(debug major-mode process))
|
||||
|
||||
;; VCS modeline (used in magit).
|
||||
(doom-modeline-def-modeline 'vcs
|
||||
'(bar
|
||||
emodule/modeline-persp-eyebrowse-segment
|
||||
window-number matches buffer-info buffer-position selection-info)
|
||||
'(debug minor-modes buffer-encoding major-mode process))
|
||||
|
||||
(add-hook 'doom-modeline-mode-hook
|
||||
(lambda () (doom-modeline-set-modeline 'my-line 'default))))
|
||||
|
@ -1,4 +1,4 @@
|
||||
;;; org.el --- Module file for org-mode configuration.
|
||||
;;; org.el --- Module file for org-mode and org-like package configuration.
|
||||
;;
|
||||
;; Copyright (C) 2017-2019 Wojciech Kozlowski
|
||||
;;
|
||||
@ -20,7 +20,8 @@
|
||||
|
||||
(defvar emodule/org-packages
|
||||
|
||||
'(org-bullets
|
||||
'(elfeed
|
||||
org-bullets
|
||||
org-noter)
|
||||
|
||||
)
|
||||
@ -30,28 +31,56 @@
|
||||
(defun emodule/org-init ()
|
||||
"Initialise the `org' module."
|
||||
|
||||
;; -----------------------------------------------------------------------------------------------
|
||||
;; `elfeed'
|
||||
;; -----------------------------------------------------------------------------------------------
|
||||
|
||||
(use-package elfeed
|
||||
:bind
|
||||
(("C-x w" . elfeed))
|
||||
:config
|
||||
(let ((elfeed-feeds-file "~/Workspace/rss.xml"))
|
||||
(when (file-exists-p elfeed-feeds-file)
|
||||
(elfeed-load-opml elfeed-feeds-file)
|
||||
(run-at-time nil 3600 'elfeed-update))))
|
||||
|
||||
;; -----------------------------------------------------------------------------------------------
|
||||
;; `org'
|
||||
;; -----------------------------------------------------------------------------------------------
|
||||
|
||||
(use-package org
|
||||
:hook
|
||||
(org-mode . auto-fill-mode)
|
||||
:bind
|
||||
(("C-c a" . org-agenda)
|
||||
("C-c b" . org-switchb)
|
||||
("C-c c" . org-capture)
|
||||
("C-c l" . org-store-link))
|
||||
:config
|
||||
;; ------------------------------------------------------------------------
|
||||
;; ---------------------------------------------------------------------------------------------
|
||||
;; Set variables.
|
||||
;; ------------------------------------------------------------------------
|
||||
;; ---------------------------------------------------------------------------------------------
|
||||
|
||||
(setq
|
||||
;; Hide special characters for italics/bold/underline.
|
||||
org-hide-emphasis-markers t
|
||||
;; Add timestamp when tasks are marked as done.
|
||||
org-log-done t
|
||||
;; Do not hide special characters for italics/bold/underline.
|
||||
org-hide-emphasis-markers nil
|
||||
;; Open org files unfolded
|
||||
org-startup-folded nil)
|
||||
org-startup-folded nil
|
||||
;; Catch edits in invisible areas (space after the ellipsis ...)
|
||||
org-catch-invisible-edits 'error
|
||||
;; Don't warn about deadlines - they're pretty visible as is
|
||||
org-deadline-warning-days 0
|
||||
;; Do not apply a special font to DONE headlines.
|
||||
org-fontify-done-headline nil)
|
||||
|
||||
;; ------------------------------------------------------------------------
|
||||
(setq org-agenda-prefix-format '((agenda . " %i %?-12t% s %b")
|
||||
(todo . " %i %-48b")
|
||||
(tags . " %i %b")
|
||||
(search . " %i %b")))
|
||||
|
||||
;; ---------------------------------------------------------------------------------------------
|
||||
;; Set workflow states.
|
||||
;; ------------------------------------------------------------------------
|
||||
;; ---------------------------------------------------------------------------------------------
|
||||
|
||||
(setq org-todo-keywords
|
||||
(quote ((sequence "TODO(t)"
|
||||
@ -63,12 +92,18 @@
|
||||
"|"
|
||||
"UNPLANNED(c@/!)"))))
|
||||
|
||||
(setq org-todo-keyword-faces
|
||||
(quote (("NEXT" :foreground "#96DEFA" :weight bold))))
|
||||
(setq org-todo-keyword-faces (quote (("NEXT" :foreground "#96DEFA" :weight bold)
|
||||
("WAIT" :foreground "#798A9B" :weight bold)
|
||||
("HOLD" :foreground "#798A9B" :weight bold)
|
||||
;; For music collection files.
|
||||
("WISH" :foreground "#FFEE99" :weight bold)
|
||||
("MPEG" :foreground "#CCCCFF" :weight bold)
|
||||
("DISC" :foreground "#96DEFA" :weight bold)
|
||||
("DROP" :foreground "#798A9B" :weight bold))))
|
||||
|
||||
;; ------------------------------------------------------------------------
|
||||
;; ---------------------------------------------------------------------------------------------
|
||||
;; Better bullet points.
|
||||
;; ------------------------------------------------------------------------
|
||||
;; ---------------------------------------------------------------------------------------------
|
||||
|
||||
(font-lock-add-keywords 'org-mode
|
||||
'(("^ +\\(*\\) "
|
||||
@ -77,30 +112,22 @@
|
||||
(match-end 1)
|
||||
"•"))))))
|
||||
|
||||
;; ------------------------------------------------------------------------
|
||||
;; ---------------------------------------------------------------------------------------------
|
||||
;; LaTeX font size.
|
||||
;; ------------------------------------------------------------------------
|
||||
;; ---------------------------------------------------------------------------------------------
|
||||
|
||||
(plist-put org-format-latex-options :scale 2.0)
|
||||
(plist-put org-format-latex-options :scale 2.0))
|
||||
|
||||
;; ------------------------------------------------------------------------
|
||||
;; Load agenda-files.
|
||||
;; ------------------------------------------------------------------------
|
||||
(let* ((org-dir "~/Workspace/org/")
|
||||
(file-list (concat org-dir "agenda-files.el")))
|
||||
(when (file-exists-p file-list)
|
||||
(load file-list))))
|
||||
|
||||
;; ------------------------------------------------------------------------
|
||||
;; -----------------------------------------------------------------------------------------------
|
||||
;; Better header bullets
|
||||
;; ------------------------------------------------------------------------
|
||||
;; -----------------------------------------------------------------------------------------------
|
||||
|
||||
(use-package org-bullets
|
||||
:hook (org-mode . org-bullets-mode))
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; -----------------------------------------------------------------------------------------------
|
||||
;; Org-noter.
|
||||
;; --------------------------------------------------------------------------
|
||||
;; -----------------------------------------------------------------------------------------------
|
||||
|
||||
(use-package org-noter
|
||||
:defer t)
|
||||
|
@ -22,7 +22,6 @@
|
||||
|
||||
'(company
|
||||
company-c-headers
|
||||
company-lsp
|
||||
fic-mode
|
||||
flycheck
|
||||
flycheck-pos-tip
|
||||
@ -41,9 +40,9 @@
|
||||
(defun emodule/programming-init ()
|
||||
"Initialise the `programming' module."
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; -----------------------------------------------------------------------------------------------
|
||||
;; Line numbers.
|
||||
;; --------------------------------------------------------------------------
|
||||
;; -----------------------------------------------------------------------------------------------
|
||||
|
||||
(setq-default
|
||||
display-line-numbers-width-start 4
|
||||
@ -51,23 +50,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 +107,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 +128,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 +166,9 @@
|
||||
|
||||
(global-set-key (kbd "M-'") 'make-box-comment)
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; -----------------------------------------------------------------------------------------------
|
||||
;; `company' - complete anything.
|
||||
;; --------------------------------------------------------------------------
|
||||
;; -----------------------------------------------------------------------------------------------
|
||||
|
||||
(use-package company
|
||||
:hook
|
||||
@ -180,7 +179,7 @@
|
||||
("C-p" . company-select-previous))
|
||||
:config
|
||||
(setq company-idle-delay 0
|
||||
company-minimum-prefix-length 3
|
||||
company-minimum-prefix-length 1
|
||||
company-tooltip-align-annotations t)
|
||||
;; For this to correctly complete headers, need to add all include paths to
|
||||
;; `company-c-headers-path-system'.
|
||||
@ -189,17 +188,21 @@
|
||||
(setq company-backends (delete 'company-dabbrev company-backends))
|
||||
(setq company-backends (delete 'company-capf company-backends)))
|
||||
|
||||
(use-package company-lsp
|
||||
:commands company-lsp)
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; -----------------------------------------------------------------------------------------------
|
||||
;; `compile'
|
||||
;; --------------------------------------------------------------------------
|
||||
;; -----------------------------------------------------------------------------------------------
|
||||
|
||||
(use-package compile
|
||||
:init
|
||||
(defun compilation-exit-autoclose (status code msg)
|
||||
"Close *compilation* buffer if compilation exits successfully."
|
||||
(when (and (eq status 'exit) (zerop code))
|
||||
;; Timer is necessary otherwise message is printed into another buffer
|
||||
(run-with-timer 0.5 nil (lambda () (kill-buffer "*compilation*"))))
|
||||
(cons msg code))
|
||||
:bind
|
||||
(("C-c c" . compile)
|
||||
("C-c r" . recompile))
|
||||
(("C-x C-." . compile)
|
||||
("C-x C-," . recompile))
|
||||
:config
|
||||
(setq-default
|
||||
;; Default compile commande
|
||||
@ -211,6 +214,15 @@
|
||||
;; Automatically scroll to first error.
|
||||
compilation-scroll-output 'first-error)
|
||||
|
||||
(defun toggle-compilation-exit-autoclose ()
|
||||
"Toggle autoclose on successful compilation."
|
||||
(interactive)
|
||||
(if compilation-exit-message-function
|
||||
(setq-default compilation-exit-message-function
|
||||
nil)
|
||||
(setq-default compilation-exit-message-function
|
||||
'compilation-exit-autoclose)))
|
||||
|
||||
;; ansi-colors
|
||||
(ignore-errors
|
||||
(require 'ansi-color)
|
||||
@ -219,9 +231,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
|
||||
@ -234,16 +246,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))
|
||||
@ -252,16 +264,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
|
||||
@ -274,38 +286,38 @@
|
||||
(setq highlight-symbol-idle-delay 0.2
|
||||
highlight-symbol-on-navigation-p t))
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; -----------------------------------------------------------------------------------------------
|
||||
;; `lsp-mode'
|
||||
;; --------------------------------------------------------------------------
|
||||
;; -----------------------------------------------------------------------------------------------
|
||||
|
||||
(use-package lsp-mode
|
||||
:commands lsp
|
||||
:config
|
||||
(require 'lsp-clients)
|
||||
(setq lsp-enable-indentation nil))
|
||||
:init
|
||||
(setq lsp-diagnostics-provider :flycheck
|
||||
lsp-enable-indentation nil
|
||||
lsp-file-watch-threshold 25000)
|
||||
:hook ((lsp-mode . lsp-enable-which-key-integration)))
|
||||
|
||||
(use-package lsp-ui
|
||||
:commands lsp-ui-mode
|
||||
:init
|
||||
(setq lsp-ui-doc-enable nil
|
||||
lsp-prefer-flymake nil
|
||||
lsp-ui-sideline-enable nil)
|
||||
(setq lsp-ui-doc-alignment 'window)
|
||||
:bind
|
||||
(("M-#" . lsp-ui-doc-focus-frame))
|
||||
:config
|
||||
(define-key lsp-ui-mode-map
|
||||
[remap xref-find-definitions] #'lsp-ui-peek-find-definitions)
|
||||
(define-key lsp-ui-mode-map
|
||||
[remap xref-find-references] #'lsp-ui-peek-find-references))
|
||||
(define-key lsp-ui-mode-map [remap xref-find-definitions] #'lsp-ui-peek-find-definitions)
|
||||
(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
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
(defvar emodule/terminal-packages
|
||||
|
||||
'(tramp-term)
|
||||
'(vterm)
|
||||
|
||||
)
|
||||
|
||||
@ -29,92 +29,9 @@
|
||||
(defun emodule/terminal-init ()
|
||||
"Initialise the `terminal' module."
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; `term' - the terminal reports itself as a "eterm-color". Therefore the
|
||||
;; `.bashrc' or `.zshrc' scripts can know if they're inside Emacs by testing
|
||||
;; [ "$TERM" == "eterm-color" ].
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(use-package term
|
||||
:config
|
||||
(defun x-term-setup ()
|
||||
(interactive)
|
||||
(define-key term-raw-map (kbd "C-y") 'term-send-raw)
|
||||
(define-key term-raw-map (kbd "C-p") 'term-send-raw)
|
||||
(define-key term-raw-map (kbd "C-n") 'term-send-raw)
|
||||
(define-key term-raw-map (kbd "C-s") 'term-send-raw)
|
||||
(define-key term-raw-map (kbd "C-r") 'term-send-raw)
|
||||
(define-key term-raw-map (kbd "M-o") 'other-window)
|
||||
(define-key term-raw-map (kbd "M-w") 'kill-ring-save)
|
||||
(define-key term-raw-map (kbd "M-y") 'helm-show-kill-ring)
|
||||
(define-key term-raw-map (kbd "M-d") (lambda () (interactive) (term-send-raw-string "\ed")))
|
||||
(define-key term-raw-map (kbd "<C-backspace>") (lambda () (interactive) (term-send-raw-string "\e\C-?")))
|
||||
(define-key term-raw-map (kbd "M-p") (lambda () (interactive) (term-send-raw-string "\ep")))
|
||||
(define-key term-raw-map (kbd "M-n") (lambda () (interactive) (term-send-raw-string "\en")))
|
||||
(define-key term-raw-map (kbd "C-S-v") 'term-paste)
|
||||
(define-key term-raw-map (kbd "C-h") nil) ; unbind C-h
|
||||
(define-key term-raw-map (kbd "M-x") nil) ; unbind M-x
|
||||
(define-key term-raw-map (kbd "C-1") 'delete-other-windows)
|
||||
(define-key term-raw-map (kbd "C-2") 'split-window-below)
|
||||
(define-key term-raw-map (kbd "C-3") 'split-window-right)
|
||||
(define-key term-raw-map (kbd "C-0") 'delete-window))
|
||||
|
||||
(add-hook 'term-mode-hook 'x-term-setup t)
|
||||
(setq term-buffer-maximum-size 0)
|
||||
|
||||
(defun ansi-term-pop (term-cmd)
|
||||
"Launch terminal in (preferably) other window."
|
||||
(let ((ansi-buf nil)
|
||||
(cur-buf (current-buffer)))
|
||||
(setq ansi-buf (ansi-term term-cmd))
|
||||
(switch-to-buffer cur-buf)
|
||||
(switch-to-buffer-other-window ansi-buf)))
|
||||
|
||||
(defun ansi-term-recycle (term-cmd)
|
||||
"Kill current buffer and start an *ansi-term* in it."
|
||||
(kill-buffer (current-buffer))
|
||||
(ansi-term term-cmd))
|
||||
|
||||
(defun first-matching-buffer (regex)
|
||||
"Find first buffer whose name matches REGEXP."
|
||||
(car (remove-if-not
|
||||
(apply-partially 'string-match-p regex)
|
||||
(mapcar 'buffer-name (buffer-list)))))
|
||||
|
||||
(defun visit-ansi-term ()
|
||||
"Open or switch to active ansi-term.
|
||||
If current buffer is a term:
|
||||
If it is running
|
||||
Open a new ansi-term in a new window
|
||||
If it is not running
|
||||
Recycle (kill buffer, restart term)
|
||||
If current buffer is not a term:
|
||||
If a *ansi-term*<x> buffer exists
|
||||
Switch to that ansi-term in other window
|
||||
Recycle if necessary
|
||||
If it does not exist
|
||||
Open a new ansi-term in a new window"
|
||||
(interactive)
|
||||
(let ((is-term (string= "term-mode" major-mode))
|
||||
(is-running (term-check-proc (buffer-name)))
|
||||
(term-cmd "/bin/zsh")
|
||||
(anon-term (first-matching-buffer "^*ansi-term*")))
|
||||
(if is-term
|
||||
(if is-running
|
||||
(ansi-term-pop term-cmd)
|
||||
(ansi-term-recycle term-cmd))
|
||||
(if anon-term
|
||||
(progn
|
||||
(switch-to-buffer-other-window anon-term)
|
||||
(unless (term-check-proc (buffer-name))
|
||||
(ansi-term-recycle term-cmd)))
|
||||
(ansi-term-pop term-cmd)))))
|
||||
|
||||
(global-set-key (kbd "C-x '") 'visit-ansi-term))
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; -----------------------------------------------------------------------------------------------
|
||||
;; `eshell'
|
||||
;; --------------------------------------------------------------------------
|
||||
;; -----------------------------------------------------------------------------------------------
|
||||
|
||||
(use-package eshell
|
||||
:config
|
||||
@ -180,12 +97,75 @@
|
||||
(setq eshell-visual-commands (nconc eshell-visual-commands '("htop"
|
||||
"tmux"))))
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; `tramp-term'
|
||||
;; --------------------------------------------------------------------------
|
||||
;; -----------------------------------------------------------------------------------------------
|
||||
;; `vterm'
|
||||
;; -----------------------------------------------------------------------------------------------
|
||||
|
||||
(use-package tramp-term
|
||||
:defer t)
|
||||
(use-package vterm
|
||||
:init
|
||||
(setq vterm-shell "/bin/zsh"
|
||||
vterm-max-scrollback 10000)
|
||||
|
||||
(defun x-vterm-setup ()
|
||||
(define-key vterm-mode-map
|
||||
[remap whole-line-or-region-yank] 'vterm-yank)
|
||||
(define-key vterm-mode-map (kbd "C-S-v") 'vterm-yank)
|
||||
|
||||
(define-key vterm-mode-map
|
||||
[remap scroll-up-command] 'vterm--self-insert)
|
||||
(define-key vterm-mode-map
|
||||
[remap scroll-down-command] 'vterm--self-insert))
|
||||
|
||||
(defun x-vterm-recycle ()
|
||||
"Kill current buffer and start a vterm in it."
|
||||
(let ((working-directory default-directory))
|
||||
(kill-buffer (current-buffer))
|
||||
(let ((default-directory working-directory))
|
||||
(vterm))))
|
||||
|
||||
(defun x-vterm-other-window ()
|
||||
"Start vterm in other window unless in initial buffer."
|
||||
(interactive)
|
||||
(if (equal major-mode 'init-buffer-mode)
|
||||
(vterm)
|
||||
(vterm-other-window)))
|
||||
|
||||
(defun visit-vterm ()
|
||||
"Open or switch to active vterm.
|
||||
If current buffer is a vterm:
|
||||
If it is running
|
||||
Open a new vterm in a new window
|
||||
If it is not running
|
||||
Recycle (kill buffer, restart vterm)
|
||||
If current buffer is not a vterm:
|
||||
If a buffer in vterm-mode exists
|
||||
Switch to that buffer in other window
|
||||
Recycle if necessary
|
||||
If it does not exist
|
||||
Open a new vterm in a new window"
|
||||
(interactive)
|
||||
(if (string= "vterm-mode" major-mode)
|
||||
(if (term-check-proc (buffer-name))
|
||||
(vterm-other-window t)
|
||||
(x-vterm-recycle))
|
||||
(let ((anon-term (seq-find (lambda (buffer)
|
||||
(with-current-buffer buffer
|
||||
(string= "vterm-mode" major-mode)))
|
||||
(buffer-list))))
|
||||
(if anon-term
|
||||
(progn
|
||||
(if (equal major-mode 'init-buffer-mode)
|
||||
(switch-to-buffer anon-term)
|
||||
(switch-to-buffer-other-window anon-term))
|
||||
(unless (term-check-proc (buffer-name))
|
||||
(x-vterm-recycle)))
|
||||
(x-vterm-other-window)))))
|
||||
|
||||
:hook
|
||||
(vterm-mode . x-vterm-setup)
|
||||
:bind
|
||||
(("C-x C-'" . vterm)
|
||||
("C-x '" . visit-vterm)))
|
||||
|
||||
)
|
||||
|
||||
|
@ -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
|
||||
@ -129,10 +127,7 @@
|
||||
("C-x g t" . magit-tag)
|
||||
:config
|
||||
(add-hook 'magit-mode-hook 'magit-load-config-extensions)
|
||||
(setq magit-bury-buffer-function 'magit-mode-quit-window)
|
||||
|
||||
;; unbind C-x g
|
||||
(unbind-key "C-x g" magit-file-mode-map))
|
||||
(setq magit-bury-buffer-function 'magit-mode-quit-window))
|
||||
|
||||
(use-package magit-todos
|
||||
:hook (magit-mode . magit-todos-mode))
|
||||
|
7
snippets/org-mode/c-src
Normal file
7
snippets/org-mode/c-src
Normal file
@ -0,0 +1,7 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: c-src
|
||||
# key: c_
|
||||
# --
|
||||
#+begin_src c
|
||||
$0
|
||||
#+end_src
|
@ -49,7 +49,7 @@
|
||||
|
||||
;; Common heading/highlight colours.
|
||||
(*head-1* (if (eq variant 'dark) "#4F97D7" "#3A81C3"))
|
||||
(*head-1-bg* (if (eq variant 'dark) "#333377" "#293239"))
|
||||
(*head-1-bg* (if (eq variant 'dark) "#333377" "#90AECE"))
|
||||
(*head-2* (if (eq variant 'dark) "#2D9574" "#2D9574"))
|
||||
(*head-3* (if (eq variant 'dark) "#67B11D" "#67B11D"))
|
||||
(*head-4* (if (eq variant 'dark) "#AF81F4" "#AF81F4"))
|
||||
@ -64,14 +64,16 @@
|
||||
(*constant* (if (eq variant 'dark) "#A45BAD" "#5F9EA0"))
|
||||
(*highlight-1* (if (eq variant 'dark) "#3E71A1" "#DA70D6"))
|
||||
(*highlight-2* (if (eq variant 'dark) "#5BA0EB" "#228B22"))
|
||||
(*info* (if (eq variant 'dark) "#89E14B" "#BC8F8F"))
|
||||
(*info* (if (eq variant 'dark) "#0D98BA" "#BC8F8F"))
|
||||
(*string* (if (eq variant 'dark) "#89E14B" "#BC8F8F"))
|
||||
(*name* (if (eq variant 'dark) "#AF81F4" "#0000FF"))
|
||||
(*tooltip* (if (eq variant 'dark) "#E1E1E0" "#000000"))
|
||||
(*tooltip-bg* (if (eq variant 'dark) "#495765" "#E2DAEF"))
|
||||
|
||||
;; Common error/success colours.
|
||||
(*success* (if (eq variant 'dark) "#86DC2F" "#42AE2C"))
|
||||
(*warning* (if (eq variant 'dark) "#C62626" "#C62626"))
|
||||
(*warning* (if (eq variant 'dark) "#FFC0CB" "#FFC0CB"))
|
||||
(*error* (if (eq variant 'dark) "#C62626" "#C62626"))
|
||||
|
||||
;; Common diff colours.
|
||||
(*diff-added-bg* (if (eq variant 'dark) "#336622" "#DDFFDD"))
|
||||
@ -121,8 +123,8 @@
|
||||
;; ---------------------------------------------------------------------
|
||||
;; Region highlighting.
|
||||
;; ---------------------------------------------------------------------
|
||||
`(region ((t (:background ,*base-region*))))
|
||||
`(vhl/default-face ((t (:background ,*base-volatile-highlight*))))
|
||||
`(region ((t (:background ,*base-region* :extend t))))
|
||||
`(vhl/default-face ((t (:background ,*base-volatile-highlight* :extend t))))
|
||||
|
||||
;; ---------------------------------------------------------------------
|
||||
;; Highlights.
|
||||
@ -131,7 +133,7 @@
|
||||
`(highlight ((t (:background ,*base-highlight*))))
|
||||
`(highlight-symbol-face ((t (:background ,*base-highlight-symbol*))))
|
||||
`(highlight-numbers-number ((t (:foreground ,*base-highlight-numbers*))))
|
||||
`(hl-line ((t (:background ,*base-highlight*))))
|
||||
`(hl-line ((t (:background ,*base-highlight* :extend t))))
|
||||
|
||||
;; ---------------------------------------------------------------------
|
||||
;; Info and buttons.
|
||||
@ -153,8 +155,9 @@
|
||||
(let ((*line-active-bg* *active-line*)
|
||||
(*line-active-fg* *normal*)
|
||||
(*line-perspective* *head-1*)
|
||||
(*line-eyebrowse* *info*)
|
||||
(*line-eyebrowse* *string*)
|
||||
|
||||
(*zoom-window-bg* (if (eq variant 'dark) "#33455b" "#90AECE"))
|
||||
(*line-header-bg* (if (eq variant 'dark) "#0A1721" "#F2F2F2"))
|
||||
(*line-inactive-bg* (if (eq variant 'dark) "#0A1721" "#C9D5E3"))
|
||||
(*line-inactive-fg* (if (eq variant 'dark) "#798A9B" "#333333")))
|
||||
@ -171,7 +174,7 @@
|
||||
;; ---------------------------------------------------------------------
|
||||
;; Doom mode line.
|
||||
;; ---------------------------------------------------------------------
|
||||
`(doom-modeline-inactive-bar ((t (:inherit mode-line-inactive))))
|
||||
`(doom-modeline-bar-inactive ((t (:inherit mode-line-inactive))))
|
||||
|
||||
;; ---------------------------------------------------------------------
|
||||
;; Perspective:eyebrowse.
|
||||
@ -179,12 +182,26 @@
|
||||
`(persp-selected-face ((t (:foreground ,*line-perspective* :weight bold))))
|
||||
`(eyebrowse-mode-line-active ((t (:foreground ,*line-eyebrowse* :weight bold))))
|
||||
|
||||
;; ---------------------------------------------------------------------
|
||||
;; Pyvenv virtualenv.
|
||||
;; ---------------------------------------------------------------------
|
||||
`(pyvenv-active-face ((t (:foreground ,*line-perspective* :weight bold))))
|
||||
|
||||
;; ---------------------------------------------------------------------
|
||||
;; Header line.
|
||||
;; ---------------------------------------------------------------------
|
||||
`(header-line ((t (:background ,*line-header-bg* :foreground ,*line-active-fg*))))
|
||||
|
||||
))
|
||||
;; ---------------------------------------------------------------------
|
||||
;; Zoom window.
|
||||
;; ---------------------------------------------------------------------
|
||||
`(zoom-window-mode-line ((t (:background ,*zoom-window-bg*))))
|
||||
|
||||
)
|
||||
|
||||
(setq zoom-window-mode-line-bg *zoom-window-bg*)
|
||||
|
||||
)
|
||||
|
||||
;; ------------------------------------------------------------------------
|
||||
;; Whitespace.
|
||||
@ -203,7 +220,7 @@
|
||||
;; ------------------------------------------------------------------------
|
||||
;; Search highlighting.
|
||||
;; ------------------------------------------------------------------------
|
||||
(let ((*search-fail-bg* *warning*)
|
||||
(let ((*search-fail-bg* *error*)
|
||||
(*search-other-bg* *highlight-1*)
|
||||
|
||||
(*search-bg* (if (eq variant 'dark) "#AF81F4" "#AF81F4"))
|
||||
@ -221,7 +238,7 @@
|
||||
;; Parentheses.
|
||||
;; ------------------------------------------------------------------------
|
||||
(let ((*paren-match* *success*)
|
||||
(*paren-mismatch* *warning*)
|
||||
(*paren-mismatch* *error*)
|
||||
|
||||
(*paren-hlp-1* (if (eq variant 'dark) "#FF6A6A" "#FF6A6A"))
|
||||
(*paren-hlp-2* (if (eq variant 'dark) "#EE6363" "#EE6363"))
|
||||
@ -299,10 +316,10 @@
|
||||
(*font-lock-negate* *warning*)
|
||||
(*font-lock-preproc* *normal-standout*)
|
||||
(*font-lock-reference* *constant*)
|
||||
(*font-lock-string* *info*)
|
||||
(*font-lock-string* *string*)
|
||||
(*font-lock-type* *highlight-2*)
|
||||
(*font-lock-variable* *normal-standout*)
|
||||
(*font-lock-warning* *warning*)
|
||||
(*font-lock-warning* *error*)
|
||||
|
||||
(*font-lock-comment* (if (eq variant 'dark) "#4E6F91" "#B22222"))
|
||||
(*font-lock-regexp* (if (eq variant 'dark) "#EF7760" "#EF7760")))
|
||||
@ -318,7 +335,7 @@
|
||||
`(font-lock-doc-string-face ((t (:foreground ,*font-lock-doc*))))
|
||||
`(font-lock-function-name-face ((t (:foreground ,*font-lock-function* :weight bold))))
|
||||
`(font-lock-keyword-face ((t (:foreground ,*font-lock-keyword* :weight bold))))
|
||||
`(font-lock-negation-char-face ((t (:foreground ,*font-lock-negate*))))
|
||||
`(font-lock-negation-char-face ((t (:foreground ,*font-lock-negate* :weight bold))))
|
||||
`(font-lock-preprocessor-face ((t (:foreground ,*font-lock-preproc*))))
|
||||
`(font-lock-reference-face ((t (:foreground ,*font-lock-reference*))))
|
||||
`(font-lock-regexp-grouping-backslash ((t (:foreground ,*font-lock-regexp*))))
|
||||
@ -326,7 +343,7 @@
|
||||
`(font-lock-string-face ((t (:foreground ,*font-lock-string*))))
|
||||
`(font-lock-type-face ((t (:foreground ,*font-lock-type* :weight bold))))
|
||||
`(font-lock-variable-name-face ((t (:foreground ,*font-lock-variable*))))
|
||||
`(font-lock-warning-face ((t (:foreground ,*font-lock-warning*))))
|
||||
`(font-lock-warning-face ((t (:foreground ,*font-lock-warning* :weight bold))))
|
||||
|
||||
))
|
||||
|
||||
@ -401,12 +418,12 @@
|
||||
(*org-2* *head-2*)
|
||||
(*org-3* *head-3*)
|
||||
(*org-4* *head-4*)
|
||||
(*org-special* *normal-standout*)
|
||||
(*org-link* *normal-standout*)
|
||||
(*org-checkbox-bg* *bg-1*)
|
||||
(*org-checkbox-fg* *normal-standout*)
|
||||
(*org-clock-bg* *info*)
|
||||
(*org-clock-fg* *bg-1*)
|
||||
(*org-link* *normal-standout*)
|
||||
(*org-special* *normal-standout*)
|
||||
|
||||
(*org-date* (if (eq variant 'dark) "#FFCCFF" "#FFCCFF")))
|
||||
|
||||
@ -431,6 +448,40 @@
|
||||
|
||||
))
|
||||
|
||||
;; ------------------------------------------------------------------------
|
||||
;; Messages.
|
||||
;; ------------------------------------------------------------------------
|
||||
|
||||
(let ((*header-name* *head-2*)
|
||||
(*header-subject* *name*)
|
||||
(*header-other* *head-1*))
|
||||
|
||||
(custom-theme-set-faces
|
||||
theme-name
|
||||
|
||||
`(message-header-name ((t (:foreground ,*header-name* :weight bold))))
|
||||
`(message-header-subject ((t (:foreground ,*header-subject* :weight bold :height 1.25))))
|
||||
`(message-header-other ((t (:foreground ,*header-other* :weight bold))))
|
||||
|
||||
))
|
||||
|
||||
;; ------------------------------------------------------------------------
|
||||
;; Elfeed.
|
||||
;; ------------------------------------------------------------------------
|
||||
|
||||
(let ((*search-date* *normal-standout*)
|
||||
(*search-feed* *name*)
|
||||
(*search-tag* *normal-standout*))
|
||||
|
||||
(custom-theme-set-faces
|
||||
theme-name
|
||||
|
||||
`(elfeed-search-date-face ((t (:foreground ,*search-date*))))
|
||||
`(elfeed-search-feed-face ((t (:foreground ,*search-feed*))))
|
||||
`(elfeed-search-tag-face ((t (:foreground ,*search-tag* :weight bold))))
|
||||
|
||||
))
|
||||
|
||||
;; ------------------------------------------------------------------------
|
||||
;; Diff.
|
||||
;; ------------------------------------------------------------------------
|
||||
@ -453,9 +504,9 @@
|
||||
(custom-theme-set-faces
|
||||
theme-name
|
||||
|
||||
`(diff-header ((t (:background ,*diff-header*))))
|
||||
`(diff-header ((t (:background ,*diff-header* :extend t))))
|
||||
`(diff-file-header ((t (:foreground ,*diff-file-header-fg*))))
|
||||
`(diff-hunk-header ((t (:background ,*diff-hunk-bg* :foreground ,*diff-hunk-fg*))))
|
||||
`(diff-hunk-header ((t (:background ,*diff-hunk-bg* :foreground ,*diff-hunk-fg* :extend t))))
|
||||
|
||||
`(diff-added ((t (:foreground ,*diff-added*))))
|
||||
`(diff-changed ((t (:foreground ,*diff-changed*))))
|
||||
@ -465,13 +516,13 @@
|
||||
`(diff-indicator-changed ((t (:foreground ,*diff-changed*))))
|
||||
`(diff-indicator-removed ((t (:foreground ,*diff-removed*))))
|
||||
|
||||
`(diff-refine-added ((t (:background ,*diff-added* :foreground ,*diff-refine-fg*))))
|
||||
`(diff-refine-changed ((t (:background ,*diff-changed* :foreground ,*diff-refine-fg*))))
|
||||
`(diff-refine-removed ((t (:background ,*diff-removed* :foreground ,*diff-refine-fg*))))
|
||||
`(diff-refine-added ((t (:background ,*diff-added* :foreground ,*diff-refine-fg* :extend t))))
|
||||
`(diff-refine-changed ((t (:background ,*diff-changed* :foreground ,*diff-refine-fg* :extend t))))
|
||||
`(diff-refine-removed ((t (:background ,*diff-removed* :foreground ,*diff-refine-fg* :extend t))))
|
||||
|
||||
`(diff-hl-insert ((t (:background ,*diff-hl-added-bg* :foreground ,*diff-hl-added-fg*))))
|
||||
`(diff-hl-change ((t (:background ,*diff-hl-changed-bg* :foreground ,*diff-hl-changed-fg*))))
|
||||
`(diff-hl-delete ((t (:background ,*diff-hl-removed-bg* :foreground ,*diff-hl-removed-fg*))))
|
||||
`(diff-hl-insert ((t (:background ,*diff-hl-added-bg* :foreground ,*diff-hl-added-fg* :extend t))))
|
||||
`(diff-hl-change ((t (:background ,*diff-hl-changed-bg* :foreground ,*diff-hl-changed-fg* :extend t))))
|
||||
`(diff-hl-delete ((t (:background ,*diff-hl-removed-bg* :foreground ,*diff-hl-removed-fg* :extend t))))
|
||||
|
||||
))
|
||||
|
||||
@ -492,25 +543,25 @@
|
||||
(custom-theme-set-faces
|
||||
theme-name
|
||||
|
||||
`(ediff-current-diff-Ancestor ((t (:background ,*ediff-ancestor-bg* :foreground ,*ediff-ancestor-fg*))))
|
||||
`(ediff-current-diff-A ((t (:background ,*ediff-current-A-bg* :foreground ,*ediff-current-A-fg*))))
|
||||
`(ediff-current-diff-B ((t (:background ,*ediff-current-B-bg* :foreground ,*ediff-current-B-fg*))))
|
||||
`(ediff-current-diff-C ((t (:background ,*ediff-current-C-bg* :foreground ,*ediff-current-C-fg*))))
|
||||
`(ediff-current-diff-Ancestor ((t (:background ,*ediff-ancestor-bg* :foreground ,*ediff-ancestor-fg* :extend t))))
|
||||
`(ediff-current-diff-A ((t (:background ,*ediff-current-A-bg* :foreground ,*ediff-current-A-fg* :extend t))))
|
||||
`(ediff-current-diff-B ((t (:background ,*ediff-current-B-bg* :foreground ,*ediff-current-B-fg* :extend t))))
|
||||
`(ediff-current-diff-C ((t (:background ,*ediff-current-C-bg* :foreground ,*ediff-current-C-fg* :extend t))))
|
||||
|
||||
`(ediff-even-diff-Ancestor ((t (:background ,*ediff-bg*))))
|
||||
`(ediff-even-diff-A ((t (:background ,*ediff-bg*))))
|
||||
`(ediff-even-diff-B ((t (:background ,*ediff-bg*))))
|
||||
`(ediff-even-diff-C ((t (:background ,*ediff-bg*))))
|
||||
`(ediff-even-diff-Ancestor ((t (:background ,*ediff-bg* :extend t))))
|
||||
`(ediff-even-diff-A ((t (:background ,*ediff-bg* :extend t))))
|
||||
`(ediff-even-diff-B ((t (:background ,*ediff-bg* :extend t))))
|
||||
`(ediff-even-diff-C ((t (:background ,*ediff-bg* :extend t))))
|
||||
|
||||
`(ediff-fine-diff-Ancestor ((t (:background nil :weight bold))))
|
||||
`(ediff-fine-diff-A ((t (:background nil :weight bold))))
|
||||
`(ediff-fine-diff-B ((t (:background nil :weight bold))))
|
||||
`(ediff-fine-diff-C ((t (:background nil :weight bold))))
|
||||
`(ediff-fine-diff-Ancestor ((t (:background nil :weight bold :extend t))))
|
||||
`(ediff-fine-diff-A ((t (:background nil :weight bold :extend t))))
|
||||
`(ediff-fine-diff-B ((t (:background nil :weight bold :extend t))))
|
||||
`(ediff-fine-diff-C ((t (:background nil :weight bold :extend t))))
|
||||
|
||||
`(ediff-odd-diff-Ancestor ((t (:background ,*ediff-bg*))))
|
||||
`(ediff-odd-diff-A ((t (:background ,*ediff-bg*))))
|
||||
`(ediff-odd-diff-B ((t (:background ,*ediff-bg*))))
|
||||
`(ediff-odd-diff-C ((t (:background ,*ediff-bg*))))
|
||||
`(ediff-odd-diff-Ancestor ((t (:background ,*ediff-bg* :extend t))))
|
||||
`(ediff-odd-diff-A ((t (:background ,*ediff-bg* :extend t))))
|
||||
`(ediff-odd-diff-B ((t (:background ,*ediff-bg* :extend t))))
|
||||
`(ediff-odd-diff-C ((t (:background ,*ediff-bg* :extend t))))
|
||||
|
||||
))
|
||||
|
||||
@ -518,7 +569,7 @@
|
||||
;; Magit.
|
||||
;; ------------------------------------------------------------------------
|
||||
(let ((*magit-blame-bg* *active-line*)
|
||||
(*magit-blame-info* *info*)
|
||||
(*magit-blame-info* *string*)
|
||||
(*magit-blame-hash* *name*)
|
||||
(*magit-branch-local* *head-1*)
|
||||
(*magit-branch-remote* *head-2*)
|
||||
@ -559,7 +610,7 @@
|
||||
;; ---------------------------------------------------------------------
|
||||
`(magit-blame-date ((t :background ,*magit-blame-bg* :foreground ,*magit-blame-info*)))
|
||||
`(magit-blame-hash ((t :background ,*magit-blame-bg* :foreground ,*magit-blame-hash*)))
|
||||
`(magit-blame-heading ((t :background ,*magit-blame-bg* :foreground ,*magit-blame-info*)))
|
||||
`(magit-blame-heading ((t :background ,*magit-blame-bg* :foreground ,*magit-blame-info* :extend t)))
|
||||
`(magit-blame-name ((t :background ,*magit-blame-bg* :foreground ,*magit-blame-fg*)))
|
||||
`(magit-blame-summary ((t :background ,*magit-blame-bg* :foreground ,*magit-blame-fg*)))
|
||||
|
||||
@ -573,15 +624,15 @@
|
||||
;; ---------------------------------------------------------------------
|
||||
;; Magit diff.
|
||||
;; ---------------------------------------------------------------------
|
||||
`(magit-diff-context-highlight ((t (:background ,*magit-highlight-bg* :foreground ,*magit-highlight-fg*))))
|
||||
`(magit-diff-context-highlight ((t (:background ,*magit-highlight-bg* :foreground ,*magit-highlight-fg* :extend t))))
|
||||
`(magit-diff-file-heading ((t (:foreground ,*magit-heading*))))
|
||||
`(magit-diff-file-heading-highlight ((t (:foreground ,*magit-heading*))))
|
||||
`(magit-diff-hunk-heading ((t (:background ,*magit-hunk-heading-bg* :foreground ,*magit-hunk-heading-fg*))))
|
||||
`(magit-diff-hunk-heading-highlight ((t (:background ,*magit-hunk-heading-bg* :foreground ,*magit-hunk-heading-fg*))))
|
||||
`(magit-diff-added ((t (:background ,*magit-diff-added-bg* :foreground ,*magit-diff-added-fg*))))
|
||||
`(magit-diff-added-highlight ((t (:background ,*magit-diff-added-hl-bg* :foreground ,*magit-diff-added-hl-fg*))))
|
||||
`(magit-diff-removed ((t (:background ,*magit-diff-removed-bg* :foreground ,*magit-diff-removed-fg*))))
|
||||
`(magit-diff-removed-highlight ((t (:background ,*magit-diff-removed-hl-bg* :foreground ,*magit-diff-removed-hl-fg*))))
|
||||
`(magit-diff-hunk-heading ((t (:background ,*magit-hunk-heading-bg* :foreground ,*magit-hunk-heading-fg* :extend t))))
|
||||
`(magit-diff-hunk-heading-highlight ((t (:background ,*magit-hunk-heading-bg* :foreground ,*magit-hunk-heading-fg* :extend t))))
|
||||
`(magit-diff-added ((t (:background ,*magit-diff-added-bg* :foreground ,*magit-diff-added-fg* :extend t))))
|
||||
`(magit-diff-added-highlight ((t (:background ,*magit-diff-added-hl-bg* :foreground ,*magit-diff-added-hl-fg* :extend t))))
|
||||
`(magit-diff-removed ((t (:background ,*magit-diff-removed-bg* :foreground ,*magit-diff-removed-fg* :extend t))))
|
||||
`(magit-diff-removed-highlight ((t (:background ,*magit-diff-removed-hl-bg* :foreground ,*magit-diff-removed-hl-fg* :extend t))))
|
||||
|
||||
;; ---------------------------------------------------------------------
|
||||
;; Magit diffstat.
|
||||
@ -616,7 +667,7 @@
|
||||
`(magit-process-ok ((t (:foreground ,*magit-ok* :weight bold))))
|
||||
|
||||
`(magit-section-heading ((t (:foreground ,*magit-heading* :weight bold))))
|
||||
`(magit-section-highlight ((t (:background ,*magit-highlight-bg*))))
|
||||
`(magit-section-highlight ((t (:background ,*magit-highlight-bg* :extend t))))
|
||||
|
||||
))
|
||||
|
||||
@ -664,7 +715,8 @@
|
||||
(*helm-header-fg* *normal*)
|
||||
|
||||
(*helm-directory* *normal-standout*)
|
||||
(*helm-exec* *info*)
|
||||
(*helm-exec* *string*)
|
||||
(*helm-file-ext* *success*)
|
||||
(*helm-line-number* *highlight-2*)
|
||||
(*helm-prefix* *normal-standout*)
|
||||
(*helm-process* *normal-standout*)
|
||||
@ -710,6 +762,7 @@
|
||||
`(helm-ff-dotted-symlink-directory ((t (:background ,*helm-bg* :foreground ,*helm-symlink* :weight bold))))
|
||||
`(helm-ff-executable ((t (:background ,*helm-bg* :foreground ,*helm-exec* :weight normal))))
|
||||
`(helm-ff-file ((t (:background ,*helm-bg* :foreground ,*helm-fg* :weight normal))))
|
||||
`(helm-ff-file-extension ((t (:background ,*helm-bg* :foreground ,*helm-file-ext* :weight normal))))
|
||||
`(helm-ff-invalid-symlink ((t (:background ,*helm-bg* :foreground ,*helm-warning* :weight bold))))
|
||||
`(helm-ff-prefix ((t (:background ,*helm-prefix* :foreground ,*helm-bg* :weight normal))))
|
||||
`(helm-ff-symlink ((t (:background ,*helm-bg* :foreground ,*helm-symlink* :weight bold))))
|
||||
@ -743,12 +796,12 @@
|
||||
|
||||
`(helm-moccur-buffer ((t (:background ,*helm-bg* :foreground ,*helm-fg-bright*))))
|
||||
|
||||
`(helm-selection ((t (:background ,*helm-select*))))
|
||||
`(helm-selection-line ((t (:background ,*helm-select-line*))))
|
||||
`(helm-selection ((t (:background ,*helm-select* :extend t))))
|
||||
`(helm-selection-line ((t (:background ,*helm-select-line* :extend t))))
|
||||
|
||||
`(helm-separator ((t (:background ,*helm-bg* :foreground ,*helm-fg-dark*))))
|
||||
|
||||
`(helm-source-header ((t (:background ,*helm-header-bg* :foreground ,*helm-header-fg* :weight bold))))
|
||||
`(helm-source-header ((t (:background ,*helm-header-bg* :foreground ,*helm-header-fg* :weight bold :extend t))))
|
||||
|
||||
`(helm-time-zone-current ((t (:background ,*helm-bg* :foreground ,*helm-fg-bright*))))
|
||||
`(helm-time-zone-home ((t (:background ,*helm-bg* :foreground ,*helm-fg-dark*))))
|
||||
|
Reference in New Issue
Block a user