feat(emacs): switched to emacs-next

This commit is contained in:
Pavel Korytov 2023-08-15 19:05:01 +03:00
parent ead93cfcb6
commit 1920a48aec
6 changed files with 138 additions and 123 deletions

View file

@ -1,5 +1,5 @@
(specifications->manifest
'("emacs"
'("emacs-next-tree-sitter"
"texinfo"
"the-silver-searcher"
"ripgrep"
@ -8,7 +8,7 @@
"imagemagick"
"font-gnu-freefont"
"font-gnu-unifont"
"tdlib-1.8.14"
"tdlib-1.8.15"
"yt-dlp"
"mpv"
"whisper-cpp"

View file

@ -21,9 +21,3 @@
'(sp-highlight-pair-overlay nil)
'(wakatime-python-bin nil)
'(warning-suppress-types '((emacs) (comp) (:warning) (lsp-mode) (comp))))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(italic ((t (:family "JetBrainsMono Nerd Font, Italic")))))

View file

@ -141,26 +141,27 @@ _=_: Balance "
(defun my/exwm-configure-window ()
(interactive)
(pcase exwm-class-name
((or "Firefox" "Nightly")
(perspective-exwm-assign-window
:workspace-index 2
:persp-name "browser"))
("Nyxt"
(perspective-exwm-assign-window
:workspace-index 2
:persp-name "browser"))
("Alacritty"
(perspective-exwm-assign-window
:persp-name "term"))
((or "VK" "Slack" "discord" "TelegramDesktop" "Rocket.Chat")
(perspective-exwm-assign-window
:workspace-index 3
:persp-name "comms"))
((or "Chromium-browser" "jetbrains-datagrip")
(perspective-exwm-assign-window
:workspace-index 4
:persp-name "dev"))))
(unless exwm--floating-frame
(pcase exwm-class-name
((or "Firefox" "Nightly")
(perspective-exwm-assign-window
:workspace-index 2
:persp-name "browser"))
("Nyxt"
(perspective-exwm-assign-window
:workspace-index 2
:persp-name "browser"))
("Alacritty"
(perspective-exwm-assign-window
:persp-name "term"))
((or "VK" "Slack" "discord" "TelegramDesktop" "Rocket.Chat")
(perspective-exwm-assign-window
:workspace-index 3
:persp-name "comms"))
((or "Chromium-browser" "jetbrains-datagrip")
(perspective-exwm-assign-window
:workspace-index 4
:persp-name "dev")))))
(add-hook 'exwm-manage-finish-hook #'my/exwm-configure-window)

View file

@ -587,13 +587,13 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer."
"M" 'magit-file-dispatch)
:config
(setq magit-blame-styles
'((headings
(heading-format . "%-20a %C %s\n"))
(highlight
(highlight-face . magit-blame-highlight))
(lines
(show-lines . t)
(show-message . t)))))
'((headings
(heading-format . "%-20a %C %s\n"))
(highlight
(highlight-face . magit-blame-highlight))
(lines
(show-lines . t)
(show-message . t)))))
(use-package forge
:after magit
@ -906,22 +906,23 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer."
(defvar my/alpha-for-light 7)
(defun my/doom-color (color)
(let ((override (alist-get (my/doom-p) my/theme-override))
(color-name (symbol-name color))
(is-light (ct-light-p (doom-color 'bg))))
(or
(alist-get color override)
(cond
((eq 'black color)
(if is-light (doom-color 'fg) (doom-color 'bg)))
((eq 'white color)
(if is-light (doom-color 'bg) (doom-color 'fg)))
((eq 'border color)
(if is-light (doom-color 'base0) (doom-color 'base8)))
((string-match-p (rx bos "light-") color-name)
(ct-edit-hsl-l-inc (my/doom-color (intern (substring color-name 6)))
my/alpha-for-light))
(t (doom-color color))))))
(when (doom-color 'bg)
(let ((override (alist-get (my/doom-p) my/theme-override))
(color-name (symbol-name color))
(is-light (ct-light-p (doom-color 'bg))))
(or
(alist-get color override)
(cond
((eq 'black color)
(if is-light (doom-color 'fg) (doom-color 'bg)))
((eq 'white color)
(if is-light (doom-color 'bg) (doom-color 'fg)))
((eq 'border color)
(if is-light (doom-color 'base0) (doom-color 'base8)))
((string-match-p (rx bos "light-") color-name)
(ct-edit-hsl-l-inc (my/doom-color (intern (substring color-name 6)))
my/alpha-for-light))
(t (doom-color color)))))))
(defun my/modus-get-base (color)
(let ((base-value (string-to-number (substring (symbol-name color) 4 5)))
@ -1037,7 +1038,9 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer."
(tab-bar-tab :background (my/color-value 'bg)
:foreground (my/color-value 'yellow)
:underline (my/color-value 'yellow))
(tab-bar :background nil :foreground nil))
(tab-bar :background nil :foreground nil)
(magit-section-secondary-heading :foreground (my/color-value 'blue)
:weight 'bold))
(defun my/switch-theme (theme)
(interactive
@ -1100,11 +1103,18 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer."
(when (display-graphic-p)
(if (x-list-fonts "JetBrainsMono Nerd Font")
(set-frame-font "JetBrainsMono Nerd Font 10" nil t)
(let ((font "-JB -JetBrainsMono Nerd Font-medium-normal-normal-*-17-*-*-*-m-0-iso10646-1"))
(set-frame-font font nil t)
(add-to-list 'default-frame-alist `(font . ,font)))
(message "Install JetBrainsMono Nerd Font!")))
(when (display-graphic-p)
(set-face-attribute 'variable-pitch nil :family "Cantarell" :height 1.0))
(set-face-attribute 'variable-pitch nil :family "Cantarell" :height 1.0)
(set-face-attribute
'italic nil
:family "JetBrainsMono Nerd Font"
:weight 'regular
:slant 'italic))
(use-package ligature
:straight (:host github :repo "mickeynp/ligature.el")
@ -2581,6 +2591,7 @@ Returns (<buffer> . <workspace-index>) or nil."
(use-package csv-mode
:straight t
:disabled
:mode "\\.csv\\'")
(use-package yaml-mode
@ -3368,7 +3379,9 @@ KEYS is a list of cons cells like (<label> . <time>)."
(my/org-alert-cleanup)))
(with-eval-after-load 'org
(my/org-alert-mode))
(if my/emacs-started
(my/org-alert-mode)
(add-hook 'emacs-startup-hook #'my/org-alert-mode)))
(my-leader-def
:infix "o"
@ -4914,21 +4927,6 @@ With ARG, repeats or can move backward if negative."
(blogs elfeed-blogs-entry)
(unread elfeed-search-unread-title-face))))
(defun my/update-my-theme-elfeed (&rest _)
(custom-theme-set-faces
'my-theme-1
`(elfeed-videos-entry ((t :foreground ,(my/color-value 'red))))
`(elfeed-twitter-entry ((t :foreground ,(my/color-value 'blue))))
`(elfeed-emacs-entry ((t :foreground ,(my/color-value 'magenta))))
`(elfeed-music-entry ((t :foreground ,(my/color-value 'green))))
`(elfeed-podcasts-entry ((t :foreground ,(my/color-value 'yellow))))
`(elfeed-blogs-entry ((t :foreground ,(my/color-value 'orange)))))
(enable-theme 'my-theme-1))
(advice-add 'load-theme :after #'my/update-my-theme-elfeed)
(when (fboundp 'doom-color)
(my/update-my-theme-elfeed))
(use-package elfeed-summary
:commands (elfeed-summary)
:straight t
@ -4959,6 +4957,17 @@ With ARG, repeats or can move backward if negative."
(defun my/get-enclosures-url (entry)
(caar (elfeed-entry-enclosures entry)))
(use-package elfeed-tube
:straight t
:after elfeed
:config
(setq elfeed-tube-auto-fetch-p nil)
(elfeed-tube-setup)
(general-define-key
:states 'normal
:keymaps '(elfeed-search-mode-map elfeed-show-mode-map)
"gf" #'elfeed-tube-fetch))
(with-eval-after-load 'emms
(define-emms-source elfeed (entry)
(let ((url (or (my/get-enclosures-url entry)
@ -6420,7 +6429,7 @@ base toot."
(interactive)
(setq telega-server-libs-prefix
(string-trim
(shell-command-to-string "guix build tdlib-1.8.14")))
(shell-command-to-string "guix build tdlib-1.8.15")))
(telega-server-build "CC=gcc"))
(add-hook 'telega-load-hook #'telega-mode-line-mode)

View file

@ -477,26 +477,27 @@ For EXWM windows, the =perspective-exwm= package provides a function called =per
#+begin_src emacs-lisp
(defun my/exwm-configure-window ()
(interactive)
(pcase exwm-class-name
((or "Firefox" "Nightly")
(perspective-exwm-assign-window
:workspace-index 2
:persp-name "browser"))
("Nyxt"
(perspective-exwm-assign-window
:workspace-index 2
:persp-name "browser"))
("Alacritty"
(perspective-exwm-assign-window
:persp-name "term"))
((or "VK" "Slack" "discord" "TelegramDesktop" "Rocket.Chat")
(perspective-exwm-assign-window
:workspace-index 3
:persp-name "comms"))
((or "Chromium-browser" "jetbrains-datagrip")
(perspective-exwm-assign-window
:workspace-index 4
:persp-name "dev"))))
(unless exwm--floating-frame
(pcase exwm-class-name
((or "Firefox" "Nightly")
(perspective-exwm-assign-window
:workspace-index 2
:persp-name "browser"))
("Nyxt"
(perspective-exwm-assign-window
:workspace-index 2
:persp-name "browser"))
("Alacritty"
(perspective-exwm-assign-window
:persp-name "term"))
((or "VK" "Slack" "discord" "TelegramDesktop" "Rocket.Chat")
(perspective-exwm-assign-window
:workspace-index 3
:persp-name "comms"))
((or "Chromium-browser" "jetbrains-datagrip")
(perspective-exwm-assign-window
:workspace-index 4
:persp-name "dev")))))
(add-hook 'exwm-manage-finish-hook #'my/exwm-configure-window)
#+end_src

View file

@ -1021,13 +1021,13 @@ I used to have [[https://github.com/Alexander-Miller/treemacs][Treemacs]] here,
"M" 'magit-file-dispatch)
:config
(setq magit-blame-styles
'((headings
(heading-format . "%-20a %C %s\n"))
(highlight
(highlight-face . magit-blame-highlight))
(lines
(show-lines . t)
(show-message . t)))))
'((headings
(heading-format . "%-20a %C %s\n"))
(highlight
(highlight-face . magit-blame-highlight))
(lines
(show-lines . t)
(show-message . t)))))
#+end_src
[[https://github.com/magit/forge][forge]] provides integration with forges, such as GitHub and GitLab.
@ -1675,7 +1675,9 @@ Defining colors for =tab-bar.el=:
(tab-bar-tab :background (my/color-value 'bg)
:foreground (my/color-value 'yellow)
:underline (my/color-value 'yellow))
(tab-bar :background nil :foreground nil))
(tab-bar :background nil :foreground nil)
(magit-section-secondary-heading :foreground (my/color-value 'blue)
:weight 'bold))
#+end_src
**** Switch theme
The built-in =load-theme= does not deactivate the previous theme, so here's a function that does that:
@ -1763,7 +1765,9 @@ References:
#+begin_src emacs-lisp
(when (display-graphic-p)
(if (x-list-fonts "JetBrainsMono Nerd Font")
(set-frame-font "JetBrainsMono Nerd Font 10" nil t)
(let ((font "-JB -JetBrainsMono Nerd Font-medium-normal-normal-*-17-*-*-*-m-0-iso10646-1"))
(set-frame-font font nil t)
(add-to-list 'default-frame-alist `(font . ,font)))
(message "Install JetBrainsMono Nerd Font!")))
#+end_src
@ -1771,7 +1775,12 @@ To make the icons work (e.g. in the Doom Modeline), run =M-x all-the-icons-insta
*** Other fonts
#+begin_src emacs-lisp
(when (display-graphic-p)
(set-face-attribute 'variable-pitch nil :family "Cantarell" :height 1.0))
(set-face-attribute 'variable-pitch nil :family "Cantarell" :height 1.0)
(set-face-attribute
'italic nil
:family "JetBrainsMono Nerd Font"
:weight 'regular
:slant 'italic))
#+end_src
*** Ligatures
Ligature setup for the JetBrainsMono font.
@ -3568,6 +3577,7 @@ A function to start up [[https://www.tensorflow.org/tensorboard][TensorBoard]].
#+begin_src emacs-lisp
(use-package csv-mode
:straight t
:disabled
:mode "\\.csv\\'")
#+end_src
*** YAML
@ -4713,9 +4723,13 @@ Let's wrap it into a minor mode:
(my/org-alert-cleanup)))
#+end_src
I don't have any idea why, but evaluating =(my/org-alert-mode)= just after =org= breaks font-lock after I try to open =inbox.org=. =emacs-startup-hook=, however, works fine.
#+begin_src emacs-lisp
(with-eval-after-load 'org
(my/org-alert-mode))
(if my/emacs-started
(my/org-alert-mode)
(add-hook 'emacs-startup-hook #'my/org-alert-mode)))
#+end_src
**** Other settings
@ -6925,24 +6939,6 @@ Setting up custom faces for certain tags to make the feed look a bit nicer.
(blogs elfeed-blogs-entry)
(unread elfeed-search-unread-title-face))))
#+end_src
Also, a function to automatically adjust these colors with the Doom theme.
#+begin_src emacs-lisp
(defun my/update-my-theme-elfeed (&rest _)
(custom-theme-set-faces
'my-theme-1
`(elfeed-videos-entry ((t :foreground ,(my/color-value 'red))))
`(elfeed-twitter-entry ((t :foreground ,(my/color-value 'blue))))
`(elfeed-emacs-entry ((t :foreground ,(my/color-value 'magenta))))
`(elfeed-music-entry ((t :foreground ,(my/color-value 'green))))
`(elfeed-podcasts-entry ((t :foreground ,(my/color-value 'yellow))))
`(elfeed-blogs-entry ((t :foreground ,(my/color-value 'orange)))))
(enable-theme 'my-theme-1))
(advice-add 'load-theme :after #'my/update-my-theme-elfeed)
(when (fboundp 'doom-color)
(my/update-my-theme-elfeed))
#+end_src
*** elfeed-summary
[[https://github.com/SqrtMinusOne/elfeed-summary][elfeed-summary]] is my package that provides a feed summary interface for elfeed.
@ -6992,6 +6988,20 @@ Second, a function that returns a URL to an enclosure. This is generally how pod
(caar (elfeed-entry-enclosures entry)))
#+end_src
And a package called [[https://github.com/karthink/elfeed-tube][elfeed-tube]] to fetch some additional data from YouTUbe.
#+begin_src emacs-lisp
(use-package elfeed-tube
:straight t
:after elfeed
:config
(setq elfeed-tube-auto-fetch-p nil)
(elfeed-tube-setup)
(general-define-key
:states 'normal
:keymaps '(elfeed-search-mode-map elfeed-show-mode-map)
"gf" #'elfeed-tube-fetch))
#+end_src
Now, a function to add a YouTube link with metadata from elfeed to EMMS.
#+begin_src emacs-lisp
(with-eval-after-load 'emms
@ -8879,7 +8889,7 @@ Also a keymap for room mode:
| Guix dependency |
|-------------------|
| tdlib-1.8.14 |
| tdlib-1.8.15 |
| font-gnu-unifont |
| font-gnu-freefont |
@ -8920,7 +8930,7 @@ Building =telega-server= can create problems. It requires the latest version of
(interactive)
(setq telega-server-libs-prefix
(string-trim
(shell-command-to-string "guix build tdlib-1.8.14")))
(shell-command-to-string "guix build tdlib-1.8.15")))
(telega-server-build "CC=gcc"))
#+end_src
@ -9683,6 +9693,6 @@ I thought about making something like a [[https://github.com/magit/transient][tr
#+begin_src scheme :tangle .config/guix/manifests/emacs.scm :noweb yes
(specifications->manifest
'("emacs"
'("emacs-next-tree-sitter"
<<packages()>>))
#+end_src