Skip to content

Add the Emacspeak Telega integration module#558

Open
Nuno69 wants to merge 1 commit into
zevlg:masterfrom
Nuno69:contrib/emacspeak-integration
Open

Add the Emacspeak Telega integration module#558
Nuno69 wants to merge 1 commit into
zevlg:masterfrom
Nuno69:contrib/emacspeak-integration

Conversation

@Nuno69
Copy link
Copy Markdown

@Nuno69 Nuno69 commented Mar 12, 2026

This module aims to make Emacspeak --- the complete audio desktop seamlessly integrated with Telega.el. Currently the module allows to automatically read incoming messages (controlled per chat with {C-c } or globally to all Telega chat buffers {C-u C-c }).

(cl-declaim (optimize (safety 0) (speed 3)))
(require 'subr-x)
(require 'emacspeak-preamble)
(require 'telega-notifications)
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use (require 'telega), making every telega function available to the package

(dtk-speak (emacspeak-telega--message-preview msg)))))))

;;;###autoload
(defun emacspeak-telega-toggle-autospeak (&optional prefix)
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is better to utilize define-minor-mode to define local/global minor modes. See how it is done in the telega-squash-message-mode and global-telega-squash-message-mode.

(if prefix "" "locally")))

(add-hook 'telega-chat-post-message-hook
#'emacspeak-telega--autospeak-message)
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you use with-telega-chatbuf in the emacspeak-telega--autospeak-message it is better to use telega-chatbuf-post-msg-insert-hook local hook, which is triggered after message is inserted in the existing chatbuf.

add-hook has local argument to install hook locally for the current buffer.

(emacspeak-telega-setup-keys)

(with-eval-after-load 'telega-chat
(emacspeak-telega-setup-keys))
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not needed, since all top-level forms will be evaluated on the emacspeak-telega load. And telega-chat-mode-map will be available because you did (require 'telega) at the top.

Also, it is arguable that explicit binding to enable mode is needed. Better to leave this to user setup

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants