ement.el icon indicating copy to clipboard operation
ement.el copied to clipboard

Improve behavior of calling reply command when point is on username using "Elemental" message format

Open yliceee opened this issue 2 years ago • 5 comments

To reproduce:

  1. Open the room list
  2. Enter a room
  3. Attempt to use S-RET or M-x ement-room-write-reply to reply to a message point

This fails with the following trace:

Debugger entered--Lisp error: (cl-assertion-failed ((ement-event-p (ewoc-data (ewoc-locate ement-ewoc))) nil))
  cl--assertion-failed((ement-event-p (ewoc-data (ewoc-locate ement-ewoc))))
  ement-room-write-reply()
  #<subr funcall-interactively>(ement-room-write-reply)
  apply(#<subr funcall-interactively> ement-room-write-reply)
  funcall-interactively(ement-room-write-reply)
  #<subr call-interactively>(ement-room-write-reply nil nil)
  apply(#<subr call-interactively> (ement-room-write-reply nil nil))
  explain-pause--wrap-call-interactively(#<subr call-interactively> ement-room-write-reply nil nil)
  apply(explain-pause--wrap-call-interactively #<subr call-interactively> (ement-room-write-reply nil nil))
  call-interactively(ement-room-write-reply nil nil)
  command-execute(ement-room-write-reply)

Specifically, I am using Nix's emacs29-pgtk package.

yliceee avatar Aug 01 '23 02:08 yliceee

The backtrace would seem to indicate that you called the command to write a reply when point was not on a message event.

alphapapa avatar Aug 01 '23 15:08 alphapapa

Yes, I must have thought that the username associated with a message is included in the region defined as the message. I'll close this now.

Though is it perhaps worthwhile to add a catch for such an error? So far nothing else while using ement has spit such an ugly message at me.

yliceee avatar Aug 01 '23 16:08 yliceee

Yes, I must have thought that the username associated with a message is included in the region defined as the message. I'll close this now.

The default message display format puts the usernames and timestamps in the margins; the point can't move into the margins. Point can be in the message body, reactions, etc.

Though is it perhaps worthwhile to add a catch for such an error? So far nothing else while using ement has spit such an ugly message at me.

What you saw was the catch, the assertion. I don't understand how you could have tried to call that command thinking point was on a username shown in a margin, though.

Maybe it should be improved, but this is the first I've heard of this problem, and at least a few hundred people are using Ement now, so we'll see.

alphapapa avatar Aug 01 '23 20:08 alphapapa

I maybe should have clarified: the issue only appears while in the "Elemental" room format: with ement-room-message-format-spec set to "%B%r%R%t".

yliceee avatar Aug 01 '23 22:08 yliceee

Ok, that makes sense, yes. Probably point was on the username rather than the message below it. I'll repurpose this issue to improve that behavior. Thanks.

alphapapa avatar Aug 01 '23 23:08 alphapapa