emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Patch] Resizing shells in shell-mode


From: Stefan Monnier
Subject: Re: [Patch] Resizing shells in shell-mode
Date: Sat, 24 May 2008 15:04:42 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

> Shell-mode doesn't update the COLUMNS env var, which prevents from having
> pretty ls for example when resizing the window. I made a patch for this, but
> I'm not sure how it should be inserted into main code, so I'm submitting it
> in the hope someone will do that. It should be straightforward though.
> Here's the code, to be included in shell.el

> ;;listen for window configuration changes to modify COLUMNS
> (add-hook 'window-configuration-change-hook
>       (lambda ()
>         (if (eq major-mode 'shell-mode) (change-columns))))

> ;;filters one and exactly one input
> (defun filter-all (string)
>   (remove-hook 'comint-preoutput-filter-functions 'filter-all)
>   "")

> ;;tells the shell to change column, and discard reply (which should
> ;;be a prompt)
> (defun change-columns ()
>   (add-hook 'comint-preoutput-filter-functions 'filter-all)
>   (funcall comint-input-sender
>        (get-buffer-process (current-buffer))
>        (format "export COLUMNS=%d" (window-width)))
>   (accept-process-output))

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.


        Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]