Skip to content

Commit

Permalink
Merge branch 'master' of github.com:SqrtMinusOne/dotfiles
Browse files Browse the repository at this point in the history
  • Loading branch information
SqrtMinusOne committed Apr 26, 2024
2 parents 6ae5b30 + aff40b3 commit 48e7e82
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 29 deletions.
35 changes: 23 additions & 12 deletions .emacs.d/init.el
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,8 @@ Obeys `widen-automatically', which see."
:infix "g"
"g" #'counsel-mark-ring
"G" #'my/counsel-global-mark-ring
"C" #'my/mark-ring-clear)
"C" #'my/mark-ring-clear
"m" #'my/push-mark-no-activate)

(general-define-key
:keymaps 'global
Expand Down Expand Up @@ -1241,7 +1242,9 @@ Obeys `widen-automatically', which see."
(when current-prefix-arg
(my/regenerate-desktop)))

(my/switch-theme 'ef-duo-light)
(if my/is-termux
(my/switch-theme 'modus-operandi-tinted)
(my/switch-theme 'ef-duo-light))

(with-eval-after-load 'transient
(my/use-colors
Expand Down Expand Up @@ -1384,6 +1387,8 @@ Obeys `widen-automatically', which see."
(setq doom-modeline-persp-icon nil)
(setq doom-modeline-persp-name nil)
(setq doom-modeline-display-misc-in-all-mode-lines nil)
(when my/is-termux
(setopt doom-modeline-icon nil))
:config
(setq doom-modeline-minor-modes nil)
(setq doom-modeline-irc nil)
Expand Down Expand Up @@ -5072,11 +5077,13 @@ KEYS is a list of cons cells like (<label> . <time>)."
"\n"))

(setq my/org-config-files
'("/home/pavel/Emacs.org"
"/home/pavel/Desktop.org"
"/home/pavel/Console.org"
"/home/pavel/Guix.org"
"/home/pavel/Mail.org"))
(mapcar
#'expand-file-name
'("~/Emacs.org"
"~/Desktop.org"
"~/Console.org"
"~/Guix.org"
"~/Mail.org")))

(add-hook 'org-mode-hook
(lambda ()
Expand Down Expand Up @@ -6605,7 +6612,7 @@ ENTRY is an instance of `elfeed-entry'."
(lambda (&key error-thrown &allow-other-keys)
(message "Error!: %S" error-thrown))))))

(unless (or my/is-termux my/remote-server)
(unless (or my/remote-server)
(let ((mail-file (expand-file-name "mail.el" user-emacs-directory)))
(if (file-exists-p mail-file)
(load-file mail-file)
Expand Down Expand Up @@ -7534,7 +7541,7 @@ base toot."

(use-package telega
:straight t
:if (not (or my/remote-server my/is-termux))
:if (not (or my/remote-server))
:commands (telega)
:init
(my-leader-def "a l" (my/command-in-persp "telega" "telega" 3 (telega)))
Expand Down Expand Up @@ -7566,8 +7573,10 @@ base toot."
(defun my/telega-server-build ()
(interactive)
(setq telega-server-libs-prefix
(string-trim
(shell-command-to-string "guix build tdlib")))
(if (executable-find "guix")
(string-trim
(shell-command-to-string "guix build tdlib"))
(expand-file-name "~/bin/td/build/res/usr/local")))
(telega-server-build "CC=gcc"))

(add-hook 'telega-load-hook #'telega-mode-line-mode)
Expand All @@ -7585,6 +7594,7 @@ base toot."
"]"))

(defun my/telega-chat-setup ()
(interactive)
(set (make-local-variable 'company-backends)
(append (list 'telega-company-emoji
'telega-company-username
Expand All @@ -7594,7 +7604,8 @@ base toot."
'(telega-company-botcmd))))
(company-mode 1)
(setopt visual-fill-column-width
(+ telega-chat-fill-column 4))
(+ telega-chat-fill-column
(if (display-graphic-p) 4 5)))
(setq-local split-width-threshold 1))
(add-hook 'telega-chat-mode-hook #'my/telega-chat-setup)

Expand Down
5 changes: 5 additions & 0 deletions .emacs.d/mail.el
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
(let ((default-directory dir))
(normal-top-level-add-subdirs-to-load-path))))

(use-package notmuch
:straight t
:if my/is-termux)

(defun my/notmuch-toggle-trash ()
(interactive)
(evil-collection-notmuch-toggle-tag "trash" "search" #'ignore))
Expand Down Expand Up @@ -69,6 +73,7 @@
(:name "pvkorytov (unread)" :query "tag:pvkorytov AND tag:unread" :key "vu")
(:name "pvkorytov (sent)" :query "tag:pvkorytov AND tag:sent" :key "vs")
(:name "pvkorytov (all mail)" :query "tag:pvkorytov" :key "va")))
(setq notmuch-show-empty-saved-searches t)

(general-define-key
:states '(normal visual)
Expand Down
37 changes: 24 additions & 13 deletions Emacs.org
Original file line number Diff line number Diff line change
Expand Up @@ -1345,7 +1345,8 @@ Keybindings:
:infix "g"
"g" #'counsel-mark-ring
"G" #'my/counsel-global-mark-ring
"C" #'my/mark-ring-clear)
"C" #'my/mark-ring-clear
"m" #'my/push-mark-no-activate)

(general-define-key
:keymaps 'global
Expand Down Expand Up @@ -1990,7 +1991,9 @@ The built-in =load-theme= does not deactivate the previous theme, so here's a fu
#+end_src

#+begin_src emacs-lisp
(my/switch-theme 'ef-duo-light)
(if my/is-termux
(my/switch-theme 'modus-operandi-tinted)
(my/switch-theme 'ef-duo-light))
#+end_src
**** Extending current theme
Colors that aren't set in themes.
Expand Down Expand Up @@ -2189,6 +2192,8 @@ References:
(setq doom-modeline-persp-icon nil)
(setq doom-modeline-persp-name nil)
(setq doom-modeline-display-misc-in-all-mode-lines nil)
(when my/is-termux
(setopt doom-modeline-icon nil))
:config
(setq doom-modeline-minor-modes nil)
(setq doom-modeline-irc nil)
Expand Down Expand Up @@ -7043,11 +7048,13 @@ One note is that by default running these commands will require the user to conf

#+begin_src emacs-lisp
(setq my/org-config-files
'("/home/pavel/Emacs.org"
"/home/pavel/Desktop.org"
"/home/pavel/Console.org"
"/home/pavel/Guix.org"
"/home/pavel/Mail.org"))
(mapcar
#'expand-file-name
'("~/Emacs.org"
"~/Desktop.org"
"~/Console.org"
"~/Guix.org"
"~/Mail.org")))

(add-hook 'org-mode-hook
(lambda ()
Expand Down Expand Up @@ -9195,7 +9202,7 @@ However, the quality of the output for Whisper is just so much better so I consi
My notmuch config now resides in [[file:Mail.org][Mail.org]].

#+begin_src emacs-lisp
(unless (or my/is-termux my/remote-server)
(unless (or my/remote-server)
(let ((mail-file (expand-file-name "mail.el" user-emacs-directory)))
(if (file-exists-p mail-file)
(load-file mail-file)
Expand Down Expand Up @@ -10401,7 +10408,7 @@ Or you can load up Element for a moment to see what the mention was, if that's e
#+begin_src emacs-lisp
(use-package telega
:straight t
:if (not (or my/remote-server my/is-termux))
:if (not (or my/remote-server))
:commands (telega)
:init
(my-leader-def "a l" (my/command-in-persp "telega" "telega" 3 (telega)))
Expand Down Expand Up @@ -10431,13 +10438,15 @@ Or you can load up Element for a moment to see what the mention was, if that's e
telega-webpage-mode 3 "telega"))
#+end_src

Building =telega-server= can create problems. It requires the latest version of =tdlib=, which isn't available anywhere, but I can inherit the Guix package definition.
Building =telega-server= can create problems. On Guix I can use the Guix package definition, on termux just build manually.
#+begin_src emacs-lisp
(defun my/telega-server-build ()
(interactive)
(setq telega-server-libs-prefix
(string-trim
(shell-command-to-string "guix build tdlib")))
(if (executable-find "guix")
(string-trim
(shell-command-to-string "guix build tdlib"))
(expand-file-name "~/bin/td/build/res/usr/local")))
(telega-server-build "CC=gcc"))
#+end_src

Expand All @@ -10461,6 +10470,7 @@ Setting up the modeline. The default mode string doesn't look great with my othe
Configuring company backends for the chat buffer, as recommended in the manual:
#+begin_src emacs-lisp
(defun my/telega-chat-setup ()
(interactive)
(set (make-local-variable 'company-backends)
(append (list 'telega-company-emoji
'telega-company-username
Expand All @@ -10470,7 +10480,8 @@ Configuring company backends for the chat buffer, as recommended in the manual:
'(telega-company-botcmd))))
(company-mode 1)
(setopt visual-fill-column-width
(+ telega-chat-fill-column 4))
(+ telega-chat-fill-column
(if (display-graphic-p) 4 5)))
(setq-local split-width-threshold 1))
(add-hook 'telega-chat-mode-hook #'my/telega-chat-setup)
#+end_src
Expand Down
22 changes: 18 additions & 4 deletions Mail.org
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,15 @@ Notmuch is an email indexer program, which handles labels in a way somewhat simi

Not much is going on here.

First, the database path.
#+begin_src conf-unix
First, the database path. It's different on desktop and termux.
#+NAME: get-maildir-path
#+begin_src emacs-lisp :tangle no
(expand-file-name "~/Mail")
#+end_src

#+begin_src conf-unix :noweb yes
[database]
path=/home/pavel/Mail
path=<<get-maildir-path()>>
#+end_src

My name and list of emails. It's not like it's a secret anyhow.
Expand All @@ -146,7 +151,8 @@ A list of tags which will be added by =notmuch new= and directory names which wi
#+begin_src conf-unix
[new]
tags=new;
ignore=.osync_workdir;.mbsyncstate;.uidvalidity;.lock;/.*gmailieer\.json.*/
# ignore=.osync_workdir;.mbsyncstate;.uidvalidity;.lock;/.*gmailieer\.json.*/
ignore=/.*[.](json|lock|bak|osync_workdir|mbsyncstate|uidvalidity)$/
#+end_src

Exclude these tags from search by default.
Expand Down Expand Up @@ -383,6 +389,13 @@ Then, the problem with my Guix setup is that Emacs by default doesn't see the el
(normal-top-level-add-subdirs-to-load-path))))
#+end_src

On termux the above doesn't work so...
#+begin_src emacs-lisp
(use-package notmuch
:straight t
:if my/is-termux)
#+end_src

Some functions to toggle tags:
#+begin_src emacs-lisp
(defun my/notmuch-toggle-trash ()
Expand Down Expand Up @@ -487,6 +500,7 @@ The following formats the tables above to a proper syntax for =setq notmuch-save
(setq notmuch-saved-searches
'((:name "drafts" :query "tag:draft" :key "d")
<<format-notmuch-saved-searches()>>))
(setq notmuch-show-empty-saved-searches t)
#+end_src

#+begin_src emacs-lisp
Expand Down

0 comments on commit 48e7e82

Please sign in to comment.