Hi, I tested it, it works. I used a simple C program : #include #include #include int main(int argc, char **argv) { int fd = open(argv[1], O_RDWR); struct winsize sz; sz.ws_row = atoi(argv[2]); sz.ws_col = atoi(argv[3]); ioctl(fd, TIOCSWINSZ, &sz); return 0; } Then in lisp, I added a hook to window-configuration-change-hook to call this program with (process-tty-name), (window-width) and (window-height). Interestingly, it worked in bash without needing a SIGWINCH, even when deactivating the bash option in shopt that tells it to check for window size changes. I searched in the lisp manual, I didn't find any way to do what I did in C in lisp. Is it possible ? Else a wrapper either to ioctl or directly something like (change-size ttyname row col) (I don't know which one is better) would need to be implemented in the C source code. The resulting code in shell.el would like like : (add-hook 'window-configuration-change-hook (lambda () (if (eq major-mode 'shell-mode) (change-size)))) (defun change-size () (ioctl (process-tty-name) (window-height) (window-size)) (signal-process (get-buffer-process (current-buffer)) 'SIGWINCH)) There's many issues going on here I don't have any clue on how to solve, but should be easy for an emacs developper : namespace cluttering, error treatment (when a shell is stopped for example), performance, portability, addition of the C source code ... could anyone tackle these in order to solve the bug ? Antoine 2008/5/25 Jan Djärv : > > > Stefan Monnier skrev: > > Problem is: sending "export COLUMNS=%d" won't do the right thing if the >> process running currently isn't some bourne derivative. E.g. if it's >> `csh' or some completely different process. >> > > I think the right thing to do is to set the new size on the pty with ioctl > TIOCSWINSZ and then send SIGWINCH to the inferior process. AFAIK, shells > react on that to set COLUMNS and LINES. The signal is discarded by default > so it does no harm if not caught. > > Jan D. >