From b860bc0bc8ace56f26614c220b4730d592d127bb Mon Sep 17 00:00:00 2001 From: js0ny Date: Sun, 2 Mar 2025 13:28:55 +0000 Subject: [PATCH] feat(emacs): Org view, telega, doomrc alias --- common/agenda-view.el | 3 ++ tools/doom/config.el | 3 ++ tools/doom/org.el | 24 ++++++++++-- tools/doom/packages.el | 4 ++ tools/doom/telega.el | 72 ++++++++++++++++++++++++++++++++++++ tools/fish/conf.d/alias.fish | 3 ++ tools/zsh/mod/alias.zsh | 3 ++ 7 files changed, 109 insertions(+), 3 deletions(-) create mode 100644 common/agenda-view.el create mode 100644 tools/doom/telega.el diff --git a/common/agenda-view.el b/common/agenda-view.el new file mode 100644 index 0000000..cf8adaa --- /dev/null +++ b/common/agenda-view.el @@ -0,0 +1,3 @@ + +(setq org-directory "~/OrgFiles/") +(setq org-agenda-files (list (concat org-directory "tasks/"))) diff --git a/tools/doom/config.el b/tools/doom/config.el index 43aeab4..7770251 100644 --- a/tools/doom/config.el +++ b/tools/doom/config.el @@ -121,3 +121,6 @@ ) (load! "calendar.el") + + +(load! "telega.el") diff --git a/tools/doom/org.el b/tools/doom/org.el index 7849347..10f75b4 100644 --- a/tools/doom/org.el +++ b/tools/doom/org.el @@ -72,12 +72,13 @@ ) ) +;;; org-agenda + (after! org-agenda ;; (setq org-agenda-files (directory-files-recursively "~/OrgFiles/tasks/" "\\.org$")) (setq org-agenda-files (list (concat org-directory "tasks/"))) ) -(map! :leader :desc "Org Agenda" "A" #'org-agenda) (map! :after org-agenda :map evil-org-agenda-mode-map @@ -87,8 +88,16 @@ :m "ge" #'org-agenda-previous-item :m "N" #'org-agenda-priority-up :m "E" #'org-agenda-priority-down - :m "i" #'evil-forward-char) + :m "i" #'evil-forward-char + :leader :desc "Org Agenda" "A" #'org-agenda) +;; org-agenda-clockreport + +(setq org-agenda-clockreport-parameter-plist '(:link t :maxlevel 3 :fileskip0 t :compact t :narrow 80)) + +;;; org-clock + +;; org-pomodoro (after! org-pomodoro (setq org-pomodoro-format "🍅~%s") @@ -96,9 +105,18 @@ (setq org-pomodoro-long-break-format "猛摸~%s") ) -;; Org-Babel + +;;; org-babel (if (bound-and-true-p ISMAC) (setq org-babel-C-compiler "clang")) (load! "+pomodoro-telegram.el") + +;;; org-export + +;; icalendar + +(setq org-icalendar-use-scheduled '(event-if-todo event-if-not-todo)) +(setq org-icalendar-use-deadline '(event-if-todo event-if-not-todo)) +(setq org-icalendar-combined-agenda-file "~/Dropbox/org.ics") diff --git a/tools/doom/packages.el b/tools/doom/packages.el index 8a85b34..d9073dd 100644 --- a/tools/doom/packages.el +++ b/tools/doom/packages.el @@ -55,3 +55,7 @@ (package! rime) (package! ox-typst) (package! cal-china-x) + +(package! telega :recipe (:files (:defaults "contrib/*.el" "etc" "server" "Makefile"))) + +(package! org-super-agenda) diff --git a/tools/doom/telega.el b/tools/doom/telega.el new file mode 100644 index 0000000..82a18cc --- /dev/null +++ b/tools/doom/telega.el @@ -0,0 +1,72 @@ +;; -*- lexical-binding: t; -*- +;; telegram client for emacs +(use-package! telega + :init + (setq telega-server-libs-prefix "/usr") + (setq telega-directory (expand-file-name "~/.local/share/telega")) + + + (prefix-key global-map (kbd "C-c t") telega-prefix-map) + (unless (display-graphic-p) (setq telega-use-images nil)) + (when (modulep! :editor evil) + (cl-pushnew 'telega +evil-collection-disabled-list :test #'equal) + (setq evil-collection-mode-list (remove 'telega evil-collection-mode-list)) + (set-evil-initial-state! '(telega-root-mode telega-chat-mode) 'emacs)) + + :hook + (telega-load . telega-mode-line-mode) + (telega-load . global-telega-url-shorten-mode) + (telega-load . global-telega-mnz-mode) + (telega-load . telega-autoplay-mode) + (telega-load . telega-transient-mode) + (telega-load . telega-adblock-mode) + (telega-chat-mode . (lambda () + (setq-local visual-fill-column-extra-text-width + '(0 . 2)))) + + :config + (add-hook 'telega-msg-ignore-predicates + (telega-match-gen-predicate 'msg '(sender is-blocked))) + (setq telega-chat-show-deleted-messages-for '(me-is-owner OR-ADMIN) + ;; telega-use-tracking-for '(or mention (and unread unmuted)) + telega-open-file-function 'org-open-file + ;; telega-open-message-as-file '(video video-note) + telega-translate-to-language-by-default "zh" + telega-avatar-workaround-gaps-for `(return t) + telega-mode-line-string-format (remove + '(:eval (telega-mode-line-icon)) + telega-mode-line-string-format)) + + (map! (:prefix "C-c" + :desc "Telega all chats" + "c" #'telega-chat-with + :desc "Telega important chats" + "v" #'telega-switch-important-chat + :desc "Telega next important chat" + "SPC" (cmd! (let ((current-prefix-arg '(4))) + (call-interactively #'telega-switch-important-chat)))) + (:map telega-chat-mode-map + (:prefix ("C-t" . "Telega chat topic") + :desc "Telega filter by chat topic" + "C-t" #'telega-chatbuf-filter-by-topic + :desc "Telega clear chat topic" + "C-c" #'telega-chatbuf-thread-cancel))) + + ; (load! "+telega-auto-input-method") + + (set-popup-rule! (regexp-quote telega-root-buffer-name) + :slot 10 :vslot 10 :side 'right :size 90 :ttl nil :quit 'current :modeline t) + (set-popup-rule! "^◀[^◀\[]*[\[({<].+[\])}>]" + :slot 10 :vslot 10 :side 'right :size 90 :ttl 10 :quit 'current :modeline t) + (set-popup-rule! (regexp-quote "*Telega User*") + :slot 20 :vslot 10 :side 'right :height .5 :ttl 10 :quit t :modeline nil :select t) + (set-popup-rule! (regexp-quote "*Telegram Chat Info*") + :slot 20 :vslot 10 :side 'right :height .5 :ttl 10 :quit t :modeline nil :select t)) + +;; (load! "+telega-addition") + +(use-package! telega-dired-dwim + :after telega dired) + +(use-package! telega-bridge-bot + :after telega) diff --git a/tools/fish/conf.d/alias.fish b/tools/fish/conf.d/alias.fish index c9eb61c..1a505b3 100644 --- a/tools/fish/conf.d/alias.fish +++ b/tools/fish/conf.d/alias.fish @@ -60,6 +60,9 @@ abbr --add ipy ipython abbr --add g lazygit + +abbr --add doomrc "emacsclient -t ~/.config/doom/" + # lsd - modern ls if command -v lsd > /dev/null alias ls='lsd' diff --git a/tools/zsh/mod/alias.zsh b/tools/zsh/mod/alias.zsh index f4442c1..dd166fa 100644 --- a/tools/zsh/mod/alias.zsh +++ b/tools/zsh/mod/alias.zsh @@ -27,6 +27,9 @@ alias ipy=ipython alias g=lazygit + +alias doomrc="emacsclient -t ~/.config/doom/" + # lsd - modern ls if command -v lsd >/dev/null 2>&1; then alias ls='lsd'