Subject: GNU Emacs Frequently Asked Questions (FAQ), part 3/5
Supersedes: <GNU-Emacs-FAQ-3_808691574@the-tech.mit.edu>
Date: 15 Oct 1995 06:51:40 GMT
Summary: Questions and answers having to do with GNU Emacs


------------------------------------------------------------

If you are viewing this text in a GNU Emacs Buffer, you can type "M-2 C-x
$" to get an overview of just the questions.  Then, when you want to look
at the text of the answers, just type "C-x $".

To search for a question numbered XXX, type "M-C-s ^XXX:", followed by a
C-r if that doesn't work.  Type RET to end the search.

If you have w3-mode installed (see question 111), you can visit ftp and
HTTP uniform resource locators (URLs) by placing the cursor on the URL and
typing M-x w3-follow-url-at-point.

The FAQ is posted in five parts; if you are missing a section or would
prefer to read the FAQ in a single file, see question 22.

------------------------------------------------------------



Bugs/Problems

70:  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 or 134,217,727 bytes.

  If you are using an older version of Emacs and cannot upgrade, you will
  have to recompile. Leonard N. Zubkoff <lnz@lucid.com> 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

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

  David Gillespie <daveg@csvax.cs.caltech.edu> 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.

    Emacs uses 8-bit tags because that's a little faster on byte-oriented
    machines, but there are only really enough tags to require 6 bits.

71:  How do I get rid of the ^M junk 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")

72:  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 top-level directory when you unpack the Emacs
  source) for other possible causes of this message.

73:  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

74:  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 question 120.

75:  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:

  * Explicitly add the host you want to communicate with to /etc/hosts.

  * Relink Emacs with this line in src/config.h:

      #define LIBS_SYSTEM -lresolv

  * Replace gethostbyname and friends in libc.a with more useful versions
    such as the ones in libresolv.a.  Then relink Emacs.

  * If you are actually running NIS, make sure that "ypbind" is properly
    told to do DNS lookups with the correct command line switch.

  * Use tcp.el and tcp.c from Gnus.  This has the additional advantage that
    you can use numeric IP addresses instead of names.  open-network-stream
    currently can't handle numeric addresses.  Brian Thomson
    <thomson@hub.toronto.edu> has a enhancement to open-network-stream to
    allow it to handle numeric addresses.

76:  Why does Emacs say "Error in init file"?

  An error occurred while loading either your .emacs file or the
  system-wide lisp/default.el file.  For information on how to debug your
  .emacs file, see question 27.

  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 question 116.

77:  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 XFILESEARCHPATH, XUSERFILESEARCHPATH, and XAPPLRESDIR environment
  variables, emulating the functionality provided by programs written using
  Xt.

  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

    + specified on the command line, with the "-xrm RESOURCESTRING"
      option,
    + then in the value of the XENVIRONMENT environment variable,
      - or if that is unset, in the file named ~/.Xdefaults-HOSTNAME if it
        exists
        (where HOSTNAME is the hostname of the machine Emacs is running on),
    + then in the screen-specific and server-wide resource properties
      provided by the server,
      - or if those properties are unset, in the file named ~/.Xdefaults
        if it exists,
    + then in the files listed in XUSERFILESEARCHPATH,
      - or in files named LANG/Emacs in directories listed in XAPPLRESDIR
        (where LANG is the value of the LANG environment variable), if
        the LANG environment variable is set,
      - or in files named Emacs in the directories listed in XAPPLRESDIR
      - or in ~/LANG/Emacs (if the LANG environment variable is set),
      - or in ~/Emacs,
    + then in the files listed in XFILESEARCHPATH.

78:  Why does Emacs take 20 seconds to visit a file?

  The usual cause is that the master lock file, "!!!SuperLock!!!" has been
  left in the lock directory somehow.  Delete it.

  Mark Meuer <meuer@geom.umn.edu> 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.

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

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

80:  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 question 87).

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

81:  Are there any security risks in Emacs?

  * the "movemail" incident (No, this is not a risk.)

    In his book "The Cuckoo's Egg," Cliff Stoll describes this in chapter
    4.  The site at LBL had installed the "etc/movemail" program setuid
    root.  (As of version 19, movemail is in your architecture-specific
    directory; type "C-h v exec-directory RET" to see what it is.)  Since
    "movemail" had not been designed for this situation, a security hole
    was created and users could get root privileges.

    "movemail" has since been changed so that even if it is installed
    setuid root this security hole will not be a result.

    We have heard unverified reports that the 1988 Internet worm took
    advantage of this configuration problem.

  * the file-local-variable feature (Yes, a risk, but easy to change.)

    There is an Emacs feature that allows the setting of local values for
    variables when editing a file by including specially formatted text
    near the end of the file.  This feature also includes the ability to
    have arbitrary Emacs Lisp code evaluated when the file is visited.
    Obviously, there is a potential for Trojan horses to exploit this
    feature.

    Emacs 18 allowed this feature by default; users could disable it by
    setting the variable inhibit-local-variables to a non-nil value.

    As of Emacs 19, the opposite is true: Emacs disallows file variable by
    default, and users must explicitly enable them by setting the variable
    enable-local-variables to a non-nil value.  You can also tell Emacs
    whether to allow the evaluation of Emacs Lisp code found at the bottom
    of files by setting the variable enable-local-eval.

    For more information, see "File Variables" in the on-line manual.

  * synthetic X events (Yes, a risk; use MIT-MAGIC-COOKIE-1 or better.)

    Emacs accepts synthetic X events generated by the SendEvent request as
    though they were regular events.  As a result, if you are using the
    trivial host-based authentication, other users who can open X
    connections to your X workstation can make your Emacs process do
    anything, including run other processes with your privileges.

    The only fix for this is to prevent other users from being able to open
    X connections.  The standard way to prevent this is to use a real
    authentication mechanism, such as MIT-MAGIC-COOKIE-1.  If using the
    "xauth" program has any effect, then you are probably using
    MIT-MAGIC-COOKIE-1.  Your site may be using a superior authentication
    method; ask your system administrator.

    If real authentication is not a possibility, you may be satisfied by
    just allowing hosts access for brief intervals while you start your X
    programs, then removing the access.  This reduces the risk somewhat by
    narrowing the time window when hostile users would have access, but
    DOES NOT ELIMINATE THE RISK.

    On most computers running Unix and X Windows, you enable and disable
    access using the "xhost" command.  To allow all hosts access to your X
    server, use

      xhost +

    at the shell prompt, which (on an HP machine, at least) produces the
    following message:

      access control disabled, clients can connect from any host

    To deny all hosts access to your X server (except those explicitly
    allowed by name), use

      xhost -

    On the test HP computer, this command generated the following message:

      access control enabled, only authorized clients can connect


Difficulties Building/Installing/Porting Emacs

82:  How do I install Emacs?

  This answer is meant for users of Unix and Unix-like systems.  Users of
  other operating systems should see the series of questions beginning with
  question 92, which describe where to get non-Unix source and binaries.
  These packages should come with installation instructions.

  For Unix and Unix-like systems, the easiest way is often to compile it
  from scratch.  You will need:

  * Emacs sources.  See question 90 for a list of ftp sites that make them
    available.  On prep.ai.mit.edu, the main GNU distribution site, sources
    are available at

      ftp://prep.ai.mit.edu/pub/gnu/emacs-19.29.tar.gz

    The above will obviously change as new versions of Emacs come out.  For
    instance, when Emacs 19.30 is released, it will most probably be
    available at

      ftp://prep.ai.mit.edu/pub/gnu/emacs-19.30.tar.gz

    Again, you should use one of the mirror sites in question 90 (and
    adjust the URL accordingly) so as to reduce load on prep.

  * Gzip, the GNU compression utility.  You can get gzip via anonymous ftp
    at prep and its mirror sites; it should compile and install without
    much trouble on most systems.  Once you have retrieved the Emacs
    sources, you will probably be able to uncompress them with the command

      gunzip --verbose emacs-19.29.tar.gz

    changing the Emacs version (19.29), as necessary.  Once gunzip has
    finished doing its job, a file by the name of "emacs-19.29.tar" should
    be in your build directory.

  * Tar, the "tape archiving" program, which moves multiple files into and
    out of archive files, or "tarfiles."  All of the files comprising the
    Emacs source come in a single tarfile, and must be extracted using tar
    before you can build Emacs.  Typically, the extraction command would
    look like

      tar -xvvf emacs-19.29.tar

    The `x' indicates that we want to extract files from this tarfile, the
    two `v's force verbose output, and the `f' tells tar to use a disk
    file, rather than one on tape.

    If you're using GNU tar (available at prep and its mirrors), you can
    combine this step and the previous one by using the command

      tar -zxvvf emacs-19.29.tar.gz

    The additional `z' at the beginning of the options list tells GNU tar
    to uncompress the file with gunzip before extracting the tarfile's
    components.

  At this point, the Emacs sources (all 25+ megabytes of them) should be
  sitting in a directory called "emacs-19.29".  On most common Unix and
  Unix-like systems, you should be able to compile Emacs (with X Windows
  support) with the following commands:

    cd emacs-19.29      [ change directory to emacs-19.29 ]
    ./configure         [ configure Emacs for your particular system ]
    make                [ use Makefile to build components, then Emacs ]

  If the "make" completes successfully, the odds are fairly good that the
  build has gone well.  (See question 84 if you weren't successful.)

  To install Emacs in its default directories of /usr/local/bin (binaries),
  /usr/local/share/emacs/19.xx (Lisp code and support files), and
  /usr/local/info (Info documentation), become the super-user and type

    make install

  Note that "make install" will overwrite /usr/local/bin/emacs and any
  Emacs Info files that might be in /usr/local/info.

  Much more verbose instructions (with many more hints and suggestions)
  come with the Emacs sources, in the file "INSTALL".

83:  How do I update Emacs to the latest version?

  Follow the instructions in question 82.

  Emacs 19 places nearly everything in version-specific directories (e.g.,
  /usr/local/share/emacs/19.29), so the only files that can be overwritten
  when installing a new release are /usr/local/bin/emacs and the Emacs Info
  documentation in /usr/local/info.  Back up these files before you install
  a new release, and you shouldn't have too much trouble.

84:  What should I do if I have trouble building Emacs?

  First look in the file PROBLEMS (in the top-level directory when you
  unpack the Emacs source) to see if there is already a solution for your
  problem.  Next, look for other questions in this FAQ that have to do with
  Emacs installation and compilation problems.

  If you'd like to have someone look at your problem and help solve it, see
  question 21.

  If you don't find a solution, then report your problem via e-mail to
  bug-gnu-emacs@prep.ai.mit.edu.  Please do not post it to gnu.emacs.help
  or e-mail it to help-gnu-emacs@prep.ai.mit.edu.  For further guidelines,
  see question 8 and question 10.

85:  Why does linking Emacs with -lX11 fail?

  Emacs needs to be linked with the static version of the X11 library,
  libX11.a.  This may be missing.

  Under OpenWindows, you may need to use "add_services" to add the
  "OpenWindows Programmers" optional software category from the CD-ROM.

  Under HP-UX 8.0, you may need to run "update" again to load the X11-PRG
  "fileset".  This may be missing even if you specified "all filesets" the
  first time.  If libcurses.a is missing, you may need to load the
  "Berkeley Development Option."

  David Zuhn <zoo@armadillo.com> says that MIT X builds shared libraries by
  default, and only shared libraries, on those platforms that support them.
  These shared libraries can't be used when undumping temacs (the last
  stage of the Emacs build process).  To get regular libraries in addition
  to shared libraries, add this to site.cf:

      #define ForceNormalLib YES

  Other systems may have similar problems.  You can always define
  CANNOT_DUMP and link with the shared libraries instead.

  To get the Xmenu stuff to work, you need to find a copy of MIT's
  liboldX.a.

