Commit graph

92 commits

Author SHA1 Message Date
Adam Porter
deeb8a6654 Add: Mentions
The ement-user struct gains a new slot, which invalidates structs in
saved sessions, so users will need to log in again.
2021-07-26 18:20:18 -05:00
Adam Porter
cc0e6a4914 Fix: (ement-room--insert-events) Select window before inserting
This seems to actually fix the bug now, hopefully for good...although
I've said that, before...but I think I finally found the root
cause (at least, without digging into EWOC internals).
2021-07-26 13:38:08 -05:00
Adam Porter
8427919dbd Debug: (ement-room--insert-event) Add more debug code 2021-07-26 13:38:08 -05:00
Adam Porter
b44e7b18b6 Fix: Display-name help-echo 2021-07-25 23:21:54 -05:00
Adam Porter
2ce26f405a Fix/Tidy: (defevent "m.typing") Show ID if no displayname
Maybe someday we'll use /members to get the displayname.
2021-07-25 23:21:54 -05:00
Adam Porter
d1764ccf7a Add: (defface ement-room-message) 2021-07-25 23:21:54 -05:00
Adam Porter
8035326a29 Change: (ement-room-message-format-spec) Use "IRCy" by default
I think this may be a better default, because it allows more of
Emacs's power to be used, e.g. Occur buffers to show all messages from
a user (which needs the username displayed with each message rather
than as a header above a group of messages).
2021-07-25 23:21:54 -05:00
Adam Porter
c5e83b76d7 Add: Emacs bookmark support
Room buffers and the room list buffer can be bookmarked.

Especially useful with Burly: <https://github.com/alphapapa/burly.el>.
2021-07-25 23:21:54 -05:00
Adam Porter
7c589b7b72 Fix: (ement-room--insert-events) Work around weird reply-to-reply bug 2021-07-25 20:42:30 -05:00
Adam Porter
8591a77b31 Fix: (ement-room-message-format-spec) Require file in setter
Thanks to Bowuigi for reporting.
2021-07-25 17:17:38 -05:00
Adam Porter
d94fc4e039 Tidy: (ement-room-retro-callback) Use buffer slot 2021-07-25 16:08:12 -05:00
Adam Porter
9266157e89 Fix: (ement-room) Define faces before options
Since ement-room-user is used in an option's setter.
2021-07-25 16:01:24 -05:00
Adam Porter
5029d0af3e Add: Header line 2021-07-25 15:58:57 -05:00
Adam Porter
da363bc8d4 Tidy: (ement-room-replying-to-event) Use event rather than ID 2021-07-25 15:14:21 -05:00
Adam Porter
9a733480f2 Fix: (define-widget ement-room-membership) Show displayname
Needed for headerless, IRC-style formatting.
2021-07-25 15:14:21 -05:00
Adam Porter
85f42c45aa Fix: (ement-room--format-message) Prism face for %B 2021-07-25 15:14:21 -05:00
Adam Porter
e98fb62ae0 Change/Fix: Displaynames when calling /messages
The ultimate fix for this was to send /messages the proper kind of
filter, a RoomEventFilter, rather than sending it the kind of filter
that /sync expects.  This is legitimately confusing, and there's even
an issue about it:
<https://github.com/matrix-org/matrix-doc/issues/706>.

This commit fixes the problem by using the right kind of filter for
/messages.

Thanks to Michael (@t3chguy) in #matrix-dev:matrix.org, who helped me
identify the problem.

Also thanks to him for clarifying that membership events may be in
both state and timeline events in a room, so calculating a displayname
requires searching both.  This commit tries to be more...comprehensive
in doing this (perhaps more than necessary, but tidying that up can be
done later if optimization is needed).
2021-07-25 14:27:20 -05:00
Adam Porter
9c707a367b Comment: Add NOTE 2021-07-25 14:18:56 -05:00
Adam Porter
5d32a31851 Comment: Add FIXME 2021-07-25 14:18:18 -05:00
Adam Porter
0e89d54275 Add/Change: More flexible sender display, IRC-style options 2021-07-25 14:18:18 -05:00
Adam Porter
3099061f17 Change/Fix: (ement-room--buffer) Set buffer slot sooner 2021-07-25 11:11:00 -05:00
Adam Porter
9234dfe9be Merge: Add: Show reactions
Squashed commit of the following:

commit 1f393d7dde
Author: Adam Porter <adam@alphapapa.net>
Date:   Thu Jul 22 10:48:19 2021 -0500

    Comment: TODOs

commit 7e039a7b4f
Author: Adam Porter <adam@alphapapa.net>
Date:   Thu Jul 22 10:48:08 2021 -0500

    WIP: Docstring for handler lambdas

commit 441c23113c
Author: Adam Porter <adam@alphapapa.net>
Date:   Thu Jul 22 10:40:58 2021 -0500

    WIP: Don't insert reaction events as nodes

    This seems to work well.  However, the event-processing needs some
    refactoring, because the logic is now spread across a few places.

commit 4fdf0ddf37
Author: Adam Porter <adam@alphapapa.net>
Date:   Thu Jul 22 10:30:28 2021 -0500

    WIP: Key face, and fix help-echo

    Remaining issue is that reactions still insert empty events in the
    buffer.

commit 5f700ccc16
Author: Adam Porter <adam@alphapapa.net>
Date:   Thu Jul 22 09:30:18 2021 -0500

    WIP: Fix: Use pushnew to avoid duplicating reactions

commit a40a6e6bc1
Author: Adam Porter <adam@alphapapa.net>
Date:   Wed Jul 21 20:17:32 2021 -0500

    WIP: And in -retro-callback

    A bug now is that, every time a room's buffer is created anew, the
    reactions are duplicated.

commit dbfec18e45
Author: Adam Porter <adam@alphapapa.net>
Date:   Wed Jul 21 19:49:47 2021 -0500

    WIP: Call -room---process-events in -room--buffer

    This almost seems to work, in that reactions from old timeline
    events are displayed when the buffer is made...or not?  It seems to
    work in some cases, but not in others, like when retro-loading...

    The big issue now is that the reaction events cause blank events to be
    inserted into the buffer.  Fixing that will require conditionally
    inserting events, which probably means moving message event handling
    into the defevent macro, which will require some more refactoring...

commit 81757536f2
Author: Adam Porter <adam@alphapapa.net>
Date:   Wed Jul 21 17:02:29 2021 -0500

    WIP: Add: Reactions

    It works for newly received reactions, but after initial sync,
    reactions that happened in the past are not displayed.  I think it's
    because the related events aren't found in the room's timeline, but I
    tried to fix that, and it still doesn't work.

    I'm guessing there are some assumptions that I'm making wrongly, or
    something that I don't understand about how the server sends events.
    We may have to save a list of certain types of events and process them
    after all other events have been processed.  Ugh.

    The good news is that EWOC makes it pretty easy and reliable to update
    messages in the buffer.
2021-07-22 10:48:41 -05:00
Adam Porter
91e560371f Fix: (ement-room-defevent m.typing) Handle missing users
I don't know why this can happen, but apparently it does.
2021-07-21 17:00:47 -05:00
Adam Porter
7595be2cd0 Tidy: (ement-room--buffer) 2021-07-21 15:31:22 -05:00
Adam Porter
2c57001118 Tidy: Docstrings 2021-07-21 14:27:04 -05:00
Adam Porter
dc2afc253d Add/Change: ement-room-defevent, and handle typing ephemeral events 2021-07-21 14:23:45 -05:00
Adam Porter
c9cd43c877 Change/Fix: (ement-room--user-display-name) Cache name 2021-07-21 14:23:01 -05:00
Adam Porter
97f75535fd Change: Track room buffers in local slot 2021-07-21 14:11:52 -05:00
Adam Porter
10b4716cd4 Fix: (ement-room--render-html) Blockquotes
shr-tag-blockquote doesn't render quite properly by default.  I'm not
sure why, but somehow, this seems to work better.
2021-07-21 12:33:59 -05:00
Adam Porter
8b49054656 Fix: (ement-room--buffer) Handle rooms with same name 2021-07-21 11:39:07 -05:00
Adam Porter
893f7173cd Add: Replies 2021-07-21 11:35:16 -05:00
Adam Porter
784d8c30d8 Add/Fix: (ement-room--insert-events) Insert ts headers for new events 2021-07-21 09:20:55 -05:00
Adam Porter
aae99327e3 Fix: (ement-room--insert-ts-headers) Compare header properly 2021-07-21 09:16:26 -05:00
Adam Porter
d8a48fe71d Change: (ement-room--insert-events) Use eq to compare room struct
This seems to make sense, because it should be the same object.
2021-07-21 09:13:14 -05:00
Adam Porter
258b3539ab Change: (defface ement-room-user) Remove :extend
Only supported in Emacs 27+, so maybe this should only be added when
explicitly requiring Emacs 27.
2021-07-04 16:52:56 -05:00
Adam Porter
587802bae3 Change: Spacing around timestamp headers 2021-07-04 16:38:02 -05:00
Adam Porter
9ce62087ac Add: Separator between events 2021-07-04 16:35:33 -05:00
Adam Porter
64a5e5d6aa Comment: Add FIXME 2021-07-04 16:34:58 -05:00
Adam Porter
baabfeb61b Change: (defface ement-room-timestamp-header) :height 1.1 2021-07-04 16:34:17 -05:00
Adam Porter
41d45b93b5 Change: (defface ement-room-self) Inherit ement-room-user 2021-07-04 16:24:26 -05:00
Adam Porter
f1a35869ff Add/Change: (define-widget ement-room-membership) Event as value
The Widget library is still mysterious to me, but some trial-and-error
helps.  This makes the ement-room-membership widget's value the Matrix
event struct, and it uses a :value-create function to insert the
string.

This pattern can probably be used for other widgets in the future,
e.g. for event type-specific widgets.
2021-07-04 14:57:10 -05:00
Adam Porter
3dd0c7c7af Add: (ement-room--format-event) Tooltip for unhandled event types 2021-07-04 14:56:34 -05:00
Adam Porter
50b9492715 Change: (ement-room--format-message) Handle empty specs better
Rather than erroring, insert a message into the buffer, with a tooltip
showing the raw event.
2021-07-04 14:56:10 -05:00
Adam Porter
2e14c1c9f2 Add: Show date in timestamp header where it changes between messages 2021-07-04 14:56:10 -05:00
Adam Porter
86221bda9d Fix: (ement-room--insert-ts-headers) Don't skip events
It was only comparing pairs of events, stepping by two instead of one.
2021-07-04 14:56:10 -05:00
Adam Porter
3c52ee0412 Debug: (ement-room--insert-ts-headers) Add debug function 2021-07-04 14:56:10 -05:00
Adam Porter
e862ea3dca Tidy: (ement-room--insert-ts-headers) 2021-07-04 13:47:35 -05:00
Adam Porter
3ec21db7b6 Tidy: (ement-room--format-user) 2021-07-04 12:38:28 -05:00
Adam Porter
d0fd9c2bda Change: (defface ement-room-user) Add overline and extend
Helps to distinguish where senders change, especially when not using
prism mode.
2021-07-04 12:37:29 -05:00
Adam Porter
96a6fd4415 Fix: (ement-room--user-color) 2020-12-19 11:41:23 -06:00