Semi-working emacs config
This commit is contained in:
parent
a16e106f98
commit
fe10168d00
5 changed files with 157 additions and 134 deletions
|
|
@ -74,50 +74,19 @@
|
||||||
(and (eq system-type 'gnu/linux)
|
(and (eq system-type 'gnu/linux)
|
||||||
(file-exists-p "/proc/sys/fs/binfmt_misc/WSLInterop")))
|
(file-exists-p "/proc/sys/fs/binfmt_misc/WSLInterop")))
|
||||||
|
|
||||||
(defun kylekrein/is-android ()
|
|
||||||
(string-equal system-type "android"))
|
|
||||||
|
|
||||||
(use-package alert
|
(use-package alert
|
||||||
:ensure t
|
:ensure t
|
||||||
)
|
)
|
||||||
|
|
||||||
(require 'alert)
|
|
||||||
|
|
||||||
(defun alert-android-notifications-notify (info)
|
|
||||||
(unless (kylekrein/is-android)
|
|
||||||
(error "Android notifications are only supported on Android systems"))
|
|
||||||
|
|
||||||
"Send INFO using android-notifications-notify."
|
|
||||||
(let ((title (or (plist-get info :title) "Org Alert Reminder"))
|
|
||||||
(body (or (plist-get info :message) ""))
|
|
||||||
(urgency (let ((severity (plist-get info :severity)))
|
|
||||||
(cond ((eq severity 'urgent) 'critical)
|
|
||||||
((eq severity 'high) 'critical)
|
|
||||||
((eq severity 'moderate) 'normal)
|
|
||||||
((eq severity 'low) 'low)
|
|
||||||
((eq severity 'trivial) 'low)
|
|
||||||
(t 'normal))))
|
|
||||||
(icon (or (plist-get info :icon) alert-default-icon)))
|
|
||||||
(android-notifications-notify
|
|
||||||
:title title
|
|
||||||
:body body
|
|
||||||
:urgency urgency
|
|
||||||
:icon icon
|
|
||||||
)))
|
|
||||||
|
|
||||||
(alert-define-style 'android-notifications :title "Android Notifications"
|
|
||||||
:notifier #'alert-android-notifications-notify
|
|
||||||
)
|
|
||||||
|
|
||||||
(use-package alert-toast :ensure t :after alert)
|
(use-package alert-toast :ensure t :after alert)
|
||||||
|
|
||||||
(setq alert-default-style
|
(setq alert-default-style
|
||||||
(cond
|
(cond
|
||||||
((kylekrein/is-android) 'android-notifications)
|
|
||||||
((kylekrein/detect-wsl) 'toast)
|
((kylekrein/detect-wsl) 'toast)
|
||||||
(t 'libnotify)))
|
(t 'libnotify)))
|
||||||
|
|
||||||
(setq backup-directory-alist '((".*" . "~/.emacs.d/tildafiles")))
|
(make-directory "~/.cache/emacs/tildafiles")
|
||||||
|
(setq backup-directory-alist '((".*" . "~/.cache/emacs/tildafiles")))
|
||||||
|
|
||||||
(use-package diminish :ensure t)
|
(use-package diminish :ensure t)
|
||||||
|
|
||||||
|
|
@ -196,12 +165,6 @@
|
||||||
|
|
||||||
(save-place-mode t) ;; Restore cursor place in file
|
(save-place-mode t) ;; Restore cursor place in file
|
||||||
|
|
||||||
(unless (or
|
|
||||||
(equal "Battery status not available" (battery))
|
|
||||||
(equal "Power N/A, battery Charging (N/A% load, remaining time N/A)" (battery))
|
|
||||||
(equal "Power N/A, battery Discharging (N/A% load, remaining time N/A)" (battery)))
|
|
||||||
(display-battery-mode 1))
|
|
||||||
|
|
||||||
(use-package nov :ensure t)
|
(use-package nov :ensure t)
|
||||||
(add-to-list 'auto-mode-alist '("\\.epub\\'" . nov-mode))
|
(add-to-list 'auto-mode-alist '("\\.epub\\'" . nov-mode))
|
||||||
|
|
||||||
|
|
@ -447,32 +410,29 @@
|
||||||
:config
|
:config
|
||||||
(eshell-syntax-highlighting-global-mode +1))
|
(eshell-syntax-highlighting-global-mode +1))
|
||||||
|
|
||||||
(unless (kylekrein/is-android) ;;Fails to compile
|
(use-package vterm
|
||||||
(use-package vterm
|
|
||||||
:ensure t
|
:ensure t
|
||||||
;;:config
|
)
|
||||||
))
|
|
||||||
|
|
||||||
(unless (kylekrein/is-android)
|
(use-package vterm-toggle
|
||||||
(use-package vterm-toggle
|
:ensure t
|
||||||
:ensure t
|
:after vterm
|
||||||
:after vterm
|
:config
|
||||||
:config
|
(setq vterm-toggle-fullscreen-p nil)
|
||||||
(setq vterm-toggle-fullscreen-p nil)
|
(setq vterm-toggle-scope 'project)
|
||||||
(setq vterm-toggle-scope 'project)
|
(add-to-list 'display-buffer-alist
|
||||||
(add-to-list 'display-buffer-alist
|
'((lambda (buffer-or-name _)
|
||||||
'((lambda (buffer-or-name _)
|
(let ((buffer (get-buffer buffer-or-name)))
|
||||||
(let ((buffer (get-buffer buffer-or-name)))
|
(with-current-buffer buffer
|
||||||
(with-current-buffer buffer
|
(or (equal major-mode 'vterm-mode)
|
||||||
(or (equal major-mode 'vterm-mode)
|
(string-prefix-p vterm-buffer-name (buffer-name buffer))))))
|
||||||
(string-prefix-p vterm-buffer-name (buffer-name buffer))))))
|
(display-buffer-reuse-window display-buffer-at-bottom)
|
||||||
(display-buffer-reuse-window display-buffer-at-bottom)
|
;;(display-buffer-reuse-window display-buffer-in-direction)
|
||||||
;;(display-buffer-reuse-window display-buffer-in-direction)
|
;;display-buffer-in-direction/direction/dedicated is added in emacs27
|
||||||
;;display-buffer-in-direction/direction/dedicated is added in emacs27
|
;;(direction . bottom)
|
||||||
;;(direction . bottom)
|
;;(dedicated . t) ;dedicated is supported in emacs27
|
||||||
;;(dedicated . t) ;dedicated is supported in emacs27
|
(reusable-frames . visible)
|
||||||
(reusable-frames . visible)
|
(window-height . 0.3))))
|
||||||
(window-height . 0.3)))))
|
|
||||||
|
|
||||||
(git-package "https://github.com/darcamo/cmake-integration.git")
|
(git-package "https://github.com/darcamo/cmake-integration.git")
|
||||||
(use-package cmake-integration
|
(use-package cmake-integration
|
||||||
|
|
@ -577,20 +537,6 @@ DIR must include a .project file to be considered a project."
|
||||||
(direnv-allow))
|
(direnv-allow))
|
||||||
(message "Added 'use flake' to .envrc and ran direnv allow in %s" root)))
|
(message "Added 'use flake' to .envrc and ran direnv allow in %s" root)))
|
||||||
|
|
||||||
(use-package nix-ts-mode
|
|
||||||
:ensure t
|
|
||||||
:mode "\\.nix\\'"
|
|
||||||
:hook
|
|
||||||
(nix-ts-mode . lsp-deferred) ;; So that envrc mode will work
|
|
||||||
:custom
|
|
||||||
(lsp-disabled-clients '((nix-ts-mode . nix-nil))) ;; Disable nil so that nixd will be used as lsp-server
|
|
||||||
:config
|
|
||||||
(setq lsp-nix-nixd-server-path "nixd"
|
|
||||||
lsp-nix-nixd-formatting-command [ "alejandra" ]
|
|
||||||
lsp-nix-nixd-nixpkgs-expr "import <nixpkgs> { }"
|
|
||||||
lsp-nix-nixd-nixos-options-expr "(builtins.getFlake \"github:kylekrein/nixos-config\".nixosConfigurations.kylekrein-homepc.options"
|
|
||||||
lsp-nix-nixd-home-manager-options-expr "(builtins.getFlake \"github:kylekrein/nixos-config\".nixosConfigurations.kylekrein-homepc.options.home-manager.users.type.getSubOptions []"))
|
|
||||||
|
|
||||||
(use-package glsl-mode
|
(use-package glsl-mode
|
||||||
:ensure t)
|
:ensure t)
|
||||||
|
|
||||||
|
|
@ -1085,20 +1031,6 @@ one, an error is signaled."
|
||||||
which-key-allow-imprecise-window-fit nil
|
which-key-allow-imprecise-window-fit nil
|
||||||
which-key-separator " → " ))
|
which-key-separator " → " ))
|
||||||
|
|
||||||
(when (kylekrein/is-android)
|
|
||||||
;;Write all android settings here
|
|
||||||
(setq touch-screen-keyboard-function t)
|
|
||||||
(setq touch-screen-display-keyboard t)
|
|
||||||
|
|
||||||
(menu-bar-mode 1) ;; Enable the menu bar
|
|
||||||
(scroll-bar-mode 1) ;; Enable the scroll bar
|
|
||||||
(tool-bar-mode 1) ;;Enable the tool bar
|
|
||||||
(setq use-file-dialog t) ;; file dialog
|
|
||||||
(setq use-dialog-box t) ;; dialog box
|
|
||||||
(setq pop-up-windows t) ;; popup windows
|
|
||||||
(server-start)
|
|
||||||
)
|
|
||||||
|
|
||||||
(when (kylekrein/detect-wsl)
|
(when (kylekrein/detect-wsl)
|
||||||
(setq select-active-regions nil)
|
(setq select-active-regions nil)
|
||||||
(setq select-enable-clipboard 't)
|
(setq select-enable-clipboard 't)
|
||||||
|
|
|
||||||
|
|
@ -4,3 +4,4 @@
|
||||||
(setenv "PATH" (mapconcat 'identity exec-path ":")) ;;fixes direnv losing nix pkgs
|
(setenv "PATH" (mapconcat 'identity exec-path ":")) ;;fixes direnv losing nix pkgs
|
||||||
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
|
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
|
||||||
(package-initialize)
|
(package-initialize)
|
||||||
|
(package-refresh-contents)
|
||||||
|
|
|
||||||
|
|
@ -32,10 +32,13 @@
|
||||||
`(".config/emacs/init.el"
|
`(".config/emacs/init.el"
|
||||||
,(mixed-text-file "early-config.el"
|
,(mixed-text-file "early-config.el"
|
||||||
";; Emacs Early Config from Guix Home\n"
|
";; Emacs Early Config from Guix Home\n"
|
||||||
|
"(setq custom-file \"~/.config/emacs/custom.el\")\n"
|
||||||
|
"(when (file-exists-p custom-file)\n"
|
||||||
|
"(load custom-file))\n"
|
||||||
(string-append "(make-directory \"" package-user-dir "\" t)\n")
|
(string-append "(make-directory \"" package-user-dir "\" t)\n")
|
||||||
(string-append "(setq package-user-dir \"" package-user-dir "\")\n")
|
(string-append "(setq package-user-dir \"" package-user-dir "\")\n")
|
||||||
"(load-file \"" (home-emacs-configuration-early-config-file config) "\")\n"
|
"(load-file \"" (home-emacs-configuration-early-config-file config) "\")\n"
|
||||||
"(load-file \"~/.config/emacs/config.el\")"))))
|
"(load-file \"~/.config/emacs/config.el\")\n"))))
|
||||||
|
|
||||||
(define (home-emacs-profile-service config)
|
(define (home-emacs-profile-service config)
|
||||||
(list (home-emacs-configuration-emacs config)))
|
(list (home-emacs-configuration-emacs config)))
|
||||||
|
|
|
||||||
81
guix-config/packages/emacs-test.scm
Normal file
81
guix-config/packages/emacs-test.scm
Normal file
|
|
@ -0,0 +1,81 @@
|
||||||
|
(define-module (guix-config packages emacs)
|
||||||
|
#:use-module (gnu packages emacs)
|
||||||
|
#:use-module (gnu packages emacs-xyz)
|
||||||
|
#:use-module (gnu packages rust-apps)
|
||||||
|
#:use-module (gnu packages bash)
|
||||||
|
#:use-module (guix build utils)
|
||||||
|
#:use-module (guix packages)
|
||||||
|
#:use-module (guix utils)
|
||||||
|
#:use-module (guix gexp)
|
||||||
|
#:use-module (guix licenses)
|
||||||
|
#:use-module (guix build-system trivial)
|
||||||
|
#:export (guixmacs))
|
||||||
|
|
||||||
|
(define emacs-config
|
||||||
|
(local-file "./config.org"))
|
||||||
|
|
||||||
|
(define emacs-init
|
||||||
|
(mixed-text-file "init.el"
|
||||||
|
";;; -*- lexical-binding: t; -*-
|
||||||
|
(require 'package)
|
||||||
|
;;https://github.com/wbolster/emacs-direnv/issues/85
|
||||||
|
(setenv \"PATH\" (mapconcat 'identity exec-path \":\")) ;;fixes direnv losing nix/guix pkgs
|
||||||
|
(add-to-list 'package-archives '(\"melpa\" . \"https://melpa.org/packages/\") t)
|
||||||
|
(package-initialize)
|
||||||
|
(org-babel-load-file
|
||||||
|
\"" emacs-config "\")
|
||||||
|
"))
|
||||||
|
|
||||||
|
(define emacs-pkgs
|
||||||
|
(list emacs-guix ripgrep))
|
||||||
|
|
||||||
|
(define guixmacs
|
||||||
|
(package
|
||||||
|
(name "guixmacs")
|
||||||
|
(version (package-version emacs-pgtk))
|
||||||
|
(source #f)
|
||||||
|
(synopsis "KyleKrein’s Emacs config wrapper")
|
||||||
|
(description "Emacs PGTK wrapped with useful Guix packages in PATH and EMACSLOADPATH.")
|
||||||
|
(license gpl3+)
|
||||||
|
(home-page "https://git.kylekrein.com/kylekrein/dotfiles")
|
||||||
|
(build-system trivial-build-system)
|
||||||
|
(propagated-inputs (append (list emacs-pgtk
|
||||||
|
bash-minimal)
|
||||||
|
emacs-pkgs))
|
||||||
|
(arguments
|
||||||
|
(list
|
||||||
|
#:modules '((guix build utils))
|
||||||
|
#:builder
|
||||||
|
#~(begin
|
||||||
|
(use-modules (guix build utils))
|
||||||
|
(define (wrap-external-program target out-bin env-vars)
|
||||||
|
(let ((script (open-output-file out-bin)))
|
||||||
|
(display (string-append "#!" #$bash-minimal "/bin/bash" "\n") script)
|
||||||
|
(for-each
|
||||||
|
(lambda (pair)
|
||||||
|
(display (string-append "export " (car pair) "=\"" (cdr pair) "\"\n") script))
|
||||||
|
env-vars)
|
||||||
|
(display (string-append target " -l " #$emacs-init " $@\n") script)
|
||||||
|
(close-output-port script))
|
||||||
|
(chmod out-bin #o755))
|
||||||
|
(let* ((out #$output)
|
||||||
|
(emacs #$(this-package-input "emacs-pgtk"))
|
||||||
|
(dep-paths '#$emacs-pkgs)
|
||||||
|
(site-lisps (map (lambda (p)
|
||||||
|
(string-append p "/share/emacs/site-lisp"))
|
||||||
|
dep-paths))
|
||||||
|
(bins (map (lambda (p)
|
||||||
|
(string-append p "/bin"))
|
||||||
|
dep-paths))
|
||||||
|
(bin (string-append out "/bin"))
|
||||||
|
(emacsloadpath (string-join site-lisps ":"))
|
||||||
|
(path (string-join (append (list "$PATH") bins) ":")))
|
||||||
|
(mkdir-p bin)
|
||||||
|
;(mkdir-p (string-append out "/native-lisp"))
|
||||||
|
(symlink (string-append emacs "/share") (string-append out "/share"))
|
||||||
|
(symlink (string-append emacs "/native-lisp") (string-append out "/native-lisp"))
|
||||||
|
(wrap-external-program
|
||||||
|
(string-append emacs "/bin/emacs")
|
||||||
|
(string-append out "/bin/emacs")
|
||||||
|
(list (cons "EMACSLOADPATH" emacsloadpath)
|
||||||
|
(cons "PATH" path)))))))))
|
||||||
|
|
@ -9,55 +9,61 @@
|
||||||
#:use-module (guix gexp)
|
#:use-module (guix gexp)
|
||||||
#:use-module (guix licenses)
|
#:use-module (guix licenses)
|
||||||
#:use-module (guix build-system trivial)
|
#:use-module (guix build-system trivial)
|
||||||
|
#:use-module (gnu packages fonts)
|
||||||
|
#:use-module (gnu packages llvm)
|
||||||
|
#:use-module (gnu packages tree-sitter)
|
||||||
#:export (guixmacs))
|
#:export (guixmacs))
|
||||||
|
|
||||||
(define emacs-pkgs
|
(define emacs-pkgs
|
||||||
(list emacs-guix ripgrep))
|
(list
|
||||||
|
emacs-guix
|
||||||
|
emacs-golden-ratio
|
||||||
|
emacs-alert
|
||||||
|
emacs-diminish
|
||||||
|
emacs-nov-el
|
||||||
|
emacs-magit
|
||||||
|
emacs-doom-modeline
|
||||||
|
emacs-doom-themes
|
||||||
|
emacs-rainbow-delimiters
|
||||||
|
emacs-org-bullets
|
||||||
|
emacs-org-transclusion
|
||||||
|
emacs-org-roam
|
||||||
|
emacs-consult
|
||||||
|
emacs-rainbow-mode
|
||||||
|
emacs-gptel
|
||||||
|
emacs-eshell-syntax-highlighting
|
||||||
|
emacs-vterm
|
||||||
|
emacs-vterm-toggle
|
||||||
|
emacs-direnv
|
||||||
|
emacs-glsl-mode
|
||||||
|
emacs-treesit-auto
|
||||||
|
emacs-nerd-icons
|
||||||
|
emacs-marginalia
|
||||||
|
emacs-multiple-cursors
|
||||||
|
emacs-corfu
|
||||||
|
emacs-cape
|
||||||
|
emacs-vertico
|
||||||
|
emacs-orderless
|
||||||
|
|
||||||
|
font-iosevka
|
||||||
|
|
||||||
|
ripgrep
|
||||||
|
clang-toolchain
|
||||||
|
tree-sitter
|
||||||
|
|
||||||
|
|
||||||
|
))
|
||||||
|
|
||||||
(define guixmacs
|
(define guixmacs
|
||||||
(package
|
(package
|
||||||
|
(inherit emacs-pgtk)
|
||||||
(name "guixmacs")
|
(name "guixmacs")
|
||||||
(version (package-version emacs-pgtk))
|
|
||||||
(source #f)
|
|
||||||
(synopsis "KyleKrein’s Emacs config wrapper")
|
|
||||||
(description "Emacs PGTK wrapped with useful Guix packages in PATH and EMACSLOADPATH.")
|
|
||||||
(license gpl3+)
|
|
||||||
(home-page "https://git.kylekrein.com/kylekrein/dotfiles")
|
(home-page "https://git.kylekrein.com/kylekrein/dotfiles")
|
||||||
(build-system trivial-build-system)
|
(properties '((tunable? . #t)))
|
||||||
(propagated-inputs (append (list emacs-pgtk
|
|
||||||
bash-minimal)
|
|
||||||
emacs-pkgs))
|
|
||||||
(arguments
|
(arguments
|
||||||
|
(append
|
||||||
|
(package-arguments emacs-pgtk)
|
||||||
(list
|
(list
|
||||||
#:modules '((guix build utils))
|
#:tests? #f)))
|
||||||
#:builder
|
(propagated-inputs (append (package-propagated-inputs emacs-pgtk)
|
||||||
#~(begin
|
emacs-pkgs))))
|
||||||
(use-modules (guix build utils))
|
|
||||||
(define (wrap-external-program target out-bin env-vars)
|
|
||||||
(let ((script (open-output-file out-bin)))
|
|
||||||
(display (string-append "#!" #$bash-minimal "/bin/bash" "\n") script)
|
|
||||||
(for-each
|
|
||||||
(lambda (pair)
|
|
||||||
(display (string-append "export " (car pair) "=\"" (cdr pair) "\"\n") script))
|
|
||||||
env-vars)
|
|
||||||
(display (string-append "\"" target "\" \"$@\"\n") script)
|
|
||||||
(close-output-port script))
|
|
||||||
(chmod out-bin #o755))
|
|
||||||
(let* ((out #$output)
|
|
||||||
(emacs #$(this-package-input "emacs-pgtk"))
|
|
||||||
(dep-paths '#$emacs-pkgs)
|
|
||||||
(site-lisps (map (lambda (p)
|
|
||||||
(string-append p "/share/emacs/site-lisp"))
|
|
||||||
dep-paths))
|
|
||||||
(bins (map (lambda (p)
|
|
||||||
(string-append p "/bin"))
|
|
||||||
dep-paths))
|
|
||||||
(bin (string-append out "/bin"))
|
|
||||||
(emacsloadpath (string-join site-lisps ":"))
|
|
||||||
(path (string-join (append (list "$PATH") bins) ":")))
|
|
||||||
(mkdir-p bin)
|
|
||||||
(wrap-external-program
|
|
||||||
(string-append emacs "/bin/emacs")
|
|
||||||
(string-append out "/bin/emacs")
|
|
||||||
(list (cons "EMACSLOADPATH" emacsloadpath)
|
|
||||||
(cons "PATH" path)))))))))
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue