abo-abo / ace-window

Quickly switch windows in Emacs
965 stars 85 forks source link

vterm not showing selecting character unless in vterm-copy-mode #215

Closed rdiaz02 closed 2 years ago

rdiaz02 commented 2 years ago

Buffers with vterm (https://github.com/akermu/emacs-libvterm) will not show the selecting character unless they are in vterm-copy-mode. (An easy solution is to set the vterm-copy-mode minor mode to all vterm buffers right before invoking ace-window and change the vterm mode back right after it; see below).

This is not a major problem as it has a simple solution, so I am just reporting the issue, and closing it, in case someone else stumbles upon it. Note this does not happen if we use posframe (see https://github.com/abo-abo/ace-window/pull/204 or https://github.com/abo-abo/ace-window/pull/192).


Instead of calling ace-window I call ace-window-vt as shown below

(defun ace-window-vt (arg)
  "ace-window setting all vterm to vterm-copy-mode."
  (interactive "p")
  (all-vterm-copy-mode)
  (ace-window arg)
  (no-vterm-copy-mode)
  )

(defun all-vterm-copy-mode ()
  "Set minor mode of all vterm buffers to vterm-copy-mode."
  (interactive)
  (mapc (lambda (buffer)
          (condition-case nil
              (with-current-buffer buffer
        (if (equal major-mode 'vterm-mode)
                    (vterm-copy-mode 1)
          )
        )
            (buffer-read-only nil)))
        (buffer-list)))

(defun no-vterm-copy-mode ()
  "Disable copy mode from all vterm buffers."
  (interactive)
  (mapc (lambda (buffer)
          (condition-case nil
              (with-current-buffer buffer
        (if (equal major-mode 'vterm-mode)
                    (vterm-copy-mode -1)
          )
        )
            (buffer-read-only nil)))
        (buffer-list)))