XEmacs FAQ [3/6]


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

Subject: Introduction

This is part 3 of the XEmacs Frequently Asked Questions list. This section is devoted to Customization and screen settings.

If you have a Web browser, the official hypertext version is at: <URL:http://www.sccon.com/~andreas/xemacs-installation.html>, and also at: <URL:http://www.xemacs.org/faq/xemacs-customization.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[You are here]
  4. Major Subsystems
  5. Miscellaneous
  6. Current Events

3.0 Customization -- Emacs Lisp and .emacs


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

Subject: Q3.0.1 What version of Emacs am I running?

How can .emacs 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 etc/sample.emacs. There are other nifty things in there as well!

For all new code, a simple

(defvar running-xemacs (string-match "XEmacs\\|Lucid" emacs-version))
is all you really need to do.

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

Subject: Q3.0.2 How can I evaluate Emacs-Lisp expressions without switching to the *scratch* buffer?

I know I can evaluate Elisp expressions from *scratch* buffer with C-j after the expression. How do I do it from another buffer?

Press M-: (the default binding of eval-expression), and enter the expression to the minibuffer. In XEmacs prior to 19.15 eval-expression used to be a disabled command by default.

If this is the case, upgrade your XEmacs.

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

Subject: Q3.0.3 (setq tab-width 6) behaves oddly

If you put (setq tab-width 6) in your .emacs 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 setq-default instead, since tab-width is all-buffer-local.

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

Subject: Q3.0.4 How can I add directories to the 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:
     ;;; 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")))
keith (k.p.) hanlan <keithh@nortel.ca> writes:

To add directories using Unix shell metacharacters use expand-file-name like this:

(setq load-path (cons (expand-file-name "~keithh/.emacsdir") load-path))

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

Subject: Q3.0.5 How to check if a lisp function is defined?

Use the following elisp:
(fboundp 'foo)

It's almost always a mistake to test emacs-version or any similar variables.

Instead, use feature-tests, such as featurep or boundp or fboundp, or even simple behavioural tests, eg.

(defvar foo-old-losing-code-p 
  (condition-case nil (progn (losing-code t) nil)
   (wrong-number-of-arguments t)))

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.

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

Subject: Q3.0.6 Can I force the output of (face-list) to a buffer other than the minibuffer since it is too wide to fit?

It would be good having it in a buffer, as the output of (face-list) is too wide to fit to a minibuffer.

Evaluate the expression in the *scratch* buffer with point after the rightmost paren and typing C-j.

If the minibuffer smallness is the only problem you encounter, you can simply press C-h l to get the former minibuffer contents in a buffer.

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

Subject: Q3.0.7 My font selections don't get saved when I do a Save Options

For XEmacs 19.14 and previous:

John Mann <mannj@ll.mit.edu> writes:

You have to go to Options->Menubar Appearance and unselect Frame-Local Font Menu. If this option is selected, font changes are only applied to the current frame and do not get saved when you save options.

For XEmacs 19.15 and later:

Implement the above as well as set the following in your `.emacs'

     (setq options-save-faces 't)

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

Subject: Q3.0.8 How do I get a single minibuffer frame?

Vinnie Shelton <shelton@icd.teradyne.com> writes:
(setq initial-frame-plist '(minibuffer nil))
(setq default-frame-plist '(minibuffer nil))
(setq default-minibuffer-frame
      (make-frame
	'(minibuffer only
                     width 86
                     height 1
                     menubar-visible-p nil
                     default-toolbar-visible-p nil
                     name "minibuffer"
                     top -2
                     left -2
                     has-modeline-p nil)))
(frame-notice-user-settings)

NOTE: The single minibuffer frame may not be to everyone's taste, and there any number of other XEmacs options settings that may make it difficult or inconvenient to use.

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

3.1 X Window System & Resources


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

Subject: Q3.1.1 Where is a list of X resources?

Search through the NEWS file for X Resources. A fairly comprehensive list is given after it.

In addition, an app-defaults file is supplied, etc/Emacs.ad, listing the defaults. The file etc/sample.Xdefaults gives a set of defaults that you might consider. It is essentially the same as etc/Emacs.ad but some entries are slightly altered. Be careful about installing the contents of this file into your .Xdefaults or .Xresources file if you use GNU Emacs under X11 as well.

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

Subject: Q3.1.2 How can I detect a color display?

You can test the return value of the function (device-class), as in:
(when (eq (device-class) 'color)
  (set-face-foreground  'font-lock-comment-face "Grey")
  (set-face-foreground  'font-lock-string-face  "Red")
  ....
  )

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

Subject: Q3.1.3 `(set-screen-width)' worked in 19.6, but not in 19.13?

In Lucid Emacs 19.6 I did (set-screen-width characters) and (set-screen-height lines) in my .emacs instead of specifying Emacs*EmacsScreen.geometry in my .Xdefaults but this does not work in XEmacs 19.13.

These two functions now take frame arguments:

(set-frame-width (selected-frame) characters)
(set-frame-height (selected-frame) lines)

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

Subject: Q3.1.4 Specifiying `Emacs*EmacsScreen.geometry' in `.emacs' does not work in 19.15?

In XEmacs 19.11 I specified Emacs*EmacsScreen.geometry in my .emacs but this does not work in XEmacs 19.15.

We have switched from using the term 'screen' to using the term frame.

The correct entry for your .Xdefaults is now:

Emacs*EmacsFrame.geometry

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

Subject: Q3.1.5 How can I get the icon to just say XEmacs

I'd like the icon to just say `XEmacs', and not include the name of the current file in it.

Add the following line to your .emacs:

(setq frame-icon-title-format "XEmacs")

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

Subject: Q3.1.6 How can I have the window title area display the full path?

I'd like to have the window title area display the full directory/name of the current buffer file and not just the name.

Add the following line to your .emacs:

(setq frame-title-format "%S: %f")
A more sophisticated title might be:
(setq frame-title-format
  '("%S: " (buffer-file-name "%f" (dired-directory dired-directory "%b"))))
That is, use the file name, or the dired-directory, or the buffer name.

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

Subject: Q3.1.7 `xemacs -name junk' doesn't work?

When I run xterm -name junk I get an xterm whose class name according to xprop, is junk. This is the way it's supposed to work, I think. When I run xemacs -name junk the class name is not set to junk. It's still emacs. What does xemacs -name really do? The reason I ask is that my window manager (fvwm) will make a window sticky and I use XEmacs to read my mail. I want that XEmacs window to be sticky, without having to use the window manager's function to set the window sticky. What gives?

xemacs -name sets the application name for the program (that is, the thing which normally comes from argv[0]). Using -name is the same as making a copy of the executable with that new name. The WM_CLASS property on each frame is set to the frame-name, and the application-class. So, if you did xemacs -name FOO and then created a frame named BAR, you'd get an X window with WM_CLASS = ( "BAR", "Emacs"). However, the resource hierarchy for this widget would be

Name:    FOO   .shell             .container   .BAR
Class:   Emacs .TopLevelEmacsShell.EmacsManager.EmacsFrame
instead of the default
Name:    xemacs.shell             .container   .emacs
Class:   Emacs .TopLevelEmacsShell.EmacsManager.EmacsFrame
It is arguable that the first element of WM_CLASS should be set to the application-name instead of the frame-name, but I think that's less flexible, since it does not give you the ability to have multiple frames with different WM_CLASS properties. Another possibility would be for the default frame name to come from the application name instead of simply being emacs. However, at this point, making that change would be troublesome: it would mean that many users would have to make yet another change to their resource files (since the default frame name would suddenly change from emacs to xemacs, or whatever the executable happened to be named), so we'd rather avoid it.

To make a frame with a particular name use:

(make-frame '((name . "the-name")))

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

Subject: Q3.1.8 When I start up XEmacs using -iconic it doesn't work right.

Using -unmapped on the command line, and setting the initiallyUnmapped X Resource don't seem to help much either ...

Ben Wing <ben@666.com> writes:
Ugh, this stuff is such an incredible mess that I've about given up getting it to work. The principal problem is numerous window-manager bugs ...

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

3.2 Textual Fonts & Colors


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

Subject: Q3.2.1 How can I set color options from `.emacs'?

How can I set the most commonly used color options from my .emacs instead of from my .Xdefaults?

Like this:

(set-face-background 'default      "bisque")     ; frame background
(set-face-foreground 'default      "black")      ; normal text
(set-face-background 'zmacs-region "red")        ; When selecting w/
                                                 ; mouse 
(set-face-foreground 'zmacs-region "yellow")
(set-face-font       'default      "*courier-bold-r*120-100-100*")
(set-face-background 'highlight    "blue")       ; Ie when selecting buffers 
(set-face-foreground 'highlight    "yellow")
(set-face-background 'modeline     "blue")       ; Line at bottom of buffer
(set-face-foreground 'modeline     "white")
(set-face-font       'modeline     "*bold-r-normal*140-100-100*")
(set-face-background 'isearch      "yellow")     ; When highlighting while
                                                 ; searching		 
(set-face-foreground 'isearch      "red")
(setq x-pointer-foreground-color   "black")      ; Adds to bg color,
                                                 ; so keep black
(setq x-pointer-background-color   "blue")       ; This is color you really
                                                 ; want ptr/crsr

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

Subject: Q3.2.2 How do I set the text, menu and modeline fonts?

Note that you should use Emacs. and not Emacs* when setting face values.

In .Xdefaults:

Emacs.default.attributeFont:  -*-*-medium-r-*-*-*-120-*-*-m-*-*-* 
Emacs*menubar*font:           fixed
Emacs.modeline.attributeFont: fixed

This is confusing because modeline is a face, and can be found listed with all faces in the current mode by using M-x set-face-font (enter) ?. It uses the face specification of attributeFont, while menubar is a normal X thing that uses the specification font. With Motif it may be necessary to use fontList instead of font.

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

Subject: Q3.2.3 How can I set the background/foreground colors when highlighting a region?

You can change the face zmacs-region either in your .Xdefaults:
Emacs.zmacs-region.attributeForeground: firebrick
Emacs.zmacs-region.attributeBackground: lightseagreen
or in your .emacs:
(set-face-background 'zmacs-region "red")   
(set-face-foreground 'zmacs-region "yellow")

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

Subject: Q3.2.4 How can I limit color map usage?

I'm using Netscape (or another color grabber like XEmacs); is there anyway to limit the number of available colors in the color map?

XEmacs 19.13 didn't have such a mechanism (unlike netscape, or other color-hogs). One solution is to start XEmacs prior to netscape, since this will prevent Netscape from grabbing all colors (but Netscape will complain). You can use the flags for Netscape, like -mono, -ncols <#> or -install (for mono, limiting to <#> colors, or for using a private color map). Since Netscape will take the entire colormap and never release it, the only reasonable way to run it is with -install.

If you have the money, another solution would be to use a truecolor or direct color video.

Starting with XEmacs 19.14, XEmacs will use the closest available color if the colormap is full, so it's O.K. now to start Netscape first.

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

Subject: Q3.2.5 My tty supports color, but XEmacs doesn't use them

XEmacs tries to automatically determine whether your tty supports color, but sometimes guesses wrong. In that case, you can make XEmacs Do The Right Thing using this Lisp code:
(if (eq 'tty (device-type))
    (set-device-class nil 'color))

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

3.3 The Modeline


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

Subject: Q3.3.1 How can I make the modeline go away?

(set-specifier has-modeline-p nil)

Starting with XEmacs 19.14 the modeline responds to mouse clicks, so if you haven't liked or used the modeline in the past, you might want to try the new version out.

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

Subject: Q3.3.2 How do you have XEmacs display the line number in the modeline?

Add the following line to your .emacs file to display the line number:
(setq line-number-mode t)

Use the following to display the column number:

(setq display-column-mode t)

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

Subject: Q3.3.3 How do I get XEmacs to put the time of day on the modeline?

(display-time)

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

Subject: Q3.3.4 How do I turn off current chapter from AUC-TeX modeline?

With AUC-TeX, fast typing is hard because the current chapter/section/... is given in the modeline. How can I turn this off?

It's not auc-tex, it comes from func-menu in func-menu.el. Add this code to your .emacs to turn it off:

(setq fume-display-in-modeline-p nil)
Or just add a hook to TeX-mode-hook to turn it off only for TeX mode.
(add-hook 'TeX-mode-hook '(lambda () (setq fume-display-in-modeline-p nil)))

David Hughes <dhughes@origin-at.co.uk> writes:

If you have 19.14 or later, try this instead; you'll still get the function name displayed in the modeline, but it won't attempt to keep track when you modify the file. To refresh when it gets out of synch, you simply need click on the Rescan Buffer option in the function-menu.

(setq-default fume-auto-rescan-buffer-p nil)

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

Subject: Q3.3.5 How can one change the color of the modeline based on the mode used?

You can use something like the following:
(add-hook 'lisp-mode-hook 
        '(lambda () (set-face-background 'modeline "red" (current-buffer))
                    (set-face-foreground 'modeline "yellow" (current-buffer))))

Then, when editing a Lisp file (i.e. when in Lisp mode), the modeline colors change from the default set in your .emacs. The change will only be made in the buffer you just entered (which contains the Lisp file you are editing) and will not affect the modeline colors anywhere else.

Notes:

This works in 19.15 as well, but there are additional modeline faces, modeline-buffer-id, modeline-mousable, and modeline-mousable-minor-mode, which you may want to customize.

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

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

Obsolete question, left blank to avoid renumbering.

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

3.4 Multiple Device Support


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

Subject: Q3.4.1 How do I open a frame on another screen of my multi-headed display?

The support for this has been revamped for 19.14. Use the command M-x make-frame-on-display. This command is also on the File menu in the menubar.

XEmacs 19.14 also has the command make-frame-on-tty which will establish a connection to any tty-like device.

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

Subject: Q3.4.2 Can I really connect to a running XEmacs after calling up over a modem? How do I do it?

If you're not running at least XEmacs 19.14, you can't. Otherwise check out the gnuattach program supplied with XEmacs.

Starting with XEmacs 20.3, gnuattach and gnudoit functionality will be provided by gnuclient.

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

3.5 Keyboard


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

Subject: Q3.5.1 How can I bind complex functions (or macros) to keys?

As an example, say you want the PASTE key on a Sun keyboard to insert the current Primary X selection at point. You can accomplish this with:
(define-key global-map 'f18 'x-insert-selection)

However, this only works if there is a current X selection (the selection will be highlighted). The functionality I like is for the PASTE key to insert the current X selection if there is one, otherwise insert the contents of the clipboard. To do this you need to pass arguments to x-insert-selection. This is done by wrapping the call in a 'lambda form:

(define-key global-map 'f18
  (function (lambda () (interactive) (x-insert-selection t nil))))

This binds the 'f18 key to a generic functional object. The interactive spec is required because only interactive functions can be bound to keys. Also take a look at the doc for function.

For the FAQ example you could use:

(global-set-key [(control ?.)]
		(function (lambda () (interactive) (scroll-up 1))))
(global-set-key [(control ?;)]
	        (function (lambda () (interactive) (scroll-up -1))))

This is fine if you only need a few functions within the lambda body. If you're doing more it's cleaner to define a separate function as in question 3.5.3).

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

Subject: Q3.5.2 How can I stop the down-arrow-key from adding empty lines at the bottom of my buffers?

Add the following line to your .emacs file:
(setq next-line-add-newlines nil)
This has been the default setting in XEmacs for some time.

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

Subject: Q3.5.3 How do I bind C-. and C-; to scroll one line up and down?

Add the following (Thanks to Richard Mlynarik <mly@adoc.xerox.com> and Wayne Newberry <wayne@zen.cac.stratus.com>) to .emacs:
(defun scroll-up-one-line ()
  (interactive)
  (scroll-up 1))

(defun scroll-down-one-line ()
  (interactive)
  (scroll-down 1))

(global-set-key [(control ?.)]   'scroll-up-one-line)        ; C-.
(global-set-key [(control ?;)]   'scroll-down-one-line)      ; C-;

The key point is that you can only bind simple functions to keys; you can not bind a key to a function that you're also passing arguments to. (See 3.5.1 How can I bind complex functions for a better answer).

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

Subject: Q3.5.4 Globally binding Delete?

I cannot manage to globally bind my Delete key to something other than the default. How does one do this?
(defun Foo ()
  (interactive)
    (message "You hit DELETE"))

(global-set-key 'delete 'Foo)
However, some modes explicitly bind Delete, so you would need to add a hook that does local-set-key for them. If what you want to do is make the Backspace and Delete keys work more PC/Motif-like, then take a look at the delbackspace.el package.

New in XEmacs 19.14 is a variable called key-translation-map which makes it easier to bind Delete. delbackspace.el is a good example of how to do this correctly.

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

Subject: Q3.5.5 Scrolling one line at a time

Can the cursor keys scroll the screen a line at a time, rather than the default half page jump? I tend it to find it disorienting.

Try this:

(defun scroll-one-line-up (&optional arg)
  "Scroll the selected window up (forward in the text) one line (or N lines)."
  (interactive "p")
  (scroll-up (or arg 1)))

(defun scroll-one-line-down (&optional arg)
  "Scroll the selected window down (backward in the text) one line (or N)."
  (interactive "p")
  (scroll-down (or arg 1)))

(global-set-key 'up 'scroll-one-line-up)
(global-set-key 'down  'scroll-one-line-down)

The following will also work but will affect more than just the cursor keys (i.e. C-n and C-p):

(setq scroll-step 1)

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

Subject: Q3.5.6 How to map Help key alone on Sun type4 keyboard?

The following works in GNU Emacs 19:
(global-set-key [help] 'help-command)  		;; Help

The following works in XEmacs 19.15 with the addition of shift:

(global-set-key [(shift help)] 'help-command)  		;; Help

But it doesn't work alone. This is in the file PROBLEMS which should have come with your XEmacs installation: Emacs ignores the help key when running OLWM.

OLWM grabs the help key, and retransmits it to the appropriate client using XSendEvent. Allowing Emacs to react to synthetic events is a security hole, so this is turned off by default. You can enable it by setting the variable x-allow-sendevents to t. You can also cause fix this by telling OLWM to not grab the help key, with the null binding OpenWindows.KeyboardCommand.Help:.

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

Subject: Q3.5.7 How can you type in special characters in XEmacs?

One way is to use the package x-compose. Then you can use sequences like Compose " a to get ä, etc.

Another way is to use the iso8859-1 package.

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

Subject: Q3.5.8 Why does (define-key global-map [ delete-forward ] 'delete-char) complain?

Why does (define-key global-map [ delete-forward ] 'delete-char) complain of not being able to bind an unknown key?

Try this instead:

(define-key global-map [delete_forward] 'delete-char)
and it will work.

What you are seeing above is a bug due to code that is trying to check for GNU Emacs bogosity like

(define-key global-map [C-M-a] 'delete-char)
which otherwise would cause no errors but would not result in the expected behavior.

This bug has been fixed in 19.14.

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

Subject: Q3.5.9 How do I make the Delete key delete forward?

Use the delbs package:
     (require 'delbs)
This will give you the functions delbs-enable-delete-forward to set things up, and delbs-disable-delete-forward to revert to normal behavior.

Also see Question 3.5.4.

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

Subject: Q3.5.10 Can I turn on sticky modifier keys?

Yes, with (setq modifier-keys-are-sticky t). This will give the effect of being able to press and release Shift and have the next character typed come out in upper case. This will affect all the other modifier keys like Control and Meta as well.

Ben Wing <ben@666.com> writes:
One thing about the sticky modifiers is that if you move the mouse out of the frame and back in, it cancels all currently stuck modifiers.

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

3.6 The Cursor


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

Subject: Q3.6.1 Is there a way to make the bar cursor a little thicker?

I'd like to have the bar cursor a little thicker, as I tend to "lose" it often.

For a 1 pixel bar cursor, use:

(setq bar-cursor t)

For a 2 pixel bar cursor, use:

(setq bar-cursor 'anything-else)

You can use a color to make it stand out better:

Emacs*cursorColor:	Red

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

Subject: Q3.6.2 Is there a way to get back the block cursor?

(setq bar-cursor nil)

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

Subject: Q3.6.3 Can I make the cursor blink?

If you are running a version of XEmacs older than 19.14, no. Otherwise you can do the following:
(blink-cursor-mode)
This function toggles between a steady cursor and a blinking cursor. You may also set this mode from the menu bar by selecting Options => Frame Appearance => Blinking Cursor.

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

3.7 The Mouse and Highlighting


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

Subject: Q3.7.1 How can I turn off Mouse pasting?

I keep hitting the middle mouse button by accident and getting stuff pasted into my buffer so how can I turn this off?

Here is an alternative binding, whereby the middle mouse button selects (but does not cut) the expression under the mouse. Clicking middle on a left or right paren will select to the matching one. Note that you can use define-key or global-set-key.

(defun Mouse-Set-Point-and-Select (event)
  "Sets the point at the mouse location, then marks following form"
  (interactive "@e")
  (mouse-set-point event)
  (mark-sexp 1)
  )
(define-key global-map 'button2 'Mouse-Set-Point-and-Select)

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

Subject: Q3.7.2 How do I set control/meta/etc modifiers on mouse buttons?

Use, for instance, [(meta button1)]. For example, here is a common setting for Common Lisp programmers who use the bundled ilisp package, whereby meta-button1 on a function name will find the file where the function name was defined, and put you at that location in the source file.

[Inside a function that gets called by the lisp-mode-hook and ilisp-mode-hook]

(local-set-key [(meta button1)] 'edit-definitions-lisp)

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

Subject: Q3.7.3 Clicking the left button does not do anything in buffer list.

I do C-x C-b to get a list of buffers and the entries get highlighted when I move the mouse over them but clicking the left mouse does not do anything.

Use the middle mouse button.

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

Subject: Q3.7.4 How can I get a list of buffers to popup when I hit button 3 on the mouse?

The following code will replace the default popup on button3:
     (global-set-key [button3] 'popup-buffer-menu)

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

Subject: Q3.7.5 Why does cut-and-paste not work between XEmacs and a cmdtool?

We don't know. It's a bug. There does seem to be a work-around, however. Try running xclipboard first. It appears to fix the problem even if you exit it. (This should be mostly fixed in 19.13, but we haven't yet verified that).

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

Subject: Q3.7.6 How I can set XEmacs up so that it pastes where the text cursor is?

Examine the function mouse-yank, by typing C-h f mouse-yank RET. To get XEmacs to paste at the text cursor, add this your .emacs:
(setq mouse-yank-at-point t)

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

Subject: Q3.7.7 How do I select a rectangular region?

Just select the region normally, then use the rectangle commands (e.g. kill-rectangle) on it. The region does not highlight as a rectangle, but the commands work just fine.

To actually sweep out rectangular regions with the mouse do the following:

(setq mouse-track-rectangle-p t)
Aki Vehtari <Aki.Vehtari@hut.fi> writes:

To actually sweep out rectangular regions with the mouse you can also use mouse-track-do-rectangle which is assigned to M-button1. Then use rectangle commands.

 mouse-track-do-rectangle: (event)
   -- an interactive compiled Lisp function.
 Like `mouse-track' but selects rectangles instead of regions.

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

Subject: Q3.7.8 Why does M-w take so long?

It actually doesn't. It leaves the region visible for a second so that you can see what area is being yanked. If you start working, though, it will immediately complete its operation. In other words, it will only delay for a second if you let it.

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

3.8 The Menubar and ToolBar


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

Subject: Q3.8.1 How do I get rid of the menu (or menubar)?

If you are running XEmacs 19.13 and earlier, add this command to your .emacs:
(set-menubar nil)

Starting with XEmacs 19.14 the preferred method is:

(set-specifier menubar-visible-p nil)

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

Subject: Q3.8.2 Can I customize the basic menubar?

For an extensive menubar, add this line to your .emacs:
(load "big-menubar")
If you'd like to write your own, this file provides as good a set of examples as any to start from. The file is located in lisp/packages/big-menubar.el in the XEmacs installation directory.

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

Subject: Q3.8.3 How do I control how many buffers are listed in the menu Buffers list?

Add the following to your .emacs (suit to fit):
(setq buffers-menu-max-size 20)
For no limit, use an argument of nil.

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

Subject: Q3.8.4 Resources like `Emacs*menubar*font' are not working?

I am trying to use a resource like Emacs*menubar*font to set the font of the menubar but it's not working.

If you are using the real Motif menubar, this resource is not recognized; you have to say

Emacs*menubar*fontList: FONT
If you are using the Lucid menubar, the former resource will be recognized only if the latter resource is unset. This means that the resource
*fontList: FONT
will override
Emacs*menubar*font: FONT
even though the latter is more specific.

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

Subject: Q3.8.5 Try something like:How can I bind a key to a function to toggle the toolbar?

Try something like:
     (defun my-toggle-toolbar ()
       (interactive)
       (set-specifier default-toolbar-visible-p
                      (not (specifier-instance default-toolbar-visible-p))))
     (global-set-key "\C-xT" 'my-toggle-toolbar)


There are redisplay bugs in 19.14 that may make the preceding result in a messed-up display, especially for frames with multiple windows. You may need to resize the frame before XEmacs completely realizes the toolbar is really gone.

Thanks to Martin Buchholz <Martin.Buchholz@sun.com> for the correct code.

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

Subject: Q3.8.6 [This question intentionally left blank]

Obsolete question, left blank to avoid renumbering.

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

3.9 ScrollBars


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

Subject: Q3.9.1 How can I disable the scrollbar?

To disable them for all frames, add the following line to your .Xdefaults:
Emacs.scrollBarWidth:  0

To turn the scrollbar off on a per-frame basis, use the following function:

(set-specifier scrollbar-width (cons (selected-frame) 0))

You can actually turn the scrollbars on at any level you want by substituting for (selected-frame) in the above command. For example, to turn the scrollbars off only in a single buffer:

(set-specifier scrollbar-width (cons (current-buffer) 0))

Starting with 19.14 you can use the more logical form:

(set-specifier scrollbar-width 0 (selected-frame))

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

Subject: Q3.9.2 How can one use resources to change scrollbar colors?

Here's a recap of how to use resources to change your scrollbar colors:
! Motif scrollbars

Emacs*XmScrollBar.Background: skyblue
Emacs*XmScrollBar.troughColor: lightgray

! Athena scrollbars

Emacs*Scrollbar.Foreground: skyblue
Emacs*Scrollbar.Background: lightgray
Note the capitalization of Scrollbar for the Athena widget.

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

Subject: Q3.9.3 Moving the scrollbar can move the point; can I disable this?

When I move the scrollbar in an XEmacs window, it moves the point as well, which should not be the default behavior. Is this a bug or a feature? Can I disable it?

The current behavior is a feature, not a bug. Point remains at the same buffer position as long as that position does not scroll off the screen. In that event, point will end up in either the upper-left or lower-left hand corner.

This cannot be changed.

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

Subject: Q3.9.4 How can I get automatic horizontal scrolling?

By the same token, how can I turn it off in specific modes?

To do this, add to your .emacs file:

(require 'auto-show)
Then do (setq truncate-lines t) in the mode-hooks for any modes in which you want lines truncated.

More precisely: If truncate-lines is nil, horizontal scrollbars will never appear. Otherwise, they will appear only if the value of scrollbar-height for that buffer/window/etc. is non-zero. If you do

(set-specifier scrollbar-height 0)
then horizontal scrollbars will not appear in truncated buffers unless the package specifically asked for them.

Newsflash: Automatic horizontal scrolling is now standard with 19.14.

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

3.10 Text Selections


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

Subject: Q3.10.1 How can I turn off or change highlighted selections?

The zmacs mode allows for what some might call gratuitous highlighting for selected regions (either by setting mark or by using the mouse). This is the default behavior. To turn off, add the following line to your .emacs file:
(setq zmacs-regions nil)

To change the face for selection, look at Options->Customize on the menubar.

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

Subject: Q3.10.2 How do I get that typing on an active region removes it?

I want to change things so that if I select some text and start typing, the typed text replaces the selected text, similar to Motif.

You want to use something called pending delete. Pending delete is what happens when you select a region (with the mouse or keyboard) and you press a key to replace the selected region by the key you typed. Usually backspace kills the selected region.

To get this behavior, add the following line to your .emacs:

(require 'pending-del)

Note that this will work with both Backspace and Delete.

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

Subject: Q3.10.3 Can I turn off the highlight during isearch?

I do not like my text highlighted while I am doing isearch as I am not able to see what's underneath. How do I turn it off?

Put the following in your .emacs:

(setq isearch-highlight nil)

Note also that isearch-highlight affects query-replace and ispell. Instead of disabling isearch-highlight you may find that a better solution consists of customizing the isearch face.

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

Subject: Q3.10.4 How do I turn off highlighting after C-x C-p (mark-page).

Put this in your .emacs:
(setq zmacs-regions nil)

Warning: This command turns off all region highlighting.

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

Subject: Q3.10.5 The region disappears when I hit the end of buffer while scrolling.

How do I turn this feature (if it indeed is a feature) off?

Like this:

(defadvice scroll-up (around scroll-up freeze)
  (interactive "_P")
  (let ((zmacs-region-stays t))
    (if (interactive-p)
	(condition-case nil
	    ad-do-it
	  (end-of-buffer (goto-char (point-max))))
      ad-do-it)))

(defadvice scroll-down (around scroll-down freeze)
  (interactive "_P")
  (let ((zmacs-region-stays t))
    (if (interactive-p)
	(condition-case nil
	    ad-do-it
	  (beginning-of-buffer (goto-char (point-min))))
      ad-do-it)))

Thanks to T. V. Raman <raman@adobe.com> for assistance in deriving this answer.


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 2  Part 4 =>