alphapapa / alphapapa/ement.el

[Feature Request] Command to copy message body

未关闭
#171 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
enhancement good first issue help wanted
主要语言
Emacs Lisp
星标
604
派生
54
PR 合并指标
30 天内没有已合并 PR

描述

As discused in #ement.el:matrix.org, it would be nice to have a command to copy a message's body to the kill-ring. e.g.

```emacs-lisp
(defun ement-room-copy-message (pos &optional formatted)
"Copy message at POS to `kill-ring'. POS Defaults to point.
If FORMATTED is non-nil, when called with a prefix argument, retain body formatting.
Otherwise, the plain text message body is copied."
(interactive (list (point) current-prefix-arg))
(or (derived-mode-p 'ement-room-mode) (user-error "Not in an ement room"))
(if-let ((event (ewoc-data (ewoc-locate ement-ewoc pos)))
((equal (ement-event-type event) "m.room.message"))
(content (ement-event-content event))
(body (or (and formatted (alist-get 'formatted_body content))
(alist-get 'body content))))
(ignore (kill-new body))
(user-error "No message at point")))
```

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。