[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6. Bugs and problems

The Emacs manual lists some common kinds of trouble users could get into, see section `Dealing with Emacs Trouble' in The GNU Emacs Manual, so you might look there if the problem you encounter isn't described in this chapter. If you decide you've discovered a bug, see section `Reporting Bugs' in The GNU Emacs Manual, for instructions how to do that.

The file `etc/PROBLEMS' in the Emacs distribution lists various known problems with building and using Emacs on specific platforms; type C-h P to read it.

6.1 Does Emacs have problems with files larger than 8 megabytes?  
6.2 How do I get rid of `^M' or echoed commands in my shell buffer?  
6.3 Why do I get "Process shell exited abnormally with code 1"?  
6.4 Why do I get an error message when I try to run M-x shell?  
6.5 Where is the termcap/terminfo entry for terminal type "emacs"?  
6.6 Why does Emacs spontaneously start displaying "I-search:" and beeping?  
6.7 Why can't Emacs talk to certain hosts (or certain hostnames)?  
6.8 Why does Emacs say "Error in init file"?  
6.9 Why does Emacs ignore my X resources (my .Xdefaults file)?  
6.10 Why don't my customizations of the frame parameters work?  
6.11 Why does Emacs take 20 seconds to visit a file?  
6.12 How do I edit a file with a `$' in its name?  
6.13 Why does shell mode lose track of the shell's current directory?  
6.14 Are there any security risks in Emacs?  
6.15 Dired says, "no file on this line" when I try to do something.  


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.1 Does Emacs have problems with files larger than 8 megabytes?

Old versions (i.e., anything before 19.29) of Emacs had problems editing files larger than 8 megabytes. As of version 19.29, the maximum buffer size is at least 2^27-1, or 134,217,727 bytes, or 132 MBytes. Emacs 20 can be compiled on some 64-bit systems in a way that enlarges the buffer size up to 576,460,752,303,423,487 bytes, or 549,755,813 GBytes.

If you are using a version of Emacs older than 19.29 and cannot upgrade, you will have to recompile. Leonard N. Zubkoff suggests putting the following two lines in `src/config.h' before compiling Emacs to allow for 26-bit integers and pointers (and thus file sizes of up to 33,554,431 bytes):

 
#define VALBITS 26
#define GCTYPEBITS 5

This method may result in "ILLEGAL DATATYPE" and other random errors on some machines.

David Gillespie explains how this problems crops up; while his numbers are true only for pre-19.29 versions of Emacs, the theory remains the same with current versions.

Emacs is largely written in a dialect of Lisp; Lisp is a freely-typed language in the sense that you can put any value of any type into any variable, or return it from a function, and so on. So each value must carry a tag along with it identifying what kind of thing it is, e.g., integer, pointer to a list, pointer to an editing buffer, and so on. Emacs uses standard 32-bit integers for data objects, taking the top 8 bits for the tag and the bottom 24 bits for the value. So integers (and pointers) are somewhat restricted compared to true C integers and pointers.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.2 How do I get rid of `^M' or echoed commands in my shell buffer?

Try typing M-x shell-strip-ctrl-m RET while in shell-mode to make them go away. If that doesn't work, you have several options:

For tcsh, put this in your `.cshrc' (or `.tcshrc') file:

 
if ($?EMACS) then
    if ("$EMACS" == t) then
        if ($?tcsh) unset edit
        stty nl
    endif
endif

Or put this in your `.emacs_tcsh' file:

 
unset edit
stty nl

Alternatively, use csh in your shell buffers instead of tcsh. One way is:

 
(setq explicit-shell-file-name "/bin/csh")

and another is to do this in your `.cshrc' (or `.tcshrc') file:

 
setenv ESHELL /bin/csh

(You must start Emacs over again with the environment variable properly set for this to take effect.)

You can also set the ESHELL environment variable in Emacs Lisp with the following Lisp form,

 
(setenv "ESHELL" "/bin/csh")

The above solutions try to prevent the shell from producing the `^M' characters in the first place. If this is not possible (e.g., if you use a Windows shell), you can get Emacs to remove these characters from the buffer by adding this to your `.emacs' init file:

 
(add-hook 'comint-output-filter-functions 'shell-strip-ctrl-m)

On a related note: If your shell is echoing your input line in the shell buffer, you might want to try the following command in your shell start-up file:

 
stty -icrnl -onlcr -echo susp ^Z


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.3 Why do I get "Process shell exited abnormally with code 1"?

The most likely reason for this message is that the `env' program is not properly installed. Compile this program for your architecture, and install it with `a+x' permission in the architecture-dependent Emacs program directory. (You can find what this directory is at your site by inspecting the value of the variable exec-directory by typing C-h v exec-directory RET.)

You should also check for other programs named `env' in your path (e.g., SunOS has a program named `/usr/bin/env'). We don't understand why this can cause a failure and don't know a general solution for working around the problem in this case.

The `make clean' command will remove `env' and other vital programs, so be careful when using it.

It has been reported that this sometimes happened when Emacs was started as an X client from an xterm window (i.e., had a controlling tty) but the xterm was later terminated.

See also `PROBLEMS' (in the `etc' subdirectory of the top-level directory when you unpack the Emacs source) for other possible causes of this message.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.4 Why do I get an error message when I try to run M-x shell?

On MS-Windows, this might happen because Emacs tries to look for the shell in a wrong place. The default file name `/bin/sh' is usually incorrect for non-Unix systems. If you know where your shell executable is, set the variable explicit-shell-file-name in your `.emacs' file to point to its full file name, like this:

 
(setq explicit-shell-file-name "d:/shells/bash.exe")

If you don't know what shell does Emacs use, try the M-! command; if that works, put the following line into your `.emacs':

 
(setq explicit-shell-file-name shell-file-name)

Some people have trouble with Shell Mode because of intrusive antivirus software; disabling the resident antivirus program solves the problems in those cases.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.5 Where is the termcap/terminfo entry for terminal type "emacs"?

The termcap entry for terminal type `emacs' is ordinarily put in the `TERMCAP' environment variable of subshells. It may help in certain situations (e.g., using rlogin from shell buffer) to add an entry for `emacs' to the system-wide termcap file. Here is a correct termcap entry for `emacs':

 
emacs:tc=unknown:

To make a terminfo entry for `emacs', use tic or captoinfo. You need to generate `/usr/lib/terminfo/e/emacs'. It may work to simply copy `/usr/lib/terminfo/d/dumb' to `/usr/lib/terminfo/e/emacs'.

Having a termcap/terminfo entry will not enable the use of full screen programs in shell buffers. Use M-x terminal-emulator for that instead.

A workaround to the problem of missing termcap/terminfo entries is to change terminal type `emacs' to type `dumb' or `unknown' in your shell start up file. csh users could put this in their `.cshrc' files:

 
if ("$term" == emacs) set term=dumb


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.6 Why does Emacs spontaneously start displaying "I-search:" and beeping?

Your terminal (or something between your terminal and the computer) is sending C-s and C-q for flow control, and Emacs is receiving these characters and interpreting them as commands. (The C-s character normally invokes the isearch-forward command.) For possible solutions, see 10.7 How do I handle C-s and C-q being used for flow control?.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.7 Why can't Emacs talk to certain hosts (or certain hostnames)?

The problem may be that Emacs is linked with a wimpier version of gethostbyname than the rest of the programs on the machine. This is often manifested as a message on startup of "X server not responding. Check your `DISPLAY' environment variable." or a message of "Unknown host" from open-network-stream.

On a Sun, this may be because Emacs had to be linked with the static C library. The version of gethostbyname in the static C library may only look in `/etc/hosts' and the NIS (YP) maps, while the version in the dynamic C library may be smart enough to check DNS in addition to or instead of NIS. On a Motorola Delta running System V R3.6, the version of gethostbyname in the standard library works, but the one that works with NIS doesn't (the one you get with -linet). Other operating systems have similar problems.

Try these options:


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.8 Why does Emacs say "Error in init file"?

An error occurred while loading either your `.emacs' file or the system-wide file `lisp/default.el'. Emacs 21.1 and later pops the `*Messages*' buffer, and puts there some additional information about the error, to provide some hints for debugging.

For information on how to debug your `.emacs' file, see 5.3 How do I debug a `.emacs' file?.

It may be the case that you need to load some package first, or use a hook that will be evaluated after the package is loaded. A common case of this is explained in 10.3 Why doesn't this [terminal or window-system setup] code work in my `.emacs' file, but it works just fine after Emacs starts up?.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.9 Why does Emacs ignore my X resources (my .Xdefaults file)?

As of version 19, Emacs searches for X resources in the files specified by the following environment variables:

This emulates the functionality provided by programs written using the Xt toolkit.

XFILESEARCHPATH and XUSERFILESEARCHPATH should be a list of file names separated by colons. XAPPLRESDIR should be a list of directory names separated by colons.

Emacs searches for X resources:

  1. specified on the command line, with the `-xrm RESOURCESTRING' option,

  2. then in the value of the `XENVIRONMENT' environment variable,

  3. then in the screen-specific and server-wide resource properties provided by the server,

  4. then in the files listed in `XUSERFILESEARCHPATH',

  5. then in the files listed in XFILESEARCHPATH.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.10 Why don't my customizations of the frame parameters work?

This probably happens because you have set the frame parameters in the variable initial-frame-alist. That variable holds parameters used only for the first frame created when Emacs starts. To customize the parameters of all frames, change the variable default-frame-alist instead.

These two variables exist because many users customize the initial frame in a special way. For example, you could determine the position and size of the initial frame, but would like to control the geometry of the other frames by individually positioning each one of them.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.11 Why does Emacs take 20 seconds to visit a file?

Old versions of Emacs (i.e., versions before Emacs 20.x) often encountered this when the master lock file, `!!!SuperLock!!!', has been left in the lock directory somehow. Delete it.

Mark Meuer says that NeXT NFS has a bug where an exclusive create succeeds but returns an error status. This can cause the same problem. Since Emacs's file locking doesn't work over NFS anyway, the best solution is to recompile Emacs with CLASH_DETECTION undefined.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.12 How do I edit a file with a `$' in its name?

When entering a file name in the minibuffer, Emacs will attempt to expand a `$' followed by a word as an environment variable. To suppress this behavior, type $$ instead.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.13 Why does shell mode lose track of the shell's current directory?

Emacs has no way of knowing when the shell actually changes its directory. This is an intrinsic limitation of Unix. So it tries to guess by recognizing `cd' commands. If you type cd followed by a directory name with a variable reference (cd $HOME/bin) or with a shell metacharacter (cd ../lib*), Emacs will fail to correctly guess the shell's new current directory. A huge variety of fixes and enhancements to shell mode for this problem have been written to handle this problem. Check the Lisp Code Directory (see section 8.2 How do I find a Emacs Lisp package that does XXX?).

You can tell Emacs the shell's current directory with the command M-x dirs.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.14 Are there any security risks in Emacs?


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.15 Dired says, "no file on this line" when I try to do something.

Chances are you're using a localized version of Unix that doesn't use US date format in dired listings. You can check this by looking at dired listings or by typing ls -l to a shell and looking at the dates that come out.

Dired uses a regular expression to find the beginning of a file name. In a long Unix-style directory listing (`ls -l'), the file name starts after the date. The regexp has thus been written to look for the date, the format of which can vary on non-US systems.

There are two approaches to solving this. The first one involves setting things up so that `ls -l' outputs US date format. This can be done by setting the locale. See your OS manual for more information.

The second approach involves changing the regular expression used by dired, dired-move-to-filename-regexp.


[ << ] [ >> ]           [Top] [Contents] [Index] [ ? ]

This document was generated by (Blade) GNU s/w Owner on November, 2 2001 using texi2html