2018-04-25 19:26:53 +02:00
|
|
|
;;; misc.el --- Hosting miscellaneous configuration -*- lexical-binding: t -*-
|
|
|
|
;; Author: William Carroll <wpcarro@gmail.com>
|
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
;; This is the home of any configuration that couldn't find a better home.
|
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
2019-10-09 13:13:56 +02:00
|
|
|
;; Display time in the modeline
|
|
|
|
;; TODO: Save preferred date format strings and cycle through them since I waver
|
|
|
|
;; about which is my favorite.
|
|
|
|
(setq display-time-format "%R %a %d %b [%U of 52 weeks]")
|
|
|
|
(display-time-mode 1)
|
|
|
|
|
2018-04-25 19:26:53 +02:00
|
|
|
;; disable custom variable entries from being written to ~/.emacs.d/init.el
|
2020-01-10 21:33:28 +01:00
|
|
|
(setq custom-file "~/.emacs.d/custom.el")
|
2018-04-25 19:26:53 +02:00
|
|
|
(load custom-file 'noerror)
|
|
|
|
|
2019-01-13 20:33:17 +01:00
|
|
|
;; integrate Emacs with X11 clipboard
|
2019-10-09 13:13:56 +02:00
|
|
|
(setq select-enable-primary t)
|
|
|
|
(setq select-enable-clipboard t)
|
2019-01-13 20:33:17 +01:00
|
|
|
(general-def 'insert
|
2019-10-09 13:13:56 +02:00
|
|
|
"s-v" #'clipboard-yank
|
|
|
|
"C-S-v" #'clipboard-yank)
|
2019-01-13 20:33:17 +01:00
|
|
|
|
2018-04-25 19:26:53 +02:00
|
|
|
;; transparently edit compressed files
|
|
|
|
(auto-compression-mode t)
|
|
|
|
|
2019-01-13 20:33:17 +01:00
|
|
|
;; autowrap when over the fill-column
|
2019-10-09 13:13:56 +02:00
|
|
|
(setq-default auto-fill-function #'do-auto-fill)
|
2019-01-13 20:33:17 +01:00
|
|
|
|
2018-10-02 15:57:15 +02:00
|
|
|
;; link to Emacs source code
|
2019-10-09 13:13:56 +02:00
|
|
|
;; TODO: Update this link.
|
|
|
|
(setq find-function-C-source-directory
|
|
|
|
"~/Dropbox/programming/emacs/src")
|
2018-10-02 15:57:15 +02:00
|
|
|
|
2018-04-25 19:26:53 +02:00
|
|
|
;; change emacs prompts from "yes or no" -> "y or n"
|
|
|
|
(fset 'yes-or-no-p 'y-or-n-p)
|
|
|
|
|
|
|
|
;; open photos in Emacs
|
|
|
|
(auto-image-file-mode 1)
|
|
|
|
|
|
|
|
;; disable line-wrapping
|
|
|
|
(setq-default truncate-lines 1)
|
|
|
|
|
|
|
|
;; shell file indentation
|
|
|
|
(setq sh-basic-offset 2)
|
|
|
|
(setq sh-indentation 2)
|
|
|
|
|
2020-01-15 23:11:53 +01:00
|
|
|
;; Emacs library that interfaces with my Linux password manager.
|
|
|
|
(use-package password-store)
|
|
|
|
|
2020-01-16 20:19:30 +01:00
|
|
|
;; Run `package-lint' before publishing to MELPA.
|
|
|
|
(use-package package-lint)
|
|
|
|
|
2020-01-16 02:12:05 +01:00
|
|
|
;; Parser combinators in Elisp.
|
|
|
|
(use-package parsec)
|
|
|
|
|
2019-03-20 16:32:38 +01:00
|
|
|
;; disable company mode when editing markdown
|
|
|
|
;; TODO: move this out of wpc-misc.el and into a later file to call
|
|
|
|
;; `(disable company-mode)'
|
2019-10-09 13:13:56 +02:00
|
|
|
(use-package markdown-mode
|
|
|
|
:config
|
|
|
|
;; TODO: Add assertion that pandoc is installed and it is accessible from
|
|
|
|
;; Emacs.
|
|
|
|
(setq markdown-command "pandoc")
|
|
|
|
(setq markdown-split-window-direction 'right)
|
2019-12-22 22:36:15 +01:00
|
|
|
;; (add-hook 'markdown-mode-hook #'markdown-live-preview-mode)
|
|
|
|
)
|
|
|
|
|
2020-01-15 23:11:53 +01:00
|
|
|
(use-package alert)
|
|
|
|
|
2019-12-22 22:36:15 +01:00
|
|
|
(use-package refine)
|
2019-10-09 13:13:56 +02:00
|
|
|
|
|
|
|
;; Required by some google-emacs package commands.
|
|
|
|
(use-package deferred)
|
|
|
|
|
|
|
|
;; git integration
|
|
|
|
(use-package magit)
|
|
|
|
|
|
|
|
;; http
|
|
|
|
(use-package request)
|
|
|
|
|
|
|
|
;; perl-compatible regular expressions
|
|
|
|
(use-package pcre2el)
|
|
|
|
|
|
|
|
;; alternative to help
|
|
|
|
(use-package helpful)
|
2018-04-25 19:26:53 +02:00
|
|
|
|
2020-01-06 16:19:57 +01:00
|
|
|
;; Similar to Douglas Crockford's idea of scope highlighting instead of syntax
|
|
|
|
;; highlighting.
|
|
|
|
(use-package prism)
|
|
|
|
|
2020-01-06 16:20:49 +01:00
|
|
|
;; Superior Elisp library for working with dates and times.
|
|
|
|
;; TODO: Put this where my other installations for dash.el, s.el, a.el, and
|
|
|
|
;; other utility Elisp libraries are located.
|
|
|
|
(use-package ts)
|
|
|
|
|
2018-04-25 19:26:53 +02:00
|
|
|
;; persist history etc b/w Emacs sessions
|
|
|
|
(setq desktop-save 'if-exists)
|
|
|
|
(desktop-save-mode 1)
|
|
|
|
(setq desktop-globals-to-save
|
|
|
|
(append '((extended-command-history . 30)
|
|
|
|
(file-name-history . 100)
|
|
|
|
(grep-history . 30)
|
|
|
|
(compile-history . 30)
|
|
|
|
(minibuffer-history . 50)
|
|
|
|
(query-replace-history . 60)
|
|
|
|
(read-expression-history . 60)
|
|
|
|
(regexp-history . 60)
|
|
|
|
(regexp-search-ring . 20)
|
|
|
|
(search-ring . 20)
|
|
|
|
(shell-command-history . 50)
|
|
|
|
tags-file-name
|
|
|
|
register-alist)))
|
|
|
|
|
|
|
|
;; config Emacs to use $PATH values
|
|
|
|
(use-package exec-path-from-shell
|
|
|
|
:if (memq window-system '(mac ns))
|
|
|
|
:config
|
|
|
|
(exec-path-from-shell-initialize))
|
|
|
|
|
|
|
|
;; Emacs autosave, backup, interlocking files
|
|
|
|
(setq auto-save-default nil
|
|
|
|
make-backup-files nil
|
|
|
|
create-lockfiles nil)
|
|
|
|
|
|
|
|
;; ensure code wraps at 80 characters by default
|
2019-10-09 13:13:56 +02:00
|
|
|
(setq-default fill-column constants/fill-column)
|
2018-04-25 19:26:53 +02:00
|
|
|
|
|
|
|
(put 'narrow-to-region 'disabled nil)
|
|
|
|
|
|
|
|
;; trim whitespace on save
|
|
|
|
(add-hook 'before-save-hook #'delete-trailing-whitespace)
|
|
|
|
|
|
|
|
;; use tabs instead of spaces
|
|
|
|
(setq-default indent-tabs-mode nil)
|
|
|
|
|
|
|
|
;; automatically follow symlinks
|
|
|
|
(setq vc-follow-symlinks t)
|
|
|
|
|
|
|
|
;; fullscreen settings
|
2019-10-09 13:13:56 +02:00
|
|
|
(defvar ns-use-native-fullscreen nil)
|
2018-04-25 19:26:53 +02:00
|
|
|
|
|
|
|
;; auto-close parens, brackets, quotes
|
|
|
|
(electric-pair-mode 1)
|
|
|
|
|
|
|
|
(use-package yasnippet
|
|
|
|
:config
|
|
|
|
(yas-global-mode 1))
|
|
|
|
|
|
|
|
(use-package projectile
|
|
|
|
:config
|
|
|
|
(projectile-mode t))
|
|
|
|
|
2019-10-09 13:13:56 +02:00
|
|
|
(use-package deadgrep
|
2018-04-25 19:26:53 +02:00
|
|
|
:config
|
2019-10-09 13:13:56 +02:00
|
|
|
(general-define-key
|
|
|
|
:keymaps 'deadgrep-mode-map
|
|
|
|
:states 'normal
|
|
|
|
"o" #'deadgrep-visit-result-other-window)
|
2020-01-10 21:30:52 +01:00
|
|
|
(setq-default deadgrep--context '(0 . 3))
|
|
|
|
(defun deadgrep/region ()
|
|
|
|
"Run a ripgrep search on the active region."
|
|
|
|
(interactive)
|
|
|
|
(deadgrep (region/to-string)))
|
|
|
|
(defun deadgrep/dwim ()
|
|
|
|
"If a region is active, use that as the search, otherwise don't."
|
|
|
|
(interactive)
|
|
|
|
(with-current-buffer (current-buffer)
|
|
|
|
(if (region-active-p)
|
|
|
|
(setq deadgrep--additional-flags '("--multiline"))
|
|
|
|
(deadgrep/region)
|
|
|
|
(call-interactively #'deadgrep))))
|
2019-10-09 13:13:56 +02:00
|
|
|
(advice-add
|
|
|
|
'deadgrep--format-command
|
|
|
|
:filter-return
|
|
|
|
(lambda (cmd)
|
|
|
|
(replace-regexp-in-string
|
|
|
|
"^rg " "rg --hidden " cmd))))
|
|
|
|
|
|
|
|
;; TODO: Do I need this when I have swiper?
|
|
|
|
(use-package counsel)
|
|
|
|
|
|
|
|
(use-package counsel-projectile)
|
2018-04-25 19:26:53 +02:00
|
|
|
|
|
|
|
;; search Google, Stackoverflow from within Emacs
|
|
|
|
(use-package engine-mode
|
|
|
|
:config
|
|
|
|
(defengine google
|
|
|
|
"http://www.google.com/search?ie=utf-8&oe=utf-8&q=%s"
|
|
|
|
:keybinding "g")
|
|
|
|
(defengine stack-overflow
|
|
|
|
"https://stackoverflow.com/search?q=%s"
|
|
|
|
:keybinding "s"))
|
|
|
|
|
2019-10-09 13:13:56 +02:00
|
|
|
;; EGlot (another LSP client)
|
|
|
|
(use-package eglot)
|
|
|
|
|
|
|
|
;; Microsoft's Debug Adapter Protocol (DAP)
|
|
|
|
(use-package dap-mode
|
|
|
|
:after lsp-mode
|
|
|
|
:config
|
|
|
|
(dap-mode 1)
|
|
|
|
(dap-ui-mode 1))
|
|
|
|
|
2018-09-04 21:01:07 +02:00
|
|
|
;; Microsoft's Language Server Protocol (LSP)
|
|
|
|
(use-package lsp-ui
|
|
|
|
:config
|
|
|
|
(add-hook 'lsp-mode-hook #'lsp-ui-mode))
|
2019-10-09 13:13:56 +02:00
|
|
|
|
2018-09-04 21:01:07 +02:00
|
|
|
(use-package company-lsp
|
|
|
|
:config
|
|
|
|
(push 'company-lsp company-backends))
|
|
|
|
|
2019-10-09 13:13:56 +02:00
|
|
|
;; Wilfred/suggest.el - Tool for discovering functions basesd on declaring your
|
|
|
|
;; desired inputs and outputs.
|
|
|
|
(use-package suggest)
|
|
|
|
|
|
|
|
;; Malabarba/paradox - Enhances the `list-packages' view.
|
|
|
|
(use-package paradox
|
|
|
|
:config
|
|
|
|
(paradox-enable))
|
|
|
|
|
|
|
|
;; TODO: Consider supporting a wpc-elisp.el package for Elisp tooling.
|
|
|
|
;; The following functions are quite useful for Elisp development:
|
|
|
|
;; - `emr-el-find-unused-definitions'
|
|
|
|
(use-package emr
|
|
|
|
:config
|
|
|
|
(define-key prog-mode-map (kbd "M-RET") #'emr-show-refactor-menu))
|
|
|
|
|
2019-03-08 19:18:30 +01:00
|
|
|
(defun wpc/frame-name ()
|
|
|
|
"Return the name of the current frame."
|
|
|
|
(frame-parameter nil 'name))
|
|
|
|
|
2019-03-20 19:38:02 +01:00
|
|
|
;; Even if I resolved the socket-name resolution issue, I couldn't find an
|
|
|
|
;; elegant way to reuse GUI frames. GUIs for me have the advantage of supporting
|
|
|
|
;; True Color, support additional keys for KBDs (i.e. super), and aren't limited
|
|
|
|
;; by the terminal for rendering certain things.
|
2019-10-09 13:13:56 +02:00
|
|
|
(require 'server)
|
|
|
|
(when (not (server-running-p))
|
|
|
|
(server-start))
|
2019-03-20 19:38:02 +01:00
|
|
|
|
2018-04-25 19:26:53 +02:00
|
|
|
(provide 'wpc-misc)
|
2018-09-04 21:01:07 +02:00
|
|
|
;;; wpc-misc.el ends here
|