You are not logged in.

#1 2011-06-23 02:24:28

marko-v
Member
Registered: 2011-06-23
Posts: 6

Emacs shell mode - problem with pacman output

Hello everyone. Since about 15 days ago, probably after some update, I noticed small change in Emacs shell mode behavior (M-x shell). When I am downloading some packages with pacman I don't have progress bars and download percentages anymore. It happens only in Emacs shell. Xterm and other non Emacs shells are fine. Do anyone have the slightest clue about what's wrong? Thank you for help in advance. Cheers!

Some pics to clarify my problem:

http://img52.imageshack.us/img52/5224/2 … 0x1024.png

vs.

http://img861.imageshack.us/img861/414/ … 0x1024.png

p.s. I have only output problems with pacman. Yaourt, for example, is doing fine.

--mod edit: use thumbnails, see https://wiki.archlinux.org/index.php/Fo … s_and_Code

Last edited by litemotiv (2011-08-09 09:12:59)

Offline

#2 2011-06-23 02:51:08

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: Emacs shell mode - problem with pacman output

Going to guess that this happened with the 3.5.3 upgrade, perhaps due to this commit. If that's the case, I'd be curious to know if backporting this commit solves it.

Could you perhaps compile the following program and post the output? You can save it as ttytest.c and use the first line of the source file to compile and run it.

/* gcc ttytest.c -o ttytest; ./ttytest */

#define _GNU_SOURCE
#include <sys/ioctl.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>

int getcols()
{
  int termwidth = -1;
  const int default_tty = 80;
  const int default_notty = 0;

  if(!isatty(fileno(stdout))) {
    return default_notty;
  }

#ifdef TIOCGSIZE
  struct ttysize win;
  if(ioctl(1, TIOCGSIZE, &win) == 0) {
    termwidth = win.ts_cols;
  }
#elif defined(TIOCGWINSZ)
  struct winsize win;
  if(ioctl(1, TIOCGWINSZ, &win) == 0) {
    termwidth = win.ws_col;
  }
#endif
  return termwidth <= 0 ? default_tty : termwidth;
}

int main(void) {
  char *term = getenv("TERM");

  if (term) printf("TERM=%s\n", term);
  printf("isatty(fileno(stdout)) = %d\n", isatty(fileno(stdout)));
  printf("getcols() = %d\n", getcols());

  return 0;
}

Offline

#3 2011-06-23 03:14:54

marko-v
Member
Registered: 2011-06-23
Posts: 6

Re: Emacs shell mode - problem with pacman output

Falconindy: I think you are right about 3.5.3 version upgrade. I am pretty sure I saw those numbers back then.

Ofcourse I can post the output.

TERM=dumb
isatty(fileno(stdout)) = 1
getcols() = 80

Thank you for your help.

Offline

#4 2011-06-23 03:34:23

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: Emacs shell mode - problem with pacman output

So, the bad news is, it looks like shell mode in emacs makes a truly poor and incapable terminal. It appears to be the equivalent of a serial console, with the added "bonus" that it doesn't even set a TERM name (and therefore inherits the 'dumb' value).

The good news is, this should be fixed in 4.0. The second patch I picked out is indeed the fix, but wouldn't be a straight backport as it touches some features only present in git master.

Offline

#5 2011-06-23 03:41:15

marko-v
Member
Registered: 2011-06-23
Posts: 6

Re: Emacs shell mode - problem with pacman output

falconindy wrote:

So, the bad news is, it looks like shell mode in emacs makes a truly poor and incapable terminal. It appears to be the equivalent of a serial console, with the added "bonus" that it doesn't even set a TERM name (and therefore inherits the 'dumb' value).

The good news is, this should be fixed in 4.0. The second patch I picked out is indeed the fix, but wouldn't be a straight backport as it touches some features only present in git master.

Thank you man. Those are great news.

Offline

#6 2011-06-26 13:02:28

fr33ke
Member
Registered: 2010-08-21
Posts: 20

Re: Emacs shell mode - problem with pacman output

M-x shell is very simple. If you want fuller terminal emulation, you can use M-x term , which shows the progress bar just fine.

Offline

#7 2011-08-09 01:38:51

marko-v
Member
Registered: 2011-06-23
Posts: 6

Re: Emacs shell mode - problem with pacman output

Error post

Last edited by marko-v (2011-08-09 01:40:09)

Offline

#8 2011-08-09 01:39:35

marko-v
Member
Registered: 2011-06-23
Posts: 6

Re: Emacs shell mode - problem with pacman output

fr33ke wrote:

M-x shell is very simple. If you want fuller terminal emulation, you can use M-x term , which shows the progress bar just fine.

I can't switch buffers when in term mode.

Offline

Board footer

Powered by FluxBB