> From: Riza Dindir <riza.din...@gmail.com>
> Date: Sat, 7 Sep 2024 15:37:17 +0300
> 
> I am running Linux with kernel 6.6.47 and am running emacs in xterm, using 
> the -nw command line argument.
> 
> I am new to emacs and was experimenting with the suspend-emacs command. 
> Following the example on
> https://www.gnu.org/software/emacs/manual/html_node/elisp/Suspending-Emacs.html.
> 
> When following the example, I added the suspend-resume-hook to my 
> .emacs.d/init.el file. When I run M-:
> (suspend-emacs "pwd") it does not show the current working directory. But 
> when I do fg from the terminal that I
> got into, I see the "Resumed!" message.
> 
> I asked in the libera chat about that, and also in the gnu-help-emacs list. I 
> have been talking to wasamasa on
> libera chat (#emacs-beginners) and we pinpointed the problem to the 
> stuff_char function (in
> https://git.savannah.gnu.org/cgit/emacs.git/tree/src/sysdep.c#n403). We came 
> to this point from
> stuff_buffered_input 
> (https://git.savannah.gnu.org/cgit/emacs.git/tree/src/keyboard.c#n11963), and 
> from 
> suspend-emacs function definition (in 
> https://git.savannah.gnu.org/cgit/emacs.git/tree/src/keyboard.c#n11908).
> 
> The stuff_char function is using ioctl with TIOCSTI. TIOCSTI requires 
> CAP_SYS_ADMIN capability. You can set
> this capability using sysctl setting dev.tty.legacy_tiocsti to 1.
> 
> Unless I had set "dev.tty.legacy_tiocsti" to 1 I could not run the 
> suspend-emacs command with an argument
> string.
> 
> Either emacs can check the return value of ioctl in stuff_char and if there 
> return value is EPERM, then handle
> this accordingly, with a message regarding the problem.

You mean, you want suspend-emacs signal an error if it is called with
STUFFSTRING argument, but fails to stuff the string into the
terminal's input buffer?



Reply via email to