diff options
author | John Ankarström <john@ankarstrom.se> | 2021-10-15 18:33:28 +0200 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2021-10-15 18:33:28 +0200 |
commit | 0b29ca95ea8e2fc96f1ce7f1193ab332dc917ad5 (patch) | |
tree | 77aea3f592f39d8c5a649126980adcb142db5211 /.emacs.d/init.el | |
download | ebsd-0b29ca95ea8e2fc96f1ce7f1193ab332dc917ad5.tar.gz |
First commit
Diffstat (limited to '.emacs.d/init.el')
-rw-r--r-- | .emacs.d/init.el | 231 |
1 files changed, 231 insertions, 0 deletions
diff --git a/.emacs.d/init.el b/.emacs.d/init.el new file mode 100644 index 0000000..ac5382c --- /dev/null +++ b/.emacs.d/init.el @@ -0,0 +1,231 @@ +(custom-set-variables + ;; custom-set-variables was added by Custom. + ;; If you edit it by hand, you could mess it up, so be careful. + ;; Your init file should contain only one such instance. + ;; If there is more than one, they won't work right. + '(c-backspace-function (quote backward-delete-char)) + '(c-default-style + (quote + ((java-mode . "java") + (awk-mode . "awk") + (other . "bsd")))) + '(package-selected-packages + (quote + (perspective wanderlust magit helm-exwm helm-ext undo-tree which-key paredit helm exwm))) + '(sentence-end-double-space nil) + '(wdired-allow-to-change-permissions t) + '(wl-from "<john@ankarstrom.se>")) +(custom-set-faces + ;; custom-set-faces was added by Custom. + ;; If you edit it by hand, you could mess it up, so be careful. + ;; Your init file should contain only one such instance. + ;; If there is more than one, they won't work right. + ) + +(require 'package) +(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t) +(package-initialize) +(package-install-selected-packages) + +(defmacro set-keys (&rest keys) + "Set multiple global keys at once." + (cl-loop for (key fun) on keys by #'cddr + collect `(global-set-key ,(if (stringp key) `(kbd ,key) key) #',fun) into exps + finally return `(progn ,@exps))) + +(defmacro set-keys-in (maps &rest keys) + "Set multiple keys in multiple keymaps." + (cl-loop for (key fun) on keys by #'cddr + collect (cl-loop for map in maps + collect `(define-key ,map + ,(if (stringp key) `(kbd ,key) key) + #',fun) + into exps + finally return `(progn ,@exps)) + into exps + finally return `(progn ,@exps))) + +(defun add-hooks (fun &rest modes) + "Add a function to multiple mode hooks at once." + (dolist (mode modes) + (add-hook (intern (concat (symbol-name mode) "-mode-hook")) fun))) + +(defun apply-with-normal-backward-delete-char (fun &rest args) + (cl-letf (((symbol-function #'backward-delete-char-untabify) #'backward-delete-char)) + (apply fun args))) + +(defun async-shell-command-here () + "Run `async-shell-command', then delete the current window." + (interactive) + (call-interactively #'async-shell-command) + (delete-window)) ; TODO: Function for opening X program with + ; associated command output buffer. + +(defun kill-buffer-now () + "Kill the current buffer immediately." + (interactive) + (kill-buffer)) + +(defun switch-to-other-buffer () + "Switch to the last visited buffer immediately." + (interactive) + (switch-to-buffer nil)) + +;; (defadvice backward-delete-char-untabify +;; (around my-backward-delete-char-untabify (arg &optional killp)) +;; (message "overridden!")) + +(setq insert-directory-program "gls" + x-pointer-shape x-pointer-top-left-arrow) +(set-mouse-color "black") +(tool-bar-mode -1) +(window-divider-mode 1) +(column-number-mode 1) +(recentf-mode 1) +(save-place-mode 1) +(set-keys "C-M-&" async-shell-command-here + ;; "C-x K" kill-buffer-now + ;; "C-x B" switch-to-other-buffer + "C-x C-b" ibuffer + "C-§" delete-other-windows + "C-<" helm-global-mark-ring) + +;;; EXWM +(require 'exwm) +(add-hook 'exwm-update-class-hook + (lambda () + (exwm-workspace-rename-buffer exwm-class-name))) +(setq exwm-input-simulation-keys + '(([?\C-b] . [left]) + ([?\C-f] . [right]) + ([?\C-p] . [up]) + ([?\C-n] . [down]) + ([?\C-a] . [home]) + ([?\C-e] . [end]) + ([?\M-v] . [prior]) + ([?\C-v] . [next]) + ([?\C-d] . [delete]) + ([?\C-k] . [S-end delete]))) +(exwm-enable) + +;;; Helm +(require 'helm) +(require 'helm-ext) +(set-keys "M-x" helm-M-x + "M-s o" helm-occur + "C-x b" helm-mini + "C-x C-f" helm-find-files + "C-x r b" helm-filtered-bookmarks + "C-M-y" helm-show-kill-ring) +(setq helm-ff-DEL-up-one-level-maybe t + helm-allow-mouse t + helm-M-x-fuzzy-match t + helm-apropos-fuzzy-match t + helm-buffers-fuzzy-matching t + helm-etags-fuzzy-match t + helm-file-cache-fuzzy-match t + helm-imenu-fuzzy-match t + helm-lisp-fuzzy-completion t + helm-locate-fuzzy-match t + helm-locate-library-fuzzy-match t + helm-mode-fuzzy-match t + helm-recentf-fuzzy-match t + helm-semantic-fuzzy-match t + helm-session-fuzzy-match t) +(helm-mode 1) +(helm-ext-ff-enable-skipping-dots t) +(helm-ext-minibuffer-enable-header-line-maybe t) + +;;; Helm-exwm +(require 'helm-exwm) +(setq helm-exwm-emacs-buffers-source (helm-exwm-build-emacs-buffers-source)) +(setq helm-exwm-source (helm-exwm-build-source)) +(setq helm-mini-default-sources '(helm-exwm-emacs-buffers-source + helm-exwm-source + helm-source-recentf + helm-source-buffer-not-found)) + +;;; Ibuffer +(require 'ibuf-ext) +(add-to-list 'ibuffer-never-show-predicates "^\\*helm[- ]") +;; (add-to-list 'ibuffer-never-show-predicates "^magit-") + +;;; Lisp +(autoload #'enable-paredit-mode "paredit" "Load Paredit." t) +(add-hooks #'enable-paredit-mode 'lisp 'emacs-lisp) +(add-hooks #'show-paren-mode 'lisp 'emacs-lisp) +(set-keys "C-x M-s ." isearch-forward-symbol-at-point + "C-x M-s _" isearch-forward-symbol + "C-x M-s o" helm-occur + "C-x M-s w" isearch-forward-word + "C-x M-s h ." highlight-symbol-at-point + "C-x M-s h f" hi-lock-find-patterns + "C-x M-s h l" highlight-lines-matching-regexp + "C-x M-s h p" highlight-phrase + "C-x M-s h r" highlight-regexp + "C-x M-s h u" unhighlight-regexp + "C-x M-s h w" hi-lock-write-interactive-patterns + "C-x M-s M-w" eww-search-words) ; Replace M-s keys + ; overridden by Paredit. +(advice-add #'paredit-backward-delete :around #'apply-with-normal-backward-delete-char) + +;;; Mouse +(setq mouse-wheel-scroll-amount '(3 ((shift) . 1) ((control)))) +(setq mouse-wheel-progressive-speed nil) ; For some reason, Emacs has + ; crazy defaults with regards + ; to mouse wheel scrolling. + +;;; Perspective +(require 'perspective) +(persp-mode) + +;;; Undo-tree +(require 'undo-tree) +(global-undo-tree-mode 1) + +;;; Wanderlust +(require 'wl) +(require 'wl-draft) +(require 'wl-score) +(require 'mime-view) +(setq elmo-imap4-default-server "imap.mailbox.org" + elmo-imap4-default-user "john@ankarstrom.se" + elmo-imap4-default-stream-type 'starttls + wl-smtp-posting-server "smtp.mailbox.org" + mail-user-agent 'wl-user-agent + wl-message-ignored-field-list '("^.*:") + wl-message-visible-field-list '("^To:" + "^Cc:" + "^From:" + "^Subject:" + "^Date:")) +(define-mail-user-agent 'wl-user-agent + #'wl-user-agent-compose + #'wl-draft-send + #'wl-draft-kill + 'mail-send-hook) +(set-keys-in (wl-address-minibuffer-local-map + wl-draft-mode-map + wl-fldmgr-mode-map + wl-folder-mode-map + wl-message-button-map + wl-message-header-narrowing-map + wl-message-header-narrowing-widen-map + wl-plugged-mode-map + wl-score-mode-map + wl-summary-mode-map + wl-template-mode-map) + "<mouse-4>" mwheel-scroll + "<mouse-5>" mwheel-scroll) +(advice-add #'wl-message-wheel-up :around + (lambda (&rest _) + (interactive) + (call-interactively #'mwheel-scroll))) +(advice-add #'wl-message-wheel-down :around + (lambda (&rest _) + (interactive) + (call-interactively #'mwheel-scroll))) + +;;; Which-key +(require 'which-key) +(which-key-mode 1) |