XEmacs FAQ [5/6]


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

Subject: Introduction

This is part 5 of the XEmacs Frequently Asked Questions list. This section is devoted to anything that doesn't fit neatly into the other sections.

If you have a Web browser, the official hypertext version is at: <URL:http://www.sccon.com/~andreas/xemacs-miscellaneous.html>, and also at: <URL:http://www.xemacs.org/faq/xemacs-miscellaneous.html>. This version is much nicer than the unofficial hypertext versions that are archived at Utrecht, Oxford, Smart Pages, and other FAQ archives.

Changes this month:
This file was last modified on Feburary 23, 1998.

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

Subject: Roadmap

  1. Introduction, policy, credits.
  2. Installation and Trouble Shooting
  3. Customization and Options
  4. Major Subsystems
  5. Miscellaneous[You are here]

5.0 Major & Minor Modes


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

Subject: Q5.0.1 How can I do source code highlighting using font-lock?

For most modes, font-lock is already set up and just needs to be turned on. This can be done by M-x font-lock-mode, or by having XEmacs automatically start it by adding lines like
(add-hook 'emacs-lisp-mode-hook	'turn-on-font-lock)
(add-hook 'dired-mode-hook	'turn-on-font-lock)
to your .emacs. See the file etc/sample.emacs for more examples.

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

Subject: Q5.0.2 I do not like cc-mode. How do I use the old c-mode?

Well, first off, consider if you really want to do this. cc-mode is much more powerful than the old c-mode. If you're having trouble getting your old offsets to work, try using c-set-offset instead. You might also consider using the package cc-compat.

But, if you still insist, add the following lines to your .emacs:

(fmakunbound 'c-mode)
(makunbound 'c-mode-map)
(fmakunbound 'c++-mode)
(makunbound 'c++-mode-map)
(makunbound 'c-style-alist)
(load-library "old-c-mode")
(load-library "old-c++-mode")	

This must be done before any other reference is made to either c-mode or c++-mode.

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

Subject: Q5.0.3 Does anyone know how to get the More Syntax Highlighting on by default?

Use the following code in your .emacs:
     (setq-default font-lock-maximum-decoration t)
In versions of XEmacs prior to 19.14, you had to use a kludgy solution like this:
(setq c-font-lock-keywords c-font-lock-keywords-2
    setq c++-font-lock-keywords c++-font-lock-keywords-2
    setq lisp-font-lock-keywords lisp-font-lock-keywords-2)
It will work for C, C++ and Lisp.

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

Subject: Q5.0.4 How can I enable auto-indent?

Put the following line in your .emacs.
(setq indent-line-function 'indent-relative-maybe)
If you want to get fancy, try the filladapt package available standard with XEmacs. Put this into your .emacs
(require 'filladapt)
(add-hook 'text-mode-hook    'turn-on-filladapt-mode)
;;; and so forth ...
Note that well-behaving text-lookalike modes will run text-mode-hook by default (e.g. that's what Message does). For the nasty ones, you'll have to provide the add-hook's yourself.

Please note that the fa-extras package is no longer useful.

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

Subject: Q5.0.5 How can I get XEmacs to come up in text mode (auto-fill) by default?

Try the following lisp in your .emacs:
(setq default-major-mode 'text-mode)
(setq text-mode-hook 'turn-on-auto-fill)

WARNING: note that changing the value of default-major-mode from fundamental-mode can break a large amount of built-in code that expects newly created buffers to be in fundamental-mode. (Changing from fundamental-mode to text-mode might not wreak too much havoc, but changing to something more exotic like a lisp-mode would break many Emacs packages).

Note that Emacs by default starts up in buffer *scratch* in initial-major-mode, which defaults to lisp-interaction-mode. Thus adding the following form to your Emacs init file will cause the initial *scratch* buffer to be put into auto-fill'ed text-mode.

(setq initial-major-mode
      (function (lambda ()
        (text-mode)
        (turn-on-auto-fill))))

Note that after your init file is loaded, if inhibit-startup-message is null (the default) and the startup buffer is *scratch* then the startup message will be inserted into *scratch*; it will be removed after a timeout by erasing the entire *scratch* buffer. Keep in mind this default usage of *scratch* if you desire any prior manipulation of *scratch* from within your Emacs init file. In particular, anything you insert into *scratch* from your init file will be later erased. Also, if you change the mode of the *scratch* buffer, be sure that this will not interfere with possible later insertion of the startup message (e.g. if you put *scratch* into a nonstandard mode that has automatic font lock rules, then the startup message might get fontified in a strange foreign manner, e.g. as code in some programming language).

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

Subject: Q5.0.6 How do I start up a second shell buffer?

In the *shell* buffer:
M-x rename-buffer RET *shell-1* RET
M-x shell RET
This will then start a second shell. The key is that no buffer named *shell* can exist. It might be preferable to use M-x rename-uniquely to rename the *shell* buffer instead of M-x rename-buffer.

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

Subject: Q5.0.7 Telnet from *shell* filters too much

I'm using the Emacs M-x shell function, and I would like to invoke and use a telnet session within it. Everything works fine except that now all ^M's are filtered out by Emacs. Fixes?

Use M-x rsh or M-x telnet to open remote sessions rather than doing rsh or telnet within the local shell buffer.

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

Subject: Q5.0.8 Why does edt emulation not work?

We don't know, but you can use tpu-edt emulation instead, which works fine and is a little fancier than the standard edt emulation. To do this, add the following line to your .emacs:
(load "tpu-edt")

If you don't want it to replace C-h with an edt-style help menu add this as well:

(global-set-key '(control h) 'help-for-help)

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

Subject: Q5.0.9 How can I emulate VI and use it as my default mode?

Our recommended VI emulator is viper. To make viper-mode the default, add this to your .emacs:

(viper-mode)
Michael Kifer <kifer@CS.SunySB.EDU> writes:

This should be added as close to the top of .emacs as you can get it, otherwise some minor modes may not get viper-ized.

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

Subject: Q5.0.10 [This question intentionally left blank]

Obsolete question, left blank to avoid renumbering

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

Subject: Q5.0.11 Filladapt doesn't work in 19.15?

Filladapt 2.x is included in 19.15. In it filladapt is now a minor mode and minor modes are traditionally off by default. The following added to your .emacs will turn it on for all buffers:
(setq-default filladapt-mode t)
Use turn-on-filladapt-mode to turn Filladapt on in particular major modes, like this:
(add-hook 'text-mode-hook 'turn-on-filladapt-mode) 

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

Subject: Q5.0.12 How do I disable gnuserv from opening a new frame?

If you set the gnuserv-frame variable to the frame that should be used to display buffers that are pulled up, a new frame will not be created. For example, you could put
(setq gnuserv-frame (selected-frame))
early on in your .emacs, to ensure that the first frame created is the one used for your gnuserv buffers.

Starting in 19.15, there is an option to set the gnuserv target to the current frame. See `Options->"Other Window" Location->Make current frame gnuserv target'

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

Subject: Q5.0.13 How do I start gnuserv so that each subsequent XEmacs is a client?

Put the following in your .emacs file to start the server:
(gnuserv-start)

Start your first XEmacs as usual. After that, you can do

gnuclient randomfilename
from the command line to get your existing XEmacs process to open a new frame and visit randomfilename in that window. When you're done editing randomfilename, hit C-x # to kill the buffer and get rid of the frame.

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

Subject: Q5.0.14 Strange things are happening in Shell Mode

Sometimes (i.e. it's not repeatable, and I can't work out why it happens) when I'm typing into shell mode, I hit return and only a portion of the command is given to the shell, and a blank prompt is returned. If I hit return again, the rest of the previous command is given to the shell.

Martin Buchholz <Martin.Buchholz@sun.com> writes:
There is a known problem with interaction between csh and the filec option and XEmacs. You should add

if ( "$TERM" == emacs || "$TERM" == unknown ) unset filec
to your .cshrc.

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

Subject: Q5.0.15 Where do I get the latest CC Mode?

Barry A. Warsaw <bwarsaw@cnri.reston.va.us> writes:

This can be had from <URL:http://www.python.org/ftp/emacs/>.

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

Subject: Q5.0.16 I find auto-show-mode disconcerting. How do I turn it off?

auto-show-mode controls whether or not a horizontal scrollbar magically appears when a line is too long to be displayed. This is enabled by default. To turn it off, put the following in your .emacs:
(setq auto-show-mode nil)
(setq-default auto-show-mode nil)

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

Subject: Q5.0.17 How can I get two instances of info?

You can't. The info package does not provide for multiple info buffers.

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

Subject: Q5.0.18 I upgraded to XEmacs 19.14 and gnuserv stopped working

Mark Daku <daku@nortel.ca> writes:

It turns out I was using an older version of gnuserv. The installation didn't put the binary into the public bin directory. It put it in lib/xemacs-19.14/hppa1.1-hp-hpux9.05/gnuserv. Shouldn't it have been put in bin/hppa1.1-hp-hpux9.0?

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

Subject: Q5.0.19 Is there something better than LaTeX mode?

David Kastrup <dak@fsnif.neuroinformatik.ruhr-uni-bochum.de> writes:
The standard TeX modes leave much to be desired, and are somewhat leniently maintained. Serious TeX users use AucTeX. See Q4.7.1.

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

5.1 Emacs Lisp Programming


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

Subject: Q5.1.1 What is the difference in key sequences between XEmacs and GNU Emacs?

Erik Naggum <erik@naggum.no> writes:

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 M-C-a, you would say [(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 "\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 accomodate 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 [(meta control A)] differs from [(meta control a)] because the case differs, "\M-\C-a" and "\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.

Another (even safer) way to be sure of the key-sequences is to use the `read-kbd-macro' function, which takes a string like `C-c ', and converts it to the internal key representation of the Emacs you use. The function is available both on XEmacs and GNU Emacs.

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

Subject: Q5.1.2 Can I generate fake keyboard events?

I wonder if there is an interactive function that can generate fake keyboard events. This way, I could simply map them inside XEmacs.

This seems to work:

(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)))

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

Subject: Q5.1.3 Could you explain `read-kbd-macro' in more detail?

The read-kbd-macro function returns the internal Emacs representation of a human-readable string (which is its argument). Thus:
     (read-kbd-macro "C-c C-a")
          => [(control ?c) (control ?a)]
     
     (read-kbd-macro "C-c C-. ")
          => [(control ?c) (control ?.) up]
In GNU Emacs the same forms will be evaluated to what GNU Emacs understands internally--the sequences \C-x\C-c and [3 67108910 up], respectively.

The exact "human-readable" syntax is defined in the docstring of edmacro-mode. I'll repeat it here, for completeness.

Format of keyboard macros during editing:

Text is divided into "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 foo SPC bar RET.

* The special words `RET', `SPC', `TAB', `DEL', `LFD', `ESC', and `NUL' represent special control characters. The words must be written in uppercase.

* A word in angle brackets, e.g., `', `', or `', represents a function key. (Note that in the standard configuration, the function key `' and the control key `RET' are synonymous.) You can use angle brackets on the words `RET', `SPC', etc., but they are not required there.

* Keys can be written by their ASCII code, using a backslash followed by up to six octal digits. This is the only way to represent keys with codes above \377.

* One or more prefixes `M-' (meta), `C-' (control), `S-' (shift), `A-' (alt), `H-' (hyper), and `s-' (super) may precede a character or key notation. For function keys, the prefixes may go inside or outside of the brackets: `C-' == `'. The prefixes may be written in any order: `M-C-x' == `C-M-x'.

Prefixes are not allowed on multi-key words, e.g., `C-abc', except that the Meta prefix is allowed on a sequence of digits and optional minus sign: `M--123' == `M-- M-1 M-2 M-3'.

* The `^' notation for control characters also works: `^M' == `C-m'.

* Double angle brackets enclose command names: `<>' is shorthand for `M-x next-line RET'.

* Finally, `REM' or `;;' causes the rest of the line to be ignored as a comment.

Any word may be prefixed by a multiplier in the form of a decimal number and `*': `3*' == ` ', and `10*foo' == `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: `; ; ;' is a keyboard macro with three semicolons, but `;;;' is a comment. Likewise, `\ 1 2 3' is four keys but `\123' is a single key written in octal, and `< right >' is seven keys but `' is a single function key. When in doubt, use whitespace.

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

Subject: Q5.1.4 What is the performance hit of `let'?

In most cases, not noticable. Besides, there's no avoiding let--you have to bind your local variables, after all. Some pose a question whether to nest let's, or use one let' per function. I think because of clarity and maintenance (and possible future implementation), let-s should be used (nested) in a way to provide the clearest code.

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

Subject: Q5.1.5 What is the recommended use of setq?

* Global variables

You will typically defvar your global variable to a default value, and use setq to set it later.

It is never a good practice to setq user variables (like case-fold-search, etc.), as it ignores the user's choice unconditionally. Note that defvar doesn't change the value of a variable if it was bound previously. If you wish to change a user-variable temporarily, use let:

          (let ((case-fold-search nil))
            ...       ; code with searches that must be case-sensitive
            ...)
You will notice the user-variables by their docstrings beginning with an asterisk (a convention).

* Local variables

Bind them with let, which will unbind them (or restore their previous value, if they were bound) after exiting from the let form. Change the value of local variables with setq or whatever you like (e.g. incf, setf and such). The let form can even return one of its local variables.

Typical usage:

          ;; 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))))
Another typical usage includes building a value simply to work with it.
          ;; 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)
This piece of code uses the local variable inbox, which becomes unbound (or regains old value) after exiting the form. The form also returns the value of inbox, which can be reused, for instance:
          (setq foo-processed-inbox
                (let .....))

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

Subject: Q5.1.6 What is the typical misuse of setq?

A typical misuse is probably setqing 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:
     (defun my-function (whatever)
       (setq a nil)
       ... build a large list ...
       ... and exit ...)
does a bad thing, as `a' will keep consuming memory, never to be unbound. The correct thing is to do it like this:
     (defun my-function (whatever)
       (let (a)             ; default initialization is to nil
         ... build a large list ...
         ... and exit, unbinding `a' in the process  ...)
Not only is this prettier syntactically, but it makes it possible for Emacs to garbage-collect the objects which a used to reference.

Note that even global variables should not be setqed without defvaring them first, because the byte-compiler issues warnings. The reason for the warning is the following:

     (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

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

Subject: Q5.1.7 I like the the do form of cl, does it slow things down?

It shouldn't. Here is what Dave Gillespie has to say about cl.el performance:

Many of the advanced features of this package, such as defun*, loop, and 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

          (incf i n)
          (push x (car p))
are expanded at compile-time to the Lisp forms
          (setq i (+ i n))
          (setcar p (cons x (car p)))
which are the most efficient ways of doing these respective operations in Lisp. Thus, there is no performance penalty for using the more readable incf and push forms in your compiled code.

*Interpreted* code, on the other hand, must expand these macros every time they are executed. For this reason it is strongly recommended that code making heavy use of macros be compiled. (The features labelled "Special Form" instead of "Function" in this manual are macros.) A loop using incf a hundred times will execute considerably faster if compiled, and will also garbage-collect less because the macro expansion will not have to be generated, used, and thrown away a hundred times.

You can find out how a macro expands by using the cl-prettyexpand function.

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

Subject: Q5.1.8 I like recursion, does it slow things down?

Yes. Emacs byte-compiler cannot do much to optimize recursion. But think well whether this is a real concern in Emacs. Much of the Emacs slowness comes from internal mechanisms such as redisplay, or from the fact that it is an interpreter.

Please try not to make your code much uglier to gain a very small speed gain. It's not usually worth it.

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

Subject: Q5.1.9 How do I put a glyph as annotation in a buffer?

Here is a solution that will insert the glyph annotation at the beginning of buffer:
     (make-annotation (make-glyph '([FORMAT :file FILE]
                                    [string :data "fallback-text"]))
                      (point-min)
                      'text
                      (current-buffer))
Replace FORMAT with an unquoted symbol representing the format of the image (e.g. `xpm', `xbm', `gif', `jpeg', etc.) Instead of FILE, use the image file name (e.g. `/usr/local/lib/xemacs-20.2/etc/recycle.xpm').

You can turn this to a function (that optionally prompts you for a file name), and inserts the glyph at (point) instead of (point-min).

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

5.2 Sound


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

Subject: Q5.2.1 How do I turn off the sound?

Add the following line to your .emacs:
(setq bell-volume 0)
(setq sound-alist nil)
That will make your XEmacs totally silent - even the default ding sound (TTY beep on TTY-s) will be gone.

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

Subject: Q5.2.2 How do I get funky sounds instead of a boring beep?

Make sure your XEmacs was compiled with sound support, and then put this in your .emacs:
(load-default-sounds)

The sound support in XEmacs 19.14 is greatly improved over previous versions.

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

Subject: Q5.2.3 What's NAS, how do I get it?

See Part 2, Q2.0.3 which has an explanation of the Network Audio System.

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

Subject: Q5.2.4 Sunsite sounds don't play

I'm having some trouble with sounds I've downloaded from sunsite. They play when I run them through showaudio or cat them directly to /dev/audio, but XEmacs refuses to play them.

Markus Gutschke <gutschk@uni-muenster.de> writes:
[Many of] These files have an (erroneous) 24byte header that tells about the format that they have been recorded in. If you cat them to /dev/audio, the header will be ignored and the default behavior for /dev/audio will be used. This happens to be 8kHz uLaw. It is probably possible to fix the header by piping through sox and passing explicit parameters for specifying the sampling format; you then need to perform a 'null' conversion from SunAudio to SunAudio.

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

5.3 Miscellaneous


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

Subject: Q5.3.1 How do you make XEmacs indent CL if-clauses correctly?

I'd like XEmacs to indent all the clauses of a Common Lisp `if' the same amount instead of indenting the 3rd clause differently from the first two.

One way is to add, to .emacs:

(put 'if 'lisp-indent-function nil)
However, note that the package cl-indent.el that comes with XEmacs sets up this kind of indentation by default. cl-indent also knows about many other CL-specific forms. To use cl-indent, one can do this:
(load "cl-indent")
(setq lisp-indent-function (function common-lisp-indent-function))
One can also customize cl-indent.el so it mimics the default if indentation then indented more than the else). Here's how:
(put 'if 'common-lisp-indent-function '(nil nil &body))
Also, a new version (1.2) of cl-indent.el was posted to comp.emacs.xemacs on 12/9/94. This version includes more documentation than previous versions. This may prove useful if you need to customize any indent-functions.

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

Subject: Q5.3.2 Fontifying hang when editing a postscript file.

When I try to edit a postscript file it gets stuck saying: fontifying 'filename' (regexps....) and it just sits there. If I press C-c in the window where XEmacs was started, it suddenly becomes alive again.

This was caused by a bug in the Postscript font-lock regular expressions. It should be fixed in 19.13. For earlier versions of XEmacs, have a look at your .emacs file. You will probably have a line like:

(add-hook 'postscript-mode-hook	'turn-on-font-lock)

Take it out, restart XEmacs, and it won't try to fontify your postscript files anymore.

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

Subject: Q5.3.3 How can I print WYSIWYG a font-locked buffer?

Font-lock looks nice. How can I print (WYSIWYG) the highlighted document?

The package ps-print.el, which is now included with XEmacs, provides the ability to do this. The source code contains complete instructions on its use: <xemacs_src_root>/lisp/packages/ps-print.el

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

Subject: Q5.3.4 Getting M-x lpr to work with postscript printer.

My printer is a Postscript printer and lpr only works for Postscript files, so how do I get M-x lpr-region and M-x lpr-buffer to work? Put something like this in your .emacs:
(setq lpr-command "a2ps")
(setq lpr-switches '("-p" "-1"))
If you don't use a2ps to convert ASCII to postscript (why not, it's free?), replace with the command you do use. Note also that some versions of a2ps require a -Pprinter to ensure spooling.

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

Subject: Q5.3.5 How do I specify the paths that XEmacs uses for finding files?

You can specify what paths to use by using a number of different flags when running configure. See the section MAKE VARIABLES in the top-level file INSTALL in the XEmacs distribution for a listing of those flags.

Most of the time, however, the simplest fix is: DO NOT specify paths as you might for GNU Emacs. XEmacs can generally determine the necessary paths dynamically at run time. The only path that generally needs to be specified is the root directory to install into. That can be specified by passing the --prefix flag to configure. For a description of the XEmacs install tree, please consult the NEWS file.

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

Subject: Q5.3.6 [This question intentionally left blank]

Obsolete question, left blank to avoid renumbering.

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

Subject: Q5.3.7 Can I have the end of the buffer delimited in some way?

Say, with: [END]?

Try this:

     (let ((ext (make-extent (point-min) (point-max))))
       (set-extent-property ext 'start-closed t)
       (set-extent-property ext 'end-closed t)
       (set-extent-property ext 'detachable nil)
       (set-extent-end-glyph ext (make-glyph [string :data "[END]"])))
Since this is XEmacs, you can specify an icon to be shown on window-system devices. To do so, change the make-glyph call to something like this:
     (make-glyph '([xpm :file "~/something.xpm"]
                   [string :data "[END]"]))
You can inline the XPM definition yourself by specifying :data instead of :file. Here is such a full-featured version that works on both X and TTY devices:
     (let ((ext (make-extent (point-min) (point-max))))
       (set-extent-property ext 'start-closed t)
       (set-extent-property ext 'end-closed t)
       (set-extent-property ext 'detachable nil)
       (set-extent-end-glyph ext (make-glyph '([xpm :data "\
     /* XPM */
     static char* eye = {
     \"20 11 7 2\",
     \"__ c None\"
     \"_` c #7f7f7f\",
     \"_a c #fefefe\",
     \"_b c #7f0000\",
     \"_c c #fefe00\",
     \"_d c #fe0000\",
     \"_e c #bfbfbf\",
     \"___________`_`_`___b_b_b_b_________`____\",
     \"_________`_`_`___b_c_c_c_b_b____________\",
     \"_____`_`_`_e___b_b_c_c_c___b___b_______`\",
     \"___`_`_e_a___b_b_d___b___b___b___b______\",
     \"_`_`_e_a_e___b_b_d_b___b___b___b___b____\",
     \"_`_`_a_e_a___b_b_d___b___b___b___b___b__\",
     \"_`_`_e_a_e___b_b_d_b___b___b___b___b_b__\",
     \"___`_`_e_a___b_b_b_d_c___b___b___d_b____\",
     \"_____`_`_e_e___b_b_b_d_c___b_b_d_b______\",
     \"_`_____`_`_`_`___b_b_b_d_d_d_d_b________\",
     \"___`_____`_`_`_`___b_b_b_b_b_b__________\",
     } ;"]
                                               [string :data "[END]"]))))
Note that you might want to make this a function, and put it to a hook. We leave that as an excercise for the reader.

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

Subject: Q5.3.8 How do I insert today's date into a buffer?

Like this:
(insert (current-time-string))

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

Subject: Q5.3.9 Are only certain syntactic character classes available for abbrevs?

Markus Gutschke <gutschk@uni-muenster.de> writes:

Yes, abbrevs only expands word-syntax strings. While XEmacs does not prevent you from defining (e.g. with C-x a g or C-x a l) abbrevs that contain special characters, it will refuse to expand them. So you need to ensure, that the abbreviation contains letters and digits only. This means that xd, d5, and 5d are valid abbrevs, but &d, and x d are not.

If this sounds confusing to you, (re-)read the online documentation for abbrevs:

M-x Info-goto-node RET
(Emacs)Abbrevs RET
or C-h i m Emacs RET m Abbrevs RET and then come back and read this question/answer again.

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

Subject: Q5.3.10 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.
<URL:ftp://ftp.cs.indiana.edu:/pub/faces/>.

Then the steps are

  1. Create 48x48x1 bitmap with your favorite tool
  2. convert to "icon" format using one of xbm2ikon, pbmtoicon, etc. and then compile the face
    cat file.xbm | xbm2ikon |compface > file.face
    
  3. Then be sure to quote things that are necessary for emacs strings
    cat ./file.face | sed 's/\\/\\\\/g'  | sed 's/\"/\\\"/g' > ./file.face.quoted
    
  4. Then set up emacs to include the file as a mail header - there were a couple of suggestions here - either something like
    (setq  mail-default-headers 
      "X-Face:  <Ugly looking text string here>")
    
    or
           (defun mail-insert-x-face ()
    	 (save-excursion 
    	   (goto-char (point-min))
    	   (search-forward mail-header-separator)
    	   (beginning-of-line nil)
    	   (insert "X-Face:")
    	   (insert-file "~/.face")))
    
           (add-hook 'mail-setup-hook 'mail-insert-x-face)
    

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 'tail +3' in the pipeline like this:

cat file.xbm | xbm2ikon | tail +3 |compface > file.face

Some people have also found that if one uses the (insert-file ...) method, one should NOT quote the face string using the sed script .

It might also be helpful to use Stig <stig@hackvan.com>'s script (included in the compface distribution at XEmacs.org) to do the conversion. For convenience xbm2xface is available for anonymous FTP at
ftp://ftp.miranova.com/pub/xemacs/xbm2xface.pl.

Contributors for this item:

Paul Emsley, 
Ricardo Marek,
Amir J. Katz,
Glen McCort,
Heinz Uphoff, 
Peter Arius,
Paul Harrison, and
Vegard Vesterheim

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

Subject: Q5.3.11 How do I add new Info directories?

You use something like:
(setq Info-directory-list (cons 
			    (expand-file-name "~/info")
 			    Info-default-directory-list))
David Masterson <davidm@prism.kla.com> writes:

Emacs Info and XEmacs Info do many things differently. If you're trying to support a number of versions of Emacs, here are some notes to remember:

  1. Emacs Info scans Info-directory-list from right-to-left while XEmacs Info reads it from left-to-right, so append to the correct end of the list.
  2. Use Info-default-directory-list to initialize Info-directory-list if it is available at startup, but not all Emacsen define it.
  3. Emacs Info looks for a standard dir file in each of the directories scanned from #1 and magically concatenates them together.
  4. XEmacs Info looks for a localdir file (which consists of just the menu entries from a dir file) in each of the directories scanned from #1 (except the first), does a simple concatentation of them, and magically attaches the resulting list to the end of the menu in the dir file in the first directory.

Another alternative is to convert the documentation to HTML with texi2html and read it from a web browser like Lynx or W3.

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

Subject: Q5.3.12 What do I need to change to make printing work?

For regular printing there are two variables that can be customized.
lpr-command
This should be set to a command that takes standard input and sends it to a printer. Something like:
(setq lpr-command "lp")
lpr-switches
This should be set to a list that contains whatever the print command requires to do its job. Something like:
(setq lpr-switches '("-depson"))

For postscript printing there are three analogous variables to customize.

ps-lpr-command
This should be set to a command that takes postscript on standard input and directs it to a postscript printer.
ps-lpr-switches
This should be set to a list of switches required for ps-lpr-command to do its job.
ps-print-color-p
This boolean variable should be set t if printing will be done in color, otherwise it should be set to nil.

NOTE: It is an undocumented limitation in XEmacs 19.14 that postscript printing (the Pretty Print Buffer menu item) requires a window system environment. It cannot be used outside of X11.


This FAQ is Copyright © 1998 by various people and edited by Andreas Kaempf. Please send comments, and suggestions to Andreas Kaempf <andreas@sccon.com>.

<= Part 4  Part 6 =>