[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ement 8d8619c2e0 12/30: Add command `ement-room-compose
From: |
ELPA Syncer |
Subject: |
[elpa] externals/ement 8d8619c2e0 12/30: Add command `ement-room-compose-send-direct' |
Date: |
Sun, 3 Mar 2024 06:58:15 -0500 (EST) |
branch: externals/ement
commit 8d8619c2e086909751b69cc4beca6ae7a59af5ee
Author: Phil Sainty <phil@catalyst.net.nz>
Commit: Phil Sainty <phil@catalyst.net.nz>
Add command `ement-room-compose-send-direct'
Extracts common functionality `ement-room-compose-send-prepare' for
both `ement-room-compose-send' and `ement-room-compose-send-direct'.
---
ement-room.el | 47 ++++++++++++++++++++++++++++++++++++++---------
1 file changed, 38 insertions(+), 9 deletions(-)
diff --git a/ement-room.el b/ement-room.el
index b5f7ef739b..dad06cb0b2 100644
--- a/ement-room.el
+++ b/ement-room.el
@@ -3781,24 +3781,34 @@ To be called from a minibuffer opened from
(skip-chars-backward " \t\r\n")
(point))))
-(defun ement-room-compose-send ()
- "Prompt to send the current compose buffer's contents.
-To be called from an `ement-room-compose' buffer."
- (interactive)
+(defun ement-room-compose-send-prepare ()
+ "Bindings for `ement-room-compose-send' and
`ement-room-compose-send-direct'."
(cl-assert ement-room-compose-buffer)
(cl-assert ement-room) (cl-assert ement-session)
+ ;; Capture the necessary values from the compose buffer before killing it and
+ ;; switching back to the room buffer. Return the values as a list.
(let ((body (ement-room-compose-buffer-string-trimmed))
- (room ement-room)
- (session ement-session)
(input-method current-input-method)
(send-message-filter ement-room-send-message-filter)
(replying-to-event ement-room-replying-to-event)
- (editing-event ement-room-editing-event))
+ (editing-event ement-room-editing-event)
+ (room ement-room)
+ (session ement-session))
+ (quit-restore-window nil 'kill)
+ (ement-view-room room session)
+ (list body input-method send-message-filter replying-to-event
editing-event room session)))
+
+(defun ement-room-compose-send ()
+ "Prompt to send the current compose buffer's contents.
+To be called from an `ement-room-compose' buffer.
+See also `ement-room-compose-send-direct'."
+ (interactive)
+ (cl-destructuring-bind (body input-method send-message-filter
+ replying-to-event editing-event room session)
+ (ement-room-compose-send-prepare)
;; Putting body in the kill ring seems like the best thing to do, to ensure
;; it doesn't get lost if the user exits the minibuffer before sending.
(kill-new body)
- (quit-restore-window nil 'kill)
- (ement-view-room room session)
(let* ((prompt (format "Send message (%s): " (ement-room-display-name
room)))
(current-input-method input-method) ; Bind around read-string call.
(ement-room-send-message-filter send-message-filter)
@@ -3821,6 +3831,25 @@ To be called from an `ement-room-compose' buffer."
(ement--original-event-for
replying-to-event
session)))))))
+(defun ement-room-compose-send-direct ()
+ "Directly send the current compose buffer's contents.
+To be called from an `ement-room-compose' buffer.
+See also `ement-room-compose-send'."
+ (interactive)
+ (cl-destructuring-bind (body _input-method send-message-filter
+ replying-to-event editing-event room session)
+ (ement-room-compose-send-prepare)
+ (add-to-history 'ement-room-message-history body)
+ (let ((ement-room-send-message-filter send-message-filter))
+ (if editing-event
+ (ement-room-edit-message (ement--original-event-for editing-event
session)
+ room session body)
+ (ement-room-send-message room session
+ :body body
+ :replying-to-event (and replying-to-event
+
(ement--original-event-for
+ replying-to-event
session)))))))
+
(defun ement-room-init-compose-buffer (room session)
"Set up the current buffer as a compose buffer.
Sets ROOM and SESSION buffer-locally, binds `save-buffer' in
- [elpa] externals/ement updated (2b9725accd -> efb6005c10), ELPA Syncer, 2024/03/03
- [elpa] externals/ement cba68d94d9 01/30: Tidy: Whitespace in README.org, ELPA Syncer, 2024/03/03
- [elpa] externals/ement 375744c409 03/30: Tidy: (ement-room-mode) Formatting, ELPA Syncer, 2024/03/03
- [elpa] externals/ement a17ffa1020 04/30: Fix: (ement-room-write-reply) Assertions, ELPA Syncer, 2024/03/03
- [elpa] externals/ement 42e07f85fd 06/30: Change: (ement-room-init-compose-buffer) Improve `header-line-format', ELPA Syncer, 2024/03/03
- [elpa] externals/ement 89d30e6027 10/30: Tidy: (ement-room-compose-send) Use let-bindings, ELPA Syncer, 2024/03/03
- [elpa] externals/ement 8d8619c2e0 12/30: Add command `ement-room-compose-send-direct',
ELPA Syncer <=
- [elpa] externals/ement a72a88c2a8 13/30: Change: Defer to `ement-room-message-history' over kill-ring usage, ELPA Syncer, 2024/03/03
- [elpa] externals/ement ea99f8dd80 02/30: Fix: (ement-room-compose-send) Docstring, ELPA Syncer, 2024/03/03
- [elpa] externals/ement ed08bc2188 05/30: Fix: (ement-room-send-org-filter) Prevent a new frame being created, ELPA Syncer, 2024/03/03
- [elpa] externals/ement 9002bc5d87 07/30: Fix: (ement-room-edit-message) Prohibit non-interactive editing of edit events, ELPA Syncer, 2024/03/03
- [elpa] externals/ement 1649da6bde 08/30: Add function `ement-room-compose-buffer-string-trimmed', ELPA Syncer, 2024/03/03
- [elpa] externals/ement 750a1cfd80 09/30: Tidy: (ement-room-compose-send) Combine the editing-or-replying cases, ELPA Syncer, 2024/03/03
- [elpa] externals/ement 3acad3e4d8 11/30: Fix: (ement-room-compose-send) Use `ement--original-event-for', ELPA Syncer, 2024/03/03
- [elpa] externals/ement ccdc20f51d 14/30: Add command `ement-room-compose-abort', ELPA Syncer, 2024/03/03
- [elpa] externals/ement f9aaf13436 16/30: Add command `ement-room-compose-edit', ELPA Syncer, 2024/03/03
- [elpa] externals/ement a8a15f64d1 19/30: Auto-resize for the compose buffer window height, ELPA Syncer, 2024/03/03