Giter Site home page Giter Site logo

Comments (17)

dadinn avatar dadinn commented on July 21, 2024 1

Uh, oh... just noticed somehow I've been using the wrong name for the function-key option!
It is named god-mode-enable-function-key-translation, not -interaction.

It seems I didn't notice the issue, because I usually press F11 as the first thing on my Emacs startup, and since I used the wrong hook, god-mode didn't get enabled on initialization... so F11 was working fine. But when I manually started god-mode afterwards, it turned out that function key translation wasn't disabled (because I was setting the wrong variable).

Sorry, my bad!

from god-mode.

dadinn avatar dadinn commented on July 21, 2024 1

Yes, indeed. The issue with initializing projectile key-binding still exists.

from god-mode.

dadinn avatar dadinn commented on July 21, 2024 1

Still, it might worth looking into why god-mode does not work well with use-package's :bind-keymap option.

from god-mode.

dadinn avatar dadinn commented on July 21, 2024

This supersedes issue #155 I've opened/closed before.

from god-mode.

darth10 avatar darth10 commented on July 21, 2024

It depends on how you initialise God mode.
As mentioned in the README, calling the god-mode function only affects future buffers.
To change both active and future buffers, you should call god-mode-all instead on loading your emacs configuration.

from god-mode.

dadinn avatar dadinn commented on July 21, 2024

I do use god-mode-all, with the binding set.

The issue happens once Emacs is initialised, then I turn god-mode on using the binding.
After this the indicators show that god-mode is turned on, yet c SPC p p does not do anything.

Interestingly, if I add god-mode-all to the emacs-init-hook, god-mode does not get turned on after initialised.

from god-mode.

darth10 avatar darth10 commented on July 21, 2024

Sorry, I can't seem to recreate this, although I'm using after-init-hook.

Calling god-mode-all through after-init-hook, or through doom-after-modules-config-hook if you're using Doom Emacs, works fine.
I can use the c SPC p prefix to call any projectile functions as soon as my Emacs starts up.

Would it be possible to share your Emacs config?
I can't find anything related to God mode in your .emacs.d repository.

from god-mode.

dadinn avatar dadinn commented on July 21, 2024

Apologies, realised my github didn't contain the config I was working with.

Here is the version which reproduces the problem for me. The god-mode version in my config uses the latest commit 607aff1.

Also, I've disabled doom-modeline, but the problem still remains.

Since I am not using Doom Emacs, only the individual doom-modeline package, I don't have a doom-after-modules-config-hook.

Regarding the after-init-hook problem: I've accidentally added the -hook suffix in my use-package declaration. After fixing it, god-mode is indeed enabled on startup. Yet, this doesn't resolve the problem with the projectile key-map binding.

from god-mode.

dadinn avatar dadinn commented on July 21, 2024

Actually, I've encountered another issue.

For some reason enabling god-mode on startup using the after-init-hook, causes the god-mode-enable-function-key-interaction to be ignored. Even though I've set it to be nil, when I try to press F11 after startup, I get the message: God: Unknown key binding for ‘C-<f11>‘.

The behaviour is present in my earlier config.
If I remove god-mode from the after-init-hook, then F11 works fine.

from god-mode.

darth10 avatar darth10 commented on July 21, 2024

or some reason enabling god-mode on startup using the after-init-hook, causes the god-mode-enable-function-key-interaction to be ignored. Even though I've set it to be nil, when I try to press F11 after startup, I get the message: God: Unknown key binding for ‘C-<f11>‘.

Just had a quick look, and it looks like you're setting god-mode-enable-function-key-interaction too late.
Try setting it in the :init part of use-package, instead of in :custom.

I've not yet investigated the issue with projectile and God mode.
I'll get to that soon, but if you find anything, please post on this issue.

from god-mode.

dadinn avatar dadinn commented on July 21, 2024

I've also tried using emacs-startup-hook instead of after-init-hook, which claims to be run later, and starts god-mode correctly, yet still captures the F11 key.

When I don't automatically start god-mode with either of the hooks, then setting god-mode-enable-function-key-interaction using :custom works fine, and F11 key registers correctly.

from god-mode.

darth10 avatar darth10 commented on July 21, 2024

Not a problem.
So the F11 issue is not a bug, but you're still having a problem calling projectile functions on start-up from what I understand?

from god-mode.

darth10 avatar darth10 commented on July 21, 2024

Okay, looking at your config, it's because projectile key bindings aren't exposed through your package configuration that uses :bind-keymap.
Can you try this config for projectile and let me know if you're still having the issue?

(use-package projectile
  :hook
  (projectile-grep-finished . (lambda () (pop-to-buffer next-error-last-buffer)))
  :bind-keymap
  ("C-c p" . projectile-command-map)
  :init 
  (require 'projectile)
  :config
  (dolist (dir (list "node_modules" "target"))
    (add-to-list 'projectile-globally-ignored-directories dir))
  (projectile-mode))

This is sort of what Doom Emacs does too.

from god-mode.

dadinn avatar dadinn commented on July 21, 2024

I don't understand. My config is exactly the same as what you wrote.

from god-mode.

darth10 avatar darth10 commented on July 21, 2024

Haha not exactly.
There's a call to (require 'projectile) you're missing.
I copied your config and added these lines:

(use-package projectile
  :hook
  (projectile-grep-finished . (lambda () (pop-to-buffer next-error-last-buffer)))
  :bind-keymap
  ("C-c p" . projectile-command-map)
+  :init 
+  (require 'projectile)
  :config
  (dolist (dir (list "node_modules" "target"))
    (add-to-list 'projectile-globally-ignored-directories dir))
  (projectile-mode))

from god-mode.

dadinn avatar dadinn commented on July 21, 2024

Adding the :init (require 'projectile) doesn't seem to solve the issue for me.

from god-mode.

dadinn avatar dadinn commented on July 21, 2024

This seems to have solved it though:

(use-package projectile
  :demand t
  :hook
  (projectile-grep-finished . (lambda () (pop-to-buffer next-error-last-buffer)))
  :bind
  ("C-c p" . projectile-command-map)
  :config
  (dolist (dir (list "node_modules" "target"))
    (add-to-list 'projectile-globally-ignored-directories dir))
  (projectile-mode))

The difference is that I've used :bind instead of :bind-keymap, and added the :demand t.
Not sure I understand what benefit :bind-keymap gives over plain :blind, but it seems the fact that it tries to do funny things, with loading the keymap and then using the binding again as prefix argument, could interfere with god-mode? At any rate, with :bind the behaviour is more straightforward, such that the :demand flag can circumvent the delayed loading.

...not sure how you've added those nice highlights on your code examples though! ;)

from god-mode.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.