Misc lisp editing changes

This commit is contained in:
Alexander Rosenberg 2024-09-12 18:01:06 -07:00
parent 745d704eb7
commit c62ab7497f
Signed by: Zander671
GPG Key ID: 5FD0394ADBD72730

92
init.el
View File

@ -135,7 +135,7 @@
;; Some settings for programming
(setq-default indent-tabs-mode nil
tab-width 4
tab-width 4
fill-column 80
comment-multi-line t)
@ -209,8 +209,8 @@ Interactively, force the recompile if called with a prefix."
(use-package flyspell
:config
(setq ispell-program-name "hunspell"
flyspell-issue-message-flag nil
flyspell-issue-welcome-flag nil)
flyspell-issue-message-flag nil
flyspell-issue-welcome-flag nil)
(define-key flyspell-mode-map (kbd "C-;") nil t)
(define-key flyspell-mode-map (kbd "C-,") nil t))
@ -300,6 +300,15 @@ Interactively, force the recompile if called with a prefix."
("C-c C-+" . evil-numbers/inc-at-pt-incremental)
("C-c C--" . evil-numbers/dec-at-pt-incremental)))
(use-package aggressive-indent
:hook (prog-mode . aggressive-indent-mode)
:config
(add-to-list 'aggressive-indent-protected-commands
#'evil-undo))
(use-package adjust-parens
:hook (prog-mode . adjust-parens-mode))
;; for when the files are just too large
(use-package vlf
:demand t
@ -1398,17 +1407,17 @@ If no name is given, list all bookmarks instead."
:hook ((emacs-lisp-mode . my/-helpful-setup-emacs-lisp-mode)
(helpful-mode . my/-setup-helpful-mode))
:bind (:map help-map
("f" . helpful-callable)
("v" . helpful-variable)
("k" . helpful-key)
("o" . helpful-symbol)
("x" . helpful-command)
("F" . helpful-function)
:map helpful-mode-map
("<mouse-8>" . my/helpful-history-back)
("<mouse-9>" . my/helpful-history-forward)
("<normal-state><" . my/helpful-history-back)
("<normal-state>>" . my/helpful-history-forward))
("f" . helpful-callable)
("v" . helpful-variable)
("k" . helpful-key)
("o" . helpful-symbol)
("x" . helpful-command)
("F" . helpful-function)
:map helpful-mode-map
("<mouse-8>" . my/helpful-history-back)
("<mouse-9>" . my/helpful-history-forward)
("<normal-state><" . my/helpful-history-back)
("<normal-state>>" . my/helpful-history-forward))
:init
(defun my/-helpful-setup-emacs-lisp-mode ()
(setq-local evil-lookup-func #'helpful-at-point))
@ -1484,9 +1493,60 @@ buffers `helpful--sym' to `my/helpful-symbol-history'."
(setq helpful-switch-buffer-function 'my/-helpful-switch-buffer-function
helpful-max-buffers 2))
(defun my/greyify-color (color percent &optional frame)
"Make COLOR closer to black by PERCENT on FRAME.
Color can be any color which can be passed to `color-values'."
(cl-destructuring-bind (&optional r g b)
(color-name-to-rgb color frame)
(when (and r g b)
(let ((scale (- 1.0 (/ percent 100.0))))
(color-rgb-to-hex (* r scale)
(* g scale)
(* b scale))))))
;; rainbow-delimiters
(use-package rainbow-delimiters
:hook (prog-mode . rainbow-delimiters-mode))
:hook (prog-mode . rainbow-delimiters-mode)
:config
;; generate dark version of the rainbow delimiters faces
(defun my/-rainbow-delimiters-recalc-dark-faces (&optional frame)
(unless frame (setq frame (selected-frame)))
(dotimes (i 9)
(when-let ((old-face (intern-soft
(format "rainbow-delimiters-depth-%d-face"
(1+ i))))
(new-face
(intern
(format "my/rainbow-delimiters-depth-%d-dark-face"
(1+ i))))
(old-color (face-attribute old-face :foreground frame))
(new-color (my/greyify-color old-color 50 frame)))
(set-face-attribute new-face frame :foreground new-color))))
(add-hook 'after-make-frame-functions
#'my/-rainbow-delimiters-recalc-dark-faces)
(add-hook 'server-after-make-frame-hook
#'my/-rainbow-delimiters-recalc-dark-faces)
(defun my/rainbow-delimiters-parinfer-pick-face (depth match loc)
"Version of `rainbow-delimiters-default-pick-face' that colors closing
parenthesis darker than opening ones. This function defers to
`rainbow-delimiters-default-pick-face' and just changes the output if it returns
one of the normal rainbow-delimiters-depth-N-face faces."
(save-match-data
(let* ((base-face (rainbow-delimiters-default-pick-face depth match loc))
(base-name (symbol-name base-face)))
(if (and adjust-parens-mode
(eq ?\) (char-syntax
(elt (buffer-substring-no-properties loc (1+ loc)) 0)))
(string-match (rx string-start "rainbow-delimiters-depth-"
(group (+ num))
"-face" string-end)
base-name))
(or (intern-soft (format "my/rainbow-delimiters-depth-%s-dark-face"
(match-string 1 base-name)))
base-face)
base-face))))
(setopt rainbow-delimiters-pick-face-function
'my/rainbow-delimiters-parinfer-pick-face))
;; auto-highlight-symbol
(use-package auto-highlight-symbol
@ -1576,4 +1636,4 @@ buffers `helpful--sym' to `my/helpful-symbol-history'."
;; fun!
(use-package mines)
;;; init.el ends
;;; init.el ends here