hrs / engine-mode

Minor mode for defining and querying search engines through Emacs.
GNU General Public License v3.0
272 stars 23 forks source link

not a valid key definition; see ‘key-valid-p’ #59

Closed morgandavidson closed 1 year ago

morgandavidson commented 1 year ago

Hello, thank you for this great mode!

My config is:

(use-package engine-mode
  :config 
  (engine-mode t)
  :bind
  (:map org-mode-map ("C-k" . nil))
  :bind-keymap
  ("C-k" . engine-mode-prefixed-map)
  )

I have to define many engines, so I use 3 letters to bind them, e.g.:

  (defengine IMDB
    "http://www.imdb.com/find?s=all&q=%s"
    :keybinding "imd")

Since engine-mode latest update, when the engine binding is >1 letter, I have the following error message: keymap--check: "imd" is not a valid key definition; see ‘key-valid-p’

hrs commented 1 year ago

Interesting! I'm using Emacs 30, and "imd" seems to be a valid keybinding there. Before I figure out how to simultaneously install 29, too :sweat_smile:, could you let me know if putting spaces in the binding (like "i m d" instead of "imd") works?

morgandavidson commented 1 year ago

My bad, it is not related to Emacs 29 but to engine-mode latest update (1 month ago, or so), I just tested with Emacs 28.2 and had the same issue. Spacing the letters seems to work (I just tested with IMDB, I'll update all my bindings), thank you!

hrs commented 1 year ago

Oh, cool, good to hear! I'll close this issue.

morgandavidson commented 1 year ago

I updated my 50+ defengine, and everything works fine.

#+name: search-engines
|---------------------+-----------------------------------------------------------------------------+-----+-----|
| Name                | URL                                                                         | key | Cat |
|---------------------+-----------------------------------------------------------------------------+-----+-----|
| IMDB                | http://www.imdb.com/find?s=all&q=%s                                         | imd | db  |
...
#+begin_src python :var tbl=search-engines :results output drawer
  for row in tbl[1:]:
    print(f'(defengine {row[0]}\n  "{row[1]}"\n  :keybinding "{" ".join(row[2])}")')
#+end_src
#+RESULTS:
:results:
(defengine IMDB
  "http://www.imdb.com/find?s=all&q=%s"
  :keybinding "i m d")
...