+See also man page of gnuclient.
+
+@node Q5.5.5, , Q5.5.4, External Subsystems
+@unnumberedsubsec Q5.5.5: Is there a way to start a new XEmacs if there's no gnuserv running, and otherwise use gnuclient?
+
+@email{vroonhof@@math.ethz.ch, Jan Vroonhof} writes:
+@quotation
+Here is one of the solutions, we have this in a script called
+@file{etc/editclient.sh}.
+@example
+ #!/bin/sh
+ if gnuclient -batch -eval t >/dev/null 2>&1
+ then
+ exec gnuclient $@{1+"$@@"@}
+ else
+ xemacs -unmapped -f gnuserv-start &
+ until gnuclient -batch -eval t >/dev/null 2>&1
+ do
+ sleep 1
+ done
+ exec gnuclient $@{1+"$@@"@}
+ fi
+@end example
+
+Note that there is a known problem when running XEmacs and 'gnuclient
+-nw' on the same TTY.
+@end quotation
+
+@node Internet, Advanced, External Subsystems, Top
+@unnumbered 6 Connecting to the Internet
+
+This is part 6 of the XEmacs Frequently Asked Questions list. This
+section is devoted connecting to the Internet.
+
+@menu
+6.0: General Mail and News
+* Q6.0.1:: What are the various packages for reading mail?
+* Q6.0.2:: How can I send mail?
+* Q6.0.3:: How do I get my outgoing mail archived?
+* Q6.0.4:: How can I read and/or compose MIME messages?
+* Q6.0.5:: How do I customize the From line?
+* Q6.0.6:: How do I get my MUA to filter mail for me?
+* Q6.0.7:: Remote mail reading with an MUA.
+* Q6.0.8:: An MUA gets an error incorporating new mail.
+* Q6.0.9:: Why isn't @file{movemail} working?
+* Q6.0.10:: How do I make my MUA display graphical smilies?
+* Q6.0.11:: How can I get those oh-so-neat X-Face lines?
+
+6.1: Reading Mail with VM
+* Q6.1.1:: How do I set up VM to retrieve mail from a remote site using POP?
+* Q6.1.2:: How can I get VM to automatically check for new mail?
+* Q6.1.3:: I have various addresses at which I receive mail. How can I tell VM to ignore them when doing a "reply-all"?
+* Q6.1.4:: Is there a mailing list or FAQ for VM?
+* Q6.1.5:: How do I make VM stay in a single frame?
+* Q6.1.6:: Customization of VM not covered in the manual, or here.
+
+6.2: Reading Netnews and Mail with Gnus
+* Q6.2.1:: GNUS, (ding) Gnus, Gnus 5, September Gnus, Red Gnus, Quassia Gnus, argh!
+* Q6.2.2:: How do I make Gnus stay within a single frame?
+
+6.3: FTP Access
+* Q6.3.1:: Can I edit files on other hosts?
+* Q6.3.2:: What is EFS?
+
+6.4: Web Browsing with W3
+* Q6.4.1:: What is W3?
+* Q6.4.2:: How do I run W3 from behind a firewall?
+* Q6.4.3:: Is it true that W3 supports style sheets and tables?
+@end menu
+
+@unnumberedsec 6.0: General Mail and News
+
+@node Q6.0.1, Q6.0.2, Internet, Internet
+@unnumberedsubsec Q6.0.1: What are the various packages for reading mail?
+
+#### Write me.
+
+@node Q6.0.2, Q6.0.3, Q6.0.1, Internet
+@unnumberedsubsec Q6.0.2: How can I send mail?
+
+Under Unix and Mac OS X, the @samp{sendmail} package is normally used
+for this.
+#### Write me.
+
+Under Windows, you need to use @samp{smtpmail}, which communicates
+directly with the mail server, as there is no @file{sendmail} program
+running. To get it working, use code like the following in your
+@file{init.el} file:
+
+@lisp
+ ;; Get mail working under Windows.
+ (setq message-send-mail-function 'smtpmail-send-it) ; for message/Gnus
+ (setq send-mail-function 'smtpmail-send-it) ; for C-x m, etc.
+ ;; the following ensures that mail problems can be debugged: it logs a trace
+ ;; of the SMTP conversation to *trace of SMTP session to <somewhere>*.
+ (setq smtpmail-debug-info t)
+ ;; Substitute your info here.
+ ;(setq user-mail-address "ben@@xemacs.org")
+ ;(setq user-full-name "Ben Wing")
+ ;(setq smtpmail-default-smtp-server "smtp.myserver.myisp.com")
+ ;; The following two aren't completely necessary but may help.
+ ;(setq smtpmail-local-domain "666.com")
+ ;(setq smtpmail-sendto-domain "666.com")
+ ;; If your SMTP server requires a username/password to authenticate, as
+ ;; many do nowadays, set them like this:
+ ;(setq smtpmail-auth-credentials ; or use ~/.authinfo
+ ; '(("smtp.myserver.myisp.com" 25 "USER@@SOMEWHERE" "PASSWORD")))
+
+ ;; Other possibilities for getting smtpmail to work:
+ ;;
+ ;; If for some reason you need to authenticate using the STARTTLS protocol
+ ;; (don't look into this unless you know what it is), use
+ ;; (setq smtpmail-starttls-credentials
+ ;; '(("YOUR SMTP HOST" 25 "~/.my_smtp_tls.key" "~/.my_smtp_tls.cert")))
+ ;; Requires external program
+ ;; ftp://ftp.opaopa.org/pub/elisp/starttls-*.tar.gz.
+ ;; See http://www.ietf.org/rfc/rfc2246.txt,
+ ;; http://www.ietf.org/rfc/rfc2487.txt
+@end lisp
+
+The lines you need to care about are those that set
+@code{user-mail-address}, @code{user-full-name},
+@code{smtpmail-default-smtp-server}, and
+@code{smtpmail-auth-credentials}. You need to set these with,
+respectively, your email address, your full name, the SMTP server you
+use for outgoing mail, and the username and password you need to log
+in to your SMTP server. (If for some reason your SMTP server doesn't
+require logging in to send mail, don't uncomment this last line.)
+
+The other settings may be useful in specific cases, but you should know what
+you're doing before enabling them.
+
+@node Q6.0.3, Q6.0.4, Q6.0.2, Internet
+@unnumberedsubsec Q6.0.3: How do I get my outgoing mail archived?
+
+@lisp
+(setq mail-archive-file-name "~/outbox")
+@end lisp
+
+@node Q6.0.4, Q6.0.5, Q6.0.3, Internet
+@unnumberedsubsec Q6.0.4: How can I read and/or compose MIME messages?
+
+VM, MH-E and GNUS support MIME natively. Other MUAs may or may not
+have MIME support; refer to their documentation and other resources,
+such as web pages and mailing lists. Packages like SEMI/WEMI may be
+useful in connection with MUAs like mew and Wanderlust.
+
+@node Q6.0.5, Q6.0.6, Q6.0.4, Internet
+@unnumberedsubsec Q6.0.5: How do I customize the From line?
+
+How do I change the @samp{From:} line? I have set gnus-user-from-line
+to
+@example
+Gail Gurman <gail.gurman@@sybase.com>
+@end example
+@noindent , but XEmacs Gnus doesn't use
+it. [This should apply to all MUA's. --ed] Instead it uses
+@example
+Gail Mara Gurman @email{gailg@@deall}
+@end example
+@noindent and then complains
+that it's incorrect. Also, as you perhaps can see, my Message-ID is
+screwy. How can I change that?
+
+@email{larsi@@ifi.uio.no, Lars Magne Ingebrigtsen} writes:
+
+@quotation
+Set @code{user-mail-address} to @samp{gail.gurman@@sybase.com} or
+@code{mail-host-address} to @samp{sybase.com}.
+@end quotation
+
+@node Q6.0.6, Q6.0.7, Q6.0.5, Internet
+@unnumberedsubsec Q6.0.6: How do I get my MUA to filter mail for me?
+
+One possibility is to use procmail to split your mail before it gets to
+the MUA. I prefer this personally, since there are many strange and
+wonderful things one can do with procmail. Procmail may be found at
+@uref{http://www.procmail.org/}.
+
+Also see the Mail Filtering FAQ at:
+@iftex
+@*
+@end iftex
+@uref{http://www.faqs.org/faqs/mail/filtering-faq/}.
+
+@node Q6.0.7, Q6.0.8, Q6.0.6, Internet
+@unnumberedsubsec Q6.0.7: Remote mail reading with an MUA.
+
+My mailbox lives at the office on a big honkin server. My regular INBOX
+lives on my honkin desktop machine. I now can PPP to the office from
+home which is far from honking... I'd like to be able to read mail at
+home without storing it here and I'd like to use xemacs and the MUA at
+home... Is there a recommended setup?
+
+@email{nuspl@@nvwls.cc.purdue.edu, Joseph J. Nuspl Jr.} writes:
+
+@quotation
+There are several ways to do this.
+
+@enumerate
+@item
+Set your display to your home machine and run dxpc or one of the other X
+compressors.
+
+@item
+NFS mount your desktop machine on your home machine and modify your pop
+command on your home machine to rsh to your desktop machine and actually
+do the pop get's.
+
+@item
+Run a POP server on your desktop machine as well and do a sort of two
+tiered POP get.
+@end enumerate
+@end quotation
+
+@email{wmperry@@monolith.spry.com, William Perry} adds:
+
+@quotation
+Or you could run a pop script periodically on your desktop machine, and
+just use ange-ftp or NFS to get to your mailbox. I used to do this all
+the time back at IU.
+@end quotation
+
+@node Q6.0.8, Q6.0.9, Q6.0.7, Internet
+@unnumberedsubsec Q6.0.8: An MUA gets an error incorporating new mail.
+
+rmail and VM, and probably other MUA's as well, get new mail from
+your mailbox (called @file{/var/mail/$USER} or @file{/var/spool/mail/$USER}
+or something similar) using a program called @code{movemail}.
+This program interlocks with @code{/bin/mail} using the protocol
+defined by @code{/bin/mail}.
+
+There are various different protocols in general use, which you need to
+specify using the @samp{--mail-locking} option
+(@samp{--with-mail-locking} in 21.5 or later) to @file{configure}:
+
+@table @samp
+@item lockf
+POSIX file locking with @code{lockf()}
+@item flock
+BSD file locking with @code{flock()}
+@item dot
+To manipulate mail file @file{foo}, first create file @file{foo.lock}
+@item locking
+Use @code{locking()}, Microsoft's renamed @code{flock()}
+@item mmdf
+Use @code{lk_open()} and @code{lk_close()} as defined by the Multi-channel
+Memo Distribution Facility
+@item pop
+Retrieve mail using POP (the Post Office Protocol). This is the
+default for Cygwin/MinGW.
+@end table
+
+@strong{IF YOU DON'T USE THE FORM OF INTERLOCKING THAT IS NORMAL ON YOUR
+SYSTEM, YOU CAN LOSE MAIL!}
+
+Usually the value is correctly determined automatically:
+@file{configure} tries to detect the method in use, and defaults exist
+on systems for which this doesn't work.
+
+However, if you run into problems incorporating new mail, it may be
+because an incorrect method is being used.
+
+If your system uses the lock file protocol, and permissions are set
+so that ordinary users cannot write lock files in the mail spool
+directory, you may need to make @file{movemail} setgid to a
+suitable group such as @samp{mail}. You can use these commands (as
+root):
+
+@example
+chgrp mail movemail
+chmod 2755 movemail
+@end example
+
+If you are using the @samp{pop} locking method, @file{movemail} must
+be setuid root.
+
+Installation normally copies movemail from the build directory to an
+installation directory which is usually under @file{/usr/local/lib}.
+The installed copy of @file{movemail} is usually in the directory
+@file{/usr/local/lib/xemacs-VERSION/TARGET} (for example,
+@file{/usr/local/lib/xemacs-21.4.15/i686-pc-cygwin}). You must change
+the group and mode of the installed copy; changing the group and mode
+of the build directory copy is ineffective.
+
+@node Q6.0.9, Q6.0.10, Q6.0.8, Internet
+@unnumberedsubsec Q6.0.9: Why isn't @file{movemail} working?
+
+@xref{Q6.0.8}.
+
+Note also that older versions of Mozilla came with a @file{movemail}
+program that is @strong{not} compatible with XEmacs. Do not use it.
+Always use the @file{movemail} installed with your XEmacs. Failure to
+do so can result in lost mail.
+
+@node Q6.0.10, Q6.0.11, Q6.0.9, Internet
+@unnumberedsubsec Q6.0.10: How do I make my MUA display graphical smilies?
+For mh-e use the following:
+
+@lisp
+(add-hook 'mh-show-mode-hook '(lambda ()
+ (smiley-region (point-min)
+ (point-max))))
+@end lisp
+
+@email{bill@@carpenter.ORG, WJCarpenter} writes:
+For VM use the following:
+@lisp
+ (autoload 'smiley-region "smiley" nil t)
+ (add-hook 'vm-select-message-hook
+ '(lambda ()
+ (smiley-region (point-min)
+ (point-max))))
+@end lisp
+
+For tm use the following:
+@lisp
+(autoload 'smiley-buffer "smiley" nil t)
+(add-hook 'mime-viewer/plain-text-preview-hook 'smiley-buffer)
+@end lisp
+
+@node Q6.0.11, Q6.1.1, Q6.0.10, Internet
+@unnumberedsubsec Q6.0.11: How can I get those oh-so-neat X-Face lines?
+
+Firstly there is an ftp site which describes X-faces and has the
+associated tools mentioned below, at
+@uref{http://ftp.cs.indiana.edu/pub/faces/}.
+
+Then the steps are
+
+@enumerate
+@item
+Create 48x48x1 bitmap with your favorite tool
+
+@item
+Convert to "icon" format using one of xbm2ikon, pbmtoicon, etc.,
+and then compile the face.
+
+@item
+@example
+cat file.xbm | xbm2ikon |compface > file.face
+@end example
+
+@item
+Then be sure to quote things that are necessary for emacs strings:
+
+@example
+cat ./file.face | sed 's/\\/\\\\/g'
+@iftex
+\ @*
+@end iftex
+| sed 's/\"/\\\"/g' > ./file.face.quoted
+@end example
+
+@item
+Then set up emacs to include the file as a mail header - there were a
+couple of suggestions here---either something like:
+
+@lisp
+(setq mail-default-headers
+ "X-Face: @email{Ugly looking text string here}")
+@end lisp
+
+Or, alternatively, as:
+
+@lisp
+(defun mail-insert-x-face ()
+ (save-excursion
+ (goto-char (point-min))
+ (search-forward mail-header-separator)
+ (beginning-of-line)
+ (insert "X-Face:")
+ (insert-file-contents "~/.face")))
+
+(add-hook 'mail-setup-hook 'mail-insert-x-face)
+@end lisp
+@end enumerate
+
+However, 2 things might be wrong:
+
+Some versions of pbmtoicon produces some header lines that is not
+expected by the version of compface that I grabbed. So I found I had to
+include a @code{tail +3} in the pipeline like this:
+
+@example
+cat file.xbm | xbm2ikon | tail +3 |compface > file.face
+@end example
+
+Some people have also found that if one uses the @code{(insert-file)}
+method, one should NOT quote the face string using the sed script .
+
+It might also be helpful to use @email{stig@@hackvan.com, Stig's} script
+xbm2face (included in the compface distribution at XEmacs.org) to do the
+conversion.
+
+Contributors for this item:
+
+Paul Emsley,
+Ricardo Marek,
+Amir J. Katz,
+Glen McCort,
+Heinz Uphoff,
+Peter Arius,
+Paul Harrison, and
+Vegard Vesterheim
+
+@unnumberedsec 6.1: Reading Mail with VM
+
+@node Q6.1.1, Q6.1.2, Q6.0.11, Internet
+@unnumberedsubsec Q6.1.1: How do I set up VM to retrieve mail from a remote site using POP?
+
+Use @code{vm-spool-files}, like this for example:
+
+@lisp
+(setq vm-spool-files '("/var/spool/mail/wing"
+ "netcom23.netcom.com:110:pass:wing:MYPASS"))
+@end lisp
+
+Of course substitute your actual password for MYPASS.
+
+@node Q6.1.2, Q6.1.3, Q6.1.1, Internet
+@unnumberedsubsec Q6.1.2: How can I get VM to automatically check for new mail?
+
+@email{turner@@lanl.gov, John Turner} writes:
+
+@quotation
+Use the following:
+
+@lisp
+(setq vm-auto-get-new-mail 60)
+@end lisp
+@end quotation
+
+@node Q6.1.3, Q6.1.4, Q6.1.2, Internet
+@unnumberedsubsec Q6.1.3: I have various addresses at which I receive mail. How can I tell VM to ignore them when doing a "reply-all"?
+
+Set @code{vm-reply-ignored-addresses} to a list, like
+
+@lisp
+(setq vm-reply-ignored-addresses
+ '("wing@@nuspl@@nvwls.cc.purdue.edu,netcom[0-9]*.netcom.com"
+ "wing@@netcom.com" "wing@@xemacs.org"))
+@end lisp
+
+Note that each string is a regular expression.
+
+@node Q6.1.4, Q6.1.5, Q6.1.3, Internet
+@unnumberedsubsec Q6.1.4: Is there a mailing list or FAQ for VM?
+
+A FAQ for VM exists at @uref{http://www.wonderworks.com/vm/FAQ.html}.
+
+VM has its own newsgroups gnu.emacs.vm.info and gnu.emacs.vm.bug.
+
+@node Q6.1.5, Q6.1.6, Q6.1.4, Internet
+@unnumberedsubsec Q6.1.5: How do I make VM stay in a single frame?
+
+John.@email{Cooper@@Eng.Sun.COM, John S Cooper} writes:
+
+@quotation
+@lisp
+ ; Don't use multiple frames
+(setq vm-frame-per-composition nil)
+(setq vm-frame-per-folder nil)
+(setq vm-frame-per-edit nil)
+(setq vm-frame-per-summary nil)
+@end lisp
+@end quotation
+
+@node Q6.1.6, Q6.2.1, Q6.1.5, Internet
+@unnumberedsubsec Q6.1.6: Customization of VM not covered in the manual, or here.
+
+@email{boffi@@hp735.stru.polimi.it, giacomo boffi} writes:
+
+@quotation
+The meta-answer is to look into the file @file{vm-vars.el}, in the vm
+directory of the lisp library.
+
+@file{vm-vars.el} contains, initializes and carefully describes, with
+examples of usage, the plethora of user options that @emph{fully}
+control VM's behavior.
+
+Enter vm-vars, @code{forward-search} for toolbar, find the variables
+that control the toolbar placement, appearance, existence, copy to your
+@file{init.el} or @file{.vm} and modify according to the
+detailed instructions.
+
+The above also applies to all the various features of VM: search for
+some keywords, maybe the first you conjure isn't appropriate, find the
+appropriate variables, copy and experiment.
+@end quotation
+
+@unnumberedsec 6.2: Reading Netnews and Mail with Gnus
+
+@node Q6.2.1, Q6.2.2, Q6.1.6, Internet
+@unnumberedsubsec Q6.2.1: GNUS, (ding) Gnus, Gnus 5, September Gnus, Red Gnus, Quassia Gnus, argh!
+
+The Gnus numbering issues are not meant for mere mortals to know them.
+If you feel you @emph{must} enter the muddy waters of Gnus, visit the
+excellent FAQ, maintained by Justin Sheehy, at:
+
+@example
+@uref{http://my.gnus.org/FAQ/}
+@end example
+
+See also Gnus home page
+@example
+@uref{http://www.gnus.org/}
+@end example
+
+@node Q6.2.2, Q6.3.1, Q6.2.1, Internet
+@unnumberedsubsec Q6.2.2: How do I make Gnus stay within a single frame?
+
+The toolbar code to start Gnus opens the new frame---and it's a feature
+rather than a bug. If you don't like it, but would still like to click
+on the seemly icon, use the following code:
+
+@lisp
+(defun toolbar-news ()
+ (gnus))
+@end lisp
+
+It will redefine the callback function of the icon to just call
+@code{gnus}, without all the fancy frame stuff.
+
+@unnumberedsec 6.3: FTP Access
+
+@node Q6.3.1, Q6.3.2, Q6.2.2, Internet
+@unnumberedsubsec Q6.3.1: Can I edit files on other hosts?
+
+Yes. Of course XEmacs can use any network file system (such as NFS or
+Windows file sharing) you have available, and includes some
+optimizations and safety features appropriate to those environments.
+
+It is also possible to transparently edit files via FTP, ssh, or rsh. That
+is, XEmacs makes a local copy using the transport in the background, and
+automatically refreshes the remote original from that copy when you save
+it. XEmacs also is capable of doing file system manipulations like
+creating and removing directories and files. The FTP interface is
+provided by the standard @samp{efs} package @ref{Top, EFS, , efs}. The
+ssh/rsh interface is provided by the optional @samp{tramp} package
+@ref{Top, TRAMP, , tramp}.
+
+@node Q6.3.2, Q6.4.1, Q6.3.1, Internet
+@unnumberedsubsec Q6.3.2: What is EFS?
+
+#### Write me.
+
+@unnumberedsec 6.4: Web Browsing with W3
+
+@node Q6.4.1, Q6.4.2, Q6.3.2, Internet
+@unnumberedsubsec Q6.4.1: What is W3?
+
+W3 is an advanced graphical browser written in Emacs lisp that runs on
+XEmacs. It has full support for cascaded style sheets, and more...
+
+It has a home web page at
+@uref{http://www.cs.indiana.edu/elisp/w3/docs.html}.
+
+@node Q6.4.2, Q6.4.3, Q6.4.1, Internet
+@unnumberedsubsec Q6.4.2: How do I run W3 from behind a firewall?
+
+There is a long, well-written, detailed section in the W3 manual that
+describes how to do this. Look in the section entitled "Firewalls".
+
+@node Q6.4.3, , Q6.4.2, Internet
+@unnumberedsubsec Q6.4.3: Is it true that W3 supports style sheets and tables?
+
+Yes, and much more. W3, as distributed with the latest XEmacs is a
+full-featured web browser.
+
+@node Advanced, Other Packages, Internet, Top
+@unnumbered 7 Advanced Customization Using XEmacs Lisp
+
+This is part 7 of the XEmacs Frequently Asked Questions list. This
+section is devoted to advanced customization using XEmacs Lisp.
+
+@menu
+7.0: Emacs Lisp and @file{init.el}
+* Q7.0.1:: What version of Emacs am I running?
+* Q7.0.2:: How can I evaluate Emacs-Lisp expressions?
+* Q7.0.3:: @code{(setq tab-width 6)} behaves oddly.
+* Q7.0.4:: How can I add directories to the @code{load-path}?
+* Q7.0.5:: How to check if a lisp function is defined?
+* Q7.0.6:: Can I force the output of @code{(face-list)} to a buffer?
+
+7.1: Emacs Lisp Programming Techniques
+* Q7.1.1:: What is the difference in key sequences between XEmacs and GNU Emacs?
+* Q7.1.2:: Can I generate "fake" keyboard events?
+* Q7.1.3:: Could you explain @code{read-kbd-macro} in more detail?
+* Q7.1.4:: What is the performance hit of @code{let}?
+* Q7.1.5:: What is the recommended use of @code{setq}?
+* Q7.1.6:: What is the typical misuse of @code{setq}?
+* Q7.1.7:: I like the @code{do} form of cl, does it slow things down?
+* Q7.1.8:: I like recursion, does it slow things down?
+* Q7.1.9:: How do I put a glyph as annotation in a buffer?
+* Q7.1.10:: @code{map-extents} won't traverse all of my extents!
+* Q7.1.11:: My elisp program is horribly slow. Is there an easy way to find out where it spends time?
+
+7.2: Mathematics
+* Q7.2.1:: What are bignums, ratios, and bigfloats in Lisp?
+* Q7.2.2:: XEmacs segfaults when I use very big numbers!
+* Q7.2.3:: Bignums are really slow!
+* Q7.2.4:: Equal bignums don't compare as equal! What gives?
+@end menu
+
+@unnumberedsec 7.0: Emacs Lisp and @file{init.el}
+
+@node Q7.0.1, Q7.0.2, Advanced, Advanced
+@unnumberedsubsec Q7.0.1: What version of Emacs am I running?
+
+How can @file{init.el} determine which of the family of
+Emacsen I am using?
+
+To determine if you are currently running GNU Emacs 18, GNU Emacs 19,
+XEmacs 19, XEmacs 20, or Epoch, and use appropriate code, check out the
+example given in @file{etc/sample.init.el} (@file{etc/sample.emacs} in
+XEmacs versions prior to 21.4). There are other nifty things in there
+as well!
+
+For all new code, all you really need to do is:
+
+@lisp
+(defvar running-xemacs (string-match "XEmacs\\|Lucid" emacs-version))
+@end lisp
+
+@node Q7.0.2, Q7.0.3, Q7.0.1, Advanced
+@unnumberedsubsec Q7.0.2: How can I evaluate Emacs-Lisp expressions?
+
+I know I can evaluate Elisp expressions from @code{*scratch*} buffer
+with @kbd{C-j} after the expression. How do I do it from another
+buffer?
+
+Press @kbd{M-:} (the default binding of @code{eval-expression}), and
+enter the expression to the minibuffer.
+
+@node Q7.0.3, Q7.0.4, Q7.0.2, Advanced
+@unnumberedsubsec Q7.0.3: @code{(setq tab-width 6)} behaves oddly.
+
+If you put @code{(setq tab-width 6)} in your
+@file{init.el} file it does not work! Is there a reason
+for this? If you do it at the EVAL prompt it works fine!! How strange.
+
+Use @code{setq-default} instead, since @code{tab-width} is
+all-buffer-local.
+
+@node Q7.0.4, Q7.0.5, Q7.0.3, Advanced
+@unnumberedsubsec Q7.0.4: How can I add directories to the @code{load-path}?
+
+Here are two ways to do that, one that puts your directories at the
+front of the load-path, the other at the end:
+
+@lisp
+;;; Add things at the beginning of the load-path, do not add
+;;; duplicate directories:
+(pushnew "bar" load-path :test 'equal)
+
+(pushnew "foo" load-path :test 'equal)
+
+;;; Add things at the end, unconditionally
+(setq load-path (nconc load-path '("foo" "bar")))
+@end lisp
+
+@email{keithh@@nortel.ca, keith (k.p.) hanlan} writes:
+
+@quotation
+To add directories using Unix shell metacharacters use
+@file{expand-file-name} like this:
+
+@lisp
+(push (expand-file-name "~keithh/.emacsdir") load-path)
+@end lisp
+@end quotation
+
+@node Q7.0.5, Q7.0.6, Q7.0.4, Advanced
+@unnumberedsubsec Q7.0.5: How to check if a lisp function is defined?
+
+Use the following elisp:
+
+@lisp
+(fboundp 'foo)
+@end lisp
+
+It's almost always a mistake to test @code{emacs-version} or any similar
+variables.
+
+Instead, use feature-tests, such as @code{featurep}, @code{boundp},
+@code{fboundp}, or even simple behavioral tests, eg.:
+
+@lisp
+(defvar foo-old-losing-code-p
+ (condition-case nil (progn (losing-code t) nil)
+ (wrong-number-of-arguments t)))
+@end lisp
+
+There is an incredible amount of broken code out there which could work
+much better more often in more places if it did the above instead of
+trying to divine its environment from the value of one variable.
+
+@node Q7.0.6, Q7.1.1, Q7.0.5, Advanced
+@unnumberedsubsec Q7.0.6: Can I force the output of @code{(face-list)} to a buffer?
+
+It would be good having it in a buffer, as the output of
+@code{(face-list)} is too wide to fit to a minibuffer.
+
+Evaluate the expression in the @samp{*scratch*} buffer with point after
+the rightmost paren and typing @kbd{C-j}.
+
+If the minibuffer smallness is the only problem you encounter, you can
+simply press @kbd{C-h l} to get the former minibuffer contents in a
+buffer.
+
+@unnumberedsec 7.1: Emacs Lisp Programming Techniques
+
+@node Q7.1.1, Q7.1.2, Q7.0.6, Advanced
+@unnumberedsubsec Q7.1.1: What is the difference in key sequences between XEmacs and GNU Emacs?
+
+@email{clerik@@naggum.no, Erik Naggum} writes;
+
+@quotation
+Emacs has a legacy of keyboards that produced characters with modifier
+bits, and therefore map a variety of input systems into this scheme even
+today. XEmacs is instead optimized for X events. This causes an
+incompatibility in the way key sequences are specified, but both Emacs
+and XEmacs will accept a key sequence as a vector of lists of modifiers
+that ends with a key, e.g., to bind @kbd{M-C-a}, you would say
+@code{[(meta control a)]} in both Emacsen. XEmacs has an abbreviated
+form for a single key, just (meta control a). Emacs has an abbreviated
+form for the Control and the Meta modifiers to string-characters (the
+ASCII characters), as in @samp{\M-\C-a}. XEmacs users need to be aware
+that the abbreviated form works only for one-character key sequences,
+while Emacs users need to be aware that the string-character is rather
+limited. Specifically, the string-character can accommodate only 256
+different values, 128 of which have the Meta modifier and 128 of which
+have not. In each of these blocks, only 32 characters have the Control
+modifier. Whereas @code{[(meta control A)]} differs from @code{[(meta
+control a)]} because the case differs, @samp{\M-\C-a} and @samp{\M-\C-A}
+do not. Programmers are advised to use the full common form, both
+because it is more readable and less error-prone, and because it is
+supported by both Emacsen.
+@end quotation
+
+Another (even safer) way to be sure of the key-sequences is to use the
+@code{read-kbd-macro} function, which takes a string like @samp{C-c
+<up>}, and converts it to the internal key representation of the Emacs
+you use. The function is available both on XEmacs and GNU Emacs.
+
+@node Q7.1.2, Q7.1.3, Q7.1.1, Advanced
+@unnumberedsubsec Q7.1.2: Can I generate "fake" keyboard events?
+
+I wonder if there is an interactive function that can generate
+@dfn{fake} keyboard events. This way, I could simply map them inside
+XEmacs.
+
+This seems to work:
+
+@lisp
+(defun cg--generate-char-event (ch)
+ "Generate an event, as if ch has been typed"
+ (dispatch-event (character-to-event ch)))
+
+;; Backspace and Delete stuff
+(global-set-key [backspace]
+ (lambda () (interactive) (cg--generate-char-event 127)))
+(global-set-key [unknown_keysym_0x4]
+ (lambda () (interactive) (cg--generate-char-event 4)))
+@end lisp
+
+@node Q7.1.3, Q7.1.4, Q7.1.2, Advanced
+@unnumberedsubsec Q7.1.3: Could you explain @code{read-kbd-macro} in more detail?
+
+The @code{read-kbd-macro} function returns the internal Emacs
+representation of a human-readable string (which is its argument).
+Thus:
+
+@lisp
+(read-kbd-macro "C-c C-a")
+@result{} [(control ?c) (control ?a)]
+
+(read-kbd-macro "C-c C-. <up>")
+@result{} [(control ?c) (control ?.) up]
+@end lisp
+
+In GNU Emacs the same forms will be evaluated to what GNU Emacs
+understands internally---the sequences @code{"\C-x\C-c"} and @code{[3
+67108910 up]}, respectively.
+
+The exact @dfn{human-readable} syntax is defined in the docstring of
+@code{edmacro-mode}. I'll repeat it here, for completeness.
+
+@quotation
+Format of keyboard macros during editing:
+
+Text is divided into @dfn{words} separated by whitespace. Except for
+the words described below, the characters of each word go directly as
+characters of the macro. The whitespace that separates words is
+ignored. Whitespace in the macro must be written explicitly, as in
+@kbd{foo @key{SPC} bar @key{RET}}.
+
+@itemize @bullet
+@item
+The special words @kbd{RET}, @kbd{SPC}, @kbd{TAB}, @kbd{DEL}, @kbd{LFD},
+@kbd{ESC}, and @kbd{NUL} represent special control characters. The
+words must be written in uppercase.
+
+@item
+A word in angle brackets, e.g., @code{<return>}, @code{<down>}, or
+@code{<f1>}, represents a function key. (Note that in the standard
+configuration, the function key @code{<return>} and the control key
+@key{RET} are synonymous.) You can use angle brackets on the words
+@key{RET}, @key{SPC}, etc., but they are not required there.
+
+@item
+Keys can be written by their @sc{ascii} code, using a backslash followed
+by up to six octal digits. This is the only way to represent keys with
+codes above \377.
+
+@item
+One or more prefixes @kbd{M-} (meta), @kbd{C-} (control), @kbd{S-}
+(shift), @kbd{A-} (alt), @kbd{H-} (hyper), and @kbd{s-} (super) may
+precede a character or key notation. For function keys, the prefixes
+may go inside or outside of the brackets: @code{C-<down>} @equiv{}
+@code{<C-down>}. The prefixes may be written in any order: @kbd{M-C-x}
+@equiv{} @kbd{C-M-x}.
+
+Prefixes are not allowed on multi-key words, e.g., @kbd{C-abc}, except
+that the Meta prefix is allowed on a sequence of digits and optional
+minus sign: @kbd{M--123} @equiv{} @kbd{M-- M-1 M-2 M-3}.
+
+@item
+The @code{^} notation for control characters also works: @kbd{^M}
+@equiv{} @kbd{C-m}.
+
+@item
+Double angle brackets enclose command names: @code{<<next-line>>} is
+shorthand for @kbd{M-x next-line @key{RET}}.
+
+@item
+Finally, @code{REM} or @code{;;} causes the rest of the line to be
+ignored as a comment.
+@end itemize
+
+Any word may be prefixed by a multiplier in the form of a decimal number
+and @code{*}: @code{3*<right>} @equiv{} @code{<right> <right> <right>},
+and @code{10*foo} @equiv{}
+@iftex
+@*
+@end iftex
+@code{foofoofoofoofoofoofoofoofoofoo}.
+
+Multiple text keys can normally be strung together to form a word, but
+you may need to add whitespace if the word would look like one of the
+above notations: @code{; ; ;} is a keyboard macro with three semicolons,
+but @code{;;;} is a comment. Likewise, @code{\ 1 2 3} is four keys but
+@code{\123} is a single key written in octal, and @code{< right >} is
+seven keys but @code{<right>} is a single function key. When in doubt,
+use whitespace.
+@end quotation
+
+@node Q7.1.4, Q7.1.5, Q7.1.3, Advanced
+@unnumberedsubsec Q7.1.4: What is the performance hit of @code{let}?
+
+In most cases, not noticeable. Besides, there's no avoiding
+@code{let}---you have to bind your local variables, after all. Some
+pose a question whether to nest @code{let}s, or use one @code{let} per
+function. I think because of clarity and maintenance (and possible
+future implementation), @code{let}-s should be used (nested) in a way to
+provide the clearest code.
+
+@node Q7.1.5, Q7.1.6, Q7.1.4, Advanced
+@unnumberedsubsec Q7.1.5: What is the recommended use of @code{setq}?
+
+@itemize @bullet
+@item Global variables
+
+You will typically @code{defvar} your global variable to a default
+value, and use @code{setq} to set it later.
+
+It is never a good practice to @code{setq} user variables (like
+@code{case-fold-search}, etc.), as it ignores the user's choice
+unconditionally. Note that @code{defvar} doesn't change the value of a
+variable if it was bound previously. If you wish to change a
+user-variable temporarily, use @code{let}:
+
+@lisp
+(let ((case-fold-search nil))
+ ... ; code with searches that must be case-sensitive
+ ...)
+@end lisp
+
+You will notice the user-variables by their docstrings beginning with an
+asterisk (a convention).
+
+@item Local variables
+
+Bind them with @code{let}, which will unbind them (or restore their
+previous value, if they were bound) after exiting from the @code{let}
+form. Change the value of local variables with @code{setq} or whatever
+you like (e.g. @code{incf}, @code{setf} and such). The @code{let} form
+can even return one of its local variables.
+
+Typical usage:
+
+@lisp
+;; iterate through the elements of the list returned by
+;; `hairy-function-that-returns-list'
+(let ((l (hairy-function-that-returns-list)))
+ (while l
+ ... do something with (car l) ...
+ (setq l (cdr l))))
+@end lisp
+
+Another typical usage includes building a value simply to work with it.
+
+@lisp
+;; Build the mode keymap out of the key-translation-alist
+(let ((inbox (file-truename (expand-file-name box)))
+ (i 0))
+ ... code dealing with inbox ...
+ inbox)
+@end lisp
+
+This piece of code uses the local variable @code{inbox}, which becomes
+unbound (or regains old value) after exiting the form. The form also
+returns the value of @code{inbox}, which can be reused, for instance:
+
+@lisp
+(setq foo-processed-inbox
+ (let .....))
+@end lisp
+@end itemize
+
+@node Q7.1.6, Q7.1.7, Q7.1.5, Advanced
+@unnumberedsubsec Q7.1.6: What is the typical misuse of @code{setq}?
+
+A typical misuse is probably @code{setq}ing a variable that was meant to
+be local. Such a variable will remain bound forever, never to be
+garbage-collected. For example, the code doing:
+
+@lisp
+(defun my-function (whatever)
+ (setq a nil)
+ ... build a large list ...
+ ... and exit ...)
+@end lisp
+
+does a bad thing, as @code{a} will keep consuming memory, never to be
+unbound. The correct thing is to do it like this:
+
+@lisp
+(defun my-function (whatever)
+ (let (a) ; default initialization is to nil
+ ... build a large list ...
+ ... and exit, unbinding `a' in the process ...)
+@end lisp
+
+Not only is this prettier syntactically, but it makes it possible for
+Emacs to garbage-collect the objects which @code{a} used to reference.
+
+Note that even global variables should not be @code{setq}ed without
+@code{defvar}ing them first, because the byte-compiler issues warnings.
+The reason for the warning is the following:
+
+@lisp
+(defun flurgoze nil) ; ok, global internal variable
+...
+
+(setq flurghoze t) ; ops! a typo, but semantically correct.
+ ; however, the byte-compiler warns.
+
+While compiling toplevel forms:
+** assignment to free variable flurghoze
+@end lisp
+
+@node Q7.1.7, Q7.1.8, Q7.1.6, Advanced
+@unnumberedsubsec Q7.1.7: I like the @code{do} form of cl, does it slow things down?
+
+It shouldn't. Here is what Dave Gillespie has to say about cl.el
+performance:
+
+@quotation
+Many of the advanced features of this package, such as @code{defun*},
+@code{loop}, and @code{setf}, are implemented as Lisp macros. In
+byte-compiled code, these complex notations will be expanded into
+equivalent Lisp code which is simple and efficient. For example, the
+forms
+
+@lisp
+(incf i n)
+(push x (car p))
+@end lisp
+
+are expanded at compile-time to the Lisp forms
+
+@lisp
+(setq i (+ i n))
+(setcar p (cons x (car p)))
+@end lisp
+
+which are the most efficient ways of doing these respective operations
+in Lisp. Thus, there is no performance penalty for using the more
+readable @code{incf} and @code{push} forms in your compiled code.