Compare commits

...

3 Commits

Author SHA1 Message Date
Mateusz Słodkowicz 1d99fb630f
Emacs update, fix corfu-mouse 2024-11-20 22:41:58 +01:00
Mateusz Słodkowicz 443da9482a
update 2024-11-20 00:57:28 +01:00
Mateusz Słodkowicz 1e436f0842
update 2024-11-20 00:49:27 +01:00
7 changed files with 252 additions and 162 deletions

View File

@ -5,7 +5,7 @@ spotify-client-secret: ENC[AES256_GCM,data:TnR+zLLklTfzMdR4woaZWuMVJQ9VIYsFM588G
youtube-api: ENC[AES256_GCM,data:qmpFlFvudS9rXQfN+Th/UrPWCW0mg5GkpMucS/01AmOnlChqtojC,iv:q3bKwI2I6BNa3L9ezKCE1fWT/vZLiJ8uzug1z2z+TWA=,tag:gKG3HTz8jp2LAFh8e8O6sg==,type:str]
steamladder-api: ENC[AES256_GCM,data:m30o5atqugwqn/WbXGkUq5GvqiIKQT0kSRQCtHc1Gxk/dC3YcbDvMw==,iv:duLKl1NvysD0XMaUOkl/6nclMQB6seXcQYkGMrm7K7Y=,tag:9dw+UH10uAdca5fVdlw1Mg==,type:str]
webarchive-accesskey: ENC[AES256_GCM,data:jdKlHsZq2Dkk1BcBfUVv5g==,iv:BXCgPb/2W57PYXxRktInz1LxSEwlw6m3xnQU4TOPMeY=,tag:kK4+InaH7K4D4n1hyGaR+w==,type:str]
webarchive-secretkey: ENC[AES256_GCM,data:nuA9G5dNtrNfbcx0G/GUTg==,iv:RRuTm4kZr5dNjBt9Zvk/NVefHCZYODmRvWAqZizKGJY=,tag:J2V0Q3BzXNWifVVvAkwYyg==,type:str]
webarchive-secretkey: ENC[AES256_GCM,data:t7lZ1aA72BrBxaE+jXmE3w==,iv:A8PF/MyRTIluqEzzt4uCw7eNCYDXAt4iB29PSrwlVyY=,tag:6HbtcrFeFcpagjzPXOANzA==,type:str]
certs: ENC[AES256_GCM,data:ttmSNTTx51a3L2HTC8RnSphDLHO2OSyIgXQ0YpZGySTdu69mgEyhaiSi+IAXg/1AHKRjpFJgE4fhsLAiW78pNYb+Zg7aDL47YtABO99sTZrZnBxZo6k6itpZ3oClDch2ZALzoXChLroc0tUbZKwsfOwGe3pw9lOJZJT34AhV+BVoXDDLQcpQoxz23Baa8oxklecT6wpJ1u1nW+aAHw33gm41Vw==,iv:b0aNZwaRKBg+ipe5+19BowyFbCjZt52S738om6emYGo=,tag:lUqtcc4vVWKx/fnc19vj7A==,type:str]
sops:
kms: []
@ -22,8 +22,8 @@ sops:
d2dMUUh1RDB3UnpEdFJsNHpQRXFWemMKc41dlOapTsvH91QLNhdPbrzerPFakOiX
J/uoZDMIhsmQxgQM7Fqxr05NywhI/ZjOtJS2bayp73O57xjjMYcyNQ==
-----END AGE ENCRYPTED FILE-----
lastmodified: "2024-04-05T22:42:16Z"
mac: ENC[AES256_GCM,data:KSRGzHipb58uNYaRYXAy3y+D9cBG53RGxZpNrx2gy+CHbGtkUW1SWc4PPrBwBhb6+TN0vb1zHuOB4HK4Bys/jqmvGgVkO2VKj15MTFMpF5n6w0blFM7d5bCDydHAhvXEZA/PFWq97DTI1Zxb+N/HWJlefKCzYOHHWj7i4leKNjk=,iv:88Ekp0sjEo5UTBLUyYSrkP+MbIFcCmegclJIK3+0jOQ=,tag:H/ESeQhC1PEF00RiDnamyw==,type:str]
lastmodified: "2024-11-18T09:01:39Z"
mac: ENC[AES256_GCM,data:CVsqff1qCcxyQ0e78ewottYKgqA2rG3j1m8X0Sb8If3qibAiBMMblc8T0doB+Fg4dVhPpbJSZdCx4JiV7sHopv2wNdguXd6Xe0L8iJqWtBeHTGTxSLvJ8UIHknak9c+JeQzZz8jAkbHYUXsc7VyeJaXoQptosz1BbE74D48Xjrg=,iv:0e+etjwabJx7PXgDUoh41Ha3aziQxBlH6QJZGG02ME0=,tag:oQIf503tmFlPoLE5d8Y24w==,type:str]
pgp:
- created_at: "2024-03-21T22:55:36Z"
enc: |-

View File

@ -122,6 +122,11 @@ let
dirvish
rg
shfmt
mermaid-mode
ob-mermaid
visual-replace
scroll-restore
highlight-indent-guides
# Completions & Minibuffer
corfu
company
@ -137,6 +142,8 @@ let
emacsEnv = pkgs.buildEnv {
name = "emacs-env";
paths = with pkgs; [
plantuml
mermaid-cli
pyright
shfmt
ripgrep

View File

@ -1,53 +1,86 @@
;;; -*- lexical-binding: t; -*-
(defvar materus/init-early t) ; Var to ensure early-init loaded
(setq materus/init-early t) ; Probably useless
(setenv "LSP_USE_PLISTS" "true")
(setq c-default-style nil)
;; [[file:emacs-materus-config.org::*Early Init Variables][Early Init Variables:1]]
(defvar materus/init-early t
"Is emacs using materus early init") ; Var to ensure early-init loaded, not used anymore but keeping it anyway
(setq materus/init-early t) ; Probably useless
(set-language-environment "UTF-8")
(setq default-input-method nil)
(setenv "LSP_USE_PLISTS" "true") ; Make lsp-mode use plists
;;
(setq c-default-style nil) ; Clear default styles for languages, will set them up later
(setq default-input-method nil) ; Disable default input method, I'm not using them anyway so far
(setq initial-major-mode 'fundamental-mode) ; Use fundamental mode in scratch buffer, speed up loading, not really important when emacs used as daemon
(setq auto-save-default nil) ; TODO: configure auto saves, disable for now
(setq backup-directory-alist
`((".*" . ,(concat user-emacs-directory "var/backups/")))) ; Set backup location
(setq auto-save-file-name-transforms
`((".*" ,(concat user-emacs-directory "var/recovery/") t))) ; Set auto-save location
(setq auto-save-list-file-prefix (concat user-emacs-directory "var/auto-save/sessions/")) ; Set auto-save-list location
(setq load-prefer-newer t) ; Prefer newer files to load
;; Packages
(setq package-enable-at-startup t) ; Ensure packages are enable since I'm either using built in package manager or nix
(setq package-quickstart nil) ; Disable package quickstart, it's annoying if forget to update it and doesn't speed up much
;;
(setq inhibit-compacting-font-caches t) ; Don't compact fonts
(set-language-environment "UTF-8") ; Use UTF-8
(setq custom-file (concat user-emacs-directory "etc/custom.el")) ; Set custom file location, don't want clutter in main directory
(setq custom-theme-directory
(concat user-emacs-directory "/etc/materus/themes" )) ; Set custom themes location
(setq ring-bell-function 'ignore) ; Disable bell
(defvar materus-emacs-gc-cons-threshold (* 64 1024 1024)
"The value of `gc-cons-threshold' after Emacs startup.") ; Define after init garbage collector threshold
;; Early Init Variables:1 ends here
;; [[file:emacs-materus-config.org::*Garbage Collector][Garbage Collector:1]]
(setq gc-cons-threshold most-positive-fixnum) ; Set `gc-cons-threshold' so it won't collectect during initialization
(add-hook 'emacs-startup-hook
(lambda ()
(setq gc-cons-threshold materus-emacs-gc-cons-threshold))) ; Set `gc-cons-threshold' to desired value after startup
;; Garbage Collector:1 ends here
;; [[file:emacs-materus-config.org::*Early Frame Settings][Early Frame Settings:1]]
(setq frame-inhibit-implied-resize t)
(setq frame-resize-pixelwise t)
(setq window-resize-pixelwise t) ; Allow pixelwise resizing of window and frame
(setq initial-major-mode 'fundamental-mode)
(setq native-comp-async-report-warnings-errors nil)
(setq package-enable-at-startup nil)
(unless (daemonp)
(add-to-list 'initial-frame-alist '(fullscreen . maximized)))
(setq default-frame-alist
'((width . 130)
(height . 40)))
(add-to-list 'initial-frame-alist '(fullscreen . maximized))) ; Start first frame maximized if not running as daemon, daemon frame are set up later in config
(setq default-frame-alist ; Set default size for frames
'((width . 130)
(height . 40)))
(setq native-comp-speed 3)
(add-hook 'emacs-startup-hook (lambda () (package-initialize)
(setq gc-cons-threshold 100000000 ; ~100mb
gc-cons-percentage 0.1)
))
(unless (daemonp)
(setq gc-cons-threshold most-positive-fixnum ; 2^61 bytes
gc-cons-percentage 0.6)
(advice-add #'tty-run-terminal-initialization :override #'ignore)
(add-hook 'window-setup-hook
(lambda ()
(advice-remove #'tty-run-terminal-initialization #'ignore)
(advice-add #'tty-run-terminal-initialization :override #'ignore)
(add-hook 'window-setup-hook
(lambda ()
(unless (display-graphic-p)
(advice-remove #'tty-run-terminal-initialization #'ignore)
(tty-run-terminal-initialization (selected-frame) nil t)
)
)
)
)))
;; Early Frame Settings:1 ends here
(when (boundp 'native-comp-eln-load-path) ; Change dir for eln-cache
(startup-redirect-eln-cache (expand-file-name "/var/eln-cache/" user-emacs-directory)))
;; [[file:emacs-materus-config.org::*Native compilation][Native compilation:1]]
(setq native-comp-async-report-warnings-errors nil) ; Silence warnings
(setq native-comp-speed 3) ; Set native-comp speed
(setq native-comp-jit-compilation t
;;native-comp-deferred-compilation t
package-native-compile t)
;; Setting up native-comp cache location
(when (and (fboundp 'startup-redirect-eln-cache)
(fboundp 'native-comp-available-p)
(native-comp-available-p))
(startup-redirect-eln-cache
(convert-standard-filename
(expand-file-name "var/eln-cache/" user-emacs-directory))))
(setq auto-save-default nil)
(setq backup-directory-alist
`((".*" . ,(concat user-emacs-directory "var/backups/")))) ; Change backup and auto save dir to var dir
(setq auto-save-file-name-transforms
`((".*" ,(concat user-emacs-directory "var/recovery/") t)))
(setq auto-save-list-file-prefix (concat user-emacs-directory "var/auto-save/sessions/"))
(setq custom-file (concat user-emacs-directory "etc/custom.el"))
(concat user-emacs-directory "var/eln-cache/"))))
;; Native compilation:1 ends here

View File

@ -3,11 +3,18 @@
#+DESCRIPTION: materus emacs configuration
#+STARTUP: overview
#+PROPERTY: header-args :tangle etc/materus/emacs-config.el :comments link
#+OPTIONS: \n:t
#+auto_tangle: t
My emacs config, tangled file is [[file:etc/materus/emacs-config.el][there]]
* Table of Contents :noexport:TOC_3:
- [[#init-files][Init Files]]
- [[#early-init][Early Init]]
- [[#early-init-variables][Early Init Variables]]
- [[#garbage-collector][Garbage Collector]]
- [[#early-frame-settings][Early Frame Settings]]
- [[#native-compilation][Native compilation]]
- [[#init][Init]]
- [[#compile-time][Compile Time]]
- [[#packages][Packages]]
@ -54,85 +61,134 @@ My emacs config, tangled file is [[file:etc/materus/emacs-config.el][there]]
* Init Files
** Early Init
:PROPERTIES:
:header-args: :tangle early-init.el
:header-args: :tangle early-init.el :comments link
:END:
Early init file, setting for GC and some paths.
Tangled file is [[./early-init.el][there]]
#+begin_src emacs-lisp :comments no
;;; -*- lexical-binding: t; -*-
#+end_src
*** Early Init Variables
Setting early init variables
#+begin_src emacs-lisp
(defvar materus/init-early t) ; Var to ensure early-init loaded
(setq materus/init-early t) ; Probably useless
(setenv "LSP_USE_PLISTS" "true")
(setq c-default-style nil)
(defvar materus/init-early t
"Is emacs using materus early init") ; Var to ensure early-init loaded, not used anymore but keeping it anyway
(setq materus/init-early t) ; Probably useless
(set-language-environment "UTF-8")
(setq default-input-method nil)
(setenv "LSP_USE_PLISTS" "true") ; Make lsp-mode use plists
;;
(setq c-default-style nil) ; Clear default styles for languages, will set them up later
(setq default-input-method nil) ; Disable default input method, I'm not using them anyway so far
(setq initial-major-mode 'fundamental-mode) ; Use fundamental mode in scratch buffer, speed up loading, not really important when emacs used as daemon
(setq auto-save-default nil) ; TODO: configure auto saves, disable for now
(setq backup-directory-alist
`((".*" . ,(concat user-emacs-directory "var/backups/")))) ; Set backup location
(setq auto-save-file-name-transforms
`((".*" ,(concat user-emacs-directory "var/recovery/") t))) ; Set auto-save location
(setq auto-save-list-file-prefix (concat user-emacs-directory "var/auto-save/sessions/")) ; Set auto-save-list location
(setq load-prefer-newer t) ; Prefer newer files to load
;; Packages
(setq package-enable-at-startup t) ; Ensure packages are enable since I'm either using built in package manager or nix
(setq package-quickstart nil) ; Disable package quickstart, it's annoying if forget to update it and doesn't speed up much
;;
(setq inhibit-compacting-font-caches t) ; Don't compact fonts
(set-language-environment "UTF-8") ; Use UTF-8
(setq custom-file (concat user-emacs-directory "etc/custom.el")) ; Set custom file location, don't want clutter in main directory
(setq custom-theme-directory
(concat user-emacs-directory "/etc/materus/themes" )) ; Set custom themes location
(setq ring-bell-function 'ignore) ; Disable bell
(defvar materus-emacs-gc-cons-threshold (* 64 1024 1024)
"The value of `gc-cons-threshold' after Emacs startup.") ; Define after init garbage collector threshold
#+end_src
*** Garbage Collector
Settings for garbage collector
#+begin_src emacs-lisp
(setq gc-cons-threshold most-positive-fixnum) ; Set `gc-cons-threshold' so it won't collectect during initialization
(add-hook 'emacs-startup-hook
(lambda ()
(setq gc-cons-threshold materus-emacs-gc-cons-threshold))) ; Set `gc-cons-threshold' to desired value after startup
#+end_src
*** Early Frame Settings
Early frame settings, maybe some could be move to normal init
#+begin_src emacs-lisp
(setq frame-inhibit-implied-resize t)
(setq frame-resize-pixelwise t)
(setq window-resize-pixelwise t) ; Allow pixelwise resizing of window and frame
(setq initial-major-mode 'fundamental-mode)
(setq native-comp-async-report-warnings-errors nil)
(setq package-enable-at-startup nil)
(unless (daemonp)
(add-to-list 'initial-frame-alist '(fullscreen . maximized)))
(setq default-frame-alist
'((width . 130)
(height . 40)))
(add-to-list 'initial-frame-alist '(fullscreen . maximized))) ; Start first frame maximized if not running as daemon, daemon frame are set up later in config
(setq default-frame-alist ; Set default size for frames
'((width . 130)
(height . 40)))
(setq native-comp-speed 3)
(add-hook 'emacs-startup-hook (lambda () (package-initialize)
(setq gc-cons-threshold 100000000 ; ~100mb
gc-cons-percentage 0.1)
))
(unless (daemonp)
(setq gc-cons-threshold most-positive-fixnum ; 2^61 bytes
gc-cons-percentage 0.6)
(advice-add #'tty-run-terminal-initialization :override #'ignore)
(add-hook 'window-setup-hook
(lambda ()
(advice-remove #'tty-run-terminal-initialization #'ignore)
(advice-add #'tty-run-terminal-initialization :override #'ignore)
(add-hook 'window-setup-hook
(lambda ()
(unless (display-graphic-p)
(advice-remove #'tty-run-terminal-initialization #'ignore)
(tty-run-terminal-initialization (selected-frame) nil t)
)
)
)
)))
#+end_src
*** Native compilation
#+begin_src emacs-lisp
(setq native-comp-async-report-warnings-errors nil) ; Silence warnings
(setq native-comp-speed 3) ; Set native-comp speed
(when (boundp 'native-comp-eln-load-path) ; Change dir for eln-cache
(startup-redirect-eln-cache (expand-file-name "/var/eln-cache/" user-emacs-directory)))
(setq native-comp-jit-compilation t
;;native-comp-deferred-compilation t
package-native-compile t)
;; Setting up native-comp cache location
(when (and (fboundp 'startup-redirect-eln-cache)
(fboundp 'native-comp-available-p)
(native-comp-available-p))
(startup-redirect-eln-cache
(convert-standard-filename
(expand-file-name "var/eln-cache/" user-emacs-directory))))
(setq auto-save-default nil)
(setq backup-directory-alist
`((".*" . ,(concat user-emacs-directory "var/backups/")))) ; Change backup and auto save dir to var dir
(setq auto-save-file-name-transforms
`((".*" ,(concat user-emacs-directory "var/recovery/") t)))
(setq auto-save-list-file-prefix (concat user-emacs-directory "var/auto-save/sessions/"))
(setq custom-file (concat user-emacs-directory "etc/custom.el"))
(concat user-emacs-directory "var/eln-cache/"))))
#+end_src
** Init
:PROPERTIES:
:header-args: :tangle init.el
:header-args: :tangle init.el :comments link
:END:
Init File
Checking if using emacs from my nix config (not used anymore, might use in future), loads config and custom.el
Init File, tangled [[./init.el][there]]
Checking if using emacs from my nix config, loads config and custom.el
Sets up package.el
#+begin_src emacs-lisp :comments no
;;; -*- lexical-binding: t; -*-
#+end_src
#+begin_src emacs-lisp
(setq-default materus/use-nix-packages (require 'materus-config nil 'noerror))
(unless (file-directory-p (concat user-emacs-directory "var/quickstart"))
(make-directory (concat user-emacs-directory "var/quickstart") t))
(require 'cl-lib)
(require 'package)
(add-to-list 'load-path (concat user-emacs-directory "etc/materus/extra")) ; Extra load path for packages
(setq package-user-dir (concat user-emacs-directory "var/elpa/" emacs-version "/" )) ; Set elpa path for this emacs version, should use nix packages anyway so keeping just in case
(setq package-gnupghome-dir (concat user-emacs-directory "var/elpa/gnupg/" )) ; Set path to gnupg for elpa
(add-to-list 'package-archives
'("nongnu-devel" . "https://elpa.nongnu.org/nongnu-devel/")) ; Add nongnu-devel repo to package manager
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t) ; Add melpa repo to package manager
(customize-set-variable 'package-archive-priorities '(("gnu" . 99)
("nongnu" . 80)
("nongnu-devel" . 70)
("melpa" . 0))) ; Repository priority
(load (concat user-emacs-directory "etc/materus/nix-init") t)
(load (concat user-emacs-directory "etc/materus/emacs-config"))
(load custom-file t)
#+end_src
** Compile Time
Some defvar so native-compile wont complain
#+begin_src emacs-lisp :comments no
;;; -*- lexical-binding: t; -*-
#+end_src
@ -152,14 +208,7 @@ Package manager config if not using nix.
After some testing default package manager works best for me.
** Init package manager config
#+begin_src emacs-lisp
(require 'cl-lib)
(require 'package)
(setq package-user-dir (concat user-emacs-directory "var/elpa/" emacs-version "/" ))
(setq package-gnupghome-dir (concat user-emacs-directory "var/elpa/gnupg/" ))
(add-to-list 'load-path (concat user-emacs-directory "etc/materus/extra"))
(add-to-list 'package-archives '("nongnu-devel" . "https://elpa.nongnu.org/nongnu-devel/"))
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
#+end_src
** Packages list & function
Packages to install
@ -281,9 +330,7 @@ Packages to install
(package-refresh-contents)
(dolist (p materus/packages)
(when (not (package-installed-p p))
(package-install p)))
(package-quickstart-refresh)))
(package-initialize)
(package-install p)))))
(unless materus/use-nix-packages
(materus/install-packages))
#+end_src
@ -293,7 +340,7 @@ General configurations of packages modes etc.
Set up no littering
#+begin_src emacs-lisp
(require 'recentf)
(use-package no-littering
(use-package no-littering
:config
(setq package-quickstart-file
(concat user-emacs-directory "var/quickstart/package-quickstart-" emacs-version ".el" ))
@ -301,8 +348,6 @@ Set up no littering
(recentf-expand-file-name no-littering-var-directory))
(add-to-list 'recentf-exclude
(recentf-expand-file-name no-littering-etc-directory)))
(setq custom-theme-directory (concat user-emacs-directory "etc/themes"))
(add-to-list 'custom-theme-load-path custom-theme-directory)
#+end_src
** Graphical
Graphical related settings.
@ -323,22 +368,22 @@ Graphical related settings.
(lambda (frame) (when (= (length (frame-list)) 2)
(set-frame-parameter frame 'fullscreen 'maximized)))))
(setq frame-inhibit-implied-resize t)
(setq frame-resize-pixelwise t)
(setq window-resize-pixelwise t)
(when (display-graphic-p)
(set-frame-font "Hack Nerd Font" nil t)
)
(setq-default display-line-numbers-width 3)
(setq-default display-line-numbers-widen t)
(setq truncate-string-ellipsis "…")
(global-tab-line-mode 1)
(tool-bar-mode -1)
(setq window-divider-default-bottom-width 1)
(setq window-divider-default-right-width 1)
(window-divider-mode 1)
(setq read-process-output-max (* 1024 1024 3))
(setq ring-bell-function 'ignore)
(setq-default cursor-type '(bar . 1))
;; Rainbow mode
(use-package rainbow-mode
@ -350,12 +395,10 @@ Graphical related settings.
(use-package rainbow-delimiters :hook
(prog-mode . rainbow-delimiters-mode)
:config
(custom-set-faces
'(rainbow-delimiters-depth-1-face ((t (:foreground "#FFFFFF"))))
'(rainbow-delimiters-depth-2-face ((t (:foreground "#FFFF00"))))
'(rainbow-delimiters-depth-5-face ((t (:foreground "#6A5ACD"))))
'(rainbow-delimiters-unmatched-face ((t (:foreground "#FF0000")))))
)
(set-face-attribute 'rainbow-delimiters-depth-1-face nil :foreground "#FFFFFF")
(set-face-attribute 'rainbow-delimiters-depth-2-face nil :foreground "#FFFF00")
(set-face-attribute 'rainbow-delimiters-depth-5-face nil :foreground "#6A5ACD")
(set-face-attribute 'rainbow-delimiters-unmatched-face nil :foreground "#FF0000"))
;; Nerd Icons
(use-package nerd-icons)
(use-package nerd-icons-completion
@ -576,7 +619,7 @@ Other configs
(use-package dap-gdb-lldb)
(setq read-process-output-max (* 1024 1024 3))
(defun lsp-booster--advice-json-parse (old-fn &rest args)
"Try to parse bytecode instead of json."
@ -596,13 +639,13 @@ Other configs
(defun lsp-booster--advice-final-command (old-fn cmd &optional test?)
"Prepend emacs-lsp-booster command to lsp CMD."
(let ((orig-result (funcall old-fn cmd test?)))
(if (and (not test?) ;; for check lsp-server-present?
(not (file-remote-p default-directory)) ;; see lsp-resolve-final-command, it would add extra shell wrapper
(if (and (not test?) ; for check lsp-server-present?
(not (file-remote-p default-directory)) ; see lsp-resolve-final-command, it would add extra shell wrapper
lsp-use-plists
(not (functionp 'json-rpc-connection)) ;; native json-rpc
(not (functionp 'json-rpc-connection)) ; native json-rpc
(executable-find "emacs-lsp-booster"))
(progn
(when-let* ((command-from-exec-path (executable-find (car orig-result)))) ;; resolve command from exec-path (in case not found in $PATH)
(when-let* ((command-from-exec-path (executable-find (car orig-result)))) ; resolve command from exec-path (in case not found in $PATH)
(setcar orig-result command-from-exec-path))
(message "Using emacs-lsp-booster for %s!" orig-result)
(cons "emacs-lsp-booster" orig-result))
@ -662,7 +705,6 @@ Other configs
(use-package lsp-pyright)
(setq lsp-pyright-langserver-command "pyright")
(add-hook 'python-mode-hook 'lsp-deferred)
#+end_src
** Java
#+begin_src emacs-lisp
@ -772,11 +814,15 @@ Byte compile files.
#+end_src
* Test
Just for testing some code
#+begin_src emacs-lisp
#+begin_src emacs-lisp
;;; (global-set-key (kbd "C-∇") (kbd "C-H"))
;;; (global-set-key (kbd "H-∇") (lambda () (interactive) (insert-char #x2207)))
;;; (keymap-set corfu--mouse-ignore-map "<mouse-movement>" 'ignore)
;;; (keymap-set corfu-map "<mouse-movement>" 'ignore)
;;; (buffer-text-pixel-size)
;;; (set-window-vscroll nil 960 t t)
;;; (set-window-margins (selected-window) 0 0)
;;; (setq completion-styles '(orderless basic)
;;; completion-category-defaults nil

View File

@ -13,14 +13,7 @@
;; Compile Time:2 ends here
;; [[file:../../emacs-materus-config.org::*Init package manager config][Init package manager config:1]]
(require 'cl-lib)
(require 'package)
(setq package-user-dir (concat user-emacs-directory "var/elpa/" emacs-version "/" ))
(setq package-gnupghome-dir (concat user-emacs-directory "var/elpa/gnupg/" ))
(add-to-list 'load-path (concat user-emacs-directory "etc/materus/extra"))
(add-to-list 'package-archives '("nongnu-devel" . "https://elpa.nongnu.org/nongnu-devel/"))
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
;; Init package manager config:1 ends here
;; [[file:../../emacs-materus-config.org::*Packages list & function][Packages list & function:1]]
@ -141,16 +134,14 @@
(package-refresh-contents)
(dolist (p materus/packages)
(when (not (package-installed-p p))
(package-install p)))
(package-quickstart-refresh)))
(package-initialize)
(package-install p)))))
(unless materus/use-nix-packages
(materus/install-packages))
;; Packages list & function:1 ends here
;; [[file:../../emacs-materus-config.org::*No Littering][No Littering:1]]
(require 'recentf)
(use-package no-littering
(use-package no-littering
:config
(setq package-quickstart-file
(concat user-emacs-directory "var/quickstart/package-quickstart-" emacs-version ".el" ))
@ -158,8 +149,6 @@
(recentf-expand-file-name no-littering-var-directory))
(add-to-list 'recentf-exclude
(recentf-expand-file-name no-littering-etc-directory)))
(setq custom-theme-directory (concat user-emacs-directory "etc/themes"))
(add-to-list 'custom-theme-load-path custom-theme-directory)
;; No Littering:1 ends here
;; [[file:../../emacs-materus-config.org::*Mouse][Mouse:1]]
@ -178,22 +167,22 @@
(lambda (frame) (when (= (length (frame-list)) 2)
(set-frame-parameter frame 'fullscreen 'maximized)))))
(setq frame-inhibit-implied-resize t)
(setq frame-resize-pixelwise t)
(setq window-resize-pixelwise t)
(when (display-graphic-p)
(set-frame-font "Hack Nerd Font" nil t)
)
(setq-default display-line-numbers-width 3)
(setq-default display-line-numbers-widen t)
(setq truncate-string-ellipsis "")
(global-tab-line-mode 1)
(tool-bar-mode -1)
(setq window-divider-default-bottom-width 1)
(setq window-divider-default-right-width 1)
(window-divider-mode 1)
(setq read-process-output-max (* 1024 1024 3))
(setq ring-bell-function 'ignore)
(setq-default cursor-type '(bar . 1))
;; Rainbow mode
(use-package rainbow-mode
@ -205,12 +194,10 @@
(use-package rainbow-delimiters :hook
(prog-mode . rainbow-delimiters-mode)
:config
(custom-set-faces
'(rainbow-delimiters-depth-1-face ((t (:foreground "#FFFFFF"))))
'(rainbow-delimiters-depth-2-face ((t (:foreground "#FFFF00"))))
'(rainbow-delimiters-depth-5-face ((t (:foreground "#6A5ACD"))))
'(rainbow-delimiters-unmatched-face ((t (:foreground "#FF0000")))))
)
(set-face-attribute 'rainbow-delimiters-depth-1-face nil :foreground "#FFFFFF")
(set-face-attribute 'rainbow-delimiters-depth-2-face nil :foreground "#FFFF00")
(set-face-attribute 'rainbow-delimiters-depth-5-face nil :foreground "#6A5ACD")
(set-face-attribute 'rainbow-delimiters-unmatched-face nil :foreground "#FF0000"))
;; Nerd Icons
(use-package nerd-icons)
(use-package nerd-icons-completion
@ -423,7 +410,7 @@
(use-package dap-gdb-lldb)
(setq read-process-output-max (* 1024 1024 3))
(defun lsp-booster--advice-json-parse (old-fn &rest args)
"Try to parse bytecode instead of json."
@ -443,13 +430,13 @@
(defun lsp-booster--advice-final-command (old-fn cmd &optional test?)
"Prepend emacs-lsp-booster command to lsp CMD."
(let ((orig-result (funcall old-fn cmd test?)))
(if (and (not test?) ;; for check lsp-server-present?
(not (file-remote-p default-directory)) ;; see lsp-resolve-final-command, it would add extra shell wrapper
(if (and (not test?) ; for check lsp-server-present?
(not (file-remote-p default-directory)) ; see lsp-resolve-final-command, it would add extra shell wrapper
lsp-use-plists
(not (functionp 'json-rpc-connection)) ;; native json-rpc
(not (functionp 'json-rpc-connection)) ; native json-rpc
(executable-find "emacs-lsp-booster"))
(progn
(when-let* ((command-from-exec-path (executable-find (car orig-result)))) ;; resolve command from exec-path (in case not found in $PATH)
(when-let* ((command-from-exec-path (executable-find (car orig-result)))) ; resolve command from exec-path (in case not found in $PATH)
(setcar orig-result command-from-exec-path))
(message "Using emacs-lsp-booster for %s!" orig-result)
(cons "emacs-lsp-booster" orig-result))
@ -614,8 +601,12 @@
;; [[file:../../emacs-materus-config.org::*Test][Test:1]]
;;; (global-set-key (kbd "C-∇") (kbd "C-H"))
;;; (global-set-key (kbd "H-∇") (lambda () (interactive) (insert-char #x2207)))
;;; (keymap-set corfu--mouse-ignore-map "<mouse-movement>" 'ignore)
;;; (keymap-set corfu-map "<mouse-movement>" 'ignore)
;;; (buffer-text-pixel-size)
;;; (set-window-vscroll nil 960 t t)
;;; (set-window-margins (selected-window) 0 0)
;;; (setq completion-styles '(orderless basic)
;;; completion-category-defaults nil

View File

@ -35,12 +35,12 @@
;; To enable, M-x corfu-mouse-mode.
;; Modified to support pixel-scroll-precision-mode
;; Modified to support pixel-scroll-precision-mode and fixed adding spaces
;;; Code:
(require 'corfu)
(make-gdb-table)
(defgroup corfu-mouse nil
"Mouse support for Corfu."
:group 'corfu
@ -78,18 +78,17 @@
(defun corfu-mouse--format-candidates (fcands)
"Format candidates.
FCANDS is the return value of `corfu--format-candidates'."
(let ((index corfu--scroll)
(cands (caddr fcands)))
(while cands
(let ((line (car cands)))
;; Append necessary amount of spaces to make it as wide as the
;; popup.
(setq line (concat line (make-string (- (cadr fcands)
(string-width line))
? )))
(let ((strlen (- (cadr fcands) (string-width line))))
(when (> strlen 0)
(setq line (concat line (make-string strlen ? )))))
(add-text-properties 0 (length line)
`(mouse-face
corfu-mouse

View File

@ -1,8 +1,22 @@
;;; -*- lexical-binding: t; -*-
;; [[file:emacs-materus-config.org::*Init][Init:2]]
(setq-default materus/use-nix-packages (require 'materus-config nil 'noerror))
(unless (file-directory-p (concat user-emacs-directory "var/quickstart"))
(make-directory (concat user-emacs-directory "var/quickstart") t))
(require 'cl-lib)
(require 'package)
(add-to-list 'load-path (concat user-emacs-directory "etc/materus/extra")) ; Extra load path for packages
(setq package-user-dir (concat user-emacs-directory "var/elpa/" emacs-version "/" )) ; Set elpa path for this emacs version, should use nix packages anyway so keeping just in case
(setq package-gnupghome-dir (concat user-emacs-directory "var/elpa/gnupg/" )) ; Set path to gnupg for elpa
(add-to-list 'package-archives
'("nongnu-devel" . "https://elpa.nongnu.org/nongnu-devel/")) ; Add nongnu-devel repo to package manager
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t) ; Add melpa repo to package manager
(customize-set-variable 'package-archive-priorities '(("gnu" . 99)
("nongnu" . 80)
("nongnu-devel" . 70)
("melpa" . 0))) ; Repository priority
(load (concat user-emacs-directory "etc/materus/nix-init") t)
(load (concat user-emacs-directory "etc/materus/emacs-config"))
(load custom-file t)
;; Init:2 ends here