Setup: Xubuntu 16.04, GNU Emacs 25.1.50.2
I have the following function defined.
(defun sudo-edit (&optional arg)
"Edit currently visited file as root.
With a prefix ARG prompt for a file to visit.
Will also prompt for a file to visit if current
buffer is not visiting a file."
(interactive "P")
(if (or arg (not buffer-file-name))
(find-file (concat "/sudo:root@localhost:"
(ido-read-file-name "Find file(as root): ")))
(find-alternate-file (concat "/sudo:root@localhost:" buffer-file-name))))
When I want to edit /etc/default/grub
, and in the GUI Emacs frame I call sudo-edit
, after typing my password, it works fine. But when I do the same with the emacsclient in terminal, it exits directly to the terminal after calling the same sudo-edit
. And it's not responding anymore, and I cannot create another frame.
I fail to understand why Emacs is not handling this properly in terminal, and the GUI frame does it well. I couldn't find anything in the function which is related to the GUI.
Anybody that can find where this functions went wrong with the terminal Emacs?