ement.el/README.org

156 lines
6.4 KiB
Org Mode
Raw Normal View History

#+TITLE: ement.el
#+PROPERTY: LOGGING nil
# Note: This readme works with the org-make-toc <https://github.com/alphapapa/org-make-toc> package, which automatically updates the table of contents.
# [[https://melpa.org/#/package-name][file:https://melpa.org/packages/package-name-badge.svg]] [[https://stable.melpa.org/#/package-name][file:https://stable.melpa.org/packages/package-name-badge.svg]]
Ement.el is a new Matrix client for Emacs. It's basic at the moment, but it can be used to send and read messages.
* Screenshots
The message formatting is customizeable (e.g. the timestamp can be displayed in the left or right margin):
2020-12-03 22:07:13 -06:00
[[images/screenshot2.png]]
An IRC-like formatting style is easily selectable in the option ~ement-room-message-format-spec~, and timestamp headers are displayed where a certain amount of time passes between events:
2020-12-04 02:27:33 -06:00
[[images/screenshot4.png]]
2020-12-04 02:27:33 -06:00
* Contents :noexport:
:PROPERTIES:
:TOC: :include siblings
:END:
:CONTENTS:
2020-12-01 16:08:51 -06:00
- [[#rationale][Rationale]]
- [[#installation][Installation]]
- [[#usage][Usage]]
- [[#changelog][Changelog]]
- [[#development][Development]]
- [[#license][License]]
:END:
2020-12-01 16:08:51 -06:00
* Rationale
Why write a new Emacs Matrix client when there is already [[https://github.com/alphapapa/matrix-client.el][matrix-client.el]], by the same author, no less? A few reasons:
- ~matrix-client~ uses an older version of the Matrix spec, r0.3.0, with a few elements of r0.4.0 grafted in. Bringing it up to date with the current version of the spec, r0.6.1, would be more work than to begin with the current version. Ement.el targets r0.6.1 from the beginning.
- ~matrix-client~ was developed without the intention of publishing it to, e.g. MELPA or ELPA. It has several dependencies, and its code does not always install or compile cleanly due to macro-expansion issues (apparently depending on the user's Emacs config). Ement.el is designed to have minimal dependencies outside of Emacs (currently only one, ~plz~, which could be imported into the project), and every file is linted and compiles cleanly using [[https://github.com/alphapapa/makem.sh][makem.sh]].
- ~matrix-client~ uses EIEIO, probably unnecessarily, since few, if any, of the benefits of EIEIO are realized in it. Ement.el uses structs instead.
- ~matrix-client~ uses bespoke code for inserting messages into buffers, which works pretty well, but has a few minor bugs which are difficult to track down. Ement.el uses Emacs's built-in (and perhaps little-known) ~ewoc~ library, which makes it much simpler and more reliable to insert and update messages in buffers, and enables the development of advanced UI features more easily.
- ~matrix-client~ was, to a certain extent, designed to imitate other messaging apps. The result is, at least when used with the ~matrix-client-frame~ command, fairly pleasing to use, but isn't especially "Emacsy." Ement.el is intended to better fit into Emacs's paradigms.
- ~matrix-client~'s long name makes for long symbol names, which makes for tedious, verbose code. ~ement~ is easy to type and makes for concise, readable code.
- The author has learned much since writing ~matrix-client~ and hopes to write simpler, more readable, more maintainable code in Ement.el. It's hoped that this will enable others to contribute more easily.
However, note that ~matrix-client~ is a more mature client and is very reliable in the author's experience. While Ement.el is intended to reach feature parity with it and eventually surpass it, that will take some time, so ~matrix-client~ remains a good choice.
* Installation
:PROPERTIES:
:TOC: :depth 0
:END:
# ** MELPA
#
# If you installed from MELPA, you're done. Just run one of the commands below.
** Quelpa
The recommended way to install is with [[https://github.com/quelpa/quelpa-use-package][quelpa-use-package]], like this:
#+BEGIN_SRC elisp
;; Install and load `quelpa-use-package'.
(package-install 'quelpa-use-package)
(require 'quelpa-use-package)
;; Install `plz' HTTP library (not on MELPA yet).
(use-package plz
:quelpa (plz :fetcher github :repo "alphapapa/plz.el"))
;; Install Ement.
(use-package ement
:quelpa (ement :fetcher github :repo "alphapapa/ement.el"))
#+END_SRC
2021-07-21 15:10:48 -05:00
** Straight
Using [[https://github.com/raxod502/straight.el][Straight]], it's also very simple:
#+BEGIN_SRC elisp
;; Install `plz' HTTP library (not on MELPA yet).
(use-package plz
:straight (plz :fetcher github :repo "alphapapa/plz.el"))
;; Install Ement.
(use-package ement
:straight (ement :fetcher github :repo "alphapapa/ement.el"))
#+END_SRC
** Manual
If you want to install it manually, it's simple enough, but you should know what you're doing, and you're on your own.
* Usage
:PROPERTIES:
:TOC: :depth 0
:END:
1. Call command ~ement-connect~ to connect.
2. Wait for initial sync to complete (which can take a few moments--initial sync JSON requests can be large).
2020-12-03 22:08:48 -06:00
3. Use these commands:
- ~ement-view-room~ to select a room buffer to view, with completion.
- ~ement-list-rooms~ to view the list of joined rooms.
2020-12-03 22:08:48 -06:00
In a room buffer:
- ~RET~ sends a message.
2021-07-21 11:29:19 -05:00
- ~S-RET~ sends a reply to the message at point.
- ~TAB~ / ~<backtab>~ moves between messages.
- ~v~ views an event's source.
- ~g~ syncs new messages (not necessary if auto sync is enabled; see below).
- ~r~ selects another room.
- ~R~ shows the room list.
- ~M-v~ or using the scroll wheel at the top of the buffer loads older messages.
** Tips
+ You can customize settings in the ~ement~ group.
- Set ~ement-auto-sync~ to sync new messages automatically.
Merge: Add: Show reactions Squashed commit of the following: commit 1f393d7dde91acf315d5e218e9d52e69b1a5aa28 Author: Adam Porter <adam@alphapapa.net> Date: Thu Jul 22 10:48:19 2021 -0500 Comment: TODOs commit 7e039a7b4f2b8c05d1a3a8e5e763344f783dfdbe Author: Adam Porter <adam@alphapapa.net> Date: Thu Jul 22 10:48:08 2021 -0500 WIP: Docstring for handler lambdas commit 441c23113cf52b53773e6a9cb3cb66870da87c24 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 4fdf0ddf37399eb2b8c75639c7f8ff40897e45b6 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 5f700ccc16276b9ce8bb1682e2446e14b6c6873a Author: Adam Porter <adam@alphapapa.net> Date: Thu Jul 22 09:30:18 2021 -0500 WIP: Fix: Use pushnew to avoid duplicating reactions commit a40a6e6bc1f97d6ada7291d0b216cff0d9ab8074 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 dbfec18e45f1371cf1f45ae301445055ce670960 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 81757536f27d14c868cee42b70a6cd806020d148 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
*** Displaying symbols and emojis
Emacs may not display certain symbols and emojis well by default. Based on [[https://emacs.stackexchange.com/questions/62049/override-the-default-font-for-emoji-characters][this question and answer]], you may find that the simplest way to fix this is to install an appropriate font, like [[https://www.google.com/get/noto/#emoji-zsye][Noto Emoji]], and then use this Elisp code:
#+BEGIN_SRC elisp
(setf use-default-font-for-symbols nil)
(set-fontset-font t 'unicode "Noto Emoji" nil 'append)
#+END_SRC
* Changelog
:PROPERTIES:
:TOC: :depth 0
:END:
** 0.1-pre
Yet to be released.
* COMMENT Credits
* Development
Bug reports, feature requests, suggestions — /oh my/!
* License
GPLv3
# Local Variables:
# eval: (require 'org-make-toc)
# before-save-hook: org-make-toc
# org-export-with-properties: ()
# org-export-with-title: t
# End: