meow-edit / meow

Yet another modal editing on Emacs / 猫态编辑
GNU General Public License v3.0
1.08k stars 128 forks source link

Intermittent issues with keypad-mode #117

Closed fedreg-bn closed 2 years ago

fedreg-bn commented 2 years ago

Just discovered keypad-mode and it's great!!!

Mine seems to not always work as expected though..

Sometimes it pops up for a split second, disappears right away, and has an error:

Failed Select: Invalid argument

This happens if I push SPC-c, SPC-x, or SPC-c and with various major modes.

But it is inconsistent and sometimes works fine..

video demo: https://user-images.githubusercontent.com/87655715/145484571-fd36efb6-cbfa-4451-ab8c-8582746e157f.mov

Most likely on my end but not sure where to look...

Keep a pretty minimal config with only these packages

(ag
cider
company
fzf
key-chord
magit
meow
rainbow-delimiters
smartparens
typit
xclip)

Emacs 28.0.50 Mac Big Sur Running in TTY mode in terminal

If anyone has experienced / resolved this issue please let me know. I'll try to dig around in meow's code this weekend and see if I can spot the conflict

Thanks!

DogLooksGood commented 2 years ago

Hi, Try M-x toggle-debug-on-error, then when something goes wrong, you'll get a stacktrace.

That information will be helpful.

fedreg-bn commented 2 years ago

Ah, good idea!

if you've never seen this before and no one else has mentioned it.. I'll check that trace and see if I spot the issue on my side

thx!!

Debugger entered--Lisp error: (file-error "Failed select" "Invalid argument")
  read-event(nil t 2305843009213693951)
  sit-for(2305843009213693951 t)
  meow-describe-keymap((keymap (120 . kmacro-to-register) (118 . kmacro-view-macro-repeat) (116 . kmacro-swap-ring) (115 . kmacro-start-macro) (114 . apply-macro-to-region-lines) (113 . kbd-macro-query) (112 . kmacro-cycle-ring-previous) (110 . kmacro-cycle-ring-next) (108 . kmacro-call-ring-2nd-repeat) (107 . kmacro-end-or-call-macro-repeat) (105 . kmacro-insert-counter) (102 . kmacro-set-format) (101 . kmacro-edit-macro-repeat) (100 . kmacro-delete-ring-head) (99 . kmacro-set-counter) (98 . kmacro-bind-to-key) (97 . kmacro-add-counter) (81 . kdb-macro-redisplay)))
  meow--keypad-display-message()
  meow--keypad-try-execute()
  meow-keypad-self-insert()
  funcall-interactively(meow-keypad-self-insert)
  call-interactively(meow-keypad-self-insert nil nil)
  command-execute(meow-keypad-self-insert)
DogLooksGood commented 2 years ago

This is where it happened: https://github.com/meow-edit/meow/blob/master/meow-keypad.el#L298

How about do (sit-for most-positive-fixnum t) on your side? Will it raise an error?

fedreg-bn commented 2 years ago

yes

Debugger entered--Lisp error: (file-error "Failed select" "Invalid argument")
  read-event(nil t 2305843009213693951)
  sit-for(2305843009213693951 t)
  eval((sit-for most-positive-fixnum t) nil)
  elisp--eval-last-sexp(nil)
  eval-last-sexp(nil)
  funcall-interactively(eval-last-sexp nil)
  call-interactively(eval-last-sexp nil nil)
  command-execute(eval-last-sexp)
DogLooksGood commented 2 years ago

yeah, so you have to figure this out, since it is bulit-in emacs function.

fedreg-bn commented 2 years ago

Sounds good! I'll dig into it. Thanks for the pointer!!!

fedreg-bn commented 2 years ago

I could not figure out why most-positive-fixnum is not working with sit-for. I didn't have much time to look into it so I just passed another variable to that sit-for and it's working fine.

Buys me a bit of time to figure out what the issue is

I'll go ahead and close this ticket for now and update it if I find the issue.

Thanks again!

DogLooksGood commented 2 years ago

Okay, we can change it to a large value, It does not have to be most-positive-fixnum.

Here it's how long popup will wait before it close. If you think it's necessary to avoid using most-positive-fixnum, you can change it to something like 1000000 then open a PR.