[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ement 0693e2e71e 4/5: Add/Change: (ement-room-list-defi
From: |
ELPA Syncer |
Subject: |
[elpa] externals/ement 0693e2e71e 4/5: Add/Change: (ement-room-list-define-mouse-command), etc. |
Date: |
Fri, 28 Apr 2023 01:58:20 -0400 (EDT) |
branch: externals/ement
commit 0693e2e71e3ad4e14b5823896bba38cb36f552bc
Author: Adam Porter <adam@alphapapa.net>
Commit: Adam Porter <adam@alphapapa.net>
Add/Change: (ement-room-list-define-mouse-command), etc.
* ement-room-list.el (ement-room-list-define-mouse-command): New macro.
(ement-room-list-mode-map): Use new macro.
(ement-room-list-mouse-1): Remove old defun.
---
ement-room-list.el | 25 ++++++++++++++++++-------
1 file changed, 18 insertions(+), 7 deletions(-)
diff --git a/ement-room-list.el b/ement-room-list.el
index 39542c5dcc..17c1f84bbf 100644
--- a/ement-room-list.el
+++ b/ement-room-list.el
@@ -39,6 +39,23 @@
"Group Ement rooms with Taxy."
:group 'ement)
+;;;; Mouse commands
+
+;; Since mouse-activated commands must handle mouse events, we define a simple
macro to
+;; wrap a command into a mouse-event-accepting one.
+
+(defmacro ement-room-list-define-mouse-command (command)
+ "Define a command that calls COMMAND interactively with point at mouse event.
+COMMAND should be a form that evaluates to a function symbol; if
+a symbol, it should be unquoted.."
+ (let ((docstring (format "Call command `%s' interactively with point at
EVENT." command))
+ (name (intern (format "ement-room-list-mouse-%s" command))))
+ `(defun ,name (event)
+ ,docstring
+ (interactive "e")
+ (mouse-set-point event)
+ (call-interactively #',command))))
+
;;;; Variables
(declare-function ement-room-toggle-space "ement-room")
@@ -48,7 +65,7 @@
(define-key map (kbd "RET") #'ement-room-list-RET)
(define-key map (kbd "SPC") #'ement-room-list-next-unread)
(define-key map [tab] #'ement-room-list-section-toggle)
- (define-key map [mouse-1] #'ement-room-list-mouse-1)
+ (define-key map [mouse-1] (ement-room-list-define-mouse-command
ement-room-list-RET))
(define-key map (kbd "k") #'ement-room-list-kill-buffer)
(define-key map (kbd "s") #'ement-room-toggle-space)
map))
@@ -692,12 +709,6 @@ left."
(kill-buffer buffer)
(ement-room-list-revert))))
-(defun ement-room-list-mouse-1 (event)
- "Call `ement-room-list-RET' at EVENT."
- (interactive "e")
- (mouse-set-point event)
- (call-interactively #'ement-room-list-RET))
-
(declare-function ement-view-room "ement-room")
(defun ement-room-list-RET ()
"View room at point, or cycle section at point."
- [elpa] externals/ement updated (ba1dd64f8a -> 11450ed344), ELPA Syncer, 2023/04/28
- [elpa] externals/ement ebbaa5829b 1/5: Add: (ement--byte-run--declare-function), ELPA Syncer, 2023/04/28
- [elpa] externals/ement 2bfb2bae5d 2/5: Tidy: Remove old declare-function form, ELPA Syncer, 2023/04/28
- [elpa] externals/ement 8589774ba3 3/5: Add/Change: (ement-room-view-hook), etc., ELPA Syncer, 2023/04/28
- [elpa] externals/ement 11450ed344 5/5: Add/Change: (ement-room-list-button-map), ELPA Syncer, 2023/04/28
- [elpa] externals/ement 0693e2e71e 4/5: Add/Change: (ement-room-list-define-mouse-command), etc.,
ELPA Syncer <=