Skip to content

Commit

Permalink
emacs: telega.el on termux
Browse files Browse the repository at this point in the history
  • Loading branch information
SqrtMinusOne committed Apr 7, 2024
1 parent eb9afec commit 15aa993
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 23 deletions.
31 changes: 20 additions & 11 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 @@ -5050,11 +5053,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 @@ -7511,7 +7516,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 @@ -7543,8 +7548,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 @@ -7562,6 +7569,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 @@ -7571,7 +7579,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
33 changes: 21 additions & 12 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 @@ -6999,11 +7002,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 @@ -10356,7 +10361,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 @@ -10386,13 +10391,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 @@ -10416,6 +10423,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 @@ -10425,7 +10433,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

0 comments on commit 15aa993

Please sign in to comment.