2019-03-04 00:03:21 +01:00
|
|
|
|
;;; oni-core.el --- Core Emacs configuration -*- lexical-binding: t; -*-
|
|
|
|
|
|
|
|
|
|
;; Copyright (C) 2019 Tom Willemse
|
|
|
|
|
|
|
|
|
|
;; Author: Tom Willemse <tom@ryuslash.org>
|
|
|
|
|
;; Keywords: local
|
2019-09-20 02:40:16 +02:00
|
|
|
|
;; Version: 2019.0919.173859
|
2019-04-09 10:09:37 +02:00
|
|
|
|
;; Package-Requires: (oni-data-dir expand-region multiple-cursors embrace helpful)
|
2019-03-04 00:03:21 +01:00
|
|
|
|
|
|
|
|
|
;; This program is free software; you can redistribute it and/or modify
|
|
|
|
|
;; it under the terms of the GNU General Public License as published by
|
|
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
;; (at your option) any later version.
|
|
|
|
|
|
|
|
|
|
;; This program is distributed in the hope that it will be useful,
|
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
|
|
|
|
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
|
|
|
|
|
;; Core Emacs configuration, doesn't need any requires from within
|
|
|
|
|
;; Emacs. These settings don't seem to go anywhere else.
|
|
|
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
|
|
|
|
|
(require 'oni-data-dir)
|
|
|
|
|
|
2019-03-30 20:06:56 +01:00
|
|
|
|
(defconst oni-core--auto-save-directory (oni-data-dir-locate "auto-save-files/")
|
|
|
|
|
"Directory where auto-saves go.")
|
|
|
|
|
|
2019-03-04 00:03:21 +01:00
|
|
|
|
(defalias 'yes-or-no-p 'y-or-n-p)
|
|
|
|
|
|
|
|
|
|
(defun oni-core--destroy-trailing-whitespace ()
|
|
|
|
|
"Delete trailing whitespace everywhere, except in Markdown buffers."
|
|
|
|
|
(if (not (eq major-mode 'markdown-mode))
|
|
|
|
|
(delete-trailing-whitespace)))
|
|
|
|
|
|
|
|
|
|
(defun oni-core--switch-newline-keys ()
|
2019-09-18 20:09:58 +02:00
|
|
|
|
"Switch the ‘C-j’ and ‘RET’ keys in the local buffer."
|
2019-03-04 00:03:21 +01:00
|
|
|
|
(if electric-indent-mode
|
|
|
|
|
(progn
|
|
|
|
|
(local-set-key (kbd "C-j") 'newline)
|
|
|
|
|
(local-set-key (kbd "RET") 'electric-newline-and-maybe-indent))
|
|
|
|
|
(local-unset-key (kbd "C-j"))
|
|
|
|
|
(local-unset-key (kbd "RET"))))
|
2019-03-30 20:06:56 +01:00
|
|
|
|
|
|
|
|
|
(defun oni-core--ensure-autosave-directory-exists ()
|
|
|
|
|
"Create the autosave directory if doesn't exist."
|
|
|
|
|
(mkdir oni-core--auto-save-directory t))
|
|
|
|
|
|
2019-03-04 00:03:21 +01:00
|
|
|
|
(add-to-list 'auto-save-file-name-transforms
|
2019-03-30 20:06:56 +01:00
|
|
|
|
`(".*" ,oni-core--auto-save-directory t)
|
|
|
|
|
:append)
|
2019-03-04 00:03:21 +01:00
|
|
|
|
|
|
|
|
|
(setq backup-directory-alist
|
|
|
|
|
`((".*" . ,(oni-data-dir-locate "backup-files"))))
|
|
|
|
|
|
|
|
|
|
(setq auto-save-list-file-prefix
|
|
|
|
|
(oni-data-dir-locate "auto-save-list/.saves-"))
|
|
|
|
|
|
|
|
|
|
(setq abbrev-file-name (oni-data-dir-locate "abbrev_defs"))
|
|
|
|
|
|
|
|
|
|
(setq user-full-name "Tom Willemse"
|
|
|
|
|
user-mail-address "tom@ryuslash.org")
|
|
|
|
|
|
|
|
|
|
(setq delete-old-versions t)
|
|
|
|
|
(setq kept-new-versions 20)
|
|
|
|
|
(setq kept-old-versions 20)
|
|
|
|
|
(setq vc-make-backup-files t)
|
|
|
|
|
(setq version-control t)
|
|
|
|
|
(setq require-final-newline t)
|
|
|
|
|
(setq sentence-end-double-space nil)
|
|
|
|
|
(setq inhibit-startup-screen t)
|
|
|
|
|
(setq electric-pair-skip-whitespace 'chomp)
|
2019-09-20 02:40:16 +02:00
|
|
|
|
(setq fit-window-to-buffer-horizontally t)
|
2019-03-04 00:03:21 +01:00
|
|
|
|
|
|
|
|
|
(setq-default indent-tabs-mode nil)
|
|
|
|
|
(setq-default tab-width 4)
|
|
|
|
|
(setq-default truncate-lines t)
|
|
|
|
|
(setq-default fill-column 80)
|
|
|
|
|
|
|
|
|
|
(add-hook 'before-save-hook #'oni-core--destroy-trailing-whitespace)
|
|
|
|
|
(add-hook 'before-save-hook 'time-stamp)
|
|
|
|
|
(add-hook 'electric-indent-local-mode-hook #'oni-core--switch-newline-keys)
|
|
|
|
|
(add-hook 'minibuffer-setup-hook 'electric-pair-local-mode)
|
2019-03-05 08:54:16 +01:00
|
|
|
|
(add-hook 'prog-mode-hook 'goto-address-prog-mode)
|
2019-03-30 20:06:56 +01:00
|
|
|
|
(add-hook 'auto-save-hook #'oni-core--ensure-autosave-directory-exists)
|
2019-03-04 00:03:21 +01:00
|
|
|
|
|
|
|
|
|
(global-set-key (kbd "C-M-SPC") 'er/expand-region)
|
|
|
|
|
(global-set-key (kbd "M-+") 'mc/mark-next-like-this)
|
|
|
|
|
(global-set-key (kbd "C-c (") 'embrace-commander)
|
|
|
|
|
(global-set-key (kbd "C-x f") 'ffap)
|
|
|
|
|
(global-set-key (kbd "C-x C-b") 'ibuffer)
|
|
|
|
|
|
2019-04-09 10:09:37 +02:00
|
|
|
|
(global-set-key [remap describe-function] 'helpful-callable)
|
|
|
|
|
(global-set-key [remap describe-key] 'helpful-key)
|
|
|
|
|
(global-set-key [remap describe-variable] 'helpful-variable)
|
|
|
|
|
(global-set-key (kbd "C-c C-d") 'helpful-at-point)
|
|
|
|
|
|
2019-09-18 20:07:46 +02:00
|
|
|
|
(global-set-key (kbd "C-<left>") 'winner-undo)
|
|
|
|
|
(global-set-key (kbd "C-<right>") 'winner-redo)
|
|
|
|
|
|
2019-03-04 00:03:21 +01:00
|
|
|
|
(electric-indent-mode -1)
|
2019-09-18 20:07:46 +02:00
|
|
|
|
(winner-mode)
|
2019-03-04 00:03:21 +01:00
|
|
|
|
|
2019-09-09 02:26:05 +02:00
|
|
|
|
(add-to-list 'display-buffer-alist
|
2019-09-20 02:39:42 +02:00
|
|
|
|
`(,(rx string-start
|
|
|
|
|
"*" (any ?h ?H) "elp")
|
|
|
|
|
display-buffer-in-side-window
|
2019-09-09 02:26:05 +02:00
|
|
|
|
(side . bottom)
|
|
|
|
|
(slot . 0)
|
|
|
|
|
(window-height . 0.33)))
|
|
|
|
|
|
2019-03-04 00:03:21 +01:00
|
|
|
|
(when (eql system-type 'windows-nt)
|
|
|
|
|
(add-to-list 'load-path (locate-user-emacs-file "vendor/p4-vc"))
|
|
|
|
|
(add-to-list 'exec-path "c:/Program Files/Git/bin")
|
|
|
|
|
(add-to-list 'exec-path "C:/Program Files/Git/usr/bin")
|
|
|
|
|
(add-to-list 'exec-path "c:/cygwin64/bin")
|
|
|
|
|
|
|
|
|
|
(setq delete-by-moving-to-trash t)
|
|
|
|
|
|
|
|
|
|
(setq-default buffer-file-coding-system 'utf-8-unix))
|
|
|
|
|
|
|
|
|
|
;;;###autoload(require 'oni-core)
|
|
|
|
|
|
|
|
|
|
(provide 'oni-core)
|
|
|
|
|
;;; oni-core.el ends here
|