Doom-emacs: workspace switch action works unreasonable when focus popup window

Created on 2 Mar 2018  路  7Comments  路  Source: hlissner/doom-emacs

Observed behavior

when focus in popup window , some action works unreasonable

  1. some keybinding not effect like switch-workspace
  2. switch-workspace in popup widow case other workspace layout crash

Expected behavior

works like common sense

Steps to reproduce

  1. create multiple workspace
  2. action for popup window like popup-scrach/magit/help
  3. then switch focuse in popup window
  4. press M-1..9 to switch workspace not work
  5. M-x +workspace:switch-next or others commands

System information


Click to expand

- OS: gnu/linux (x86_64-pc-linux-gnu)
- Emacs: 25.3.1 (Feb 23, 2018)
- Doom: 2.0.9 (develop https://github.com/hlissner/doom-emacs/commit/dfb6bc162d14f16b9031458f58f695fb33f81ff1)
- Graphic display: t (daemon: nil)
- System features: XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS NOTIFY GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11
- Details:
  ```elisp
  modules:   (:config :feature debugger eval evil file-templates (lookup (+devdocs +docsets)) services snippets spellcheck syntax-checker version-control workspaces :completion ivy :ui doom-dashboard doom-modeline doom-quit hl-todo nav-flash evil-goggles vi-tilde-fringe window-select :tools electric-indent eshell gist imenu impatient-mode macos make neotree pdf rotate-text term tmux upload :lang emacs-lisp go hy javascript latex ledger lua markdown (org (+attach +babel +capture +export +present +publish)) plantuml python rest rust sh web :app :config :private org chinese)
  packages:  (ace-link ace-window adaptive-wrap all-the-icons anaconda-mode async atomic-chrome auctex auto-compile auto-yasnippet avy (centered-window :recipe (centered-window :fetcher github :repo anler/centered-window-mode)) coffee-mode command-log-mode company company-anaconda company-auctex company-dict company-go company-lua company-quickhelp company-racer company-restclient company-shell company-statistics company-tern company-web counsel (counsel-css :recipe (counsel-css :fetcher github :repo hlissner/emacs-counsel-css)) counsel-dash counsel-projectile counsel-tramp devdocs dired-k docker-tramp dockerfile-mode doom-themes dumb-jump editorconfig (emacs-snippets :recipe (emacs-snippets :fetcher github :repo hlissner/emacs-snippets :files (*))) emmet-mode eslintd-fix evil evil-anzu evil-args evil-commentary evil-easymotion evil-embrace evil-escape evil-exchange evil-goggles evil-indent-plus evil-ledger evil-magit evil-matchit evil-mc evil-multiedit evil-numbers evil-org evil-snipe evil-surround evil-textobj-anyblock evil-vimish-fold evil-visualstar (exec-path-from-shell :ignore t) expand-region fcitx flycheck flycheck-cask flycheck-ledger flycheck-plantuml flycheck-popup-tip flycheck-pos-tip flycheck-rust flyspell flyspell-correct flyspell-correct-ivy fringe-helper gist git-gutter-fringe git-link git-timemachine gitconfig-mode gitignore-mode go-eldoc go-guru go-mode gorepl-mode graphviz-dot-mode haml-mode helpful highlight-indentation highlight-numbers highlight-quoted hl-todo htmlize hy-mode hydra imenu-anywhere imenu-list impatient-mode ivy ivy-bibtex ivy-hydra ivy-rich ivy-xref js2-mode js2-refactor json-mode keyfreq langtool ledger-mode less-css-mode lsp-python lua-mode macrostep magit magithub makefile-executor markdown-mode markdown-toc mixed-pitch moonscript multi-term nav-flash neotree nlinum nlinum-hl nlinum-relative nodejs-repl nose ob-go ob-mongo ob-rust ob-sql-mode ob-translate org-brain (org-bullets :recipe (org-bullets :fetcher github :repo Kaligule/org-bullets)) org-download org-plus-contrib org-tree-slide orgit (osx-clipboard :ignore t) overseer ox-pandoc ox-reveal pcre2el pdf-tools persistent-soft persp-mode pip-requirements pipenv plantuml-mode prodigy prog-fill projectile pug-mode py-isort quelpa quickrun racer rainbow-delimiters rainbow-mode realgud restclient rjsx-mode (rotate-text :recipe (rotate-text :fetcher github :repo debug-ito/rotate-text.el)) rust-mode sass-mode shackle shrink-path skewer-mode slime smart-forward smartparens smex solaire-mode ssh-deploy stylus-mode swiper synosaurus tern toc-org toml-mode undo-tree use-package vi-tilde-fringe vimrc-mode visual-fill-column web-beautify web-mode wgrep which-key whitespace-cleanup-mode wordnut xref-js2 yaml-mode (yapfify :recipe (yapfify :fetcher github :repo JorisE/yapfify)) yasnippet youdao-dictionary)
  elc dirs:  n/a
  exec-path: (/home/liubin/.cargo/bin /home/liubin/.pyenv/plugins/pyenv-virtualenv/shims /home/liubin/.pyenv/shims /home/liubin/.pyenv/bin /home/liubin/.local/bin /usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin /usr/games /usr/local/games /snap/bin /usr/local/libexec/emacs/25.3/x86_64-pc-linux-gnu)
  ```

:ui popup :ui workspaces bug interface resolved

All 7 comments

Just FYI, I use the following code as a partial workaround to this problem:

(defun +my-workspace/goto-main-window (pname frame)
  (let ((window (car (+my-doom-visible-windows))))
    (if (window-live-p window)
        (select-window window))))
(add-hook 'persp-before-switch-functions '+my-workspace/goto-main-window)


(defun +my-workspace/doom-visible-windows (&optional window-list)
  "Return a list of the visible, non-popup windows."
  (cl-loop for window in (or window-list (window-list))
           unless (window-dedicated-p window)
           collect window))

(defun +my-workspace/close-window-or-workspace ()
  "Close the selected window. If it's the last window in the workspace, close
the workspace and move to the next."
  (interactive)
  (let ((delete-window-fn (if (featurep 'evil) #'evil-window-delete #'delete-window)))
    (if (window-dedicated-p)
        (funcall delete-window-fn)
      (let ((current-persp-name (+workspace-current-name)))
        (cond ((or (+workspace--protected-p current-persp-name)
                   (cdr (+my-workspace/doom-visible-windows)))
               (funcall delete-window-fn))
              ((cdr (+workspace-list-names))
               (+workspace/delete current-persp-name)))))))

I've changed those bindings, which should make them available in popup windows. Give it a try and let me know if it doesn't fix your issue.

key binding available in popup window. but action still unnormal when press M+..
to switch workspace. @hlissner

@fuxialexander These works fine @hlissner , thanks for snippet, why don't you create PR?

@driftcrow I think it's a partial solution as I did not store the information of whether a point is in a pop up window before switch (and restore it after switch back). Although I do not need that, I'm not sure whether others will care about it.

@driftcrow I think it's a partial solution as I did not store the information of whether a point is in a pop up window before switch (and restore it after switch back). Although I do not need that, I'm not sure whether others will care about it.

yes, you are right, you consider the requirement thoughtful. but the
snippet is what I want, thank you .

Sorry for the late followup. A lot has changed in all this time. On the latest commit the switch-workspace keys appear to work from inside popups, so I'll consider this resolved. Let me know if that isn't the case and I will reopen the thread.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

shuxiao9058 picture shuxiao9058  路  25Comments

pmercatoris picture pmercatoris  路  30Comments

ghost picture ghost  路  31Comments

leojrfs picture leojrfs  路  29Comments

yglukhov picture yglukhov  路  30Comments