mohkale / projection

Projectile like project management library built on Emacs project.el
GNU General Public License v3.0
53 stars 2 forks source link

problems getting started... #7

Closed MarcRohrer closed 8 months ago

MarcRohrer commented 8 months ago

Hi,

I just wanted to try out your package, I just copied your suggested init and get:

 Error (use-package): projection/:init: Key sequence C - x SPC P starts with non-prefix key C
Error (use-package): projection-multi/:init: Key sequence R E T starts with non-prefix key R

I then changed the key bindings to:

:bind
  (("C-x p" . projection-map))

and

:bind
  (("C-x P" . projection-multi-compile))

which works, but calling the projection-map function results in:

Autoloading file h:/src/emacs/.emacs.d/elpa/projection-20230927.2019/projection.elc failed to define function projection-mapError during redisplay: (eval (lsp-modeline--diagnostics-update-modeline)) signaled (wrong-type-argument char-or-string-p nil)

Marc

mohkale commented 8 months ago

Hmmm... I'm not quite sure why the error makes it seem like your binding to the C key instead of C-x (looking at the docs use-package seems to recommend single parens instead of nested parens so perhaps that's why). Regardless this isn't correct usage for binding keymaps. Use-package has a specific section suggesting how to do this. Perhaps I should update the docs to recommend that, in the meantime could you try bind-keymap instead of bind and see if it fixes your issue?

MarcRohrer commented 8 months ago

as I said, I changed it to:

(use-package projection
  ;; Enable the `projection-hook' feature.
  :hook (after-init . global-projection-hook-mode)

  ;; Require projections immediately after project.el.
  :config
  (with-eval-after-load 'project
    (require 'projection))

  ;; Access pre-configured projection commands from a keybinding of your choice.
  ;; Run `M-x describe-keymap projection-map` for a list of available commands.
  :bind
  (("C-x p" . projection-map)))

(use-package projection-multi
  ;; Allow interactively selecting available compilation targets from the current
  ;; project type.
  :bind
  (("C-x P" . projection-multi-compile)))

(use-package projection-multi-embark
  :after embark
  :after projection-multi
  :demand t
  ;; Add the projection set-command bindings to `compile-multi-embark-command-map'.
  :config (projection-multi-embark-setup-command-map))

which works fine. At least for the key-bindings.

The error with projection-map ist something else of course.

mohkale commented 8 months ago

Yes, @MarcRohrer you're still using :bind instead of :bind-keymap as use-package recommends. Please see the docs I've linked and confirm if you're seeing a different problem.

MarcRohrer commented 8 months ago

:bind sets global keys, that is what I wand and is needed here as of my understanding. projection-map does not work even if I run it with M-x.

mohkale commented 8 months ago

Because it's a map. Please properly read the documentation your directed to. :bind-keymap also binds in the global map, but it works around the fact you can't autoload keymaps.

MarcRohrer commented 8 months ago

Not better after :bind-keymap. I have no time to investigate into this any further. Sorry