mirror of
https://github.com/vale981/ement.el
synced 2025-03-04 17:01:39 -05:00
Tidy: Docstrings, comment
This commit is contained in:
parent
74a8be013d
commit
d1fceb149e
5 changed files with 26 additions and 8 deletions
18
ement-api.el
18
ement-api.el
|
@ -71,8 +71,22 @@
|
||||||
;; can get slow and respond a minute or two later.
|
;; can get slow and respond a minute or two later.
|
||||||
(connect-timeout 10) (timeout 60)
|
(connect-timeout 10) (timeout 60)
|
||||||
(version "r0"))
|
(version "r0"))
|
||||||
"FIXME: Docstring."
|
"Make API request on SESSION to ENDPOINT.
|
||||||
;; TODO: Remind users to json-encode data when needed.
|
The request automatically uses SESSION's server, URI prefix, and
|
||||||
|
access token.
|
||||||
|
|
||||||
|
These keyword arguments are passed to `plz', which see: THEN,
|
||||||
|
DATA (passed as BODY), QUEUE (passed to `plz-queue', which see),
|
||||||
|
DATA-TYPE (passed as BODY-TYPE), ELSE, METHOD,
|
||||||
|
JSON-READ-FN (passed as AS), CONNECT-TIMEOUT, TIMEOUT.
|
||||||
|
|
||||||
|
Other arguments include PARAMS (used as the URL's query
|
||||||
|
parameters), ENDPOINT-CATEGORY (added to the endpoint URL), and
|
||||||
|
VERSION (added to the endpoint URL).
|
||||||
|
|
||||||
|
Note that most Matrix requests expect JSON-encoded data, so
|
||||||
|
usually the DATA argument should be passed through
|
||||||
|
`json-encode'."
|
||||||
(declare (indent defun))
|
(declare (indent defun))
|
||||||
(pcase-let* (((cl-struct ement-session server token) session)
|
(pcase-let* (((cl-struct ement-session server token) session)
|
||||||
((cl-struct ement-server uri-prefix) server)
|
((cl-struct ement-server uri-prefix) server)
|
||||||
|
|
|
@ -416,7 +416,10 @@ USER is an `ement-user' struct."
|
||||||
|
|
||||||
(cl-defun ement--prism-color (string &key (contrast-with (face-background 'default nil 'default)))
|
(cl-defun ement--prism-color (string &key (contrast-with (face-background 'default nil 'default)))
|
||||||
"Return a computed color for STRING.
|
"Return a computed color for STRING.
|
||||||
Useful for user messages, generated room avatars, etc."
|
The color is adjusted to have sufficient contrast with the color
|
||||||
|
CONTRAST-WITH (by default, the default face's background). The
|
||||||
|
computed color is useful for user messages, generated room
|
||||||
|
avatars, etc."
|
||||||
;; TODO: Use this instead of `ement-room--user-color'. (Same algorithm ,just takes a
|
;; TODO: Use this instead of `ement-room--user-color'. (Same algorithm ,just takes a
|
||||||
;; string as argument.)
|
;; string as argument.)
|
||||||
;; TODO: Try using HSV somehow so we could avoid having so many strings return a
|
;; TODO: Try using HSV somehow so we could avoid having so many strings return a
|
||||||
|
|
|
@ -222,7 +222,7 @@ anything if session hasn't finished initial sync."
|
||||||
bookmark-make-record-function #'ement-notify-bookmark-make-record))
|
bookmark-make-record-function #'ement-notify-bookmark-make-record))
|
||||||
|
|
||||||
(cl-defun ement-notify--log-to-buffer (event room session &key (buffer-name "*Ement Notifications*"))
|
(cl-defun ement-notify--log-to-buffer (event room session &key (buffer-name "*Ement Notifications*"))
|
||||||
"Log EVENT in ROOM to \"*Ement Notifications*\" buffer."
|
"Log EVENT in ROOM on SESSION to \"*Ement Notifications*\" buffer."
|
||||||
(with-demoted-errors "ement-notify--log-to-buffer: %S"
|
(with-demoted-errors "ement-notify--log-to-buffer: %S"
|
||||||
;; HACK: We only log "m.room.message" events for now. This shouldn't be necessary
|
;; HACK: We only log "m.room.message" events for now. This shouldn't be necessary
|
||||||
;; since we have `ement-notify--event-message-p' in `ement-notify-predicates', but
|
;; since we have `ement-notify--event-message-p' in `ement-notify-predicates', but
|
||||||
|
|
|
@ -1014,7 +1014,8 @@ when switching themes or adjusting `ement-prism' options."
|
||||||
"Browse URL, using Ement for matrix.to URLs when possible.
|
"Browse URL, using Ement for matrix.to URLs when possible.
|
||||||
Otherwise, fall back to `browse-url'. When called outside of an
|
Otherwise, fall back to `browse-url'. When called outside of an
|
||||||
`ement-room' buffer, the variable `ement-session' must be bound
|
`ement-room' buffer, the variable `ement-session' must be bound
|
||||||
to the session in which to look for URL's room and event."
|
to the session in which to look for URL's room and event. ARGS
|
||||||
|
are passed to `browse-url'."
|
||||||
(interactive)
|
(interactive)
|
||||||
(when (string-match ement-room-matrix.to-url-regexp url)
|
(when (string-match ement-room-matrix.to-url-regexp url)
|
||||||
(let ((room-id (when (string-prefix-p "!" (match-string 1 url))
|
(let ((room-id (when (string-prefix-p "!" (match-string 1 url))
|
||||||
|
@ -2682,7 +2683,7 @@ the first and last nodes in the buffer, respectively."
|
||||||
(cl-defun ement-room--insert-sender-headers
|
(cl-defun ement-room--insert-sender-headers
|
||||||
(ewoc &optional (start-node (ewoc-nth ewoc 0)) (end-node (ewoc-nth ewoc -1)))
|
(ewoc &optional (start-node (ewoc-nth ewoc 0)) (end-node (ewoc-nth ewoc -1)))
|
||||||
;; TODO: Use this in appropriate places.
|
;; TODO: Use this in appropriate places.
|
||||||
"Insert sender headers into current buffer's `ement-ewoc'.
|
"Insert sender headers into EWOC.
|
||||||
Inserts headers between START-NODE and END-NODE, which default to
|
Inserts headers between START-NODE and END-NODE, which default to
|
||||||
the first and last nodes in the buffer, respectively."
|
the first and last nodes in the buffer, respectively."
|
||||||
(cl-labels ((read-marker-p
|
(cl-labels ((read-marker-p
|
||||||
|
|
|
@ -122,7 +122,7 @@
|
||||||
;; Room is a specified space.
|
;; Room is a specified space.
|
||||||
(or name (concat "Space: " (ement-room-display-name room)))
|
(or name (concat "Space: " (ement-room-display-name room)))
|
||||||
))
|
))
|
||||||
;; ID not specified.
|
;; ID not specified.
|
||||||
(pcase (length parents)
|
(pcase (length parents)
|
||||||
(0 nil)
|
(0 nil)
|
||||||
(1
|
(1
|
||||||
|
@ -538,7 +538,7 @@ left."
|
||||||
(ement-taxy-room-list :display-buffer-action '(display-buffer-no-window (allow-no-window . t))))
|
(ement-taxy-room-list :display-buffer-action '(display-buffer-no-window (allow-no-window . t))))
|
||||||
|
|
||||||
(defun ement-taxy-mouse-1 (event)
|
(defun ement-taxy-mouse-1 (event)
|
||||||
"Call `ement-taxy-RET' at point."
|
"Call `ement-taxy-RET' at EVENT."
|
||||||
(interactive "e")
|
(interactive "e")
|
||||||
(mouse-set-point event)
|
(mouse-set-point event)
|
||||||
(call-interactively #'ement-taxy-RET))
|
(call-interactively #'ement-taxy-RET))
|
||||||
|
|
Loading…
Add table
Reference in a new issue