Refactor: remove unused packages, replace some with new features
This commit is contained in:
parent
0b701f0567
commit
68b9bec8d5
30
.gitignore
vendored
30
.gitignore
vendored
@ -1,20 +1,20 @@
|
||||
# Directories
|
||||
auto-save-list
|
||||
bookmarks
|
||||
.backups
|
||||
.cache
|
||||
elpa
|
||||
eshell
|
||||
semanticdb
|
||||
transient
|
||||
|
||||
# Files
|
||||
custom.el
|
||||
recentf
|
||||
ede-projects.el
|
||||
flycheck_*.elc
|
||||
.lsp-session-v1
|
||||
places
|
||||
projectile-bookmarks.eld
|
||||
projectile.cache
|
||||
semanticdb
|
||||
ede-projects.el
|
||||
tramp
|
||||
transient
|
||||
url
|
||||
session*
|
||||
eww-bookmarks
|
||||
eshell
|
||||
\.cache
|
||||
\.lsp-session*
|
||||
\#*
|
||||
*~
|
||||
recentf
|
||||
|
||||
# Globs
|
||||
*\~
|
6
.gitmodules
vendored
6
.gitmodules
vendored
@ -1,6 +0,0 @@
|
||||
[submodule "doom-modeline"]
|
||||
path = doom-modeline
|
||||
url = https://github.com/seagle0128/doom-modeline.git
|
||||
[submodule "ide-mode"]
|
||||
path = ide-mode
|
||||
url = git@gitlab.wojciechkozlowski.eu:wojtek/ide-mode.git
|
88
README.org
Normal file
88
README.org
Normal file
@ -0,0 +1,88 @@
|
||||
#+TITLE: .emacs.d
|
||||
#+AUTHOR: Wojciech Kozlowski
|
||||
#+EMAIL: wk@wojciechkozlowski.eu
|
||||
|
||||
* 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
|
||||
rely on the newer Emacs versions. Currently, this configuration uses a few
|
||||
features from Emacs 26 and 27.
|
||||
|
||||
* Installation
|
||||
|
||||
Clone this repository into your home directory:
|
||||
|
||||
#+BEGIN_SRC
|
||||
$ git clone https://github.com/Wojtek242/.emacs.d ~/.emacs.d
|
||||
#+END_SRC
|
||||
|
||||
This configuration uses the [[https://github.com/adobe-fonts/source-code-pro][Source Code Pro]] font. If you do not have it
|
||||
installed and it isn't available through your distribution you can install
|
||||
the font by running
|
||||
|
||||
#+BEGIN_SRC
|
||||
$ git clone https://github.com/adobe-fonts/source-code-pro.git --branch release ~/.local/source-code-pro
|
||||
$ sudo cp ~/.local/source-code-pro/OTF/*.otf /usr/local/share/fonts
|
||||
#+END_SRC
|
||||
|
||||
* External Support for Programming Languages
|
||||
|
||||
This configuration relies uses ~lsp-mode~ for language-specific features.
|
||||
However, in order to use the LSP features, you need to have the appropriate
|
||||
language servers installed.
|
||||
|
||||
** 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=.
|
||||
|
||||
** 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
|
||||
|
||||
** Rust
|
||||
|
||||
Install RLS using ~rustup~
|
||||
|
||||
#+BEGIN_SRC
|
||||
$ rustup component add rls rust-analysis rust-src
|
||||
#+END_SRC
|
||||
|
||||
* 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]].
|
||||
|
||||
A detailed justification for using =emodule= over its alternatives can be
|
||||
found in the [[DEVLOG.org#EModule][Dev Log]].
|
||||
|
||||
* Theme
|
||||
|
||||
The theme in use started with the =underwater= theme and has been heavily
|
||||
modified, with inspiration from the [[http://spacemacs.org/][Spacemacs]] theme, to add support for all
|
||||
new faces introduced by the installed packages.
|
||||
|
||||
The theme files are located in the [[themes][themes]] directory.
|
||||
|
||||
* Dev Log
|
||||
|
||||
The development history of this configuration is chronicled in the [[DEVLOG.org][Dev Log]].
|
121
README.rst
121
README.rst
@ -1,121 +0,0 @@
|
||||
.emacs.d
|
||||
========
|
||||
|
||||
My personal Emacs configuration.
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
Just clone this repository into your home directory:
|
||||
|
||||
::
|
||||
|
||||
git clone https://github.com/Wojtek242/.emacs.d ~/.emacs.d
|
||||
|
||||
This configuration uses the `Source Code Pro`_ font. If you do not have it
|
||||
installed and it isn't available through your distribution you can install
|
||||
the font by running
|
||||
|
||||
::
|
||||
|
||||
git clone https://github.com/adobe-fonts/source-code-pro.git --branch release ~/.local/source-code-pro
|
||||
sudo cp ~/.local/source-code-pro/OTF/*.otf /usr/local/share/fonts
|
||||
|
||||
After cloning the repository and waiting for all packages to install on the
|
||||
first startup you will also have to run the following command from within Emacs
|
||||
in order to get all the icons used by the modeline
|
||||
|
||||
::
|
||||
|
||||
M-x all-the-icons-install-fonts
|
||||
|
||||
External Support for Programming Languages
|
||||
------------------------------------------
|
||||
|
||||
- Rust:
|
||||
|
||||
Install RLS using ``rustup``
|
||||
|
||||
::
|
||||
rustup component add rls rust-analysis rust-src
|
||||
|
||||
- Python:
|
||||
|
||||
The python configurations assumes ``python3`` and ``ipython3`` is installed
|
||||
|
||||
Furthermore, install ``jedi``, ``autopep8``, ``flake8`` using ``pip3``
|
||||
|
||||
Install the language server:
|
||||
|
||||
::
|
||||
pip3 install 'python-language-server[all]'
|
||||
|
||||
- C/C++:
|
||||
|
||||
Uses ``ccls`` as the language server
|
||||
|
||||
::
|
||||
apt install clang libclang-dev
|
||||
git clone --depth=1 --recursive https://github.com/MaskRay/ccls
|
||||
cd ccls
|
||||
cmake -H. -BRelease
|
||||
cmake --build Release
|
||||
|
||||
And make sure ``Release/ccls`` is in the ``$PATH``
|
||||
|
||||
Package Management
|
||||
------------------
|
||||
|
||||
This ``.emacs.d`` uses its own small framework for package management located
|
||||
in the ``emodule`` directory. Its operation is heavily inspired by Spacemacs_,
|
||||
but is much smaller with fewer features and thus simpler.
|
||||
|
||||
The purpose of using such a package manager is to ensure that all packages are
|
||||
always installed before any configuration happens. Furthermore, it will also
|
||||
remove all unused packages and manage upgrades and backups.
|
||||
|
||||
Package configuration happens in the ``modules`` directory. A file called
|
||||
``MODULE.el`` corresponds to an individual ``MODULE``. Inside each module
|
||||
file, all the pre-requisite packages must be defined in a variable called
|
||||
``emodule/MODULE-packages`` and all package configuration must be done in a
|
||||
single function called ``emodule/MODULE-init``. Each module must also be added
|
||||
to the ``emodule/init`` call in the ``init.el`` file.
|
||||
|
||||
The ``emodule`` package manager runs during every startup. It will first ensure
|
||||
all packages are installed before it runs any ``init`` functions so it is safe
|
||||
to write configuration for packages that depends on other packages without any
|
||||
concerns about ordering. This applies even if the configuration is spread
|
||||
across multiple modules.
|
||||
|
||||
When Emacs is first launched with this configuration it will download all
|
||||
the ``Elpa`` and ``Melpa`` packages that it needs so the first startup takes
|
||||
much longer to complete.
|
||||
|
||||
Upgrades are supported and can be initiated either from the home screen or by
|
||||
calling ``emodule/upgrade``. I don't like tracking ``elpa`` with git as it
|
||||
introduces a lot of code churn and makes analysing diffs, especially between
|
||||
distant commits, very difficult. Instead, on each upgrade the ``elpa``
|
||||
directory will be backed up to ``elpa.tar.xz``. You can restore the last
|
||||
backup by calling ``emodule/restore``. This repository should always contain a
|
||||
functional backup of ``elpa``.
|
||||
|
||||
Theme
|
||||
-----
|
||||
|
||||
The theme in use started with the ``underwater`` theme and has been heavily
|
||||
modified, with inspiration from the Spacemacs_ theme, to add support for all
|
||||
new faces introduced by the installed packages. The code setting up the theme
|
||||
is quite messy. It is my plan to simplify it one day.
|
||||
|
||||
The theme files are located in ``themes``.
|
||||
|
||||
Stability
|
||||
---------
|
||||
|
||||
I have been using this configuration at work and at home for many months now
|
||||
which helped flush many bugs. It has been pretty reliable, but suffers from
|
||||
the occasional glitches which I think are more due to the limitations of
|
||||
Emacs and the packages used than errors in my configuration.
|
||||
|
||||
.. _Spacemacs: http://spacemacs.org/
|
||||
.. _`Source Code Pro`: https://github.com/adobe-fonts/source-code-pro
|
@ -1 +0,0 @@
|
||||
Subproject commit 0feb1c1499953222a2de768b7c8bf73517c4e828
|
@ -1,658 +0,0 @@
|
||||
;;; help+.el --- Extensions to `help.el'.
|
||||
;;
|
||||
;; Filename: help+.el
|
||||
;; Description: Extensions to `help.el'.
|
||||
;; Author: Drew Adams
|
||||
;; Maintainer: Drew Adams (concat "drew.adams" "@" "oracle" ".com")
|
||||
;; Copyright (C) 1999-2018, Drew Adams, all rights reserved.
|
||||
;; Created: Tue Mar 16 14:18:11 1999
|
||||
;; Version: 0
|
||||
;; Package-Requires: ()
|
||||
;; Last-Updated: Mon Jan 1 13:10:54 2018 (-0800)
|
||||
;; By: dradams
|
||||
;; Update #: 2201
|
||||
;; URL: https://www.emacswiki.org/emacs/download/help%2b.el
|
||||
;; Doc URL: https://emacswiki.org/emacs/HelpPlus
|
||||
;; Keywords: help
|
||||
;; Compatibility: GNU Emacs: 22.x, 23.x, 24.x, 25.x, 26.x
|
||||
;;
|
||||
;; Features that might be required by this library:
|
||||
;;
|
||||
;; `avoid', `backquote', `fit-frame', `frame-fns', `help-macro',
|
||||
;; `help-macro+', `info', `info+20', `misc-fns', `naked',
|
||||
;; `strings', `thingatpt', `thingatpt+'.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; Extensions to `help.el' for Emacs 22 and later. For similar
|
||||
;; extensions to `help.el' for Emacs 20, see `help+20.el'.
|
||||
;;
|
||||
;; Note: As of Emacs 24.4, byte-compiling this file in one Emacs
|
||||
;; version and using the compiled file in another Emacs version
|
||||
;; does not work.
|
||||
;;
|
||||
;;
|
||||
;; Commands defined here:
|
||||
;;
|
||||
;; `help-on-click/key', `mouse-help-on-click',
|
||||
;; `mouse-help-on-mode-line-click', `pop-to-help-toggle'.
|
||||
;;
|
||||
;; Non-interactive functions defined here:
|
||||
;;
|
||||
;; `help-on-click/key-lookup'.
|
||||
;;
|
||||
;; Internal variables defined here:
|
||||
;;
|
||||
;; `help-origin-buffer'.
|
||||
;;
|
||||
;;
|
||||
;; ***** NOTE: The following functions defined in `help.el' have
|
||||
;; been REDEFINED HERE:
|
||||
;;
|
||||
;; `describe-key' (Emacs 22-25), `where-is'.
|
||||
;;
|
||||
;;
|
||||
;; ***** NOTE: The doc string for `help-for-help' has been
|
||||
;; REDEFINED HERE (see `make-help-screen help-for-help')
|
||||
;;
|
||||
;; The following bindings are made here:
|
||||
;;
|
||||
;; `C-h u' `manual-entry'
|
||||
;; `C-h C-a' `apropos'
|
||||
;; `C-h C-l' `locate-library'
|
||||
;; `C-h RET' `help-on-click/key'
|
||||
;; `C-h M-a' `apropos-documentation'
|
||||
;; `C-h M-o' `pop-to-help-toggle'
|
||||
;; `C-h C-M-a' `tags-apropos'
|
||||
;; [mouse-1] `mouse-help-on-click' (non-mode-line)
|
||||
;; [mouse-1] `mouse-help-on-mode-line-click' (mode-line)
|
||||
;;
|
||||
;; Suggested additional binding:
|
||||
;;
|
||||
;; (global-set-key [f1] 'help-on-click/key)
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Change Log:
|
||||
;;
|
||||
;; 2017/10/21 dadams
|
||||
;; describe-key: Do not redefine for Emacs 26+ (not worth it).
|
||||
;; help-on-click/key-lookup: Use help--analyze-key, if defined, instead of describe-key.
|
||||
;; 2015/07/02 dadams
|
||||
;; help-on-click/key: Removed part of doc string that said that C-g is not in manual index.
|
||||
;; 2014/05/04 dadams
|
||||
;; Emacs 20-22: soft-require info+20.el (new) instead of info+.el.
|
||||
;; 2014/04/22 dadams
|
||||
;; Updated for Emacs 24.4: with-help-window, not with-output-to-temp-buffer - bug #17109.
|
||||
;; help-on-click/key: save-excursion.set-buffer -> with-current-buffer.
|
||||
;; 2012/08/21 dadams
|
||||
;; Call tap-put-thing-at-point-props after load thingatpt+.el.
|
||||
;; 2012/08/18 dadams
|
||||
;; Invoke tap-define-aliases-wo-prefix if thingatpt+.el is loaded.
|
||||
;; help-on-click/key: Use tap-symbol-at-point, not symbol-at-point, if defined.
|
||||
;; 2012/04/01 dadams
|
||||
;; where-is: Wrap individual key sequences in `', not just all of them together.
|
||||
;; 2011/10/07 dadams
|
||||
;; Added soft require of naked.el.
|
||||
;; where-is, help-on-click/key-lookup: Use naked-key-description if available.
|
||||
;; 2011/01/04 dadams
|
||||
;; Removed autoload cookies from non-interactive function and define-key.
|
||||
;; 2008-01-03 dadams
|
||||
;; describe-key: Replaced newline with ", " before "which is".
|
||||
;; 2007/12/20 dadams
|
||||
;; pop-to-help-toggle = C-h M-o, so C-h C-o can be describe-option.
|
||||
;; 2007/12/13 dadams
|
||||
;; Created.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; 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 2, 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; see the file COPYING. If not, write to
|
||||
;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth
|
||||
;; Floor, Boston, MA 02110-1301, USA.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
(require 'info nil t) ;; (no error if not found):
|
||||
;; Info-exit, Info-goto-node, Info-goto-emacs-key-command-node
|
||||
(if (> emacs-major-version 22);; (no error if not found):
|
||||
;; Info-goto-emacs-key-command-node (returns found-p)
|
||||
(require 'info+ nil t)
|
||||
(require 'info+20 nil t))
|
||||
(require 'thingatpt nil t) ;; (no error if not found): symbol-at-point
|
||||
|
||||
(when (and (require 'thingatpt+ nil t) ;; (no error if not found)
|
||||
(fboundp 'tap-put-thing-at-point-props)) ; >= 2012-08-21
|
||||
(tap-define-aliases-wo-prefix)
|
||||
(tap-put-thing-at-point-props))
|
||||
;; symbol-nearest-point, tap-symbol-at-point
|
||||
|
||||
(require 'frame-fns nil t) ;; (no error if not found): 1-window-frames-on
|
||||
(require 'naked nil t) ;; (no error if not found): naked-key-description
|
||||
|
||||
;; Get macro `make-help-screen' when this is compiled,
|
||||
;; or run interpreted, but not when the compiled code is loaded.
|
||||
(eval-when-compile
|
||||
(require 'help-macro nil t) ;; (no error if not found) make-help-screen
|
||||
(require 'help-macro+ nil t)) ;; (no error if not found): make-help-screen
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(defvar help-origin-buffer nil "Buffer that we left, to go to *Help*.")
|
||||
|
||||
(define-key help-map [?\C-m] 'help-on-click/key) ; RET
|
||||
(define-key help-map "u" 'manual-entry) ; in `man.el'
|
||||
(define-key help-map "\C-a" 'apropos)
|
||||
(define-key help-map "\M-o" 'pop-to-help-toggle)
|
||||
(define-key help-map "\C-l" 'locate-library)
|
||||
(define-key help-map "\M-a" 'apropos-documentation)
|
||||
(define-key help-map "\C-\M-a" 'tags-apropos)
|
||||
(define-key help-map [down-mouse-1] 'mouse-help-on-click)
|
||||
(define-key help-map [mode-line down-mouse-1] 'mouse-help-on-mode-line-click)
|
||||
|
||||
|
||||
;; REPLACES ORIGINAL in `help.el':
|
||||
;;
|
||||
;; Return nil if KEY is undefined; else return t.
|
||||
;;
|
||||
(unless (fboundp 'help--analyze-key) ; Emacs 26+
|
||||
(defun describe-key (&optional key untranslated up-event)
|
||||
"Describe the command that a keyboard/menu/mouse sequence invokes.
|
||||
KEY can be any kind of a key sequence; it can include keyboard events,
|
||||
mouse events, and/or menu events. When calling from a program,
|
||||
pass KEY as a string or a vector.
|
||||
|
||||
If non-nil, UNTRANSLATED is a vector of the corresponding untranslated events.
|
||||
It can also be a number, in which case the untranslated events from
|
||||
the last key sequence entered are used.
|
||||
UP-EVENT is the up-event that was discarded by reading KEY, or nil.
|
||||
|
||||
If KEY is a menu item or a tool-bar button that is disabled, this command
|
||||
temporarily enables it to allow getting help on disabled items and buttons.
|
||||
Return nil if KEY is undefined; else return t."
|
||||
(interactive
|
||||
(let ((enable-disabled-menus-and-buttons t)
|
||||
(cursor-in-echo-area t)
|
||||
saved-yank-menu)
|
||||
(unwind-protect
|
||||
(let (key)
|
||||
;; If yank-menu is empty, populate it temporarily, so that
|
||||
;; "Select and Paste" menu can generate a complete event.
|
||||
(when (null (cdr yank-menu))
|
||||
(setq saved-yank-menu (copy-sequence yank-menu))
|
||||
(menu-bar-update-yank-menu "(any string)" nil))
|
||||
(setq key (read-key-sequence "Describe key (or click or menu item): "))
|
||||
(list key
|
||||
(prefix-numeric-value current-prefix-arg)
|
||||
;; If KEY is a down-event, read and include the
|
||||
;; corresponding up-event. Note that there are also
|
||||
;; down-events on scroll bars and mode lines: the actual
|
||||
;; event then is in the second element of the vector.
|
||||
(and (vectorp key)
|
||||
(let ((last-idx (1- (length key))))
|
||||
(and (eventp (aref key last-idx))
|
||||
(memq 'down (event-modifiers (aref key last-idx)))))
|
||||
(or (and (eventp (aref key 0))
|
||||
(memq 'down (event-modifiers (aref key 0)))
|
||||
;; However, for the C-down-mouse-2 popup
|
||||
;; menu, there is no subsequent up-event. In
|
||||
;; this case, the up-event is the next
|
||||
;; element in the supplied vector.
|
||||
(= (length key) 1))
|
||||
(and (> (length key) 1)
|
||||
(eventp (aref key 1))
|
||||
(memq 'down (event-modifiers (aref key 1)))))
|
||||
(read-event))))
|
||||
;; Put yank-menu back as it was, if we changed it.
|
||||
(when saved-yank-menu
|
||||
(setq yank-menu (copy-sequence saved-yank-menu))
|
||||
(fset 'yank-menu (cons 'keymap yank-menu))))))
|
||||
(when (numberp untranslated) (setq untranslated (this-single-command-raw-keys)))
|
||||
(let* ((event (aref key (if (and (symbolp (aref key 0))
|
||||
(> (length key) 1)
|
||||
(consp (aref key 1)))
|
||||
1
|
||||
0)))
|
||||
(modifiers (event-modifiers event))
|
||||
(mouse-msg (if (or (memq 'click modifiers)
|
||||
(memq 'down modifiers)
|
||||
(memq 'drag modifiers))
|
||||
" at that spot"
|
||||
""))
|
||||
(defn (key-binding key t))
|
||||
defn-up defn-up-tricky ev-type mouse-1-remapped mouse-1-tricky)
|
||||
|
||||
;; Handle the case where we faked an entry in "Select and Paste" menu.
|
||||
(when (and (eq defn nil)
|
||||
(stringp (aref key (1- (length key))))
|
||||
(eq (key-binding (substring key 0 -1)) 'yank-menu))
|
||||
(setq defn 'menu-bar-select-yank))
|
||||
(cond ((or (null defn) (integerp defn) (equal defn 'undefined))
|
||||
(message "%s%s is undefined" (help-key-description key untranslated) mouse-msg)
|
||||
nil) ; Return nil: undefined.
|
||||
(t
|
||||
(help-setup-xref (list #'describe-function defn) (interactive-p))
|
||||
;; Don't bother user with strings from (e.g.) the select-paste menu.
|
||||
(when (stringp (aref key (1- (length key))))
|
||||
(aset key (1- (length key)) "(any string)"))
|
||||
(when (and untranslated (stringp (aref untranslated (1- (length untranslated)))))
|
||||
(aset untranslated (1- (length untranslated))
|
||||
"(any string)"))
|
||||
;; Need to do this before erasing *Help* buffer in case event
|
||||
;; is a mouse click in an existing *Help* buffer.
|
||||
(when up-event
|
||||
(setq ev-type (event-basic-type up-event))
|
||||
(let ((sequence (vector up-event)))
|
||||
(when (and (eq ev-type 'mouse-1)
|
||||
mouse-1-click-follows-link
|
||||
(not (eq mouse-1-click-follows-link 'double))
|
||||
(setq mouse-1-remapped (mouse-on-link-p (event-start up-event))))
|
||||
(setq mouse-1-tricky (and (integerp mouse-1-click-follows-link)
|
||||
(> mouse-1-click-follows-link 0)))
|
||||
(cond ((stringp mouse-1-remapped) (setq sequence mouse-1-remapped))
|
||||
((vectorp mouse-1-remapped) (setcar up-event (elt mouse-1-remapped 0)))
|
||||
(t (setcar up-event 'mouse-2))))
|
||||
(setq defn-up (key-binding sequence nil nil (event-start up-event)))
|
||||
(when mouse-1-tricky
|
||||
(setq sequence (vector up-event))
|
||||
(aset sequence 0 'mouse-1)
|
||||
(setq defn-up-tricky (key-binding sequence nil nil
|
||||
(event-start up-event))))))
|
||||
(if (fboundp 'with-help-window)
|
||||
(with-help-window (help-buffer)
|
||||
(princ (help-key-description key untranslated))
|
||||
(princ (format "\
|
||||
%s runs the command %S, which is "
|
||||
mouse-msg defn))
|
||||
(describe-function-1 defn)
|
||||
(when up-event
|
||||
(unless (or (null defn-up) (integerp defn-up) (equal defn-up 'undefined))
|
||||
(princ (format "
|
||||
|
||||
----------------- up-event %s----------------
|
||||
|
||||
<%S>%s%s runs the command %S, which is "
|
||||
(if mouse-1-tricky "(short click) " "")
|
||||
ev-type mouse-msg
|
||||
(if mouse-1-remapped " is remapped to <mouse-2>, which" "")
|
||||
defn-up))
|
||||
(describe-function-1 defn-up))
|
||||
(unless (or (null defn-up-tricky)
|
||||
(integerp defn-up-tricky)
|
||||
(eq defn-up-tricky 'undefined))
|
||||
(princ (format "
|
||||
|
||||
----------------- up-event (long click) ----------------
|
||||
|
||||
Pressing <%S>%s for longer than %d milli-seconds
|
||||
runs the command %S, which is "
|
||||
ev-type mouse-msg
|
||||
mouse-1-click-follows-link
|
||||
defn-up-tricky))
|
||||
(describe-function-1 defn-up-tricky)))
|
||||
(print-help-return-message))
|
||||
(with-output-to-temp-buffer (help-buffer) ; Emacs 22-24.3.
|
||||
(princ (help-key-description key untranslated))
|
||||
(princ (format "\
|
||||
%s runs the command %S, which is "
|
||||
mouse-msg defn))
|
||||
(describe-function-1 defn)
|
||||
(when up-event
|
||||
(unless (or (null defn-up) (integerp defn-up) (equal defn-up 'undefined))
|
||||
(princ (format "
|
||||
|
||||
----------------- up-event %s----------------
|
||||
|
||||
<%S>%s%s runs the command %S, which is "
|
||||
(if mouse-1-tricky "(short click) " "")
|
||||
ev-type mouse-msg
|
||||
(if mouse-1-remapped " is remapped to <mouse-2>, which" "")
|
||||
defn-up))
|
||||
(describe-function-1 defn-up))
|
||||
(unless (or (null defn-up-tricky)
|
||||
(integerp defn-up-tricky)
|
||||
(eq defn-up-tricky 'undefined))
|
||||
(princ (format "
|
||||
|
||||
----------------- up-event (long click) ----------------
|
||||
|
||||
Pressing <%S>%s for longer than %d milli-seconds
|
||||
runs the command %S, which is "
|
||||
ev-type mouse-msg
|
||||
mouse-1-click-follows-link
|
||||
defn-up-tricky))
|
||||
(describe-function-1 defn-up-tricky)))
|
||||
(print-help-return-message)))))))) ; Return t: defined.
|
||||
|
||||
|
||||
;; REPLACES ORIGINAL in `help.el':
|
||||
;; Updated key bindings.
|
||||
;;
|
||||
(make-help-screen help-for-help-internal
|
||||
"RET [abcCefFhiIkKlLmnopqrsStuvw] C-[\acdeflmoptw] M-[acko] C-M-a (? for more help):"
|
||||
"This is the Emacs `help-command', accessible via `%THIS-KEY%'.
|
||||
Type a help option (below) now, for help on a particular topic.
|
||||
Use \\<help-map>`\\[scroll-up]' or `\\[scroll-down]' to scroll this text. \
|
||||
Type `\\[help-quit]' to exit Help.
|
||||
\(A \"command\" is any function that you can execute via `M-x'.)
|
||||
|
||||
LEARNING EMACS
|
||||
--------------
|
||||
\\[help-with-tutorial]: Starts a tutorial for learning Emacs.
|
||||
\\[view-emacs-FAQ]: Explains frequently asked Emacs questions.
|
||||
|
||||
COMMONLY USED
|
||||
-------------
|
||||
\\[help-on-click/key]: Help about a key sequence or something you click with the mouse.
|
||||
\\[apropos-command]: Shows commands that match a regular expression (regexp).
|
||||
\\[describe-bindings]: Shows current key bindings: keyboard, menu bar, and mouse.
|
||||
\\[describe-command]: Shows the doc for an Emacs command.
|
||||
\\[describe-function]: Shows the doc for an Emacs function.
|
||||
\\[Info-goto-emacs-command-node]: Opens the Emacs manual for an Emacs command.
|
||||
\\[info]: Enters `Info', to browse manuals, including Emacs and Emacs Lisp.
|
||||
\\[describe-key]: Describes the command bound to keyboard/menu/mouse sequence.
|
||||
\\[Info-goto-emacs-key-command-node]: Opens the Emacs manual for a keyboard/menu/mouse \
|
||||
sequence.
|
||||
\\[describe-mode]: Describes the current major and minor modes.
|
||||
\\[describe-option]: Shows an Emacs user option's value and documentation.
|
||||
\\[describe-variable]: Shows an Emacs variable's value and documentation.
|
||||
|
||||
MORE ADVANCED HELP
|
||||
------------------
|
||||
\\[apropos-documentation]: Shows Emacs functions and variables whose doc matches a regexp.
|
||||
\\[view-lossage]: Shows what you just typed (last 100 keystrokes & mouse actions).
|
||||
\\[view-emacs-news]: Describes what's new in this Emacs release.
|
||||
\\[finder-by-keyword]: Finds Emacs-Lisp libraries that match a topic.
|
||||
\\[describe-syntax]: Describes the current syntax table.
|
||||
\\[info-lookup-symbol]: Finds a symbol in the manual for the current buffer's language.
|
||||
\\[manual-entry]: Finds a topic in the Unix manual.
|
||||
\\[where-is]: Identifies a keyboard/menu/mouse sequence that invokes a command.
|
||||
\\[apropos]: Shows Emacs functions and variables that match a regexp.
|
||||
\\[describe-key-briefly]: Identifies the command bound to a keyboard/menu/mouse sequence.
|
||||
\\[describe-distribution]: Shows Emacs ordering information.
|
||||
\\[locate-library]: Shows the path name to an Emacs library.
|
||||
\\[describe-option-of-type]: Shows value and doc for an Emacs user option of a given type.
|
||||
\\[describe-project]: Shows information about the GNU project.
|
||||
\\[describe-no-warranty]: Shows information about the absence of a warranty.
|
||||
\\[describe-copying]: Shows the GNU Emacs General Public License.
|
||||
\\[pop-to-help-toggle]: Pops to Help buffer or back to the buffer that sent you to Help.
|
||||
\\[tags-apropos]: Shows the tags matched by a given string.
|
||||
|
||||
INTERNATIONAL
|
||||
-------------
|
||||
\\[describe-coding-system]: Describes a coding system.
|
||||
h Displays the HELLO file, which illustrates scripts and languages.
|
||||
\\[describe-input-method]: Describes an input method.
|
||||
\\[describe-language-environment]: Describes a language environment.
|
||||
"
|
||||
help-map)
|
||||
|
||||
|
||||
;; REPLACES ORIGINAL in `help.el':
|
||||
;; Preferred candidate is `symbol-nearest-point'.
|
||||
;;
|
||||
;;;###autoload
|
||||
(defun where-is (definition &optional insert)
|
||||
"Show keyboard/menu/mouse sequences that invoke specified command.
|
||||
Argument is a command definition, usually a symbol with a function
|
||||
definition. Default candidate is: preferably the
|
||||
`symbol-nearest-point', or else the innermost function call
|
||||
surrounding point (`function-called-at-point').
|
||||
|
||||
With no prefix argument, only commands actually bound to keys are
|
||||
completion candidates. With a prefix argument, all commands are
|
||||
candidates.
|
||||
|
||||
With a plain (non-numeric) prefix argument, `C-u', insert the message
|
||||
in the current buffer."
|
||||
(interactive
|
||||
(let ((fn (or (and (fboundp 'symbol-nearest-point)
|
||||
(symbol-nearest-point))
|
||||
(function-called-at-point)))
|
||||
(enable-recursive-minibuffers t)
|
||||
(orig-buf (current-buffer))
|
||||
val)
|
||||
(setq val (completing-read (if fn
|
||||
(format "Where is command (default %s): " fn)
|
||||
"Where is command: ")
|
||||
obarray
|
||||
(if current-prefix-arg
|
||||
'commandp
|
||||
(lambda (c)
|
||||
(with-current-buffer orig-buf
|
||||
(and (commandp c)
|
||||
(where-is-internal c overriding-local-map
|
||||
'non-ascii)))))
|
||||
t))
|
||||
(list (if (equal val "") fn (intern val))
|
||||
(consp current-prefix-arg))))
|
||||
(unless definition (error "No command"))
|
||||
(let ((func (indirect-function definition))
|
||||
(defs ())
|
||||
(standard-output (if insert (current-buffer) t)))
|
||||
;; In DEFS, find all symbols that are aliases for DEFINITION.
|
||||
(mapatoms (lambda (symbol)
|
||||
(and (fboundp symbol)
|
||||
(not (eq symbol definition))
|
||||
(eq func (condition-case () (indirect-function symbol) (error symbol)))
|
||||
(push symbol defs))))
|
||||
;; Look at all the symbols--first DEFINITION, then its aliases.
|
||||
(dolist (symbol (cons definition defs))
|
||||
(let* ((remapped (command-remapping symbol))
|
||||
(keys (where-is-internal symbol overriding-local-map nil nil remapped))
|
||||
(keys (mapconcat (if (fboundp 'naked-key-description)
|
||||
#'naked-key-description
|
||||
#'key-description)
|
||||
keys "', `"))
|
||||
string)
|
||||
(setq string (if insert
|
||||
(if (> (length keys) 0)
|
||||
(if remapped
|
||||
(format "%s (%s) (remapped from %s)" keys remapped symbol)
|
||||
(format "%s (%s)" keys symbol))
|
||||
(format "M-x %s RET" symbol))
|
||||
(if (> (length keys) 0)
|
||||
(if remapped
|
||||
(format "%s is remapped to %s which is on `%s'"
|
||||
symbol remapped keys)
|
||||
(format "%s is on `%s'" symbol keys))
|
||||
;; If this is the command the user asked about, and it is not on any
|
||||
;; key, say so. For other symbols, its aliases, say nothing about
|
||||
;; them unless they are on keys.
|
||||
(and (eq symbol definition)
|
||||
(format "%s is not on any key" symbol)))))
|
||||
(when string
|
||||
(unless (eq symbol definition) (princ ";\n its alias "))
|
||||
(princ string)))))
|
||||
nil)
|
||||
|
||||
(defun help-on-click/key-lookup (key &optional pp-key where)
|
||||
"Look up information on KEY via `describe-key' and `info'.
|
||||
Optional args PP-KEY and WHERE are strings naming KEY and its type.
|
||||
Their defaults are KEY's `key-description' and \"Key sequence\".
|
||||
Function `Info-goto-emacs-key-command-node' is used to look up KEY."
|
||||
(sit-for 0 200) ;; HACK to fix bug if click on scroll bar in `help-on-click/key'.
|
||||
(setq where (or where "Key sequence ")
|
||||
pp-key (or pp-key (if (fboundp 'naked-key-description)
|
||||
(naked-key-description key)
|
||||
(key-description key))))
|
||||
(let* ((described-p (if (fboundp 'help--analyze-key) ; Emacs 26+
|
||||
(cadr (help--analyze-key key nil))
|
||||
(describe-key key)))
|
||||
;; The version of `Info-goto-emacs-key-command-node' defined in `info+.el' returns
|
||||
;; non-nil if Info doc is found. The standard version defined `info.el' will not.
|
||||
(documented-p (Info-goto-emacs-key-command-node key))) ; nil if have only std version
|
||||
(when (and (not documented-p) (get-buffer-window "*info*" 'visible)) (Info-exit))
|
||||
(cond ((and described-p documented-p)
|
||||
(when (fboundp 'show-*Help*-buffer) (show-*Help*-buffer))
|
||||
(message "%s`%s': summary in *Help* buffer; doc in buffer `*info*'."
|
||||
where pp-key))
|
||||
(described-p
|
||||
(when (fboundp 'show-*Help*-buffer) (show-*Help*-buffer))
|
||||
(message "%s`%s': summary in buffer `*Help*'." where pp-key))
|
||||
(documented-p
|
||||
(message "%s`%s': doc in buffer `*info*'." where pp-key))
|
||||
(t
|
||||
(message "%s`%s' is undefined." where pp-key)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun help-on-click/key (key)
|
||||
"Give help on a key/menu sequence or object clicked with the mouse.
|
||||
The object can be any part of an Emacs window or a name appearing in a
|
||||
buffer. You can do any of the following:
|
||||
|
||||
type a key sequence (e.g. `C-M-s')
|
||||
choose a menu item (e.g. [menu-bar files open-file])
|
||||
click on a scroll bar
|
||||
click on the mode line
|
||||
click in the minibuffer
|
||||
click on an Emacs-related name in a buffer: apropos is called
|
||||
click anywhere else in a buffer: its modes are described
|
||||
|
||||
Help is generally provided using `describe-key' and the Emacs online
|
||||
manual (via `Info-goto-emacs-key-command-node'). If no entry is found
|
||||
in the index of the Emacs manual, then the manual is searched from the
|
||||
beginning for literal occurrences of KEY.
|
||||
|
||||
If you click on a name in a buffer, then `apropos-documentation' and
|
||||
`apropos' are used to find information on the name. These functions
|
||||
are not used when you do something besides click on a name.
|
||||
|
||||
If you click elsewhere in a buffer other than the minibuffer, then
|
||||
`describe-mode' is used to describe the buffer's current mode(s)."
|
||||
(interactive "kClick mouse on something or type a key sequence")
|
||||
(let ((temp-buffer-show-function 'switch-to-buffer-other-window)
|
||||
(font-lock-verbose nil)
|
||||
(global-font-lock-mode nil))
|
||||
;; DEBUG (message "KEY: `%s'" key)(sit-for 4) ; DEBUG
|
||||
(cond ((stringp key)
|
||||
(help-on-click/key-lookup key))
|
||||
(t ; Vector.
|
||||
(let ((type (aref key 0)))
|
||||
(cond ((or (symbolp type) (integerp type))
|
||||
(cond ((eq 'mode-line type) ; Click on the mode line.
|
||||
(Info-goto-node "(emacs)Mode Line")
|
||||
(message "Mode line: decribed in *info* buffer."))
|
||||
(t ; Normal key sequence.
|
||||
(help-on-click/key-lookup key))))
|
||||
((eq 'menu-bar (car type))
|
||||
|
||||
(help-on-click/key-lookup key (aref key (1- (length key))) "Menu item "))
|
||||
((not (eq 'down (car (event-modifiers (car type))))) ; e.g. mouse menus
|
||||
(help-on-click/key-lookup key))
|
||||
(t ; Mouse click.
|
||||
(setq key type)
|
||||
(cond ((window-minibuffer-p ; Click in minibuffer.
|
||||
(posn-window (event-start key)))
|
||||
(Info-goto-node "(emacs)Minibuffer")
|
||||
(message "Minibuffer: decribed in buffer `*info*'."))
|
||||
(t
|
||||
(let ((symb (save-excursion
|
||||
(mouse-set-point key)
|
||||
(if (fboundp 'tap-symbol-at-point)
|
||||
(tap-symbol-at-point)
|
||||
(symbol-at-point))))
|
||||
(apropos-do-all t)
|
||||
(found-doc nil)
|
||||
(found nil)
|
||||
(symb-regexp nil))
|
||||
(cond (symb
|
||||
(message "Looking for info apropos `%s'..." symb)
|
||||
(when (get-buffer "*Apropos Doc*")
|
||||
(kill-buffer (get-buffer "*Apropos Doc*")))
|
||||
(setq found-doc
|
||||
(apropos-documentation
|
||||
(setq symb-regexp
|
||||
(regexp-quote
|
||||
(setq symb (format "%s" symb))))))
|
||||
(when found-doc
|
||||
(with-current-buffer (get-buffer "*Apropos*")
|
||||
(rename-buffer "*Apropos Doc*"))
|
||||
(when (fboundp '1-window-frames-on) ; In `frame-fns.el'.
|
||||
(let ((frames (1-window-frames-on "*Apropos Doc*")))
|
||||
(while frames
|
||||
(save-window-excursion
|
||||
(select-frame (car frames))
|
||||
(rename-frame nil "*Apropos Doc*")
|
||||
(pop frames))))))
|
||||
(setq found (apropos symb-regexp))
|
||||
;; Remove empty stuff.
|
||||
(setq found (and (consp found)
|
||||
(or (cdr found) (cadr found))))
|
||||
;; Remove *Apropos* window that was displayed needlessly.
|
||||
(unless found (delete-windows-on "*Apropos*"))
|
||||
(cond
|
||||
((and found-doc found)
|
||||
(message
|
||||
"See buffers `*Apropos*' and `*Apropos Doc*'."))
|
||||
(found
|
||||
(message
|
||||
"See information on `%s' in buffer `*Apropos*'."
|
||||
symb))
|
||||
(found-doc
|
||||
(message
|
||||
"See information on `%s' in buffer `*Apropos Doc*'."
|
||||
symb))
|
||||
(t
|
||||
(message
|
||||
"No information found regarding `%s'."
|
||||
symb))))
|
||||
(t ; User clicked in buffer, but not on a symbol.
|
||||
(let ((bufname (buffer-name (current-buffer))))
|
||||
(describe-mode)
|
||||
(when
|
||||
(fboundp 'show-*Help*-buffer) (show-*Help*-buffer))
|
||||
(message
|
||||
"Mode(s) of buffer `%s' are described in buffer \
|
||||
`*Help*'."
|
||||
bufname))))))))))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun mouse-help-on-click (event)
|
||||
"Give help on an object clicked with the mouse."
|
||||
(interactive "e")
|
||||
(help-on-click/key (vector event)))
|
||||
|
||||
;;;###autoload
|
||||
(defun mouse-help-on-mode-line-click (event)
|
||||
"Give help on the mode line."
|
||||
(interactive "e")
|
||||
(help-on-click/key (vector 'mode-line event)))
|
||||
|
||||
;;;###autoload
|
||||
(defun pop-to-help-toggle ()
|
||||
"Pop to buffer *Help* or back to the buffer that sent you to *Help*."
|
||||
(interactive)
|
||||
(let ((orig-buf (and (buffer-live-p help-origin-buffer)
|
||||
(get-buffer help-origin-buffer)))
|
||||
(w32-grab-focus-on-raise t)
|
||||
(win32-grab-focus-on-raise t)) ; Older name.
|
||||
(if (string-match "*Help*" (buffer-name))
|
||||
(cond ((not orig-buf) (error "No buffer to return to"))
|
||||
((string-match "Minibuf" (buffer-name orig-buf)) ; No `minibufferp' in Emacs 20.
|
||||
(select-frame-set-input-focus
|
||||
(window-frame (select-window (minibuffer-window)))))
|
||||
(t (pop-to-buffer orig-buf)))
|
||||
(setq help-origin-buffer (current-buffer))
|
||||
(pop-to-buffer "*Help*"))))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(provide 'help+)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; help+.el ends here
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@ -1,396 +0,0 @@
|
||||
;;; help-mode+.el --- Extensions to `help-mode.el'
|
||||
;;
|
||||
;; Filename: help-mode+.el
|
||||
;; Description: Extensions to `help-mode.el'
|
||||
;; Author: Drew Adams
|
||||
;; Maintainer: Drew Adams (concat "drew.adams" "@" "oracle" ".com")
|
||||
;; Copyright (C) 2004-2018, Drew Adams, all rights reserved.
|
||||
;; Created: Sat Nov 06 15:14:12 2004
|
||||
;; Version: 0
|
||||
;; Package-Requires: ()
|
||||
;; Last-Updated: Mon Jan 1 13:28:45 2018 (-0800)
|
||||
;; By: dradams
|
||||
;; Update #: 215
|
||||
;; URL: https://www.emacswiki.org/emacs/download/help-mode%2b.el
|
||||
;; Doc URL: https://emacswiki.org/emacs/HelpPlus
|
||||
;; Keywords: help
|
||||
;; Compatibility: GNU Emacs: 22.x, 23.x, 24.x, 25.x, 26.x
|
||||
;;
|
||||
;; Features that might be required by this library:
|
||||
;;
|
||||
;; `button', `help-mode', `view'.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; Extensions to `help-mode.el'
|
||||
;;
|
||||
;;
|
||||
;; ***** NOTE: The following functions defined in `help-mode.el'
|
||||
;; have been REDEFINED HERE:
|
||||
;;
|
||||
;; `help-make-xrefs' - Put symbol clause first, so cross-xref links
|
||||
;; show doc for both fun and var, if available.
|
||||
;; `help-mode' - If `one-window-p', then delete Help frame.
|
||||
;; `help-xref-on-pp' - Library names are buttonized.
|
||||
;;
|
||||
;;
|
||||
;; Put this in your initialization file (`~/.emacs'):
|
||||
;;
|
||||
;; (require 'help-mode+)
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Change Log:
|
||||
;;
|
||||
;; 2018/01/1 dadams
|
||||
;; help-make-xrefs:
|
||||
;; Bug #12686: Promote type tests after cond tests to be inside them with the match tests.
|
||||
;; 2014/01/17 dadams
|
||||
;; Do not redefine help-mode for Emacs 24+.
|
||||
;; 2012/10/25 dadams
|
||||
;; Added redefinition of help-make-xrefs.
|
||||
;; 2011/01/04 dadams
|
||||
;; Removed autoload cookie from non-interactive function.
|
||||
;; 2007/12/14 dadams
|
||||
;; Added redefinition of help-mode.
|
||||
;; Removed pop-to-help-buffer and help-origin-buffer to (new) help+.el.
|
||||
;; 2006/07/11 dadams
|
||||
;; Added: help-origin-buffer, pop-to-help-toggle. Bound latter to C-h C-o.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; 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 2, 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; see the file COPYING. If not, write to
|
||||
;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth
|
||||
;; Floor, Boston, MA 02110-1301, USA.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
(require 'help-mode)
|
||||
|
||||
;; Quiet the byte-compiler.
|
||||
(defvar help-forward-label)
|
||||
(defvar help-xref-override-view-map)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
|
||||
;; REPLACES ORIGINAL IN `help-mode.el'.
|
||||
;;
|
||||
;; Deletes frame if `one-window-p'.
|
||||
;;
|
||||
;;;###autoload
|
||||
(when (< emacs-major-version 24) ; Emacs 24+ does not use `view-mode', so no need.
|
||||
(defun help-mode ()
|
||||
"Major mode for viewing help text and navigating references in it.
|
||||
Entry to this mode runs the normal hook `help-mode-hook'.
|
||||
Commands:
|
||||
\\{help-mode-map}"
|
||||
(interactive)
|
||||
(kill-all-local-variables)
|
||||
(use-local-map help-mode-map)
|
||||
(setq mode-name "Help"
|
||||
major-mode 'help-mode)
|
||||
(view-mode)
|
||||
(make-local-variable 'view-no-disable-on-exit)
|
||||
(setq view-no-disable-on-exit t
|
||||
view-exit-action (lambda (buffer)
|
||||
(or (window-minibuffer-p (selected-window))
|
||||
(when (eq (window-buffer) (get-buffer "*Help*"))
|
||||
(if (one-window-p t)
|
||||
(delete-frame)
|
||||
(delete-window))))))
|
||||
(run-mode-hooks 'help-mode-hook)))
|
||||
|
||||
|
||||
;; REPLACES ORIGINAL IN `help-mode.el'.
|
||||
;;
|
||||
;; Show all doc possible for a symbol that is any 2 or 3 of fn, var, and face.
|
||||
;; See Emacs bug #12686.
|
||||
;;
|
||||
;; Also a partial fix for Emacs bug #24842.
|
||||
;;
|
||||
;;;###autoload
|
||||
(defun help-make-xrefs (&optional buffer)
|
||||
"Parse and hyperlink documentation cross-references in the given BUFFER.
|
||||
|
||||
Find cross-reference information in a buffer and activate such cross
|
||||
references for selection with `help-follow'. Cross-references have
|
||||
the canonical form `...' and the type of reference may be
|
||||
disambiguated by the preceding word(s) used in
|
||||
`help-xref-symbol-regexp'. Faces only get cross-referenced if
|
||||
preceded or followed by the word `face'. Variables without
|
||||
variable documentation do not get cross-referenced, unless
|
||||
preceded by the word `variable' or `option'.
|
||||
|
||||
If the variable `help-xref-mule-regexp' is non-nil, find also
|
||||
cross-reference information related to multilingual environment
|
||||
\(e.g., coding-systems). This variable is also used to disambiguate
|
||||
the type of reference as the same way as `help-xref-symbol-regexp'.
|
||||
|
||||
A special reference `back' is made to return back through a stack of
|
||||
help buffers. Variable `help-back-label' specifies the text for
|
||||
that."
|
||||
(interactive "b")
|
||||
(with-current-buffer (or buffer (current-buffer))
|
||||
(save-excursion
|
||||
(goto-char (point-min))
|
||||
;; Skip the header-type info, though it might be useful to parse
|
||||
;; it at some stage (e.g. "function in `library'").
|
||||
(forward-paragraph)
|
||||
(let ((old-modified (buffer-modified-p)))
|
||||
(let ((stab (syntax-table))
|
||||
(case-fold-search t)
|
||||
(inhibit-read-only t))
|
||||
(set-syntax-table emacs-lisp-mode-syntax-table)
|
||||
;; The following should probably be abstracted out.
|
||||
(unwind-protect
|
||||
(progn
|
||||
;; Info references
|
||||
(save-excursion
|
||||
(while (re-search-forward help-xref-info-regexp nil t)
|
||||
(let ((data (match-string 2)))
|
||||
(save-match-data
|
||||
(unless (string-match "^([^)]+)" data)
|
||||
(setq data (concat "(emacs)" data)))
|
||||
(setq data ;; possible newlines if para filled
|
||||
(replace-regexp-in-string "[ \t\n]+" " " data t t)))
|
||||
(help-xref-button 2 'help-info data))))
|
||||
;; URLs
|
||||
(save-excursion
|
||||
(while (re-search-forward help-xref-url-regexp nil t)
|
||||
(let ((data (match-string 1)))
|
||||
(help-xref-button 1 'help-url data))))
|
||||
;; Mule related keywords. Do this before trying
|
||||
;; `help-xref-symbol-regexp' because some of Mule
|
||||
;; keywords have variable or function definitions.
|
||||
|
||||
;; $$$$$ Should I do it here too? (Have not done so yet.)
|
||||
(when help-xref-mule-regexp
|
||||
(save-excursion
|
||||
(while (re-search-forward help-xref-mule-regexp nil t)
|
||||
(let* ((data (match-string 7))
|
||||
(sym (intern-soft data)))
|
||||
(cond ((match-string 3) ; coding system
|
||||
(and sym
|
||||
(coding-system-p sym)
|
||||
(help-xref-button 6 'help-coding-system sym)))
|
||||
((match-string 4) ; input method
|
||||
(and (assoc data input-method-alist)
|
||||
(help-xref-button 7 'help-input-method data)))
|
||||
((or (match-string 5) (match-string 6)) ; charset
|
||||
(and sym
|
||||
(charsetp sym)
|
||||
(help-xref-button 7 'help-character-set sym)))
|
||||
((assoc data input-method-alist)
|
||||
(help-xref-button 7 'help-character-set data))
|
||||
((and sym (coding-system-p sym))
|
||||
(help-xref-button 7 'help-coding-system sym))
|
||||
((and sym (charsetp sym))
|
||||
(help-xref-button 7 'help-character-set sym)))))))
|
||||
;; Quoted symbols
|
||||
(save-excursion
|
||||
(while (re-search-forward help-xref-symbol-regexp nil t)
|
||||
(let* ((data (match-string 8))
|
||||
(sym (intern-soft data)))
|
||||
(when sym
|
||||
(cond ((or (and (or (boundp sym) ; var & fn
|
||||
(get sym 'variable-documentation))
|
||||
(fboundp sym))
|
||||
(and (fboundp sym) ; fn & face
|
||||
(facep sym))
|
||||
(and (or (boundp sym) ; var & face
|
||||
(get sym 'variable-documentation))
|
||||
(facep sym)))
|
||||
;; Var, function, or face -- doc all, if possible.
|
||||
(help-xref-button 8 'help-symbol sym))
|
||||
((and (match-string 3) ; `variable' &c
|
||||
(or (boundp sym) ; `variable' doesn't ensure
|
||||
; it's actually bound
|
||||
(get sym 'variable-documentation)))
|
||||
(help-xref-button 8 'help-variable sym))
|
||||
((and (match-string 4) ; `function' &c
|
||||
(fboundp sym)) ; similarly
|
||||
(help-xref-button 8 'help-function sym))
|
||||
((and (match-string 5) ; `face'
|
||||
(facep sym))
|
||||
(help-xref-button 8 'help-face sym))
|
||||
((match-string 6)) ; nothing for `symbol'
|
||||
((match-string 7)
|
||||
;; this used:
|
||||
;; #'(lambda (arg)
|
||||
;; (let ((location (find-function-noselect arg)))
|
||||
;; (pop-to-buffer (car location))
|
||||
;; (goto-char (cdr location))))
|
||||
(help-xref-button 8 'help-function-def sym))
|
||||
((and (facep sym)
|
||||
(save-match-data (looking-at "[ \t\n]+face\\W")))
|
||||
(help-xref-button 8 'help-face sym))
|
||||
((and
|
||||
(or (boundp sym) (get sym 'variable-documentation))
|
||||
(or (documentation-property sym 'variable-documentation)
|
||||
(if (or (> emacs-major-version 24)
|
||||
(and (= emacs-major-version 24)
|
||||
(> emacs-minor-version 2)))
|
||||
(documentation-property (indirect-variable sym)
|
||||
'variable-documentation)
|
||||
(condition-case nil
|
||||
(documentation-property (indirect-variable sym)
|
||||
'variable-documentation)
|
||||
(cyclic-variable-indirection nil)))))
|
||||
(help-xref-button 8 'help-variable sym))
|
||||
((fboundp sym)
|
||||
(help-xref-button 8 'help-function sym)))))))
|
||||
;; An obvious case of a key substitution:
|
||||
(save-excursion
|
||||
(while (re-search-forward
|
||||
;; Assume command name is only word and symbol
|
||||
;; characters to get things like `use M-x foo->bar'.
|
||||
;; Command required to end with word constituent
|
||||
;; to avoid `.' at end of a sentence.
|
||||
"\\<M-x\\s-+\\(\\sw\\(\\sw\\|\\s_\\)*\\sw\\)" nil t)
|
||||
(let ((sym (intern-soft (match-string 1))))
|
||||
(when (fboundp sym) (help-xref-button 1 'help-function sym)))))
|
||||
;; Look for commands in whole keymap substitutions:
|
||||
(save-excursion
|
||||
;; Make sure to find the first keymap.
|
||||
(goto-char (point-min))
|
||||
;; Find a header and the column at which the command
|
||||
;; name will be found.
|
||||
|
||||
;; If the keymap substitution isn't the last thing in
|
||||
;; the doc string, and if there is anything on the same
|
||||
;; line after it, this code won't recognize the end of it.
|
||||
(while (re-search-forward "^key +binding\n\\(-+ +\\)-+\n\n"
|
||||
nil t)
|
||||
(let ((col (- (match-end 1) (match-beginning 1))))
|
||||
(while (and (not (eobp))
|
||||
;; Stop at a pair of blank lines.
|
||||
(not (looking-at "\n\\s-*\n")))
|
||||
;; Skip a single blank line.
|
||||
(and (eolp) (forward-line))
|
||||
(end-of-line)
|
||||
(skip-chars-backward "^ \t\n")
|
||||
(when (and (>= (current-column) col)
|
||||
(looking-at "\\(\\sw\\|\\s_\\)+$"))
|
||||
(let ((sym (intern-soft (match-string 0))))
|
||||
(when (fboundp sym) (help-xref-button 0 'help-function sym))))
|
||||
(forward-line))))))
|
||||
(set-syntax-table stab))
|
||||
;; Delete extraneous newlines at the end of the docstring
|
||||
(goto-char (point-max))
|
||||
(while (and (not (bobp)) (bolp)) (delete-char -1))
|
||||
(insert "\n")
|
||||
(when (or help-xref-stack (and (boundp 'help-xref-forward-stack)
|
||||
help-xref-forward-stack))
|
||||
(insert "\n"))
|
||||
;; Make a back-reference in this buffer if appropriate.
|
||||
(when help-xref-stack
|
||||
(help-insert-xref-button help-back-label 'help-back
|
||||
(current-buffer)))
|
||||
;; Make a forward-reference in this buffer if appropriate.
|
||||
(when (and (boundp 'help-xref-forward-stack) help-xref-forward-stack)
|
||||
(when help-xref-stack
|
||||
(insert "\t"))
|
||||
(help-insert-xref-button help-forward-label 'help-forward
|
||||
(current-buffer)))
|
||||
(when (or help-xref-stack (and (boundp 'help-xref-forward-stack)
|
||||
help-xref-forward-stack))
|
||||
(insert "\n")))
|
||||
(when (< emacs-major-version 24)
|
||||
;; View mode steals RET from us.
|
||||
(set (make-local-variable 'minor-mode-overriding-map-alist)
|
||||
(list (cons 'view-mode help-xref-override-view-map))))
|
||||
(when (or (> emacs-major-version 24)
|
||||
(and (= emacs-major-version 24) (> emacs-minor-version 2)))
|
||||
(set-buffer-modified-p old-modified))))))
|
||||
|
||||
|
||||
;; REPLACES ORIGINAL IN `help-mode.el'.
|
||||
|
||||
;; Buttonizes names of libraries also.
|
||||
;; To see the effect, try `C-h v features', and click on a library name.
|
||||
;;
|
||||
;; 2006-01-20: This no longer works, because the call to this function
|
||||
;; from `describe-variable' was commented out in `help-fns.el'.
|
||||
;;
|
||||
(defun help-xref-on-pp (from to)
|
||||
"Add xrefs for symbols in `pp's output between FROM and TO."
|
||||
(if (> (- to from) 5000)
|
||||
nil
|
||||
(with-syntax-table emacs-lisp-mode-syntax-table
|
||||
(save-excursion
|
||||
(save-restriction
|
||||
(narrow-to-region from to)
|
||||
(goto-char (point-min))
|
||||
(condition-case nil
|
||||
(while (not (eobp))
|
||||
(cond
|
||||
((looking-at "\"") (forward-sexp 1))
|
||||
((looking-at "#<") (search-forward ">" nil 'move))
|
||||
((looking-at "\\(\\(\\sw\\|\\s_\\)+\\)")
|
||||
(let* ((sym (intern-soft (match-string 1)))
|
||||
(type (cond ((fboundp sym) 'help-function)
|
||||
((or (memq sym '(t nil)) (keywordp sym))
|
||||
nil)
|
||||
((and sym (boundp sym))
|
||||
'help-variable)
|
||||
((and sym (locate-library (symbol-name sym)))
|
||||
'help-library))))
|
||||
(when type (help-xref-button 1 type sym)))
|
||||
(goto-char (match-end 1)))
|
||||
(t (forward-char 1))))
|
||||
(error nil)))))))
|
||||
|
||||
(define-button-type 'help-library
|
||||
:supertype 'help-xref
|
||||
'help-function #'(lambda (x) (find-library (symbol-name x)))
|
||||
'help-echo (purecopy "mouse-2, RET: find this library"))
|
||||
|
||||
;; $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
|
||||
;; REPLACES ORIGINAL IN `help-mode.el'.
|
||||
;; Provide a tooltip for whatever is under the mouse.
|
||||
;; This can't be done here - the message needs to be done via an idle timer,
|
||||
;; whenever mouse is over any name. Perhaps combine with eldoc.
|
||||
;;
|
||||
;; ;;;###autoload
|
||||
;; (defun help-follow-mouse (click)
|
||||
;; "Follow the cross-reference that you CLICK on."
|
||||
;; (interactive "e")
|
||||
;; (let* ((start (event-start click))
|
||||
;; (window (car start))
|
||||
;; (pos (car (cdr start))))
|
||||
;; (with-current-buffer (window-buffer window)
|
||||
;; (message "Display help on `%s'"
|
||||
;; (save-excursion
|
||||
;; (goto-char pos) (skip-syntax-backward "w_")
|
||||
;; (buffer-substring (point)
|
||||
;; (progn (skip-syntax-forward "w_")
|
||||
;; (point)))))
|
||||
;; (help-follow pos))))
|
||||
|
||||
;; After a certain idle time, use function `mouse-position', and pick
|
||||
;; up the symbol under the pointer. Then display a message that
|
||||
;; clicking mouse-2 will display help on the symbol.
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(provide 'help-mode+)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; help-mode+.el ends here
|
Binary file not shown.
5421
emacswiki/info+.el
5421
emacswiki/info+.el
File diff suppressed because it is too large
Load Diff
Binary file not shown.
46
emodule/README.org
Normal file
46
emodule/README.org
Normal file
@ -0,0 +1,46 @@
|
||||
#+TITLE: EModule
|
||||
#+AUTHOR: Wojciech Kozlowski
|
||||
#+EMAIL: wk@wojciechkozlowski.eu
|
||||
|
||||
EModule (Emacs Module) - is a small add-on to Emacs that helps manage personal
|
||||
configuration by splitting it into manageable modules. It goes beyond simply
|
||||
splitting configuration across multiple files by also managing the installation
|
||||
and removal of packages.
|
||||
|
||||
This was inspired by Spacemacs' automatic package management with layers.
|
||||
However, adding additional configuration to an existing layer, or creating a
|
||||
new layer required some ramp-up in how they work. By developing something
|
||||
simpler, the hope was to have something close in simplicity to just writing a
|
||||
basic init file, with the additional benefit of automatic package installation
|
||||
and removal.
|
||||
|
||||
* Usage
|
||||
|
||||
Import the package:
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(add-to-list 'load-path "~/.emacs.d/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
|
||||
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~.
|
||||
|
||||
Finally, invoke ~emodule/init~ from your init file:
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(emodule/init '(MODULE
|
||||
...))
|
||||
#+END_SRC
|
||||
|
||||
This will install all the required packages (including all dependencies),
|
||||
remove any packages that are no longer required (i.e. packages that are no
|
||||
longer explicitly listed as required and are not a dependency of some other
|
||||
required package), and invoke all the initialisation functions.
|
||||
|
||||
There is also ~emodule/init-debug~, which will not install/remove
|
||||
packages so you can comment out modules to help you in debugging
|
||||
your init file.
|
@ -1,46 +0,0 @@
|
||||
EModule
|
||||
=======
|
||||
|
||||
EModule (Emacs Module) - is a small add-on to Emacs that helps manage personal
|
||||
configuration by splitting it into manageable modules. It goes beyond simply
|
||||
splitting configuration across multiple files by also managing the installation
|
||||
and removal of packages.
|
||||
|
||||
This was inspired by Spacemacs' automatic package management with layers.
|
||||
However, adding additional configuration to an existing layer, or creating a
|
||||
new layer required some ramp-up in how they work. By developing something
|
||||
simpler, the hope was to have something close in simplicity to just writing a
|
||||
basic init file, with the additional benefit of automatic package installation
|
||||
and removal.
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
Import the package:
|
||||
|
||||
::
|
||||
|
||||
(add-to-list 'load-path "~/.emacs.d/emodule")
|
||||
(require 'emodule)
|
||||
|
||||
Define one or more modules in the modules directory (by default
|
||||
``~/.emacs.d/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``.
|
||||
|
||||
Now simply invoke the ``emodule/init`` function from your main init file
|
||||
|
||||
::
|
||||
|
||||
(emodule/init '(MODULE
|
||||
...))
|
||||
|
||||
Which will install all the required packages (including all dependencies),
|
||||
remove any packages that are no longer required (i.e. packages that are no
|
||||
longer explicitly listed as required and are not a dependency of some other
|
||||
required package), and invoke all the initialisation functions.
|
||||
|
||||
There is also ``emodule/init-debug``, which will skip installing/removing
|
||||
packages so you can comment out modules to help you in debugging your init
|
||||
file.
|
@ -1,9 +1,9 @@
|
||||
;;; emodule.el --- Helpful automation functions for `package'
|
||||
;;
|
||||
;; Copyright (C) 2017 Wojciech Kozlowski
|
||||
;; Copyright (C) 2017-2019 Wojciech Kozlowski
|
||||
;;
|
||||
;; Author: Wojciech Kozlowski <wk@wojciechkozlowski.eu>
|
||||
;; Created: 23 Aug 2017
|
||||
;; Created: 2017-08-23
|
||||
;; Version: 1.0.0
|
||||
;; Keywords: tools
|
||||
;; Package-Requires:
|
||||
|
1
ide-mode
1
ide-mode
@ -1 +0,0 @@
|
||||
Subproject commit 52bd5990da147f3b5ceae6ccfbd562012bd3fc51
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
@ -1,9 +1,9 @@
|
||||
;;; initial-buffer.el --- Initial buffer displayed at startup
|
||||
;;; init-buffer.el --- Initial buffer displayed at startup
|
||||
;;
|
||||
;; Copyright (C) 2018 Wojciech Kozlowski
|
||||
;; Copyright (C) 2018-2019 Wojciech Kozlowski
|
||||
;;
|
||||
;; Author: Wojciech Kozlowski <wk@wojciechkozlowski.eu>
|
||||
;; Created: 5 Nov 2018
|
||||
;; Created: 2018-11-05
|
||||
;;
|
||||
;; This file is not part of GNU Emacs.
|
||||
;;
|
||||
@ -15,32 +15,32 @@
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
(defconst initial-buffer/banner-file "~/.emacs.d/initial-buffer/blue-robot.png"
|
||||
(defconst init-buffer/banner-file "~/.emacs.d/init-buffer/blue-robot.png"
|
||||
"Location of the banner image to use.")
|
||||
|
||||
(defconst initial-buffer/name "*GNU Emacs*"
|
||||
(defconst init-buffer/name "*GNU Emacs*"
|
||||
"Name of the initial buffer.")
|
||||
|
||||
(defconst initial-buffer/recentf-list-length 10
|
||||
(defconst init-buffer/recentf-list-length 10
|
||||
"Length used for recentf list.")
|
||||
|
||||
(defconst initial-buffer/recentf-length-threshold 75
|
||||
(defconst init-buffer/recentf-length-threshold 75
|
||||
"Threshold of filename length to apply different centre rules.
|
||||
If at least one file in recentf is longer than this, the list
|
||||
will not be centered, but offset by a constant instead.")
|
||||
|
||||
(defconst initial-buffer/buttons-recentf-offset 20
|
||||
(defconst init-buffer/buttons-recentf-offset 20
|
||||
"Relative position between the home buffer buttons and startup lists.")
|
||||
|
||||
(defvar initial-buffer/buttons-line nil
|
||||
(defvar init-buffer/buttons-line nil
|
||||
"Vertical position of the home buffer buttons.
|
||||
Internal use, do not set this variable.")
|
||||
|
||||
(defvar initial-buffer/buttons-position nil
|
||||
(defvar init-buffer/buttons-position nil
|
||||
"Horizontal position of the home buffer buttons.
|
||||
Internal use, do not set this variable.")
|
||||
|
||||
(defvar initial-buffer-mode-map
|
||||
(defvar init-buffer-mode-map
|
||||
(let ((map (make-sparse-keymap)))
|
||||
(define-key map (kbd "RET") 'widget-button-press)
|
||||
|
||||
@ -52,22 +52,22 @@ Internal use, do not set this variable.")
|
||||
(define-key map (kbd "b") 'widget-backward)
|
||||
(define-key map (kbd "p") 'widget-backward)
|
||||
|
||||
(define-key map (kbd "r") 'initial-buffer/refresh)
|
||||
(define-key map (kbd "r") 'init-buffer/refresh)
|
||||
(define-key map "q" 'quit-window)
|
||||
map)
|
||||
"Keymap for initial buffer mode.")
|
||||
|
||||
(define-derived-mode initial-buffer-mode fundamental-mode "Initial buffer"
|
||||
(define-derived-mode init-buffer-mode fundamental-mode "Initial buffer"
|
||||
"Major mode for startup screen."
|
||||
:group 'initial-buffer
|
||||
:group 'init-buffer
|
||||
:syntax-table nil
|
||||
:abbrev-table nil
|
||||
(setq buffer-read-only t
|
||||
truncate-lines t))
|
||||
|
||||
(defun initial-buffer/insert-banner ()
|
||||
(defun init-buffer/insert-banner ()
|
||||
"Display an image banner."
|
||||
(let* ((spec (create-image initial-buffer/banner-file))
|
||||
(let* ((spec (create-image init-buffer/banner-file))
|
||||
(size (image-size spec))
|
||||
(width (car size))
|
||||
(left-margin (max 0 (floor (- (window-width) width) 2))))
|
||||
@ -77,7 +77,7 @@ Internal use, do not set this variable.")
|
||||
(insert-image spec)
|
||||
(insert "\n\n")))
|
||||
|
||||
(defun initial-buffer/insert-buttons ()
|
||||
(defun init-buffer/insert-buttons ()
|
||||
"Create and insert the interactive buttons under the banner."
|
||||
(goto-char (point-max))
|
||||
(widget-create 'push-button
|
||||
@ -97,14 +97,14 @@ Internal use, do not set this variable.")
|
||||
'face 'font-lock-keyword-face))
|
||||
(let ((len (- (line-end-position)
|
||||
(line-beginning-position))))
|
||||
(initial-buffer/center-line)
|
||||
(setq initial-buffer/buttons-line (count-lines 1 (point)))
|
||||
(setq initial-buffer/buttons-position (- (line-end-position)
|
||||
(init-buffer/center-line)
|
||||
(setq init-buffer/buttons-line (count-lines 1 (point)))
|
||||
(setq init-buffer/buttons-position (- (line-end-position)
|
||||
(line-beginning-position)
|
||||
len)))
|
||||
(insert "\n"))
|
||||
|
||||
(defun initial-buffer/center-line (&optional real-width)
|
||||
(defun init-buffer/center-line (&optional real-width)
|
||||
"When point is at the end of a line, center it.
|
||||
REAL-WIDTH: the real width of the line. If the line contains an image, the size
|
||||
of that image will be considered to be 1 by the calculation method
|
||||
@ -117,7 +117,7 @@ REAL-WIDTH: the real width of the line. If the line contains an image, the size
|
||||
(insert (make-string margin ?\s))
|
||||
(end-of-line)))
|
||||
|
||||
(defun initial-buffer/insert-file-list (list)
|
||||
(defun init-buffer/insert-file-list (list)
|
||||
"Insert an interactive list of files in the home buffer.
|
||||
LIST-DISPLAY-NAME: the displayed title of the list.
|
||||
LIST: a list of string pathnames made interactive in this function."
|
||||
@ -135,7 +135,7 @@ LIST: a list of string pathnames made interactive in this function."
|
||||
(abbreviate-file-name el)))
|
||||
list)))
|
||||
|
||||
(defun initial-buffer/subseq (seq start end)
|
||||
(defun init-buffer/subseq (seq start end)
|
||||
"Adapted version of `cl-subseq'.
|
||||
Use `cl-subseq', but accounting for end points greater than the size of the
|
||||
list. Return entire list if end is omitted.
|
||||
@ -144,7 +144,7 @@ SEQ, START and END are the same arguments as for `cl-subseq'"
|
||||
(cl-subseq seq start (and (number-or-marker-p end)
|
||||
(min len end)))))
|
||||
|
||||
(defun initial-buffer/get-buffer-width ()
|
||||
(defun init-buffer/get-buffer-width ()
|
||||
"Return the length of longest line in the current buffer."
|
||||
(save-excursion
|
||||
(goto-char 0)
|
||||
@ -156,12 +156,12 @@ SEQ, START and END are the same arguments as for `cl-subseq'"
|
||||
(forward-line 1))
|
||||
current-max)))
|
||||
|
||||
(defun initial-buffer/center-recentf ()
|
||||
(defun init-buffer/center-recentf ()
|
||||
"Centre recentf list after it was inserted."
|
||||
(let* ((lists-width (initial-buffer/get-buffer-width))
|
||||
(margin (max 0 (- initial-buffer/buttons-position
|
||||
initial-buffer/buttons-recentf-offset)))
|
||||
(final-padding (if (< lists-width initial-buffer/recentf-length-threshold)
|
||||
(let* ((lists-width (init-buffer/get-buffer-width))
|
||||
(margin (max 0 (- init-buffer/buttons-position
|
||||
init-buffer/buttons-recentf-offset)))
|
||||
(final-padding (if (< lists-width init-buffer/recentf-length-threshold)
|
||||
(max 0 (floor (/ (- (window-width) lists-width) 2)))
|
||||
margin)))
|
||||
(goto-char (point-min))
|
||||
@ -170,47 +170,47 @@ SEQ, START and END are the same arguments as for `cl-subseq'"
|
||||
(insert (make-string final-padding ?\s))
|
||||
(forward-line))))
|
||||
|
||||
(defun initial-buffer/insert-recentf ()
|
||||
(defun init-buffer/insert-recentf ()
|
||||
"Insert startup lists in home buffer."
|
||||
(goto-char (point-max))
|
||||
(save-restriction
|
||||
(narrow-to-region (point) (point))
|
||||
(recentf-mode)
|
||||
(when (initial-buffer/insert-file-list
|
||||
(initial-buffer/subseq recentf-list 0 initial-buffer/recentf-list-length)))
|
||||
(initial-buffer/center-recentf)))
|
||||
(when (init-buffer/insert-file-list
|
||||
(init-buffer/subseq recentf-list 0 init-buffer/recentf-list-length)))
|
||||
(init-buffer/center-recentf)))
|
||||
|
||||
(defun initial-buffer/goto-buffer ()
|
||||
(defun init-buffer/goto-buffer ()
|
||||
"Create the initial buffer and switch to it."
|
||||
(with-current-buffer (get-buffer-create initial-buffer/name)
|
||||
(with-current-buffer (get-buffer-create init-buffer/name)
|
||||
(let ((inhibit-read-only t))
|
||||
(erase-buffer)
|
||||
(initial-buffer/insert-banner)
|
||||
(initial-buffer/insert-buttons)
|
||||
(initial-buffer/insert-recentf))
|
||||
(initial-buffer-mode)
|
||||
(init-buffer/insert-banner)
|
||||
(init-buffer/insert-buttons)
|
||||
(init-buffer/insert-recentf))
|
||||
(init-buffer-mode)
|
||||
(goto-char (point-min))
|
||||
(forward-line (- initial-buffer/buttons-line 1))
|
||||
(move-to-column (- initial-buffer/buttons-position 1))
|
||||
(forward-line (- init-buffer/buttons-line 1))
|
||||
(move-to-column (- init-buffer/buttons-position 1))
|
||||
(current-buffer)))
|
||||
|
||||
(add-hook 'window-setup-hook
|
||||
(lambda ()
|
||||
(add-hook 'window-configuration-change-hook
|
||||
'initial-buffer/resize-on-hook)))
|
||||
'init-buffer/resize-on-hook)))
|
||||
|
||||
(defun initial-buffer/resize-on-hook ()
|
||||
(defun init-buffer/resize-on-hook ()
|
||||
"Hook run on window resize events to redisplay the home buffer."
|
||||
(let ((home-buffer (get-buffer-window initial-buffer/name)))
|
||||
(let ((home-buffer (get-buffer-window init-buffer/name)))
|
||||
(when home-buffer
|
||||
(with-selected-window home-buffer
|
||||
(initial-buffer/goto-buffer)))))
|
||||
(init-buffer/goto-buffer)))))
|
||||
|
||||
(defun initial-buffer/refresh ()
|
||||
(defun init-buffer/refresh ()
|
||||
"Force recreation of the spacemacs buffer."
|
||||
(interactive)
|
||||
(initial-buffer/goto-buffer))
|
||||
(init-buffer/goto-buffer))
|
||||
|
||||
(provide 'initial-buffer)
|
||||
(provide 'init-buffer)
|
||||
|
||||
;;; initial-buffer.el ends here
|
||||
;;; init-buffer.el ends here
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
43
init.el
43
init.el
@ -1,11 +1,9 @@
|
||||
;;; init.el --- Emacs Initialization File
|
||||
;;
|
||||
;; Copyright (c) 2017 Wojciech Kozlowski
|
||||
;; Copyright (c) 2017-2019 Wojciech Kozlowski
|
||||
;;
|
||||
;; Author: Wojciech Kozlowski <wk@wojciechkozlowski.eu>
|
||||
;; URL: https://gitlab.wojciechkozlowski.eu/config/emacs.d
|
||||
;; URL: https://github.com/Wojtek242/.emacs.d
|
||||
;; Created: 17 Aug 2017
|
||||
;; Created: 2017-08-17
|
||||
;;
|
||||
;;; License: GPLv3
|
||||
|
||||
@ -46,7 +44,7 @@
|
||||
;; Font ---------------------------------------------------------------------
|
||||
|
||||
(let* ((font-name "Source Code Pro")
|
||||
(font-size 10)
|
||||
(font-size 13.5)
|
||||
(font-spec (concat font-name "-" (int-to-string font-size))))
|
||||
|
||||
(set-frame-font font-spec nil t)
|
||||
@ -78,11 +76,11 @@
|
||||
;; Splash screen ------------------------------------------------------------
|
||||
|
||||
;; Add path.
|
||||
(add-to-list 'load-path "~/.emacs.d/initial-buffer")
|
||||
(require 'initial-buffer)
|
||||
(add-to-list 'load-path "~/.emacs.d/init-buffer")
|
||||
(require 'init-buffer)
|
||||
|
||||
;; Set the initial buffer.
|
||||
(setq initial-buffer-choice 'initial-buffer/goto-buffer)
|
||||
(setq-default init-buffer-choice 'init-buffer/goto-buffer)
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Change file in which custom variable changes are saved.
|
||||
@ -110,17 +108,14 @@
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(emodule/init '(
|
||||
em-editing
|
||||
em-emacs
|
||||
em-files
|
||||
em-helm
|
||||
em-modeline
|
||||
em-org
|
||||
em-parentheses
|
||||
em-programming
|
||||
em-terminal
|
||||
em-version-control
|
||||
em-workflow
|
||||
emacs
|
||||
helm
|
||||
languages
|
||||
modeline
|
||||
org
|
||||
programming
|
||||
terminal
|
||||
vcs
|
||||
))
|
||||
|
||||
|
||||
@ -137,16 +132,6 @@
|
||||
;; ;;
|
||||
;; *********************************************************************** ;;
|
||||
|
||||
|
||||
;; Add path.
|
||||
(add-to-list 'load-path "~/.emacs.d/ide-mode")
|
||||
(require 'ide-mode)
|
||||
(require 'ide-mode-config)
|
||||
(setq ide-mode/term-default (lambda () (ansi-term "zsh")))
|
||||
(define-key ide-mode-map (kbd "M-i") 'ide-mode/select-term-window)
|
||||
(ide-mode)
|
||||
(ide-mode/start)
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Load any custom variables.
|
||||
;; --------------------------------------------------------------------------
|
||||
|
@ -1,275 +0,0 @@
|
||||
;;; em-editing.el --- Module file for editing configuration.
|
||||
;;
|
||||
;; Copyright (C) 2017 Wojciech Kozlowski
|
||||
;;
|
||||
;; Author: Wojciech Kozlowski <wk@wojciechkozlowski.eu>
|
||||
;; Created: 25 Aug 2017
|
||||
;;
|
||||
;; This file is not part of GNU Emacs.
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This module sets up packages and configuration for editing text and code.
|
||||
;;
|
||||
;;; License: GPLv3
|
||||
|
||||
;;; Required packages:
|
||||
|
||||
;;; Code:
|
||||
|
||||
(defvar emodule/em-editing-packages
|
||||
|
||||
'(duplicate-thing
|
||||
expand-region
|
||||
fill-column-indicator
|
||||
undo-tree
|
||||
volatile-highlights
|
||||
whole-line-or-region
|
||||
ws-butler)
|
||||
|
||||
)
|
||||
|
||||
;; Configuration:
|
||||
|
||||
(defun emodule/em-editing-init ()
|
||||
"Initialise the `em-editing' module."
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Duplicate things.
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(use-package duplicate-thing
|
||||
:bind (("M-C" . duplicate-thing)))
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Expand region - intelligent select.
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(use-package expand-region
|
||||
:bind (("C-'" . er/expand-region)))
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Column indicator.
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(use-package fill-column-indicator
|
||||
:bind
|
||||
(("C-x t f" . fci-mode)))
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Undo tree. To undo "C-\", to redo "C-_", undo tree "C-x u".
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(use-package undo-tree
|
||||
:config
|
||||
(global-undo-tree-mode))
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Volatile highlights - highlight changes caused by undo, yank, etc.
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(use-package volatile-highlights
|
||||
:config
|
||||
(volatile-highlights-mode t))
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Kill line when calling kill-region without a selected region.
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(use-package whole-line-or-region
|
||||
:config
|
||||
(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))
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Non-package related editing settings.
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
;; Kill whole line when point at beginning of line.
|
||||
(setq-default kill-whole-line t)
|
||||
|
||||
;; Replace selected rather than inserting text at point.
|
||||
(delete-selection-mode)
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Use UTF-8.
|
||||
;; --------------------------------------------------------------------------
|
||||
(set-terminal-coding-system 'utf-8)
|
||||
(set-keyboard-coding-system 'utf-8)
|
||||
(set-language-environment "UTF-8")
|
||||
(prefer-coding-system 'utf-8)
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Formatting
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(setq-default
|
||||
;; Indentation size - applies even when indent-tabs-mode is nil.
|
||||
tab-width 8
|
||||
;; Do not use tab characters for indentation.
|
||||
indent-tabs-mode nil
|
||||
;; Standard fill-column width - last character is for end of line glyph.
|
||||
fill-column 79
|
||||
;; Highlight lines that are too long in whitespace mode.
|
||||
whitespace-line-column fill-column)
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Treat CamelCase as separate words.
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(global-subword-mode)
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Completion help.
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
;; hippie-expand is a better version of dabbrev-expand.
|
||||
(global-set-key (kbd "M-/") 'hippie-expand)
|
||||
|
||||
(setq-default
|
||||
hippie-expand-try-functions-list
|
||||
'(try-expand-dabbrev ;; Search current buffer.
|
||||
try-expand-dabbrev-all-buffers ;; Search all other buffers.
|
||||
try-expand-dabbrev-from-kill ;; Search the kill ring.
|
||||
try-complete-file-name-partially ;; Complete text partially as file name.
|
||||
try-complete-file-name ;; Complete text as file name.
|
||||
try-expand-all-abbrevs ;; Expand according to all abbrev tables.
|
||||
try-expand-list ;; Complete the current list to a list in the buffer.
|
||||
try-expand-line ;; Complete the current line to a line in the buffer.
|
||||
try-complete-lisp-symbol-partially ;; Complete partially as Elisp symbol.
|
||||
try-complete-lisp-symbol) ;; Complete as Elisp symbol.
|
||||
)
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Check spelling.
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(use-package flyspell
|
||||
:hook
|
||||
(((text-mode org-mode) . flyspell-mode)
|
||||
(prog-mode . flyspell-prog-mode))
|
||||
:config
|
||||
(if (executable-find "aspell")
|
||||
(progn
|
||||
(setq-default ispell-program-name "aspell")
|
||||
(setq-default ispell-extra-args '("--sug-mode=ultra")))
|
||||
(setq-default ispell-program-name "ispell"))
|
||||
(unbind-key "C-M-i" flyspell-mode-map))
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Commands.
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(defun unfill-paragraph (&optional region)
|
||||
"Takes a multi-line paragraph and makes it into a single line of text."
|
||||
(interactive (progn (barf-if-buffer-read-only) '(t)))
|
||||
(let ((fill-column (point-max))
|
||||
;; This would override `fill-column' if it's an integer.
|
||||
(emacs-lisp-docstring-fill-column t))
|
||||
(fill-paragraph nil region)))
|
||||
|
||||
(defun toggle-indent-tabs-mode ()
|
||||
"Toggle a indent-tabs-mode between a defined and undefined state."
|
||||
(interactive)
|
||||
(setq indent-tabs-mode (not indent-tabs-mode))
|
||||
(setq-default indent-tabs-mode indent-tabs-mode))
|
||||
|
||||
(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.
|
||||
|
||||
If ARG is not nil or 1, move forward ARG - 1 lines first. If
|
||||
point reaches the beginning or end of the buffer, stop
|
||||
there."
|
||||
|
||||
(interactive "^p")
|
||||
(setq arg (or arg 1))
|
||||
|
||||
;; Move lines first
|
||||
(when (/= arg 1)
|
||||
(let ((line-move-visual nil))
|
||||
(forward-line (1- arg))))
|
||||
|
||||
(let ((orig-point (point)))
|
||||
(back-to-indentation)
|
||||
(when (= orig-point (point))
|
||||
(move-beginning-of-line 1))))
|
||||
|
||||
(defun indent-buffer ()
|
||||
"Indent the currently visited buffer."
|
||||
(interactive)
|
||||
(indent-region (point-min) (point-max)))
|
||||
|
||||
(defcustom indent-sensitive-modes
|
||||
'(coffee-mode python-mode slim-mode haml-mode yaml-mode)
|
||||
"Modes for which auto-indenting is suppressed."
|
||||
:type 'list
|
||||
:group 'wk/editing)
|
||||
|
||||
(defun indent-region-or-buffer ()
|
||||
"Indent a region if selected, otherwise the whole buffer."
|
||||
(interactive)
|
||||
|
||||
(unless (member major-mode indent-sensitive-modes)
|
||||
(save-excursion
|
||||
(if (region-active-p)
|
||||
(indent-region (region-beginning) (region-end))
|
||||
(indent-buffer)
|
||||
(whitespace-cleanup)))))
|
||||
|
||||
(defun transpose-lines-down ()
|
||||
"Transpose the current line with the one below."
|
||||
(interactive)
|
||||
(next-line)
|
||||
(transpose-lines 1)
|
||||
(previous-line))
|
||||
|
||||
(defun transpose-lines-up ()
|
||||
"Transpose the current line with the one above."
|
||||
(interactive)
|
||||
(transpose-lines 1)
|
||||
(previous-line 2))
|
||||
|
||||
;; Key-bindings -------------------------------------------------------------
|
||||
|
||||
;; Override the beginning of line key-binding.
|
||||
(global-set-key (kbd "C-a") 'x-move-beginning-of-line)
|
||||
|
||||
;; Override the indent-region key-binding
|
||||
(global-set-key (kbd "C-M-\\") 'indent-region-or-buffer)
|
||||
|
||||
;; unfill-paragraph, closely related to fill-paragraph.
|
||||
(global-set-key (kbd "M-Q") 'unfill-paragraph)
|
||||
|
||||
;; Transpose-lines keybindings
|
||||
(global-set-key (kbd "M-<down>") 'transpose-lines-down)
|
||||
(global-set-key (kbd "M-<up>") 'transpose-lines-up)
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Additional key-bindings.
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
;; Toggle whitespace mode.
|
||||
(global-set-key (kbd "C-c w") 'whitespace-mode)
|
||||
|
||||
;; Occur. More convenient than "M-s o".
|
||||
(global-set-key (kbd "M-s M-o") 'occur)
|
||||
|
||||
;; Flyspell correct word. More convenient than C-c $.
|
||||
(global-set-key (kbd "C-c C-'") 'flyspell-correct-word-before-point)
|
||||
|
||||
)
|
||||
|
||||
(provide 'em-editing)
|
||||
;;; em-editing.el ends here
|
@ -1,277 +0,0 @@
|
||||
;;; em-emacs.el --- Module file for configuring Emacs itself.
|
||||
;;
|
||||
;; Copyright (C) 2017 Wojciech Kozlowski
|
||||
;;
|
||||
;; Author: Wojciech Kozlowski <wk@wojciechkozlowski.eu>
|
||||
;; Created: 25 Aug 2017
|
||||
;;
|
||||
;; This file is not part of GNU Emacs.
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This module is used for generic Emacs configuration.
|
||||
;;
|
||||
;;; License: GPLv3
|
||||
|
||||
;;; Required packages:
|
||||
|
||||
;;; Code:
|
||||
|
||||
(defvar emodule/em-emacs-packages
|
||||
|
||||
'(deadgrep
|
||||
discover-my-major
|
||||
ibuffer-vc
|
||||
objed
|
||||
pdf-tools
|
||||
rainbow-mode
|
||||
which-key
|
||||
use-package)
|
||||
|
||||
)
|
||||
|
||||
;;; Configuration:
|
||||
|
||||
(defun emodule/em-emacs-init ()
|
||||
"Initialise the `em-emacs' module."
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Enable objed.
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(use-package objed
|
||||
:bind
|
||||
(("M-/" . objed-activate))
|
||||
:config
|
||||
(unbind-key "M-o" objed-map))
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Use deadgrep.
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(use-package deadgrep
|
||||
:bind
|
||||
(("C-x C-g" . deadgrep)))
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Help extensions.
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(use-package info+)
|
||||
|
||||
(use-package discover-my-major
|
||||
:init
|
||||
(global-unset-key (kbd "C-h h"))
|
||||
:bind
|
||||
(("C-h h m" . discover-my-major)))
|
||||
|
||||
(use-package help+)
|
||||
|
||||
(use-package help-fns+)
|
||||
|
||||
(use-package help-mode+)
|
||||
|
||||
(use-package which-key
|
||||
:init
|
||||
(setq which-key-separator " ")
|
||||
(setq which-key-prefix-prefix "+")
|
||||
:config
|
||||
(which-key-mode 1))
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Configure `ibuffer'.
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(use-package ibuffer-vc
|
||||
:defer t
|
||||
:init
|
||||
(add-hook 'ibuffer-hook
|
||||
(lambda ()
|
||||
(ibuffer-vc-set-filter-groups-by-vc-root)
|
||||
(unless (eq ibuffer-sorting-mode 'alphabetic)
|
||||
(ibuffer-do-sort-by-alphabetic))))
|
||||
:config
|
||||
(setq ibuffer-formats
|
||||
'((mark modified read-only vc-status-mini " "
|
||||
(name 36 36 :left :elide)
|
||||
" "
|
||||
(size 9 -1 :right)
|
||||
" "
|
||||
(mode 16 16 :left :elide)
|
||||
" "
|
||||
(vc-status 16 16 :left)
|
||||
" "
|
||||
filename-and-process))))
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Rainbow mode.
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(use-package rainbow-mode
|
||||
:defer t)
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Keep point in same position on the screen when scrolling.
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(setq-default scroll-preserve-screen-position 1)
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Functions.
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(defun quit-other-window ()
|
||||
"Quit the next window in cyclic order"
|
||||
(interactive)
|
||||
(quit-window t (next-window (selected-window))))
|
||||
|
||||
(defun kill-default-buffer ()
|
||||
"Kill the currently active buffer with no confirmation."
|
||||
(interactive)
|
||||
(let (kill-buffer-query-functions) (kill-buffer)))
|
||||
|
||||
(defun refresh-non-face-colours ()
|
||||
"Restart modes that use colours not set with face variables.
|
||||
This has to be called whenever the active theme changes to
|
||||
refresh these colours."
|
||||
|
||||
(when (and (fboundp 'fci-mode)
|
||||
(member 'fci-mode minor-mode-list))
|
||||
(fci-mode 1))
|
||||
|
||||
(when (and (fboundp 'highlight-parentheses-mode)
|
||||
highlight-parentheses-mode)
|
||||
(highlight-parentheses-mode 1)))
|
||||
|
||||
;; Key-bindings -------------------------------------------------------------
|
||||
|
||||
;; Kill other window (cyclic order).
|
||||
(global-set-key (kbd "C-z") 'quit-other-window)
|
||||
|
||||
;; Kill current buffer without prompting.
|
||||
(global-set-key (kbd "C-x k") 'kill-default-buffer)
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Additional key-bindings.
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
;; 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)
|
||||
(let ((scroll-preserve-screen-position nil))
|
||||
(scroll-down 1))))
|
||||
(global-set-key (kbd "C->") (lambda()
|
||||
(interactive)
|
||||
(let ((scroll-preserve-screen-position nil))
|
||||
(scroll-up 1))))
|
||||
|
||||
;; Recursive grep. Use only if ripgrep not present.
|
||||
(unless (executable-find "rg")
|
||||
(global-set-key (kbd "C-x C-g") 'rgrep))
|
||||
|
||||
;; Setup key-bindings for switching between themes.
|
||||
(global-set-key (kbd "C-x t l") (lambda ()
|
||||
(interactive)
|
||||
(load-theme 'havoc-light t)
|
||||
(refresh-non-face-colours)))
|
||||
(global-set-key (kbd "C-x t d") (lambda ()
|
||||
(interactive)
|
||||
(load-theme 'havoc-dark t)
|
||||
(refresh-non-face-colours)))
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Update buffers when files change.
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(global-auto-revert-mode)
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Aliases.
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
;; y or n is enough.
|
||||
(defalias 'yes-or-no-p 'y-or-n-p)
|
||||
|
||||
;; Always use ibuffer.
|
||||
(defalias 'list-buffers 'ibuffer)
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Address mode.
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(add-hook 'prog-mode-hook 'goto-address-mode)
|
||||
(add-hook 'text-mode-hook 'goto-address-mode)
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Use PDF Tools instead of DocView.
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(use-package pdf-tools
|
||||
:config
|
||||
(pdf-tools-install))
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Tramp configuration.
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(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.
|
||||
(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.
|
||||
(add-to-list 'tramp-default-proxies-alist '("localhost" "\\`root\\'" nil))
|
||||
|
||||
(defun sudo ()
|
||||
"Use TRAMP to `sudo' the current buffer"
|
||||
(interactive)
|
||||
(when buffer-file-name
|
||||
(find-alternate-file
|
||||
(concat "/sudo:root@localhost:"
|
||||
buffer-file-name)))))
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Configure garbage collection.
|
||||
;;
|
||||
;; Based on advice from:
|
||||
;; http://bling.github.io/blog/2016/01/18/why-are-you-changing-gc-cons-threshold/
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(defun minibuffer-gc-setup-hook ()
|
||||
(setq gc-cons-threshold most-positive-fixnum))
|
||||
|
||||
(defun minibuffer-gc-exit-hook ()
|
||||
(setq gc-cons-threshold 800000))
|
||||
|
||||
(add-hook 'minibuffer-setup-hook #'minibuffer-gc-setup-hook)
|
||||
(add-hook 'minibuffer-exit-hook #'minibuffer-gc-exit-hook)
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Increase recursion limits.
|
||||
;; --------------------------------------------------------------------------
|
||||
(setq-default max-specpdl-size 20000) ;; ~15x original value
|
||||
(setq-default max-lisp-eval-depth 24000) ;; 30x orignal value
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; This slows down cursor scrolling.
|
||||
;; --------------------------------------------------------------------------
|
||||
(setq-default auto-window-vscroll nil)
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Add directories to exec-path.
|
||||
;; --------------------------------------------------------------------------
|
||||
(setq exec-path (append exec-path '("/home/wojtek/.local/bin"
|
||||
"/home/wojtek/.cask/bin")))
|
||||
|
||||
)
|
||||
|
||||
(provide 'em-emacs)
|
||||
;;; em-emacs.el ends here
|
@ -1,206 +0,0 @@
|
||||
;;; em-files.el --- Module file for configuring file management.
|
||||
;;
|
||||
;; Copyright (C) 2017 Wojciech Kozlowski
|
||||
;;
|
||||
;; Author: Wojciech Kozlowski <wk@wojciechkozlowski.eu>
|
||||
;; Created: 25 Aug 2017
|
||||
;;
|
||||
;; This file is not part of GNU Emacs.
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This module is used for configuring file management within Emacs.
|
||||
;;
|
||||
;;; License: GPLv3
|
||||
|
||||
;;; Required packages:
|
||||
|
||||
;;; Code:
|
||||
|
||||
(defvar emodule/em-files-packages
|
||||
|
||||
'(recentf-ext
|
||||
treemacs
|
||||
treemacs-projectile
|
||||
treemacs-icons-dired
|
||||
treemacs-magit
|
||||
vlf)
|
||||
|
||||
)
|
||||
|
||||
;;; Configuration:
|
||||
|
||||
(defun emodule/em-files-init ()
|
||||
"Initialise the `em-files' module."
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; View large files.
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(use-package vlf-integrate
|
||||
:defer t
|
||||
:init
|
||||
(setq-default vlf-application 'dont-ask))
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Large file threshold.
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(setq large-file-warning-threshold 10485760) ;; 10 MB
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Back up settings.
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(defvar backup-directory "~/.emacs.d/.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.
|
||||
backup-directory-alist `((".*" . ,backup-directory))
|
||||
;; Copy the current file into backup directory.
|
||||
backup-by-copying t
|
||||
;; Version numbers for backup files.
|
||||
version-control t
|
||||
;; Delete unnecessary versions.
|
||||
delete-old-versions t
|
||||
;; Oldest versions to keep when a new numbered backup is made.
|
||||
kept-old-versions 2
|
||||
;; Newest versions to keep when a new numbered backup is made.
|
||||
kept-new-versions 3
|
||||
;; Auto-save every buffer that visits a file.
|
||||
auto-save-default t
|
||||
;; Number of seconds idle time before auto-save.
|
||||
auto-save-timeout 30
|
||||
;; Number of keystrokes between auto-saves.
|
||||
auto-save-interval 300)
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Dired.
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(use-package dired
|
||||
:config
|
||||
(setq
|
||||
;; If another Dired buffer is visible, use it as target for Rename/Copy.
|
||||
dired-dwim-target t
|
||||
;; "always" means no asking.
|
||||
dired-recursive-copies 'always
|
||||
;; "top" means ask once for top level directory.
|
||||
dired-recursive-deletes 'top
|
||||
;; Human-readable listing
|
||||
dired-listing-switches "-lha --group-directories-first"
|
||||
)
|
||||
|
||||
;; Automatically refresh dired buffer on changes.
|
||||
(add-hook 'dired-mode-hook 'auto-revert-mode))
|
||||
|
||||
(use-package dired-x
|
||||
:after dired
|
||||
:init
|
||||
(add-hook 'dired-mode-hook 'dired-omit-mode)
|
||||
:config
|
||||
(setq-default dired-omit-files "^\\.\\|^\\#"))
|
||||
|
||||
(use-package wdired
|
||||
:after dired
|
||||
:config
|
||||
(setq-default wdired-allow-to-change-permissions t
|
||||
wdired-allow-to-redirect-links t))
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Recentf.
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(recentf-mode 1)
|
||||
(use-package recentf-ext)
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Remember location in file.
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(use-package saveplace
|
||||
:init
|
||||
(save-place-mode 1))
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Treemacs.
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(use-package treemacs
|
||||
:defer t
|
||||
:init
|
||||
(with-eval-after-load 'winum
|
||||
(define-key winum-keymap (kbd "M-m") #'treemacs-select-window))
|
||||
:config
|
||||
(progn
|
||||
(setq treemacs-collapse-dirs (if (executable-find "python") 3 0)
|
||||
treemacs-deferred-git-apply-delay 0.5
|
||||
treemacs-display-in-side-window t
|
||||
treemacs-file-event-delay 5000
|
||||
treemacs-file-follow-delay 0.2
|
||||
treemacs-follow-after-init t
|
||||
treemacs-git-command-pipe ""
|
||||
treemacs-goto-tag-strategy 'refetch-index
|
||||
treemacs-indentation 2
|
||||
treemacs-indentation-string " "
|
||||
treemacs-is-never-other-window t
|
||||
treemacs-max-git-entries 5000
|
||||
treemacs-no-png-images nil
|
||||
treemacs-no-delete-other-windows t
|
||||
treemacs-project-follow-cleanup nil
|
||||
treemacs-persist-file (expand-file-name ".cache/treemacs-persist" user-emacs-directory)
|
||||
treemacs-recenter-distance 0.1
|
||||
treemacs-recenter-after-file-follow nil
|
||||
treemacs-recenter-after-tag-follow nil
|
||||
treemacs-recenter-after-project-jump 'always
|
||||
treemacs-recenter-after-project-expand 'on-distance
|
||||
treemacs-show-cursor nil
|
||||
treemacs-show-hidden-files t
|
||||
treemacs-silent-filewatch nil
|
||||
treemacs-silent-refresh nil
|
||||
treemacs-sorting 'alphabetic-desc
|
||||
treemacs-space-between-root-nodes t
|
||||
treemacs-tag-follow-cleanup t
|
||||
treemacs-tag-follow-delay 1.5
|
||||
treemacs-width 35)
|
||||
|
||||
;; The default width and height of the icons is 22 pixels. If you are
|
||||
;; using a Hi-DPI display, uncomment this to double the icon size.
|
||||
;;(treemacs-resize-icons 44)
|
||||
|
||||
(treemacs-follow-mode t)
|
||||
(treemacs-filewatch-mode t)
|
||||
(treemacs-fringe-indicator-mode t)
|
||||
(pcase (cons (not (null (executable-find "git")))
|
||||
(not (null (executable-find "python3"))))
|
||||
(`(t . t)
|
||||
(treemacs-git-mode 'deferred))
|
||||
(`(t . _)
|
||||
(treemacs-git-mode 'simple))))
|
||||
|
||||
:bind
|
||||
(:map global-map
|
||||
("M-m" . treemacs-select-window)
|
||||
("C-x t 1" . treemacs-delete-other-windows)
|
||||
("C-x t t" . treemacs)
|
||||
("C-x t B" . treemacs-bookmark)
|
||||
("C-x t C-t" . treemacs-find-file)
|
||||
("C-x t M-t" . treemacs-find-tag)))
|
||||
|
||||
(use-package treemacs-projectile
|
||||
:defer t)
|
||||
|
||||
(use-package treemacs-magit
|
||||
:defer t)
|
||||
|
||||
(use-package treemacs-icons-dired
|
||||
:hook (dired-mode . treemacs-icons-dired-mode))
|
||||
|
||||
)
|
||||
|
||||
(provide 'em-files)
|
||||
;;; em-files.el ends here
|
@ -1,113 +0,0 @@
|
||||
;;; em-modeline.el --- Module file for configuring the modeline.
|
||||
;;
|
||||
;; Copyright (C) 2018 Wojciech Kozlowski
|
||||
;;
|
||||
;; Author: Wojciech Kozlowski <wk@wojciechkozlowski.eu>
|
||||
;; Created: 11 Feb 2018
|
||||
;;
|
||||
;; This file is not part of GNU Emacs.
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This module is used for configuring the modeline.
|
||||
;;
|
||||
;;; License: GPLv3
|
||||
|
||||
;;; Required packages:
|
||||
|
||||
;;; Code:
|
||||
|
||||
;; FIXME: move back to doom-modeline package
|
||||
;; Currently, I'm running doom-modeline from a local checkout, because the
|
||||
;; newest versions don't play nicely with treemacs.
|
||||
|
||||
(defvar emodule/em-modeline-packages
|
||||
|
||||
'(anzu
|
||||
;; doom-modeline
|
||||
|
||||
;; doom-modeline dependencies.
|
||||
;; Needed to load from local checkout.
|
||||
all-the-icons
|
||||
eldoc-eval
|
||||
shrink-path
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
;;; Configuration:
|
||||
|
||||
(defun emodule/em-modeline-init ()
|
||||
"Initialise the `em-modeline' module."
|
||||
|
||||
;; 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'.
|
||||
(add-to-list 'load-path "~/.emacs.d/doom-modeline")
|
||||
(use-package doom-modeline
|
||||
:hook
|
||||
(after-init . doom-modeline-init)
|
||||
:config
|
||||
(setq-default doom-modeline-height 23)
|
||||
|
||||
;; Set anzu-mode
|
||||
(use-package anzu
|
||||
:config
|
||||
(global-anzu-mode 1))
|
||||
|
||||
;; Add perspective to modeline
|
||||
(doom-modeline-def-segment perspective-name
|
||||
"Perspectives list and selection. Requires `persp-mode' to be enabled."
|
||||
(if (bound-and-true-p persp-mode)
|
||||
(persp-format-name (persp-name (persp-curr)))
|
||||
""))
|
||||
|
||||
(doom-modeline-def-segment workspace-number
|
||||
"The current workspace name or number. Requires `eyebrowse-mode' to be
|
||||
enabled."
|
||||
(if (bound-and-true-p eyebrowse-mode)
|
||||
(let* ((num (eyebrowse--get 'current-slot))
|
||||
(tag (when num (nth 2 (assoc num (eyebrowse--get 'window-configs)))))
|
||||
(str (if (and tag (< 0 (length tag)))
|
||||
tag
|
||||
(when num (int-to-string num)))))
|
||||
(propertize str 'face 'eyebrowse-mode-line-active))
|
||||
""))
|
||||
|
||||
;; 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))))
|
||||
|
||||
;; Set the modeline
|
||||
(setq column-number-mode t)
|
||||
(setq doom-modeline-python-executable "python3")
|
||||
(doom-modeline-def-modeline 'main
|
||||
|
||||
'(bar
|
||||
"["
|
||||
perspective-name
|
||||
":"
|
||||
workspace-number
|
||||
"]"
|
||||
window-number
|
||||
matches
|
||||
buffer-info
|
||||
remote-host
|
||||
buffer-position
|
||||
selection-info)
|
||||
|
||||
'(lsp
|
||||
debug
|
||||
buffer-encoding
|
||||
major-mode
|
||||
vcs
|
||||
checker))
|
||||
)
|
||||
)
|
||||
|
||||
(provide 'em-modeline)
|
||||
;;; em-modeline.el ends here
|
@ -1,123 +0,0 @@
|
||||
;;; em-parentheses.el --- Module file for managing parentheses packages.
|
||||
;;
|
||||
;; Copyright (C) 2017 Wojciech Kozlowski
|
||||
;;
|
||||
;; Author: Wojciech Kozlowski <wk@wojciechkozlowski.eu>
|
||||
;; Created: 28 Aug 2017
|
||||
;;
|
||||
;; This file is not part of GNU Emacs.
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This module sets up configuration for packages that manage parentheses in
|
||||
;; code and text.
|
||||
;;
|
||||
;;; License: GPLv3
|
||||
|
||||
;;; Required packages:
|
||||
|
||||
;;; Code:
|
||||
|
||||
(defvar emodule/em-parentheses-packages
|
||||
|
||||
'(highlight-parentheses
|
||||
rainbow-delimiters
|
||||
smartparens)
|
||||
|
||||
)
|
||||
|
||||
;; Configuration:
|
||||
|
||||
(defun emodule/em-parentheses-init ()
|
||||
"Initialise the `em-parentheses' module."
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; 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))
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Rainbow delimiters - colours are set by theme.
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(use-package rainbow-delimiters
|
||||
:hook
|
||||
(prog-mode . rainbow-delimiters-mode))
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Smartparens highlighting.
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(use-package smartparens
|
||||
:config
|
||||
(smartparens-global-mode t)
|
||||
(show-smartparens-global-mode t)
|
||||
|
||||
(require 'smartparens-config)
|
||||
|
||||
;; 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)
|
||||
|
||||
(define-key smartparens-mode-map (kbd "C-M-u") 'sp-backward-up-sexp)
|
||||
(define-key smartparens-mode-map (kbd "C-M-S-u") 'sp-up-sexp)
|
||||
|
||||
(define-key smartparens-mode-map (kbd "C-M-d") 'sp-down-sexp)
|
||||
(define-key smartparens-mode-map (kbd "C-M-S-d") 'sp-backward-down-sexp)
|
||||
|
||||
(define-key smartparens-mode-map (kbd "C-S-a") 'sp-beginning-of-sexp)
|
||||
(define-key smartparens-mode-map (kbd "C-S-e") 'sp-end-of-sexp)
|
||||
|
||||
(define-key smartparens-mode-map (kbd "C-M-t") 'sp-transpose-sexp)
|
||||
|
||||
(define-key smartparens-mode-map (kbd "C-M-n") 'sp-next-sexp)
|
||||
(define-key smartparens-mode-map (kbd "C-M-p") 'sp-previous-sexp)
|
||||
|
||||
(define-key smartparens-mode-map (kbd "C-M-k") 'sp-kill-sexp)
|
||||
(define-key smartparens-mode-map (kbd "C-M-w") 'sp-copy-sexp)
|
||||
|
||||
(define-key smartparens-mode-map (kbd "C-<right>") 'sp-forward-slurp-sexp)
|
||||
(define-key smartparens-mode-map (kbd "C-<left>") 'sp-forward-barf-sexp)
|
||||
|
||||
(define-key smartparens-mode-map (kbd "M-D") 'sp-splice-sexp)
|
||||
(define-key smartparens-mode-map (kbd "C-S-d") 'sp-splice-sexp-killing-forward)
|
||||
(define-key smartparens-mode-map (kbd "C-M-<backspace>") 'sp-splice-sexp-killing-backward)
|
||||
(define-key smartparens-mode-map (kbd "C-S-<backspace>") 'sp-splice-sexp-killing-around)
|
||||
|
||||
(define-key smartparens-mode-map (kbd "C-]") 'sp-select-next-thing-exchange)
|
||||
(define-key smartparens-mode-map (kbd "C-M-]") 'sp-select-next-thing)
|
||||
|
||||
(define-key smartparens-mode-map (kbd "M-F") 'sp-forward-symbol)
|
||||
(define-key smartparens-mode-map (kbd "M-B") 'sp-backward-symbol)
|
||||
|
||||
(define-key smartparens-mode-map (kbd "C-c f")
|
||||
(lambda () (interactive) (sp-beginning-of-sexp 2)))
|
||||
(define-key smartparens-mode-map (kbd "C-c b")
|
||||
(lambda () (interactive) (sp-beginning-of-sexp -2)))
|
||||
|
||||
;; rst-mode
|
||||
(sp-with-modes 'rst-mode
|
||||
(sp-local-pair "`" nil :actions nil)
|
||||
(sp-local-pair "``" "``"))
|
||||
|
||||
;; Smartparens custom settings --------------------------------------------
|
||||
|
||||
(setq-default
|
||||
;; Jump to closing parenthesis when closing symbol is typed.
|
||||
sp-autoskip-closing-pair t
|
||||
;; Do not automatically reindent anything.
|
||||
sp-navigate-reindent-after-up nil
|
||||
sp-navigate-reindent-after-up-in-string nil
|
||||
;; Do not highlight space between parentheses.
|
||||
sp-highlight-pair-overlay nil))
|
||||
|
||||
)
|
||||
|
||||
(provide 'em-parentheses)
|
||||
;;; em-parentheses.el ends here
|
@ -1,572 +0,0 @@
|
||||
;;; em-programming.el --- Module file for programming configuration.
|
||||
;;
|
||||
;; Copyright (C) 2017 Wojciech Kozlowski
|
||||
;;
|
||||
;; Author: Wojciech Kozlowski <wk@wojciechkozlowski.eu>
|
||||
;; Created: 28 Aug 2017
|
||||
;;
|
||||
;; This file is not part of GNU Emacs.
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This module sets up packages and configuration for editing source code in
|
||||
;; all languages.
|
||||
;;
|
||||
;;; License: GPLv3
|
||||
|
||||
;;; Required packages:
|
||||
|
||||
;;; Code:
|
||||
|
||||
(defvar emodule/em-programming-packages
|
||||
|
||||
'(cargo
|
||||
ccls
|
||||
company
|
||||
company-c-headers
|
||||
company-lsp
|
||||
dockerfile-mode
|
||||
elpy
|
||||
feature-mode
|
||||
fic-mode
|
||||
function-args
|
||||
flycheck
|
||||
flycheck-haskell
|
||||
flycheck-plantuml
|
||||
flycheck-pos-tip
|
||||
flycheck-rust
|
||||
haskell-mode
|
||||
highlight-numbers
|
||||
highlight-symbol
|
||||
lsp-mode
|
||||
lsp-ui
|
||||
plantuml-mode
|
||||
py-autopep8
|
||||
rust-mode
|
||||
stickyfunc-enhance
|
||||
swiper
|
||||
toml-mode
|
||||
vala-mode
|
||||
yaml-mode
|
||||
yasnippet
|
||||
yasnippet-snippets)
|
||||
|
||||
)
|
||||
|
||||
;; Configuration:
|
||||
|
||||
(defun emodule/em-programming-init ()
|
||||
"Initialise the `em-programming' module."
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Set up LSP first.
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(use-package lsp-mode
|
||||
:commands lsp
|
||||
:config
|
||||
(require 'lsp-clients)
|
||||
(setq lsp-enable-indentation nil))
|
||||
|
||||
(use-package lsp-ui
|
||||
:commands lsp-ui-mode
|
||||
:bind (("C-M-i" . lsp-ui-imenu))
|
||||
:init
|
||||
(setq lsp-ui-doc-enable nil)
|
||||
(setq lsp-prefer-flymake nil)
|
||||
: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))
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Company - complete anything.
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(use-package company
|
||||
:hook
|
||||
(after-init . global-company-mode)
|
||||
:config
|
||||
(setq company-idle-delay 0
|
||||
company-minimum-prefix-length 3
|
||||
company-tooltip-align-annotations t)
|
||||
;; For this to correctly complete headers, need to add all include paths to
|
||||
;; `company-c-headers-path-system'.
|
||||
(add-to-list 'company-backends 'company-c-headers)
|
||||
(setq company-backends (delete 'company-clang company-backends))
|
||||
(setq company-backends (delete 'company-dabbrev company-backends))
|
||||
(setq company-backends (delete 'company-capf company-backends)))
|
||||
|
||||
(use-package company-lsp
|
||||
:commands company-lsp)
|
||||
|
||||
;; Functions args -----------------------------------------------------------
|
||||
|
||||
(use-package function-args
|
||||
:config
|
||||
(use-package ivy)
|
||||
(fa-config-default)
|
||||
|
||||
(defun set-other-window-key ()
|
||||
;; function-args overrides the custom "M-o" binding, this undoes it
|
||||
(define-key function-args-mode-map (kbd "M-o") nil)
|
||||
(define-key function-args-mode-map (kbd "M-O") 'moo-complete))
|
||||
|
||||
(defun set-moo-jump-directory-key ()
|
||||
;; function-args overrides the default "C-M-k" binding, this undoes it
|
||||
(define-key function-args-mode-map (kbd "C-M-k") nil)
|
||||
(define-key function-args-mode-map (kbd "C-M-;") 'moo-jump-directory))
|
||||
|
||||
(defun set-fa-idx-cycle-keys ()
|
||||
;; function-args overrides the default "M-h" and "M-p" bindings, this
|
||||
;; undoes it
|
||||
(define-key function-args-mode-map (kbd "M-h") nil)
|
||||
(define-key function-args-mode-map (kbd "M-[") 'fa-idx-cycle-up)
|
||||
(define-key function-args-mode-map (kbd "M-n") nil)
|
||||
(define-key function-args-mode-map (kbd "M-]") 'fa-idx-cycle-down))
|
||||
|
||||
(defun set-fa-abort-key ()
|
||||
;; function-args overrides the default "C-M-k" binding, this undoes it
|
||||
(define-key function-args-mode-map (kbd "M-u") nil)
|
||||
(define-key function-args-mode-map (kbd "M-k") 'fa-abort))
|
||||
|
||||
(defun set-function-args-keys ()
|
||||
;; Collects all the function-args key overrides
|
||||
(set-other-window-key)
|
||||
(set-moo-jump-directory-key)
|
||||
(set-fa-idx-cycle-keys)
|
||||
(set-fa-abort-key))
|
||||
|
||||
(add-hook 'function-args-mode-hook #'set-function-args-keys))
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Configure dockerfile environment.
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(use-package dockerfile-mode
|
||||
:defer t)
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Enable elpy.
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(use-package python
|
||||
:init
|
||||
(setq python-shell-interpreter "python3")
|
||||
:hook
|
||||
(python-mode . lsp))
|
||||
|
||||
(use-package elpy
|
||||
:hook (python-mode . elpy-mode)
|
||||
:after flycheck
|
||||
:init (elpy-enable)
|
||||
:config
|
||||
(unbind-key "C-c C-f" python-mode-map)
|
||||
(unbind-key "C-c C-f" elpy-mode-map)
|
||||
(setq elpy-rpc-python-command "python3")
|
||||
(setq python-shell-interpreter "ipython3"
|
||||
python-shell-interpreter-args "-i --simple-prompt")
|
||||
|
||||
(setq elpy-modules (delq 'elpy-module-flymake elpy-modules))
|
||||
(add-hook 'elpy-mode-hook 'flycheck-mode))
|
||||
|
||||
(use-package py-autopep8
|
||||
;; Note that this package require autopep8 to be installed.
|
||||
:bind (("C-c C-f" . py-autopep8-buffer)))
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Configure feature mode for use with `ecukes' for Emacs package
|
||||
;; development.
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(use-package feature-mode
|
||||
:defer t)
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; FIC mode.
|
||||
;; --------------------------------------------------------------------------
|
||||
(use-package fic-mode
|
||||
:hook
|
||||
(prog-mode . fic-mode))
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Flycheck mode.
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(use-package flycheck
|
||||
:hook
|
||||
(after-init . global-flycheck-mode))
|
||||
|
||||
(use-package flycheck-pos-tip
|
||||
:after flycheck
|
||||
:config
|
||||
(flycheck-pos-tip-mode)
|
||||
(add-hook 'flycheck-mode-hook #'flycheck-rust-setup))
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Highlights.
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(use-package highlight-numbers
|
||||
:hook
|
||||
(prog-mode . highlight-numbers-mode))
|
||||
|
||||
(use-package highlight-symbol
|
||||
:hook
|
||||
((prog-mode org-mode) . highlight-symbol-mode)
|
||||
:bind
|
||||
(("M-n" . highlight-symbol-next)
|
||||
("M-p" . highlight-symbol-prev))
|
||||
:config
|
||||
(highlight-symbol-nav-mode)
|
||||
(setq highlight-symbol-idle-delay 0.2
|
||||
highlight-symbol-on-navigation-p t))
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Haskell.
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(use-package haskell-mode
|
||||
:after flycheck
|
||||
:hook
|
||||
(require flycheck-haskell)
|
||||
(haskell-mode . flycheck-haskell-setup))
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Configure Rust environment.
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(defun rust-new-project (project-name project-type)
|
||||
(let ((rust-cargo-bin "cargo"))
|
||||
(unless (executable-find rust-cargo-bin)
|
||||
(error "Could not locate executable \"%s\"" rust-cargo-bin))
|
||||
|
||||
(let* ((tmpf (make-temp-file "*cargo-new*"))
|
||||
(err-msg "")
|
||||
(ret (call-process
|
||||
rust-cargo-bin
|
||||
nil tmpf t
|
||||
"new" project-name (concat "--" project-type))))
|
||||
|
||||
(with-current-buffer (get-buffer-create tmpf)
|
||||
(setq err-msg (buffer-string))
|
||||
(kill-buffer))
|
||||
|
||||
(unless (= ret 0)
|
||||
(error err-msg)))))
|
||||
|
||||
(defun rust-new-project-bin (project-name)
|
||||
(interactive "sBinary project name: ")
|
||||
(rust-new-project project-name "bin"))
|
||||
|
||||
(defun rust-new-project-lib (project-name)
|
||||
(interactive "sLibrary project name: ")
|
||||
(rust-new-project project-name "lib"))
|
||||
|
||||
;; LSP requires RLS, install with
|
||||
;; rustup component add rls rust-analysis rust-src
|
||||
(use-package rust-mode
|
||||
:defer t
|
||||
:hook (rust-mode . lsp)
|
||||
:config
|
||||
(setq exec-path (append exec-path '("/home/wojtek/.cargo/bin")))
|
||||
(add-hook 'rust-mode-hook 'flycheck-mode))
|
||||
|
||||
;; Add keybindings for interacting with Cargo
|
||||
(use-package cargo
|
||||
:hook (rust-mode . cargo-minor-mode))
|
||||
|
||||
(use-package toml-mode
|
||||
:mode "\\.lock\\'")
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Configure `swiper'.
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(use-package swiper
|
||||
:bind
|
||||
(("M-s M-s" . swiper))
|
||||
:config
|
||||
(setq ivy-count-format "%d/%d "))
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; plantuml-mode
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(use-package plantuml-mode
|
||||
:mode "\\.pu\\'"
|
||||
:init
|
||||
(setq-default plantuml-jar-path "~/.emacs.d/plantuml.jar")
|
||||
:config
|
||||
(require 'flycheck-plantuml))
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Configure Vala environment.
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(use-package vala-mode
|
||||
:defer t
|
||||
:config
|
||||
(add-to-list 'file-coding-system-alist '("\\.vala$" . utf-8))
|
||||
(add-to-list 'file-coding-system-alist '("\\.vapi$" . utf-8)))
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Configure HDL environment.
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(use-package vhdl-mode
|
||||
:mode "\\.hdl\\'")
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Configure yaml environment.
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(use-package yaml-mode
|
||||
:config
|
||||
(add-hook 'yaml-mode-hook #'linum-mode))
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Enable yasnippet.
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(use-package yasnippet
|
||||
:config
|
||||
(yas-global-mode 1)
|
||||
|
||||
(define-key yas-minor-mode-map [(tab)] nil)
|
||||
(define-key yas-minor-mode-map (kbd "TAB") nil)
|
||||
(define-key yas-minor-mode-map (kbd "<tab>") nil)
|
||||
(define-key yas-minor-mode-map (kbd "<C-return>") 'yas-expand))
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Configure C/C++.
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(use-package cc-mode
|
||||
:defer t)
|
||||
|
||||
(use-package ccls
|
||||
:hook ((c-mode c++-mode objc-mode) .
|
||||
(lambda () (require 'ccls) (lsp))))
|
||||
|
||||
;; For this to work, need to specify project roots in the variable
|
||||
;; `ede-cpp-root-project', e.g.
|
||||
;; (ede-cpp-root-project "project_root"
|
||||
;; :file "/dir/to/project_root/Makefile"
|
||||
;; :include-path '("/include1"
|
||||
;; "/include2") ;; add more include
|
||||
;; ;; paths here
|
||||
;; :system-include-path '("~/linux"))
|
||||
;; May need to run `semantic-force-refresh' afterwards.
|
||||
(use-package ede
|
||||
:config
|
||||
(global-ede-mode))
|
||||
|
||||
(add-hook 'c-mode-common-hook 'hs-minor-mode)
|
||||
|
||||
;; Emacs C/C++ settings.
|
||||
(setq c-basic-offset 4)
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Debugging options.
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(use-package gud
|
||||
:defer t
|
||||
:config
|
||||
(setq gud-chdir-before-run nil))
|
||||
|
||||
(setq-default
|
||||
;; Use gdb-many-windows by default.
|
||||
gdb-many-windows t
|
||||
;; Display source file containing main.
|
||||
gdb-show-main t)
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Setup compilation-mode used by `compile' command
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(use-package compile
|
||||
:bind
|
||||
(("C-c c" . compile)
|
||||
("C-c r" . recompile))
|
||||
:config
|
||||
(setq-default
|
||||
;; Default compile commande
|
||||
compile-command "make "
|
||||
;; Just save before compiling.
|
||||
compilation-ask-about-save nil
|
||||
;; Just kill old compile processes before starting the new one.
|
||||
compilation-always-kill t
|
||||
;; Automatically scroll to first error.
|
||||
compilation-scroll-output 'first-error)
|
||||
|
||||
;; ansi-colors
|
||||
(ignore-errors
|
||||
(require 'ansi-color)
|
||||
(defun my-colorize-compilation-buffer ()
|
||||
(when (eq major-mode 'compilation-mode)
|
||||
(ansi-color-apply-on-region compilation-filter-start (point-max))))
|
||||
(add-hook 'compilation-filter-hook 'my-colorize-compilation-buffer)))
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Makefile settings.
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(defun makefile-mode-tabs ()
|
||||
(whitespace-toggle-options '(tabs))
|
||||
(setq indent-tabs-mode t))
|
||||
|
||||
(add-hook 'makefile-mode-hook 'makefile-mode-tabs)
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Line numbers.
|
||||
;;
|
||||
;; Ideally, we could just use linum-format "%4d \u2502". However, the
|
||||
;; unicode character for the vertical line causes the screen to flicker on
|
||||
;; some screens when typing or moving the cursor. Using `nlinum' does not
|
||||
;; solve the problem. A compromise is to instead use a whitespace character
|
||||
;; of a different colour.
|
||||
;;
|
||||
;; Furthermore, since `linum' can struggle with large buffers, it is disabled
|
||||
;; once the number of lines cannot fit into linum-format anymore. `nlinum'
|
||||
;; is meant to solve the problem, but it updates line numbers after a visible
|
||||
;; pause if a line is inderted/deleted.
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(defun linum-format-func (line)
|
||||
(concat
|
||||
(propertize (format "%4d " line) 'face 'linum)
|
||||
(propertize " " 'face 'mode-line-inactive)))
|
||||
|
||||
(setq-default linum-format 'linum-format-func)
|
||||
(add-hook 'prog-mode-hook (lambda ()
|
||||
(unless (> (count-lines (point-min) (point-max))
|
||||
9999)
|
||||
(linum-mode))))
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Formatting settings.
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(setq-default c-default-style "linux")
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Trailing whitespace.
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
;; The following setting of `show-trailing-whitespace' is incompatible with
|
||||
;; `fci-mode'. The only known workaround is to have whitespace mode on with
|
||||
;; whitespace-style set such that only trailing whitespace is shown.
|
||||
|
||||
(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)
|
||||
"Modes in which to indent regions that are yanked (or yank-popped).
|
||||
Only modes that don't derive from `prog-mode' should be
|
||||
listed here.")
|
||||
|
||||
(defvar yank-indent-blacklisted-modes
|
||||
'(python-mode slim-mode haml-mode)
|
||||
"Modes for which auto-indenting is suppressed.")
|
||||
|
||||
(defvar yank-advised-indent-threshold 10000
|
||||
"Threshold (# chars) over which indentation does not
|
||||
automatically occur.")
|
||||
|
||||
(defun yank-advised-indent-function (beg end)
|
||||
"Do indentation, as long as the region isn't too large."
|
||||
(if (<= (- end beg) yank-advised-indent-threshold)
|
||||
(indent-region beg end nil)))
|
||||
|
||||
(defadvice yank (after yank-indent activate)
|
||||
"If current mode is one of 'yank-indent-modes,
|
||||
indent yanked text (with prefix arg don't indent)."
|
||||
(if (and (not (ad-get-arg 0))
|
||||
(not (member major-mode yank-indent-blacklisted-modes))
|
||||
(or (derived-mode-p 'prog-mode)
|
||||
(member major-mode yank-indent-modes)))
|
||||
(let ((transient-mark-mode nil))
|
||||
(yank-advised-indent-function (region-beginning) (region-end)))))
|
||||
|
||||
(defadvice yank-pop (after yank-pop-indent activate)
|
||||
"If current mode is one of `yank-indent-modes',
|
||||
indent yanked text (with prefix arg don't indent)."
|
||||
(when (and (not (ad-get-arg 0))
|
||||
(not (member major-mode yank-indent-blacklisted-modes))
|
||||
(or (derived-mode-p 'prog-mode)
|
||||
(member major-mode yank-indent-modes)))
|
||||
(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 ";; ")
|
||||
(defvar box-comment-char/scheme-mode ";; ")
|
||||
|
||||
(defun box-comment-char ()
|
||||
"Return the comment character for the current mode."
|
||||
(let ((box-comment-var
|
||||
(intern (format "box-comment-char/%s" major-mode))))
|
||||
(if (boundp box-comment-var)
|
||||
(eval box-comment-var)
|
||||
comment-start)))
|
||||
|
||||
(defun make-box-comment ()
|
||||
(interactive)
|
||||
(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)
|
||||
(indent-to-column indent)
|
||||
(end-of-line)
|
||||
(fill-paragraph)
|
||||
(unless (bolp)
|
||||
(progn
|
||||
(newline)
|
||||
(indent-to-column indent)))
|
||||
(insert comm-start (make-string len ?-))))
|
||||
|
||||
(global-set-key (kbd "M-'") 'make-box-comment)
|
||||
|
||||
)
|
||||
|
||||
(provide 'em-programming)
|
||||
;;; em-programming.el ends here
|
@ -1,170 +0,0 @@
|
||||
;;; em-workflow.el --- Module file for setting up workflows.
|
||||
;;
|
||||
;; Copyright (C) 2017 Wojciech Kozlowski
|
||||
;;
|
||||
;; Author: Wojciech Kozlowski <wk@wojciechkozlowski.eu>
|
||||
;; Created: 25 Aug 2017
|
||||
;;
|
||||
;; This file is not part of GNU Emacs.
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This module sets up configuration for a workflow and is expected to be
|
||||
;; loaded last.
|
||||
;;
|
||||
;;; License: GPLv3
|
||||
|
||||
;;; Required packages:
|
||||
|
||||
;;; Code:
|
||||
|
||||
(defvar emodule/em-workflow-packages
|
||||
|
||||
'(perspective
|
||||
eyebrowse)
|
||||
|
||||
)
|
||||
|
||||
;;; Configuration:
|
||||
|
||||
(defun emodule/em-workflow-init ()
|
||||
"Initialise the `em-workflow' module."
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Enable `perspective'.
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(use-package perspective
|
||||
:config
|
||||
(persp-mode))
|
||||
|
||||
(use-package eyebrowse
|
||||
:after perspective
|
||||
:init
|
||||
(setq eyebrowse-keymap-prefix (kbd "C-x C-x"))
|
||||
:config
|
||||
(setq eyebrowse-default-workspace-slot 0)
|
||||
|
||||
(defvar em-workflow/perspectives nil)
|
||||
|
||||
(defun em-workflow/get-persp-parameters (persp)
|
||||
"Return alist of parameters for perspective PERSP.
|
||||
If the alist did not exist, create one and initialise the values
|
||||
to nil."
|
||||
(assoc persp em-workflow/perspectives))
|
||||
|
||||
(defun em-workflow/persp-parameter-cons (param-name persp)
|
||||
"Return value of PARAM-NAME for perspective PERSP.
|
||||
If none was set, returns nil."
|
||||
(assoc param-name (em-workflow/get-persp-parameters persp)))
|
||||
|
||||
(defun em-workflow/persp-parameter (param-name persp)
|
||||
"Return value of PARAM-NAME for perspective PERSP.
|
||||
If none was set, returns nil."
|
||||
(cdr (em-workflow/persp-parameter-cons param-name persp)))
|
||||
|
||||
(defun em-workflow/set-persp-parameter (param-name value persp)
|
||||
"Set PARAM-NAME to VALUE for perspective PERSP."
|
||||
(let ((param (em-workflow/persp-parameter-cons param-name persp)))
|
||||
(when (not param)
|
||||
(let ((persp-params (em-workflow/get-persp-parameters persp)))
|
||||
(when (not persp-params)
|
||||
(setq em-workflow/perspectives
|
||||
(cons `(,persp . nil) em-workflow/perspectives))
|
||||
(setq persp-params (car em-workflow/perspectives)))
|
||||
(setcdr persp-params
|
||||
(cons `(,param-name . nil) (cdr persp-params)))
|
||||
(setq param (cadr persp-params))))
|
||||
(setcdr param value)))
|
||||
|
||||
(defun em-workflow/get-persp-workspace (&optional persp frame)
|
||||
"Get the correct workspace parameters for perspective.
|
||||
PERSP is the perspective, and defaults to the current
|
||||
perspective. FRAME is the frame where the parameters are
|
||||
expected to be used, and defaults to the current frame."
|
||||
(or persp (setq persp (persp-curr)))
|
||||
(let ((param-names (if (display-graphic-p frame)
|
||||
'(gui-eyebrowse-window-configs
|
||||
gui-eyebrowse-current-slot
|
||||
gui-eyebrowse-last-slot)
|
||||
'(term-eyebrowse-window-configs
|
||||
term-eyebrowse-current-slot
|
||||
term-eyebrowse-last-slot))))
|
||||
(--map (em-workflow/persp-parameter it persp) param-names)))
|
||||
|
||||
(defun em-workflow/set-persp-workspace (workspace-params
|
||||
&optional persp frame)
|
||||
"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)
|
||||
PERSP is the perspective, and defaults to the current
|
||||
perspective. FRAME is the frame where the parameters came
|
||||
from, and defaults to the current frame. Each perspective
|
||||
has two sets of workspace parameters: one set for graphical
|
||||
frames, and one set for terminal frames."
|
||||
(or persp (setq persp (persp-curr)))
|
||||
(let ((param-names (if (display-graphic-p frame)
|
||||
'(gui-eyebrowse-window-configs
|
||||
gui-eyebrowse-current-slot
|
||||
gui-eyebrowse-last-slot)
|
||||
'(term-eyebrowse-window-configs
|
||||
term-eyebrowse-current-slot
|
||||
term-eyebrowse-last-slot))))
|
||||
(--zip-with (em-workflow/set-persp-parameter it other persp)
|
||||
param-names workspace-params)))
|
||||
|
||||
(defun em-workflow/load-eyebrowse-for-perspective (&optional frame)
|
||||
"Load an eyebrowse workspace according to a perspective's parameters.
|
||||
FRAME's perspective is the perspective that is considered,
|
||||
defaulting to the current frame's perspective. If the
|
||||
perspective doesn't have a workspace, create one."
|
||||
(let* ((workspace-params
|
||||
(em-workflow/get-persp-workspace (persp-curr frame) frame))
|
||||
(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 frame)
|
||||
(eyebrowse--set 'current-slot current-slot frame)
|
||||
(eyebrowse--set 'last-slot last-slot frame)
|
||||
(eyebrowse--load-window-config current-slot))
|
||||
(eyebrowse--set 'window-configs nil frame)
|
||||
(eyebrowse-init frame)
|
||||
(em-workflow/save-eyebrowse-for-perspective frame))))
|
||||
|
||||
(defun em-workflow/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)))
|
||||
(em-workflow/save-eyebrowse-for-perspective))
|
||||
|
||||
(defun em-workflow/save-eyebrowse-for-perspective (&optional frame)
|
||||
"Save FRAME's eyebrowse workspace to FRAME's perspective.
|
||||
FRAME defaults to the current frame."
|
||||
(em-workflow/set-persp-workspace (list
|
||||
(eyebrowse--get 'window-configs frame)
|
||||
(eyebrowse--get 'current-slot frame)
|
||||
(eyebrowse--get 'last-slot frame))
|
||||
(persp-curr frame)
|
||||
frame))
|
||||
|
||||
(add-hook 'persp-before-switch-hook
|
||||
#'em-workflow/update-eyebrowse-for-perspective)
|
||||
(add-hook 'eyebrowse-post-window-switch-hook
|
||||
#'em-workflow/save-eyebrowse-for-perspective)
|
||||
(add-hook 'persp-activated-hook
|
||||
#'em-workflow/load-eyebrowse-for-perspective)
|
||||
|
||||
(eyebrowse-mode))
|
||||
|
||||
)
|
||||
|
||||
(provide 'em-workflow)
|
||||
;;; em-workflow.el ends here
|
665
modules/emacs.el
Normal file
665
modules/emacs.el
Normal file
@ -0,0 +1,665 @@
|
||||
;;; emacs.el --- Module file for configuring Emacs itself.
|
||||
;;
|
||||
;; Copyright (C) 2017-2019 Wojciech Kozlowski
|
||||
;;
|
||||
;; Author: Wojciech Kozlowski <wk@wojciechkozlowski.eu>
|
||||
;; Created: 2017-08-25
|
||||
;;
|
||||
;; This file is not part of GNU Emacs.
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This module is used for generic Emacs configuration.
|
||||
;;
|
||||
;;; License: GPLv3
|
||||
|
||||
;;; Required packages:
|
||||
|
||||
;;; Code:
|
||||
|
||||
(defvar emodule/emacs-packages
|
||||
|
||||
'(deadgrep
|
||||
discover-my-major
|
||||
duplicate-thing
|
||||
expand-region
|
||||
highlight-parentheses
|
||||
ibuffer-vc
|
||||
pdf-tools
|
||||
perspective
|
||||
projectile
|
||||
rainbow-delimiters
|
||||
rainbow-mode
|
||||
recentf-ext
|
||||
smartparens
|
||||
swiper
|
||||
treemacs-icons-dired
|
||||
undo-tree
|
||||
use-package
|
||||
vlf
|
||||
volatile-highlights
|
||||
which-key
|
||||
whole-line-or-region
|
||||
ws-butler)
|
||||
|
||||
)
|
||||
|
||||
;;; Configuration:
|
||||
|
||||
(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
|
||||
;; Do not use tab characters for indentation.
|
||||
indent-tabs-mode nil
|
||||
;; Kill whole line when point at beginning of line.
|
||||
kill-whole-line t
|
||||
;; Large file warning only above 10 MB.
|
||||
large-file-warning-threshold 10485760
|
||||
;; Keep point in same position on the screen when scrolling.
|
||||
scroll-preserve-screen-position 1
|
||||
;; 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")
|
||||
(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.
|
||||
backup-directory-alist `((".*" . ,backup-directory))
|
||||
;; Copy the current file into backup directory.
|
||||
backup-by-copying t
|
||||
;; Version numbers for backup files.
|
||||
version-control t
|
||||
;; Delete unnecessary versions.
|
||||
delete-old-versions t
|
||||
;; Oldest versions to keep when a new numbered backup is made.
|
||||
kept-old-versions 2
|
||||
;; Newest versions to keep when a new numbered backup is made.
|
||||
kept-new-versions 3
|
||||
;; Auto-save every buffer that visits a file.
|
||||
auto-save-default t
|
||||
;; Number of seconds idle time before auto-save.
|
||||
auto-save-timeout 30
|
||||
;; Number of keystrokes between auto-saves.
|
||||
auto-save-interval 300)
|
||||
|
||||
;; Update buffers when files change.
|
||||
(global-auto-revert-mode)
|
||||
|
||||
;; Replace selected rather than inserting text at point.
|
||||
(delete-selection-mode)
|
||||
|
||||
;; Treat CamelCase as separate words.
|
||||
(global-subword-mode)
|
||||
|
||||
;; Recentf.
|
||||
(recentf-mode 1)
|
||||
|
||||
;; Use UTF-8.
|
||||
(set-terminal-coding-system 'utf-8)
|
||||
(set-keyboard-coding-system 'utf-8)
|
||||
(set-language-environment "UTF-8")
|
||||
(prefer-coding-system 'utf-8)
|
||||
|
||||
;; Address mode.
|
||||
(add-hook 'prog-mode-hook 'goto-address-mode)
|
||||
(add-hook 'text-mode-hook 'goto-address-mode)
|
||||
|
||||
;; y or n is enough.
|
||||
(defalias 'yes-or-no-p 'y-or-n-p)
|
||||
|
||||
;; Always use ibuffer.
|
||||
(defalias 'list-buffers 'ibuffer)
|
||||
|
||||
;; Increase recursion limits.
|
||||
(setq-default max-specpdl-size 20000) ;; ~15x original value
|
||||
(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")))
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; 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-exit-hook
|
||||
(lambda () (setq gc-cons-threshold 800000)))
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Additional key-bindings.
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
;; Toggle whitespace mode.
|
||||
(global-set-key (kbd "C-c w") 'whitespace-mode)
|
||||
|
||||
;; 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 ()
|
||||
(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)
|
||||
(let ((scroll-preserve-screen-position nil))
|
||||
(scroll-down 1))))
|
||||
(global-set-key (kbd "C->") (lambda()
|
||||
(interactive)
|
||||
(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.
|
||||
This has to be called whenever the active theme changes to
|
||||
refresh these colours."
|
||||
|
||||
(when (and (fboundp 'highlight-parentheses-mode)
|
||||
highlight-parentheses-mode)
|
||||
(highlight-parentheses-mode 1)))
|
||||
|
||||
;; Key-bindings -------------------------------------------------------------
|
||||
|
||||
(global-set-key (kbd "C-x t l") (lambda ()
|
||||
(interactive)
|
||||
(load-theme 'havoc-light t)
|
||||
(refresh-non-face-colours)))
|
||||
(global-set-key (kbd "C-x t d") (lambda ()
|
||||
(interactive)
|
||||
(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.
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(defun toggle-indent-tabs-mode ()
|
||||
"Toggle a indent-tabs-mode between a defined and undefined state."
|
||||
(interactive)
|
||||
(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.
|
||||
|
||||
If ARG is not nil or 1, move forward ARG - 1 lines first. If
|
||||
point reaches the beginning or end of the buffer, stop
|
||||
there."
|
||||
|
||||
(interactive "^p")
|
||||
(setq arg (or arg 1))
|
||||
|
||||
;; Move lines first
|
||||
(when (/= arg 1)
|
||||
(let ((line-move-visual nil))
|
||||
(forward-line (1- arg))))
|
||||
|
||||
(let ((orig-point (point)))
|
||||
(back-to-indentation)
|
||||
(when (= orig-point (point))
|
||||
(move-beginning-of-line 1))))
|
||||
|
||||
;; 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)
|
||||
(transpose-lines 1)
|
||||
(previous-line))
|
||||
|
||||
(defun transpose-lines-up ()
|
||||
"Transpose the current line with the one above."
|
||||
(interactive)
|
||||
(transpose-lines 1)
|
||||
(previous-line 2))
|
||||
|
||||
;; 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."
|
||||
(interactive)
|
||||
(indent-region (point-min) (point-max)))
|
||||
|
||||
(defcustom indent-sensitive-modes
|
||||
'(coffee-mode python-mode slim-mode haml-mode yaml-mode)
|
||||
"Modes for which auto-indenting is suppressed."
|
||||
:type 'list
|
||||
:group 'emodule/emacs)
|
||||
|
||||
(defun indent-region-or-buffer ()
|
||||
"Indent a region if selected, otherwise the whole buffer."
|
||||
(interactive)
|
||||
|
||||
(unless (member major-mode indent-sensitive-modes)
|
||||
(save-excursion
|
||||
(if (region-active-p)
|
||||
(indent-region (region-beginning) (region-end))
|
||||
(indent-buffer)
|
||||
(whitespace-cleanup)))))
|
||||
|
||||
;; 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."
|
||||
(interactive (progn (barf-if-buffer-read-only) '(t)))
|
||||
(let ((fill-column (point-max))
|
||||
;; This would override `fill-column' if it's an integer.
|
||||
(emacs-lisp-docstring-fill-column t))
|
||||
(fill-paragraph nil region)))
|
||||
|
||||
;; Key-bindings -------------------------------------------------------------
|
||||
|
||||
(global-set-key (kbd "M-Q") 'unfill-paragraph)
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; `deadgrep'
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(use-package deadgrep
|
||||
:init
|
||||
(setq deadgrep-project-root-function
|
||||
(lambda () (read-directory-name "Base directory: "
|
||||
nil default-directory t)))
|
||||
:bind
|
||||
(("C-x C-g" . deadgrep)))
|
||||
|
||||
;; Use rgrep if ripgrep not present.
|
||||
(unless (executable-find "rg")
|
||||
(global-set-key (kbd "C-x C-g") 'rgrep))
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; `dired'
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(use-package dired
|
||||
:config
|
||||
(setq
|
||||
;; If another Dired buffer is visible, use it as target for Rename/Copy.
|
||||
dired-dwim-target t
|
||||
;; "always" means no asking.
|
||||
dired-recursive-copies 'always
|
||||
;; "top" means ask once for top level directory.
|
||||
dired-recursive-deletes 'top
|
||||
;; Human-readable listing
|
||||
dired-listing-switches "-lha --group-directories-first")
|
||||
|
||||
;; Automatically refresh dired buffer on changes.
|
||||
(add-hook 'dired-mode-hook 'auto-revert-mode))
|
||||
|
||||
(use-package dired-x
|
||||
:after dired
|
||||
:init
|
||||
(add-hook 'dired-mode-hook 'dired-omit-mode)
|
||||
:config
|
||||
(setq-default dired-omit-files "^\\.\\|^\\#"))
|
||||
|
||||
(use-package wdired
|
||||
:after dired
|
||||
:config
|
||||
(setq-default wdired-allow-to-change-permissions t
|
||||
wdired-allow-to-redirect-links t))
|
||||
|
||||
(use-package treemacs-icons-dired
|
||||
:after dired
|
||||
:hook (dired-mode . treemacs-icons-dired-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)))
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; `flyspell'
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(use-package flyspell
|
||||
:bind
|
||||
(("C-c C-'" . flyspell-correct-word-before-point))
|
||||
:hook
|
||||
(((text-mode org-mode) . flyspell-mode)
|
||||
(prog-mode . flyspell-prog-mode))
|
||||
:config
|
||||
(if (executable-find "aspell")
|
||||
(progn
|
||||
(setq-default ispell-program-name "aspell")
|
||||
(setq-default ispell-extra-args '("--sug-mode=ultra")))
|
||||
(setq-default ispell-program-name "ispell"))
|
||||
(unbind-key "C-M-i" flyspell-mode-map))
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; `highlight-parentheses' - this package does not use faces for colours,
|
||||
;; instead it uses the `hl-parens-colors' variable. This can be set in the
|
||||
;; theme file, but the mode has to be reloaded whenever the theme changes.
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(use-package highlight-parentheses
|
||||
:hook
|
||||
(prog-mode . highlight-parentheses-mode))
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; `ibuffer-vc'
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(use-package ibuffer-vc
|
||||
:defer t
|
||||
:init
|
||||
(add-hook 'ibuffer-hook
|
||||
(lambda ()
|
||||
(ibuffer-vc-set-filter-groups-by-vc-root)
|
||||
(unless (eq ibuffer-sorting-mode 'alphabetic)
|
||||
(ibuffer-do-sort-by-alphabetic))))
|
||||
:config
|
||||
(setq ibuffer-formats
|
||||
'((mark modified read-only vc-status-mini " "
|
||||
(name 36 36 :left :elide)
|
||||
" "
|
||||
(size 9 -1 :right)
|
||||
" "
|
||||
(mode 16 16 :left :elide)
|
||||
" "
|
||||
(vc-status 16 16 :left)
|
||||
" "
|
||||
filename-and-process))))
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; `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
|
||||
:bind
|
||||
(("C-c p" . projectile-command-map))
|
||||
: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
|
||||
(smartparens-global-mode t)
|
||||
(show-smartparens-global-mode t)
|
||||
|
||||
(require 'smartparens-config)
|
||||
|
||||
;; 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)
|
||||
|
||||
(define-key smartparens-mode-map (kbd "C-M-u") 'sp-backward-up-sexp)
|
||||
(define-key smartparens-mode-map (kbd "C-M-S-u") 'sp-up-sexp)
|
||||
|
||||
(define-key smartparens-mode-map (kbd "C-M-d") 'sp-down-sexp)
|
||||
(define-key smartparens-mode-map (kbd "C-M-S-d") 'sp-backward-down-sexp)
|
||||
|
||||
(define-key smartparens-mode-map (kbd "C-S-a") 'sp-beginning-of-sexp)
|
||||
(define-key smartparens-mode-map (kbd "C-S-e") 'sp-end-of-sexp)
|
||||
|
||||
(define-key smartparens-mode-map (kbd "C-M-t") 'sp-transpose-sexp)
|
||||
|
||||
(define-key smartparens-mode-map (kbd "C-M-n") 'sp-next-sexp)
|
||||
(define-key smartparens-mode-map (kbd "C-M-p") 'sp-previous-sexp)
|
||||
|
||||
(define-key smartparens-mode-map (kbd "C-M-k") 'sp-kill-sexp)
|
||||
(define-key smartparens-mode-map (kbd "C-M-w") 'sp-copy-sexp)
|
||||
|
||||
(define-key smartparens-mode-map (kbd "C-<right>") 'sp-forward-slurp-sexp)
|
||||
(define-key smartparens-mode-map (kbd "C-<left>") 'sp-forward-barf-sexp)
|
||||
|
||||
(define-key smartparens-mode-map (kbd "M-D") 'sp-splice-sexp)
|
||||
(define-key smartparens-mode-map (kbd "C-S-d") 'sp-splice-sexp-killing-forward)
|
||||
(define-key smartparens-mode-map (kbd "C-M-<backspace>") 'sp-splice-sexp-killing-backward)
|
||||
(define-key smartparens-mode-map (kbd "C-S-<backspace>") 'sp-splice-sexp-killing-around)
|
||||
|
||||
(define-key smartparens-mode-map (kbd "C-]") 'sp-select-next-thing-exchange)
|
||||
(define-key smartparens-mode-map (kbd "C-M-]") 'sp-select-next-thing)
|
||||
|
||||
(define-key smartparens-mode-map (kbd "M-F") 'sp-forward-symbol)
|
||||
(define-key smartparens-mode-map (kbd "M-B") 'sp-backward-symbol)
|
||||
|
||||
(define-key smartparens-mode-map (kbd "C-c f")
|
||||
(lambda () (interactive) (sp-beginning-of-sexp 2)))
|
||||
(define-key smartparens-mode-map (kbd "C-c b")
|
||||
(lambda () (interactive) (sp-beginning-of-sexp -2)))
|
||||
|
||||
;; rst-mode
|
||||
(sp-with-modes 'rst-mode
|
||||
(sp-local-pair "`" nil :actions nil)
|
||||
(sp-local-pair "``" "``"))
|
||||
|
||||
;; Smartparens custom settings --------------------------------------------
|
||||
|
||||
(setq-default
|
||||
;; Jump to closing parenthesis when closing symbol is typed.
|
||||
sp-autoskip-closing-pair t
|
||||
;; Do not automatically reindent anything.
|
||||
sp-navigate-reindent-after-up nil
|
||||
sp-navigate-reindent-after-up-in-string nil
|
||||
;; Do not highlight space between parentheses.
|
||||
sp-highlight-pair-overlay nil))
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Configure `swiper'.
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(use-package swiper
|
||||
:bind
|
||||
(("M-s M-s" . swiper))
|
||||
:config
|
||||
(setq ivy-count-format "%d/%d "))
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; `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.
|
||||
(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.
|
||||
(add-to-list 'tramp-default-proxies-alist '("localhost" "\\`root\\'" nil))
|
||||
|
||||
(defun sudo ()
|
||||
"Use TRAMP to `sudo' the current buffer"
|
||||
(interactive)
|
||||
(when buffer-file-name
|
||||
(find-alternate-file
|
||||
(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))
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; `which-key'
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(use-package which-key
|
||||
:init
|
||||
(setq which-key-separator " ")
|
||||
(setq which-key-prefix-prefix "+")
|
||||
:config
|
||||
(which-key-mode 1))
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; `whole-line-or-region' - kill line when calling kill-region without a
|
||||
;; selected region.
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(use-package whole-line-or-region
|
||||
:config
|
||||
(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))
|
||||
|
||||
)
|
||||
|
||||
(provide 'emodule/emacs)
|
||||
;;; emacs.el ends here
|
@ -1,9 +1,9 @@
|
||||
;;; em-helm.el --- Module file for Helm configuration.
|
||||
;;; helm.el --- Module file for Helm configuration.
|
||||
;;
|
||||
;; Copyright (C) 2017 Wojciech Kozlowski
|
||||
;; Copyright (C) 2017-2019 Wojciech Kozlowski
|
||||
;;
|
||||
;; Author: Wojciech Kozlowski <wk@wojciechkozlowski.eu>
|
||||
;; Created: 27 Aug 2017
|
||||
;; Created: 2017-08-27
|
||||
;;
|
||||
;; This file is not part of GNU Emacs.
|
||||
;;
|
||||
@ -17,23 +17,21 @@
|
||||
|
||||
;;; Code:
|
||||
|
||||
(defvar emodule/em-helm-packages
|
||||
(defvar emodule/helm-packages
|
||||
|
||||
'(helm
|
||||
helm-descbinds
|
||||
helm-projectile
|
||||
swiper-helm)
|
||||
helm-projectile)
|
||||
|
||||
)
|
||||
|
||||
;;; Configuration:
|
||||
|
||||
(defun emodule/em-helm-init ()
|
||||
"Initialise the `em-helm' module."
|
||||
(defun emodule/helm-init ()
|
||||
"Initialise the `helm' module."
|
||||
|
||||
(use-package helm
|
||||
:init
|
||||
(helm-mode 1)
|
||||
(require 'helm-config)
|
||||
:bind
|
||||
(("C-x C-f" . helm-find-files)
|
||||
("C-x C-r" . helm-resume)
|
||||
@ -43,7 +41,7 @@
|
||||
("C-M-j" . helm-semantic-or-imenu)
|
||||
("C-h SPC" . helm-all-mark-rings))
|
||||
:config
|
||||
(require 'helm-config)
|
||||
(helm-mode 1)
|
||||
|
||||
;; Helm prefix ------------------------------------------------------------
|
||||
|
||||
@ -101,6 +99,7 @@
|
||||
|
||||
;; Rebind tab to run persistent action.
|
||||
(define-key helm-map (kbd "<tab>") 'helm-execute-persistent-action)
|
||||
(define-key helm-map (kbd "TAB") 'helm-execute-persistent-action)
|
||||
;; List actions using C-z.
|
||||
(define-key helm-map (kbd "C-z") 'helm-select-action)
|
||||
|
||||
@ -109,33 +108,17 @@
|
||||
(global-set-key (kbd "C-c h x") 'helm-register)
|
||||
(global-set-key (kbd "C-c h M-o") 'helm-occur))
|
||||
|
||||
;; ------------------------------------------------------------------------
|
||||
;; Activate helm-descbinds.
|
||||
;; ------------------------------------------------------------------------
|
||||
|
||||
(use-package helm-descbinds
|
||||
:config
|
||||
(helm-descbinds-mode))
|
||||
|
||||
;; ------------------------------------------------------------------------
|
||||
;; Configure projectile.
|
||||
;; ------------------------------------------------------------------------
|
||||
|
||||
(use-package helm-projectile
|
||||
:after projectile
|
||||
:config
|
||||
(projectile-mode)
|
||||
(setq-default projectile-completion-system 'helm)
|
||||
(helm-projectile-on))
|
||||
|
||||
;; ------------------------------------------------------------------------
|
||||
;; Configure swiper.
|
||||
;; ------------------------------------------------------------------------
|
||||
|
||||
(use-package swiper-helm
|
||||
:bind
|
||||
(("C-c h C-s" . swiper-helm)))
|
||||
|
||||
)
|
||||
|
||||
(provide 'em-helm)
|
||||
;;; em-helm.el ends here
|
||||
(provide 'emodule/helm)
|
||||
;;; helm.el ends here
|
143
modules/languages.el
Normal file
143
modules/languages.el
Normal file
@ -0,0 +1,143 @@
|
||||
;;; languages.el --- Module file for programming language configuration.
|
||||
;;
|
||||
;; Copyright (C) 2019 Wojciech Kozlowski
|
||||
;;
|
||||
;; Author: Wojciech Kozlowski <wk@wojciechkozlowski.eu>
|
||||
;; Created: 2019-07-20
|
||||
;;
|
||||
;; This file is not part of GNU Emacs.
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This module sets up language-specific configuration for editing source code.
|
||||
;; Language-agnostic settings are in `programming.el'.
|
||||
;;
|
||||
;;; License: GPLv3
|
||||
|
||||
;;; Required packages:
|
||||
|
||||
;;; Code:
|
||||
|
||||
(defvar emodule/languages-packages
|
||||
|
||||
'(
|
||||
;; C/C++
|
||||
ccls
|
||||
;; Dockerfile
|
||||
dockerfile-mode
|
||||
;; Python
|
||||
py-autopep8
|
||||
;; Rust
|
||||
cargo
|
||||
flycheck-rust
|
||||
rust-mode
|
||||
toml-mode
|
||||
;; YAML
|
||||
yaml-mode)
|
||||
|
||||
)
|
||||
|
||||
;; Configuration:
|
||||
|
||||
(defun emodule/languages-init ()
|
||||
"Initialise the `languages' module."
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; C/C++.
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(use-package ccls
|
||||
:hook ((c-mode c++-mode objc-mode) .
|
||||
(lambda () (require 'ccls) (lsp))))
|
||||
|
||||
(setq-default
|
||||
c-default-style "linux"
|
||||
c-basic-offset 4)
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Dockerfile.
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(use-package dockerfile-mode
|
||||
:defer t)
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Makefile settings.
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(add-hook 'makefile-mode-hook (lambda () (setq indent-tabs-mode t)))
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Python.
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(use-package python
|
||||
:init
|
||||
(setq python-shell-interpreter "python3")
|
||||
:hook
|
||||
(python-mode . lsp))
|
||||
|
||||
(use-package py-autopep8
|
||||
;; Note that this package require autopep8 to be installed.
|
||||
:bind (("C-c C-f" . py-autopep8-buffer)))
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Rust.
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(defun rust-new-project (project-name project-type)
|
||||
(let ((rust-cargo-bin "cargo"))
|
||||
(unless (executable-find rust-cargo-bin)
|
||||
(error "Could not locate executable \"%s\"" rust-cargo-bin))
|
||||
|
||||
(let* ((tmpf (make-temp-file "*cargo-new*"))
|
||||
(err-msg "")
|
||||
(ret (call-process
|
||||
rust-cargo-bin
|
||||
nil tmpf t
|
||||
"new" project-name (concat "--" project-type))))
|
||||
|
||||
(with-current-buffer (get-buffer-create tmpf)
|
||||
(setq err-msg (buffer-string))
|
||||
(kill-buffer))
|
||||
|
||||
(unless (= ret 0)
|
||||
(error err-msg)))))
|
||||
|
||||
(defun rust-new-project-bin (project-name)
|
||||
(interactive "sBinary project name: ")
|
||||
(rust-new-project project-name "bin"))
|
||||
|
||||
(defun rust-new-project-lib (project-name)
|
||||
(interactive "sLibrary project name: ")
|
||||
(rust-new-project project-name "lib"))
|
||||
|
||||
(use-package rust-mode
|
||||
:hook (rust-mode . lsp)
|
||||
:config
|
||||
(setq exec-path (append exec-path '("/home/wojtek/.cargo/bin"))))
|
||||
|
||||
(use-package flycheck-rust
|
||||
:hook
|
||||
((rust-mode . flycheck-mode)
|
||||
(flycheck-mode . flycheck-rust-setup)))
|
||||
|
||||
;; Add keybindings for interacting with Cargo
|
||||
(use-package cargo
|
||||
:hook (rust-mode . cargo-minor-mode))
|
||||
|
||||
(use-package toml-mode
|
||||
:mode "\\.lock\\'")
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; YAML.
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(use-package yaml-mode
|
||||
:config
|
||||
(add-hook 'yaml-mode-hook 'display-line-numbers-mode))
|
||||
|
||||
)
|
||||
|
||||
(provide 'emodule/languages)
|
||||
;;; languages.el ends here
|
81
modules/modeline.el
Normal file
81
modules/modeline.el
Normal file
@ -0,0 +1,81 @@
|
||||
;;; modeline.el --- Module file for configuring the modeline.
|
||||
;;
|
||||
;; Copyright (C) 2018-2019 Wojciech Kozlowski
|
||||
;;
|
||||
;; Author: Wojciech Kozlowski <wk@wojciechkozlowski.eu>
|
||||
;; Created: 2018-02-11
|
||||
;;
|
||||
;; This file is not part of GNU Emacs.
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This module is used for configuring the modeline.
|
||||
;;
|
||||
;;; License: GPLv3
|
||||
|
||||
;;; Required packages:
|
||||
|
||||
;;; Code:
|
||||
|
||||
(defvar emodule/modeline-packages
|
||||
|
||||
'(anzu
|
||||
doom-modeline)
|
||||
|
||||
)
|
||||
|
||||
;;; Configuration:
|
||||
|
||||
(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'.
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(use-package doom-modeline
|
||||
:hook
|
||||
(after-init . doom-modeline-mode)
|
||||
:config
|
||||
(setq column-number-mode t
|
||||
doom-modeline-height 23
|
||||
doom-modeline-checker-simple-format nil
|
||||
doom-modeline-env-python-executable "python3")
|
||||
|
||||
;; Custom perspective display - display only the active perspective.
|
||||
(doom-modeline-def-segment perspective-name
|
||||
"Perspectives list and selection. Requires `persp-mode' to be enabled."
|
||||
(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))))
|
||||
|
||||
;; 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))
|
||||
|
||||
(add-hook 'doom-modeline-mode-hook
|
||||
(lambda () (doom-modeline-set-modeline 'my-line 'default))))
|
||||
|
||||
)
|
||||
|
||||
(provide 'emodule/modeline)
|
||||
;;; modeline.el ends here
|
@ -1,9 +1,9 @@
|
||||
;;; em-org.el --- Module file for org-mode configuration.
|
||||
;;; org.el --- Module file for org-mode configuration.
|
||||
;;
|
||||
;; Copyright (C) 2017 Wojciech Kozlowski
|
||||
;; Copyright (C) 2017-2019 Wojciech Kozlowski
|
||||
;;
|
||||
;; Author: Wojciech Kozlowski <wk@wojciechkozlowski.eu>
|
||||
;; Created: 4 Feb 2018
|
||||
;; Created: 2018-02-04
|
||||
;;
|
||||
;; This file is not part of GNU Emacs.
|
||||
;;
|
||||
@ -18,7 +18,7 @@
|
||||
;;; Code:
|
||||
|
||||
|
||||
(defvar emodule/em-org-packages
|
||||
(defvar emodule/org-packages
|
||||
|
||||
'(org-bullets
|
||||
org-noter)
|
||||
@ -27,8 +27,8 @@
|
||||
|
||||
;; Configuration:
|
||||
|
||||
(defun emodule/em-org-init ()
|
||||
"Initialise the `em-org' module."
|
||||
(defun emodule/org-init ()
|
||||
"Initialise the `org' module."
|
||||
|
||||
(use-package org
|
||||
:bind
|
||||
@ -37,14 +37,6 @@
|
||||
("C-c c" . org-capture)
|
||||
("C-c l" . org-store-link))
|
||||
:config
|
||||
;; ------------------------------------------------------------------------
|
||||
;; Rebind some keys.
|
||||
;; ------------------------------------------------------------------------
|
||||
(define-key org-mode-map (kbd "C-c C-n") 'org-forward-heading-same-level)
|
||||
(define-key org-mode-map (kbd "C-c C-p") 'org-backward-heading-same-level)
|
||||
(define-key org-mode-map (kbd "C-c C-f") 'org-next-visible-heading)
|
||||
(define-key org-mode-map (kbd "C-c C-b") 'org-previous-visible-heading)
|
||||
|
||||
;; ------------------------------------------------------------------------
|
||||
;; Set variables.
|
||||
;; ------------------------------------------------------------------------
|
||||
@ -115,5 +107,5 @@
|
||||
|
||||
)
|
||||
|
||||
(provide 'em-org)
|
||||
;;; em-org.el ends here
|
||||
(provide 'emodule/org)
|
||||
;;; org.el ends here
|
322
modules/programming.el
Normal file
322
modules/programming.el
Normal file
@ -0,0 +1,322 @@
|
||||
;;; programming.el --- Module file for programming configuration.
|
||||
;;
|
||||
;; Copyright (C) 2017-2019 Wojciech Kozlowski
|
||||
;;
|
||||
;; Author: Wojciech Kozlowski <wk@wojciechkozlowski.eu>
|
||||
;; Created: 2017-08-28
|
||||
;;
|
||||
;; This file is not part of GNU Emacs.
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This module sets up packages and configuration for editing source code in
|
||||
;; any language. Language specific configuration is in `languages.el'.
|
||||
;;
|
||||
;;; License: GPLv3
|
||||
|
||||
;;; Required packages:
|
||||
|
||||
;;; Code:
|
||||
|
||||
(defvar emodule/programming-packages
|
||||
|
||||
'(company
|
||||
company-c-headers
|
||||
company-lsp
|
||||
fic-mode
|
||||
flycheck
|
||||
flycheck-pos-tip
|
||||
highlight-numbers
|
||||
highlight-symbol
|
||||
lsp-mode
|
||||
lsp-ui
|
||||
swiper
|
||||
yasnippet
|
||||
yasnippet-snippets)
|
||||
|
||||
)
|
||||
|
||||
;; Configuration:
|
||||
|
||||
(defun emodule/programming-init ()
|
||||
"Initialise the `programming' module."
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Line numbers.
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(setq-default
|
||||
display-line-numbers-width-start 4
|
||||
display-line-numbers-grow-only t)
|
||||
|
||||
(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)
|
||||
"Modes in which to indent regions that are yanked (or yank-popped).
|
||||
Only modes that don't derive from `prog-mode' should be
|
||||
listed here.")
|
||||
|
||||
(defvar yank-indent-blacklisted-modes
|
||||
'(python-mode slim-mode haml-mode)
|
||||
"Modes for which auto-indenting is suppressed.")
|
||||
|
||||
(defvar yank-advised-indent-threshold 10000
|
||||
"Threshold (# chars) over which indentation does not
|
||||
automatically occur.")
|
||||
|
||||
(defun yank-advised-indent-function (beg end)
|
||||
"Do indentation, as long as the region isn't too large."
|
||||
(if (<= (- end beg) yank-advised-indent-threshold)
|
||||
(indent-region beg end nil)))
|
||||
|
||||
(defadvice yank (after yank-indent activate)
|
||||
"If current mode is one of 'yank-indent-modes,
|
||||
indent yanked text (with prefix arg don't indent)."
|
||||
(if (and (not (ad-get-arg 0))
|
||||
(not (member major-mode yank-indent-blacklisted-modes))
|
||||
(or (derived-mode-p 'prog-mode)
|
||||
(member major-mode yank-indent-modes)))
|
||||
(let ((transient-mark-mode nil))
|
||||
(yank-advised-indent-function (region-beginning) (region-end)))))
|
||||
|
||||
(defadvice yank-pop (after yank-pop-indent activate)
|
||||
"If current mode is one of `yank-indent-modes',
|
||||
indent yanked text (with prefix arg don't indent)."
|
||||
(when (and (not (ad-get-arg 0))
|
||||
(not (member major-mode yank-indent-blacklisted-modes))
|
||||
(or (derived-mode-p 'prog-mode)
|
||||
(member major-mode yank-indent-modes)))
|
||||
(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 ";; ")
|
||||
(defvar box-comment-char/scheme-mode ";; ")
|
||||
|
||||
(defun box-comment-char ()
|
||||
"Return the comment character for the current mode."
|
||||
(let ((box-comment-var
|
||||
(intern (format "box-comment-char/%s" major-mode))))
|
||||
(if (boundp box-comment-var)
|
||||
(eval box-comment-var)
|
||||
comment-start)))
|
||||
|
||||
(defun make-box-comment ()
|
||||
(interactive)
|
||||
(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)
|
||||
(indent-to-column indent)
|
||||
(end-of-line)
|
||||
(fill-paragraph)
|
||||
(unless (bolp)
|
||||
(progn
|
||||
(newline)
|
||||
(indent-to-column indent)))
|
||||
(insert comm-start (make-string len ?-))))
|
||||
|
||||
(global-set-key (kbd "M-'") 'make-box-comment)
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; `company' - complete anything.
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(use-package company
|
||||
:hook
|
||||
(after-init . global-company-mode)
|
||||
:bind
|
||||
(:map company-active-map
|
||||
("C-n" . company-select-next)
|
||||
("C-p" . company-select-previous))
|
||||
:config
|
||||
(setq company-idle-delay 0
|
||||
company-minimum-prefix-length 3
|
||||
company-tooltip-align-annotations t)
|
||||
;; For this to correctly complete headers, need to add all include paths to
|
||||
;; `company-c-headers-path-system'.
|
||||
(add-to-list 'company-backends 'company-c-headers)
|
||||
(setq company-backends (delete 'company-clang company-backends))
|
||||
(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
|
||||
:bind
|
||||
(("C-c c" . compile)
|
||||
("C-c r" . recompile))
|
||||
:config
|
||||
(setq-default
|
||||
;; Default compile commande
|
||||
compile-command "make "
|
||||
;; Just save before compiling.
|
||||
compilation-ask-about-save nil
|
||||
;; Just kill old compile processes before starting the new one.
|
||||
compilation-always-kill t
|
||||
;; Automatically scroll to first error.
|
||||
compilation-scroll-output 'first-error)
|
||||
|
||||
;; ansi-colors
|
||||
(ignore-errors
|
||||
(require 'ansi-color)
|
||||
(defun my-colorize-compilation-buffer ()
|
||||
(when (eq major-mode 'compilation-mode)
|
||||
(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
|
||||
:config
|
||||
(setq gud-chdir-before-run nil))
|
||||
|
||||
(setq-default
|
||||
;; Use gdb-many-windows by default.
|
||||
gdb-many-windows t
|
||||
;; 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))
|
||||
|
||||
(use-package flycheck-pos-tip
|
||||
: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
|
||||
(prog-mode . highlight-symbol-mode)
|
||||
:bind
|
||||
(("M-n" . highlight-symbol-next)
|
||||
("M-p" . highlight-symbol-prev))
|
||||
:config
|
||||
(highlight-symbol-nav-mode)
|
||||
(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))
|
||||
|
||||
(use-package lsp-ui
|
||||
:commands lsp-ui-mode
|
||||
:init
|
||||
(setq lsp-ui-doc-enable nil
|
||||
lsp-prefer-flymake nil
|
||||
lsp-ui-sideline-enable nil)
|
||||
: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))
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; `semantic'
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(use-package semantic
|
||||
:hook (prog-mode . semantic-mode))
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Enable yasnippet.
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(use-package yasnippet
|
||||
:config
|
||||
(yas-global-mode 1)
|
||||
|
||||
(define-key yas-minor-mode-map [(tab)] nil)
|
||||
(define-key yas-minor-mode-map (kbd "TAB") nil)
|
||||
(define-key yas-minor-mode-map (kbd "<tab>") nil)
|
||||
(define-key yas-minor-mode-map (kbd "<C-return>") 'yas-expand))
|
||||
|
||||
)
|
||||
|
||||
(provide 'emodule/programming)
|
||||
;;; programming.el ends here
|
@ -1,9 +1,9 @@
|
||||
;;; em-terminal.el --- Module file for terminal configuration.
|
||||
;;; terminal.el --- Module file for terminal configuration.
|
||||
;;
|
||||
;; Copyright (C) 2017 Wojciech Kozlowski
|
||||
;; Copyright (C) 2017-2019 Wojciech Kozlowski
|
||||
;;
|
||||
;; Author: Wojciech Kozlowski <wk@wojciechkozlowski.eu>
|
||||
;; Created: 28 Aug 2017
|
||||
;; Created: 2017-08-28
|
||||
;;
|
||||
;; This file is not part of GNU Emacs.
|
||||
;;
|
||||
@ -18,7 +18,7 @@
|
||||
|
||||
;;; Code:
|
||||
|
||||
(defvar emodule/em-terminal-packages
|
||||
(defvar emodule/terminal-packages
|
||||
|
||||
'()
|
||||
|
||||
@ -26,11 +26,13 @@
|
||||
|
||||
;; Configuration:
|
||||
|
||||
(defun emodule/em-terminal-init ()
|
||||
"Initialise the `em-terminal' module."
|
||||
(defun emodule/terminal-init ()
|
||||
"Initialise the `terminal' module."
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Configure term.
|
||||
;; `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
|
||||
@ -56,6 +58,7 @@
|
||||
(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)
|
||||
|
||||
@ -75,7 +78,7 @@
|
||||
(defun first-matching-buffer (regex)
|
||||
"Find first buffer whose name matches REGEXP."
|
||||
(car (remove-if-not
|
||||
(apply-partially #'string-match-p regex)
|
||||
(apply-partially 'string-match-p regex)
|
||||
(mapcar 'buffer-name (buffer-list)))))
|
||||
|
||||
(defun visit-ansi-term ()
|
||||
@ -110,7 +113,7 @@
|
||||
(global-set-key (kbd "C-x '") 'visit-ansi-term))
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Configure eshell.
|
||||
;; `eshell'
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(use-package eshell
|
||||
@ -179,5 +182,5 @@
|
||||
|
||||
)
|
||||
|
||||
(provide 'em-terminal)
|
||||
;;; em-terminal.el ends here
|
||||
(provide 'emodule/terminal)
|
||||
;;; terminal.el ends here
|
@ -1,16 +1,15 @@
|
||||
;;; em-version-control.el --- Module file for version control configuration.
|
||||
;;; vcs.el --- Module file for version control configuration.
|
||||
;;
|
||||
;; Copyright (C) 2017 Wojciech Kozlowski
|
||||
;; Copyright (C) 2017-2019 Wojciech Kozlowski
|
||||
;;
|
||||
;; Author: Wojciech Kozlowski <wk@wojciechkozlowski.eu>
|
||||
;; Created: 25 Aug 2017
|
||||
;; Created: 2017-08-25
|
||||
;;
|
||||
;; This file is not part of GNU Emacs.
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This module sets up configuration for version control packages such as
|
||||
;; `magit'.
|
||||
;; This module sets up configuration for version control.
|
||||
;;
|
||||
;;; License: GPLv3
|
||||
|
||||
@ -18,7 +17,7 @@
|
||||
|
||||
;;; Code:
|
||||
|
||||
(defvar emodule/em-version-control-packages
|
||||
(defvar emodule/vcs-packages
|
||||
|
||||
'(diff-hl
|
||||
magit
|
||||
@ -28,44 +27,11 @@
|
||||
|
||||
;;; Configuration:
|
||||
|
||||
(defun emodule/em-version-control-init ()
|
||||
"Initialise the `em-version-control' module."
|
||||
(defun emodule/vcs-init ()
|
||||
"Initialise the `vcs' module."
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Load and configure `magit'.
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(use-package magit
|
||||
:bind
|
||||
("C-x g l" . magit-log-head)
|
||||
("C-x g f" . magit-log-buffer-file)
|
||||
("C-x g b" . magit-blame)
|
||||
("C-x g m" . magit-show-refs-popup)
|
||||
("C-x g c" . magit-branch-and-checkout)
|
||||
("C-x g s" . magit-status)
|
||||
("C-x g r" . magit-reflog)
|
||||
("C-x g t" . magit-tag)
|
||||
:config
|
||||
(add-hook 'magit-mode-hook 'magit-load-config-extensions)
|
||||
(add-hook 'magit-mode-hook 'magit-todos-mode)
|
||||
(setq magit-bury-buffer-function 'magit-mode-quit-window)
|
||||
|
||||
;; unbind C-x g
|
||||
(unbind-key "C-x g" magit-file-mode-map))
|
||||
|
||||
(use-package magit-todos)
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Ediff.
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(setq ediff-diff-options "-w"
|
||||
ediff-split-window-function 'split-window-horizontally
|
||||
ediff-window-setup-function 'ediff-setup-windows-plain)
|
||||
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Diff highlight mode.
|
||||
;; `diff-hl'
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
;; The `magit-post-refresh-hook' doesn't work very well if it's not the
|
||||
@ -79,7 +45,7 @@
|
||||
(add-hook 'magit-post-refresh-hook 'diff-hl-magit-post-refresh))
|
||||
|
||||
;; --------------------------------------------------------------------------
|
||||
;; Diff mode settings.
|
||||
;; `diff-mode'
|
||||
;; --------------------------------------------------------------------------
|
||||
|
||||
(use-package diff-mode
|
||||
@ -102,24 +68,26 @@
|
||||
|
||||
: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.
|
||||
(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
|
||||
prefix arg is given) determines whether to jump to the old
|
||||
or the new file. If the prefix arg is bigger than 8 (for
|
||||
example with \\[universal-argument]
|
||||
\\[universal-argument]) then `diff-jump-to-old-file' is
|
||||
also set, for the next invocations."
|
||||
prefix arg is given) determines whether to jump to the old or
|
||||
the new file. If the prefix arg is bigger than 8 (for
|
||||
example with \\[universal-argument] \\[universal-argument])
|
||||
then `diff-jump-to-old-file' is also set, for the next
|
||||
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.
|
||||
(if event (posn-set-point (event-end event)))
|
||||
(let ((rev (not (save-excursion (beginning-of-line) (looking-at "[-<]")))))
|
||||
(let ((rev (not (save-excursion (beginning-of-line)
|
||||
(looking-at "[-<]")))))
|
||||
(pcase-let ((`(,buf ,line-offset ,pos ,src ,_dst ,switched)
|
||||
(diff-find-source-location other-file rev)))
|
||||
(let ((window (display-buffer buf t)))
|
||||
@ -128,7 +96,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)
|
||||
@ -137,7 +105,39 @@
|
||||
;; 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
|
||||
("C-x g l" . magit-log-head)
|
||||
("C-x g f" . magit-log-buffer-file)
|
||||
("C-x g b" . magit-blame)
|
||||
("C-x g m" . magit-show-refs-popup)
|
||||
("C-x g c" . magit-branch-and-checkout)
|
||||
("C-x g s" . magit-status)
|
||||
("C-x g r" . magit-reflog)
|
||||
("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))
|
||||
|
||||
(use-package magit-todos
|
||||
:hook (magit-mode . magit-todos-mode))
|
||||
|
||||
)
|
||||
|
||||
(provide 'em-version-control)
|
||||
;;; em-version-control.el ends here
|
||||
(provide 'emodule/vcs)
|
||||
;;; vcs.el ends here
|
BIN
plantuml.jar
BIN
plantuml.jar
Binary file not shown.
@ -1,6 +1,6 @@
|
||||
;;; havoc-common.el --- definition of `Havoc' themes.
|
||||
|
||||
;; Copyright (C) 2017 Wojciech Kozlowski
|
||||
;; Copyright (C) 2017-2019 Wojciech Kozlowski
|
||||
|
||||
;; Author: Wojciech Kozlowski <wk@wojciechkozlowski.eu>
|
||||
;; Keywords: faces
|
||||
@ -95,7 +95,7 @@
|
||||
(*base-volatile-highlight* *bg-2*)
|
||||
|
||||
(*base-line-number* (if (eq variant 'dark) "#46577C" "#B3B3B3"))
|
||||
(*base-line-number-bg* (if (eq variant 'dark) "#071017" "#FAFDFF"))
|
||||
(*base-line-number-bg* (if (eq variant 'dark) "#22252c" "#FAFDFF"))
|
||||
(*base-mb-prompt* (if (eq variant 'dark) "#8AC6F2" "#0000FF"))
|
||||
(*base-vertical-border* (if (eq variant 'dark) "#0A1721" "#C2C2C2")))
|
||||
|
||||
@ -112,10 +112,10 @@
|
||||
;; Peripherals.
|
||||
;; ---------------------------------------------------------------------
|
||||
`(fringe ((t (:background ,*base-bg* :foreground ,*base-fg*))))
|
||||
`(linum ((t (:background ,*base-line-number-bg* :foreground ,*base-line-number*
|
||||
:underline nil :bold nil :italic nil))))
|
||||
`(minibuffer-prompt ((t (:foreground ,*base-mb-prompt*
|
||||
`(line-number ((t (:background ,*base-line-number-bg* :foreground ,*base-line-number*))))
|
||||
`(line-number-current-line ((t (:background ,*base-line-number-bg* :foreground ,*base-cursor-block*
|
||||
:weight bold))))
|
||||
`(minibuffer-prompt ((t (:foreground ,*base-mb-prompt* :weight bold))))
|
||||
`(vertical-border ((t (:foreground ,*base-vertical-border*))))
|
||||
|
||||
;; ---------------------------------------------------------------------
|
||||
@ -140,14 +140,12 @@
|
||||
`(info-xref ((t (:foreground ,*base-info* :underline t))))
|
||||
`(Info-quoted ((t (:foreground ,*base-info*))))
|
||||
|
||||
)
|
||||
|
||||
;; ----------------------------------------------------------------------
|
||||
;; ---------------------------------------------------------------------
|
||||
;; Fill column line.
|
||||
;; ----------------------------------------------------------------------
|
||||
(setq fci-rule-color *base-fci*)
|
||||
;; ---------------------------------------------------------------------
|
||||
`(fill-column-indicator ((t (:foreground ,*base-fci*))))
|
||||
|
||||
)
|
||||
))
|
||||
|
||||
;; ------------------------------------------------------------------------
|
||||
;; Mode line and header line.
|
||||
|
Reference in New Issue
Block a user