The OpenNET Project / Index page

[ новости /+++ | форум | теги | ]

Поиск:  Каталог документации | GNU-Emacs-FAQ

GNU Emacs Frequently Asked Questions (FAQ), part 4/5

Questions and answers having to do with GNU Emacs
Archive-name: GNU-Emacs-FAQ/part4

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

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.

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



Major Emacs Lisp Packages, Emacs Extensions, and Related Programs

104: VM (View Mail) -- another mail reader within Emacs, with MIME support

  Author: Kyle Jones <[email protected]>
  Latest version: 6.62
  Anonymous FTP:
    ftp://ftp.uu.net/networking/mail/vm/vm.tar.gz
  Newsgroups and mailing lists:
    Informational newsgroup/mailing list:
      gnu.emacs.vm.info (newsgroup)
      [email protected] (for subscriptions)
      [email protected] (for submissions)
    Bug reports newsgroup/mailing list:
      gnu.emacs.vm.bug (newsgroup)
      [email protected] (for subscriptions)
      [email protected] (for submissions)
  NOTE: VM 6 is not guaranteed to work under Emacs 20 (although many people
  seem to use it without too much trouble).  Users of Emacs 20 might prefer
  to use VM 5.97, available from the same FTP site.

105: Supercite -- mail and news citation package within Emacs

  Author: Barry Warsaw <[email protected]>
  Latest version: 3.1 (comes with Emacs 20)

  World Wide Web:
    http://www.python.org/emacs/supercite.tar.gz
  Mailing list:
    [email protected] (for subscriptions)
    [email protected] (for submissions)
  NOTE: Superyank is an old version of Supercite.

106: Calc -- poor man's Mathematica within Emacs

  Author: Dave Gillespie <[email protected]>
  Latest version: 2.02f
  Anonymous FTP:
    ftp://ftp.gnu.org/pub/gnu/calc-2.02f.tar.gz
  NOTE: Unlike Wolfram Research, Dave has never threatened to sue
        anyone for having a program with a similar command language to
        Calc.  :-)

107: VIPER -- vi emulation for Emacs

  Since Emacs 19.29, the preferred vi emulation in Emacs is VIPER (M-x
  viper-mode RET), which comes with Emacs.  It extends and supersedes VIP
  (including VIP 4.3) and provides vi emulation at several levels, from one
  that closely follows vi to one that departs from vi in several
  significant ways.

  For Emacs 19.28 and earlier, the following version of VIP is generally
  better than the one distributed with Emacs:

  Author: Aamod Sane <[email protected]>
  Latest version: 4.3
  Anonymous FTP:
    ftp://archive.cis.ohio-state.edu/pub/gnu/emacs/elisp-archive/modes/vip-mode.tar.Z

108: AUC TeX -- enhanced LaTeX mode with debugging facilities

  Authors: Kresten Krab Thorup <[email protected]>
           and Per Abrahamsen <[email protected]>
  Latest version: 9.8l
  Anonymous FTP:
    ftp://sunsite.auc.dk/packages/auctex/auctex.tar.gz
  Mailing list:
    [email protected] (for subscriptions)
    [email protected] (for submissions)
    [email protected] (auc-tex development team)
  World Wide Web:
    http://www.iesd.auc.dk/~amanda/auctex/

109: BBDB -- personal Info Rolodex integrated with mail/news readers

  Maintainer: Matt Simmons <[email protected]>
  Latest released version: 2.00
  Available from:
    http://www.netcom.com/~simmonmt/bbdb/index.html
  Mailing lists:
    [email protected] (for subscriptions)
    [email protected] (for submissions)
    [email protected] (to be informed of new releases)

110: Ispell -- spell checker in C with interface for Emacs

  Author: Geoff Kuenning <[email protected]>
  Latest released version: 3.1.20
  Anonymous FTP:
   Master Sites:
     ftp://ftp.cs.ucla.edu/pub/ispell/ispell-3.1.20.tar.gz
   Known Mirror Sites:
     ftp://ftp.th-darmstadt.de/pub/dicts/ispell/
     ftp://ftp.nl.net/pub/textproc/ispell/
  World Wide Web:
     http://fmg-www.cs.ucla.edu/geoff/ispell.html

  NOTE: * Do not ask Geoff to send you the latest version of Ispell.
          He does not have free e-mail.
      
        * This Ispell program is distinct from GNU Ispell 4.0. GNU
          Ispell 4.0 is no longer a supported product.

111: W3-mode -- A World Wide Web browser inside of Emacs

  Author: Bill Perry <[email protected]>
  Latest version: 4.0pre.23
  Anonymous FTP:
    ftp://ftp.cs.indiana.edu/pub/elisp/w3/.betas/w3.tar.gz
  Mailing lists:
    [email protected] (to get announcements of new versions)
    [email protected] (for beta-testers of new versions)
    [email protected] (for developers of W3)

112: EDB -- Database program for Emacs; replaces forms editing modes

  Author: Michael Ernst <[email protected]>
  Latest version: 1.21
  Anonymous FTP:
    ftp://theory.lcs.mit.edu/pub/emacs/edb

113: Mailcrypt -- PGP interface within Emacs mail and news

  Authors: Patrick J. LoPresti <[email protected]> and 
           Jin S. Choi <[email protected]>
  Maintainer: Len Budney <[email protected]>
  Latest version: 3.4
  Anonymous FTP:
    http://www.nb.net/~lbudney/linux/software/mailcrypt/mailcrypt-3.5b6.tar.gz
  World Wide Web:
    http://www.nb.net/~lbudney/linux/software/mailcrypt.html

114: JDE -- Development environment for Java programming

  Author: Paul Kinnucan <[email protected]>
  Mailing list: [email protected]
  Latest version: 2.1.1
  World Wide Web: http://sunsite.auc.dk/jde/

115: Patch -- program to apply "diffs" for updating files

  Author: Larry Wall <[email protected]> (with GNU modifications)
  Latest version: 2.5
  Anonymous FTP: See question 92


Changing Key Bindings and Handling Key Binding Problems

116: How do I bind keys (including function keys) to commands?

  Keys can be bound to commands either interactively or in your .emacs
  file.  To interactively bind keys for all modes, type

    M-x global-set-key RET KEY CMD RET

  To bind a key just in the current major mode, type

    M-x local-set-key RET KEY CMD RET

  See "Key Bindings" in the on-line manual for further details.

  To bind keys on starting Emacs or on starting any given mode, use the
  following "trick": First bind the key interactively, then immediately
  type "C-x ESC ESC C-a C-k C-g".  Now, the command needed to bind the key
  is in the kill ring, and can be yanked into your .emacs file.  If the key
  binding is global, no changes to the command are required.  For example,

    (global-set-key (quote [f1]) (quote help-for-help))

  can be placed directly into the .emacs file.  If the key binding is
  local, the command is used in conjunction with the "add-hook" command.
  For example, in tex-mode, a local binding might be

    (add-hook 'tex-mode-hook
      (function (lambda ()
        (local-set-key (quote [f1]) (quote help-for-help))))

  NOTE: * Control characters in key sequences, in the form yanked from the
          kill ring are given in their graphic form -- i.e., CTRL is shown
          as `^', TAB as a set of spaces (usually 8), etc.  You may want to
          convert these into their vector or string forms.

        * If a prefix key of the character sequence to be bound is already
          bound as a complete key, then you must unbind it before the new
          binding.  For example, if "ESC {" is previously bound:

                    (global-unset-key [?\e ?{])   ;;   or
                     (local-unset-key [?\e ?{])

        * Aside from commands and "lambda lists," a vector or string also
          can be bound to a key and thus treated as a macro.  For example:

           (global-set-key [f10] [?\C-x?\e?\e?\C-a?\C-k?\C-g])  ;;  or
           (global-set-key [f10] "\C-x\e\e\C-a\C-k\C-g")

117: Why does Emacs say "Key sequence XXX uses invalid prefix characters"?

  Usually, one of two things has happened.  In one case, the control
  character in the key sequence has been misspecified (e.g. "C-f" used
  instead of "\C-f" within a Lisp expression).  In the other case, a
  "prefix key" in the keystroke sequence you were trying to bind was
  already bound as a "complete key."  Historically, the "ESC [" prefix was
  usually the problem, in which case you should evaluate either of these
  forms before attempting to bind the key sequence:

    (global-unset-key [?\e ?[])  ;;  or
    (global-unset-key "\e[")

118: Why doesn't this [terminal or window-system setup] code work in my
     .emacs file, but it works just fine after Emacs starts up?

  During startup, Emacs initializes itself according to a given code/file
  order.  If some of the code executed in your .emacs file needs to be
  postponed until the initial terminal or window-system setup code has been
  executed but is not, then you will experience this problem (this
  code/file execution order is not enforced after startup).

  To postpone the execution of Emacs Lisp code until after terminal or
  window-system setup, treat the code as a "lambda list" and set the value
  of either the "term-setup-hook" or "window-setup-hook" variable to this
  "lambda function."  For example,

    (setq term-setup-hook
          (function
           (lambda ()
             (cond ((string-match "\\`vt220" (or (getenv "TERM") ""))
                    ;; Make vt220's "Do" key behave like M-x:
                    (global-set-key [do] 'execute-extended-command))
                   ))))

  For information on what Emacs does every time it is started, see the
  lisp/startup.el file.

119: How do I use function keys under X Windows?

  With Emacs 19, functions keys under X are bound like any other key.  See
  question 116 for details.

120: How do I tell what characters or symbols my function or arrow keys
     emit?

  Type "C-h c" then the function or arrow keys.  The command will return
  either a function key symbol or character sequence (see the Emacs on-line
  documentation for an explanation).  This works for other keys as well.

121: How do I set the X key "translations" for Emacs?

  Emacs is not written using the Xt library by default, so there are no
  "translations" to be set.  (We aren't sure how to set such translations
  if you do build Emacs with Xt; please let us know if you've done this!)

  The only way to affect the behavior of keys within Emacs is through
  "xmodmap" (outside Emacs) or "define-key" (inside Emacs).  The
  "define-key" command should be used in conjunction with the
  "function-key-map" map.  For instance,

     (define-key function-key-map [M-tab] [?\M-\t])

  defines the "M-TAB" key sequence.

122: How do I handle C-s and C-q being used for flow control?

  C-s and C-q are used in the XON/XOFF flow control protocol.  This messes
  things up when you're using Emacs, because Emacs binds these keys to
  commands by default.  Because Emacs won't honor them as flow control
  characters, too many of these characters are not passed on and overwhelm
  output buffers.  Sometimes, intermediate software using XON/XOFF flow
  control will prevent Emacs from ever seeing C-s and C-q.

  Possible solutions:

  * Disable the use of C-s and C-q for flow control.

    You need to determine the cause of the flow control.

    * your terminal

      Your terminal may use XON/XOFF flow control to have time to display
      all the characters it receives.  For example, VT series terminals do
      this.  It may be possible to turn this off from a setup menu.  For
      example, on a VT220 you may select "No XOFF" in the setup menu.  This
      is also true for some terminal emulation programs on PCs.

      When you turn off flow control at the terminal, you will also need to
      turn it off at the other end, which might be at the computer you are
      logged in to or at some terminal server in between.

      If you turn off flow control, characters may be lost; using a printer
      connected to the terminal may fail.  You may be able to get around
      this problem by modifying the "termcap" entry for your terminal to
      include extra NUL padding characters.

    * a modem

      If you are using a dialup connection, the modems may be using
      XON/XOFF flow control.  It's not clear how to get around this.

    * a router or terminal server

      Some network box between the terminal and your computer may be using
      XON/XOFF flow control.  It may be possible to make it use some other
      kind of flow control.  You will probably have to ask your local
      network experts for help with this.

    * tty and/or pty devices

      If your connection to Emacs goes through multiple tty and/or pty
      devices, they may be using XON/XOFF flow control even when it is not
      necessary.

      Eirik Fuller <[email protected]> writes:

        Some versions of "rlogin" (and possibly telnet) do not pass flow
        control characters to the remote system to which they connect.  On
        such systems, Emacs on the remote system cannot disable flow
        control on the local system.  Sometimes "rlogin -8" will avoid this
        problem.

        One way to cure this is to disable flow control on the local host
        (the one running rlogin, not the one running rlogind) using the
        stty command, before starting the rlogin process.  On many systems,
        "stty start u stop u" will do this.

        Some versions of "tcsh" will prevent even this from working.  One
        way around this is to start another shell before starting rlogin,
        and issue the stty command to disable flow control from that shell.

      Use "stty -ixon" instead of "stty start u stop u" on some systems.

  * Make Emacs speak the XON/XOFF flow control protocol.

    You can make Emacs treat C-s and C-q as flow control characters by
    evaluating the form

      (enable-flow-control)

    to unconditionally enable flow control or

      (enable-flow-control-on "vt100" "h19")

    (using your terminal names instead of "vt100" or "h19") to enable
    selectively.  These commands will automatically swap `C-s' and `C-q' to
    `C-\' and `C-^'.  Variables can be used to change the default swap keys
    ("flow-control-c-s-replacement" and "flow-control-c-q-replacement").

    If you are fixing this for yourself, simply put the form in your .emacs
    file.  If you are fixing this for your entire site, the best place to
    put it is in the lisp/site-start.el file.  Putting this form in
    lisp/default.el has the problem that if the user's .emacs file has an
    error, this will prevent lisp/default.el from being loaded and Emacs
    may be unusable for the user, even for correcting their .emacs file
    (unless they're smart enough to move it to another name).

    For further discussion of this issue, read the file PROBLEMS (in the
    top-level directory when you unpack the Emacs source).

123: How do I bind `C-s' and `C-q' (or any key) if these keys are filtered
     out?

  To bind `C-s' and `C-q', use either "enable-flow-control" or
  "enable-flow-control-on".  See question 122 for usage and implementation
  details.

  To bind other keys, use "keyboard-translate".  See question 126 for usage
  details.  To do this for an entire site, you should swap the keys in
  lisp/site-start.el.  See question 122 for an explanation of why
  lisp/default.el should not be used.

  NOTE: * If you do this for an entire site, the users will be confused by
          the disparity between what the documentation says and how Emacs
          actually behaves.

124: Why does the "Backspace" key invoke help?

  The "Backspace" key (on most keyboards) generates ASCII code 8.  `C-h'
  sends the same code.  In Emacs by default `C-h' invokes help-command.
  This is intended to be easy to remember since the first letter of "help"
  is `h'.  The easiest solution to this problem is to use `C-h' (and
  Backspace) for help and DEL (the Delete key) for deleting the previous
  character.

  For many people this solution may be problematic:

  * They normally use Backspace outside of Emacs for deleting the previous
    character.  This can be solved by making DEL the command for deleting
    the previous character outside of Emacs.  On many Unix systems, this
    command will remap DEL:

      stty erase `^?'

  * The person may prefer using the Backspace key for deleting the previous
    character because it is more conveniently located on their keyboard or
    because they don't even have a separate Delete key.  In this case, the
    Backspace key should be made to behave like Delete.  There are several
    methods.

  * Some terminals (e.g., VT3## terminals) allow the character generated by
    the Backspace key to be changed from a setup menu.

  * You may be able to get a keyboard that is completely programmable.

  * Under X or on a dumb terminal, it is possible to swap the Backspace and
    Delete keys inside Emacs:

      (keyboard-translate ?\C-h ?\C-?)

    See question 126 for further details of "keyboard-translate".

  * Another approach is to switch key bindings and put help on "C-x h"
    instead:

      (global-set-key "\C-h" 'delete-backward-char)
      (global-set-key "\C-xh" 'help-command) ;; overrides mark-whole-buffer

    Other popular key bindings for help are M-? and "C-x ?".

    NOTE: * Don't try to bind DEL to help-command, because there are many
            modes that have local bindings of DEL that will interfere.

125: Why doesn't Emacs look at the stty settings for Backspace vs. Delete?

  Good question!

126: How do I "swap" two keys?

  In Emacs 19, you can swap two keys (or key sequences) by using the
  "keyboard-translate" function.  For example, to turn `C-h' into DEL and
  DEL to `C-h', use

        (keyboard-translate ?\C-h ?\C-?)  ; translate `C-h' to DEL
        (keyboard-translate ?\C-? ?\C-h)  ; translate DEL to `C-h'.

  The first key sequence of the pair after the function identifies what is
  produced by the keyboard; the second, what is matched for in the keymaps.

  Keyboard translations are not the same as key bindings in keymaps.  Emacs
  contains numerous keymaps that apply in different situations, but there
  is only one set of keyboard translations, and it applies to every
  character that Emacs reads from the terminal.  Keyboard translations take
  place at the lowest level of input processing; the keys that are looked
  up in keymaps contain the characters that result from keyboard
  translation.

  Also see "Keyboard Translations" in the on-line manual.

127: How do I produce C-XXX with my keyboard?

  On terminals (but not under X), some common "aliases" are:

            C-2  or  C-SPC         for      C-@
            C-6                    for      C-^
            C-7  or  C-S--         for      C-_
            C-4                    for      C-\
            C-5                    for      C-]
            C-/                    for      C-?

  Often other aliases exist; use the "C-h c" command and try `CTRL' with
  all of the digits on your keyboard to see what gets generated.  You can
  also try the "C-h w" command if you know the name of the command.

128: What if I don't have a Meta key?

  Instead of typing "M-a", you can type "ESC a".  In fact, Emacs converts
  M-a internally into "ESC a" anyway (depending on the value of
  meta-prefix-char).  Note that you press "Meta" and `a' together, while
  you press `ESC', release it, and then press `a'.

129: What if I don't have an Escape key?

  Type `C-[' instead.  This should send ASCII code 27 just like an Escape
  key would.  `C-3' may also work on some terminal (but not under X).  For
  many terminals (notably DEC terminals) `F11' generates ESC.  If not, the
  following form can be used to bind it:

  (define-key function-key-map [f11] [?\e])  ; F11 is the documented ESC
                                             ; replacement on DEC terminals.

130: Can I make my "Compose Character" key behave like a Meta key?

  On a dumb terminal such as a VT220, no.  It is rumored that certain VT220
  clones could have their Compose key configured this way.  If you're using
  X, you might be able to do this with the "xmodmap" program.

131: How do I bind a combination of modifier key and function key?

  With Emacs 19 you can represent modified function keys in vector format
  by adding prefixes to the function key symbol.  For example (from the
  on-line documentation):

           (global-set-key [?\C-x right] 'forward-page)

  where "?\C-x" is the Lisp character constant for the character "C-x".

  You can use the modifier keys Control, Meta, Hyper, Super, Alt, and Shift
  with function keys.  To represent these modifiers, prepend the strings
  "C-", "M-", "H-", "s-", "A-", and "S-" to the symbol name.  Here is how
  to make "Hyper-Meta-RIGHT" move forward a word:

           (global-set-key [H-M-right] 'forward-word)

  NOTE: * Not all modifiers are permitted in all situations.  Hyper, Super,
          and Alt are available only under X (provided there are such
          keys).  Non-ASCII keys and mouse events (e.g. "C-=" and
          "mouse-1") also fall under this category.

  See question 116 for general key binding instructions.

132: Why doesn't my Meta key work in an xterm window?

  Try all of these methods before asking for further help:

  * You may have big problems using "mwm" as your window manager.  {Does
    anyone know a good generic solution to allow the use of the Meta key in
    Emacs with mwm?}

  * For X11: Make sure it really is a Meta key.  Use "xev" to find out what
    keysym your Meta key generates.  It should be either Meta_L or Meta_R.
    If it isn't, use xmodmap to fix the situation.

  * Make sure the pty the xterm is using is passing 8 bit characters.
    "stty -a" (or "stty everything") should show "cs8" somewhere.  If it
    shows "cs7" instead, use "stty cs8 -istrip" (or "stty pass8") to fix
    it.

  * If there is an rlogin connection between the xterm and the Emacs, the
    "-8" argument may need to be given to rlogin to make it pass all 8 bits
    of every character.

  * If the Emacs is running under Ultrix, it is reported that evaluating
    (set-input-mode t nil) helps.

  * If all else fails, you can make xterm generate "ESC W" when you type
    M-W, which is the same conversion Emacs would make if it got the M-W
    anyway.  In X11R4, the following resource specification will do this:

      XTerm.VT100.EightBitInput: false

    (This changes the behavior of the insert-eight-bit action.)

    With older xterms, you can specify this behavior with a translation:

      XTerm.VT100.Translations: #override \
        Meta<KeyPress>: string(0x1b) insert()

    You might have to replace "Meta" with "Alt".

133: Why doesn't my ExtendChar key work as a Meta key under HP-UX 8.0
     and 9.x?

  This is a result of an internationalization extension in X11R4 and the
  fact that HP is now using this extension.  Emacs assumes that
  XLookupString returns the same result regardless of the Meta key state
  which is no longer necessarily true.  Until Emacs is fixed, the temporary
  kludge is to run this command after each time the X server is started but
  preferably before any xterm clients are:

    xmodmap -e 'remove mod1 = Mode_switch'

  NOTE: This will disable the use of the extra keysyms systemwide, which
  may be undesirable if you actually intend to use them.


Using Emacs with Alternate Character Sets

134: How do I make Emacs display 8-bit characters?

  Emacs 19 has built-in support for 8-bit characters.  Here is an excerpt
  from the "European Display" page of the on-line manual:

    Some European languages use accented letters and other special symbols.
    The ISO 8859 Latin-1 character set defines character codes for many
    European languages in the range 160 to 255.

    Emacs can display those characters according to Latin-1, provided the
    terminal or font in use supports them.  The "M-x
    standard-display-european" command toggles European character display
    mode.  With a numeric argument, "M-x standard-display-european" enables
    European character display if and only if the argument is positive.

    Some operating systems let you specify the language you are using by
    setting a locale.  Emacs handles one common special case of this: if
    your locale name for character types contains the string "8859-1" or
    "88591", Emacs automatically enables European character display mode
    when it starts up.

135: How do I input 8-bit characters?

  Again, from the "European Display" page of the on-line manual:

    If you enter non-ASCII ISO Latin-1 characters often, you might find ISO
    Accents mode convenient.  When this minor mode is enabled, the
    characters ``', `'', `"', `^', `/' and `~' modify the following letter
    by adding the corresponding diacritical mark to it, if possible.  To
    enable or disable ISO Accents mode, use the command "M-x
    iso-accents-mode".  This command affects only the current buffer.

    To enter one of those six special characters, type the character,
    followed by a space.  Some of those characters have a corresponding
    "dead key" accent character in the ISO Latin-1 character set; to enter
    that character, type the corresponding ASCII character twice.  For
    example, `''' enters the Latin-1 character acute-accent (character code
    0264).

136: Where can I get an Emacs that handles kanji, Chinese, or other
     character sets?

  Emacs 20 now includes many of the features of MULE, the Multilingual
  Enhancement of Emacs.  See question 84 for information on where to find
  and download Emacs.

  The original MULE is available at

    ftp://sh.wide.ad.jp/JAPAN/mule/mule-19.33-delta.tar.gz

137: Where is an Emacs that can handle Semitic (right-to-left) alphabets?

  Emacs 20 supports Hebrew characters (ISO 8859-8), but does not yet
  support right-to-left character entry.

  Joel M. Hoffman <[email protected]> has written a Lisp package called
  hebrew.el that allows right-to-left editing of Hebrew.  It reportedly
  works out of the box with Emacs 19, but requires patches for Emacs 18.
  Write to Joel if you want the patches or package.

  Hebrew.el requires a Hebrew screen font, but no other Hardware support.
  Joel has a screen font for PCs running MS-DOS and Linux.

  You might also try to query archie for files named with "hebrew"; several
  ftp sites in Israel may also have the necessary files.




Партнёры:
PostgresPro
Inferno Solutions
Hosting by Hoster.ru
Хостинг:

Закладки на сайте
Проследить за страницей
Created 1996-2024 by Maxim Chirkov
Добавить, Поддержать, Вебмастеру