3

I've been using emacs for a while, but am being quite dismayed by some quite hectic pinky-pain, so have just started using Chris Done's god-mode, which is great, I like it so far.

The problem is that with a few buffers open it's hard to easy know if I'm in god-mode in the given buffer.

I'm not accustomed to this "vim" way of doing things and am being confused by which buffer is currently in "god-mode".

So the question is generally:

How do I make a buffer (either in the mode-line or in some other place) more distinctive in some way when I'm in a particular minor-mode, in my case in god-mode, so I don't have to move my eyes to the mode-line or test by pressing something.

  • 1
    How about changing the mode-line :lighter from _God to _GOD!? github.com/chrisdone/god-mode/blob/master/god-mode.el#L98 Do you want this to be a different color? What do you want the entire mode-line background to change colors? Do you want ...? Here is an example for Magnar's mutliple-cursor library for a :lighter that changes depending upon the number of cursors: github.com/magnars/multiple-cursors.el/blob/master/… – lawlist Jun 20 '17 at 21:55
  • 2
    Here is a link to another idea to change the buffer default face (e.g., foreground and/or background) using the face-remapping-alist with the function face-remap-add-relative: stackoverflow.com/a/28008006/2112489 Create a simple function to turn it on and attach that function to the god-mode-enabled-hook and turn it off with a similar function attached to the god-mode-disabled-hook. It could be a subtle color change, or an eye-popping change, whatever suits your personal taste. – lawlist Jun 20 '17 at 23:56
  • 1
    When I used to use evil I had the same problem (a problem I believe UI/UX people call "modal confusion"). After trying a few options I settled on changing the color of the mode-line's background. – Omar Jun 21 '17 at 2:23
1

What I did is to add a function that changes the cursor's color if god-mode is enabled in the current buffer. I hook this function so that it is run whenever the buffer list is updated. However, you can hook it to more functions as you wish.

  (defun hook-update-cursor ()
    (cond ((or (bound-and-true-p god-mode)
               (bound-and-true-p god-global-mode))
           (set-cursor-color "lime green"))
          (t (set-cursor-color "dark orange"))))

  (add-hook 'buffer-list-update-hook 'hook-update-cursor)
  • 1
    Cursor color affects the whole frame, not just the buffer that has god-mode enabled. This is a built-in limitation with Emacs components written in C. The cursor color could be different for each buffer (or even each window) if someone cared enough to implement that in C, but it doesn't yet exist. – lawlist Jul 14 '17 at 14:24
1

I change the mode line color to red when in god mode.

(defun me//god-mode-indicator ()
  (cond (god-local-mode
         (progn
           (set-face-background 'mode-line "red4")
           (set-face-foreground 'mode-line "gray")
           (set-face-background 'mode-line-inactive "gray30")
           (set-face-foreground 'mode-line-inactive "red")))
        (t
         (progn
           (set-face-background 'mode-line-inactive "gray30")
           (set-face-foreground 'mode-line-inactive "gray80")
           (set-face-background 'mode-line "gray75")
           (set-face-foreground 'mode-line "black")))))

(add-hook 'god-mode-enabled-hook #'me//god-mode-indicator)
(add-hook 'god-mode-disabled-hook #'me//god-mode-indicator))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.