Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[layouts] Emacs 27 over-rides workspace keybindings gt and gT #13677

Closed
practicalli-johnny opened this issue Jun 15, 2020 · 9 comments
Closed

Comments

@practicalli-johnny
Copy link
Contributor

Description :octocat:

From Emacs 27.1 onward tab bar functionality is built in and it seems that Evil normal key bindings are over-riding the existing keybindings for eyebrowse-next-window-config and eyebrowse-previous-window-config

Reproduction guide 🪲

  • Install Emacs 27.1 or greater
  • Start Emacs
  • SPC l w 2 to create a second workspace
  • SPC f f to open a new file in this workspace (so you can tell easily see workspaces switching)
  • g t in Evil normal state should cycle between the layouts

Observed behaviour: 👀 💔
g t in Evil normal state does not do anything (unless Emacs tabs were enabled)

Expected behaviour: ❤️ 😄
g t in Evil normal state cycles forward through the workspaces, g T cycles in reverse through the workspaces.

System Info 💻

  • OS: gnu/linux
  • Emacs: 28.0.50
  • Spacemacs: 0.300.0
  • Spacemacs branch: develop (rev. 1660527)
  • Graphic display: t
  • Distribution: spacemacs
  • Editing style: vim
  • Completion: helm
  • Layers:
(asciidoc
 (auto-completion :variables auto-completion-enable-help-tooltip t auto-completion-enable-snippets-in-popup t auto-completion-enable-sort-by-usage t)
 (clojure :variables clojure-toplevel-inside-comment-form t cider-overlays-use-font-lock t clojure-enable-linters 'clj-kondo)
 command-log colors csv emacs-lisp emoji
 (git :variables git-magit-status-fullscreen t magit-diff-refine-hunk 'all)
 github graphviz
 (helm :variables helm-follow-mode-persistent t)
 html json markdown multiple-cursors theming
 (org :variables org-enable-github-support t org-enable-bootstrap-support t org-enable-reveal-js-support t org-want-todo-bindings t org-enable-org-journal-support t org-journal-dir "~/projects/journal/" org-journal-file-format "%Y-%m-%d" org-journal-date-prefix "#+TITLE: " org-journal-date-format "%A, %B %d %Y" org-journal-time-prefix "* " org-journal-time-format "" org-journal-carryover-items "TODO=\"TODO\"|TODO=\"DOING\"|TODO=\"BLOCKED\"|TODO=\"REVIEW\"")
 (ranger :variables ranger-show-preview t ranger-show-hidden t ranger-cleanup-eagerly t ranger-cleanup-on-disable t ranger-ignored-extensions
         '("mkv" "flv" "iso" "mp4"))
 (shell :variables shell-default-shell 'eshell shell-default-height 30 shell-default-position 'bottom)
 (spacemacs-layouts :variables spacemacs-layouts-restrict-spc-tab t persp-autokill-buffer-on-remove 'kill-weak)
 spell-checking
 (syntax-checking :variables syntax-checking-use-original-bitmaps t)
 (treemacs :variables treemacs-indentation 1 treemacs-use-filewatch-mode t treemacs-use-follow-mode t)
 (version-control :variables version-control-diff-tool 'diff-hl version-control-global-margin t))
  • System configuration features: XPM JPEG TIFF GIF PNG RSVG CAIRO SOUND GPM DBUS GSETTINGS GLIB NOTIFY INOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE HARFBUZZ M17N_FLT LIBOTF ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS XWIDGETS LIBSYSTEMD JSON PDUMPER LCMS2 GMP

Backtrace 🐾

<<BACKTRACE IF RELEVANT>>
@emacs18
Copy link
Contributor

emacs18 commented Jun 15, 2020

Following is found in evil-maps.el which is part of evil package:

(when (featurep 'tab-bar)
  (define-key evil-normal-state-map "gt" 'tab-bar-switch-to-next-tab)
  (define-key evil-normal-state-map "gT" 'tab-bar-switch-to-prev-tab))

Since only emacs 27 has the tab-bar feature, above code is relevant only on emacs 27.
Above seems to shadow the following key bindings found in spacemacs-layouts layer:

      (define-key evil-motion-state-map "gt" 'eyebrowse-next-window-config)
      (define-key evil-motion-state-map "gT" 'eyebrowse-prev-window-config)

@emacs18
Copy link
Contributor

emacs18 commented Jun 15, 2020

Oops. I did not see the fix until now. The fix mentioned above changed spacemacs key bindings to avoid the clash. Sorry.

@duianto
Copy link
Contributor

duianto commented Jun 24, 2020

There's also an issue with the gt key binding in a magit buffer, where it's bound to:
magit-jump-to-tracked

It means that, switching between workspaces stops when one of them shows a magit buffer.

@practicalli-johnny
Copy link
Contributor Author

practicalli-johnny commented Jun 24, 2020

@emacs18 I closed the PR to change the keys to g> and g> as I wanted to see if there were any other options before changing keybindings that have been around for a long time.

My current workaround is to define user keybindings for workspaces in the dotspacemacs/user-config section of .spacemacs

  ;; Toggle workspaces forward/backwards
  (spacemacs/set-leader-keys "ow" 'eyebrowse-next-window-config)
  (spacemacs/set-leader-keys "oW" 'eyebrowse-last-window-config)

What are the options for resolving the workspace keybinding conflicts?

On a side note: I also noticed that gk in a magit commit buffer (COMMIT_EDITMSG) is over-ridden by evil-previous-visual-line at first, however, by switching to Evil insert state and back to Evil normal state gkbecomes git-commit-prev-message. I don't really understand that behavior.

@practicalli-johnny
Copy link
Contributor Author

There is no fix for this issue as the initial proposal for alternate keybindings was correctly rejected (my suggestion wasnt that good).

Ideally I would like to disable the tab-bar feature in Emacs then the workspace keybindings will not be over-ridden by a feature I find far less useful.

@travisbhartwell
Copy link
Contributor

I was able to work around this for myself by putting the following in dotspacemacs/user-config:

  (with-eval-after-load 'evil-maps
    (when (featurep 'tab-bar)
      (define-key evil-normal-state-map "gt" nil)
      (define-key evil-normal-state-map "gT" nil)))

This removed the binding that shadowed the Spacemacs binding.

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid!

@github-actions github-actions bot added the stale marked as a stale issue/pr (usually by a bot) label Aug 13, 2021
@practicalli-johnny
Copy link
Contributor Author

I still consider this an issue as it impacts my daily workflow

@github-actions github-actions bot removed the stale marked as a stale issue/pr (usually by a bot) label Aug 13, 2021
@mixmixmix
Copy link

Being able quickly switch workspaces is essential to use layouts-workspaces workflow correctly. Without @travisbhartwell hack I quickly kept regressing to using layouts only.

Is there any obstacle in implementing that user config as a layout initialisation option? Alternatively, @practicalli-john why did you say that your suggestion "wasn't that good"?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants