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:
parent
d683e4ae6a
commit
d9aecce780
2 changed files with 39 additions and 1 deletions
|
|
@ -41,3 +41,41 @@
|
||||||
(setq exec-path
|
(setq exec-path
|
||||||
(append exec-path
|
(append exec-path
|
||||||
my/emacs-deps-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))))))))
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,7 @@
|
||||||
(eval +overlay) ; run code, run (also, repls)
|
(eval +overlay) ; run code, run (also, repls)
|
||||||
lookup ; navigate your code and its documentation
|
lookup ; navigate your code and its documentation
|
||||||
;;llm ; when I said you needed friends, I didn't mean...
|
;;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
|
magit ; a git porcelain for Emacs
|
||||||
make ; run make tasks from Emacs
|
make ; run make tasks from Emacs
|
||||||
;;pass ; password manager for nerds
|
;;pass ; password manager for nerds
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue