feat(doom): Enhance telega clipboard and enable lisp

This commit introduces significant improvements to clipboard handling
within the Telega (Telegram) client and enables the LSP module.

### Telega Clipboard Enhancements
- Paste Images: Overrides the default image pasting
  function (`telega-chatbuf-attach-clipboard`) with more image format
  support.
- Copy Images: Adds a new interactive command,
  `+telega-save-file-to-clipboard`, to download a file from a message
  and copy it directly to the Wayland clipboard via `wl-copy`.

### LSP Support
- Enabled the `:tools lsp` module to activate Language Server Protocol
  support for improved code intelligence.
This commit is contained in:
ulic-youthlic 2025-08-30 22:18:47 +08:00
parent d683e4ae6a
commit d9aecce780
Signed by: youthlic
GPG key ID: 63E86C3C14A0D721
2 changed files with 39 additions and 1 deletions

View file

@ -41,3 +41,41 @@
(setq exec-path
(append exec-path
my/emacs-deps-exec-path))))
(advice-add #'telega-chatbuf-attach-clipboard
:override #'(lambda (doc-p)
(interactive "P")
(let* ((selection-coding-system 'no-conversion) ;for rawdata
(temporary-file-directory telega-temp-dir)
(tmpfile (telega-temp-name "clipboard" ".png"))
(coding-system-for-write 'binary))
(if (eq system-type 'darwin)
(progn
;; NOTE: On MacOS, try extracting clipboard using pngpaste
(unless (executable-find "pngpaste")
(error "Please install pngpaste to paste images"))
(unless (= 0 (telega-screenshot-with-pngpaste tmpfile))
(error "No image in CLIPBOARD")))
(let ((image-data (or (gui-get-selection 'CLIPBOARD 'image/png)
(gui-get-selection 'CLIPBOARD 'image/jpeg)
(error "No image in CLIPBOARD"))))
(write-region image-data nil tmpfile nil 'quiet)))
(telega-chatbuf-attach-media tmpfile (when doc-p 'preview)))))
(defun +telega-save-file-to-clipboard (msg)
"Save file at point to clipboard.
NOTE: wayland only."
(interactive (list (telega-msg-for-interactive)))
(let ((file (telega-msg--content-file msg)))
(unless file
(user-error "No file associated with message"))
(telega-file--download file
:priority 32
:update-callback
(lambda (dfile)
(telega-msg-redisplay msg)
(message "Wait for downloading to finish…")
(when (telega-file--downloaded-p dfile)
(let* ((fpath (telega--tl-get dfile :local :path)))
(shell-command (format "wl-copy < \"%s\"" fpath))
(message (format "File saved to clipboard: %s" fpath))))))))

View file

@ -100,7 +100,7 @@
(eval +overlay) ; run code, run (also, repls)
lookup ; navigate your code and its documentation
;;llm ; when I said you needed friends, I didn't mean...
;;lsp ; M-x vscode
lsp ; M-x vscode
magit ; a git porcelain for Emacs
make ; run make tasks from Emacs
;;pass ; password manager for nerds