diff options
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | init.el | 25 | ||||
-rw-r--r-- | lisp/general.el | 73 | ||||
-rw-r--r-- | lisp/kanagawa-theme.el | 516 | ||||
-rw-r--r-- | lisp/org-custom.el | 29 | ||||
-rw-r--r-- | lisp/ultra-scroll.el | 302 | ||||
-rw-r--r-- | lisp/vc-annotate-lens-mode.el | 50 |
7 files changed, 367 insertions, 631 deletions
@@ -24,4 +24,5 @@ eln-cache .projectile session.* emojis -multisession
\ No newline at end of file +multisession +.aider* @@ -28,18 +28,10 @@ (emacs-init-time "%.2f") gcs-done))) -;; Theme -;; (use-package leuven-theme -;; :ensure t -;; :config -;; (load-theme 'leuven t)) - -(load-theme 'sanityinc-tomorrow-night t) - -;; (use-package autothemer -;; :ensure t) - +(use-package dracula-theme + :ensure t) +(load-theme 'dracula t) (set-frame-parameter (selected-frame) 'alpha '(99 99)) (add-to-list 'default-frame-alist '(alpha 99 99)) @@ -53,12 +45,10 @@ (require 'lisp) (require 'json) (require 'python-custom) -;(require 'vc-annotate-lens-mode) (require 'rust) (require 'mk) (require 'resize-frame) - (require 'server) (unless (server-running-p) (server-start)) @@ -68,10 +58,13 @@ ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. '(custom-safe-themes - '("6fc9e40b4375d9d8d0d9521505849ab4d04220ed470db0b78b700230da0a86c1" "b11edd2e0f97a0a7d5e66a9b82091b44431401ac394478beb44389cf54e6db28" "6bdc4e5f585bb4a500ea38f563ecf126570b9ab3be0598bdf607034bb07a8875" "f3781be0be23cc71c89b317489e07a4ad3e885f84c0a618692b53bbd69e60843" "0cf95236abcf59e05b1ea69b4edd53d293a5baec4fe4c3484543fee99bfd2204" "ec8ff5e2c8a9eb38e49a9bea6297c2194bbe0c03982630d66db1570f5ae83d90" "2ca3da7d36b0d326f984530a07be54b272b5c313b1361989acf747d8b5616162" "80214de566132bf2c844b9dee3ec0599f65c5a1f2d6ff21a2c8309e6e70f9242" "b3737f86b86d52c7d06820c10dc2609e9192627fc02dd654f4f9eb336f24f511" "a6f9dd4844bfbfaf1162f04ae3c52070154ef28d18b5d482566015cf429492b0" "f149d9986497e8877e0bd1981d1bef8c8a6d35be7d82cba193ad7e46f0989f6a" "3c83b3676d796422704082049fc38b6966bcad960f896669dfc21a7a37a748fa" "a27c00821ccfd5a78b01e4f35dc056706dd9ede09a8b90c6955ae6a390eb1c1e" default)) + '("c650a74280e8ce4ae4b50835b7a3bc62aeffa202ffea82260e529f0a69027696" "6fc9e40b4375d9d8d0d9521505849ab4d04220ed470db0b78b700230da0a86c1" "b11edd2e0f97a0a7d5e66a9b82091b44431401ac394478beb44389cf54e6db28" "6bdc4e5f585bb4a500ea38f563ecf126570b9ab3be0598bdf607034bb07a8875" "f3781be0be23cc71c89b317489e07a4ad3e885f84c0a618692b53bbd69e60843" "0cf95236abcf59e05b1ea69b4edd53d293a5baec4fe4c3484543fee99bfd2204" "ec8ff5e2c8a9eb38e49a9bea6297c2194bbe0c03982630d66db1570f5ae83d90" "2ca3da7d36b0d326f984530a07be54b272b5c313b1361989acf747d8b5616162" "80214de566132bf2c844b9dee3ec0599f65c5a1f2d6ff21a2c8309e6e70f9242" "b3737f86b86d52c7d06820c10dc2609e9192627fc02dd654f4f9eb336f24f511" "a6f9dd4844bfbfaf1162f04ae3c52070154ef28d18b5d482566015cf429492b0" "f149d9986497e8877e0bd1981d1bef8c8a6d35be7d82cba193ad7e46f0989f6a" "3c83b3676d796422704082049fc38b6966bcad960f896669dfc21a7a37a748fa" "a27c00821ccfd5a78b01e4f35dc056706dd9ede09a8b90c6955ae6a390eb1c1e" default)) '(package-selected-packages - '(color-theme-sanityinc-tomorrow catppuccin-theme ef-themes org-attach-screenshot eglot treemacs-nerd-icons treemacs-all-the-icons nerd-icons kaolin-themes ement dart-mode yaml-mode meson-mode autothemer pyenv-mode pyvenv plantuml-mode ledger-mode centered-window perfect-margin-mode org-download helm-rg htmlize mood-line org-super-agenda material-theme esup glsl-mode fast-scroll yasnippet-snippets jsdoc helm-slack slack smart-mode-line magit rust-mode xref-js2 web-mode vterm-toggle vscode-dark-plus-theme treemacs-projectile tree-sitter-langs tide tern smartparens rtags req-package rainbow-mode pythonic python-mode perfect-margin org-roam org-notify org-modern org-bullets org-alert minimap markdown-mode json-mode js2-refactor js2-highlight-vars js-doc ido-vertical-mode hl-todo highlight-thing highlight-indent-guides helm-projectile helm-posframe helm-ag good-scroll go-mode git-gutter-fringe git-commit flycheck-irony evil eslint-fix emojify eldoc-box drag-stuff doom-themes dashboard css-eldoc counsel company-quickhelp company-irony cmake-mode cmake-ide auctex all-the-icons ac-js2)) - '(safe-local-variable-values '((js-indent-level . 4))) + '(helpful aider ultra-scroll dracula-theme color-theme-sanityinc-tomorrow catppuccin-theme ef-themes org-attach-screenshot eglot treemacs-nerd-icons treemacs-all-the-icons nerd-icons kaolin-themes ement dart-mode yaml-mode meson-mode autothemer pyenv-mode pyvenv plantuml-mode ledger-mode centered-window perfect-margin-mode org-download helm-rg htmlize mood-line org-super-agenda material-theme esup glsl-mode fast-scroll yasnippet-snippets jsdoc helm-slack slack smart-mode-line magit rust-mode xref-js2 web-mode vterm-toggle vscode-dark-plus-theme treemacs-projectile tree-sitter-langs tide tern smartparens rtags req-package rainbow-mode pythonic python-mode perfect-margin org-roam org-notify org-modern org-bullets org-alert minimap markdown-mode json-mode js2-refactor js2-highlight-vars js-doc ido-vertical-mode hl-todo highlight-thing highlight-indent-guides helm-projectile helm-posframe helm-ag good-scroll go-mode git-gutter-fringe git-commit flycheck-irony evil eslint-fix emojify eldoc-box drag-stuff doom-themes dashboard css-eldoc counsel company-quickhelp company-irony cmake-mode cmake-ide auctex all-the-icons ac-js2)) + '(package-vc-selected-packages '((aider :url "https://github.com/tninja/aider.el"))) + '(safe-local-variable-values + '((eval setq-local org-log-done 'time) + (js-indent-level . 4))) '(warning-suppress-types '((comp)))) (custom-set-faces ;; custom-set-faces was added by Custom. diff --git a/lisp/general.el b/lisp/general.el index 95966e4..720ae79 100644 --- a/lisp/general.el +++ b/lisp/general.el @@ -65,6 +65,12 @@ ;; Line highlighting (global-hl-line-mode 1) +;; Set delay to 0 +(setq show-paren-delay 0) + +;; Line selection color +(set-face-attribute 'region nil :background "#3b3911") + ;; Initial major mode (setq initial-major-mode 'text-mode) @@ -80,6 +86,7 @@ ;; Modeline (use-package mood-line ;; Enable mood-line + :ensure t :config (mood-line-mode)) @@ -139,7 +146,7 @@ ;; (setq vertico-scroll-margin 0) ;; Show more candidates - ;; (setq vertico-count 20) + (setq vertico-count 24) ;; Grow and shrink the Vertico minibuffer ;; (setq vertico-resize t) @@ -197,7 +204,6 @@ (define-key projectile-mode-map (kbd "C-c p f") 'projectile-ripgrep) (define-key projectile-mode-map (kbd "C-c p o") 'projectile-switch-project) (define-key projectile-mode-map (kbd "C-c p p") 'projectile-find-file) - ) @@ -216,21 +222,6 @@ (define-fringe-bitmap 'git-gutter-fr:modified [224] nil nil '(center repeated)) (define-fringe-bitmap 'git-gutter-fr:deleted [128 192 224 240] nil nil 'bottom)) -(use-package magit - :ensure t) - -;; Emojis -;; (use-package emojify -;; :ensure t -;; :config -;; (when (member "Segoe UI Emoji" (font-family-list)) -;; (set-fontset-font -;; t 'symbol (font-spec :family "Segoe UI Emoji") nil 'prepend)) -;; (setq emojify-display-style 'unicode) -;; (setq emojify-emoji-styles '(unicode)) -;; (bind-key* (kbd "C-c e") #'emojify-insert-emoji)) ; override binding i -;; n any mode - ;; icons (use-package all-the-icons :ensure t @@ -245,22 +236,22 @@ :defer t :init (add-hook 'after-init-hook 'global-company-mode) :config - (setq company-idle-delay 0.1 - company-minimum-prefix-length 2 + (setq company-minimum-prefix-length 2 company-tooltip-limit 10 company-backends '((company-capf company-gtags company-elisp company-css company-dabbrev company-nxml)) company-dabbrev-downcase nil + company-idle-delay nil ) + (define-key company-mode-map (kbd "M-c") #'company-complete) ) -(use-package company-quickhelp - :ensure t - :defer t - :init (company-quickhelp-mode 1) - :config - (setq company-quickhelp-delay 0.1) - (setq company-quickhelp-color-background (face-attribute 'default :background)) - ) +;; (use-package company-quickhelp +;; :ensure t +;; :defer t +;; :init (company-quickhelp-mode 1) +;; :config +;; (setq company-quickhelp-color-background (face-attribute 'default :background)) +;; ) ;; Eglot (use-package eglot @@ -269,30 +260,17 @@ :ensure t :bind ("<f2>" . #'eglot-rename) :config - (add-to-list 'eglot-server-programs '((c++-mode c-mode) "clangd-19")) - (add-to-list 'eglot-server-programs `((dart-mode) "/home/matthew/Programs/flutter/bin/dart" "language-server")) + (add-to-list 'eglot-server-programs '((c++-mode c-mode) "clangd-18")) + (add-to-list 'eglot-server-programs `((dart-mode) "/home/matthew/Github/flutter/bin/dart" "language-server")) (add-hook 'c-mode-common-hook 'eglot-ensure) - (add-hook 'dart-mode-hook 'eglot-ensure)) + (add-hook 'dart-mode-hook 'eglot-ensure) + (advice-add 'jsonrpc--log-event :override #'ignore)) ;; (set-face-underline 'eglot-highlight-symbol-face t) (bind-key* (kbd "M-n") 'flymake-goto-next-error) (bind-key* (kbd "M-p") 'flymake-goto-prev-error) -;; Vterm - -(defun vterm-mode-set-colors() - "Set the colors of vterm to match my personal taste." - (setq-local global-hl-line-mode nil) - ;(turn-off-evil-mode) - (display-line-numbers-mode -1) - (setq left-fringe-width 0) - (setq right-fringe-width 0) - (set-window-fringes (selected-window) 0 0 nil) - (face-remap-add-relative 'default '(:background "#232627")) - (face-remap-add-relative 'default '(:foreground"#fcfcfc")) - ) - ;; Line movement (use-package drag-stuff :config @@ -333,6 +311,13 @@ (lambda () (setq indent-line-function (lambda () 'noindent)))) +(use-package ultra-scroll + :load-path "~/.emacs.d/lisp/ultra-scroll" ; if you git clone'd instead of package-vc-install + :init + (setq scroll-conservatively 101 ; important! + scroll-margin 0) + :config + (ultra-scroll-mode 1)) (provide 'general) ;;; general.el ends here diff --git a/lisp/kanagawa-theme.el b/lisp/kanagawa-theme.el deleted file mode 100644 index e4e3342..0000000 --- a/lisp/kanagawa-theme.el +++ /dev/null @@ -1,516 +0,0 @@ -;;; package: --- A theme inspired by the colors of the famous painting by Katsushika Hokusa - -;;; Commentary: Original theme created by rebelot see: https://github.com/rebelot/kanagawa.nvim -;;; Code: - -(eval-when-compile - (require 'cl-lib)) - -(require 'autothemer) - -(unless (>= emacs-major-version 24) - (error "Requires Emacs 24 or later")) - - -(autothemer-deftheme - kanagawa "A theme inspired by the colors of the famous painting by Katsushika Hokusa" - - ((((class color) (min-colors #xFFFFFF)) ; col 1 GUI/24bit - ((class color) (min-colors #xFF))) ; col 2 Xterm/256 - - ;; Define our color palette - (fujiWhite "#DCD7BA" "#ffffff") - (old-white "#C8C093" "#ffffff") - - (sumiInk-0 "#16161D" "#000000") - (sumiInk-1b "#1f1f28" "#000000") - (sumiInk-1 "#1F1F28" "#080808") - (sumiInk-2 "#2A2A37" "#121212") - (sumiInk-3 "#363646" "#303030") - (sumiInk-4 "#54546D" "#303030") - - (waveBlue-1 "#223249" "#4e4e4e") - (waveBlue-2 "#2D4F67" "#585858") - (waveAqua1 "#6A9589" "#6a9589") - (waveAqua2 "#7AA89F" "#717C7C") - - (winterGreen "#2B3328" "#585858") - (winterYellow "#49443C" "#585858") - (winterRed "#43242B" "#585858") - (winterBlue "#252535" "#585858") - - (autumnGreen "#76946A" "#585858") - (autumnRed "#C34043" "#585858") - (autumnYellow "#DCA561" "#585858") - - (samuraiRed "#E82424" "#585858") - (roninYellow "#FF9E3B" "#585858") - - (dragonBlue "#658594" "#658594") - (fujiGray "#727169" "#717C7C") - (springViolet1 "#938AA9" "#717C7C") - (oniViolet "#957FB8" "#717C7C") - (crystalBlue "#7E9CD8" "#717C7C") - (springViolet2 "#9CABCA" "#717C7C") - (springBlue "#7FB4CA" "#717C7C") - (lightBlue "#A3D4D5" "#717C7C") - (springGreen "#98BB6C" "#717C7C") - (boatYellow1 "#938056" "#717C7C") - (boatYellow2 "#C0A36E" "#717C7C") - (carpYellow "#E6C384" "#717C7C") - (sakuraPink "#D27E99" "#717C7C") - (waveRed "#E46876" "#717C7C") - (peachRed "#FF5D62" "#717C7C") - (surimiOrange "#FFA066" "#717C7C") - (katanaGray "#717C7C" "#717C7C") - (comet "#54536D" "#4e4e4e")) - - ;; Customize faces - ( - (default (:background sumiInk-1b :foreground fujiWhite)) - (border (:background sumiInk-1b :foreground sumiInk-0)) - (button (:foreground waveAqua2)) - (child-frame (:background sumiInk-0 :foreground sumiInk-0)) - (child-frame-border (:background sumiInk-0 :foreground sumiInk-0)) - (cursor (:background lightBlue :foreground sumiInk-0 :bold t)) - (error (:foreground samuraiRed)) - (fringe (:foreground sumiInk-3)) - (glyph-face (:background sumiInk-4)) - (glyphless-char (:foreground sumiInk-4)) - (header-line (:background sumiInk-0)) - (highlight (:background comet :foreground springViolet1)) - (hl-line (:background sumiInk-2)) - (homoglyph (:foreground lightBlue)) - (internal-border (:background sumiInk-1b)) - (line-number (:foreground sumiInk-4)) - (line-number-current-line (:foreground springViolet2 :background sumiInk-2 :bold t)) - (lv-separator (:foreground waveBlue-2 :background sumiInk-2)) - (match (:background carpYellow :foreground sumiInk-0)) - (menu (:background sumiInk-0 :foreground fujiWhite)) - (mode-line (:background sumiInk-0)) - (mode-line-inactive (:background nil :foreground sumiInk-4 :bold nil)) - (mode-line-active (:background sumiInk-0 :foreground old-white :bold nil)) - (mode-line-highlight (:foreground boatYellow2)) - (mode-line-buffer-id (:foreground waveAqua2 :bold t)) - (numbers (:background sakuraPink)) - (region (:background waveBlue-2)) - (separator-line (:background sumiInk-0)) - (shadow (:background sumiInk-0)) - (success (:foreground waveAqua2)) - (vertical-border (:foreground sumiInk-4)) - (warning (:foreground roninYellow)) - (window-border (:background sumiInk-1b)) - (window-divider (:foreground sumiInk-2)) - (hi-yellow (:background carpYellow :foreground sumiInk-1b)) - - ;; Font lock - (font-lock-type-face (:foreground waveAqua2)) - (font-lock-regexp-grouping-backslash (:foreground boatYellow2)) - (font-lock-keyword-face (:foreground oniViolet :weight 'semi-bold)) - (font-lock-warning-face (:foreground roninYellow)) - (font-lock-string-face (:foreground springGreen :italic t)) - (font-lock-builtin-face (:foreground springBlue)) - (font-lock-reference-face (:foreground peachRed)) - (font-lock-constant-face (:foreground carpYellow)) - (font-lock-function-name-face (:foreground crystalBlue)) - (font-lock-variable-name-face (:foreground waveRed)) - (font-lock-negation-char-face (:foreground peachRed)) - (font-lock-comment-face (:foreground fujiGray :italic t)) - (font-lock-comment-delimiter-face (:foreground fujiGray :italic t)) - (font-lock-doc-face (:foreground comet)) - (font-lock-doc-markup-face (:foreground comet)) - (font-lock-preprocessor-face (:foreground boatYellow2)) - (elisp-shorthand-font-lock-face (:foreground fujiWhite)) - - (info-xref (:foreground carpYellow)) - (minibuffer-prompt-end (:foreground autumnRed :background winterRed)) - (minibuffer-prompt (:foreground carpYellow :background winterYellow)) - (epa-mark (:foreground waveRed)) - (dired-mark (:foreground waveRed)) - (trailing-whitespace (:background comet)) - (mode-line (:background sumiInk-0 :foreground fujiWhite :bold t)) - - ;; Battery colors - (doom-modeline-battery-critical (:foreground peachRed)) - (doom-modeline-battery-warning (:foreground springGreen)) - (doom-modeline-battery-charging (:foreground fujiGray)) - (doom-modeline-battery-error (:foreground peachRed)) - (doom-modeline-battery-normal (:foreground springViolet1)) - (doom-modeline-battery-full (:foreground waveAqua2)) - - ;; Doom visual state - (doom-modeline-evil-motion-state (:foreground lightBlue)) - (doom-modeline-evil-emacs-state (:foreground crystalBlue)) - (doom-modeline-evil-insert-state (:foreground peachRed)) - (doom-modeline-evil-normal-state (:foreground lightBlue)) - (doom-modeline-evil-visual-state (:foreground springGreen)) - (doom-modeline-evil-replace-state (:foreground roninYellow)) - (doom-modeline-evil-operator-state (:foreground crystalBlue)) - - (doom-modeline-project-dir (:bold t :foreground waveAqua2)) - (doom-modeline-buffer-path (:inherit 'bold :foreground waveAqua2)) - (doom-modeline-buffer-file (:inherit 'bold :foreground oniViolet)) - (doom-modeline-buffer-modified (:inherit 'bold :foreground carpYellow)) - (doom-modeline-error (:background peachRed)) - (doom-modeline-buffer-major-mode (:foreground waveAqua2 :bold t)) - (doom-modeline-info (:bold t :foreground lightBlue)) - (doom-modeline-project-dir (:bold t :foreground surimiOrange)) - (doom-modeline-bar (:bold t :background springViolet1)) - (doom-modeline-panel (:inherit 'bold :background boatYellow2 :foreground sumiInk-2)) - (doom-themes-visual-bell (:background autumnRed)) - - ;; elfeed - (elfeed-search-feed-face (:foreground springViolet1)) - (elfeed-search-tag-face (:foreground waveAqua2)) - - ;; message colors - (message-header-name (:foreground sumiInk-4)) - (message-header-other (:foreground surimiOrange)) - (message-header-subject (:foreground carpYellow)) - (message-header-to (:foreground old-white)) - (message-header-cc (:foreground waveAqua2)) - (message-header-xheader (:foreground old-white)) - (custom-link (:foreground crystalBlue)) - (link (:foreground crystalBlue)) - - ;; org-mode - (org-done (:foreground dragonBlue)) - (org-code (:background sumiInk-0)) - (org-meta-line (:background winterGreen :foreground springGreen)) - (org-block (:background sumiInk-0 :foreground sumiInk-4)) - (org-block-begin-line (:background winterBlue :foreground springBlue)) - (org-block-end-line (:background winterRed :foreground peachRed)) - (org-headline-done (:foreground dragonBlue :strike-through t)) - (org-todo (:foreground surimiOrange :bold t)) - (org-headline-todo (:foreground sumiInk-2)) - (org-upcoming-deadline (:foreground peachRed)) - (org-footnote (:foreground waveAqua2)) - (org-indent (:background sumiInk-1b :foreground sumiInk-1b)) - (org-hide (:background sumiInk-1b :foreground sumiInk-1b)) - (org-date (:foreground waveBlue-2)) - (org-ellipsis (:foreground waveBlue-2 :bold t)) - (org-level-1 (:foreground peachRed :height 1.3 :bold t)) - (org-level-2 (:foreground springViolet2 :height 1.15 :bold t)) - (org-level-3 (:foreground boatYellow2 :height 1.05)) - (org-level-4 (:foreground fujiWhite)) - (org-level-5 (:foreground fujiWhite)) - (org-level-6 (:foreground carpYellow)) - (org-level-7 (:foreground surimiOrange)) - (org-level-8 (:foreground springGreen)) - - ;; which-key - (which-key-key-face (:inherit 'font-lock-variable-name-face)) - (which-func (:inherit 'font-lock-function-name-face :bold t)) - (which-key-group-description-face (:foreground waveRed)) - (which-key-command-description-face (:foreground crystalBlue)) - (which-key-local-map-description-face (:foreground carpYellow)) - (which-key-posframe (:background waveBlue-1)) - (which-key-posframe-border (:background waveBlue-1)) - - ;; swiper - (swiper-line-face (:foreground carpYellow)) - (swiper-background-match-face-1 (:background surimiOrange :foreground sumiInk-0)) - (swiper-background-match-face-2 (:background crystalBlue :foreground sumiInk-0)) - (swiper-background-match-face-3 (:background boatYellow2 :foreground sumiInk-0)) - (swiper-background-match-face-4 (:background peachRed :foreground sumiInk-0)) - (swiper-match-face-1 (:inherit 'swiper-background-match-face-1)) - (swiper-match-face-2 (:inherit 'swiper-background-match-face-2)) - (swiper-match-face-3 (:inherit 'swiper-background-match-face-3)) - (swiper-match-face-4 (:inherit 'swiper-background-match-face-4)) - - (counsel-outline-default (:foreground carpYellow)) - (info-header-xref (:foreground carpYellow)) - (xref-file-header (:foreground carpYellow)) - (xref-match (:foreground carpYellow)) - - ;; rainbow delimiters - (rainbow-delimiters-mismatched-face (:foreground peachRed)) - (rainbow-delimiters-unmatched-face (:foreground waveAqua2)) - (rainbow-delimiters-base-error-face (:foreground peachRed)) - (rainbow-delimiters-base-face (:foreground sumiInk-4)) - - (rainbow-delimiters-depth-1-face (:foreground springViolet2)) - (rainbow-delimiters-depth-2-face (:foreground dragonBlue)) - (rainbow-delimiters-depth-3-face (:foreground springViolet1)) - (rainbow-delimiters-depth-4-face (:foreground springGreen)) - (rainbow-delimiters-depth-5-face (:foreground waveAqua2)) - (rainbow-delimiters-depth-6-face (:foreground carpYellow)) - (rainbow-delimiters-depth-7-face (:foreground waveRed)) - (rainbow-delimiters-depth-8-face (:foreground lightBlue)) - (rainbow-delimiters-depth-9-face (:foreground springViolet2)) - - ;; show-paren - (show-paren-match (:background waveAqua1 :foreground sumiInk-0 :bold t)) - (show-paren-match-expression (:background waveAqua1 :foreground sumiInk-0 :bold t)) - (show-paren-mismatch (:background peachRed :foreground old-white)) - (tooltip (:foreground sumiInk-0 :background carpYellow :bold t)) - - ;; company-box - (company-tooltip (:background sumiInk-2)) - (company-tooltip-common (:foreground autumnYellow)) - (company-tooltip-quick-access (:foreground springViolet2)) - (company-tooltip-scrollbar-thumb (:background autumnRed)) - (company-tooltip-scrollbar-track (:background sumiInk-2)) - (company-tooltip-search (:background carpYellow :foreground sumiInk-0 :distant-foreground fujiWhite)) - (company-tooltip-selection (:background peachRed :foreground winterRed :bold t)) - (company-tooltip-mouse (:background sumiInk-2 :foreground sumiInk-0 :distant-foreground fujiWhite)) - (company-tooltip-annotation (:foreground peachRed :distant-foreground sumiInk-1)) - (company-scrollbar-bg (:inherit 'tooltip)) - (company-scrollbar-fg (:background peachRed)) - (company-preview (:foreground carpYellow)) - (company-preview-common (:foreground peachRed :bold t)) - (company-preview-search (:inherit 'company-tooltip-search)) - (company-template-field (:inherit 'match)) - - ;; flycheck - (flycheck-posframe-background-face (:background sumiInk-0)) - (flycheck-posframe-face (:background sumiInk-0)) - (flycheck-posframe-info-face (:background sumiInk-0 :foreground autumnGreen)) - (flycheck-posframe-warning-face (:background sumiInk-0 :foreground lightBlue)) - (flycheck-posframe-error-face (:background sumiInk-0 :foreground samuraiRed)) - (flycheck-fringe-warning (:foreground lightBlue)) - (flycheck-fringe-error (:foreground samuraiRed)) - (flycheck-fringe-info (:foreground autumnGreen)) - (flycheck-error-list-warning (:foreground roninYellow :bold t)) - (flycheck-error-list-error (:foreground samuraiRed :bold t)) - (flycheck-error-list-info (:foreground waveAqua1 :bold t)) - (flycheck-inline-error (:foreground samuraiRed :background winterRed :italic t :bold t :height 138)) - (flycheck-inline-info (:foreground lightBlue :background winterBlue :italic t :bold t :height 138)) - (flycheck-inline-warning (:foreground winterYellow :background carpYellow :italic t :bold t :height 138)) - - ;; indent dots - (highlight-indent-guides-character-face (:foreground sumiInk-3)) - (highlight-indent-guides-stack-character-face (:foreground sumiInk-3)) - (highlight-indent-guides-stack-odd-face (:foreground sumiInk-3)) - (highlight-indent-guides-stack-even-face (:foreground comet)) - (highlight-indent-guides-stack-character-face (:foreground sumiInk-3)) - (highlight-indent-guides-even-face (:foreground sumiInk-2)) - (highlight-indent-guides-odd-face (:foreground comet)) - - (highlight-operators-face (:foreground boatYellow2)) - (highlight-quoted-symbol (:foreground springGreen)) - (highlight-numbers-face (:foreground sakuraPink)) - (highlight-symbol-face (:background waveBlue-1 :foreground lightBlue)) - - ;; ivy - (ivy-current-match (:background crystalBlue :foreground sumiInk-0 :bold t)) - (ivy-action (:background nil :foreground fujiWhite)) - (ivy-grep-line-number (:background nil :foreground springGreen)) - (ivy-minibuffer-match-face-1 (:background nil :foreground waveRed)) - (ivy-minibuffer-match-face-2 (:background nil :foreground springGreen)) - (ivy-minibuffer-match-highlight (:foreground lightBlue)) - (ivy-grep-info (:foreground lightBlue)) - (ivy-grep-line-number (:foreground springViolet2)) - (ivy-confirm-face (:foreground waveAqua2)) - - ;; posframe's - (ivy-posframe (:background sumiInk-2)) - (ivy-posframe-border (:background sumiInk-3)) - - ;;treemacs - (treemacs-directory-collapsed-face (:foreground fujiWhite)) - (treemacs-directory-face (:foreground fujiWhite)) - (treemacs-file-face (:foreground fujiWhite)) - - (treemacs-git-added-face (:foreground surimiOrange)) - (treemacs-git-renamed-face (:foreground fujiWhite)) - (treemacs-git-ignored-face (:foreground sumiInk-4)) - (treemacs-git-unmodified-face (:foreground fujiWhite)) - (treemacs-git-renamed-face (:foreground fujiWhite)) - (treemacs-git-modified-face (:foreground springGreen)) - - ;; lsp and lsp-ui - (lsp-headerline-breadcrumb-path-error-face (:underline (:color springGreen :style 'wave) :foreground sumiInk-4 :background sumiInk-0)) - (lsp-headerline-breadcrumb-path-face (:background sumiInk-0)) - (lsp-headerline-breadcrumb-path-hint-face (:background sumiInk-0)) - (lsp-headerline-breadcrumb-path-info-face (:background sumiInk-0)) - (lsp-headerline-breadcrumb-separator-face (:background sumiInk-0)) - (lsp-headerline-breadcrumb-symbols-face (:background sumiInk-0)) - (lsp-headerline-breadcrumb-project-prefix-face (:background sumiInk-0)) - (lsp-headerline-breadcrumb-symbols-error-face (:foreground peachRed)) - - (lsp-ui-doc-background (:background sumiInk-0 :foreground peachRed)) - (lsp-ui-doc-header (:background sumiInk-0 :foreground peachRed)) - (lsp-ui-doc-border (:background nil :foreground nil)) - (lsp-ui-peek-filename (:foreground lightBlue)) - (lsp-ui-sideline-code-action (:foreground carpYellow)) - (lsp-ui-sideline-current-symbol (:foreground springBlue)) - (lsp-ui-sideline-symbol (:foreground dragonBlue)) - - ;; dashboard - (dashboard-heading (:foreground springViolet2 :bold t)) - (dashboard-items-face (:bold nil :foreground fujiWhite)) - (dashboard-banner-logo-title (:bold t :height 200)) - (dashboard-no-items-face (:foreground sumiInk-4)) - - ;; all-the-icons - (all-the-icons-dgreen (:foreground waveAqua2)) - (all-the-icons-green (:foreground waveAqua2)) - (all-the-icons-dpurple (:foreground springViolet2)) - (all-the-icons-purple (:foreground springViolet2)) - - ;; evil - (evil-ex-lazy-highlight (:foreground winterGreen :background autumnGreen :bold t)) - (evil-ex-substitute-matches (:foreground winterRed :background autumnRed :bold t)) - (evil-ex-substitute-replacement (:foreground surimiOrange :strike-through nil :inherit 'evil-ex-substitute-matches)) - (evil-search-highlight-persist-highlight-face (:background carpYellow)) - - ;; term - (term (:background sumiInk-0 :foreground fujiWhite)) - (term-color-blue (:background crystalBlue :foreground crystalBlue)) - (term-color-bright-blue (:inherit 'term-color-blue)) - (term-color-green (:background waveAqua2 :foreground waveAqua2)) - (term-color-bright-green (:inherit 'term-color-green)) - (term-color-black (:background sumiInk-0 :foreground fujiWhite)) - (term-color-bright-black (:background sumiInk-1b :foreground sumiInk-1b)) - (term-color-white (:background fujiWhite :foreground fujiWhite)) - (term-color-bright-white (:background old-white :foreground old-white)) - (term-color-red (:background peachRed :foreground peachRed)) - (term-color-bright-red (:background springGreen :foreground springGreen)) - (term-color-yellow (:background carpYellow :foreground carpYellow)) - (term-color-bright-yellow (:background carpYellow :foreground carpYellow)) - (term-color-cyan (:background springBlue :foreground springBlue)) - (term-color-bright-cyan (:background springBlue :foreground springBlue)) - (term-color-magenta (:background springViolet2 :foreground springViolet2)) - (term-color-bright-magenta (:background springViolet2 :foreground springViolet2)) - - ;; popup - (popup-face (:inherit 'tooltip)) - (popup-selection-face (:inherit 'tooltip)) - (popup-tip-face (:inherit 'tooltip)) - - ;; anzu - (anzu-match-1 (:foreground waveAqua2 :background sumiInk-2)) - (anzu-match-2 (:foreground carpYellow :background sumiInk-2)) - (anzu-match-3 (:foreground lightBlue :background sumiInk-2)) - - (anzu-mode-line (:foreground sumiInk-0 :background springViolet2)) - (anzu-mode-no-match (:foreground fujiWhite :background peachRed)) - (anzu-replace-to (:foreground springBlue :background winterBlue)) - (anzu-replace-highlight (:foreground peachRed :background winterRed :strike-through t)) - - ;; ace - (ace-jump-face-background (:foreground waveBlue-2)) - (ace-jump-face-foreground (:foreground peachRed :background sumiInk-0 :bold t)) - - ;; vertico - (vertico-multiline (:background samuraiRed)) - (vertico-group-title (:background winterBlue :foreground lightBlue :bold t)) - (vertico-group-separator (:background winterBlue :foreground lightBlue :strike-through t)) - (vertico-current (:foreground carpYellow :bold t :italic t :background waveBlue-1)) - - (vertico-posframe-border (:background sumiInk-3)) - (vertico-posframe (:background sumiInk-2)) - (orderless-match-face-0 (:foreground crystalBlue :bold t)) - - (comint-highlight-prompt (:background springViolet2 :foreground sumiInk-1)) - (completions-annotations (:background nil :foreground dragonBlue :italic t)) - (marginalia-file-priv-no (:background 'unspecified)) - - ;; hydra - (hydra-face-amaranth (:foreground autumnRed)) - (hydra-face-blue (:foreground springBlue)) - (hydra-face-pink (:foreground sakuraPink)) - (hydra-face-red (:foreground peachRed)) - (hydra-face-teal (:foreground lightBlue)) - - ;; centaur-tabs - (centaur-tabs-active-bar-face (:background springBlue :foreground fujiWhite)) - (centaur-tabs-selected (:background sumiInk-1b :foreground fujiWhite :bold t)) - (centaur-tabs-selected-modified (:background sumiInk-1b :foreground fujiWhite)) - (centaur-tabs-modified-marker-selected (:background sumiInk-1b :foreground autumnYellow)) - (centaur-tabs-close-selected (:inherit 'centaur-tabs-selected)) - (tab-line (:background sumiInk-0)) - - (centaur-tabs-unselected (:background sumiInk-0 :foreground sumiInk-4)) - (centaur-tabs-default (:background sumiInk-0 :foreground sumiInk-4)) - (centaur-tabs-unselected-modified (:background sumiInk-0 :foreground peachRed)) - (centaur-tabs-modified-marker-unselected (:background sumiInk-0 :foreground sumiInk-4)) - (centaur-tabs-close-unselected (:background sumiInk-0 :foreground sumiInk-4)) - - (centaur-tabs-close-mouse-face (:background nil :foreground peachRed)) - (centaur-tabs-default (:background roninYellow )) - (centaur-tabs-name-mouse-face (:foreground springBlue :bold t)) - - (git-gutter:added (:foreground autumnGreen)) - (git-gutter:deleted (:foreground waveRed)) - (git-gutter:modified (:foreground springBlue)) - - (diff-hl-margin-change (:foreground springBlue :background winterBlue)) - (diff-hl-margin-delete (:foreground peachRed :background winterRed)) - (diff-hl-margin-insert (:foreground comet :background winterBlue)) - - (bm-fringe-face (:background peachRed :foreground sumiInk-3)) - (bm-fringe-persistent-face (:background peachRed :foreground sumiInk-3)) - - (ansi-color-green (:foreground springGreen)) - (ansi-color-black (:background sumiInk-0)) - (ansi-color-cyan (:foreground waveAqua2)) - (ansi-color-magenta (:foreground sakuraPink)) - (ansi-color-blue (:foreground crystalBlue)) - (ansi-color-red (:foreground peachRed)) - (ansi-color-white (:foreground fujiWhite)) - (ansi-color-yellow (:foreground autumnYellow)) - (ansi-color-bright-white (:foreground old-white)) - (ansi-color-bright-white (:foreground old-white)) - - (tree-sitter-hl-face:attribute (:foreground surimiOrange)) - (tree-sitter-hl-face:escape (:foreground waveRed)) - (tree-sitter-hl-face:constructor (:foreground waveRed :weight 'semi-bold)) - - (tree-sitter-hl-face:constant (:foreground surimiOrange)) - (tree-sitter-hl-face:constant.builtin (:foreground carpYellow :weight 'semi-bold)) - - (tree-sitter-hl-face:embedded (:foreground boatYellow2)) - - (tree-sitter-hl-face:function (:foreground crystalBlue)) - (tree-sitter-hl-face:function.builtin (:foreground peachRed :italic t :background winterRed)) - (tree-sitter-hl-face:function.call (:foreground springViolet2)) - (tree-sitter-hl-face:function.macro (:foreground samuraiRed)) - (tree-sitter-hl-face:function.special (:foreground sakuraPink)) - (tree-sitter-hl-face:function.label (:foreground surimiOrange)) - - (tree-sitter-hl-face:method (:foreground lightBlue)) - (tree-sitter-hl-face:method.call (:foreground lightBlue)) - - (tree-sitter-hl-face:property (:foreground carpYellow)) - (tree-sitter-hl-face:property.definition (:foreground old-white :italic t)) - - (tree-sitter-hl-face:tag (:foreground peachRed)) - - (tree-sitter-hl-face:type (:foreground waveAqua2 :weight 'semi-bold)) - (tree-sitter-hl-face:type.argument (:foreground surimiOrange)) - (tree-sitter-hl-face:type.builtin (:foreground autumnRed)) - (tree-sitter-hl-face:type.parameter (:foreground surimiOrange)) - (tree-sitter-hl-face:type.super (:foreground samuraiRed :bold t)) - - (tree-sitter-hl-face:variable (:foreground springBlue :italic t)) - (tree-sitter-hl-face:variable.builtin (:foreground waveRed)) - (tree-sitter-hl-face:variable.parameter (:foreground springViolet2 :italic t)) - (tree-sitter-hl-face:variable.special (:foreground surimiOrange)) - (tree-sitter-hl-face:variable.synthesized (:foreground lightBlue)) - - (tree-sitter-hl-face:number (:foreground sakuraPink)) - (tree-sitter-hl-face:operator (:foreground sakuraPink :bold t)) - - (tree-sitter-hl-face:punctuation (:foreground lightBlue)) - (tree-sitter-hl-face:punctuation.bracket (:foreground springViolet2 :bold t)) - (tree-sitter-hl-face:punctuation.delimiter (:foreground springViolet2 :bold t)) - (tree-sitter-hl-face:punctuation.special (:foreground peachRed)) - - (tree-sitter-hl-face:case-pattern (:foreground waveRed)) - (tree-sitter-hl-face:variable.synthesized (:foreground waveRed)) - (tree-sitter-hl-face:keyword.compiler (:foreground peachRed :bold t :italic t)) - - (focus-unfocused (:foreground sumiInk-4)) - )) - -;;;###autoload -(and load-file-name - (boundp 'custom-theme-load-path) - (add-to-list 'custom-theme-load-path - (file-name-as-directory - (file-name-directory load-file-name)))) - -(provide-theme 'kanagawa) -;;; kanagawa-theme.el ends here diff --git a/lisp/org-custom.el b/lisp/org-custom.el index 573ddb3..2af529a 100644 --- a/lisp/org-custom.el +++ b/lisp/org-custom.el @@ -26,11 +26,32 @@ `(org-document-title ((t (,@headline ,@variable-tuple :height 1.3 :weight bold)))))) - (use-package org-bullets + ;; (use-package org-bullets + ;; :ensure t + ;; :config + ;; (org-bullets-mode 1) + ;; ) + + (use-package org-modern :ensure t :config - (org-bullets-mode 1) - ) + (global-org-modern-mode)) + + (setq org-ellipsis "…") + (set-face-attribute 'org-ellipsis nil :inherit 'default :box nil) + + (setq + ;; Edit settings + org-auto-align-tags nil + org-tags-column 0 + org-catch-invisible-edits 'show-and-error + org-special-ctrl-a/e t + org-insert-heading-respect-content t + + ;; Org styling, hide markup etc. + org-hide-emphasis-markers t + org-pretty-entities t + org-agenda-tags-column 0) (org-indent-mode 1) (visual-line-mode 1)) @@ -85,7 +106,7 @@ '(("d" "default" entry "* %?" :target (file+head "%<%Y-%m-%d>.org" - "#+title: %<%Y-%m-%d> 📰 \n#+filetags: :dailies: \n\n* Timeline 🍞\n\n* Notes 📁\n\n* Questions ❓\n\n")))) + "#+title: %<%Y-%m-%d> 📰 \n#+filetags: :dailies: \n\n[[file:%(format-time-string \"%Y-%m-%d\" (time-subtract (current-time) (days-to-time 1))).org][← Previous Day]]\n\n* Tasks 🎯\n\n* Notes 📁\n\n")))) (setq org-roam-capture-templates '(("d" "default" plain "%?" diff --git a/lisp/ultra-scroll.el b/lisp/ultra-scroll.el new file mode 100644 index 0000000..1df5ddb --- /dev/null +++ b/lisp/ultra-scroll.el @@ -0,0 +1,302 @@ +;;; ultra-scroll.el --- Fast and smooth scrolling -*- lexical-binding: t; -*- +;; Copyright (C) 2023-2025 J.D. Smith + +;; Author: J.D. Smith +;; Homepage: https://github.com/jdtsmith/ultra-scroll +;; Package-Requires: ((emacs "29.1")) +;; Version: 0.2.1 +;; Keywords: convenience +;; Prefix: ultra-scroll +;; Separator: - + +;; ultra-scroll 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. + +;; ultra-scroll 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: +;; ultra-scroll enables fast, smooth, jump-free scrolling for Emacs. +;; On emacs-mac it retains the swipe-to-scroll and pinch-out for tab +;; overview capabilities of that port. On all ports, it can scroll +;; past images taller than the window without problem. +;; +;; The strongly recommended scroll settings are: +;; scroll-margin=0 +;; scroll-conservatively=101 +;; +;; See also pixel-scroll-precision-mode in pixel-scroll.el. + +;;; Code: +;;;; Requires +(require 'mac-win nil 'noerror) +(require 'pixel-scroll) +(require 'mwheel) +(require 'timer) + +;;;; Customize +(defcustom ultra-scroll-mac-multiplier 1. + "Multiplier for smooth scroll step for wheeled mice on emacs-mac. +This multiplies the fractional delta-y values generated by +regular mouse wheels by the value returned by +`frame-char-height'. Increase it to increase scrolling speed on +such mice. Note that some mice drivers emulate trackpads, and so +will not be affected by this setting. Adjust scrolling speed +directly with those drivers instead." + :group 'scrolling + :type 'float) + +(defcustom ultra-scroll-gc-percentage 0.67 + "Value to temporarily set `gc-cons-percentage'. +This is set on initial scrolling, and restored during idle +time (see `ultra-scroll-gc-idle-time')." + :type '(choice (const :tag "Disable" nil) float) + :group 'scrolling) + +(defcustom ultra-scroll-gc-idle-time 0.5 + "Idle time in sec after which to restore `gc-cons-percentage'. +Operates only if `ultra-scroll-gc-percentage' is non-nil." + :type 'float + :group 'scrolling) + +;;;; Event callback/scroll +(defun ultra-scroll-down (delta) + "Scroll the current window down by DELTA pixels. +DELTA should not be larger than the height of the current window." + (let* ((initial (point)) + (edges (window-edges nil t nil t)) + (current-vs (window-vscroll nil t)) + (off (+ (window-tab-line-height) (window-header-line-height))) + (new-start (or (posn-point (posn-at-x-y 0 (+ delta off))) (window-start)))) + (goto-char new-start) + (unless (zerop (window-hscroll)) + (setq new-start (beginning-of-visual-line))) + (if (>= (line-pixel-height) (- (nth 3 edges) (nth 1 edges))) + ;; Jumbo line at top: just stay on it and increment vscroll + (set-window-vscroll nil (+ current-vs delta) t t) + (if (eq new-start (window-start)) ; same start: just vscroll a bit more + (setq delta (+ current-vs delta)) + (setq delta (- delta (cdr (posn-x-y (posn-at-point new-start))))) + (set-window-start nil new-start (not (zerop delta)))) + (set-window-vscroll nil delta t t) + ;; Avoid recentering + (goto-char (posn-point (posn-at-x-y 0 off))) ; window-start may be above + (if (zerop (vertical-motion 1)) ; move down 1 line from top + (signal 'end-of-buffer nil)) + (if (> initial (point)) (goto-char initial))))) + +(defun ultra-scroll-up (delta) + "Scroll the current window up by DELTA pixels. +DELTA should be less than the window's height." + (let* ((initial (point)) + (edges (window-edges nil t nil t)) + (win-height (- (nth 3 edges) (nth 1 edges))) + (win-start (window-start)) + (current-vs (window-vscroll nil t)) + (start win-start)) + (if (<= delta current-vs) ; simple case: just reduce vscroll + (setq delta (- current-vs delta)) + ; Not enough vscroll: measure size above window-start + (let* ((dims (window-text-pixel-size nil (cons start (- current-vs delta)) + start nil nil nil t)) + (pos (nth 2 dims)) + (height (nth 1 dims))) + (when (or (not pos) (eq pos (point-min))) + (signal 'beginning-of-buffer nil)) + (setq start (nth 2 dims) + delta (- (+ height current-vs) delta))) ; should be >= 0 + (unless (eq start win-start) + (set-window-start nil start (not (zerop delta))))) + (when (>= delta 0) (set-window-vscroll nil delta t t)) + + ;; Position point to avoid recentering, moving up one line from + ;; the bottom, if necessary. "Jumbo" lines (taller than the + ;; window height, usually due to images) must be handled + ;; carefully. Once they are within the window, point should stay + ;; on the first tall object on the line until the top of the jumbo + ;; line clears the top of the window, then immediately moved off + ;; (above), via the full height character. The is the only way to + ;; avoid unwanted re-centering/motion trapping. + (if (> (line-pixel-height) win-height) ; a jumbo on the line! + (let ((end (max (point) + (save-excursion + (end-of-visual-line) + (1- (point)))))) ; don't fall off + (when-let ((pv (pos-visible-in-window-p end nil t)) + ((and (> (length pv) 2) ; falls outside window + (zerop (nth 2 pv))))) ; but not at the top + (goto-char end) ; eol is usually full height + (goto-char start))) ; now move up + (when-let ((p (posn-at-x-y 0 (1- win-height)))) + (goto-char (posn-point p)) + (vertical-motion -1) + (if (< initial (point)) (goto-char initial)))))) + +(defvar ultra-scroll--gc-percentage-orig nil) +(defvar ultra-scroll--gc-timer nil) +(defun ultra-scroll--restore-gc () + "Reset GC variable during idle time." + (setq gc-cons-percentage + (or ultra-scroll--gc-percentage-orig 0.1) + ultra-scroll--gc-timer nil)) + +(defsubst ultra-scroll--scroll (delta window) + "Scroll by WINDOW by DELTA (positive or negative)." + (let (ignore) + (unless (or (zerop delta) + (and (setq ignore (window-parameter window 'ultra-scroll--ignore)) + (or (and (eq (point) (car ignore)) ; ignoring this window this direction + (eq (cdr ignore) (< delta 0))) + (set-window-parameter window 'ultra-scroll--ignore nil)))) + (with-selected-window window + (condition-case err + (if (< delta 0) + (ultra-scroll-down (- delta)) + (ultra-scroll-up delta)) + ;; Do not ding at buffer limits. Show a message instead (once!). + ((beginning-of-buffer end-of-buffer) + (let* ((end (eq (car err) 'end-of-buffer)) + (p (if end (point-max) (point-min)))) + (goto-char p) + (set-window-start window p) + (set-window-vscroll window 0 t t) + (set-window-parameter window 'ultra-scroll--ignore + (cons (point) end)) + (message (error-message-string + (if end '(end-of-buffer) '(beginning-of-buffer))))))))))) + +(defsubst ultra-scroll--maybe-relax-gc () + "Lift the GC threshold percentage to avoid GC during scroll. +See `ultra-scroll-gc-percentage' to configuring whether this +occurs and the `gc-cons-percentage' level to set temporarily." + (when (and ultra-scroll-gc-percentage (not ultra-scroll--gc-timer)) + (setq gc-cons-percentage ; reduce GC's during scroll + (max gc-cons-percentage ultra-scroll-gc-percentage) + ultra-scroll--gc-timer + (run-with-idle-timer ultra-scroll-gc-idle-time nil + #'ultra-scroll--restore-gc)))) + +(defun ultra-scroll (event &optional arg) + "Smooth scroll EVENT. +EVENT and optional ARG are passed to `mwheel-scroll', unless +EVENT is a scrolling event." + (interactive "e") + (let ((delta (nth 4 event))) + (if (not delta) + (mwheel-scroll event arg) + (ultra-scroll--maybe-relax-gc) + (ultra-scroll--scroll (round (cdr delta)) (mwheel-event-window event))))) + +(declare-function mac-forward-wheel-event "mac-win") +(defun ultra-scroll-mac (event &optional arg) + "Smooth scroll EVENT for emacs-mac. +EVENT and optional ARG are passed on to `mwheel-scroll', for any +events not handled here. If swipe-tracking is enabled for +swipe-between-pages at the OS level, left-/right-swipe events +will be replayed for left/right touch ends." + (interactive "e") + (let ((ev-type (event-basic-type event)) + (plist (nth 3 event))) + (if (not (memq ev-type '(wheel-up wheel-down))) + (when (memq ev-type '(wheel-left wheel-right)) + (if mouse-wheel-tilt-scroll + (mac-forward-wheel-event t 'mwheel-scroll event arg) + (when (and ;; "Swipe between pages" enabled. + (plist-get plist :swipe-tracking-from-scroll-events-enabled-p) + (eq (plist-get plist :momentum-phase) 'began)) + ;; Post a swipe event when left/right momentum phase begins + (push (cons (event-convert-list + (nconc (delq 'click + (delq 'double + (delq 'triple + (event-modifiers event)))) + (if (eq (event-basic-type event) 'wheel-left) + '(swipe-left) '(swipe-right)))) + (cdr event)) + unread-command-events)))) + ;; Note: emacs-mac encodes all scrolling information in the PLIST, as follows: + ;; trackpads: + ;; - `:scrolling-delta-x' and `:scrolling-delta-y' are set + ;; to pixel scroll amounts. + ;; - `:phase' is set to `began' on first scroll, then `changed'. + ;; - During momentum scroll, `:momentum-phase' is set to + ;; `began' then `changed', while `:phase' is `none'. + ;; some regular wheeled mice: + ;; - `:delta-x' and `:delta-y' are set to floating + ;; fractional line scroll amounts. + ;; - `:phase' is set to `began' on first scroll, then `changed'. + ;; - `:momentum-phase' is always `none'. + (when (eq (plist-get plist :phase) 'began) + (ultra-scroll--maybe-relax-gc)) + (let* ((scroll-delta (plist-get plist :scrolling-delta-y)) + (delta (or scroll-delta + ;; regular non-touch scroll: fraction of a line + (* (plist-get plist :delta-y) (frame-char-height) + ultra-scroll-mac-multiplier)))) + (ultra-scroll--scroll (round delta) (mwheel-event-window event)))))) + +; scroll-isearch support +(put 'ultra-scroll 'scroll-command t) +(put 'ultra-scroll-mac 'scroll-command t) + +(defun ultra-scroll-check () + "Check and report on the scrolling event data your system provides." + (interactive) + (message "ultra-scroll: checking scroll data -- scroll your mouse wheel or track-pad!") + (let* ((nc (string-match "\\bNATIVE_COMP\\b" system-configuration-features)) + ev) + (while (and (setq ev (read-event)) + (not (memq (event-basic-type ev) + '(wheel-up wheel-down))))) + (display-warning + :debug + (format "ultra-scroll-check: %s detected, found %s pixel scroll data%s" + (event-basic-type ev) + (if (featurep 'mac-win) + (let ((plist (nth 3 ev))) + (cond ((null plist) "NO") + ((plist-get plist :scrolling-delta-y) "FULL") + ((plist-get plist :delta-y) "BASIC") + (t "MISSING"))) + (if (nth 4 ev) "FULL" "MISSING")) + (if nc "" " [NO NATIVE COMPILATION!]"))))) + +;;;; Mode +;;;###autoload +(define-minor-mode ultra-scroll-mode + "Toggle pixel precision scrolling for mac. +When enabled, this minor mode scrolls the display precisely using +full mac trackpad capabilities (and simulating them for regular +mouse). Makes use of the underlying pixel-scrolling capabilities +of `ultra-scroll-mode', which see." + :global t + :group 'scrolling + :keymap pixel-scroll-precision-mode-map ; reuse + (cond + (ultra-scroll-mode + (unless (> scroll-conservatively 0) + (warn "ultra-scroll: scroll-conservatively > 0 is required for smooth scrolling of large images; 101 recommended")) + (unless (= scroll-margin 0) + (warn "ultra-scroll: scroll-margin = 0 is required for glitch-free smooth scrolling")) + (define-key pixel-scroll-precision-mode-map [remap pixel-scroll-precision] + (if (featurep 'mac-win) #'ultra-scroll-mac #'ultra-scroll)) + (setf (get 'pixel-scroll-precision-use-momentum 'us-orig-value) + pixel-scroll-precision-use-momentum) + (setq pixel-scroll-precision-use-momentum nil) + (setq ultra-scroll--gc-percentage-orig gc-cons-percentage)) + (t + (define-key pixel-scroll-precision-mode-map [remap pixel-scroll-precision] nil) + (setq pixel-scroll-precision-use-momentum + (get 'pixel-scroll-precision-use-momentum 'us-orig-value)))) + (setq mwheel-coalesce-scroll-events (not ultra-scroll-mode))) + +(provide 'ultra-scroll) +;;; ultra-scroll.el ends here + diff --git a/lisp/vc-annotate-lens-mode.el b/lisp/vc-annotate-lens-mode.el deleted file mode 100644 index b615a1b..0000000 --- a/lisp/vc-annotate-lens-mode.el +++ /dev/null @@ -1,50 +0,0 @@ -;;; Code: - -;;; Commit -;; commit 6257322d751dc36eaaf509682da164f6aef3ff90 -;; Author: Matthew Kosarek <mattkae@protonmail.com> -;; Date: Sat Sep 3 12:01:26 2022 -0400 - -;; Big upgrade to javascript/typescript to use a lanugage server - -;; diff --git a/init.el b/init.el -;; --- a/init.el -;; +++ b/init.el - - -(make-variable-buffer-local - (defvar vc-annotate-lens-cursor-position 0 - "Holds the cursor position from the last run of post-command-hooks.")) - -(defun do-stuff-if-moved-post-command () - "Show version control history of the current line in a flash." - (unless (equal (line-number-at-pos) vc-annotate-lens-cursor-position) - (setq vc-annotate-lens-cursor-position (line-number-at-pos))) - - (remove-overlays) ; TODO: Only remove the overlay that we last displayed - - (let ((git-info (shell-command-to-string (format "git log -u -L%d,%d:%s" vc-annotate-lens-cursor-position vc-annotate-lens-cursor-position buffer-file-name)))) - - (let (( git-info-split (split-string git-info "\n" ))) - (let ( - ( commit-line (nth 0 git-info-split)) - ( author-line (nth 1 git-info-split)) - ( date-line (nth 2 git-info-split))) - (overlay-put (make-overlay (point-at-eol) (+ 3 (point-at-eol))) 'display (format " %s\n" author-line)) - ) - ) - ) - ) - - - (define-minor-mode vc-annotate-lens-mode - "Show 'vc-annotate' information when you move to a line." - :lighter " vc-annotate-lens" - ) - - (add-hook 'vc-annotate-lens-mode-on-hook (lambda () (add-hook 'post-command-hook #'do-stuff-if-moved-post-command))) - (add-hook 'vc-annotate-lens-mode-off-hook (lambda () (remove-hook 'post-command-hook #'do-stuff-if-moved-post-command))) - - (provide 'vc-annotate-lens-mode) -;;; vc-annotate-lens-mode.el ends here. - |