0

Why does term-emulate-terminal get executed every time I execute counsel-switch-buffer if and only if the *terminal* buffer is open in a window. If the *terminal* buffer is not in a window term-emulate-terminal does not get called.

I can't seem to pinpoint why ivy/counsel is causing this behavior, as it is screwing up my buffer workflow. Is it because of ivy-read?


This is the update I get from debug-on-entry for term-emulate-terminal. And I'm not quite sure how to decipher all of this since I usually use edebug for my debugging:

Debugger entered--entering a function:
  (if (or inhibit-debug-on-entry debugger-jumping-flag) nil (let ((inhibit-debug-on-entry t)) (funcall debugger (quote debug))))
  debug--implement-debug-on-entry(#<process terminal> "\015\033[K\033[01;32mi@debord\033[00m:\033[01;34m~\033[00m$ ")
  apply(debug--implement-debug-on-entry (#<process terminal> "\015\033[K\033[01;32mi@debord\033[00m:\033[01;34m~\033[00m$ "))
  term-emulate-terminal(#<process terminal> "\015\033[K\033[01;32mi@debord\033[00m:\033[01;34m~\033[00m$ ")
  read-from-minibuffer("Switch to buffer: " nil (keymap (keymap (11 . ivy-switch-buffer-kill)) keymap (up . ivy-previous-line) (down . ivy-next-line) (jd:M-ret . jd:preview-function) (jd:M-bks . ivy-switch-buffer-kill) (jd:C-bks . jd:delete-word-backward) (jd:tab . ivy-partial) (jd:ret . ivy-alt-done) (C-M-k . ivy-next-history-element) (C-M-i . ivy-previous-history-element) (M-u . beginning-of-line) (M-o . end-of-line) (M-l . ivy-alt-done) (M-k . ivy-next-line) (M-j . counsel-up-directory) (M-i . ivy-previous-line) (M-\; . swiper-recenter-top-bottom) (C-u . ivy-beginning-of-buffer) (C-o . ivy-end-of-buffer) (C-k . jd:ivy-scroll-up-command) (C-i . jd:ivy-scroll-down-command) (C-g . minibuffer-keyboard-quit) (36 . ivy-magic-read-file-env) (3 keymap (19 . ivy-rotate-sort) (1 . ivy-toggle-ignore) (15 . ivy-occur)) (33554464 . ivy-restrict-to-matches) (15 . hydra-ivy/body) (22 . ivy-scroll-up-command) (prior . ivy-scroll-down-command) (next . ivy-scroll-up-command) (7 . minibuffer-keyboard-quit) (right . ivy-forward-char) (32 . self-insert-command) (18 . ivy-reverse-i-search) (remap keymap (describe-mode . ivy-help) (kill-ring-save . ivy-kill-ring-save) (kill-whole-line . ivy-kill-whole-line) (kill-line . ivy-kill-line) (scroll-down-command . ivy-scroll-down-command) (scroll-up-command . ivy-scroll-up-command) (end-of-buffer . ivy-end-of-buffer) (beginning-of-buffer . ivy-beginning-of-buffer) (kill-word . ivy-kill-word) (forward-char . ivy-forward-char) (delete-char . ivy-delete-char) (backward-kill-word . ivy-backward-kill-word) (backward-delete-char-untabify . ivy-backward-delete-char) (delete-backward-char . ivy-backward-delete-char) (previous-line . ivy-previous-line) (next-line . ivy-next-line)) (9 . ivy-partial-or-done) (10 . ivy-alt-done) (nil keymap (1 . ivy-read-action) (15 . ivy-dispatching-call) (111 . ivy-dispatching-done) (25 . ivy-insert-current-full) (105 . ivy-insert-current) (106 . ivy-yank-word) (114 . ivy-toggle-regexp-quote) (97 . ivy-toggle-marks) (16 . ivy-previous-line-and-call) (14 . ivy-next-line-and-call) (118 . ivy-scroll-down-command) (112 . ivy-previous-history-element) (110 . ivy-next-history-element) (10 . ivy-immediate-done) (13 . ivy-call)) (mouse-3 . ivy-mouse-dispatching-done) (mouse-1 . ivy-mouse-done) (down-mouse-1 . ignore) (13 . ivy-done)) nil ivy-history)
  (condition-case err (read-from-minibuffer prompt (progn (or (and (memq (type-of ivy-last) cl-struct-ivy-state-tags) t) (signal (quote wrong-type-argument) (list (quote ivy-state) ivy-last))) (aref ivy-last 5)) (make-composed-keymap keymap ivy-minibuffer-map) nil hist) (error (if (equal err (quote (error "Selecting deleted buffer"))) nil (signal (car err) (cdr err)))))
  (if (and ivy-auto-select-single-candidate ivy--all-candidates (null (cdr ivy--all-candidates))) (progn (progn (or (and (memq (type-of ivy-last) cl-struct-ivy-state-tags) t) (signal (quote wrong-type-argument) (list (quote ivy-state) ivy-last))) (let* ((v ivy-last)) (aset v 23 (car ivy--all-candidates)))) (setq ivy-exit (quote done))) (condition-case err (read-from-minibuffer prompt (progn (or (and (memq (type-of ivy-last) cl-struct-ivy-state-tags) t) (signal (quote wrong-type-argument) (list (quote ivy-state) ivy-last))) (aref ivy-last 5)) (make-composed-keymap keymap ivy-minibuffer-map) nil hist) (error (if (equal err (quote (error "Selecting deleted buffer"))) nil (signal (car err) (cdr err))))))
  (let* ((hist (or history (quote ivy-history))) (minibuffer-completion-table collection) (minibuffer-completion-predicate predicate) (ivy-height (ivy--height caller)) (resize-mini-windows (if (display-graphic-p) nil (quote grow-only)))) (if (and ivy-auto-select-single-candidate ivy--all-candidates (null (cdr ivy--all-candidates))) (progn (progn (or (and (memq (type-of ivy-last) cl-struct-ivy-state-tags) t) (signal (quote wrong-type-argument) (list (quote ivy-state) ivy-last))) (let* ((v ivy-last)) (aset v 23 (car ivy--all-candidates)))) (setq ivy-exit (quote done))) (condition-case err (read-from-minibuffer prompt (progn (or (and (memq ... cl-struct-ivy-state-tags) t) (signal (quote wrong-type-argument) (list ... ivy-last))) (aref ivy-last 5)) (make-composed-keymap keymap ivy-minibuffer-map) nil hist) (error (if (equal err (quote (error "Selecting deleted buffer"))) nil (signal (car err) (cdr err)))))) (if (eq ivy-exit (quote done)) (progn (ivy--update-history hist))))
  (progn (add-hook (quote minibuffer-setup-hook) setup-hook) (let* ((hist (or history (quote ivy-history))) (minibuffer-completion-table collection) (minibuffer-completion-predicate predicate) (ivy-height (ivy--height caller)) (resize-mini-windows (if (display-graphic-p) nil (quote grow-only)))) (if (and ivy-auto-select-single-candidate ivy--all-candidates (null (cdr ivy--all-candidates))) (progn (progn (or (and (memq ... cl-struct-ivy-state-tags) t) (signal (quote wrong-type-argument) (list ... ivy-last))) (let* ((v ivy-last)) (aset v 23 (car ivy--all-candidates)))) (setq ivy-exit (quote done))) (condition-case err (read-from-minibuffer prompt (progn (or (and ... t) (signal ... ...)) (aref ivy-last 5)) (make-composed-keymap keymap ivy-minibuffer-map) nil hist) (error (if (equal err (quote ...)) nil (signal (car err) (cdr err)))))) (if (eq ivy-exit (quote done)) (progn (ivy--update-history hist)))))
  (unwind-protect (progn (add-hook (quote minibuffer-setup-hook) setup-hook) (let* ((hist (or history (quote ivy-history))) (minibuffer-completion-table collection) (minibuffer-completion-predicate predicate) (ivy-height (ivy--height caller)) (resize-mini-windows (if (display-graphic-p) nil (quote grow-only)))) (if (and ivy-auto-select-single-candidate ivy--all-candidates (null (cdr ivy--all-candidates))) (progn (progn (or (and ... t) (signal ... ...)) (let* (...) (aset v 23 ...))) (setq ivy-exit (quote done))) (condition-case err (read-from-minibuffer prompt (progn (or ... ...) (aref ivy-last 5)) (make-composed-keymap keymap ivy-minibuffer-map) nil hist) (error (if (equal err ...) nil (signal ... ...))))) (if (eq ivy-exit (quote done)) (progn (ivy--update-history hist))))) (remove-hook (quote minibuffer-setup-hook) setup-hook))
  (let ((fun (function ivy--minibuffer-setup)) setup-hook) (setq setup-hook (function (lambda nil (remove-hook (quote minibuffer-setup-hook) setup-hook) (funcall fun)))) (unwind-protect (progn (add-hook (quote minibuffer-setup-hook) setup-hook) (let* ((hist (or history (quote ivy-history))) (minibuffer-completion-table collection) (minibuffer-completion-predicate predicate) (ivy-height (ivy--height caller)) (resize-mini-windows (if (display-graphic-p) nil (quote grow-only)))) (if (and ivy-auto-select-single-candidate ivy--all-candidates (null (cdr ivy--all-candidates))) (progn (progn (or ... ...) (let* ... ...)) (setq ivy-exit (quote done))) (condition-case err (read-from-minibuffer prompt (progn ... ...) (make-composed-keymap keymap ivy-minibuffer-map) nil hist) (error (if ... nil ...)))) (if (eq ivy-exit (quote done)) (progn (ivy--update-history hist))))) (remove-hook (quote minibuffer-setup-hook) setup-hook)))
  (unwind-protect (let ((fun (function ivy--minibuffer-setup)) setup-hook) (setq setup-hook (function (lambda nil (remove-hook (quote minibuffer-setup-hook) setup-hook) (funcall fun)))) (unwind-protect (progn (add-hook (quote minibuffer-setup-hook) setup-hook) (let* ((hist (or history ...)) (minibuffer-completion-table collection) (minibuffer-completion-predicate predicate) (ivy-height (ivy--height caller)) (resize-mini-windows (if ... nil ...))) (if (and ivy-auto-select-single-candidate ivy--all-candidates (null ...)) (progn (progn ... ...) (setq ivy-exit ...)) (condition-case err (read-from-minibuffer prompt ... ... nil hist) (error ...))) (if (eq ivy-exit (quote done)) (progn (ivy--update-history hist))))) (remove-hook (quote minibuffer-setup-hook) setup-hook))) (let ((session (or (plist-get extra-props :session) (if (or (minibufferp) (null ...) (eq ... ...)) nil caller)))) (if session (progn (progn (or (and (memq ... cl-struct-ivy-state-tags) t) (signal (quote wrong-type-argument) (list ... ivy-last))) (let* ((v ivy-last)) (aset v 27 (plist-put extra-props :ivy-data ...)))) (ivy--alist-set (quote ivy--sessions) session ivy-last)))) (ivy--cleanup))
  (let* ((ivy-recursive-last (and (active-minibuffer-window) ivy-last)) (ivy--display-function (if (or ivy-recursive-last (not (window-minibuffer-p))) (progn (ivy-alist-setting ivy-display-functions-alist caller))))) (setq update-fn (or update-fn (ivy-alist-setting ivy-update-fns-alist caller))) (setq unwind (or unwind (ivy-alist-setting ivy-unwind-fns-alist caller))) (setq ivy-last (make-ivy-state :prompt (ivy--update-prompt prompt) :collection collection :predicate predicate :require-match require-match :initial-input initial-input :history history :preselect preselect :keymap keymap :update-fn (if (eq update-fn (quote auto)) (function (lambda nil (let (...) (save-current-buffer ...)))) update-fn) :sort sort :action (ivy--compute-extra-actions action caller) :multi-action multi-action :frame (selected-frame) :window (selected-window) :buffer (current-buffer) :unwind unwind :re-builder re-builder :matcher matcher :dynamic-collection dynamic-collection :display-transformer-fn (ivy-alist-setting ivy--display-transformers-alist caller) :directory default-directory :extra-props extra-props :caller caller :def def)) (ivy--reset-state ivy-last) (unwind-protect (let ((fun (function ivy--minibuffer-setup)) setup-hook) (setq setup-hook (function (lambda nil (remove-hook (quote minibuffer-setup-hook) setup-hook) (funcall fun)))) (unwind-protect (progn (add-hook (quote minibuffer-setup-hook) setup-hook) (let* ((hist ...) (minibuffer-completion-table collection) (minibuffer-completion-predicate predicate) (ivy-height ...) (resize-mini-windows ...)) (if (and ivy-auto-select-single-candidate ivy--all-candidates ...) (progn ... ...) (condition-case err ... ...)) (if (eq ivy-exit ...) (progn ...)))) (remove-hook (quote minibuffer-setup-hook) setup-hook))) (let ((session (or (plist-get extra-props :session) (if (or ... ... ...) nil caller)))) (if session (progn (progn (or (and ... t) (signal ... ...)) (let* (...) (aset v 27 ...))) (ivy--alist-set (quote ivy--sessions) session ivy-last)))) (ivy--cleanup)) (ivy-call))
  (progn (let ((init-fn (ivy-alist-setting ivy-init-fns-alist caller))) (if init-fn (progn (funcall init-fn)))) (if (equal overriding-local-map (quote (keymap))) (progn (keyboard-quit))) (setq caller (or caller this-command)) (let* ((ivy-recursive-last (and (active-minibuffer-window) ivy-last)) (ivy--display-function (if (or ivy-recursive-last (not (window-minibuffer-p))) (progn (ivy-alist-setting ivy-display-functions-alist caller))))) (setq update-fn (or update-fn (ivy-alist-setting ivy-update-fns-alist caller))) (setq unwind (or unwind (ivy-alist-setting ivy-unwind-fns-alist caller))) (setq ivy-last (make-ivy-state :prompt (ivy--update-prompt prompt) :collection collection :predicate predicate :require-match require-match :initial-input initial-input :history history :preselect preselect :keymap keymap :update-fn (if (eq update-fn (quote auto)) (function (lambda nil (let ... ...))) update-fn) :sort sort :action (ivy--compute-extra-actions action caller) :multi-action multi-action :frame (selected-frame) :window (selected-window) :buffer (current-buffer) :unwind unwind :re-builder re-builder :matcher matcher :dynamic-collection dynamic-collection :display-transformer-fn (ivy-alist-setting ivy--display-transformers-alist caller) :directory default-directory :extra-props extra-props :caller caller :def def)) (ivy--reset-state ivy-last) (unwind-protect (let ((fun (function ivy--minibuffer-setup)) setup-hook) (setq setup-hook (function (lambda nil (remove-hook ... setup-hook) (funcall fun)))) (unwind-protect (progn (add-hook (quote minibuffer-setup-hook) setup-hook) (let* (... ... ... ... ...) (if ... ... ...) (if ... ...))) (remove-hook (quote minibuffer-setup-hook) setup-hook))) (let ((session (or (plist-get extra-props :session) (if ... nil caller)))) (if session (progn (progn (or ... ...) (let* ... ...)) (ivy--alist-set (quote ivy--sessions) session ivy-last)))) (ivy--cleanup)) (ivy-call)))
  (progn (let ((--cl-keys-- --cl-rest--)) (while --cl-keys-- (cond ((memq (car --cl-keys--) (quote (:predicate :require-match :initial-input :history :preselect :def :keymap :update-fn :sort :action :multi-action :unwind :re-builder :matcher :dynamic-collection :extra-props :caller :allow-other-keys))) (setq --cl-keys-- (cdr (cdr --cl-keys--)))) ((car (cdr (memq ... --cl-rest--))) (setq --cl-keys-- nil)) (t (error "Keyword argument %s not one of (:predicate :require-match :initial-input :history :preselect :def :keymap :update-fn :sort :action :multi-action :unwind :re-builder :matcher :dynamic-collection :extra-props :caller)" (car --cl-keys--)))))) (progn (let ((init-fn (ivy-alist-setting ivy-init-fns-alist caller))) (if init-fn (progn (funcall init-fn)))) (if (equal overriding-local-map (quote (keymap))) (progn (keyboard-quit))) (setq caller (or caller this-command)) (let* ((ivy-recursive-last (and (active-minibuffer-window) ivy-last)) (ivy--display-function (if (or ivy-recursive-last (not ...)) (progn (ivy-alist-setting ivy-display-functions-alist caller))))) (setq update-fn (or update-fn (ivy-alist-setting ivy-update-fns-alist caller))) (setq unwind (or unwind (ivy-alist-setting ivy-unwind-fns-alist caller))) (setq ivy-last (make-ivy-state :prompt (ivy--update-prompt prompt) :collection collection :predicate predicate :require-match require-match :initial-input initial-input :history history :preselect preselect :keymap keymap :update-fn (if (eq update-fn (quote auto)) (function (lambda nil ...)) update-fn) :sort sort :action (ivy--compute-extra-actions action caller) :multi-action multi-action :frame (selected-frame) :window (selected-window) :buffer (current-buffer) :unwind unwind :re-builder re-builder :matcher matcher :dynamic-collection dynamic-collection :display-transformer-fn (ivy-alist-setting ivy--display-transformers-alist caller) :directory default-directory :extra-props extra-props :caller caller :def def)) (ivy--reset-state ivy-last) (unwind-protect (let ((fun (function ivy--minibuffer-setup)) setup-hook) (setq setup-hook (function (lambda nil ... ...))) (unwind-protect (progn (add-hook ... setup-hook) (let* ... ... ...)) (remove-hook (quote minibuffer-setup-hook) setup-hook))) (let ((session (or ... ...))) (if session (progn (progn ... ...) (ivy--alist-set ... session ivy-last)))) (ivy--cleanup)) (ivy-call))))
  (let* ((predicate (car (cdr (plist-member --cl-rest-- (quote :predicate))))) (require-match (car (cdr (plist-member --cl-rest-- (quote :require-match))))) (initial-input (car (cdr (plist-member --cl-rest-- (quote :initial-input))))) (history (car (cdr (plist-member --cl-rest-- (quote :history))))) (preselect (car (cdr (plist-member --cl-rest-- (quote :preselect))))) (def (car (cdr (plist-member --cl-rest-- (quote :def))))) (keymap (car (cdr (plist-member --cl-rest-- (quote :keymap))))) (update-fn (car (cdr (plist-member --cl-rest-- (quote :update-fn))))) (sort (car (cdr (plist-member --cl-rest-- (quote :sort))))) (action (car (cdr (plist-member --cl-rest-- (quote :action))))) (multi-action (car (cdr (plist-member --cl-rest-- (quote :multi-action))))) (unwind (car (cdr (plist-member --cl-rest-- (quote :unwind))))) (re-builder (car (cdr (plist-member --cl-rest-- (quote :re-builder))))) (matcher (car (cdr (plist-member --cl-rest-- (quote :matcher))))) (dynamic-collection (car (cdr (plist-member --cl-rest-- (quote :dynamic-collection))))) (extra-props (car (cdr (plist-member --cl-rest-- (quote :extra-props))))) (caller (car (cdr (plist-member --cl-rest-- (quote :caller)))))) (progn (let ((--cl-keys-- --cl-rest--)) (while --cl-keys-- (cond ((memq (car --cl-keys--) (quote ...)) (setq --cl-keys-- (cdr ...))) ((car (cdr ...)) (setq --cl-keys-- nil)) (t (error "Keyword argument %s not one of (:predicate :require-match :initial-input :history :preselect :def :keymap :update-fn :sort :action :multi-action :unwind :re-builder :matcher :dynamic-collection :extra-props :caller)" (car --cl-keys--)))))) (progn (let ((init-fn (ivy-alist-setting ivy-init-fns-alist caller))) (if init-fn (progn (funcall init-fn)))) (if (equal overriding-local-map (quote (keymap))) (progn (keyboard-quit))) (setq caller (or caller this-command)) (let* ((ivy-recursive-last (and (active-minibuffer-window) ivy-last)) (ivy--display-function (if (or ivy-recursive-last ...) (progn ...)))) (setq update-fn (or update-fn (ivy-alist-setting ivy-update-fns-alist caller))) (setq unwind (or unwind (ivy-alist-setting ivy-unwind-fns-alist caller))) (setq ivy-last (make-ivy-state :prompt (ivy--update-prompt prompt) :collection collection :predicate predicate :require-match require-match :initial-input initial-input :history history :preselect preselect :keymap keymap :update-fn (if (eq update-fn ...) (function ...) update-fn) :sort sort :action (ivy--compute-extra-actions action caller) :multi-action multi-action :frame (selected-frame) :window (selected-window) :buffer (current-buffer) :unwind unwind :re-builder re-builder :matcher matcher :dynamic-collection dynamic-collection :display-transformer-fn (ivy-alist-setting ivy--display-transformers-alist caller) :directory default-directory :extra-props extra-props :caller caller :def def)) (ivy--reset-state ivy-last) (unwind-protect (let ((fun ...) setup-hook) (setq setup-hook (function ...)) (unwind-protect (progn ... ...) (remove-hook ... setup-hook))) (let ((session ...)) (if session (progn ... ...))) (ivy--cleanup)) (ivy-call)))))
  ivy-read("Switch to buffer: " internal-complete-buffer :keymap (keymap (11 . ivy-switch-buffer-kill)) :preselect "ivy.el" :action ivy--switch-buffer-action :matcher ivy--switch-buffer-matcher :caller ivy-switch-buffer)
  ivy-switch-buffer()
  (let ((ivy-update-fns-alist (quote ((ivy-switch-buffer . counsel--switch-buffer-update-fn)))) (ivy-unwind-fns-alist (quote ((ivy-switch-buffer . counsel--switch-buffer-unwind))))) (ivy-switch-buffer))
  counsel-switch-buffer()
  funcall-interactively(counsel-switch-buffer)
  call-interactively(counsel-switch-buffer nil nil)
  (prog1 (call-interactively cmd record-flag keys) (if (and (symbolp cmd) (get cmd (quote byte-obsolete-info)) (not (get cmd (quote command-execute-obsolete-warned)))) (progn (put cmd (quote command-execute-obsolete-warned) t) (message "%s" (macroexp--obsolete-warning cmd (get cmd (quote byte-obsolete-info)) "command")))))
  (cond ((arrayp final) (if record-flag (progn (setq command-history (cons (list (quote execute-kbd-macro) final prefixarg) command-history)) (if (and (numberp history-length) (> history-length 0)) (progn (let (...) (if ... ...)))))) (execute-kbd-macro final prefixarg)) (t (prog1 (call-interactively cmd record-flag keys) (if (and (symbolp cmd) (get cmd (quote byte-obsolete-info)) (not (get cmd (quote command-execute-obsolete-warned)))) (progn (put cmd (quote command-execute-obsolete-warned) t) (message "%s" (macroexp--obsolete-warning cmd (get cmd ...) "command")))))))
  (let ((final cmd)) (while (progn (setq final (indirect-function final)) (if (autoloadp final) (setq final (autoload-do-load final cmd))))) (cond ((arrayp final) (if record-flag (progn (setq command-history (cons (list ... final prefixarg) command-history)) (if (and (numberp history-length) (> history-length 0)) (progn (let ... ...))))) (execute-kbd-macro final prefixarg)) (t (prog1 (call-interactively cmd record-flag keys) (if (and (symbolp cmd) (get cmd (quote byte-obsolete-info)) (not (get cmd ...))) (progn (put cmd (quote command-execute-obsolete-warned) t) (message "%s" (macroexp--obsolete-warning cmd ... "command"))))))))
  (if (and (symbolp cmd) (get cmd (quote disabled)) disabled-command-function) (run-hooks (quote disabled-command-function)) (let ((final cmd)) (while (progn (setq final (indirect-function final)) (if (autoloadp final) (setq final (autoload-do-load final cmd))))) (cond ((arrayp final) (if record-flag (progn (setq command-history (cons ... command-history)) (if (and ... ...) (progn ...)))) (execute-kbd-macro final prefixarg)) (t (prog1 (call-interactively cmd record-flag keys) (if (and (symbolp cmd) (get cmd ...) (not ...)) (progn (put cmd ... t) (message "%s" ...))))))))
  (let ((prefixarg (if special nil (prog1 prefix-arg (setq current-prefix-arg prefix-arg) (setq prefix-arg nil) (if current-prefix-arg (progn (prefix-command-update))))))) (if (and (symbolp cmd) (get cmd (quote disabled)) disabled-command-function) (run-hooks (quote disabled-command-function)) (let ((final cmd)) (while (progn (setq final (indirect-function final)) (if (autoloadp final) (setq final (autoload-do-load final cmd))))) (cond ((arrayp final) (if record-flag (progn (setq command-history ...) (if ... ...))) (execute-kbd-macro final prefixarg)) (t (prog1 (call-interactively cmd record-flag keys) (if (and ... ... ...) (progn ... ...))))))))
  command-execute(counsel-switch-buffer)


Even eliminating the extra arguments passed to read-from-minibuffer doesn't prevent read-from-minibuffer to somehow trigger term-emulate-terminal.

...
term-emulate-terminal(#<process terminal> "\015\033[K\033[01;32mi@debord\033[00m:\033[01;34m~\033[00m$ ")
read-from-minibuffer("Switch to buffer: ")
...
  • M-x debug-on-entry RET term-emulate-terminal RET – phils Aug 11 at 0:04
  • Updated my question with what I get returned to me by using M-x debug-on-entry RET term-emulate-terminal RET . – John DeBord Aug 11 at 2:12
  • If I'm reading this correctly, I'm seeing that read-from-minibuffer may be responsible for the undesired behavior I'm experiencing. But I don't know how in the world why. – John DeBord Aug 11 at 2:14
  • Updated my question once again, eliminating the extraneous arguments passed to read-from-minibuffer; still exhibits the same behavior. – John DeBord Aug 11 at 2:22
  • But if I manually invoke read-from-minibuffer via eval-expression, term-emulate-terminal doesn't get called. – John DeBord Aug 11 at 2:31
1

I suspect the reason for this is:

  • Calling counsel-switch-buffer is triggering a window configuration change.
  • window-configuration-change-hook contains window--adjust-process-windows to "Update process window sizes to match the current window configuration", which calls set-process-window-size for each process in each affected window, which talks to the process in question.
  • If the process talks back, that's going to invoke the process filter (which is what term-emulate-terminal is, for term buffers).
  • Per (elisp)Accepting Output, output from processes is normally handled "only while Emacs is waiting for some sort of external event, such as elapsed time or terminal input". In the scenario in question, the first such opportunity is when read-from-minibuffer is called and awaiting user input.
| improve this answer | |

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.