all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: "Antoine Levitt" <smeuuh@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: [Patch] Resizing shells in shell-mode
Date: Sat, 24 May 2008 15:04:42 -0400	[thread overview]
Message-ID: <jwv7idjsewz.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <6fa54e4e0805241138s7ca3428ay976f4331b86b89e6@mail.gmail.com> (Antoine Levitt's message of "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)))
>   (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	other threads:[~2008-05-24 19:04 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-24 18:38 [Patch] Resizing shells in shell-mode Antoine Levitt
2008-05-24 19:04 ` Stefan Monnier [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwv7idjsewz.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    --cc=smeuuh@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.