all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [Patch] Resizing shells in shell-mode
@ 2008-05-24 18:38 Antoine Levitt
  2008-05-24 19:04 ` Stefan Monnier
  0 siblings, 1 reply; 10+ messages in thread
From: Antoine Levitt @ 2008-05-24 18:38 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 985 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 1243 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2008-06-05  6:24 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-24 18:38 [Patch] Resizing shells in shell-mode Antoine Levitt
2008-05-24 19:04 ` Stefan Monnier
2008-05-24 20:23   ` Antoine Levitt
2008-05-24 20:47     ` Stefan Monnier
2008-05-24 20:56     ` Miles Bader
2008-05-24 21:58       ` Antoine Levitt
2008-05-25  8:20   ` Jan Djärv
2008-05-25 12:26     ` Antoine Levitt
2008-05-25 14:43       ` Miles Bader
2008-06-05  6:24       ` Stefan Monnier

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.