[Emacs] Add fix for TRAMP bug
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Lucien Cartier-Tilet 2023-09-18 09:57:59 +02:00
parent bff574afd2
commit 566861ee28
Signed by: phundrak
GPG Key ID: BD7789E705CB8DCA

View File

@ -2872,6 +2872,25 @@ doing and what Git is doing! In short, I absolutely love it!
"fF" #'magit-find-file))
#+end_src
There is currently a bug in Emacs TRAMP as described in issue [[https://github.com/magit/magit/issues/4720][#4720]] of
Magit and bug [[https://debbugs.gnu.org/cgi/bugreport.cgi?bug=62093][62093]] of Emacs. A workaround is to redefine the old
=tramp-send-command= function through an advice.
#+begin_src emacs-lisp
(defun my--tramp-send-command--workaround-stty-icanon-bug (conn-vec orig-command &rest args)
"See: https://github.com/magit/magit/issues/4720"
(let ((command
(if (string= "stty -icrnl -icanon min 1 time 0" orig-command)
"stty -icrnl"
orig-command)))
(append (list conn-vec command) args)))
(defun my--tramp-send-command--workaround-stty-icanon-bug--filter-args (args)
(apply #'my--tramp-send-command--workaround-stty-icanon-bug args))
(advice-add 'tramp-send-command :filter-args
#'my--tramp-send-command--workaround-stty-icanon-bug--filter-args)
#+end_src
[[https://github.com/alphapapa][Alphapapa]] also created an awesome package for Magit: magit-todos which
display in the Magit buffer a list of TODOs found in the current
project to remind you of what to do next.