alphapapa / ement.el

A Matrix client for GNU Emacs
GNU General Public License v3.0
508 stars 45 forks source link

Errors running ement.el in no-window-system/no-images build of emacs #79

Closed tsdh closed 2 years ago

tsdh commented 2 years ago

I like to have my IRC and now Matrix sessions residing in a tmux/emacs session on a server. I'm running a self-compiled emacs master version there which has no window-system nor image support. I've just build a similar version locally for easier testing. It's configured with:

./configure --without-tiff --without-png --with-x-toolkit=no --without-png --without-rsvg --without-jpeg --without-native-compilation --without-toolkit-scroll-bars --without-x --without-pgtk
...
Configured for 'x86_64-pc-linux-gnu'.

  Where should the build process find the source code?    .
  What compiler should emacs be built with?               gcc -g3 -O2
  Should Emacs use the GNU version of malloc?             no
    (The GNU allocators don't work with this system configuration.)
  Should Emacs use a relocating allocator for buffers?    no
  Should Emacs use mmap(2) for buffer allocation?         no
  What window system should Emacs use?                    none
  What toolkit should Emacs use?                          none
  Where do we find X Windows header files?                NONE
  Where do we find X Windows libraries?                   NONE
  Does Emacs use -lXaw3d?                                 no
  Does Emacs use -lXpm?                                   no
  Does Emacs use -ljpeg?                                  no
  Does Emacs use -ltiff?                                  no
  Does Emacs use a gif library?                           no 
  Does Emacs use a png library?                           no 
  Does Emacs use -lrsvg-2?                                no
  Does Emacs use -lwebp?                                  no
  Does Emacs use -lsqlite3?                               yes
  Does Emacs use cairo?                                   no
  Does Emacs use -llcms2?                                 yes
  Does Emacs use imagemagick?                             no
  Does Emacs use native APIs for images?                  no
  Does Emacs support sound?                               yes
  Does Emacs use -lgpm?                                   yes
  Does Emacs use -ldbus?                                  yes
  Does Emacs use -lgconf?                                 no
  Does Emacs use GSettings?                               no
  Does Emacs use a file notification library?             yes -lglibc (inotify)
  Does Emacs use access control lists?                    yes -lacl
  Does Emacs use -lselinux?                               no
  Does Emacs use -lgnutls?                                yes
  Does Emacs use -lxml2?                                  yes
  Does Emacs use -lfreetype?                              no
  Does Emacs use HarfBuzz?                                no
  Does Emacs use -lm17n-flt?                              no
  Does Emacs use -lotf?                                   no
  Does Emacs use -lxft?                                   no
  Does Emacs use -lsystemd?                               yes
  Does Emacs use -ljansson?                               yes
  Does Emacs use the GMP library?                         yes
  Does Emacs directly use zlib?                           yes
  Does Emacs have dynamic modules support?                yes
  Does Emacs use toolkit scroll bars?                     no
  Does Emacs support Xwidgets?                            no
  Does Emacs have threading support in lisp?              yes
  Does Emacs support the portable dumper?                 yes
  Does Emacs support legacy unexec dumping?               no
  Which dumping strategy does Emacs use?                  pdumper
  Does Emacs have native lisp compiler?                   no
  Does Emacs use version 2 of the X Input Extension?      no
  Does Emacs generate a smaller-size Japanese dictionary? no

When I try to ement-connect I get this error:

Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil)
  color-gradient((0.8666666666666667 0.8666666666666667 0.8666666666666667) nil 104)
  ement-room-list--timestamp-colors()
  ement-room-list-mode()
  ement-list-rooms(#s(ement-session :user ... :server ... :token "syt_dHNkaA_trj..." :transaction-id 2917148943 :rooms ... :next-batch "s3089444058_75..." :device-id nil :ini$
  run-hook-with-args(ement-list-rooms #s(ement-session :user ... :server ... :token "syt_dHNkaA_trj..." :transaction-id 2917148943 :rooms ... :next-batch "s3089444058_75..." $
  ement--sync-callback(#s(ement-session :user ... :server ... :token "syt_dHNkaA_trj..." :transaction-id 2917148943 :rooms ... :next-batch "s3089444058_75..." :device-id nil $
  apply(ement--sync-callback (... ...))
  #f(compiled-function (&rest args2) #<bytecode -0xadae47184c239cd>)(((next_batch . "s3089444058_757284974_10137003_1456681471_14...") (account_data (events . [((type . "im.v$
  #f(compiled-function () #<bytecode 0x138544df14dddc78>)()
  plz--sentinel(#<process plz-request-curl> "finished\n")

This error repeats every few seconds it seems. The *Ement Rooms* buffer stays empty.

Also, in *Messages* there is

Ement: Read sessions.
Ement: Sync request sent, waiting for response...
Ement: Response arrived after 1.03 seconds.  Reading 677k JSON response...
Ement: Reading JSON took 0.25 seconds
Ement: Reading events...
Ement: Sync request sent, waiting for response...
Entering debugger...
image-type: Invalid image type ‘png’

For the image-type error I'm not put into the debugger so I guess it happens probably in a sentinel function or something alike.

EDIT: viz on the Ement.el Matrix room suggested the error was fixed by https://github.com/alphapapa/ement.el/commit/0541916b61824a07c1c8d8104bbba375a7b0af1a however my emacs build doesn't have an "unspecified-fg":

(face-foreground`` 'default nil 'default)
"#dddddd"
alphapapa commented 2 years ago

@tsdh Thanks for reporting. Please let me know if that fixes it for you.

For the image-type error I'm not put into the debugger so I guess it happens probably in a sentinel function or something alike.

If your Emacs doesn't support images, the image-related code should be automatically disabled, so that message shouldn't appear. I guess it won't cause any problems, but if you feel like it, please open another issue and maybe we can track that down. Also, check the value of ement-room-images.

tsdh commented 2 years ago

@alphapapa Hi Adam, the error persists because (face-background 'default nil 'default) => "unspecified-bg" and then color-name-to-rgb returns nil in the "One face per week" mapcar.

Wrt. images: ement-room-images is nil.

alphapapa commented 2 years ago

@tsdh Oops, thanks. https://github.com/alphapapa/ement.el/commit/0b587685fb7d722422e601d47883155e2c839a4c should fix it, then.

tsdh commented 2 years ago

Seems to work now, thanks!