Hacker News new | ask | show | jobs
by chaorace 991 days ago
Have you considered overriding the Emacs process EDITOR variable via setenv? i.e.:

    (setenv "EDITOR" "/usr/bin/emacsclient -c")
If you do that, it should cause any child processes (e.g.: vterm) to inherit the replaced EDITOR variable and properly open new editor frames instead of trying to do a terminal takeover.
1 comments

Well,this is extremely clever and simple. I tried that out from vterm in 29.1 and it crashed emacs...
Personally, I got tired of weird quirks like this with vterm and now bind this command to the key I used to have vterm on to spawn my actual terminal (st) in my current directory. It's probably not what most people want from vterm, but I prefer it.

  (defun open-term-here ()
    "open st in `default-directory`"
    (interactive)
    (call-process-shell-command
     (concat "st bash -c \"cd "
      default-directory
      " && exec zsh\"")
     nil 0))
I also do this, C-x t to open a tmux tab to whatever directory the current buffer is:

  (defun tmux-here ()
    (interactive)
    (if (not (eq (getenv "TMUX") ""))
        (shell-command (format "tmux new-window -c %s" default-directory))
      (error "Not inside a tmux session.")))
I know, I know, tmux is slow and should never be used. I like it, OK.