summaryrefslogtreecommitdiff
path: root/.emacs.d
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2021-10-15 21:21:27 +0200
committerJohn Ankarström <john@ankarstrom.se>2021-10-15 21:21:27 +0200
commit226d1e5faa01b801a9f73409864a4c9b1656d061 (patch)
treeba1bac656cf00eed036152b16d504b89f61182a2 /.emacs.d
parent0b29ca95ea8e2fc96f1ce7f1193ab332dc917ad5 (diff)
downloadebsd-226d1e5faa01b801a9f73409864a4c9b1656d061.tar.gz
Update init.el
Diffstat (limited to '.emacs.d')
-rw-r--r--.emacs.d/init.el132
1 files changed, 74 insertions, 58 deletions
diff --git a/.emacs.d/init.el b/.emacs.d/init.el
index ac5382c..ced6a16 100644
--- a/.emacs.d/init.el
+++ b/.emacs.d/init.el
@@ -35,6 +35,7 @@
(defmacro set-keys-in (maps &rest keys)
"Set multiple keys in multiple keymaps."
+ (declare (indent defun))
(cl-loop for (key fun) on keys by #'cddr
collect (cl-loop for map in maps
collect `(define-key ,map
@@ -50,6 +51,37 @@
(dolist (mode modes)
(add-hook (intern (concat (symbol-name mode) "-mode-hook")) fun)))
+(defun align-setq ()
+ "Align the setq expression at point. Note that this removes all comments."
+ (interactive)
+ (let ((sexp (list-at-point)))
+ (unless (string-prefix-p "set" (prin1-to-string (car sexp)))
+ (error "Not a set* expression."))
+ (let ((bounds (thing-at-point-bounds-of-list-at-point))
+ (max-length 0))
+ (delete-region (car bounds) (cdr bounds))
+ (insert "(" (prin1-to-string (car sexp)) " ")
+ (when (string= "set-keys-in" (prin1-to-string (car sexp)))
+ (insert (prin1-to-string (cadr sexp)) "\n")
+ (setq sexp (cdr sexp)))
+ (cl-loop for (sym val) on (cdr sexp) by #'cddr
+ do (let ((length (length (prin1-to-string sym))))
+ (when (< max-length length)
+ (setq max-length length))))
+ (cl-loop for (sym val) on (cdr sexp) by #'cddr
+ do (let* ((length (length (prin1-to-string sym)))
+ (diff (- max-length length)))
+ (insert (prin1-to-string sym))
+ (when (<= 0 diff)
+ (insert (make-string (1+ diff) ? )))
+ (insert (prin1-to-string val) "\n")))
+ (backward-delete-char 1)
+ (insert ")")
+ (left-char)
+ (setq bounds (thing-at-point-bounds-of-list-at-point))
+ (indent-region (car bounds) (cdr bounds))
+ (right-char))))
+
(defun apply-with-normal-backward-delete-char (fun &rest args)
(cl-letf (((symbol-function #'backward-delete-char-untabify) #'backward-delete-char))
(apply fun args)))
@@ -71,24 +103,18 @@
(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)
+(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)
+(set-keys "C-M-&" async-shell-command-here
+ "C-x C-b" ibuffer
+ "C-§" delete-other-windows
+ "C-<" helm-global-mark-ring)
;;; EXWM
(require 'exwm)
@@ -111,27 +137,18 @@
;;; 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)
+(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-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)
@@ -154,20 +171,23 @@
(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
+(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)
+(set-keys-in (lisp-mode-map emacs-lisp-mode-map)
+ "M-Q" align-setq
+ "C-c s f" sort-fields)
;;; Mouse
(setq mouse-wheel-scroll-amount '(3 ((shift) . 1) ((control))))
@@ -188,17 +208,13 @@
(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:"))
+(setq elmo-imap4-default-server "imap.mailbox.org"
+ elmo-imap4-default-user "john@ankarstrom.se"
+ elmo-imap4-default-stream-type (quote starttls)
+ wl-smtp-posting-server "smtp.mailbox.org"
+ mail-user-agent (quote wl-user-agent)
+ wl-message-ignored-field-list (list "^.*:")
+ wl-message-visible-field-list (list "^To:" "^Cc:" "^From:" "^Subject:" "^Date:"))
(define-mail-user-agent 'wl-user-agent
#'wl-user-agent-compose
#'wl-draft-send
@@ -215,8 +231,8 @@
wl-score-mode-map
wl-summary-mode-map
wl-template-mode-map)
- "<mouse-4>" mwheel-scroll
- "<mouse-5>" mwheel-scroll)
+ "<mouse-4>" mwheel-scroll
+ "<mouse-5>" mwheel-scroll)
(advice-add #'wl-message-wheel-up :around
(lambda (&rest _)
(interactive)