diff options
Diffstat (limited to '.emacs.d')
-rw-r--r-- | .emacs.d/bookmarks | 8 | ||||
-rw-r--r-- | .emacs.d/init.el | 143 |
2 files changed, 113 insertions, 38 deletions
diff --git a/.emacs.d/bookmarks b/.emacs.d/bookmarks index d473ee3..d0bf6d3 100644 --- a/.emacs.d/bookmarks +++ b/.emacs.d/bookmarks @@ -2,11 +2,11 @@ ;;; This format is meant to be slightly human-readable; ;;; nevertheless, you probably don't want to edit it. ;;; -*- End Of Bookmark File Format Version Stamp -*- -(("keys" +(("conf" (filename . "~/.emacs.d/init.el") - (front-context-string . "(set-keys \"C-M-&") - (rear-context-string . "e-place-mode 1)\n") - (position . 2469)) + (front-context-string . ";; Configuration") + (rear-context-string . "(point-max))))\n\n") + (position . 4099)) ("helm" (filename . "~/.emacs.d/init.el") (front-context-string . "(require 'helm)\n") diff --git a/.emacs.d/init.el b/.emacs.d/init.el index ced6a16..a7831c3 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -1,3 +1,5 @@ +;; -*- lexical-binding: t; -*- + (custom-set-variables ;; custom-set-variables was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. @@ -9,12 +11,13 @@ ((java-mode . "java") (awk-mode . "awk") (other . "bsd")))) + '(org-support-shift-select t) '(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>")) + '(undo-tree-enable-undo-in-region t) + '(wdired-allow-to-change-permissions t)) (custom-set-faces ;; custom-set-faces was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. @@ -27,10 +30,15 @@ (package-initialize) (package-install-selected-packages) +;; Helpers + (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 + collect `(global-set-key + ,(if (stringp key) `(kbd ,key) key) + ,(if (listp fun) fun `#',fun)) + into exps finally return `(progn ,@exps))) (defmacro set-keys-in (maps &rest keys) @@ -40,7 +48,7 @@ collect (cl-loop for map in maps collect `(define-key ,map ,(if (stringp key) `(kbd ,key) key) - #',fun) + ,(if (listp fun) fun `#',fun)) into exps finally return `(progn ,@exps)) into exps @@ -98,23 +106,40 @@ (interactive) (kill-buffer)) +(defun sort-config-paragraphs () + (interactive) + (save-excursion + (goto-char (point-min)) + (re-search-forward "^;;; ") + (move-beginning-of-line 1) + (sort-paragraphs nil (point) (point-max)))) + (defun switch-to-other-buffer () "Switch to the last visited buffer immediately." (interactive) (switch-to-buffer nil)) +;; Configuration + (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) +(delete-selection-mode 1) + (set-keys "C-M-&" async-shell-command-here - "C-x C-b" ibuffer "C-§" delete-other-windows - "C-<" helm-global-mark-ring) + "C-<" helm-global-mark-ring + "C-x C-b" ibuffer + "C-c s c" sort-config-paragraphs + "C-c s f" sort-fields + "C-c s l" sort-lines + "C-c s p" sort-paragraphs) ;;; EXWM (require 'exwm) @@ -139,7 +164,8 @@ (require 'helm-ext) (set-keys "M-x" helm-M-x "M-s o" helm-occur - "C-x b" helm-mini + "C-x b" helm-multi-files + "C-x M-b" helm-exwm "C-x C-f" helm-find-files "C-x r b" helm-filtered-bookmarks "C-M-y" helm-show-kill-ring) @@ -148,27 +174,69 @@ ;; helm-completion-style 'emacs ;; completion-styles '(helm-flex) ) - (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)) +(autoload #'helm-exwm "helm-exwm" nil t) +(with-eval-after-load '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-") +;;; Layouts +(defun layout-jump-to-fun (reg) + (interactive) + (lambda () (interactive) + (jump-to-register reg))) +(defun layout-save () + (interactive) + (window-configuration-to-register ?§)) +(defun layout-save-to-fun (reg) + (interactive) + (lambda () (interactive) + (window-configuration-to-register reg))) +(defun layout-swap () + (interactive) + (let ((reg (get-register ?§))) + (window-configuration-to-register ?½) + (jump-to-register ?§) + (set-register ?§ (get-register ?½)) + (set-register ?½ nil))) +(set-keys "C-c W" layout-save + "C-c w" layout-swap + "C-c 1" (layout-jump-to-fun ?1) + "C-c M-1" (layout-save-to-fun ?1) + "C-c 2" (layout-jump-to-fun ?2) + "C-c M-2" (layout-save-to-fun ?2) + "C-c 3" (layout-jump-to-fun ?3) + "C-c M-3" (layout-save-to-fun ?3) + "C-c 4" (layout-jump-to-fun ?4) + "C-c M-4" (layout-save-to-fun ?4) + "C-c 5" (layout-jump-to-fun ?5) + "C-c M-5" (layout-save-to-fun ?5) + "C-c 6" (layout-jump-to-fun ?6) + "C-c M-6" (layout-save-to-fun ?6) + "C-c 7" (layout-jump-to-fun ?7) + "C-c M-7" (layout-save-to-fun ?7) + "C-c 8" (layout-jump-to-fun ?8) + "C-c M-8" (layout-save-to-fun ?8) + "C-c 9" (layout-jump-to-fun ?9) + "C-c M-9" (layout-save-to-fun ?9) + "C-c 0" (layout-jump-to-fun ?0) + "C-c M-0" (layout-save-to-fun ?0)) + ;;; Lisp -(autoload #'enable-paredit-mode "paredit" "Load Paredit." t) +(autoload #'enable-paredit-mode "paredit" nil 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 @@ -186,8 +254,7 @@ ; overridden by Paredit. (advice-add #'paredit-backward-delete :around #'apply-with-normal-backward-delete-char) (set-keys-in (lisp-mode-map emacs-lisp-mode-map) - "M-Q" align-setq - "C-c s f" sort-fields) + "M-Q" align-setq) ;;; Mouse (setq mouse-wheel-scroll-amount '(3 ((shift) . 1) ((control)))) @@ -204,13 +271,14 @@ (global-undo-tree-mode 1) ;;; Wanderlust -(require 'wl) -(require 'wl-draft) -(require 'wl-score) +(autoload 'wl "wl" "Wanderlust" t) +(autoload 'wl-other-frame "wl" "Wanderlust on new frame." t) +(autoload 'wl-draft "wl-draft" "Write draft with Wanderlust." t) (require 'mime-view) (setq elmo-imap4-default-server "imap.mailbox.org" elmo-imap4-default-user "john@ankarstrom.se" elmo-imap4-default-stream-type (quote starttls) + wl-from "<john@ankarstrom.se>" wl-smtp-posting-server "smtp.mailbox.org" mail-user-agent (quote wl-user-agent) wl-message-ignored-field-list (list "^.*:") @@ -220,19 +288,26 @@ #'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) + +;;; Wanderlust: Fix scrolling +(defmacro fix-wl-scroll (feature maps) + `(with-eval-after-load ',feature + (set-keys-in ,maps + "<mouse-4>" mwheel-scroll + "<mouse-5>" mwheel-scroll))) +(fix-wl-scroll wl (wl-plugged-mode-map)) +(fix-wl-scroll wl-addrmgr (wl-addrmgr-mode-map)) +(fix-wl-scroll wl-draft (wl-draft-mode-map)) +(fix-wl-scroll wl-fldmgr (wl-fldmgr-mode-map)) +(fix-wl-scroll wl-spam (wl-summary-spam-map)) +(fix-wl-scroll wl-template (wl-template-mode-map)) +(fix-wl-scroll wl-address (wl-address-minibuffer-local-map)) +(fix-wl-scroll wl-folder (wl-folder-mode-map)) +(fix-wl-scroll wl-summary (wl-summary-mode-map)) +(fix-wl-scroll wl-message (wl-message-button-map + wl-message-header-narrowing-map + wl-message-header-narrowing-widen-map)) +(fix-wl-scroll wl-score (wl-score-mode-map)) (advice-add #'wl-message-wheel-up :around (lambda (&rest _) (interactive) |