[Top][All Lists]

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

[Patch] Resizing shells in shell-mode

From: Antoine Levitt
Subject: [Patch] Resizing shells in shell-mode
Date: Sat, 24 May 2008 20:38:45 +0200

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)))

reply via email to

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