*** empty log message ***
[bpt/emacs.git] / etc / FAQ
CommitLineData
468a4755
JB
1This is a list of frequently asked questions (FAQ) about GNU Emacs with
2answers. This list is designed to cut down on the noise in the
3gnu.emacs.help newsgroup (which is also the help-gnu-emacs mailing list)
4that results from people repeatedly asking many of the same questions.
5
6This list is maintained by me, Joe Wells. My e-mail address is
7jbw@bu.edu. If jbw@bu.edu doesn't work try jbw@bucsf.bu.edu.
8
9Feel free to contribute text for the answers that I haven't written yet,
10to suggest new questions, to suggest changes in the wording, to suggest
11deletions, etc. Please include either "FAQ" or "frequently asked
12questions" in the subject of messages you send to me to help keep me from
13accidentally filing your message in the wrong mail folder.
14
15Here is a short list of new questions and questions that are now answered:
16
17New questions:
18
19 Why doesn't "C-c C-c" interrupt subprocesses under HP/UX?
20 How do I make Emacs send 8-bit characters to my terminal?
21 Why does ispell sometimes ignore the local dictionary?
22 Where can I get Emacs with NeWS support?
23
24Questions with improved answers:
25
26 Has someone written an GNU Emacs Lisp package that does XXX?
27 How do I get Emacs running on VMS under DECwindows?
28 Why does Emacs crash from a bus error in XLookupString under OpenLook?
29 Why does Emacs hang with message "Unknown XMenu" with X11R4?
30 How do I use regexps (regular expressions) in Emacs?
31 How do I make Emacs "typeover" or "overwrite" when I type instead of
32 always inserting?
33 How do I get Emacs for my PC?
34 How can I highlight a region?
35 Where can I get GNU Emacs Lisp packages that don't come with Emacs?
36 Where can I get the latest VM, Supercite, GNUS, Calc, Calendar, or Patch?
37
38Minor changes:
39
40 Where does the name "Emacs" come from?
41 In C mode, can I show just the lines that will be left after #ifdef
42 commands are handled by the compiler?
43 What does "M-x command" mean?
44 How do I get a printed copy of the GNU Emacs manual?
45 What do things like this mean: C-h, M-C-a, RET, etc.?
46 Why doesn't GNUS work anymore via NNTP?
47 What does Emacs do every time it starts up?
48
49Enjoy,
50
51--
52Joe Wells <jbw@bu.edu>
53-------------------------------------------------
54GNU Emacs Frequently Asked Questions with Answers (part 1 of 2)
55
56Sat Dec 8 01:30:53 1990
57
58
59If you are viewing this file in a GNU Emacs Buffer, you can type "M-2 C-x
60$" to get an overview of just the questions. Then, when you want to look
61at the text of the answers, just type "C-x $".
62
63To search for a question numbered XXX, type "M-C-s ^XXX:", followed by a
64C-r if that doesn't work, then type ESC to end the search.
65
66
67Notation Used in the Answers (READ THIS SECTION FIRST!)
68
69 You may skip this section if you are reasonably familiar with GNU Emacs.
70 Some of these are not actually frequently asked questions, but knowing
71 them is important for understanding the answers to the rest of the
72 questions.
73
741: What do things like this mean: C-h, M-C-a, RET, etc.?
75
76 C-a means while holding down the "Control" key press the "a" key. The
77 ASCII code this sends will generally be the value that would be sent by
78 pressing just "a" minus 96 or 64. Either way it will be a number from 0
79 to 31.
80
81 M-a means while holding down the "Meta" key press the "a" key. The
82 ASCII code this sends is the sum of the ASCII code that would be sent by
83 pressing just "a" and 128.
84
85 M-C-a means while holding down both the "Control" key and the "Meta" key
86 press the "a" key.
87
88 C-M-a is a synonym for M-C-a.
89
90 RET means press the "Return" key. RET is the same as C-m. This sends
91 ASCII code 13.
92
93 LFD means press the "Linefeed" key. LFD is also the same as C-j. This
94 sends ASCII code 10. Under Unix, ASCII code 10 is more often called
95 "Newline".
96
97 DEL means press the "Delete" key. DEL is the same as C-?. This sends
98 ASCII code 127.
99
100 ESC means press the "Escape" key. ESC is the same as C-[. This sends
101 ASCII code 27.
102
103 SPC means press the "Space" key. This send ASCII code 32.
104
105 TAB means press the "Tab" key. TAB is the same as C-i. This send ASCII
106 code 9.
107
108 To read more about this online, type "C-h i m emacs RET m characters
109 RET", and also "C-h i m emacs RET m keys RET".
110
1112: What do you mean when you write things like this: type "ESC a"?
112
113 I will enclose key sequences that are longer than one key inside double
114 quotes. These notations refer to single keys (some with modifiers):
115
116 C-x, M-x, M-C-x
117 RET, LFD, DEL, ESC, SPC, TAB
118
119 I separate these from other keys within double quotes by spaces. Any
120 real spaces that I write inside double quotes can be ignored, only SPC
121 means press the space key. All other characters within double quotes
122 represent single keys (some shifted).
123
1243: What if I don't have a Meta key?
125
126 Instead of typing M-a, you can type "ESC a" instead. In fact, Emacs
127 converts M-a internally into "ESC a" anyway.
128
1294: What if I don't have an Escape key?
130
131 Type C-[ instead. This should send ASCII code 27 just like an Escape
132 key would.
133
1345: What does "M-x command" mean?
135
136 "M-x command" means type M-x, then type the name of the command, then
137 type RET.
138
139 M-x is simply the default key sequence that invokes the command
140 "execute-extended-command". This command allows you to run any Emacs
141 command if you can remember the command's name. If you can't remember
142 the command's name, you can type TAB and SPC for completion, and ? for a
143 list of possibilities. An Emacs "command" is any "interactive" Emacs
144 function.
145
146 NOTE: Your system administrator may have bound other key sequences to
147 invoke execute-extended-command. A function key labeled "Do" is a good
148 candidate for this.
149
150 To run non-interactive Emacs functions, use M-ESC instead and type a
151 Lisp form.
152
1536: What do things like this mean: etc/SERVICE, src/config.h,
154 lisp/default.el?
155
156 These are the names of files that are part of the GNU Emacs
157 distribution. The GNU Emacs distribution is so big that it is divided
158 into several subdirectories; the important subdirectories are named
159 "etc", "lisp", and "src".
160
161 If you use GNU Emacs, but don't know where it is kept on your system,
162 start Emacs, then type "C-h v exec-directory RET". The directory name
163 that is displayed by this will be the full pathname of the "etc"
164 directory of your installed GNU Emacs distribution.
165
166 Some of these files are available individually via FTP or e-mail, see
167 question 16.
168
1697: What are FSF, LPF, OSF, GNU, RMS, FTP, BTW, and GPL?
170
171 FSF == Free Software Foundation
172 LPF == League for Programming Freedom
173 OSF == Open Software Foundation
174 GNU == GNU's Not Unix
175 RMS == Richard M. Stallman
176 FTP == File Transfer Protocol
177 BTW == By the way
178 GPL == GNU General Public Licence
179
180 NOTE: Avoid confusing the FSF, the LPF, and the OSF. The LPF only
181 opposes look-and-feel copyrights and software patents. The FSF aims to
182 make high quality free software available for everyone. The OSF is a
183 commercial organization which wants to provide an alternative,
184 standardized version of Unix not controlled by AT&T.
185
186
187
188Sources of Information and Help
189
1908: I'm just starting GNU Emacs; how do I do basic editing?
191
192 Type "C-h t" to invoke the self-paced tutorial. Typing just C-h is
193 how to enter the help system.
194
195 WARNING: your system administrator may have changed C-h to act like DEL.
196 You can use M-x help-for-help instead to invoke help. To discover what
197 key (if any) invokes help on your system, type "M-x where-is RET
198 help-for-help RET". This will print a comma-separated list of key
199 sequences in the echo area. Ignore the last character in each key
200 sequence listed. Each of the resulting key sequences invokes help.
201
202 NOTE: Emacs's help facility works best if help is invoked by a single
203 key. The variable help-char should hold the value of this character.
204
2059: How do I find out how to do something in GNU Emacs?
206
207 There are several methods for finding out how to do things in Emacs.
208
209 You should become familiar with the online documentation for Emacs. The
210 complete text of the Emacs manual is available online in a hypertext
211 format via the "Info" manual reader. Type "C-h i" to invoke Info.
212
213 You can order a hardcopy of the manual from the FSF. See question 12.
214
215 You can list all of the commands whose names contain a certain word
216 (actually which match a regular expression) using the "command-apropos"
217 command. Type "C-h a" to invoke this command.
218
219 You can list all of the functions and variables whose names contain a
220 certain word using the "apropos" command. M-x apropos invokes this
221 command.
222
223 You may find that command-apropos and apropos are extremely slow on your
224 system. This will be fixed in Emacs 19. If you can't wait that long,
225 I can send you the "fast-apropos.el" file that contains the fix. This
226 file also contains a "super-apropos" command that will list all the
227 functions and variables whose documentation strings contain a certain
228 word.
229
230 There are many other commands in Emacs for getting help and information.
231 To get a list of these commands, type "C-h C-h C-h".
232
23310: Where can I get GNU Emacs on the net (or by snail mail)?
234
235 Look in the files etc/DISTRIB and etc/FTP for information. If you don't
236 already have GNU Emacs, see question 16.
237
23811: Where can I get help in installing GNU Emacs?
239
240 Look in the file etc/SERVICE for names of companies and individuals who
241 will sell you this type of service.
242
243 This file in the version 18.55 distribution is not completely up to
244 date. The imminent release of 18.56 will help that. An up-to-date
245 version of the SERVICE file is available on prep.ai.mit.edu. See
246 question 16 for how to retrieve this file.
247
24812: How do I get a printed copy of the GNU Emacs manual?
249
250 You can order a printed copy of the GNU Emacs manual from the FSF for
251 $15. A set of 6 manuals is $60.
252
253 The full TeX source for the manual also comes with Emacs, if you're
254 daring enough to try to print out this 300 page manual yourself. (We're
255 talking about killing an entire tree here. This kind of printer usage
256 can make you very unpopular. Besides, if you order it from the FSF, the
257 price may be tax-deductible as a business expense.)
258
259 If you absolutely have to print your own copy, and you don't have TeX,
260 you can get a PostScript version from:
261
262 Anonymous FTP:
263 site: abcfd20.larc.nasa.gov
264 file: /pub/docs/emacs-18.55.PS.Z (size: 472K)
265
266 Carl Witty <cwitty@cs.stanford.edu> writes:
267
268 The Emacs manual is also available online in the Info system, which is
269 available by typing "C-h i". In this form, it has hypertext links and
270 is very easy to browse or search; many people prefer it to the printed
271 manual.
272
27313: Has someone written an GNU Emacs Lisp package that does XXX?
274
275 Probably. A listing of Emacs Lisp packages, called the Lisp Code
276 Directory, is being maintained by Dave Brennan <brennan@dg-rtp.dg.com>.
277 You can search through this list to find if someone has written
278 something that fits your needs.
279
280 This list is file "LCD-datafile.Z" in the Emacs Lisp Archive. (See
281 question 14.) The files "lispdir.el.Z" and "lispdir.doc.Z"
282 in the archive contain information to help you use the list.
283
28414: Where can I get GNU Emacs Lisp packages that don't come with Emacs?
285
286 First, check the Lisp Code Directory to find the name of the package you
287 are looking for. (See question 13). Then check local archives and
288 the Emacs Lisp Archive to find a copy of the relevant files. Then, if
289 you still haven't found it, you can send e-mail to the author asking for
290 a copy.
291
292 You can access the Emacs Lisp Archive via:
293
294 Anonymous FTP:
295 site: tut.cis.ohio-state.edu
296 directory: /pub/gnu/emacs/elisp-archive
297 file: README.Z
298
299 NOTE: Any files with names ending in ".Z" are compressed, and you should
300 use "binary" mode in FTP to retrive them. You should also use binary
301 mode whenever you retrieve any files with names ending in ".elc".
302
303 Submissions for the archive should be sent to Dave Sill <de5@ornl.gov>.
304 If you have ftp access, the submission can be deposited in the directory
305 /pub/gnu/emacs/elisp-archive/incoming on tut.cis.ohio-state.edu.
306 Whenever possible submissions should contain an LCD-datafile entry since
307 this helps reduce administrative overhead for the maintainers. Before
308 submitting anything, first read the file "guidelines.Z", which is
309 available in the archive.
310
31115: Where can I get documentation on GNU Emacs Lisp?
312
313 Obtain the GNU Emacs Lisp Reference Manual for Emacs 18 under Unix. It
314 is available from the FSF for $50. The latest revision is edition 1.02
315 dated July 1990.
316
317 Within Emacs, you can type "C-h f" to get the documentation for a
318 function, "C-h v" for a variable.
319
320 Also, as a popular USENET saying goes, "Use the Force, Read the Source".
321
322 You can also get the Texinfo source for the manual, if you are daring
323 enough to try to print this 550 page manual out yourself. This is
324 available in the Emacs Lisp Archive and also via:
325
326 Anonymous FTP:
327 site: prep.ai.mit.edu
328 file: /pub/gnu/elisp.tar.Z
329
330 A set of pregenerated Info files comes with the Texinfo source for the
331 Emacs Lisp manual, so you don't have to format it yourself for online
332 use. (You can create the Info files from the Texinfo source.) See
333 question 21 for details on how to install these files online.
334
33516: What informational files are available?
336
337 This isn't a frequently asked question, but it should be!
338
339 The following files are available in the "etc" directory of the GNU
340 Emacs distribution, and also the latest versions are available
341 individually via:
342
343 Anonymous FTP:
344 site: prep.ai.mit.edu
345 directory: /pub/gnu/etc
346
347 APPLE -- Special Report: Apple's New Look and Feel
348 DISTRIB -- GNU Emacs Availability Information,
349 including the popular "Free Software Foundation Order Form"
350 FTP -- How to get GNU Software by Internet FTP or by UUCP
351 GNU -- The GNU Manifesto
352 INTERVIEW -- Richard Stallman discusses his public-domain
353 UNIX-compatible software system
354 with BYTE editors
355 MACHINES -- Status of GNU Emacs on Various Machines and Systems
356 MAILINGLISTS -- GNU Project Electronic Mailing Lists
357 SERVICE -- GNU Service Directory
358 SUN-SUPPORT -- includes the popular "Using Emacstool with GNU Emacs"
359
360 These files are available in the "etc" directory of the GNU Emacs
361 distribution:
362
363 DIFF -- Differences between GNU Emacs and Twenex Emacs
364 CCADIFF -- Differences between GNU Emacs and CCA Emacs
365 GOSDIFF -- Differences between GNU Emacs and Gosling (Unipress??) Emacs
366 COPYING -- GNU Emacs General Public License
367 NEWS -- GNU Emacs News, a history of user-visible changes
368
369 In addition, all of the above files are available directly from the FSF
370 via e-mail. Of course, please try to get them from a local source
371 first.
372
373 These files are available from the FSF via e-mail:
374
375 * GNU's Bulletin, June, 1990 -- this file includes:
376 GNU'S Who
377 What Is the Free Software Foundation?
378 What Is Copyleft?
379 GNUs Flashes
380 Possible New Terms for GNU Libraries by Richard Stallman
381 "League for Programming Freedom" by Michael Bloom and Richard Stallman
382 Free Software Support
383 GNU Project Status Report
384 GNU Wish List
385 GNU Documentation
386 GNU Software Available Now
387 Contents of the Emacs Release Tape
388 Contents of the Pre-Release Tape
389 Contents of the X11 Tapes
390 VMS Emacs and Compiler Tapes
391 How to Get GNU Software
392 Freemacs, an Extensible Editor for MS-DOS
393 Thank GNUs
394 FSF Order Form
395 * GNU Task List
396 * GNU Coding Standards
397 * Legal issues about contributing code to GNU
398 * GNU Project Status Report
399
40017: What is the current address of the FSF?
401
402 Snail mail address:
403 Free Software Foundation
404 675 Massachusetts Avenue
405 Cambridge, MA 02139, USA
406
407 Phone number:
408 (617) 876-3296
409
410 E-mail addresses:
411 gnu@prep.ai.mit.edu {probably read by Len Tower}
412 gnulists@prep
413
41418: What is the current address of the LPF?
415
416 Snail mail address:
417 League for Programming Freedom
418 1 Kendall Square, Number 143
419 Post Office Box 9171
420 Cambridge, MA 02139, USA
421
422 Phone number:
423 (617) 243-4061 { or 243-4091, I'm not sure ... }
424
425 E-mail address:
426 league@prep.ai.mit.edu
427
42819: Where can I get the up-to-date GNU stuff?
429
430 The most up-to-date official GNU stuff is normally kept on
431 prep.ai.mit.edu and is available for anonymous FTP. See the files
432 etc/DISTRIB and etc/FTP for more information. (To get copies of these
433 files, see question 16.)
434
43520: Where can I get the latest VM, Supercite, GNUS, Calc, Calendar, or Patch?
436
437 1. VM:
438
439 Author: Kyle Jones <kyle@xanth.cs.odu.edu>
440
441 Mailing lists: info-vm-request@uunet.uu.net
442 info-vm@uunet.uu.net
443 bug-vm-request@uunet.uu.net
444 bug-vm@uunet.uu.net
445
446 Anonymous FTP:
447
448 Last released version: 4.41
449 site: tut.cis.ohio-state.edu
450 file: /pub/gnu/vm/vm-4.41.tar.Z
451
452 Beta test version: 5.18
453 site: abcfd20.larc.nasa.gov
454 directory: /pub/vm
455
456 2. Supercite:
457
458 Author: Barry Warsaw <warsaw@warsaw.nlm.nih.gov>
459
460 Latest version: 2.1
461
462 Mailing lists: supercite@warsaw.nlm.nih.gov
463 supercite-request@warsaw.nlm.nih.gov
464
465 Anonymous FTP:
466 site: durer.cme.nist.gov [129.6.32.4]
467 files:/pub/gnu/elisp/supercite-2.1.shar.0# (where # is replaced by 1 or 2)
468
469 NOTE: Superyank is an old version of Supercite.
470
471 3. GNUS:
472
473 Author: Masanobu Umeda
474
475 Latest version: 3.13
476
477 Anonymous FTP:
478 site: tut.cis.ohio-state.edu
479 files: /pub/gnu/gnus/3.13.##-of-11.Z (where ## is replaced by 00 -- 11)
480
481 4. Calc:
482
483 Author: Dave Gillespie <daveg@csvax.cs.caltech.edu>
484
485 Latest version: 1.06
486
487 Anonymous FTP:
488 site: csvax.cs.caltech.edu [131.215.131.131]
489 or any comp.sources.misc archive
490
491 5. Calendar/Diary
492
493 Author: Ed Reingold <reingold@cs.uiuc.edu>
494
495 Latest version: 4
496
497 E-mail:
498 Subject: send-emacs-cal
499 body: your best internet e-mail address
500
501 6. Patch
502
503 Author: Larry Wall <lwall@jpl-devvax.jpl.nasa.gov>
504
505 Latest version: 2.0 patchlevel 12
506
507 Anonymous FTP:
508 site: any comp.sources.unix archive
509
510 or, for Europeans:
511
512 site: archive.cs.ruu.nl [131.211.80.5]
513 file: /pub/UNIX/patch-2.0.tar.Z
514
51521: How do I install a piece of Texinfo documentation?
516
517 First create Info files from the Texinfo files with M-x
518 texinfo-format-buffer. There is also a program called "makeinfo" that
519 provides better error checking and runs faster. Currently, it comes
520 with the Emacs Lisp manual (which comes on the GNU Emacs tape).
521
522 For information about the Texinfo format, read the Texinfo manual which
523 comes with Emacs. This manual also comes installed in Info format, so
524 you can read it online.
525
526 Neither texinfo-format-buffer nor the makeinfo program install the
527 resulting Info files in Emacs's Info tree. To install Info files:
528
529 1. Move the files to the "info" directory in the installed Emacs
530 distribution. See question 6 if you don't know where that
531 is.
532
533 2. Edit the file info/dir in the installed Emacs distribution, and add a
534 line for the top level node in the Info package that you are
535 installing.
536
53722: What is the real legal meaning of the GNU copyleft?
538
539 RMS writes:
540
541 The legal meaning of the GNU copyleft is less important than the spirit,
542 which is that Emacs is a free software project and that work pertaining
543 to Emacs should also be free software. "Free" means that all users have
544 the freedom to study, share, change and improve Emacs. To make sure
545 everyone has this freedom, pass along source code when you distribute
546 any version of Emacs or a related program, and give the recipients the
547 same freedom that you enjoyed.
548
549 If you still want to find out about the legal meaning of the copyleft,
550 please ask yourself if this means you are not paying attention to the
551 spirit.
552
55323: What are appropriate messages for gnu.emacs.help/gnu.emacs.bug/comp.emacs
554 etc.?
555
556 The file etc/MAILINGLISTS discusses the purpose of each GNU
557 mailing-list. (See question 16 on how to get a copy.) For
558 those which are gatewayed with newsgroups, it lists both the newsgroup
559 name and the mailing list address.
560
561 comp.emacs is for discussion of Emacs programs in general. This
562 includes GNU Emacs along with various other implementations like JOVE,
563 MicroEmacs, Freemacs, MG, Unipress, CCA, etc.
564
565 Many people post GNU Emacs questions to comp.emacs because they don't
566 receive any of the gnu.* newsgroups. Arguments have been made both for
567 and against posting GNU-Emacs-specific material to comp.emacs. You have
568 to decide for yourself.
569
57024: Should I send questions directly to people who post a lot on the net,
571 instead of posting myself?
572
573 I don't know about the others, but please don't send such messages to me
574 just because you don't want to disturb a lot of people. Send messages
575 to individuals that concern things that individual has written.
576
577
578
579GNU Emacs, all its Variants, and other Editors
580
58125: Where does the name "Emacs" come from?
582
583 EMACS originally was an acronym for Editor MACroS. The first Emacs was
584 a set of macros written by Richard Stallman for the editor TECO (Tape
585 Editor and COrrector {Text Editor and COrrector?}) on a PDP-10.
586 (Amusing fact: many people have told me that TECO code looks a lot like
587 line noise.)
588
58926: What is the latest version of GNU Emacs?
590
591 GNU Emacs 18.55. GNU Emacs 18.56 is coming out with some bug fixes, but
592 no additional functionality.
593
59427: When will GNU Emacs 19 be available?
595
596 Good question, I don't know. For that matter, neither do the
597 developers. It will undoubtedly be available sometime in the 1990s.
598
59928: What will be different about GNU Emacs 19?
600
601 From the latest "GNU's Bulletin":
602
603 Version 19 approaches release with a host of new features: before and
604 after change hooks; X selection processing (including CLIPBOARD
605 selections); scrollbars; support for European character sets; floating
606 point numbers; per-buffer mouse commands; interfacing with the X
607 resource manager; mouse-tracking; Lisp-level binding of function keys;
608 and multiple X windows (`screens' to Emacs).
609
610 Thanks go to Alan Carroll and the people who worked on Epoch for
611 generating initial feedback to a multi-windowed Emacs. Emacs 19
612 supports two styles of multiple windows, one with a separate screen for
613 the minibuffer, and another with a minibuffer attached to each screen.
614
615 More features of Version 19 are buffer allocation, which uses a new
616 mechanism capable of returning storage to the system when a buffer is
617 killed, and a new input system---all input now arrives in the form of
618 Lisp objects.
619
620 Other features being considered for Version 19 include:
621
622 * Associating property lists with regions of text in a buffer.
623 * Multiple font, color, and pixmaps defined by those properties.
624 * Different visibility conditions for the regions, and for the various
625 windows showing one buffer.
626 * Incremental syntax analysis for various programming languages.
627 * Hooks to be run if point or mouse moves outside a certain range.
628 * Source-level debugging for Emacs Lisp.
629 * Incrementally saving undo history in a file, so that recover-file also
630 reinstalls buffer's undo history.
631 * Static menu bars, and better pop-up menus.
632 * A more sophisticated emacsclient/server model, which would provide
633 network transparent Emacs widget functionality.
634
635 Also, Emacs 19 will have a Emacs Lisp source code debugger.
636
63729: Is there an Emacs that has better mouse and X window support?
638
639 Emacs 18 has some limited X Window System support, but there are
640 problems. Emacs 19 will have amazing mouse and window support. Right
641 now, there is a modified version of Emacs 18.55 called "Epoch" which has
642 greatly improved mouse and window support. The latest version of Epoch
643 is available via:
644
645 Anonymous FTP:
646 site: cs.uiuc.edu
647 directory: pub/epoch-files/epoch
648 file: epoch-3.2b (b stands for beta)
649
650 NOTE: Epoch only works with the X Window System; it does not work on
651 ordinary terminals.
652
65330: How do I get Emacs for my PC?
654
655 GNU Emacs won't run on a PC directly under MS-DOS. There have been
656 reports of people running GNU Emacs under a special program under MS-DOS
657 on 286 or 386 machines, but I don't know the details.
658
659 You can try a variety of similar programs such as MG, MicroEmacs,
660 Freemacs, etc.
661
662 Russ Nelson <nelson@sun.soe.clarkson.edu>, the author, describes
663 Freemacs:
664
665 * Freemacs is free, and it was designed from the start to be
666 programmable.
667 * Freemacs is the only IBM-PC editor that tries to be like GNU Emacs.
668 * Freemacs can only edit files less than 64K in length.
669 * Freemacs doesn't have undo.
670
671 Carl Witty <cwitty@cs.stanford.edu> writes about Freemacs:
672
673 Better is Freemacs, which follows the tradition of ITS and GNU Emacs
674 by having an full, turing-complete extension language which is
675 incompatible with everything else. In fact, it's even closer to ITS
676 Emacs than GNU Emacs is, because Mint (Freemacs' extension language)
677 is absolutely illegible without weeks of study, much like TECO.
678
679 You can get Freemacs several ways:
680
681 1. Anonymous FTP:
682 site: simtel20.army.mil, directory: PD:<MSDOS.FREEMACS>
683 site: grape.ecs.clarkson.edu [128.153.13.196], directory: /e/freemacs
684
685 2. E-mail:
686 address: archive-server@sun.soe.clarkson.edu, or
687 archive-server%sun.soe@omnigate (BITNET), or
688 {smart-host}!sun.soe.clarkson.edu!archive-server (UUCP)
689 body: help
690
691 3. Snail mail:
692 address: Russell Nelson, 11 Grant St., Potsdam, NY 13676
693 Send $15 copying fee, and specify preferred floppy disk format:
694 5.25", 1.2 Meg, or 5.25", 360K, or 3.50", 720K
695
696 I don't know much about MicroEmacs. All I know is that the latest
697 version is 3.10 and it is available via:
698
699 Anonymous FTP:
700 site: durer.cme.nist.gov
701
702 Another Emacs for small machines is Jove (Jonathan's Own Version of
703 Emacs). The latest version is 4.9. It is available via:
704
705 Anonymous FTP:
706 sites: hipl.psych.nyu.edu, cs.toronto.edu, cayuga.cs.rochester.edu
707
708 Yet another Emacs is "mg", which used to stand for MicroGNUEmacs, but
709 now just stands for "mg". It is available via:
710
711 Anonymous FTP:
712 site: snow.white.toronto.edu
713
71431: Where can I get Emacs for my Atari ST?
715
716 The latest version for the ST is available via:
717
718 Anonymous FTP:
719 site: cs.uni-sb.de [134.96.7.254]
720 directory: /pub/atari/emacs
721
72232: Where can I get Emacs with NeWS support?
723
724 Chris Maio's NeWS support package for GNU Emacs is available via:
725
726 Anonymous FTP:
727 site: columbia.edu
728 file: /pub/ps-emacs.tar.Z
729
730 site: tut.cis.ohio-state.edu
731 file: /pub/gnu/emacs/ps-emacs.tar.Z
732
733
734
735Binding Keys to Commands
736
73733: Why does my key binding fail?
738
739 Most likely, it failed because "ESC [" was already defined. Evaluate
740 this form first:
741
742 (define-key esc-map "[" nil)
743
74434: Why doesn't this [terminal or window-system setup] code work in my
745 .emacs file, but it works just fine after Emacs starts up?
746
747 This is because you're trying to do something in your .emacs file that
748 needs to be postponed until after the terminal/window-system setup code
749 is loaded. This is a result of the order in which things are done
750 during the startup of Emacs.
751
752 In order to postpone the execution of Emacs Lisp code until after the
753 terminal/window-system setup, set the value of the variable
754 term-setup-hook or window-setup-hook to be a function which does what
755 you want.
756
757 See question 72 for a complete explanation of what Emacs
758 does every time it is started.
759
760 Here is a simple example of how to set term-setup-hook:
761
762 (setq term-setup-hook
763 (function
764 (lambda ()
765 (if (string-match "^vt220" (or (getenv "TERM") ""))
766 ;; Make vt220's "Do" key behave like M-x:
767 (define-key CSI-map "29~" 'execute-extended-command)))))
768
76935: How do I use function keys under X Windows?
770
771 If compiled on a Sun, Emacs recognizes the function keys that are
772 normally on a Sun keyboard, and you can bind them the same way you
773 normally bind Sun keys. Each function key will generate a key sequence
774 that looks like "ESC [ ### z", where ### is replaced by a number.
775
776 If not compiled on a Sun, the function keys will appear to Emacs in a
777 way remarkably similar to the keys of a VT220 terminal. Each function
778 key will generate a key sequence that looks like "ESC [ ### ~".
779
780 For the complete list of the numbers which are generated by the function
781 keys, look in the file src/x11term.c.
782
783 However, this may be inadequate for you if you have function keys Emacs
784 doesn't know about. Johan Vromans <jv@mh.nl> explains:
785
786 There are a number of tricks that can be helpful. The most elegant
787 solution, however, is to use the function "x-rebind-key". This function
788 is commented out in the source for good reasons --- it's buggy.
789
790 It is rather easy to replace this function with the function
791 epoch:rebind-key from the Epoch distribution.
792
793 After implementing this, all keyboard keys can be configured to send
794 user definable sequences, e.g.
795
796 (x-rebind-key "KP_F1" 0 "\033OP")
797
798 This will have the keypad key PF1 send the sequence \eOP, just like an
799 ordinary VTxxx terminal.
800
801 Another method is to handle the keys in the C source. Although this may
802 be slightly more efficient, it is much less flexible.
803
804 Finally, some people have established a convention to have the special
805 keys send a sequence of characters that indicate the key and its
806 modifiers instead of a plain escape sequence. This is also a good
807 method. The advantage of sending the plain escape sequences is that you
808 require only one setup for Emacs running under X and on normal
809 terminals, e.g.
810
811 (x-rebind-key "KP_F1" 0 "\033OP")
812
813 will have key PF1 send \eOP, and, probably in another setup file:
814
815 (global-set-key "\eOP" 'specific-function)
816
817 to bind PF1 to a function. The last statement applies for normal VTxxx
818 terminal also.
819
82036: How do I tell what characters my function keys emit?
821
822 Use this function by Randal L. Schwartz <merlyn@iwarp.intel.com>:
823
824 (defun see-chars ()
825 "Displays characters typed, terminated by a 3-second timeout."
826 (interactive)
827 (let ((chars "")
828 (inhibit-quit t))
829 (message "Enter characters, terminated by 3-second timeout.")
830 (while (not (sit-for 3))
831 (setq chars (concat chars (list (read-char)))
832 quit-flag nil)) ; quit-flag maybe set by C-g
833 (message "Characters entered: %s" (key-description chars))))
834
835
836
837Problems with Key Bindings and Input
838
83937: Why does Emacs spontaneously go into "I-search:" mode?
840
841 Your terminal (or something between your terminal and the computer) is
842 sending C-s and C-q for flow control, and Emacs is receiving these
843 characters and interpreting them as commands. (The C-s character
844 normally invokes the isearch-forward command.)
845
846 For a more detailed discussion, read the file PROBLEMS in the Emacs
847 distribution.
848
84938: What do I do if my terminal is sending C-s and C-q for flow control and
850 I can't disable it?
851
852 Use this piece of Emacs Lisp:
853
854 (set-input-mode nil t)
855
85639: How do I make Emacs use C-s and C-q for flow control instead of for
857 commands?
858
859 Same answer as previous question.
860
86140: How do I use commands bound to C-s and C-q (or any key) if these keys
862 are filtered out?
863
864 I suggest swapping C-s with C-\ and C-q with C-^:
865
866 (swap-keys ?\C-s ?\C-\\)
867 (swap-keys ?\C-q ?\C-^)
868
869 See question 41 for the implementation of swap-keys.
870
87141: How do I "swap" two keys?
872
873 When Emacs receives a character, you can make Emacs behave as though it
874 received another character by setting the value of
875 keyboard-translate-table. The following Emacs Lisp will do this for
876 you, allowing you to "swap" keys.
877
878 WARNING: the value of C-g (7) is hard coded in several places both
879 before and after the translation specified by keyboard-translate-table
880 is carried out. Thus, swapping C-g with another key may cause problems;
881 rebinding C-g may also cause problems. (Well, I've never done it, so I
882 don't know for sure.)
883
884 (defun swap-keys (key1 key2)
885 "Swap keys KEY1 and KEY2 using map-key."
886 (map-key key1 key2 t)
887 (map-key key2 key1))
888
889 (defvar map-keys-alist nil
890 "Association list of key mappings currently in effect.
891 If (FROM . TO) is an element, that means key FROM is currently mapped to TO.")
892
893 (defun map-key (from to &optional no-update)
894 "Make key FROM behave as though key TO was typed instead.
895 If optional argument NO-UPDATE is non-nil, the key-mapping does not take
896 effect until a subsequent map-key or unmap-key."
897 (let ((alist-entry (assq from map-keys-alist)))
898 (if alist-entry
899 (setcdr alist-entry to)
900 (setq map-keys-alist (cons (cons from to) map-keys-alist))))
901 (or no-update (map-keys-update)))
902
903 (defun unmap-key (key)
904 "Undo any mapping of key KEY."
905 (setq map-keys-alist (delq (assq key map-keys-alist) map-keys-alist))
906 (map-keys-update))
907
908 ;; Makes keyboard-translate-table reflect the key mappings in
909 ;; map-keys-alist.
910
911 (defun map-keys-update ()
912 (if (null map-keys-alist)
913 ;; Emacs runs fasted if keyboard-translate-table is nil
914 (setq keyboard-translate-table nil)
915 (let ((max-key-mapped
916 ;; Find the mapped key with largest value
917 (apply 'max
918 (mapcar
919 (function
920 (lambda (x)
921 (car x)))
922 map-keys-alist)))
923 (i 0))
924 ;; keyboard-translate-table doesn't have to be any longer than
925 ;; necessary. This speeds up Emacs.
926 (setq keyboard-translate-table (make-string (1+ max-key-mapped) 0))
927 (while (<= i max-key-mapped)
928 (aset keyboard-translate-table i (or (cdr (assq i map-keys-alist)) i))
929 (setq i (1+ i))))))
930
93142: Why does the "Backspace" key invoke help?
932
933 The Backspace key (on every keyboard I've used) sends ASCII code 8. C-h
934 sends the same code. In Emacs by default C-h invokes "help-command".
935 The easiest solution to this problem is to use C-h (and Backspace) for
936 help and DEL (the Delete key) for deleting the previous character.
937
938 For some people this solution may be problematic:
939
940 1. They normally use Backspace outside of Emacs for deleting the
941 previous character typed. This can be solved by making DEL be the
942 command for deleting the previous character outside of Emacs. This
943 command will do this on many Unix systems:
944
945 stty erase ^?
946
947 2. The person may prefer using the Backspace key for deleting the
948 previous character because it is more conveniently located on their
949 keyboard or because they don't even have a separate Delete key. In
950 this case, the best solution is to swap C-h and DEL:
951
952 (swap-keys ?\C-h ?\C-?)
953
954 See question 41 for the implementation of swap-keys.
955
95643: How do I type DEL on PC terminal emulators?
957
958 Someone whose name I forgot wrote:
959
960 Most PCs have deficient keyboards that don't have both Backspace and
961 Delete keys. Whether C-h (backspace) or DEL is generated by the
962 "Backspace" key varies from one terminal emulator to another. If you're
963 lucky, you can reconfigure the keyboard so that it generates DEL. If
964 not, you will have to hunt to figure out what keystroke will do it ---
965 possibilities include various shifted and controlled versions of
966 "Backspace", the "Del" key on the numeric keypad (which might depend on
967 "Shift" or "NumLock"), or perhaps C-? (Control-?).
968
969 If this is too hard, you may want to swap the delete key with some other
970 key. See question 42.
971
972
973
974Building/Installing/Porting Emacs and Machine/OS-Specific Bugs:
975
97644: Why do I get an "f68881_used undefined" error, when I build Emacs on my
977 Sun 3?
978
979 Barry A. Warsaw <warsaw@cme.nist.gov> writes:
980
981 Some of the code that is being linked on the "ld" line of emacs'
982 build command has been compiled with the -f68881 option. Most
983 common reason is that you're linking with X libraries which were
984 built with -f68881 option set. You need to either remove all
985 dependencies to the 68881 (may mean a recompile of the X libraries
986 with -fswitch or -fsoft option), or you need to link emacs with
987 the 68881 startup file /usr/lib/Mcrt1.o. Make this change to
988 src/ymakefile:
989
990 change: #define START_FILES crt0.o
991 to: #define START_FILES crt0.o /usr/lib/Mcrt1.o
992
993 The order of these start files is critical.
994
99545: Why does Emacs crash under SunOS 4.1?
996
997 Under SunOS 4.1, Emacs dies with this message:
998
999 Fatal error (6).Abort
1000
1001 There is a bug in the "localtime" routine supplied with SunOS 4.1.
1002 A private function called by tzsetwall zeroes the byte just past an
1003 eight byte region it mallocs. This corrupts GNU malloc's memory pool.
1004
1005 Put "#define SYSTEM_MALLOC" in src/config.h.
1006
1007 Or, for the purists:
1008
1009 Put "#define SUNOS_LOCALTIME_BUG" in src/config.h and apply the following
1010 patch to src/malloc.c.
1011
1012 (Patch by Eirik Fuller <eirik@elf.tn.cornell.edu>.)
1013
1014 >*** malloc.c~ Fri Apr 7 22:12:10 1989
1015 >--- malloc.c Tue May 8 07:07:22 1990
1016 >***************
1017 >*** 476,482 ****
1018 >--- 476,487 ----
1019 > multiple of 8, then figure out which nestf[] area to use.
1020 > Both the beginning of the header and the beginning of the
1021 > block should be on an eight byte boundary. */
1022 >+ #ifdef SUNOS_LOCALTIME_BUG
1023 >+ /* SunOS 4.1 localtime scribbles on the ninth byte. */
1024 >+ nbytes = (n + ((sizeof *p + 15) & ~15) + EXTRA + 15) & ~15;
1025 >+ #else
1026 > nbytes = (n + ((sizeof *p + 7) & ~7) + EXTRA + 7) & ~7;
1027 >+ #endif
1028 > {
1029 > register unsigned int shiftr = (nbytes - 1) >> 2;
1030 >
1031
103246: Why does Emacs occasionally cause segmentation faults and machine
1033 panics on my DECstation 3100?
1034
1035 Bruce Cole <cole@dip.cs.wisc.edu> writes:
1036
1037 > We're running Emacs 18.54 on an Ultrix Risc DECsystem 5400. Three
1038 > times we've had the machine hang with the following message:
1039 >
1040 > panic: tblmod on invalid pte
1041 >
1042 > Ultrix support tells us this is caused by Emacs. Has anyone
1043 > experienced this? DEC says it only happens on RISC boxes.
1044
1045 This is due to a MIPS specific Ultrix kernel bug. I sent DEC a
1046 description of the bug with a bug fix. The Kernel bug manifests itself
1047 with Emacs since Emacs uses a non-standard data start address on Ultrix
1048 MIPS machines.
1049
1050 I haven't often seen Emacs cause MIPS machines to panic. Usually you
1051 just see one of the following errors when you try to start up Emacs:
1052
1053 segmentation fault (core dumped)
1054 emacs: Bad address
1055 Out of memory
1056 data size rlimit exceeded, pid 6523, process tcsh (for example)
1057
1058 Until DEC fixes their kernel, you can avoid the bug by changing the data
1059 start address used by Emacs.
1060
1061 > I have built two newer versions of GNU Emacs and it still happens. I
1062 > should also mention that these faults happen quite rarely to some
1063 > users (I may see it once a month), while other users see it a few
1064 > times a week or even daily!
1065
1066 The problem only occurs when a MIPS machine is doing a lot of paging.
1067 Users who don't cause their workstation to page will not see this
1068 problem.
1069
1070 Patch to GNU Emacs 18.55:
1071
1072 >*** m-pmax.h Thu Jun 8 11:53:55 1989
1073 >--- m-pmax.h.new Mon Jul 9 10:21:21 1990
1074 >***************
1075 >*** 1,3 ****
1076 >--- 1,7 ----
1077 > #include "m-mips.h"
1078 > #undef LIBS_MACHINE
1079 > #undef BIG_ENDIAN
1080 >+ #undef LD_SWITCH_MACHINE
1081 >+ #undef DATA_START
1082 >+ #define DATA_START 0x10000000
1083 >+ #define DATA_SEG_BITS 0x10000000
1084
108547: How do I get Emacs running on VMS under DECwindows?
1086
1087 Hal R. Brand <BRAND@addvax.llnl.gov> is said to have a VMS save set with
1088 a ready-to-run VMS version of Emacs for X Windows. It is available via:
1089
1090 Anonymous FTP:
1091 site: addvax.llnl.gov
1092
1093 Johan Vromans <jv@mh.nl> writes:
1094
1095 Getting Emacs to run on VMS with DECwindows requires a number of changes
1096 to the sources. Fortunately this has been done already. Joshua Marantz
1097 <josh@viewlogic.com> did most of the work for Emacs 18.52, and the mods
1098 were ported to 18.55 by Johan Vromans <jv@mh.nl>. Also included is the
1099 handling of DEC's LK201 keyboard. You need to apply the changes to a
1100 fresh Emacs 18.55 distribution on a Unix system, and then you can copy
1101 the sources to VMS to perform the compile/link/build.
1102
1103 The set of changes have been posted a number of times three times the
1104 last 12 months, so they should be widely available.
1105
110648: Why won't src/alloc.c compile on a SPARCstation?
1107
1108 {Could someone send me a better description of the symptoms ... Does it
1109 really not compile, or does it refuse to link, or does it die when it's
1110 run?}
1111
1112 An object in src/alloc.c is declared as an array of char. However, on a
1113 SPARCstation, this object must be aligned on a longword boundary.
1114 gcc will align this object not on a longword boundary because it thinks
1115 this is ok because the object is an array of char.
1116
1117 Here is a solution:
1118
1119 (Patch from the Epoch source code.)
1120
1121 >*** dist-18.55.dist/src/alloc.c Mon Feb 13 05:23:35 1989
1122 >--- dist-18.55/src/alloc.c Mon Nov 27 23:30:13 1989
1123 >***************
1124 >*** 665,673 ****
1125 > #define NSTATICS 200
1126 >
1127 >- char staticvec1[NSTATICS * sizeof (Lisp_Object *)] = {0};
1128 >-
1129 > int staticidx = 0;
1130 >
1131 > #define staticvec ((Lisp_Object **) staticvec1)
1132 >
1133 > /* Put an entry in staticvec, pointing at the variable whose address is given */
1134 >--- 665,676 ----
1135 > #define NSTATICS 200
1136 >
1137 > int staticidx = 0;
1138 >
1139 >+ #ifdef __GNUC__
1140 >+ Lisp_Object *staticvec[NSTATICS] = {0};
1141 >+ #else
1142 >+ char staticvec1[NSTATICS * sizeof (Lisp_Object *)] = {0};
1143 > #define staticvec ((Lisp_Object **) staticvec1)
1144 >+ #endif
1145 >
1146 > /* Put an entry in staticvec, pointing at the variable whose address is given */
1147
1148 {Does anyone understand why one might want to declare staticvec as an
1149 array of char instead of an array of LispObject?}
1150
115149: Why do shells started from Emacs suspend themselves under SunOS 4.1?
1152
1153 In SunOS 4.1, when subprocesses are started by an Emacs process started
1154 by "rsh", the process stops with a message like this:
1155
1156 Process shell stopped (tty input)
1157
1158 SunOS 4.1 uses the POSIX standard's specification for job control.
1159 Basically, a process must be a session leader to acquire a new
1160 controlling terminal.
1161
1162 A quick fix is to run Emacs as "/usr/etc/setsid emacs" instead.
1163
1164 To fix it in Emacs, use this patch:
1165
1166 (Patch by Eirik Fuller <eirik@elf.tn.cornell.edu>.)
1167
1168 >*** /tmp/,RCSt1a12635 Fri Jul 6 11:29:10 1990
1169 >--- process.c Sat Jun 16 14:04:55 1990
1170 >***************
1171 >*** 1031,1036 ****
1172 >--- 1031,1039 ----
1173 > int j = open ("/dev/tty", O_RDWR, 0);
1174 > ioctl (j, TIOCNOTTY, 0);
1175 > close (j);
1176 >+ #ifndef USG
1177 >+ setpgrp (0, 0);
1178 >+ #endif
1179 > }
1180 > #endif /* TIOCNOTTY */
1181 >
1182
118350: Why does Emacs crash from a bus error in XLookupString under OpenLook?
1184
1185 The Sun OpenLook libraries use the XComposeStatus parameter on
1186 XLookupString for composing key sequences. I'm told this is actually
1187 supposed to be an optional parameter.
1188
1189 (Patch by David J. MacKenzie <djm@eng.umd.edu>.)
1190
1191 >*** dist-18.55.dist/src/x11term.c Wed Aug 2 21:56:42 1989
1192 >--- dist-18.55/src/x11term.c Fri Jul 13 19:22:32 1990
1193 >***************
1194 >*** 1213,1216 ****
1195 >--- 1213,1218 ----
1196 > #endif /* not sun */
1197 >
1198 >+ static XComposeStatus status;
1199 >+
1200 > internal_socket_read(bufp, numchars)
1201 > register unsigned char *bufp;
1202 >***************
1203 >*** 1223,1227 ****
1204 > BLOCK_INPUT_DECLARE ();
1205 > XEvent event;
1206 >- XComposeStatus status;
1207 > KeySym keysym;
1208 >
1209 >--- 1225,1228 ----
1210 >***************
1211 >*** 1330,1334 ****
1212 > nbytes = XLookupString (&event,
1213 > mapping_buf, 20, &keysym,
1214 >! 0);
1215 > /* Someday this will be unnecessary as we will
1216 > be able to use XRebindKeysym so XLookupString
1217 >--- 1331,1335 ----
1218 > nbytes = XLookupString (&event,
1219 > mapping_buf, 20, &keysym,
1220 >! &status);
1221 > /* Someday this will be unnecessary as we will
1222 > be able to use XRebindKeysym so XLookupString
1223
122451: Why doesn't "C-c C-c" interrupt subprocesses under HP/UX?
1225
1226 Paul Stravers <stravers@dutentb.tudelft.nl> writes:
1227
1228 In HP/UX we can (must) combine the two distinct calls
1229 1. ioctl (fildes, TIOCGPGRP, &gid);
1230 2. kill (-gid, signo);
1231 into the single call
1232 1+2. ioctl (fildes, TIOCSIGSEND, signo);
1233
1234 This is apparently the case under at least HP/UX versions 6.5 and 7.0.
1235
1236 Here is a set of patches courtesy of Piet van Oostrum <piet@cs.ruu.nl>
1237 that fixes these problems:
1238
1239 1. Signals to child processes work now (like the C-c C-c mentioned above)
1240
1241 2. When running under X11, C-g now correctly interrupts long-running commands
1242
1243 3. When running under X11, the window is redislayed even if emacs is doing
1244 some work (e.g. if your window becomes visible after being behind another
1245 one.
1246
1247 4. A nasty bug in alloca is solved. This bug is very infrequent unless you
1248 apply the other patches.
1249
1250 {I don't know for sure whether all of these patches are applicable only
1251 under HP/UX. Perhaps someone can tell me.}
1252
1253 >*** alloca.s.~1~ Fri Sep 15 16:35:39 1989
1254 >--- alloca.s Tue May 1 17:18:08 1990
1255 >***************
1256 >*** 92,103 ****
1257 > sub.l &MAXREG*4,%d1 # space for saving registers
1258 > mov.l %d1,%sp # save new value of sp
1259 > tst.b PROBE(%sp) # create pages (sigh)
1260 > move.w &MAXREG-1,%d0
1261 > copy_regs_loop: /* save caller's saved registers */
1262 >! mov.l (%a1)+,(%sp)+
1263 > dbra %d0,copy_regs_loop
1264 >! mov.l %sp,%d0 # return value
1265 >! mov.l %d1,%sp
1266 > add.l &-4,%sp # adjust tos
1267 > jmp (%a0) # rts
1268 > #endif /* new hp assembler */
1269 >--- 92,105 ----
1270 > sub.l &MAXREG*4,%d1 # space for saving registers
1271 > mov.l %d1,%sp # save new value of sp
1272 > tst.b PROBE(%sp) # create pages (sigh)
1273 >+ mov.l %a2,%d1 # save reg a2
1274 >+ mov.l %sp,%a2
1275 > move.w &MAXREG-1,%d0
1276 > copy_regs_loop: /* save caller's saved registers */
1277 >! mov.l (%a1)+,(%a2)+
1278 > dbra %d0,copy_regs_loop
1279 >! mov.l %a2,%d0 # return value
1280 >! mov.l %d1,%a2 # restore a2
1281 > add.l &-4,%sp # adjust tos
1282 > jmp (%a0) # rts
1283 > #endif /* new hp assembler */
1284
1285 >*** keyboard.c.~1~ Wed Apr 4 14:53:49 1990
1286 >--- keyboard.c Thu Apr 26 14:46:27 1990
1287 >***************
1288 >*** 719,724 ****
1289 >--- 719,773 ----
1290 > errno = old_errno;
1291 > }
1292 >
1293 >+ #ifdef HPUX
1294 >+ /* tells if an alarm is outstanding for emptying the socket */
1295 >+ int socket_alarm;
1296 >+
1297 >+ static void
1298 >+ empty_socket_interrupt()
1299 >+ {
1300 >+ int nread;
1301 >+ char buf[256 * BUFFER_SIZE_FACTOR];
1302 >+ register int i;
1303 >+ int old_errno = errno;
1304 >+
1305 >+ if (waiting_for_input) return;
1306 >+
1307 >+ fcntl (fileno (stdin), F_SETFL, O_NDELAY);
1308 >+
1309 >+ /* Read what is waiting. */
1310 >+
1311 >+ nread = (*read_socket_hook) (0, buf, sizeof buf);
1312 >+
1313 >+ #ifdef EBADSLT
1314 >+ if (nread == -1 && (errno == EAGAIN || errno == EBADSLT))
1315 >+ #else
1316 >+ if (nread == -1 && errno == EAGAIN)
1317 >+ #endif
1318 >+ nread = 0;
1319 >+
1320 >+ fcntl (fileno (stdin), F_SETFL, 0);
1321 >+
1322 >+ /* Scan the chars for C-g and store them in kbd_buffer. */
1323 >+ kbd_ptr = kbd_buffer;
1324 >+ for (i = 0; i < nread; i++)
1325 >+ {
1326 >+ kbd_buffer_store_char (buf[i]);
1327 >+ /* Don't look at input that follows a C-g too closely.
1328 >+ This reduces lossage due to autorepeat on C-g. */
1329 >+ if (buf[i] == Ctl ('G'))
1330 >+ break;
1331 >+ }
1332 >+
1333 >+ /* reestablish interrupt */
1334 >+ signal (SIGALRM, empty_socket_interrupt);
1335 >+ alarm (1);
1336 >+
1337 >+ errno = old_errno;
1338 >+ }
1339 >+
1340 >+ #endif /* HPUX */
1341 >+
1342 > /* read a character from the keyboard; call the redisplay if needed */
1343 > /* commandflag 0 means do not do auto-saving, but do do redisplay.
1344 > -1 means do not do redisplay, but do do autosaving.
1345 >***************
1346 >*** 733,738 ****
1347 >--- 782,794 ----
1348 > Lisp_Object tem;
1349 > extern request_echo ();
1350 >
1351 >+ #ifdef HPUX
1352 >+ if (socket_alarm) {
1353 >+ alarm (0);
1354 >+ socket_alarm = 0;
1355 >+ }
1356 >+ #endif
1357 >+
1358 > if ((c = unread_command_char) >= 0)
1359 > {
1360 > unread_command_char = -1;
1361 >***************
1362 >*** 869,874 ****
1363 >--- 925,938 ----
1364 > }
1365 > }
1366 >
1367 >+ #ifdef HPUX
1368 >+ if (read_socket_hook) {
1369 >+ socket_alarm = 1;
1370 >+ signal (SIGALRM, empty_socket_interrupt);
1371 >+ alarm (1);
1372 >+ }
1373 >+ #endif
1374 >+
1375 > return c;
1376 > }
1377 >
1378 >***************
1379 >*** 1094,1119 ****
1380 >
1381 > #else /* no FIONREAD */
1382 > #ifdef USG
1383 > if (kbd_count)
1384 > abort ();
1385 >
1386 > fcntl (fileno (stdin), F_SETFL, O_NDELAY);
1387 >! kbd_ptr = kbd_buffer;
1388 > if (read_socket_hook)
1389 >! {
1390 >! kbd_count = (*read_socket_hook) (0, kbd_buffer, sizeof kbd_buffer);
1391 >! }
1392 > else
1393 >! {
1394 >! kbd_count = read (fileno (stdin), kbd_buffer, sizeof kbd_buffer);
1395 >! }
1396 > #ifdef EBADSLT
1397 >! if (kbd_count == -1 && (errno == EAGAIN || errno == EBADSLT))
1398 > #else
1399 >! if (kbd_count == -1 && errno == EAGAIN)
1400 > #endif
1401 >! kbd_count = 0;
1402 > fcntl (fileno (stdin), F_SETFL, 0);
1403 > #else /* not USG */
1404 > you lose
1405 > #endif /* not USG */
1406 >--- 1158,1209 ----
1407 >
1408 > #else /* no FIONREAD */
1409 > #ifdef USG
1410 >+ char buf[256 * BUFFER_SIZE_FACTOR];
1411 >+ register int i;
1412 >+ #ifdef HPUX
1413 >+ int mask;
1414 >+ #endif
1415 >+
1416 > if (kbd_count)
1417 > abort ();
1418 >
1419 >+ #ifdef HPUX
1420 >+ if (socket_alarm)
1421 >+ mask = sigblock (sigmask (SIGALRM));
1422 >+ #endif
1423 >+
1424 > fcntl (fileno (stdin), F_SETFL, O_NDELAY);
1425 >!
1426 >! /* Read what is waiting. */
1427 > if (read_socket_hook)
1428 >! nread = (*read_socket_hook) (0, buf, sizeof buf);
1429 > else
1430 >! nread = read (fileno(stdin), buf, sizeof buf);
1431 > #ifdef EBADSLT
1432 >! if (nread == -1 && (errno == EAGAIN || errno == EBADSLT))
1433 > #else
1434 >! if (nread == -1 && errno == EAGAIN)
1435 > #endif
1436 >! nread = 0;
1437 >!
1438 > fcntl (fileno (stdin), F_SETFL, 0);
1439 >+
1440 >+ /* Scan the chars for C-g and store them in kbd_buffer. */
1441 >+ kbd_ptr = kbd_buffer;
1442 >+ for (i = 0; i < nread; i++)
1443 >+ {
1444 >+ kbd_buffer_store_char (buf[i]);
1445 >+ /* Don't look at input that follows a C-g too closely.
1446 >+ This reduces lossage due to autorepeat on C-g. */
1447 >+ if (buf[i] == Ctl ('G'))
1448 >+ break;
1449 >+ }
1450 >+
1451 >+ #ifdef HPUX
1452 >+ if (socket_alarm)
1453 >+ sigsetmask(mask);
1454 >+ #endif
1455 >+
1456 > #else /* not USG */
1457 > you lose
1458 > #endif /* not USG */
1459
1460 >*** x11term.h~ Fri Sep 15 15:20:26 1989
1461 >--- x11term.h Thu Apr 26 14:03:25 1990
1462 >***************
1463 >*** 11,17 ****
1464 >--- 11,22 ----
1465 > #define sigmask(no) (1L << ((no) - 1))
1466 > #endif
1467 >
1468 >+ #ifdef HPUX
1469 > #define BLOCK_INPUT_DECLARE() int BLOCK_INPUT_mask
1470 >+ #define BLOCK_INPUT() BLOCK_INPUT_mask = sigblock (sigmask (SIGALRM))
1471 >+ #define UNBLOCK_INPUT() sigsetmask (BLOCK_INPUT_mask)
1472 >+ #else /* not HPUX */
1473 >+ #define BLOCK_INPUT_DECLARE() int BLOCK_INPUT_mask
1474 > #ifdef SIGIO
1475 > #define BLOCK_INPUT() BLOCK_INPUT_mask = sigblock (sigmask (SIGIO))
1476 > #define UNBLOCK_INPUT() sigsetmask (BLOCK_INPUT_mask)
1477 >***************
1478 >*** 19,23 ****
1479 >--- 24,29 ----
1480 > #define BLOCK_INPUT()
1481 > #define UNBLOCK_INPUT()
1482 > #endif /* SIGIO */
1483 >+ #endif /* HPUX */
1484 >
1485 > #define CLASS "emacs" /* class id for GNU Emacs, used in .Xdefaults, etc. */
1486
1487 >*** process.c.orig Fri Sep 15 16:28:36 1989
1488 >--- process.c Fri Apr 20 13:17:06 1990
1489 >***************
1490 >*** 1057,1062 ****
1491 >--- 1057,1079 ----
1492 > signal (SIGHUP, SIG_DFL);
1493 > #endif
1494 > #endif /* HAVE_PTYS */
1495 >+
1496 >+ /* Give child clean slate for signals */
1497 >+ #ifdef SIGCHLD
1498 >+ #ifdef BSD4_1
1499 >+ sigrelse (SIGCHLD);
1500 >+ #else /* not BSD4_1 */
1501 >+ #ifdef HPUX
1502 >+ sigsetmask (0);
1503 >+ #endif /* HPUX */
1504 >+ #if defined (BSD) || defined (UNIPLUS)
1505 >+ sigsetmask (0);
1506 >+ #else /* ordinary USG */
1507 >+ signal (SIGCHLD, sigchld);
1508 >+ #endif /* ordinary USG */
1509 >+ #endif /* not BSD4_1 */
1510 >+ #endif /* SIGCHLD */
1511 >+
1512 > child_setup_tty (xforkout);
1513 > child_setup (xforkin, xforkout, xforkout, new_argv, env);
1514 > }
1515 >***************
1516 >*** 1413,1427 ****
1517 > if (read_kbd && kbd_count)
1518 > nfds = 0;
1519 > else
1520 >! #ifdef IBMRTAIX
1521 > nfds = select (MAXDESC, &Available, 0, 0, &timeout);
1522 > #else
1523 >- #ifdef HPUX
1524 >- nfds = select (MAXDESC, &Available, 0, 0, &timeout);
1525 >- #else
1526 > nfds = select (MAXDESC, &Available, 0, &Exception, &timeout);
1527 > #endif
1528 >- #endif
1529 > xerrno = errno;
1530 >
1531 > if (fix_screen_hook)
1532 >--- 1430,1440 ----
1533 > if (read_kbd && kbd_count)
1534 > nfds = 0;
1535 > else
1536 >! #if defined (IBMRTAIX) || defined (HPUX)
1537 > nfds = select (MAXDESC, &Available, 0, 0, &timeout);
1538 > #else
1539 > nfds = select (MAXDESC, &Available, 0, &Exception, &timeout);
1540 > #endif
1541 > xerrno = errno;
1542 >
1543 > if (fix_screen_hook)
1544 >***************
1545 >*** 1771,1776 ****
1546 >--- 1784,1790 ----
1547 > error ("Process %s is not active",
1548 > XSTRING (p->name)->data);
1549 >
1550 >+ #ifndef HPUX /* Can't get gid of tty's controlling session */
1551 > #ifdef TIOCGPGRP /* Not sure about this! (fnf) */
1552 > /* If we are using pgrps, get a pgrp number and make it negative. */
1553 > if (!NULL (current_group))
1554 >***************
1555 >*** 1785,1790 ****
1556 >--- 1799,1805 ----
1557 > the child itself heads the pgrp. */
1558 > gid = - XFASTINT (p->pid);
1559 > #endif /* not using pgrps */
1560 >+ #endif /* not HPUX */
1561 >
1562 > switch (signo)
1563 > {
1564 >***************
1565 >*** 1800,1805 ****
1566 >--- 1815,1827 ----
1567 > flush_pending_output (XFASTINT (p->infd));
1568 > break;
1569 > }
1570 >+
1571 >+ #ifdef HPUX
1572 >+ if (!NULL (current_group))
1573 >+ ioctl (XFASTINT (p->infd), TIOCSIGSEND, signo);
1574 >+ else
1575 >+ kill (XFASTINT (p->pid), signo);
1576 >+ #else /* not HPUX */
1577 > /* gid may be a pid, or minus a pgrp's number */
1578 > #ifdef BSD
1579 > /* On bsd, [man says] kill does not accept a negative number to kill a pgrp.
1580 >***************
1581 >*** 1808,1813 ****
1582 >--- 1830,1836 ----
1583 > #else /* Not BSD. */
1584 > kill (gid, signo);
1585 > #endif /* Not BSD. */
1586 >+ #endif /* Not HPUX */
1587 >
1588 > /* Put notices in buffers now, since it is safe now.
1589 > Because of this, we know that a process we have just killed
1590 >%
1591
1592 This is a separate patch to process.c, distinct from the immediately
1593 preceding one. Both should be applied.
1594
1595 >*** process.c.~1~ Fri Apr 20 13:17:06 1990
1596 >--- process.c Wed Oct 24 16:38:15 1990
1597 >***************
1598 >*** 1085,1095 ****
1599 > /* If the subfork execv fails, and it exits,
1600 > this close hangs. I don't know why.
1601 > So have an interrupt jar it loose. */
1602 >! signal (SIGALRM, create_process_1);
1603 >! alarm (1);
1604 >! if (forkin >= 0)
1605 >! close (forkin);
1606 >! alarm (0);
1607 > if (forkin != forkout && forkout >= 0)
1608 > close (forkout);
1609 >
1610 >--- 1085,1100 ----
1611 > /* If the subfork execv fails, and it exits,
1612 > this close hangs. I don't know why.
1613 > So have an interrupt jar it loose. */
1614 >!
1615 >! { int old_trap = signal (SIGALRM, create_process_1);
1616 >! int old_alarm = alarm (1);
1617 >! if (forkin >= 0)
1618 >! close (forkin);
1619 >! alarm (0);
1620 >! signal (SIGALRM, old_trap);
1621 >! /* don't bother with possible 1 sec loss */
1622 >! if (old_alarm) alarm (old_alarm);
1623 >! }
1624 > if (forkin != forkout && forkout >= 0)
1625 > close (forkout);
1626
162752: What should I do if I have trouble building Emacs?
1628
1629 RMS writes:
1630
1631 If you try to build Emacs and it does not run, the first thing to do is
1632 look in the file called PROBLEMS to see if a solution is given there.
1633
1634 If none is given, then please send a report by mail to
1635 bug-gnu-emacs@prep.ai.mit.edu. Please do not send it to
1636 help-gnu-emacs@prep.ai.mit.edu.
1637
1638 Sending to help-gnu-emacs (which has the effect of posting on
1639 gnu.emacs.help) is undesirable because it takes the time of an
1640 unnecessarily large group of people, most of whom are just users and
1641 have no idea how to fix these problem. bug-gnu-emacs reaches a much
1642 smaller group of people who are more likely to know what to do and have
1643 expressed a wish to receive more messages about Emacs than the others.
1644
1645Weird/Confusing Problems:
1646
164753: Does Emacs have problems with files larger than 8 Megs?
1648
1649 Most installed versions of GNU Emacs will use 24 bit signed integers
1650 (and 24 bit pointers!) internally. This limits the file size that Emacs
1651 can handle to 8388608 bytes.
1652
1653 Leonard N. Zubkoff <lnz@lucid.com> writes:
1654
1655 Putting the following two lines in src/config.h before compiling Emacs
1656 allows for 26 bit integers and pointers:
1657
1658 #define VALBITS 26
1659 #define GCTYPEBITS 5
1660
1661 See question 54 for an explanation.
1662
166354: Why does Emacs use 24 bit integers and pointers?
1664
1665 David Gillespie <daveg@csvax.cs.caltech.edu> writes:
1666
1667 Emacs is largely written in a dialect of Lisp; Lisp is a freely-typed
1668 language in the sense that you can put any value of any type into any
1669 variable, or return it from a function, and so on. So each value must
1670 carry a "tag" along with it identifying what kind of thing it is, e.g.,
1671 integer, pointer to a list, pointer to an editing buffer, and so on.
1672 Emacs uses standard 32-bit integers for data objects, taking the top 8
1673 bits for the tag and the bottom 24 bits for the value. So integers (and
1674 pointers) are somewhat restricted compared to true C integers and
1675 pointers.
1676
1677 Emacs uses 8-bit tags because that's a little faster on byte-oriented
1678 machines, but there are only really enough tags to require 6 bits. See
1679 question 53 to find how to recompile Emacs with 6-bit tags and
1680 26-bit integers and pointers if space is at a premium for you.
1681
168255: Why does Emacs start up using the wrong directory?
1683
1684 Most likely, you have an environment variable named PWD that is set to a
1685 value other than the name of your current directory. This is most
1686 likely caused by using two different shell programs. "ksh" and (some
1687 versions of) "csh" set and maintain the value of the PWD environment
1688 variable, but "sh" doesn't. If you start sh from ksh, change your
1689 current directory inside sh, and then start Emacs from inside sh, PWD
1690 will have the wrong value but Emacs will use this value. See question
1691 72.
1692
169356: How do I edit a file with a "$" in its name?
1694
1695 When entering a filename in the minibuffer, Emacs will attempt to expand
1696 a "$" followed by a word as an environment variable. To suppress this
1697 behavior, type "$$" instead.
1698
169957: Why does Shell Mode lose track of the shell's current directory?
1700
1701 Emacs has no way of knowing when the shell actually changes its
1702 directory. So it tries to guess by recognizing cd commands. A number
1703 of fixes and enhancements to Shell Mode have been written, check the
1704 Emacs Lisp Archive (question 14).
1705
170658: Why doesn't Emacs expand my aliases when sending mail?
1707
1708 First, you must separate multiple addresses with commas.
1709
1710 Emacs normally only reads the ".mailrc" file once per session, when you
1711 start to compose your first mail message. If you edit .mailrc, you can
1712 type "M-ESC (build-mail-aliases) RET" to make Emacs reread .mailrc.
1713
171459: Why doesn't setting default-directory always work?
1715
1716 There is a separate value of default-directory for each Emacs buffer.
1717 The value in the current buffer is the one that is used.
1718
171960: Why does my change to load-path not work?
1720
1721 If you added file names with tildes (~) in them to your load-path,
1722 you'll need to do something like this:
1723
1724 (setq-default load-path (mapcar 'expand-file-name load-path))
1725
172661: Why does the cursor always go to the wrong column when I move up or
1727 down one line?
1728
1729 You have inadvertently typed "C-x C-n" (set-goal-column) which sets the
1730 "goal-column" to the column where the cursor was. To undo this type
1731 "C-u C-x C-n".
1732
1733 If you make this mistake frequently, you might want to unbind this
1734 command by doing (define-key ctl-x-map "\C-n" nil).
1735
173662: Why don't the command line switches documented in the man page work?
1737
1738 The "man page", ie. the file etc/emacs.1, hasn't been updated in a
1739 while. The command line switches that it says work with X Windows are
1740 for X10. See question 72 for details on what switches are
1741 available using X11. {Would someone like to rewrite the man page? RMS
1742 asked me and I haven't had time yet.}
1743
174463: Why does gnus-Subject-mail-reply chop off the last character of the
1745 article headers?
1746
1747 There is a bug in some rnews functions that GNUS uses. Here is a patch:
1748
1749 (Patch supplied by Karl Kleinpaste <karl_kleinpaste@cis.ohio-state.edu>.)
1750
1751 >*** rnewspost.el.orig Thu Oct 5 10:32:47 1989
1752 >--- rnewspost.el Thu Oct 5 10:32:47 1989
1753 >***************
1754 >*** 252,258 ****
1755 > (save-restriction
1756 > (narrow-to-region (point-min) (progn (goto-line (point-min))
1757 > (search-forward "\n\n")
1758 >! (- (point) 2)))
1759 > (setq from (mail-fetch-field "from")
1760 > subject (mail-fetch-field "subject")
1761 > reply-to (mail-fetch-field "reply-to")
1762 >--- 252,258 ----
1763 > (save-restriction
1764 > (narrow-to-region (point-min) (progn (goto-line (point-min))
1765 > (search-forward "\n\n")
1766 >! (- (point) 1)))
1767 > (setq from (mail-fetch-field "from")
1768 > subject (mail-fetch-field "subject")
1769 > reply-to (mail-fetch-field "reply-to")
1770 >***************
1771 >*** 289,295 ****
1772 > ;@@ but rnews.el lacks support
1773 > (narrow-to-region (point-min) (progn (goto-char (point-min))
1774 > (search-forward "\n\n")
1775 >! (- (point) 2)))))
1776 > (setq from (mail-fetch-field "from")
1777 > news-reply-yank-from from
1778 > ;; @@ not handling old Title: field
1779 >--- 289,295 ----
1780 > ;@@ but rnews.el lacks support
1781 > (narrow-to-region (point-min) (progn (goto-char (point-min))
1782 > (search-forward "\n\n")
1783 >! (- (point) 1)))))
1784 > (setq from (mail-fetch-field "from")
1785 > news-reply-yank-from from
1786 > ;; @@ not handling old Title: field
1787 >***************
1788 >*** 365,371 ****
1789 > ;@@ but rnews.el lacks support
1790 > (narrow-to-region (point-min) (progn (goto-char (point-min))
1791 > (search-forward "\n\n")
1792 >! (- (point) 2)))))
1793 > (setq news-reply-yank-from (mail-fetch-field "from")
1794 > ;; @@ not handling old Article-I.D.: field
1795 > news-reply-yank-message-id (mail-fetch-field "message-id")))
1796 >--- 365,371 ----
1797 > ;@@ but rnews.el lacks support
1798 > (narrow-to-region (point-min) (progn (goto-char (point-min))
1799 > (search-forward "\n\n")
1800 >! (- (point) 1)))))
1801 > (setq news-reply-yank-from (mail-fetch-field "from")
1802 > ;; @@ not handling old Article-I.D.: field
1803 > news-reply-yank-message-id (mail-fetch-field "message-id")))
1804
180564: Why does Emacs hang with message "Unknown XMenu" with X11R4?
1806
1807 Many different X errors can produce this message. Here is the solution
1808 to one problem:
1809
1810 X11 Release 4 now enforces some conditions in the X protocol that were
1811 previously allowed to pass unnoticed. You need to put the X11R4 server
1812 into X11R3 bug compatibility mode for Emacs's Xmenu code to work. You
1813 can do this with the command "xset bc".
1814
181565: Why isn't the load average displayed by display-time?
1816
1817 The most likely cause of the problem is that "loadst" can't read the
1818 special file /dev/kmem. To properly install loadst, it should be either
1819 setuid to the owner of /dev/kmem, or is should be setgid to the group to
1820 which /dev/kmem belongs. In either case, /dev/kmem should be readable by
1821 its owner or its group, respectively.
1822
1823 Another possibility is that your version of Unix doesn't have the load
1824 average data available in /dev/kmem. Your version of Unix might have a
1825 special system call to retrieve this information (eg., inq_stats under
1826 UMAX).
1827
182866: Why doesn't GNUS work anymore via NNTP?
1829
1830 There is a bug in NNTP version 1.5.10, such that when multiple requests
1831 are sent to the NNTP server, the server only handles the first one before
1832 blocking waiting for more input which never comes.
1833
1834 You can work around the bug inside Emacs like this:
1835
1836 (setq nntp-maximum-request 1)
1837 (setq nntp-buggy-select t)
1838
1839 Or you could fix the NNTP server in one of these ways:
1840
1841 1. Test whether there is data in stdin's stdio buffer before calling
1842 "select" using something like "((fileptr)->_cnt > 0)". Best choice.
1843 2. Remove call to select by not defining "TIMEOUT" in "common/conf.h".
1844 3. Put "setbuf (stdin, NULL)" in the NNTP server in the right spot.
1845 This would be very inefficient.
1846 4. Rewrite the server to use an alarm instead of "select".
1847
184867: Why can't I paste a selection I made in Emacs into my xterm window?
1849
1850 A person whose name I lost writes:
1851
1852 The strange interaction between Emacs, xterm, and the cut buffers is
1853 because most xterm clients use selections instead of (well, superceding)
1854 cut buffers. If there is a selection around, xterms will use that
1855 instead of the cut buffer. Emacs doesn't know about selections, but you
1856 can convince xterm to always use the cut buffer instead of selections by
1857 adding this to your .Xdefaults:
1858
1859 ! Solution by Thomas Narten, should work under X11R3 and later
1860 ! GNU Emacs only copies to CUT_BUFFER0. xterm by default wants to paste
1861 ! from the PRIMARY selection.
1862 XTerm*VT100.Translations: #override \
1863 ~Meta <Btn2Up>: insert-selection(CUT_BUFFER0)
1864
1865
186668: Why does ispell sometimes ignore the local dictionary?
1867
1868 You need to update the version of ispell to 2.0.02. A patch is
1869 available via:
1870
1871 Anonymous FTP:
1872 site: tut.cis.ohio-state.edu
1873 file: /pub/gnu/ispell/patch2.Z
1874
1875 You also need to change a line in ispell.el from:
1876
1877 (defconst ispell-version "2.0.01") ;; Check against output of "ispell -v".
1878
1879 to:
1880
1881 (defconst ispell-version "2.0.02") ;; Check against output of "ispell -v".
1882
1883
1884
1885Configuring Emacs for yourself:
1886
188769: How do I set up a .emacs file properly?
1888
1889 I'm going to be sending out a sample .emacs file in a separate message
1890 later this month. It will be based largely on AT&T's sample .emacs
1891 file, which was sent to me by Dan Jacobson. In fact it might be
1892 identical.
1893
189470: How do you debug a .emacs file?
1895
1896 First start Emacs with the "-q" command line option. Then, in the
1897 *scratch* buffer, type the following:
1898
1899 (setq debug-on-error t) C-j
1900 (load-file "~/.emacs") C-j
1901
1902 (C-j stands for Control-J, ie., hold the control key and press J.)
1903
1904 If you have an error in your .emacs file, this will invoke the debugger
1905 when the error occurs. If you don't know how to use the debugger do
1906 (setq stack-trace-on-error t) instead.
1907
1908 WARNING: this will not discover errors caused by trying to do something
1909 that requires the terminal/window-system initialization code to have
1910 been loaded. See question 34.
1911
191271: How do I turn on abbrevs by default just in mode XXX?
1913
1914 Put this in your .emacs file:
1915
1916 (condition-case ()
1917 (read-abbrev-file nil t)
1918 (file-error nil))
1919
1920 (setq XXX-mode-hook
1921 (function
1922 (lambda ()
1923 (setq abbrev-mode t))))
1924
192572: What does Emacs do every time it starts up?
1926
1927 This question is not itself frequently asked, but helps to answer other
1928 questions.
1929
1930 Here is a complete explanation of the order in which things are done
1931 during startup.
1932
1933 1. These command line switches are handled, only if they appear before
1934 all other command line arguments, and only if they appear in this
1935 order:
1936
1937 "-map". Only under VMS. Instead of "undumping", under VMS the
1938 contents of a dump file are mapped over a section of memory (very
1939 quickly initializing lots of variables).
1940
1941 "-t". The next argument is treated as the name of a terminal to use
1942 instead of whatever is connected to the stdin, stdout, and stderr
1943 FILE pointers.
1944
1945 "-display" (synonym: "-d"). The next argument is treated as the
1946 name of an X Window System server with which to connect. This
1947 overrides the DISPLAY environment variable.
1948
1949 "-nw". This means don't connect to an X Window server even if the
1950 DISPLAY environment variable was set or the "-display" switch was
1951 specified. Instead, Emacs talks to a regular dumb terminal.
1952
1953 "-batch". Emacs is noninteractive. The variable "noninteractive"
1954 is t. This disables any full screen interaction either with a
1955 dumb terminal or with a window system. In addition, Emacs will
1956 die after processing all command line arguments.
1957
1958 All of Emacs's internal data structures are initialized between steps 2
1959 and 5.
1960
1961 2. The "*scratch*" buffer is created and its value of default-directory
1962 is set from the result of calling the "getwd" library routine.
1963 (getwd does what the "pwd" program does.)
1964
1965 3. If X11 is being used, Emacs determines the name under which it looks
1966 for X resource values. (I haven't checked how it does this under
1967 X10.)
1968
1969 1. If there is a "-rn" command line switch, it is handled now, no
1970 matter where it is on the command line. (Later it will be
1971 processed again and ignored.) The next argument is used as
1972 Emacs's resource name.
1973
1974 2. If the "-rn" switch was missing, Emacs looks for the WM_RES_NAME
1975 environment variable.
1976
1977 3. If neither of the previous two steps succeed, Emacs uses the
1978 filename with which it was invoked as its resource name.
1979
1980 4. If X11 is being used, these command line switches are handled now,
1981 no matter where they appear in the command line. (Under X10, they
1982 are not handled until step 13.) WARNING: this can cause strange
1983 interactions with the processing of the remaining command line
1984 arguments in step 13.
1985
1986 In addition, under both X11 and X10, X resources (ie. the stuff in
1987 an .Xdefaults file) are handled now. Command line switches take
1988 precedence over resources.
1989
1990 After each command line switch are given the equivalent resource
1991 names in this format: (X10 name / X11 instance name / X11 class name).
1992
1993 "-r". Reverse video. (ReverseVideo/reverseVideo/ReverseVideo)
1994 "-font" (synonym: "-fn"). Font. (BodyFont/font/Font)
1995 "-wn". Window name (X11 only). (/title/Title)
1996 "-in". Icon name (X11 only). (/iconName/Title)
1997 "-i". Use built-in icon bitmap. (BitMapIcon//)
1998
1999 "-b". Border width (in pixels).
2000 (BorderWidth/borderWidth/BorderWidth)
2001
2002 "-ib". Internal border width (in pixels) (default: 1).
2003 (/internalBorder/BorderWidth)
2004
2005 "-geometry" (synonym: "-w"). Window shape and size. "-geometry" is
2006 X11 only, but its synonym "-w" was available under X10.
2007 (/geometry/Geometry)
2008
2009 Color options only:
2010
2011 "-fg". Foreground color. (Foreground/foreground/Foreground)
2012 "-bg". Background color. (Background/background/Background)
2013 "-bd". Border color. (Border/borderColor/BorderColor)
2014 "-cr". Cursor color. (Cursor/cursorColor/Foreground)
2015 "-ms". Mouse pointer color. (Mouse/pointerColor/Foreground)
2016
2017 In addition, under X10, the resource "Keymap" was handled now.
2018
2019 5. If your Emacs isn't "dumped", the default Lisp libraries are
2020 "loaded" now.
2021
2022 6. Emacs enters a "recursive edit". The first time Emacs does a
2023 recursive edit, steps 7 through 15 are followed, and then Emacs
2024 enters its normal editing mode.
2025
2026 7. If the environment variable PWD exists, the value of
2027 default-directory in the *scratch* buffer is set to the value of
2028 PWD. This often causes problems and confusion when the value of PWD
2029 doesn't actually contain the pathname of the current directory.
2030
2031 8. Now the "-no-init-file" (synonym: "-q") and "-user" (synonym: "-u")
2032 command line switches are handled. They must follow the switches
2033 mentioned in step 1, and must precede any other command line
2034 arguments. Actually, both of these options can be specified;
2035 whichever is last on the command line wins.
2036
2037 9. The user's ".emacs" file is loaded now, if the -no-init-file option
2038 was not specified. If the -user option was specified, that user's
2039 .emacs file is loaded instead. A user's .emacs file is a file named
2040 ".emacs" in the user's "home" directory. If no such file exists,
2041 this step has no effect.
2042
2043 10. The system wide "default" file is loaded now, if the variable
2044 inhibit-default-init is nil. The user can set this variable in the
2045 .emacs file to skip this step.
2046
2047 11. If the *scratch* buffer still exists now, the value of
2048 initial-major-mode is called as a function in this buffer.
2049 Normally, this puts this buffer in Lisp Interaction mode.
2050
2051 12. Now the terminal/window-system setup file is loaded. The name of
2052 this file is determined as follows:
2053
2054 1. It starts with the value of term-file-prefix. Normally this is
2055 "term/", but the user can set it to another value. If this
2056 variable is nil, this entire step is skipped.
2057
2058 2. For a window system, the prefix is followed by the name of the
2059 value of the variable window-system, followed by "-win". For X
2060 Windows, this means the name is "term/x-win".
2061
2062 3. For a terminal, the prefix is followed by the value of the
2063 environment variable TERM, for example, "term/vt200". If Emacs
2064 cannot find such a file to load, it retries by stripping off
2065 suffixes that begin with a hyphen. For example, if TERM is
2066 "vt200-40", first Emacs will try "term/vt200-40", and if that
2067 fails it will try "term/vt200".
2068
2069 13. The rest of the command line arguments are handled at this point, in
2070 the order they appear:
2071
2072 "-funcall" (synonyms: "-f", "-e"). The next argument is treated as
2073 the name of a function, which is called with no arguments.
2074
2075 "-load" (synonym: "-l"). The next argument is treated as the name
2076 of a file to load. NOTE: the value of the variable load-path
2077 will be restored after this file is done loading. Thus, trying
2078 to change load-path in such a file will fail!!
2079
2080 "-kill". When this argument is handled, Emacs kills itself.
2081
2082 "+DDD", where D is a digit. DDD is used as a line number to go to.
2083 When the next ordinary file argument on the command line is
2084 handled, Emacs positions point in that file on line DDD.
2085
2086 An ordinary filename. Emacs edits this file using the function
2087 find-file. If the filename is not an "absolute" filename, it is
2088 expanded relative to the value that default-directory in the
2089 *scratch* buffer had at the beginning of step 11. The buffer
2090 visiting this file becomes the current buffer.
2091
2092 "-insert" (synonym: "-i"). The next argument is treated as the name
2093 of a file. This file is inserted in the current buffer.
2094 Initially, this is the *scratch* buffer. Otherwise it is the
2095 buffer visiting the file most recently specified on the command
2096 line. WARNING: the synonym "-i" doesn't work under X11.
2097
2098 Other command line switches may have been created by modifying the
2099 value of the variable command-switch-alist. If X Windows is being
2100 used, all X-specific switches mentioned above in steps 3 and 4 will
2101 be processed. Under X11, they will have already been handled, and
2102 will be ignored now. Under X10, they are being handled for the
2103 first time.
2104
2105 14. The values of the variables term-setup-hook and window-setup-hook
2106 are called as functions with no arguments, in the order listed.
2107
2108 15. If the user did not specify any of the command line options handled
2109 in step 13, and the variable inhibit-startup-message is still nil,
2110 the familiar Emacs startup message is displayed.
2111
211273: What are the valid X resource settings (ie., stuff in .Xdefaults file)?
2113
2114 See question 72.
2115
2116 WARNING: Don't pay any attention to the documentation in etc/XDOC or
2117 etc/emacs.1. It's way out of date. {Would someone like to rewrite it?
2118 RMS asked me and I haven't had time yet.}
2119
212074: How do I turn down the bell volume in Emacs running under X Windows?
2121
2122 Under Epoch you can do:
2123
2124 (setq epoch::bell-volume 20)
2125
2126 Under normal GNU Emacs you must modify the XTfeep function in
2127 src/x11term.c, and change the number 50 to some other number:
2128
2129 XTfeep ()
2130 {
2131 BLOCK_INPUT_DECLARE ();
2132 #ifdef XDEBUG
2133 fprintf (stderr, "XTfeep\n");
2134 #endif
2135 BLOCK_INPUT ();
2136 XBell (XXdisplay,50); /* change this 50 */
2137 UNBLOCK_INPUT ();
2138 }
2139
214075: How do I make Emacs send 8-bit characters to my terminal?
2141
2142 Johan Widen <jw@sics.se> writes:
2143
2144 A patch for emacs-18.55 is available by ftp and mail-server from
2145 sics.se.
2146
2147 Anonymous FTP:
2148 site: sics.se [192.16.123.90]
2149 file: archive/emacs-18.55-8bit-diff
2150
2151 E-mail:
2152 To: mail-server@sics.se
2153 body: send emacs-18.55-8bit-diff
2154
2155
2156
2157Emacs Lisp programming:
2158
215976: What dialect of Lisp is Emacs Lisp?
2160
2161 It's the dialect of Lisp called Emacs Lisp. (No joke!) People also
2162 call it elisp or e-lisp. (NOTE: The term "Elisp" is trademarked by
2163 someone else.)
2164
216577: How close is Emacs Lisp to Common Lisp?
2166
2167 Pretty far. GNU Emacs Lisp is case-sensitive, uses dynamic scoping,
2168 doesn't have packages, doesn't have multiple return values, doesn't have
2169 reader macros, etc. For people used to Common Lisp, some of the
2170 functions in Common Lisp that are not in Emacs Lisp by default are
2171 provided in the file lisp/cl.el. There is a Texinfo manual describing
2172 these functions in man/cl.texinfo.
2173
217478: How do I execute a piece of Emacs Lisp code?
2175
2176 There are a number of ways to execute (called "evaluate") an Emacs Lisp
2177 "form":
2178
2179 * If you want it evaluated every time you run Emacs, put it in a file
2180 named ".emacs" in your home directory.
2181
2182 * You can type the form in the "*scratch*" buffer, and then type C-j
2183 after it. The result of evaluating the form will be inserted in the
2184 buffer.
2185
2186 * In in Emacs-Lisp mode, typing M-C-x evaluates a top-level form before
2187 or around point.
2188
2189 * Typing "C-x C-e" in any buffer evaluates the Lisp form immediately
2190 before point and prints its value in the echo area.
2191
2192 * Typing M-ESC or M-x eval-expression allows you to type a Lisp form in
2193 the minibuffer which will be evaluated.
2194
2195 * You can use M-x load-file to have Emacs evaluate all the Lisp forms in
2196 a file. (To do this from Lisp use the function "load" instead.)
2197
219879: How do I make a set of operations fully local to a region?
2199
2200 Use narrow-to-region inside of save-restriction.
2201
220280: How can I highlight a region?
2203
2204 There are ways to get highlighting in GNU Emacs 18.55, but they all
2205 require patching the C code of Emacs and rebuilding. They are also slow
2206 and the highlighting disappears if you scroll or redraw the screen. One
2207 patch is by Kenichi Handa <handa@etl.go.jp>.
2208
2209 You can hightlight regions in a variety of ways in Epoch. GNU Emacs 19
2210 will have everything you need, but won't be out soon.
2211
221281: How do I change Emacs's idea of the tab character's length?
2213
2214 Example: (setq default-tab-width 10).
2215
221682: What is the difference between (interactive "P") and (interactive "p")?
2217
2218 The value that is a result of "P" can be a list, a symbol, or an
2219 integer; the value that is a result of "p" is always an integer:
2220
2221 Prefix keys typed result of: "P" "p"
2222 nothing nil 1
2223 "M-1" 1 1
2224 "C-u 1" 1 1
2225 "M--" '- -1
2226 "C-u -" '- -1
2227 "C-u" (4) 4
2228 "C-u C-u" (16) 16
2229
2230
2231
2232Carrying Out Common Tasks:
2233
223483: How do I insert ">"'s in the beginning of every line in a buffer?
2235
2236 Type "M-x replace-regexp RET ^ RET > RET". ("replace-regexp" can be
2237 shortened to "repl TAB r".)
2238
2239 To do this only in the region, type "C-x n M-x replace-regexp RET ^ RET
2240 > RET C-x w". (You're going to remember that, right?)
2241
224284: How do I insert "_^H" characters before each character in a
2243 paragraph to get an underlined paragraph?
2244
2245 M-x underline-region.
2246
224785: How do I repeat a command as many times as possible?
2248
2249 Make a keyboard macro that invokes the command and then type "M-0 C-x
2250 e". WARNING: any messages your command prints in the echo area will be
2251 suppressed.
2252
225386: How do I search for an unprintable (8-bit) character that appears
2254 in a buffer as \237?
2255
2256 C-s C-q 2 3 7
2257
2258 (This assumes the value of search-quote-char is 17 (C-q).)
2259
226087: How do I tell Emacs to automatically indent a new line to the
2261 indentation of the previous line?
2262
2263 M-x indented-text-mode. (This is a major mode.)
2264
2265 If you have auto-fill mode on (minor mode), you can tell Emacs to prefix
2266 every line with a certain character sequence, the "fill prefix". Type
2267 the prefix at the beginning of a line, position point after it, and then
2268 type "C-x ." (set-fill-prefix) to set the fill prefix. Thereafter,
2269 auto-filling will automatically put the fill prefix at the beginning of
2270 new lines, and M-q (fill-paragraph) will maintain any fill prefix when
2271 refilling the paragraph.
2272
227388: How do I make Emacs "typeover" or "overwrite" when I type instead of
2274 always inserting?
2275
2276 M-x overwrite-mode (minor mode).
2277
2278 WARNING: delete-backward-char (usually the delete key) doesn't work
2279 properly in overwrite mode. It deletes the character to the left,
2280 rather than replacing it with a space.
2281
228289: How do I show which parenthesis matches the one I'm looking at?
2283
2284 If you're looking at a right parenthesis (or brace or bracket) you can
2285 delete it and reinsert it.
2286
2287 M-C-f (forward-sexp) and M-C-b (backward-sexp) will skip over balanced
2288 parentheses, so you can see which parentheses match. (You can train it
2289 to skip over balanced brackets and braces at the same time by modifying
2290 the syntax table.)
2291
2292 Here is some Emacs Lisp that will make the % key show the matching
2293 parenthese, like in vi. In addition, if the cursor isn't over a
2294 parenthese, it simply inserts a % like normal.
2295
2296 (By an unknown contributor.)
2297
2298 (global-set-key "%" 'match-paren)
2299
2300 (defun match-paren (arg)
2301 "Go to the matching parenthesis if on parenthesis otherwise insert %."
2302 (interactive "p")
2303 (cond ((looking-at "[([{]") (forward-sexp 1) (backward-char))
2304 ((looking-at "[])}]") (forward-char) (backward-sexp 1))
2305 (t (self-insert-command (or arg 1)))))
2306
230790: How do I make Emacs behave like this: when I go up or down, the cursor
2308 should stay in the same column even if the line is too short?
2309
2310 M-x picture-mode. (This is a minor mode, in theory anyway ...)
2311
231291: How do I read news under Emacs?
2313
2314 There are at least three news reading packages that operate inside
2315 Emacs. "rnews" comes with Emacs. "GNUS" and "Gnews" come separately.
2316
2317 {I've never used rnews; could someone write a description? BTW, rnews
2318 will be replaced with GNUS in Emacs 19.}
2319
2320 Both GNUS and Gnews handle reading news over NNTP. I think both can
2321 also read from a local news spool. GNUS also supports reading mail
2322 stored in MH folders or articles saved by GNUS.
2323
2324 GNUS is written (mostly) by Masanobu Umeda. His (?) latest e-mail
2325 address was umerin@tc.nagasaki.go.jp, but I don't think he has an e-mail
2326 address right now. The latest version is GNUS 3.13. There is a
2327 newsgroup for discussion of GNUS called gnu.emacs.gnus. This newsgroup
2328 is gatewayed with the mailing list info-gnus-english to subscribe send
2329 mail to info-gnus-english-request@cis.ohio-state.edu. There is also a
2330 mailing list called info-gnus, which includes discussion in Japanese.
2331
2332 Gnews was written by Matthew Wiener <e-mail address?>. {Could someone
2333 tell me the # of the latest version, and how long it has been since
2334 anyone has heard from Matthew?}. There is a newsgroup for Gnews called
2335 gnu.emacs.gnews.
2336
233792: In C mode, can I show just the lines that will be left after #ifdef
2338 commands are handled by the compiler?
2339
2340 M-x hide-ifdef-mode. (This is a minor mode.)
2341
2342 You may have to (load "hideif") first. If you want to do this
2343 regularly, put this in your .emacs file:
2344
2345 (autoload 'hide-ifdef-mode "hideif" nil t)
2346
234793: Is there an equivalent to the "." (dot) command of vi?
2348
2349 ("." is the redo command in vi. It redoes the last insertion/deletion.)
2350
2351 No, not really.
2352
2353 You can type "C-x ESC" (repeat-complex-command) to reinvoke commands
2354 that used the minibuffer to get arguments. In repeat-complex-command
2355 you can type M-p and M-n to scan through all the different complex
2356 commands you've typed.
2357
2358 To repeat something on each line I recommend using keyboard macros.
2359
236094: How do I use emacstool under SunView?
2361
2362 The file etc/SUN-SUPPORT includes the document "Using Emacstool with GNU
2363 Emacs". Also read the man page for emacstool (etc/emacstool.1).
2364
236595: How do I get Emacs to display the current line number on the mode line?
2366
2367 There is no "correct" way to constantly display the current line number
2368 on the mode line in Emacs 18. Emacs is not a line-oriented editor, and
2369 really has no idea what "lines" of the buffer are displayed in the
2370 window. It would require a lot of work at the C code level to make
2371 Emacs keep track of this.
2372
2373 Emacs 19 will probably be able to do this, but probably not with great
2374 efficiency.
2375
2376 To find out what line of the buffer you are on right now, do "M-x
2377 what-line". Typing "C-x l" will also tell you what line you are on,
2378 provided the buffer isn't separated into "pages" with C-l characters.
2379 In that case, it will only tell you what line of the current "page" you
2380 are on. WARNING: "C-x l" gives the wrong value when point is at the
2381 beginning of a line.
2382
2383 People have written various kludges to display the current line number
2384 on the mode line. Look in the Lisp Code Directory. (See question 13.)
2385
238696: How do I tell Emacs to iconify itself?
2387
2388 You need to modify C source and recompile. Either that or get Epoch
2389 instead. For the interested I have a patch to allow Emacs to iconify
2390 itself.
2391
239297: How do I use regexps (regular expressions) in Emacs?
2393
2394 This is documented in the Emacs manual. To read the manual section
2395 online, type "C-h i m emacs RET m regexps RET".
2396
2397 WARNING: Unlike in Unix grep, sed, etc., a complement character set
2398 ([^...]) can match a Newline, unless Newline is mentioned as one of the
2399 characters not to match.
2400