changeset 83199:0e38a1bd20a8

Merged in changes from CVS trunk. Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-509 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-510 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-511 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-512 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-513 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-514 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-515 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-516 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-517 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-518 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-239
author Karoly Lorentey <lorentey@elte.hu>
date Tue, 31 Aug 2004 16:31:03 +0000
parents d58083e7ec81 (current diff) f3a8f3204f86 (diff)
children cc29203a9a04
files lisp/ChangeLog lisp/mh-e/mh-loaddefs.el lisp/subr.el man/ChangeLog src/fileio.c src/xmenu.c
diffstat 52 files changed, 1263 insertions(+), 672 deletions(-) [+]
line wrap: on
line diff
--- a/admin/ChangeLog	Tue Aug 31 16:30:29 2004 +0000
+++ b/admin/ChangeLog	Tue Aug 31 16:31:03 2004 +0000
@@ -1,6 +1,15 @@
+2004-08-29  Kim F. Storm  <storm@cua.dk>
+
+	* FOR-RELEASE (Documentation): Add man/ack.texi and AUTHORS.
+
+2004-08-28  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
+
+	* FOR-RELEASE (Indications): Remove entry about GTK and geometry,
+	(now behaves as well as other ports).
+
 2004-06-28  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
 
-	* FOR-RELEASE: Removed entry about GTK and monochrome displays (done).
+	* FOR-RELEASE: Remove entry about GTK and monochrome displays (done).
 
 2002-06-26  Eli Zaretskii  <eliz@is.elta.co.il>
 
--- a/admin/FOR-RELEASE	Tue Aug 31 16:30:29 2004 +0000
+++ b/admin/FOR-RELEASE	Tue Aug 31 16:31:03 2004 +0000
@@ -14,6 +14,10 @@
 
 ** Update man/info.texi.
 
+** Update man/ack.texi.
+
+** Update AUTHORS.
+
 
 * NEW FEATURES
 
@@ -38,8 +42,6 @@
 
 * GTK RELATED BUGS
 
-** Make geometry specifications work correctly for GTK.
-
 ** Make GTK scrollbars behave like others w.r.t. overscrolling.
 
 
--- a/etc/ChangeLog	Tue Aug 31 16:30:29 2004 +0000
+++ b/etc/ChangeLog	Tue Aug 31 16:31:03 2004 +0000
@@ -1,3 +1,7 @@
+2004-08-24  Bill Wohler  <wohler@newt.com>
+
+	* NEWS, MH-E-NEWS: Upgraded to MH-E version 7.82.
+
 2004-08-22  David Kastrup  <dak@gnu.org>
 
 	* PROBLEMS, MAILINGLISTS: Update AUCTeX information.
--- a/etc/MH-E-NEWS	Tue Aug 31 16:30:29 2004 +0000
+++ b/etc/MH-E-NEWS	Tue Aug 31 16:31:03 2004 +0000
@@ -6,6 +6,12 @@
 are permitted in any medium without royalty provided the copyright
 notice and this notice are preserved.
 
+* Changes in MH-E 7.82
+
+Version 7.82 continues to address the saga surrounding the use of CL
+macros in CVS Emacs and fixes the auto-detection of vanilla MH (SF
+#1014781).
+
 * Changes in MH-E 7.81
 
 Version 7.81 fixes a `wrong-type-argument' argument error that
--- a/etc/NEWS	Tue Aug 31 16:30:29 2004 +0000
+++ b/etc/NEWS	Tue Aug 31 16:31:03 2004 +0000
@@ -194,6 +194,11 @@
 rule applies to file buffers.  For non-file buffers, the behavior may
 be mode dependent.
 
+If you are sure that the file will only change by growing at the end,
+then you can tail the file more efficiently by using the new minor
+mode Auto Revert Tail mode.  The function `auto-revert-tail-mode'
+toggles this mode.
+
 ** Auto Revert mode is now more careful to avoid excessive reverts and
 other potential problems when deciding which non-file buffers to
 revert.  This matters especially if Global Auto Revert mode is enabled
@@ -660,7 +665,7 @@
 
 ** MH-E changes.
 
-Upgraded to MH-E version 7.81. There have been major changes since
+Upgraded to MH-E version 7.82. There have been major changes since
 version 5.0.2; see MH-E-NEWS for details.
 
 +++
--- a/lisp/ChangeLog	Tue Aug 31 16:30:29 2004 +0000
+++ b/lisp/ChangeLog	Tue Aug 31 16:31:03 2004 +0000
@@ -1,3 +1,92 @@
+2004-08-30  John Paul Wallington  <jpw@gnu.org>
+
+	* textmodes/tex-mode.el (tex-validate-buffer): Use distinct
+	strings rather than programatically constructing message.
+
+2004-08-30  Richard M. Stallman  <rms@gnu.org>
+
+	* emacs-lisp/lisp-mode.el (prin1-char): Don't turn S-a into A.
+	Don't return a string that would read as the wrong character code.
+
+2004-08-29  Kim F. Storm  <storm@cua.dk>
+
+	* emulation/cua-base.el (cua-auto-expand-rectangles): Remove
+	automatic rectangle padding feature; replace by non-destructive
+	virtual rectangle edges feature.
+	(cua-virtual-rectangle-edges): New defcustom.
+	(cua-auto-tabify-rectangles): New defcustom.
+	(cua-paste): If paste into a marked rectangle, insert rectangle at
+	current column, even if virtual; also paste exactly as many lines
+	as has been marked (ignore additional lines or add empty lines),
+	but paste whole source if only one line is marked.
+	(cua--update-indications): No longer use overwrite-cursor to
+	indicate rectangle padding
+
+	* emulation/cua-rect.el (cua--rectangle-padding): Remove.
+	(cua--rectangle-virtual-edges): New defun.
+	(cua--rectangle-get-corners): Remove optional PAD arg.
+	(cua--rectangle-set-corners): Never do padding.
+	(cua--forward-line): Remove optional PAD arg.  Simplify.
+	(cua-resize-rectangle-right, cua-resize-rectangle-left)
+	(cua-resize-rectangle-down, cua-resize-rectangle-up):
+	(cua-resize-rectangle-bot, cua-resize-rectangle-top)
+	(cua-resize-rectangle-page-up, cua-resize-rectangle-page-down)
+	(cua--rectangle-move): Never do padding.  Simplify.
+	(cua--tabify-start): New defun.
+	(cua--rectangle-operation): Add tabify arg.  All callers changed.
+	(cua--pad-rectangle): Remove.
+	(cua--delete-rectangle): Handle delete with virtual edges.
+	(cua--extract-rectangle): Add spaces if rectangle has virtual edges.
+	(cua--insert-rectangle): Handle insert at virtual column.
+	Perform auto-tabify if necessary.
+	(cua--activate-rectangle): Remove optional FORCE arg.
+	Never do padding.  Simplify.
+	(cua--highlight-rectangle): Enhance for virtual edges.
+	(cua-toggle-rectangle-padding): Remove command.
+	(cua-toggle-rectangle-virtual-edges): New command.
+	(cua-sequence-rectangle): Add optional TABIFY arg.  Callers changed.
+	(cua--rectangle-post-command): Don't force rectangle padding.
+	(cua--init-rectangles): Bind M-p to cua-toggle-rectangle-virtual-edges.
+
+2004-08-28  Luc Teirlinck  <teirllm@auburn.edu>
+
+	* indent.el (edit-tab-stops-buffer): Doc fix.
+
+2004-08-28  Richard M. Stallman  <rms@gnu.org>
+
+	* progmodes/grep.el (grep-default-command): Use find-tag-default.
+	(grep-tag-default): Function deleted.
+
+	* subr.el (find-tag-default): Moved from etags.el.
+
+	* progmodes/etags.el (find-tag-default): Moved to subr.el.
+
+	* emacs-lisp/lisp-mode.el (prin1-char): Put `shift' modifier
+	into the basic character if it has an uppercase form.
+
+2004-08-27  Kenichi Handa  <handa@m17n.org>
+
+	* international/utf-8.el (utf-8-post-read-conversion): If the
+	buffer is unibyte, temporarily make it multibyte.
+
+2004-08-27  Masatake YAMATO  <jet@gyve.org>
+
+	* calendar/time-date.el (time-to-seconds): Add autoload cookies.
+
+2004-08-25  John Paul Wallington  <jpw@gnu.org>
+
+	* textmodes/tex-mode.el (tex-validate-buffer): Distinguish between
+	0, 1, and many mismatches in message.
+	(tex-start-shell): Use `set-process-query-on-exit-flag'.
+
+	* ielm.el (ielm-tab, ielm-complete-symbol): Doc fix.
+	(inferior-emacs-lisp-mode): Use	`set-process-query-on-exit-flag'.
+
+2004-08-23  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* vc-svn.el (vc-svn-diff): Treat options from vc-svn-diff-switches and
+	vc-diff-switches differently.
+
 2004-08-22  Luc Teirlinck  <teirllm@auburn.edu>
 
 	* speedbar.el (speedbar-file-regexp): Give it a phony defvar
@@ -7,8 +96,8 @@
 
 2004-08-22  Richard M. Stallman  <rms@gnu.org>
 
-	* textmodes/flyspell.el (flyspell-word): Use
-	set-process-query-on-exit-flag.
+	* textmodes/flyspell.el (flyspell-word):
+	Use set-process-query-on-exit-flag.
 	(flyspell-highlight-duplicate-region): Take POSS as arg.
 	(flyspell-word): Pass POSS as arg.
 
@@ -51,8 +140,7 @@
 
 2004-08-22  Andreas Schwab  <schwab@suse.de>
 
-	* cvs-status.el: Require pcvs during byte-compiling for
-	defun-cvs-mode.
+	* cvs-status.el: Require pcvs during byte-compiling for defun-cvs-mode.
 
 2004-08-22  Masatake YAMATO  <jet@gyve.org>
 
--- a/lisp/calendar/time-date.el	Tue Aug 31 16:30:29 2004 +0000
+++ b/lisp/calendar/time-date.el	Tue Aug 31 16:31:03 2004 +0000
@@ -45,6 +45,7 @@
 	      (timezone-make-date-arpa-standard date)))
     (error (error "Invalid date: %s" date))))
 
+;;;###autoload
 (defun time-to-seconds (time)
   "Convert time value TIME to a floating point number.
 You can use `float-time' instead."
--- a/lisp/emacs-lisp/lisp-mode.el	Tue Aug 31 16:30:29 2004 +0000
+++ b/lisp/emacs-lisp/lisp-mode.el	Tue Aug 31 16:31:03 2004 +0000
@@ -363,7 +363,7 @@
     (when (stringp default)
       (if (string-match ":+" default)
           (substring default (match-end 0))
-          default))))
+	default))))
 
 ;; Used in old LispM code.
 (defalias 'common-lisp-mode 'lisp-mode)
@@ -459,21 +459,37 @@
 If CHAR is not a character, return nil."
   (and (integerp char)
        (eventp char)
-       (let ((c (event-basic-type char)))
-	 (concat
-	  "?"
-	  (mapconcat
-	   (lambda (modif)
-	     (cond ((eq modif 'super) "\\s-")
-		   (t (string ?\\ (upcase (aref (symbol-name modif) 0)) ?-))))
-	   (event-modifiers char) "")
-	  (cond
-	   ((memq c '(?\; ?\( ?\) ?\{ ?\} ?\[ ?\] ?\" ?\' ?\\)) (string ?\\ c))
-	   ((eq c 127) "\\C-?")
-	   (t
-	    (condition-case nil
-		(string c)
-	      (error nil))))))))
+       (let ((c (event-basic-type char))
+	     (mods (event-modifiers char))
+	     string)
+	 ;; Prevent ?A from turning into ?\S-a.
+	 (if (and (memq 'shift mods)
+		  (zerop (logand char ?\S-\^@))
+		  (not (let ((case-fold-search nil))
+			 (char-equal c (upcase c)))))
+	     (setq c (upcase c) mods nil))
+	 ;; What string are we considering using?
+	 (condition-case nil
+	     (setq string
+		   (concat
+		    "?"
+		    (mapconcat
+		     (lambda (modif)
+		       (cond ((eq modif 'super) "\\s-")
+			     (t (string ?\\ (upcase (aref (symbol-name modif) 0)) ?-))))
+		     mods "")
+		    (cond
+		     ((memq c '(?\; ?\( ?\) ?\{ ?\} ?\[ ?\] ?\" ?\' ?\\)) (string ?\\ c))
+		     ((eq c 127) "\\C-?")
+		     (t
+		      (string c)))))
+	   (error nil))
+	 ;; Verify the string reads a CHAR, not to some other character.
+	 ;; If it doesn't, return nil instead.
+	 (and string
+	      (= (car (read-from-string string)) char)
+	      string))))
+	 
 
 (defun eval-last-sexp-1 (eval-last-sexp-arg-internal)
   "Evaluate sexp before point; print value in minibuffer.
--- a/lisp/emulation/cua-base.el	Tue Aug 31 16:30:29 2004 +0000
+++ b/lisp/emulation/cua-base.el	Tue Aug 31 16:31:03 2004 +0000
@@ -141,30 +141,39 @@
 ;; completely separate set of "rectangle commands" [C-x r ...] on the
 ;; region to copy, kill, fill a.s.o. the virtual rectangle.
 ;;
-;; cua-mode's superior rectangle support is based on using a true visual
-;; representation of the selected rectangle. To start a rectangle, use
-;; [S-return] and extend it using the normal movement keys (up, down,
-;; left, right, home, end, C-home, C-end). Once the rectangle has the
-;; desired size, you can cut or copy it using C-x and C-c (or C-w and M-w),
-;; and you can subsequently insert it - as a rectangle - using C-v (or
-;; C-y).  So the only new command you need to know to work with
-;; cua-mode rectangles is S-return!
+;; cua-mode's superior rectangle support uses a true visual
+;; representation of the selected rectangle, i.e. it highlights the
+;; actual part of the buffer that is currently selected as part of the
+;; rectangle.  Unlike emacs' traditional rectangle commands, the
+;; selected rectangle always as straight left and right edges, even
+;; when those are in the middle of a TAB character or beyond the end
+;; of the current line.  And it does this without actually modifying
+;; the buffer contents (it uses display overlays to visualize the
+;; virtual dimensions of the rectangle).
+;;
+;; This means that cua-mode's rectangles are not limited to the actual
+;; contents of the buffer, so if the cursor is currently at the end of a
+;; short line, you can still extend the rectangle to include more columns
+;; of longer lines in the same rectangle.  And you can also have the
+;; left edge of a rectangle start in the middle of a TAB character.
+;; Sounds strange? Try it!
+;;
+;; To start a rectangle, use [S-return] and extend it using the normal
+;; movement keys (up, down, left, right, home, end, C-home,
+;; C-end). Once the rectangle has the desired size, you can cut or
+;; copy it using C-x and C-c (or C-w and M-w), and you can
+;; subsequently insert it - as a rectangle - using C-v (or C-y).  So
+;; the only new command you need to know to work with cua-mode
+;; rectangles is S-return!
 ;;
 ;; Normally, when you paste a rectangle using C-v (C-y), each line of
 ;; the rectangle is inserted into the existing lines in the buffer.
 ;; If overwrite-mode is active when you paste a rectangle, it is
 ;; inserted as normal (multi-line) text.
 ;;
-;; Furthermore, cua-mode's rectangles are not limited to the actual
-;; contents of the buffer, so if the cursor is currently at the end of a
-;; short line, you can still extend the rectangle to include more columns
-;; of longer lines in the same rectangle.  Sounds strange? Try it!
-;;
-;; You can enable padding for just this rectangle by pressing [M-p];
-;; this works like entering `picture-mode' where the tabs and spaces
-;; are automatically converted/inserted to make the rectangle truly
-;; rectangular. Or you can do it for all rectangles by setting the
-;; `cua-auto-expand-rectangles' variable.
+;; If you prefer the traditional rectangle marking (i.e. don't want
+;; straight edges), [M-p] toggles this for the current rectangle,
+;; or you can customize cua-virtual-rectangle-edges.
 
 ;; And there's more: If you want to extend or reduce the size of the
 ;; rectangle in one of the other corners of the rectangle, just use
@@ -204,8 +213,8 @@
 ;;       a supplied format string (prompt)
 ;; [M-o] opens the rectangle by moving the highlighted text to the
 ;;       right of the rectangle and filling the rectangle with blanks.
-;; [M-p] toggles rectangle padding, i.e. insert tabs and spaces to
-;;       make rectangles truly rectangular
+;; [M-p] toggles virtual straight rectangle edges
+;; [M-P] inserts tabs and spaces (padding) to make real straight edges
 ;; [M-q] performs text filling on the rectangle
 ;; [M-r] replaces REGEXP (prompt) by STRING (prompt) in rectangle
 ;; [M-R] reverse the lines in the rectangle
@@ -347,14 +356,27 @@
 
 ;;; Rectangle Customization
 
-(defcustom cua-auto-expand-rectangles nil
-  "*If non-nil, rectangles are padded with spaces to make straight edges.
-This implies modifying buffer contents by expanding tabs and inserting spaces.
-Consequently, this is inhibited in read-only buffers.
-Can be toggled by [M-p] while the rectangle is active,"
+(defcustom cua-virtual-rectangle-edges t
+  "*If non-nil, rectangles have virtual straight edges.
+Note that although rectangles are always DISPLAYED with straight edges, the
+buffer is NOT modified, until you execute a command that actually modifies it.
+\[M-p] toggles this feature when a rectangle is active."
   :type 'boolean
   :group 'cua)
 
+(defcustom cua-auto-tabify-rectangles 1000
+  "*If non-nil, automatically tabify after rectangle commands.
+This basically means that `tabify' is applied to all lines that
+are modified by inserting or deleting a rectangle.  If value is
+an integer, cua will look for existing tabs in a region around
+the rectangle, and only do the conversion if any tabs are already
+present.  The number specifies then number of characters before
+and after the region marked by the rectangle to search."
+  :type '(choice (number :tag "Auto detect (limit)")
+		 (const :tag "Disabled" nil)
+		 (other :tag "Enabled" t))
+  :group 'cua)
+
 (defcustom cua-enable-rectangle-auto-help t
   "*If non-nil, automatically show help for region, rectangle and global mark."
   :type 'boolean
@@ -412,7 +434,6 @@
 				       (frame-parameter nil 'cursor-color)
 				       "red")
   "Normal (non-overwrite) cursor color.
-Also used to indicate that rectangle padding is not in effect.
 Default is to load cursor color from initial or default frame parameters.
 
 If the value is a COLOR name, then only the `cursor-color' attribute will be
@@ -462,7 +483,6 @@
 
 (defcustom cua-overwrite-cursor-color "yellow"
   "*Cursor color used when overwrite mode is set, if non-nil.
-Also used to indicate that rectangle padding is in effect.
 Only used when `cua-enable-cursor-indications' is non-nil.
 
 If the value is a COLOR name, then only the `cursor-color' attribute will be
@@ -806,7 +826,8 @@
   (interactive "P")
   (setq arg (cua--prefix-arg arg))
   (let ((regtxt (and cua--register (get-register cua--register)))
-	(count (prefix-numeric-value arg)))
+	(count (prefix-numeric-value arg))
+	paste-column paste-lines)
     (cond
      ((and cua--register (not regtxt))
       (message "Nothing in register %c" cua--register))
@@ -825,7 +846,12 @@
 	  ;; the same region that we are going to delete.
 	  ;; That would make yank a no-op.
 	  (if cua--rectangle
-	      (cua--delete-rectangle)
+	      (progn
+		(goto-char (min (mark) (point)))
+		(setq paste-column (cua--rectangle-left))
+		(setq paste-lines (cua--delete-rectangle))
+		(if (= paste-lines 1)
+		    (setq paste-lines nil))) ;; paste all
 	    (if (string= (buffer-substring (point) (mark))
 			 (car kill-ring))
 		(current-kill 1))
@@ -843,7 +869,8 @@
 	    (setq this-command 'cua--paste-rectangle)
 	    (undo-boundary)
 	    (setq buffer-undo-list (cons pt buffer-undo-list)))
-	  (cua--insert-rectangle (cdr cua--last-killed-rectangle))
+	  (cua--insert-rectangle (cdr cua--last-killed-rectangle)
+				 nil paste-column paste-lines)
 	  (if arg (goto-char pt))))
        (t (yank arg)))))))
 
@@ -1033,9 +1060,7 @@
 	   ((and buffer-read-only
 		 cua-read-only-cursor-color)
 	    cua-read-only-cursor-color)
-	   ((and cua-overwrite-cursor-color
-		 (or overwrite-mode
-		     (and cua--rectangle (cua--rectangle-padding))))
+	   ((and cua-overwrite-cursor-color overwrite-mode)
 	    cua-overwrite-cursor-color)
 	   (t cua-normal-cursor-color)))
 	 (color (if (consp cursor) (cdr cursor) cursor))
--- a/lisp/emulation/cua-rect.el	Tue Aug 31 16:30:29 2004 +0000
+++ b/lisp/emulation/cua-rect.el	Tue Aug 31 16:31:03 2004 +0000
@@ -44,10 +44,10 @@
 (require 'rect)
 
 ;; If non-nil, restrict current region to this rectangle.
-;; Value is a vector [top bot left right corner ins pad select].
+;; Value is a vector [top bot left right corner ins virt select].
 ;; CORNER specifies currently active corner 0=t/l 1=t/r 2=b/l 3=b/r.
 ;; INS specifies whether to insert on left(nil) or right(t) side.
-;; If PAD is non-nil, tabs are converted to spaces when necessary.
+;; If VIRT is non-nil, virtual straight edges are enabled.
 ;; If SELECT is a regexp, only lines starting with that regexp are affected.")
 (defvar cua--rectangle nil)
 (make-variable-buffer-local 'cua--rectangle)
@@ -65,6 +65,8 @@
 (defvar cua--rectangle-overlays nil)
 (make-variable-buffer-local 'cua--rectangle-overlays)
 
+(defvar cua--virtual-edges-debug nil)
+
 ;; Per-buffer CUA mode undo list.
 (defvar cua--undo-list nil)
 (make-variable-buffer-local 'cua--undo-list)
@@ -97,7 +99,7 @@
 (defvar cua--tidy-undo-counter 0
   "Number of times `cua--tidy-undo-lists' have run successfully.")
 
-;; Clean out danling entries from cua's undo list.
+;; Clean out dangling entries from cua's undo list.
 ;; Since this list contains pointers into the standard undo list,
 ;; such references are only meningful as undo information if the
 ;; corresponding entry is still on the standard undo list.
@@ -203,11 +205,11 @@
           (aref cua--rectangle 5))
       (cua--rectangle-left))))
 
-(defun cua--rectangle-padding (&optional set val)
-  ;; Current setting of rectangle padding
+(defun cua--rectangle-virtual-edges (&optional set val)
+  ;; Current setting of rectangle virtual-edges
   (if set
       (aset cua--rectangle 6 val))
-  (and (not buffer-read-only)
+  (and ;(not buffer-read-only)
        (aref cua--rectangle 6)))
 
 (defun cua--rectangle-restriction (&optional val bounded negated)
@@ -226,7 +228,7 @@
   (if (< (cua--rectangle-bot) (cua--rectangle-top))
       (message "rectangle bot < top")))
 
-(defun cua--rectangle-get-corners (&optional pad)
+(defun cua--rectangle-get-corners ()
   ;; Calculate the rectangular region represented by point and mark,
   ;; putting start in the upper left corner and end in the
   ;; bottom right corner.
@@ -245,12 +247,12 @@
               (setq r (1- r)))
         (setq l (prog1 r (setq r l)))
         (goto-char top)
-        (move-to-column l pad)
+        (move-to-column l)
         (setq top (point))
         (goto-char bot)
-        (move-to-column r pad)
+        (move-to-column r)
         (setq bot (point))))
-    (vector top bot l r corner 0 pad nil)))
+    (vector top bot l r corner 0 cua-virtual-rectangle-edges nil)))
 
 (defun cua--rectangle-set-corners ()
   ;; Set mark and point in opposite corners of current rectangle.
@@ -269,24 +271,21 @@
       (setq pp (cua--rectangle-bot) pc (cua--rectangle-right)
             mp (cua--rectangle-top) mc (cua--rectangle-left))))
     (goto-char mp)
-    (move-to-column mc (cua--rectangle-padding))
+    (move-to-column mc)
     (set-mark (point))
     (goto-char pp)
-    (move-to-column pc (cua--rectangle-padding))))
+    (move-to-column pc)
+    ))
 
 ;;; Rectangle resizing
 
-(defun cua--forward-line (n pad)
+(defun cua--forward-line (n)
   ;; Move forward/backward one line.  Returns t if movement.
-  (if (or (not pad) (< n 0))
-      (= (forward-line n) 0)
-    (next-line 1)
-    t))
+  (= (forward-line n) 0))
 
 (defun cua--rectangle-resized ()
   ;; Refresh state after resizing rectangle
   (setq cua--buffer-and-point-before-command nil)
-  (cua--pad-rectangle)
   (cua--rectangle-insert-col 0)
   (cua--rectangle-set-corners)
   (cua--keep-active))
@@ -294,47 +293,35 @@
 (defun cua-resize-rectangle-right (n)
   "Resize rectangle to the right."
   (interactive "p")
-  (let ((pad (cua--rectangle-padding)) (resized (> n 0)))
+  (let ((resized (> n 0)))
     (while (> n 0)
       (setq n (1- n))
       (cond
-       ((and (cua--rectangle-right-side) (or pad (eolp)))
+       ((cua--rectangle-right-side)
         (cua--rectangle-right (1+ (cua--rectangle-right)))
-        (move-to-column (cua--rectangle-right) pad))
-       ((cua--rectangle-right-side)
-        (forward-char 1)
-        (cua--rectangle-right (current-column)))
-       ((or pad (eolp))
+        (move-to-column (cua--rectangle-right)))
+       (t
         (cua--rectangle-left (1+ (cua--rectangle-left)))
-        (move-to-column (cua--rectangle-right) pad))
-       (t
-        (forward-char 1)
-        (cua--rectangle-left (current-column)))))
+        (move-to-column (cua--rectangle-right)))))
     (if resized
         (cua--rectangle-resized))))
 
 (defun cua-resize-rectangle-left (n)
   "Resize rectangle to the left."
   (interactive "p")
-  (let ((pad (cua--rectangle-padding)) resized)
+  (let (resized)
     (while (> n 0)
       (setq n (1- n))
       (if (or (= (cua--rectangle-right) 0)
               (and (not (cua--rectangle-right-side)) (= (cua--rectangle-left) 0)))
           (setq n 0)
         (cond
-         ((and (cua--rectangle-right-side) (or pad (eolp) (bolp)))
+         ((cua--rectangle-right-side)
           (cua--rectangle-right (1- (cua--rectangle-right)))
-          (move-to-column (cua--rectangle-right) pad))
-         ((cua--rectangle-right-side)
-          (backward-char 1)
-          (cua--rectangle-right (current-column)))
-         ((or pad (eolp) (bolp))
+          (move-to-column (cua--rectangle-right)))
+         (t
           (cua--rectangle-left (1- (cua--rectangle-left)))
-          (move-to-column (cua--rectangle-right) pad))
-         (t
-          (backward-char 1)
-          (cua--rectangle-left (current-column))))
+          (move-to-column (cua--rectangle-right))))
         (setq resized t)))
     (if resized
         (cua--rectangle-resized))))
@@ -342,20 +329,20 @@
 (defun cua-resize-rectangle-down (n)
   "Resize rectangle downwards."
   (interactive "p")
-  (let ((pad (cua--rectangle-padding)) resized)
+  (let (resized)
     (while (> n 0)
       (setq n (1- n))
       (cond
        ((>= (cua--rectangle-corner) 2)
         (goto-char (cua--rectangle-bot))
-        (when (cua--forward-line 1 pad)
-          (move-to-column (cua--rectangle-column) pad)
+        (when (cua--forward-line 1)
+          (move-to-column (cua--rectangle-column))
           (cua--rectangle-bot t)
           (setq resized t)))
        (t
         (goto-char (cua--rectangle-top))
-        (when (cua--forward-line 1 pad)
-          (move-to-column (cua--rectangle-column) pad)
+        (when (cua--forward-line 1)
+          (move-to-column (cua--rectangle-column))
           (cua--rectangle-top t)
           (setq resized t)))))
     (if resized
@@ -364,20 +351,20 @@
 (defun cua-resize-rectangle-up (n)
   "Resize rectangle upwards."
   (interactive "p")
-  (let ((pad (cua--rectangle-padding)) resized)
+  (let (resized)
     (while (> n 0)
       (setq n (1- n))
       (cond
        ((>= (cua--rectangle-corner) 2)
         (goto-char (cua--rectangle-bot))
-        (when (cua--forward-line -1 pad)
-          (move-to-column (cua--rectangle-column) pad)
+        (when (cua--forward-line -1)
+          (move-to-column (cua--rectangle-column))
           (cua--rectangle-bot t)
           (setq resized t)))
        (t
         (goto-char (cua--rectangle-top))
-        (when (cua--forward-line -1 pad)
-          (move-to-column (cua--rectangle-column) pad)
+        (when (cua--forward-line -1)
+          (move-to-column (cua--rectangle-column))
           (cua--rectangle-top t)
           (setq resized t)))))
     (if resized
@@ -408,7 +395,7 @@
   "Resize rectangle to bottom of buffer."
   (interactive)
   (goto-char (point-max))
-  (move-to-column (cua--rectangle-column) (cua--rectangle-padding))
+  (move-to-column (cua--rectangle-column))
   (cua--rectangle-bot t)
   (cua--rectangle-resized))
 
@@ -416,31 +403,29 @@
   "Resize rectangle to top of buffer."
   (interactive)
   (goto-char (point-min))
-  (move-to-column (cua--rectangle-column) (cua--rectangle-padding))
+  (move-to-column (cua--rectangle-column))
   (cua--rectangle-top t)
   (cua--rectangle-resized))
 
 (defun cua-resize-rectangle-page-up ()
   "Resize rectangle upwards by one scroll page."
   (interactive)
-  (let ((pad (cua--rectangle-padding)))
-    (scroll-down)
-    (move-to-column (cua--rectangle-column) pad)
-    (if (>= (cua--rectangle-corner) 2)
-        (cua--rectangle-bot t)
-      (cua--rectangle-top t))
-    (cua--rectangle-resized)))
+  (scroll-down)
+  (move-to-column (cua--rectangle-column))
+  (if (>= (cua--rectangle-corner) 2)
+      (cua--rectangle-bot t)
+    (cua--rectangle-top t))
+  (cua--rectangle-resized))
 
 (defun cua-resize-rectangle-page-down ()
   "Resize rectangle downwards by one scroll page."
   (interactive)
-  (let ((pad (cua--rectangle-padding)))
-    (scroll-up)
-    (move-to-column (cua--rectangle-column) pad)
-    (if (>= (cua--rectangle-corner) 2)
-        (cua--rectangle-bot t)
-      (cua--rectangle-top t))
-    (cua--rectangle-resized)))
+  (scroll-up)
+  (move-to-column (cua--rectangle-column))
+  (if (>= (cua--rectangle-corner) 2)
+      (cua--rectangle-bot t)
+    (cua--rectangle-top t))
+  (cua--rectangle-resized))
 
 ;;; Mouse support
 
@@ -450,7 +435,8 @@
   "Set rectangle corner at mouse click position."
   (interactive "e")
   (mouse-set-point event)
-  (if (cua--rectangle-padding)
+  ;; FIX ME -- need to calculate virtual column.
+  (if (cua--rectangle-virtual-edges)
       (move-to-column (car (posn-col-row (event-end event))) t))
   (if (cua--rectangle-right-side)
       (cua--rectangle-right (current-column))
@@ -470,6 +456,7 @@
     (cua--deactivate t))
   (setq cua--last-rectangle nil)
   (mouse-set-point event)
+  ;; FIX ME -- need to calculate virtual column.
   (cua-set-rectangle-mark)
   (setq cua--buffer-and-point-before-command nil)
   (setq cua--mouse-last-pos nil))
@@ -489,13 +476,13 @@
     (let ((cua-keep-region-after-copy t))
       (cua-copy-rectangle arg)
       (setq cua--mouse-last-pos (cons (point) cua--last-killed-rectangle)))))
+
 (defun cua--mouse-ignore (event)
   (interactive "e")
   (setq this-command last-command))
 
 (defun cua--rectangle-move (dir)
-  (let ((pad (cua--rectangle-padding))
-        (moved t)
+  (let ((moved t)
         (top (cua--rectangle-top))
         (bot (cua--rectangle-bot))
         (l (cua--rectangle-left))
@@ -503,17 +490,17 @@
     (cond
      ((eq dir 'up)
       (goto-char top)
-      (when (cua--forward-line -1 pad)
+      (when (cua--forward-line -1)
         (cua--rectangle-top t)
         (goto-char bot)
         (forward-line -1)
         (cua--rectangle-bot t)))
      ((eq dir 'down)
       (goto-char bot)
-      (when (cua--forward-line 1 pad)
+      (when (cua--forward-line 1)
         (cua--rectangle-bot t)
         (goto-char top)
-        (cua--forward-line 1 pad)
+        (cua--forward-line 1)
         (cua--rectangle-top t)))
      ((eq dir 'left)
       (when (> l 0)
@@ -526,19 +513,37 @@
       (setq moved nil)))
     (when moved
       (setq cua--buffer-and-point-before-command nil)
-      (cua--pad-rectangle)
       (cua--rectangle-set-corners)
       (cua--keep-active))))
 
 
 ;;; Operations on current rectangle
 
-(defun cua--rectangle-operation (keep-clear visible undo pad &optional fct post-fct)
+(defun cua--tabify-start (start end)
+  ;; Return position where auto-tabify should start (or nil if not required).
+  (save-excursion
+    (save-restriction
+      (widen)
+      (and (not buffer-read-only)
+	   cua-auto-tabify-rectangles
+	   (if (or (not (integerp cua-auto-tabify-rectangles))
+		   (= (point-min) (point-max))
+		   (progn
+		     (goto-char (max (point-min)
+				     (- start cua-auto-tabify-rectangles)))
+		     (search-forward "\t" (min (point-max)
+					       (+ end cua-auto-tabify-rectangles)) t)))
+	       start)))))
+
+(defun cua--rectangle-operation (keep-clear visible undo pad tabify &optional fct post-fct)
   ;; Call FCT for each line of region with 4 parameters:
   ;; Region start, end, left-col, right-col
   ;; Point is at start when FCT is called
+  ;; Call fct with (s,e) = whole lines if VISIBLE non-nil.
+  ;; Only call fct for visible lines if VISIBLE==t.
   ;; Set undo boundary if UNDO is non-nil.
-  ;; Rectangle is padded if PAD = t or numeric and (cua--rectangle-padding)
+  ;; Rectangle is padded if PAD = t or numeric and (cua--rectangle-virtual-edges)
+  ;; Perform auto-tabify after operation if TABIFY is non-nil.
   ;; Mark is kept if keep-clear is 'keep and cleared if keep-clear is 'clear.
   (let* ((start (cua--rectangle-top))
          (end   (cua--rectangle-bot))
@@ -546,11 +551,12 @@
          (r (1+ (cua--rectangle-right)))
          (m (make-marker))
          (tabpad (and (integerp pad) (= pad 2)))
-         (sel (cua--rectangle-restriction)))
+         (sel (cua--rectangle-restriction))
+	 (tabify-start (and tabify (cua--tabify-start start end))))
     (if undo
         (cua--rectangle-undo-boundary))
     (if (integerp pad)
-        (setq pad (cua--rectangle-padding)))
+        (setq pad (cua--rectangle-virtual-edges)))
     (save-excursion
       (save-restriction
         (widen)
@@ -558,7 +564,7 @@
           (goto-char end)
           (and (bolp) (not (eolp)) (not (eobp))
                (setq end (1+ end))))
-        (when visible
+        (when (eq visible t)
           (setq start (max (window-start) start))
           (setq end   (min (window-end) end)))
         (goto-char end)
@@ -575,7 +581,7 @@
               (forward-char 1))
           (set-marker m (point))
           (move-to-column l pad)
-          (if (and fct (>= (current-column) l) (<= (current-column) r))
+          (if (and fct (or visible (and (>= (current-column) l) (<= (current-column) r))))
               (let ((v t) (p (point)))
                 (when sel
                   (if (car (cdr sel))
@@ -585,8 +591,7 @@
                   (if (car (cdr (cdr sel)))
                       (setq v (null v))))
                 (if visible
-		    (unless (eolp)
-			(funcall fct p m l r v))
+		    (funcall fct p m l r v)
                   (if v
                       (funcall fct p m l r)))))
           (set-marker m nil)
@@ -594,7 +599,9 @@
         (if (not visible)
             (cua--rectangle-bot t))
         (if post-fct
-            (funcall post-fct l r))))
+            (funcall post-fct l r))
+	(when tabify-start
+	  (tabify tabify-start (point)))))
     (cond
      ((eq keep-clear 'keep)
       (cua--keep-active))
@@ -607,48 +614,96 @@
 
 (put 'cua--rectangle-operation 'lisp-indent-function 4)
 
-(defun cua--pad-rectangle (&optional pad)
-  (if (or pad (cua--rectangle-padding))
-      (cua--rectangle-operation nil nil t t)))
-
 (defun cua--delete-rectangle ()
-  (cua--rectangle-operation nil nil t 2
-    '(lambda (s e l r)
-       (if (and (> e s) (<= e (point-max)))
-	   (delete-region s e)))))
+  (let ((lines 0))
+    (if (not (cua--rectangle-virtual-edges))
+	(cua--rectangle-operation nil nil t 2 t
+	  '(lambda (s e l r v)
+	     (setq lines (1+ lines))
+	     (if (and (> e s) (<= e (point-max)))
+		 (delete-region s e))))
+      (cua--rectangle-operation nil 1 t nil t
+	'(lambda (s e l r v)
+	   (setq lines (1+ lines))
+	   (when (and (> e s) (<= e (point-max)))
+	     (delete-region s e)))))
+    lines))
 
 (defun cua--extract-rectangle ()
   (let (rect)
-    (cua--rectangle-operation nil nil nil 1
-     '(lambda (s e l r)
-        (setq rect (cons (buffer-substring-no-properties s e) rect))))
-      (nreverse rect)))
+    (if (not (cua--rectangle-virtual-edges))
+	(cua--rectangle-operation nil nil nil nil nil ; do not tabify
+	  '(lambda (s e l r)
+	     (setq rect (cons (buffer-substring-no-properties s e) rect))))
+      (cua--rectangle-operation nil 1 nil nil nil ; do not tabify
+	'(lambda (s e l r v)
+	   (let ((copy t) (bs 0) (as 0) row)
+	     (if (= s e) (setq e (1+ e)))
+	     (goto-char s)
+	     (move-to-column l)
+	     (if (= (point) (line-end-position))
+		 (setq bs (- r l)
+		       copy nil)
+	       (skip-chars-forward "\s\t" e)
+	       (setq bs (- (min r (current-column)) l)
+		     s (point))
+	       (move-to-column r)
+	       (skip-chars-backward "\s\t" s)
+	       (setq as (- r (max (current-column) l))
+		     e (point)))
+       	     (setq row (if (and copy (> e s))
+			   (buffer-substring-no-properties s e)
+			 ""))
+    	     (when (> bs 0)
+    	       (setq row (concat (make-string bs ?\s) row)))
+    	     (when (> as 0)
+    	       (setq row (concat row (make-string as ?\s))))
+    	     (setq rect (cons row rect))))))
+    (nreverse rect)))
 
-(defun cua--insert-rectangle (rect &optional below)
+(defun cua--insert-rectangle (rect &optional below paste-column line-count)
   ;; Insert rectangle as insert-rectangle, but don't set mark and exit with
   ;; point at either next to top right or below bottom left corner
   ;; Notice: In overwrite mode, the rectangle is inserted as separate text lines.
-  (if (and below (eq below 'auto))
+  (if (eq below 'auto)
       (setq below (and (bolp)
                        (or (eolp) (eobp) (= (1+ (point)) (point-max))))))
+  (unless paste-column
+    (setq paste-column (current-column)))
   (let ((lines rect)
-        (insertcolumn (current-column))
         (first t)
+	(tabify-start (cua--tabify-start (point) (point)))
+	last-column
         p)
     (while (or lines below)
       (or first
           (if overwrite-mode
               (insert ?\n)
             (forward-line 1)
-            (or (bolp) (insert ?\n))
-            (move-to-column insertcolumn t)))
+            (or (bolp) (insert ?\n))))
+      (unless overwrite-mode
+	(move-to-column paste-column t))
       (if (not lines)
           (setq below nil)
         (insert-for-yank (car lines))
+	(unless last-column
+	  (setq last-column (current-column)))
         (setq lines (cdr lines))
         (and first (not below)
              (setq p (point))))
-      (setq first nil))
+      (setq first nil)
+      (if (and line-count (= (setq line-count (1- line-count)) 0))
+	  (setq lines nil)))
+    (when (and line-count last-column (not overwrite-mode))
+      (while (> line-count 0)
+	(forward-line 1)
+	(or (bolp) (insert ?\n))
+	(move-to-column paste-column t)
+        (insert-char ?\s (- last-column paste-column -1))
+	(setq line-count (1- line-count))))
+    (when (and tabify-start
+	       (not overwrite-mode))
+      (tabify tabify-start (point)))
     (and p (not overwrite-mode)
          (goto-char p))))
 
@@ -662,7 +717,7 @@
                    (function (lambda (row) (concat row "\n")))
                    killed-rectangle "")))))
 
-(defun cua--activate-rectangle (&optional force)
+(defun cua--activate-rectangle ()
   ;; Turn on rectangular marking mode by disabling transient mark mode
   ;; and manually handling highlighting from a post command hook.
   ;; Be careful if we are already marking a rectangle.
@@ -671,12 +726,8 @@
                  (eq (car cua--last-rectangle) (current-buffer))
                  (eq (car (cdr cua--last-rectangle)) (point)))
             (cdr (cdr cua--last-rectangle))
-          (cua--rectangle-get-corners
-           (and (not buffer-read-only)
-                (or cua-auto-expand-rectangles
-                    force
-                    (eq major-mode 'picture-mode)))))
-        cua--status-string (if (cua--rectangle-padding) " Pad" "")
+          (cua--rectangle-get-corners))
+        cua--status-string (if (cua--rectangle-virtual-edges) " [R]" "")
         cua--last-rectangle nil))
 
 ;; (defvar cua-save-point nil)
@@ -698,7 +749,7 @@
   ;; Each overlay extends across all the columns of the rectangle.
   ;; We try to reuse overlays where possible because this is more efficient
   ;; and results in less flicker.
-  ;; If cua--rectangle-padding is nil and the buffer contains tabs or short lines,
+  ;; If cua--rectangle-virtual-edges is nil and the buffer contains tabs or short lines,
   ;; the higlighted region may not be perfectly rectangular.
   (let ((deactivate-mark deactivate-mark)
         (old cua--rectangle-overlays)
@@ -707,12 +758,59 @@
         (right (1+ (cua--rectangle-right))))
     (when (/= left right)
       (sit-for 0)  ; make window top/bottom reliable
-      (cua--rectangle-operation nil t nil nil
+      (cua--rectangle-operation nil t nil nil nil ; do not tabify
         '(lambda (s e l r v)
            (let ((rface (if v 'cua-rectangle-face 'cua-rectangle-noselect-face))
-                 overlay)
-             ;; Trim old leading overlays.
+                 overlay bs as)
 	     (if (= s e) (setq e (1+ e)))
+	     (when (cua--rectangle-virtual-edges)
+	       (let ((lb (line-beginning-position))
+		     (le (line-end-position))
+		     cl cl0 pl cr cr0 pr)
+		 (goto-char s)
+		 (setq cl (move-to-column l)
+		       pl (point))
+		 (setq cr (move-to-column r)
+		       pr (point))
+		 (if (= lb pl)
+		     (setq cl0 0)
+		   (goto-char (1- pl))
+		   (setq cl0 (current-column)))
+		 (if (= lb le)
+		     (setq cr0 0)
+		   (goto-char (1- pr))
+		   (setq cr0 (current-column)))
+		 (unless (and (= cl l) (= cr r))
+		   (when (/= cl l)
+		     (setq bs (propertize
+			       (make-string
+				(- l cl0 (if (and (= le pl) (/= le lb)) 1 0))
+				(if cua--virtual-edges-debug ?. ?\s))
+			       'face 'default))
+		     (if (/= pl le)
+			 (setq s (1- s))))
+		   (cond
+		    ((= cr r)
+		     (if (and (/= cr0 (1- cr))
+			      (= (mod cr tab-width) 0))
+			 (setq e (1- e))))
+		    ((= cr cl)
+		     (setq bs (concat bs
+				      (propertize
+				       (make-string
+					(- r l)
+					(if cua--virtual-edges-debug ?, ?\s))
+				       'face rface)))
+		     (setq rface nil))
+		    (t
+		     (setq as (propertize
+			       (make-string
+				(- r cr0 (if (= le pr) 1 0))
+				(if cua--virtual-edges-debug ?~ ?\s))
+			       'face rface))
+		     (if (/= pr le)
+			 (setq e (1- e))))))))
+	     ;; Trim old leading overlays.
              (while (and old
                          (setq overlay (car old))
                          (< (overlay-start overlay) s)
@@ -728,8 +826,10 @@
                    (move-overlay overlay s e)
                    (setq old (cdr old)))
                (setq overlay (make-overlay s e)))
-             (overlay-put overlay 'face rface)
-             (setq new (cons overlay new))))))
+	     (overlay-put overlay 'before-string bs)
+	     (overlay-put overlay 'after-string as)
+	     (overlay-put overlay 'face rface)
+	     (setq new (cons overlay new))))))
     ;; Trim old trailing overlays.
     (mapcar (function delete-overlay) old)
     (setq cua--rectangle-overlays (nreverse new))))
@@ -737,9 +837,9 @@
 (defun cua--indent-rectangle (&optional ch to-col clear)
   ;; Indent current rectangle.
   (let ((col (cua--rectangle-insert-col))
-        (pad (cua--rectangle-padding))
+        (pad (cua--rectangle-virtual-edges))
         indent)
-    (cua--rectangle-operation (if clear 'clear 'corners) nil t pad
+    (cua--rectangle-operation (if clear 'clear 'corners) nil t pad t
       '(lambda (s e l r)
          (move-to-column col pad)
          (if (and (eolp)
@@ -877,21 +977,18 @@
   (cua--rectangle-corner (if (= (cua--rectangle-left) (cua--rectangle-right)) 0 1))
   (cua--rectangle-set-corners))
 
-(defun cua-toggle-rectangle-padding ()
+(defun cua-toggle-rectangle-virtual-edges ()
   (interactive)
-  (if buffer-read-only
-      (message "Cannot do padding in read-only buffer.")
-    (cua--rectangle-padding t (not (cua--rectangle-padding)))
-    (cua--pad-rectangle)
-    (cua--rectangle-set-corners))
-  (setq cua--status-string (and (cua--rectangle-padding) " Pad"))
+  (cua--rectangle-virtual-edges t (not (cua--rectangle-virtual-edges)))
+  (cua--rectangle-set-corners)
+  (setq cua--status-string (and (cua--rectangle-virtual-edges) " [R]"))
   (cua--keep-active))
 
 (defun cua-do-rectangle-padding ()
   (interactive)
   (if buffer-read-only
       (message "Cannot do padding in read-only buffer.")
-    (cua--pad-rectangle t)
+    (cua--rectangle-operation nil nil t t t)
     (cua--rectangle-set-corners))
   (cua--keep-active))
 
@@ -900,7 +997,7 @@
 The text previously in the region is not overwritten by the blanks,
 but instead winds up to the right of the rectangle."
   (interactive)
-  (cua--rectangle-operation 'corners nil t 1
+  (cua--rectangle-operation 'corners nil t 1 nil
    '(lambda (s e l r)
       (skip-chars-forward " \t")
       (let ((ws (- (current-column) l))
@@ -915,7 +1012,7 @@
 at that column is deleted.
 With prefix arg, also delete whitespace to the left of that column."
   (interactive "P")
-  (cua--rectangle-operation 'clear nil t 1
+  (cua--rectangle-operation 'clear nil t 1 nil
    '(lambda (s e l r)
       (when arg
         (skip-syntax-backward " " (line-beginning-position))
@@ -927,7 +1024,7 @@
   "Blank out CUA rectangle.
 The text previously in the rectangle is overwritten by the blanks."
   (interactive)
-  (cua--rectangle-operation 'keep nil nil 1
+  (cua--rectangle-operation 'keep nil nil 1 nil
    '(lambda (s e l r)
       (goto-char e)
       (skip-syntax-forward " " (line-end-position))
@@ -942,7 +1039,7 @@
   "Align rectangle lines to left column."
   (interactive)
   (let (x)
-    (cua--rectangle-operation 'clear nil t t
+    (cua--rectangle-operation 'clear nil t t nil
      '(lambda (s e l r)
         (let ((b (line-beginning-position)))
           (skip-syntax-backward "^ " b)
@@ -984,7 +1081,7 @@
   "Replace CUA rectangle contents with STRING on each line.
 The length of STRING need not be the same as the rectangle width."
   (interactive "sString rectangle: ")
-  (cua--rectangle-operation 'keep nil t t
+  (cua--rectangle-operation 'keep nil t t nil
      '(lambda (s e l r)
         (delete-region s e)
         (skip-chars-forward " \t")
@@ -999,7 +1096,7 @@
 (defun cua-fill-char-rectangle (ch)
   "Replace CUA rectangle contents with CHARACTER."
   (interactive "cFill rectangle with character: ")
-  (cua--rectangle-operation 'clear nil t 1
+  (cua--rectangle-operation 'clear nil t 1 nil
    '(lambda (s e l r)
       (delete-region s e)
       (move-to-column l t)
@@ -1010,7 +1107,7 @@
   (interactive "sReplace regexp: \nsNew text: ")
   (if buffer-read-only
       (message "Cannot replace in read-only buffer")
-    (cua--rectangle-operation 'keep nil t 1
+    (cua--rectangle-operation 'keep nil t 1 nil
      '(lambda (s e l r)
         (if (re-search-forward regexp e t)
             (replace-match newtext nil nil))))))
@@ -1018,7 +1115,7 @@
 (defun cua-incr-rectangle (increment)
   "Increment each line of CUA rectangle by prefix amount."
   (interactive "p")
-  (cua--rectangle-operation 'keep nil t 1
+  (cua--rectangle-operation 'keep nil t 1 nil
      '(lambda (s e l r)
         (cond
          ((re-search-forward "0x\\([0-9a-fA-F]+\\)" e t)
@@ -1051,36 +1148,36 @@
   (if (= (length fmt) 0)
       (setq fmt cua--rectangle-seq-format)
     (setq cua--rectangle-seq-format fmt))
-  (cua--rectangle-operation 'clear nil t 1
+  (cua--rectangle-operation 'clear nil t 1 nil
      '(lambda (s e l r)
          (delete-region s e)
          (insert (format fmt first))
          (setq first (+ first incr)))))
 
-(defmacro cua--convert-rectangle-as (command)
-  `(cua--rectangle-operation 'clear nil nil nil
+(defmacro cua--convert-rectangle-as (command tabify)
+  `(cua--rectangle-operation 'clear nil nil nil ,tabify
     '(lambda (s e l r)
        (,command s e))))
 
 (defun cua-upcase-rectangle ()
   "Convert the rectangle to upper case."
   (interactive)
-  (cua--convert-rectangle-as upcase-region))
+  (cua--convert-rectangle-as upcase-region nil))
 
 (defun cua-downcase-rectangle ()
   "Convert the rectangle to lower case."
   (interactive)
-  (cua--convert-rectangle-as downcase-region))
+  (cua--convert-rectangle-as downcase-region nil))
 
 (defun cua-upcase-initials-rectangle ()
   "Convert the rectangle initials to upper case."
   (interactive)
-  (cua--convert-rectangle-as upcase-initials-region))
+  (cua--convert-rectangle-as upcase-initials-region nil))
 
 (defun cua-capitalize-rectangle ()
   "Convert the rectangle to proper case."
   (interactive)
-  (cua--convert-rectangle-as capitalize-region))
+  (cua--convert-rectangle-as capitalize-region nil))
 
 
 ;;; Replace/rearrange text in current rectangle
@@ -1116,7 +1213,7 @@
       (setq z (reverse z))
       (if cua--debug
 	  (print z auxbuf))
-      (cua--rectangle-operation nil nil t pad
+      (cua--rectangle-operation nil nil t pad nil
         '(lambda (s e l r)
            (let (cc)
              (goto-char e)
@@ -1232,9 +1329,9 @@
   "Delete char to left or right of rectangle."
   (interactive)
   (let ((col (cua--rectangle-insert-col))
-        (pad (cua--rectangle-padding))
+        (pad (cua--rectangle-virtual-edges))
         indent)
-    (cua--rectangle-operation 'corners nil t pad
+    (cua--rectangle-operation 'corners nil t pad nil
      '(lambda (s e l r)
         (move-to-column
          (if (cua--rectangle-right-side t)
@@ -1282,10 +1379,7 @@
         (cua--rectangle-left (current-column)))
       (if (>= (cua--rectangle-corner) 2)
           (cua--rectangle-bot t)
-        (cua--rectangle-top t))
-      (if (cua--rectangle-padding)
-          (setq unread-command-events
-                (cons (if cua-use-hyper-key ?\H-P ?\M-P) unread-command-events)))))
+        (cua--rectangle-top t))))
   (if cua--rectangle
       (if (and mark-active
                (not deactivate-mark))
@@ -1379,7 +1473,7 @@
   (cua--rect-M/H-key ?m	'cua-copy-rectangle-as-text)
   (cua--rect-M/H-key ?n	'cua-sequence-rectangle)
   (cua--rect-M/H-key ?o	'cua-open-rectangle)
-  (cua--rect-M/H-key ?p	'cua-toggle-rectangle-padding)
+  (cua--rect-M/H-key ?p	'cua-toggle-rectangle-virtual-edges)
   (cua--rect-M/H-key ?P	'cua-do-rectangle-padding)
   (cua--rect-M/H-key ?q	'cua-refill-rectangle)
   (cua--rect-M/H-key ?r	'cua-replace-in-rectangle)
--- a/lisp/ielm.el	Tue Aug 31 16:30:29 2004 +0000
+++ b/lisp/ielm.el	Tue Aug 31 16:31:03 2004 +0000
@@ -198,7 +198,7 @@
 ;;; Completion stuff
 
 (defun ielm-tab nil
-  "Possibly indent the current line as lisp code."
+  "Possibly indent the current line as Lisp code."
   (interactive)
   (if (or (eq (preceding-char) ?\n)
 	  (eq (char-syntax (preceding-char)) ? ))
@@ -207,7 +207,7 @@
 	t)))
 
 (defun ielm-complete-symbol nil
-  "Complete the lisp symbol before point."
+  "Complete the Lisp symbol before point."
   ;; A wrapper for lisp-complete symbol that returns non-nil if
   ;; completion has occurred
   (let* ((btick (buffer-modified-tick))
@@ -528,7 +528,7 @@
     (condition-case nil
 	(start-process "ielm" (current-buffer) "hexl")
       (file-error (start-process "ielm" (current-buffer) "cat")))
-    (process-kill-without-query (ielm-process))
+    (set-process-query-on-exit-flag (ielm-process) nil)
     (goto-char (point-max))
 
     ;; Lisp output can include raw characters that confuse comint's
--- a/lisp/indent.el	Tue Aug 31 16:30:29 2004 +0000
+++ b/lisp/indent.el	Tue Aug 31 16:31:03 2004 +0000
@@ -442,8 +442,8 @@
   "Keymap used in `edit-tab-stops'.")
 
 (defvar edit-tab-stops-buffer nil
-  "Buffer whose tab stops are being edited--in case
-the variable `tab-stop-list' is local in that buffer.")
+  "Buffer whose tab stops are being edited.
+This matters if the variable `tab-stop-list' is local in that buffer.")
 
 (defun edit-tab-stops ()
   "Edit the tab stops used by `tab-to-tab-stop'.
--- a/lisp/international/utf-8.el	Tue Aug 31 16:30:29 2004 +0000
+++ b/lisp/international/utf-8.el	Tue Aug 31 16:31:03 2004 +0000
@@ -870,7 +870,9 @@
       ;; version of the string in the loop, since it's always loaded as
       ;; unibyte from a byte-compiled file.
       (let ((range (string-as-multibyte "^\xc0-\xc3\xe1-\xf7"))
+	    (buffer-multibyte enable-multibyte-characters)
 	    hash-table ch)
+	(set-buffer-multibyte t)
 	(when utf-translate-cjk-mode
 	  (if (not utf-translate-cjk-lang-env)
 	      ;; Check these characters:
@@ -893,7 +895,9 @@
 		(progn
 		  (insert ch)
 		  (delete-char 1))
-	      (forward-char 1)))))
+	      (forward-char 1))))
+	(or buffer-multibyte
+	    (set-buffer-multibyte nil)))
 
       (when (and utf-8-compose-scripts (> length 1))
 	;; These currently have definitions which cover the relevant
--- a/lisp/mh-e/ChangeLog	Tue Aug 31 16:30:29 2004 +0000
+++ b/lisp/mh-e/ChangeLog	Tue Aug 31 16:31:03 2004 +0000
@@ -1,3 +1,38 @@
+2004-08-21  Bill Wohler  <wohler@newt.com>
+
+	* Released MH-E version 7.82.
+     
+	* MH-E-NEWS, README: Updated for release 7.82.
+     
+	* mh-e.el (Version, mh-version): Updated for release 7.82.
+
+2004-08-24  Bill Wohler  <wohler@newt.com>
+
+	* mh-init.el (mh-variant-set): Changed MH to mh as that's what is
+	emitted by `mh-variant-mh-info' (closes SF #1014781).
+	(mh-variant-p): Added mu-mh to docstring.
+
+2004-08-23  Satyaki Das  <satyaki@theforce.stanford.edu>
+
+	* mh-acros.el (mh-require-cl): Remove unneeded autoloads.
+	(require): Add an advice to the function so that at compile time
+	the uncompiled file is loaded. This avoids compilation problems
+	when built in the Emacs tree.
+
+	* mh-mime.el (mh-identity-pgg-default-user-id): Defvar the
+	variable, to avoid compiler warnings.
+
+	* mh-e.el (mh-seq): Load mh-seq since functions defined there are
+	used here. Without this, the state mh-seq.elc would be loaded.
+
+	* mh-customize.el (mh-init, mh-identity): Load mh-init and
+	mh-identity at compile time manually, before the corresponding
+	stale elc files get autoloaded.
+
+2004-08-21  Bill Wohler  <wohler@newt.com>
+
+	* mh-e.el (Version, mh-version): Added +cvs to release number.
+
 2004-08-21  Bill Wohler  <wohler@newt.com>
 
 	* Released MH-E version 7.81.
--- a/lisp/mh-e/mh-acros.el	Tue Aug 31 16:30:29 2004 +0000
+++ b/lisp/mh-e/mh-acros.el	Tue Aug 31 16:31:03 2004 +0000
@@ -51,12 +51,7 @@
 \(setf (gethash ...) ...) that uses functions in `cl' at run time.  This macro
 recognizes that and loads `cl' where appropriate."
   (if (eq (car (macroexpand '(setf (gethash foo bar) baz))) 'cl-puthash)
-      `(progn
-         (require 'cl)
-         ;; Autoloads of CL functions go here...
-         (autoload 'cl-puthash "cl")
-         (autoload 'values "cl")
-         (autoload 'copy-tree "cl"))
+      `(require 'cl)
     `(eval-when-compile (require 'cl))))
 
 ;;; Macros to generate correct code for different emacs variants
@@ -130,6 +125,12 @@
                           (list 'nth ,x z)))
        (quote ,struct-name))))
 
+(defadvice require (around mh-prefer-el activate)
+  "Modify `require' to load uncompiled MH-E files."
+  (or (featurep (ad-get-arg 0))
+      (and (string-match "^mh-" (symbol-name (ad-get-arg 0)))
+           (load (format "%s.el" (ad-get-arg 0)) t t))
+      ad-do-it))
 
 (provide 'mh-acros)
 
--- a/lisp/mh-e/mh-customize.el	Tue Aug 31 16:30:29 2004 +0000
+++ b/lisp/mh-e/mh-customize.el	Tue Aug 31 16:31:03 2004 +0000
@@ -78,6 +78,13 @@
 (when mh-xemacs-flag
   (require 'mh-xemacs))
 
+;; XXX: Functions autoloaded from the following files are used to initialize
+;;  customizable variables. They are require'd here, since otherwise the
+;;  corresponding .elc would be loaded at compile time.
+(eval-when-compile
+  (require 'mh-init)
+  (require 'mh-identity))
+
 (defun mh-customize (&optional delete-other-windows-flag)
   "Customize MH-E variables.
 If optional argument DELETE-OTHER-WINDOWS-FLAG is non-nil, other windows in
--- a/lisp/mh-e/mh-e.el	Tue Aug 31 16:30:29 2004 +0000
+++ b/lisp/mh-e/mh-e.el	Tue Aug 31 16:31:03 2004 +0000
@@ -5,7 +5,7 @@
 
 ;; Author: Bill Wohler <wohler@newt.com>
 ;; Maintainer: Bill Wohler <wohler@newt.com>
-;; Version: 7.81
+;; Version: 7.82
 ;; Keywords: mail
 
 ;; This file is part of GNU Emacs.
@@ -89,6 +89,7 @@
 (require 'mh-utils)
 (require 'mh-init)
 (require 'mh-inc)
+(require 'mh-seq)
 (require 'gnus-util)
 (require 'easymenu)
 
@@ -96,7 +97,7 @@
 (defvar font-lock-auto-fontify)
 (defvar font-lock-defaults)
 
-(defconst mh-version "7.81" "Version number of MH-E.")
+(defconst mh-version "7.82" "Version number of MH-E.")
 
 ;;; Autoloads
 (autoload 'Info-goto-node "info")
--- a/lisp/mh-e/mh-init.el	Tue Aug 31 16:30:29 2004 +0000
+++ b/lisp/mh-e/mh-init.el	Tue Aug 31 16:31:03 2004 +0000
@@ -90,7 +90,7 @@
       (cond
        ((mh-variant-set-variant 'nmh)
         (message "%s installed as MH variant" mh-variant-in-use))
-       ((mh-variant-set-variant 'MH)
+       ((mh-variant-set-variant 'mh)
         (message "%s installed as MH variant" mh-variant-in-use))
        ((mh-variant-set-variant 'mu-mh)
         (message "%s installed as MH variant" mh-variant-in-use))
@@ -145,7 +145,7 @@
 ;;;###mh-autoload
 (defun mh-variant-p (&rest variants)
   "Return t if variant is any of VARIANTS.
-Currently known variants are 'mh and 'nmh."
+Currently known variants are 'MH, 'nmh, and 'mu-mh."
   (let ((variant-in-use
          (cadr (assoc 'variant (assoc mh-variant-in-use mh-variants)))))
     (not (null (member variant-in-use variants)))))
--- a/lisp/mh-e/mh-loaddefs.el	Tue Aug 31 16:30:29 2004 +0000
+++ b/lisp/mh-e/mh-loaddefs.el	Tue Aug 31 16:31:03 2004 +0000
@@ -13,7 +13,7 @@
 ;;;;;;  mh-check-whom mh-insert-signature mh-to-fcc mh-to-field mh-fill-paragraph-function
 ;;;;;;  mh-get-header-field mh-send-other-window mh-send mh-reply
 ;;;;;;  mh-redistribute mh-forward mh-extract-rejected-mail mh-edit-again)
-;;;;;;  "mh-comp" "mh-comp.el" (16665 55172))
+;;;;;;  "mh-comp" "mh-comp.el" (16665 53716))
 ;;; Generated autoloads from mh-comp.el
 
 (autoload (quote mh-edit-again) "mh-comp" "\
@@ -183,7 +183,7 @@
 ;;;;;;  mh-store-msg mh-undo-folder mh-sort-folder mh-page-digest-backwards
 ;;;;;;  mh-page-digest mh-pipe-msg mh-pack-folder mh-list-folders
 ;;;;;;  mh-kill-folder mh-copy-msg mh-burst-digest) "mh-funcs" "mh-funcs.el"
-;;;;;;  (16671 49652))
+;;;;;;  (16671 48788))
 ;;; Generated autoloads from mh-funcs.el
 
 (autoload (quote mh-burst-digest) "mh-funcs" "\
@@ -261,7 +261,7 @@
 ;;;;;;  mh-identity-insert-attribution-verb mh-identity-handler-attribution-verb
 ;;;;;;  mh-identity-handler-signature mh-identity-handler-gpg-identity
 ;;;;;;  mh-insert-identity mh-identity-list-set mh-identity-make-menu)
-;;;;;;  "mh-identity" "mh-identity.el" (16680 7172))
+;;;;;;  "mh-identity" "mh-identity.el" (16671 57010))
 ;;; Generated autoloads from mh-identity.el
 
 (autoload (quote mh-identity-make-menu) "mh-identity" "\
@@ -307,7 +307,7 @@
 ;;;***
 
 ;;;### (autoloads (mh-inc-spool-list-set) "mh-inc" "mh-inc.el" (16671
-;;;;;;  49652))
+;;;;;;  48848))
 ;;; Generated autoloads from mh-inc.el
 
 (autoload (quote mh-inc-spool-list-set) "mh-inc" "\
@@ -326,7 +326,7 @@
 ;;;;;;  mh-index-parse-search-regexp mh-index-do-search mh-index-p
 ;;;;;;  mh-index-read-data mh-index-search mh-index-create-sequences
 ;;;;;;  mh-create-sequence-map mh-index-update-maps) "mh-index" "mh-index.el"
-;;;;;;  (16665 55172))
+;;;;;;  (16665 53754))
 ;;; Generated autoloads from mh-index.el
 
 (autoload (quote mh-index-update-maps) "mh-index" "\
@@ -582,7 +582,7 @@
 ;;;***
 
 ;;;### (autoloads (mh-variants mh-variant-p mh-variant-set) "mh-init"
-;;;;;;  "mh-init.el" (16680 9361))
+;;;;;;  "mh-init.el" (16684 6777))
 ;;; Generated autoloads from mh-init.el
 
 (autoload (quote mh-variant-set) "mh-init" "\
@@ -593,7 +593,7 @@
 
 (autoload (quote mh-variant-p) "mh-init" "\
 Return t if variant is any of VARIANTS.
-Currently known variants are 'mh and 'nmh." nil nil)
+Currently known variants are 'MH, 'nmh, and 'mu-mh." nil nil)
 
 (autoload (quote mh-variants) "mh-init" "\
 Return a list of installed variants of MH on the system.
@@ -604,7 +604,7 @@
 ;;;***
 
 ;;;### (autoloads (mh-junk-whitelist mh-junk-blacklist) "mh-junk"
-;;;;;;  "mh-junk.el" (16671 49652))
+;;;;;;  "mh-junk.el" (16671 48929))
 ;;; Generated autoloads from mh-junk.el
 
 (autoload (quote mh-junk-blacklist) "mh-junk" "\
@@ -644,7 +644,7 @@
 ;;;;;;  mh-mhn-compose-external-compressed-tar mh-mhn-compose-anon-ftp
 ;;;;;;  mh-mhn-compose-insertion mh-file-mime-type mh-have-file-command
 ;;;;;;  mh-compose-forward mh-compose-insertion) "mh-mime" "mh-mime.el"
-;;;;;;  (16680 7172))
+;;;;;;  (16684 7323))
 ;;; Generated autoloads from mh-mime.el
 
 (autoload (quote mh-compose-insertion) "mh-mime" "\
@@ -857,7 +857,7 @@
 ;;;***
 
 ;;;### (autoloads (mh-do-search mh-pick-do-search mh-search-folder)
-;;;;;;  "mh-pick" "mh-pick.el" (16671 49652))
+;;;;;;  "mh-pick" "mh-pick.el" (16671 49140))
 ;;; Generated autoloads from mh-pick.el
 
 (autoload (quote mh-search-folder) "mh-pick" "\
@@ -882,7 +882,7 @@
 
 ;;;### (autoloads (mh-print-msg mh-ps-print-toggle-mime mh-ps-print-toggle-color
 ;;;;;;  mh-ps-print-toggle-faces mh-ps-print-msg-show mh-ps-print-msg-file
-;;;;;;  mh-ps-print-msg) "mh-print" "mh-print.el" (16680 9361))
+;;;;;;  mh-ps-print-msg) "mh-print" "mh-print.el" (16680 11171))
 ;;; Generated autoloads from mh-print.el
 
 (autoload (quote mh-ps-print-msg) "mh-print" "\
@@ -935,7 +935,7 @@
 ;;;;;;  mh-rename-seq mh-translate-range mh-read-range mh-read-seq-default
 ;;;;;;  mh-notate-deleted-and-refiled mh-widen mh-put-msg-in-seq
 ;;;;;;  mh-narrow-to-seq mh-msg-is-in-seq mh-list-sequences mh-delete-seq)
-;;;;;;  "mh-seq" "mh-seq.el" (16668 22297))
+;;;;;;  "mh-seq" "mh-seq.el" (16671 65286))
 ;;; Generated autoloads from mh-seq.el
 
 (autoload (quote mh-delete-seq) "mh-seq" "\
@@ -1157,7 +1157,7 @@
 
 ;;;### (autoloads (mh-speed-add-folder mh-speed-invalidate-map mh-speed-flists
 ;;;;;;  mh-speed-view mh-speed-toggle mh-folder-speedbar-buttons)
-;;;;;;  "mh-speed" "mh-speed.el" (16665 55171))
+;;;;;;  "mh-speed" "mh-speed.el" (16665 53793))
 ;;; Generated autoloads from mh-speed.el
 
 (autoload (quote mh-folder-speedbar-buttons) "mh-speed" "\
@@ -1196,7 +1196,7 @@
 ;;;;;;  mh-alias-grab-from-field mh-alias-add-alias mh-alias-for-from-p
 ;;;;;;  mh-alias-address-to-alias mh-alias-letter-expand-alias mh-alias-minibuffer-confirm-address
 ;;;;;;  mh-read-address mh-alias-reload-maybe mh-alias-reload) "mh-alias"
-;;;;;;  "mh-alias.el" (16671 49553))
+;;;;;;  "mh-alias.el" (16671 49382))
 ;;; Generated autoloads from mh-alias.el
 
 (autoload (quote mh-alias-reload) "mh-alias" "\
--- a/lisp/mh-e/mh-mime.el	Tue Aug 31 16:30:29 2004 +0000
+++ b/lisp/mh-e/mh-mime.el	Tue Aug 31 16:31:03 2004 +0000
@@ -583,6 +583,8 @@
     (mml-insert-empty-tag 'part 'type type 'filename file
                           'disposition dispos 'description description)))
 
+(defvar mh-identity-pgg-default-user-id)
+
 (defun mh-secure-message (method mode &optional identity)
   "Add directive to Encrypt/Sign an entire message.
 METHOD should be one of: \"pgpmime\", \"pgp\", \"smime\".
@@ -852,7 +854,7 @@
 ;;;###mh-autoload
 (defun mh-toggle-mh-decode-mime-flag ()
   "Toggle whether MH-E should decode MIME or not."
-  (interactive) 
+  (interactive)
   (setq mh-decode-mime-flag (not mh-decode-mime-flag))
   (mh-show nil t)
   (message (format "(setq mh-decode-mime-flag %s)" mh-decode-mime-flag)))
--- a/lisp/progmodes/etags.el	Tue Aug 31 16:30:29 2004 +0000
+++ b/lisp/progmodes/etags.el	Tue Aug 31 16:31:03 2004 +0000
@@ -772,26 +772,6 @@
 	(all-completions string (tags-completion-table) predicate)
       (try-completion string (tags-completion-table) predicate))))
 
-;; Return a default tag to search for, based on the text at point.
-(defun find-tag-default ()
-  (save-excursion
-    (while (looking-at "\\sw\\|\\s_")
-      (forward-char 1))
-    (if (or (re-search-backward "\\sw\\|\\s_"
-				(save-excursion (beginning-of-line) (point))
-				t)
-	    (re-search-forward "\\(\\sw\\|\\s_\\)+"
-			       (save-excursion (end-of-line) (point))
-			       t))
-	(progn (goto-char (match-end 0))
-	       (buffer-substring-no-properties
-                (point)
-                (progn (forward-sexp -1)
-                       (while (looking-at "\\s'")
-                         (forward-char 1))
-                       (point))))
-      nil)))
-
 ;; Read a tag name from the minibuffer with defaulting and completion.
 (defun find-tag-tag (string)
   (let* ((completion-ignore-case (if (memq tags-case-fold-search '(t nil))
--- a/lisp/progmodes/grep.el	Tue Aug 31 16:30:29 2004 +0000
+++ b/lisp/progmodes/grep.el	Tue Aug 31 16:31:03 2004 +0000
@@ -384,9 +384,7 @@
   (let ((tag-default
 	 (funcall (or find-tag-default-function
 		      (get major-mode 'find-tag-default-function)
-		      ;; We use grep-tag-default instead of
-		      ;; find-tag-default, to avoid loading etags.
-		      'grep-tag-default)))
+		      'find-tag-default)))
 	(sh-arg-re "\\(\\(?:\"\\(?:[^\"]\\|\\\\\"\\)+\"\\|'[^']+'\\|[^\"' \t\n]\\)+\\)")
 	(grep-default (or (car grep-history) grep-command)))
     ;; Replace the thing matching for with that around cursor.
@@ -457,25 +455,6 @@
   (set (make-local-variable 'compilation-error-regexp-alist)
        grep-regexp-alist))
 
-;; This is a copy of find-tag-default from etags.el.
-;;;###autoload
-(defun grep-tag-default ()
-  (save-excursion
-    (while (looking-at "\\sw\\|\\s_")
-      (forward-char 1))
-    (when (or (re-search-backward "\\sw\\|\\s_"
-				  (save-excursion (beginning-of-line) (point))
-				  t)
-	      (re-search-forward "\\(\\sw\\|\\s_\\)+"
-				 (save-excursion (end-of-line) (point))
-				 t))
-      (goto-char (match-end 0))
-      (buffer-substring (point)
-			(progn (forward-sexp -1)
-			       (while (looking-at "\\s'")
-				 (forward-char 1))
-			       (point))))))
-
 ;;;###autoload
 (defun grep-find (command-args)
   "Run grep via find, with user-specified args COMMAND-ARGS.
--- a/lisp/subr.el	Tue Aug 31 16:30:29 2004 +0000
+++ b/lisp/subr.el	Tue Aug 31 16:31:03 2004 +0000
@@ -1981,6 +1981,27 @@
 		(setq parent (get parent 'derived-mode-parent))))
     parent))
 
+(defun find-tag-default ()
+  "Determine default tag to search for, based on text at point.
+If there is no plausible default, return nil."
+  (save-excursion
+    (while (looking-at "\\sw\\|\\s_")
+      (forward-char 1))
+    (if (or (re-search-backward "\\sw\\|\\s_"
+				(save-excursion (beginning-of-line) (point))
+				t)
+	    (re-search-forward "\\(\\sw\\|\\s_\\)+"
+			       (save-excursion (end-of-line) (point))
+			       t))
+	(progn (goto-char (match-end 0))
+	       (buffer-substring-no-properties
+                (point)
+                (progn (forward-sexp -1)
+                       (while (looking-at "\\s'")
+                         (forward-char 1))
+                       (point))))
+      nil)))
+
 (defmacro with-syntax-table (table &rest body)
   "Evaluate BODY with syntax table of current buffer set to TABLE.
 The syntax table of the current buffer is saved, BODY is evaluated, and the
--- a/lisp/textmodes/tex-mode.el	Tue Aug 31 16:30:29 2004 +0000
+++ b/lisp/textmodes/tex-mode.el	Tue Aug 31 16:31:03 2004 +0000
@@ -1141,10 +1141,14 @@
 					 'occur-target tem)))))
 	    (goto-char prev-end))))
       (with-current-buffer standard-output
-	(if (eq num-matches 0)
-	    (insert "None!\n"))
-	(if (interactive-p)
-	    (message "%d mismatches found" num-matches))))))
+	(let ((no-matches (zerop num-matches)))
+	  (if no-matches
+	      (insert "None!\n"))
+	  (if (interactive-p)
+	      (message (cond (no-matches "No mismatches found")
+			     ((= num-matches 1) "1 mismatch found")
+			     (t "%d mismatches found"))
+		       num-matches)))))))
 
 (defun tex-validate-region (start end)
   "Check for mismatched braces or $'s in region.
@@ -1459,7 +1463,7 @@
        nil)
     (let ((proc (get-process "tex-shell")))
       (set-process-sentinel proc 'tex-shell-sentinel)
-      (process-kill-without-query proc)
+      (set-process-query-on-exit-flag proc nil)
       (tex-shell)
       (while (zerop (buffer-size))
 	(sleep-for 1)))))
@@ -1928,7 +1932,7 @@
 		(re-search-forward
 		 "^l\\.\\([0-9]+\\) \\(\\.\\.\\.\\)?\\(.*\\)$" nil 'move))
       (let* ((this-error (copy-marker begin-of-error))
-	     (linenum (string-to-int (match-string 1)))
+	     (linenum (string-to-number (match-string 1)))
 	     (error-text (regexp-quote (match-string 3)))
 	     (filename
 	      (save-excursion
--- a/lispref/ChangeLog	Tue Aug 31 16:30:29 2004 +0000
+++ b/lispref/ChangeLog	Tue Aug 31 16:31:03 2004 +0000
@@ -1,3 +1,9 @@
+2004-08-27  Luc Teirlinck  <teirllm@auburn.edu>
+
+	* abbrevs.texi (Abbrev Expansion): `abbrev-start-location' can be
+	an integer or a marker.
+	(Abbrev Expansion): Replace example for `pre-abbrev-expand-hook'.
+
 2004-08-22  Richard M. Stallman  <rms@gnu.org>
 
 	* modes.texi (Major Mode Conventions): Discuss rebinding of
--- a/lispref/abbrevs.texi	Tue Aug 31 16:30:29 2004 +0000
+++ b/lispref/abbrevs.texi	Tue Aug 31 16:31:03 2004 +0000
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1999
+@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1999, 2004
 @c   Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @setfilename ../info/abbrevs
@@ -288,7 +288,7 @@
 @end defopt
 
 @defvar abbrev-start-location
-The value of this variable is a marker pointing to the buffer position
+The value of this variable is a buffer position (an integer or a marker)
 for @code{expand-abbrev} to use as the start of the next abbrev to be
 expanded.  The value can also be @code{nil}, which means to use the
 word before point instead.  @code{abbrev-start-location} is set to
@@ -331,31 +331,42 @@
 the abbrev to be expanded by looking in the buffer before point.
 Running the hook is the first thing that @code{expand-abbrev} does, and
 so a hook function can be used to change the current abbrev table before
-abbrev lookup happens.
+abbrev lookup happens.  (Although you have to do this carefully.  See
+the example below.)
 @end defvar
 
   The following sample code shows a simple use of
-@code{pre-abbrev-expand-hook}.  If the user terminates an abbrev with
-a punctuation character, the hook function asks for confirmation.  It
-aborts expansion if the user does not confirm.
+@code{pre-abbrev-expand-hook}.  It assumes that @code{foo-mode} is a
+mode for editing certain files in which lines that start with @samp{#}
+are comments.  You want to use Text mode abbrevs for those lines.  The
+regular local abbrev table, @code{foo-mode-abbrev-table} is
+appropriate for all other lines.  Then you can put the following code
+in your @file{.emacs} file.  @xref{Standard Abbrev Tables}, for the
+definitions of @code{local-abbrev-table} and @code{text-mode-abbrev-table}.
 
 @smallexample
-(add-hook 'pre-abbrev-expand-hook 'query-if-not-space)
-
-;; @r{This is the function invoked by @code{pre-abbrev-expand-hook}.}
+(defun foo-mode-pre-abbrev-expand ()
+  (when (save-excursion (forward-line 0) (eq (char-after) ?#))
+    (let ((local-abbrev-table text-mode-abbrev-table)
+	  ;; Avoid infinite loop.
+	  (pre-abbrev-expand-hook nil))
+      (expand-abbrev))
+    ;; We have already called `expand-abbrev' in this hook.
+    ;; Hence we want the "actual" call following this hook to be a no-op.
+    (setq abbrev-start-location (point-max)
+	  abbrev-start-location-buffer (current-buffer))))
 
-;; @r{If the user terminated the abbrev with a space, the function does}
-;; @r{nothing (that is, it returns so that the abbrev can expand).  If the}
-;; @r{user entered some other character, this function asks whether}
-;; @r{expansion should continue.}
+(add-hook 'foo-mode-hook
+	  #'(lambda ()
+	      (add-hook 'pre-abbrev-expand-hook
+			'foo-mode-pre-abbrev-expand
+			nil t)))
+@end smallexample
 
-;; @r{The function's return value makes no difference.}
-
-(defun query-if-not-space ()
-  (if (/= ?\s last-command-char)
-      (if (not (y-or-n-p "Do you want to expand this abbrev? "))
-          (error "Not expanding this abbrev"))))
-@end smallexample
+Note that @code{foo-mode-pre-abbrex-expand} just returns @code{nil}
+without doing anything for lines not starting with @samp{#}.  Hence
+abbrevs expand normally using @code{foo-mode-abbrev-table} as local
+abbrev table for such lines.
 
 @node Standard Abbrev Tables,  , Abbrev Expansion, Abbrevs
 @comment  node-name,  next,  previous,  up
--- a/lwlib/ChangeLog	Tue Aug 31 16:30:29 2004 +0000
+++ b/lwlib/ChangeLog	Tue Aug 31 16:31:03 2004 +0000
@@ -1,3 +1,7 @@
+2004-08-30  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
+
+	* lwlib.h (_widget_value): Added lname and lkey.
+
 2004-01-12  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
 
 	* xlwmenuP.h (_XlwMenu_part): Added top_depth.
--- a/lwlib/lwlib.h	Tue Aug 31 16:30:29 2004 +0000
+++ b/lwlib/lwlib.h	Tue Aug 31 16:31:03 2004 +0000
@@ -64,10 +64,12 @@
 typedef struct _widget_value
 {
   /* name of widget */
+  Lisp_Object   lname;
   char*		name;
   /* value (meaning depend on widget type) */
   char*		value;
   /* keyboard equivalent. no implications for XtTranslations */
+  Lisp_Object   lkey;
   char*		key;
   /* Help string or nil if none.
      GC finds this string through the frame's menu_bar_vector
--- a/man/ChangeLog	Tue Aug 31 16:30:29 2004 +0000
+++ b/man/ChangeLog	Tue Aug 31 16:31:03 2004 +0000
@@ -1,9 +1,76 @@
+2004-08-30  Luc Teirlinck  <teirllm@auburn.edu>
+
+	* indent.texi: Various minor changes in addition to:
+	(Indentation Commands): Correct description of `indent-relative'.
+	(Tab Stops): <TAB> is no longer bound to `tab-to-tab-stop' in Text
+	mode.  The *Tab Stops* buffer uses Overwrite Mode.
+	(Just Spaces): `untabify' converts sequences of at least two
+	spaces to tabs.
+
+2004-08-28  Eli Zaretskii  <eliz@gnu.org>
+
+	* faq.texi (Emacs for MS-DOS): Update URLs for the MS-DOS port of
+	Emacs and related programs.
+
+2004-08-27  Luc Teirlinck  <teirllm@auburn.edu>
+
+	* frames.texi (Secondary Selection): Setting the secondary
+	selection with M-Drag-Mouse-1 does not alter the kill ring,
+	setting it with M-Mouse-1 and M-Mouse-3 does.
+	(Mode Line Mouse): C-Mouse-2 on scroll bar now also works for
+	toolkit scroll bars.
+	(Scroll Bars): Ditto.
+
+	* windows.texi (Basic Window): When using a window system, the value
+	of point in a non-selected window is indicated by a hollow box.
+	(Split Window): Side by side windows are separated by a scroll bar,
+	if scroll bars are used.
+	C-Mouse-2 on scroll bar now also works for toolkit scroll bars.
+	(Change Window): Correct Mouse-2 vs Mouse-3 mess-up.
+	(Window Convenience): Update bindings for `winner-undo' and
+	`winner-redo'.
+
+	* ack.texi (Acknowledgments): Use `@unnumbered'.
+	* misc.texi : Adapt sectioning in Info to the node structure.
+	(Invoking emacsclient): Make "Invoking emacsclient" a subsection
+	of "Using Emacs as a Server".
+	* building.texi (Building): Interchange nodes (for correct numbering).
+	* programs.texi (Programs): Interchange nodes (for correct numbering).
+	* killing.texi, entering.texi, commands.texi: Adapt sectioning in
+	Info to the node structure.
+	* emacs.texi: Make "GNU GENERAL PUBLIC LICENSE" an appendix.
+	Rearrange order of nodes and sections such that both "GNU GENERAL
+	PUBLIC LICENSE" and "GNU Free Documentation License" appear at the
+	end, as appropriate for appendices.
+	(Acknowledgments): Put inside @iftex instead of @ifnotinfo.
+	Use `@unnumberedsec'.
+	* trouble.texi: Adapt sectioning in Info to the node structure.
+	Adapt node pointers to change in emacs.texi.
+	* cmdargs.texi, doclicense.texi: Adapt node pointers.
+
+2004-08-27  Richard M. Stallman  <rms@gnu.org>
+
+	* faq.texi: Fix texinfo usage, esp. doublequotes.
+	(Difference between Emacs and XEmacs): Some clarification.
+
+	* faq.texi (Difference between Emacs and XEmacs):
+	Explain not to contrast XEmacs with GNU Emacs.
+
+2004-08-26  Richard M. Stallman  <rms@gnu.org>
+
+	* faq.texi (Difference between Emacs and XEmacs): Rewrite.
+
+2004-08-25  Kenichi Handa  <handa@m17n.org>
+
+	* custom.texi (Non-ASCII Rebinding): Fix and simplify the
+	description for unibyte mode.
+
 2004-08-23  Luc Teirlinck  <teirllm@auburn.edu>
 
-	* display.texi (Font Lock): Correct invalid @xref.
-
-	* search.texi (Regexps): Correct cryptic @ref.
-	(Configuring Scrolling): Correct invalid @xref.
+	* display.texi (Font Lock): Correct invalid (for hardcopy) @xref.
+
+	* search.texi (Regexps): Correct cryptic (in hardcopy) @ref.
+	(Configuring Scrolling): Correct invalid (for hardcopy) @xref.
 	(Regexp Replace): Standardize reference to hardcopy Elisp Manual
 	in @pxref.
 
--- a/man/ack.texi	Tue Aug 31 16:30:29 2004 +0000
+++ b/man/ack.texi	Tue Aug 31 16:31:03 2004 +0000
@@ -4,7 +4,7 @@
 @c See file emacs.texi for copying conditions.
 @c
 @node Acknowledgments, Screen, Concept Index, Top
-@chapter Acknowledgments
+@unnumbered Acknowledgments
 
 Many people have contributed code included in the Free Software
 Foundation's distribution of GNU Emacs.  To show our appreciation for
--- a/man/building.texi	Tue Aug 31 16:30:29 2004 +0000
+++ b/man/building.texi	Tue Aug 31 16:31:03 2004 +0000
@@ -23,8 +23,8 @@
                           with different facilities for running
                           the Lisp programs.
 * Libraries: Lisp Libraries.      Creating Lisp programs to run in Emacs.
+* Eval: Lisp Eval.      Executing a single Lisp expression in Emacs.
 * Interaction: Lisp Interaction.  Executing Lisp in an Emacs buffer.
-* Eval: Lisp Eval.      Executing a single Lisp expression in Emacs.
 * External Lisp::         Communicating through Emacs with a separate Lisp.
 @end menu
 
@@ -644,7 +644,7 @@
 @menu
 * Layout::               Control the number of displayed buffers.
 * Breakpoints Buffer::   A breakpoint control panel.
-* Stack Buffer::         Select a frame from the call stack. 
+* Stack Buffer::         Select a frame from the call stack.
 * Watch Expressions::    Monitor variable values in the speedbar.
 * Other Buffers::        Input/output, locals, registers and assembler buffers.
 @end menu
@@ -698,12 +698,12 @@
 @node Breakpoints Buffer
 @subsubsection Breakpoints Buffer
 
-The breakpoints buffer shows the existing breakpoints and watchpoints 
+The breakpoints buffer shows the existing breakpoints and watchpoints
 (@pxref{Breakpoints,,, gdb, The GNU debugger}).  It has three special
 commands:
 
 @table @kbd
-@item @key{SPC} 
+@item @key{SPC}
 @kindex SPC @r{(GDB breakpoints buffer)}
 @findex gdb-toggle-breakpoint
 Enable/disable the breakpoint at the current line
--- a/man/cmdargs.texi	Tue Aug 31 16:30:29 2004 +0000
+++ b/man/cmdargs.texi	Tue Aug 31 16:31:03 2004 +0000
@@ -1,7 +1,7 @@
 @c This is part of the Emacs manual.
 @c Copyright (C) 1985,86,87,93,94,95,97,2001,03,2004 Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
-@node Command Arguments, X Resources, Service, Top
+@node Command Arguments, X Resources, GNU Free Documentation License, Top
 @appendix Command Line Arguments
 @cindex command line arguments
 @cindex arguments (command line)
--- a/man/commands.texi	Tue Aug 31 16:30:29 2004 +0000
+++ b/man/commands.texi	Tue Aug 31 16:31:03 2004 +0000
@@ -10,6 +10,10 @@
 how Emacs interprets your keyboard and mouse input.
 @end iftex
 
+@ifnottex
+@raisesections
+@end ifnottex
+
 @node User Input, Keys, Screen, Top
 @section Kinds of User Input
 @cindex input with the keyboard
@@ -266,6 +270,10 @@
 alphabet of non-@acronym{ASCII} characters, but they all fit in one byte.  They
 use codes 0200 through 0377.  @xref{Single-Byte Character Support}.
 
+@ifnottex
+@lowersections
+@end ifnottex
+
 @ignore
    arch-tag: 9be43eef-d1f4-4d03-a916-c741ea713a45
 @end ignore
--- a/man/custom.texi	Tue Aug 31 16:30:29 2004 +0000
+++ b/man/custom.texi	Tue Aug 31 16:31:03 2004 +0000
@@ -1635,17 +1635,15 @@
 Type @kbd{C-q} followed by the key you want to bind, to insert @var{char}.
 
 Since this puts a non-@acronym{ASCII} character in the @file{.emacs},
-you should specify the proper coding system for that file.  @xref{Init
-Syntax}.  You should specify the same coding system for the file that
-you use for your keyboard.
+you should specify for that file a coding system that supports
+that character.  @xref{Init Syntax}.
 
-@strong{Warning:} if you change the keyboard encoding, or change
-from unibyte to multibyte mode, such that the code that
+@strong{Warning:} if you change the keyboard encoding, such that the code that
 @kbd{C-q} inserts becomes different, you'll need to edit the
 Lisp expression accordingly.
 
-If you bind 8-bit characters like this in your init file, you may find it
-convenient to specify that it is unibyte.  @xref{Enabling Multibyte}.
+@strong{Warning:} @kbd{C-q} will insert the wrong code if you visit
+the file @file{.emacs} in a unibyte buffer, so don't do that.
 
 @node Mouse Buttons
 @subsection Rebinding Mouse Buttons
--- a/man/doclicense.texi	Tue Aug 31 16:30:29 2004 +0000
+++ b/man/doclicense.texi	Tue Aug 31 16:31:03 2004 +0000
@@ -1,6 +1,5 @@
 @c -*-texinfo-*-
-@node GNU Free Documentation License, Intro, Copying, Top
-
+@node GNU Free Documentation License, Command Arguments, Copying, Top
 @appendix GNU Free Documentation License
 @center Version 1.1, March 2000
 
--- a/man/emacs.texi	Tue Aug 31 16:30:29 2004 +0000
+++ b/man/emacs.texi	Tue Aug 31 16:31:03 2004 +0000
@@ -901,7 +901,7 @@
 manual.  @xref{MS-DOS}, for information about using Emacs on MS-DOS.
 @end iftex
 
-@node Distrib, Copying, Top, Top
+@node Distrib, Intro, Top, Top
 @unnumbered Distribution
 
 GNU Emacs is @dfn{free software}; this means that everyone is free to
@@ -955,9 +955,9 @@
 might instead suggest ordering a CD-ROM from the Foundation
 occasionally, or subscribing to periodic updates.
 
-@ifnotinfo
-@node Acknowledgments, Copying, Distrib, Top
-@section Acknowledgments
+@iftex
+@node Acknowledgments, Intro, Distrib, Top
+@unnumberedsec Acknowledgments
 
 Contributors to GNU Emacs include Per Abrahamsen, Jay K. Adams, Joe
 Arceneaux, Boaz Ben-Zvi, Jim Blandy, Terrence Brannon, Frank Bresz,
@@ -1000,10 +1000,102 @@
 Wilkinson, Mike Williams, Steven A. Wood, Dale R. Worley, Felix
 S. T. Wu, Tom Wurgler, Eli Zaretskii, Jamie Zawinski, Ian T. Zimmermann,
 Reto Zimmermann, and Neal Ziring.
-@end ifnotinfo
+@end iftex
+
+@node Intro, Glossary, Distrib, Top
+@unnumbered Introduction
+
+  You are reading about GNU Emacs, the GNU incarnation of the advanced,
+self-documenting, customizable, extensible real-time display editor Emacs.
+(The `G' in `GNU' is not silent.)
+
+  We say that Emacs is a @dfn{display} editor because normally the text
+being edited is visible on the screen and is updated automatically as you
+type your commands.  @xref{Screen,Display}.
+
+  We call it a @dfn{real-time} editor because the display is updated very
+frequently, usually after each character or pair of characters you
+type.  This minimizes the amount of information you must keep in your
+head as you edit.  @xref{Basic,Real-time,Basic Editing}.
+
+  We call Emacs advanced because it provides facilities that go beyond
+simple insertion and deletion: controlling subprocesses; automatic
+indentation of programs; viewing two or more files at once; editing
+formatted text; and dealing in terms of characters, words, lines,
+sentences, paragraphs, and pages, as well as expressions and comments in
+several different programming languages.
+
+  @dfn{Self-documenting} means that at any time you can type a special
+character, @kbd{Control-h}, to find out what your options are.  You can
+also use it to find out what any command does, or to find all the commands
+that pertain to a topic.  @xref{Help}.
+
+  @dfn{Customizable} means that you can change the definitions of Emacs
+commands in little ways.  For example, if you use a programming language in
+which comments start with @samp{<**} and end with @samp{**>}, you can tell
+the Emacs comment manipulation commands to use those strings
+(@pxref{Comments}).  Another sort of customization is rearrangement of the
+command set.  For example, if you prefer the four basic cursor motion
+commands (up, down, left and right) on keys in a diamond pattern on the
+keyboard, you can rebind the keys that way.  @xref{Customization}.
 
-@node Copying, GNU Free Documentation License, Distrib, Top
-@unnumbered GNU GENERAL PUBLIC LICENSE
+  @dfn{Extensible} means that you can go beyond simple customization and
+write entirely new commands, programs in the Lisp language to be run by
+Emacs's own Lisp interpreter.  Emacs is an ``on-line extensible''
+system, which means that it is divided into many functions that call
+each other, any of which can be redefined in the middle of an editing
+session.  Almost any part of Emacs can be replaced without making a
+separate copy of all of Emacs.  Most of the editing commands of Emacs
+are written in Lisp; the few exceptions could have been written
+in Lisp but are written in C for efficiency.  Although only a programmer
+can write an extension, anybody can use it afterward.  If you want to
+learn Emacs Lisp programming, we recommend the @cite{Introduction to
+Emacs Lisp} by Robert J. Chassell, also published by the Free Software
+Foundation.
+
+   When run under the X Window System, Emacs provides its own menus and
+convenient bindings to mouse buttons.  But Emacs can provide many of the
+benefits of a window system on a text-only terminal.  For instance, you
+can look at or edit several files at once, move text between files, and
+edit files while running shell commands.
+
+@include screen.texi
+@include commands.texi
+@include entering.texi
+@include basic.texi
+@include mini.texi
+@include m-x.texi
+@include help.texi
+@include mark.texi
+@include killing.texi
+@include regs.texi
+@include display.texi
+@include search.texi
+@include fixit.texi
+@include kmacro.texi
+@include files.texi
+@include buffers.texi
+@include windows.texi
+@include frames.texi
+@include mule.texi
+@include major.texi
+@include indent.texi
+@include text.texi
+@include programs.texi
+@include building.texi
+@include maintaining.texi
+@include abbrevs.texi
+@include picture.texi
+@include sending.texi
+@include rmail.texi
+@include dired.texi
+@include calendar.texi
+@include misc.texi
+@include custom.texi
+@include trouble.texi
+
+@node Copying, GNU Free Documentation License, Service, Top
+@appendix GNU GENERAL PUBLIC LICENSE
 @center Version 2, June 1991
 
 @display
@@ -1399,98 +1491,6 @@
 Public License instead of this License.
 
 @include doclicense.texi
-
-@node Intro, Glossary, GNU Free Documentation License, Top
-@unnumbered Introduction
-
-  You are reading about GNU Emacs, the GNU incarnation of the advanced,
-self-documenting, customizable, extensible real-time display editor Emacs.
-(The `G' in `GNU' is not silent.)
-
-  We say that Emacs is a @dfn{display} editor because normally the text
-being edited is visible on the screen and is updated automatically as you
-type your commands.  @xref{Screen,Display}.
-
-  We call it a @dfn{real-time} editor because the display is updated very
-frequently, usually after each character or pair of characters you
-type.  This minimizes the amount of information you must keep in your
-head as you edit.  @xref{Basic,Real-time,Basic Editing}.
-
-  We call Emacs advanced because it provides facilities that go beyond
-simple insertion and deletion: controlling subprocesses; automatic
-indentation of programs; viewing two or more files at once; editing
-formatted text; and dealing in terms of characters, words, lines,
-sentences, paragraphs, and pages, as well as expressions and comments in
-several different programming languages.
-
-  @dfn{Self-documenting} means that at any time you can type a special
-character, @kbd{Control-h}, to find out what your options are.  You can
-also use it to find out what any command does, or to find all the commands
-that pertain to a topic.  @xref{Help}.
-
-  @dfn{Customizable} means that you can change the definitions of Emacs
-commands in little ways.  For example, if you use a programming language in
-which comments start with @samp{<**} and end with @samp{**>}, you can tell
-the Emacs comment manipulation commands to use those strings
-(@pxref{Comments}).  Another sort of customization is rearrangement of the
-command set.  For example, if you prefer the four basic cursor motion
-commands (up, down, left and right) on keys in a diamond pattern on the
-keyboard, you can rebind the keys that way.  @xref{Customization}.
-
-  @dfn{Extensible} means that you can go beyond simple customization and
-write entirely new commands, programs in the Lisp language to be run by
-Emacs's own Lisp interpreter.  Emacs is an ``on-line extensible''
-system, which means that it is divided into many functions that call
-each other, any of which can be redefined in the middle of an editing
-session.  Almost any part of Emacs can be replaced without making a
-separate copy of all of Emacs.  Most of the editing commands of Emacs
-are written in Lisp; the few exceptions could have been written
-in Lisp but are written in C for efficiency.  Although only a programmer
-can write an extension, anybody can use it afterward.  If you want to
-learn Emacs Lisp programming, we recommend the @cite{Introduction to
-Emacs Lisp} by Robert J. Chassell, also published by the Free Software
-Foundation.
-
-   When run under the X Window System, Emacs provides its own menus and
-convenient bindings to mouse buttons.  But Emacs can provide many of the
-benefits of a window system on a text-only terminal.  For instance, you
-can look at or edit several files at once, move text between files, and
-edit files while running shell commands.
-
-@include screen.texi
-@include commands.texi
-@include entering.texi
-@include basic.texi
-@include mini.texi
-@include m-x.texi
-@include help.texi
-@include mark.texi
-@include killing.texi
-@include regs.texi
-@include display.texi
-@include search.texi
-@include fixit.texi
-@include kmacro.texi
-@include files.texi
-@include buffers.texi
-@include windows.texi
-@include frames.texi
-@include mule.texi
-@include major.texi
-@include indent.texi
-@include text.texi
-@include programs.texi
-@include building.texi
-@include maintaining.texi
-@include abbrevs.texi
-@include picture.texi
-@include sending.texi
-@include rmail.texi
-@include dired.texi
-@include calendar.texi
-@include misc.texi
-@include custom.texi
-@include trouble.texi
 @include cmdargs.texi
 @include xresources.texi
 
--- a/man/entering.texi	Tue Aug 31 16:30:29 2004 +0000
+++ b/man/entering.texi	Tue Aug 31 16:31:03 2004 +0000
@@ -59,6 +59,10 @@
 file in the already running Emacs.  @xref{Emacs Server}, for more
 information on editing files with Emacs from other programs.
 
+@ifnottex
+@raisesections
+@end ifnottex
+
 @node Exiting, Basic, Entering Emacs, Top
 @section Exiting Emacs
 @cindex exiting
@@ -150,6 +154,10 @@
 their only relationship with the operating system.  You can customize
 these keys to run any commands of your choice (@pxref{Keymaps}).
 
+@ifnottex
+@lowersections
+@end ifnottex
+
 @ignore
    arch-tag: df798d8b-f253-4113-b585-f528f078a944
 @end ignore
--- a/man/faq.texi	Tue Aug 31 16:30:29 2004 +0000
+++ b/man/faq.texi	Tue Aug 31 16:31:03 2004 +0000
@@ -17,7 +17,7 @@
 
 @quotation
 This list of frequently asked questions about GNU Emacs with answers
-("FAQ") may be translated into other languages, transformed into other
+(``FAQ'') may be translated into other languages, transformed into other
 formats (e.g. Texinfo, Info, WWW, WAIS), and updated with new information.
 
 The same conditions apply to any derivative of the FAQ as apply to the FAQ
@@ -906,8 +906,8 @@
 Emacs General Public License
 
 @item DISTRIB
-Emacs Availability Information, including the popular "Free Software
-Foundation Order Form"
+Emacs Availability Information, including the popular Free Software
+Foundation Order Form
 
 @item FTP
 How to get GNU Software by Internet FTP or by UUCP
@@ -935,7 +935,7 @@
 GNU Service Directory
 
 @item SUN-SUPPORT
-including "Using Emacstool with GNU Emacs"
+including ``Using Emacstool with GNU Emacs''
 
 @end table
 
@@ -1045,7 +1045,7 @@
 @end example
 
 For more information, send email to @email{mail-server@@rtfm.mit.edu}
-with "help" and "index" in the body on separate lines.
+with @samp{help} and @samp{index} in the body on separate lines.
 
 @item
 As the very last resort, you can e-mail a request to
@@ -1864,7 +1864,7 @@
 @end itemize
 
 @node Overwrite mode, Turning off beeping, Horizontal scrolling, Common requests
-@section How do I make Emacs "typeover" or "overwrite" instead of inserting?
+@section How do I make Emacs ``typeover'' or ``overwrite'' instead of inserting?
 @cindex @key{Insert}
 @cindex @code{overwrite-mode}
 @cindex Overwriting existing text
@@ -2075,7 +2075,7 @@
 was compiled with the X toolkit.
 
 @node Evaluating Emacs Lisp code, Changing the length of a Tab, Valid X resources, Common requests
-@section How do I execute ("evaluate") a piece of Emacs Lisp code?
+@section How do I execute (``evaluate'') a piece of Emacs Lisp code?
 @cindex Evaluating Lisp code
 @cindex Lisp forms, evaluating
 
@@ -2162,7 +2162,7 @@
 additional information.
 
 @node Underlining paragraphs, Repeating a command as many times as possible, Inserting > at the beginning of each line, Common requests
-@section How do I insert "_^H" before each character in a region to get an underlined paragraph?
+@section How do I insert @samp{_^H} before each character in a region to get an underlined paragraph?
 @cindex Underlining a region of text
 @cindex @code{underline-region}
 
@@ -2264,7 +2264,7 @@
 You probably don't want to do this, since backups are useful, especially
 when something goes wrong.
 
-To avoid seeing backup files (and other "uninteresting" files) in Dired,
+To avoid seeing backup files (and other ``uninteresting'' files) in Dired,
 load @code{dired-x} by adding the following to your @file{.emacs} file:
 
 @lisp
@@ -2733,7 +2733,7 @@
 @end example
 
 @noindent
-This method may result in "ILLEGAL DATATYPE" and other random errors on
+This method may result in ``ILLEGAL DATATYPE'' and other random errors on
 some machines.
 
 @email{daveg@@csvax.cs.caltech.edu, David Gillespie} explains how this
@@ -2824,7 +2824,7 @@
 @end example
 
 @node Shell process exits abnormally, Problems with Shell Mode on MS-Windows, ^M in the shell buffer, Bugs and problems
-@section Why do I get "Process shell exited abnormally with code 1"?
+@section Why do I get ``Process shell exited abnormally with code 1''?
 @cindex Abnormal exits from @code{shell-mode}
 @cindex @code{shell-mode} exits
 @cindex Process shell exited
@@ -2881,7 +2881,7 @@
 the problems in those cases.
 
 @node Termcap/Terminfo entries for Emacs, Spontaneous entry into isearch-mode, Problems with Shell Mode on MS-Windows, Bugs and problems
-@section Where is the termcap/terminfo entry for terminal type "emacs"?
+@section Where is the termcap/terminfo entry for terminal type @samp{emacs}?
 @cindex Termcap
 @cindex Terminfo
 @cindex Emacs entries for termcap/terminfo
@@ -2915,7 +2915,7 @@
 @end example
 
 @node Spontaneous entry into isearch-mode, Problems talking to certain hosts, Termcap/Terminfo entries for Emacs, Bugs and problems
-@section Why does Emacs spontaneously start displaying "I-search:" and beeping?
+@section Why does Emacs spontaneously start displaying @samp{I-search:} and beeping?
 @cindex Spontaneous entry into isearch-mode
 @cindex isearch-mode, spontaneous entry into
 @cindex Beeping without obvious reason
@@ -2972,7 +2972,7 @@
 @end itemize
 
 @node Errors with init files, Emacs ignores X resources, Problems talking to certain hosts, Bugs and problems
-@section Why does Emacs say "Error in init file"?
+@section Why does Emacs say @samp{Error in init file}?
 @cindex Error in @file{.emacs}
 @cindex Error in init file
 @cindex Init file, errors in
@@ -3238,7 +3238,7 @@
 @end itemize
 
 @node Dired claims that no file is on this line,  , Security risks with Emacs, Bugs and problems
-@section Dired says, "no file on this line" when I try to do something.
+@section Dired says, @samp{no file on this line} when I try to do something.
 @cindex Dired does not see a file
 
 @c FIXME: I think this is fixed in Emacs 21, but I didn't have time to
@@ -3441,7 +3441,7 @@
 @file{libX11.a}.  This may be missing.
 
 On OpenWindows, you may need to use @code{add_services} to add the
-"OpenWindows Programmers" optional software category from the CD-ROM.
+``OpenWindows Programmers'' optional software category from the CD-ROM.
 
 On HP-UX 8.0, you may need to run @code{update} again to load the
 X11-PRG ``fileset''.  This may be missing even if you specified ``all
@@ -3580,51 +3580,37 @@
 @uref{http://www.gnu.org/order/ftp.html}
 
 @node Difference between Emacs and XEmacs, Emacs for MS-DOS, Current GNU distributions, Finding Emacs and related packages
-@section What is the difference between Emacs and XEmacs (formerly "Lucid Emacs")?
+@section What is the difference between Emacs and XEmacs (formerly Lucid Emacs)?
 @cindex XEmacs
 @cindex Difference Emacs and XEmacs
 @cindex Lucid Emacs
 @cindex Epoch
 
-First of all, they're both GNU Emacs.  XEmacs is just as much a later
-version of GNU Emacs as the FSF-distributed version.  This FAQ refers to
-the latest version to be distributed by the FSF as ``Emacs,'' partly
-because the XEmacs maintainers now refer to their product using the
-``XEmacs'' name, and partly because there isn't any accurate way to
-differentiate between the two without getting mired in paragraphs of
-legalese and history.
-
-XEmacs, which began life as Lucid Emacs, is based on an early version of
-Emacs 19 and Epoch, an X-aware version of Emacs 18.
-
-Emacs (i.e., the version distributed by the FSF) has a larger installed
-base and now always contains the MULE multilingual facilities.
-XEmacs can do some clever tricks with X and MS-Windows, such as
-putting arbitrary graphics in a buffer.  Similar facilities have been
-implemented for Emacs as part of a new redisplay implementation for
-Emacs 21, and are available in the latest Emacs releases.
-Emacs and XEmacs each come with
-Lisp packages that are lacking in the other; RMS says that the FSF would
-include more packages that come with XEmacs, but that the XEmacs
-maintainers don't always keep track of the authors of contributed code,
-which makes it impossible for the FSF to have certain legal papers
-signed.  (Without these legal papers, the FSF will not distribute Lisp
-packages with Emacs.)  The two versions have some
-significant differences at the Lisp programming level.
-
-Many XEmacs features have found their way into recent versions of Emacs,
-and more features can be expected in the future, but there are still many
-differences between the two.
-
-The latest stable branch of XEmacs as of this writing is 21.4; you can
-get it at
-
-@uref{ftp://ftp.xemacs.org/pub/xemacs/xemacs-21.4/xemacs-21.4.12.tar.gz}
-
-More information about XEmacs, including a list of frequently asked
-questions (FAQ), is available at
-
-@uref{http://www.xemacs.org/}
+XEmacs is a branch version of Emacs.  It was first called Lucid Emacs,
+and was initially derived from a prerelease version of Emacs 19.  In
+this FAQ, we use the name ``Emacs'' only for the official version.
+
+Emacs and XEmacs each come with Lisp packages that are lacking in the
+other.  The two versions have some significant differences at the Lisp
+programming level.  Their current features are roughly comparable,
+though the support for some operating systems, character sets and
+specific packages might be quite different.
+
+Some XEmacs code has been contributed to Emacs, and we would like to
+use other parts, but the earlier XEmacs maintainers did not always
+keep track of the authors of contributed code, which makes it
+impossible for the FSF to get copyright papers signed for that code.
+(The FSF requires these papers for all the code included in the Emacs
+release, aside from generic C support packages that retain their
+separate identity and are not integrated into the code of Emacs
+proper.)
+
+If you want to talk about these two versions and distinguish them,
+please call them ``Emacs'' and ``XEmacs.''  To contrast ``XEmacs''
+with ``GNU Emacs'' would be misleading, since XEmacs too has its
+origin in the work of the GNU Project.  Terms such as ``Emacsen'' and
+``(X)Emacs'' are not wrong, but they are not very clear, so it
+is better to write ``Emacs and XEmacs.''
 
 @node Emacs for MS-DOS, Emacs for Windows, Difference between Emacs and XEmacs, Finding Emacs and related packages
 @section Where can I get Emacs for my PC running MS-DOS?
@@ -3640,17 +3626,17 @@
 Windows 9X, Windows ME, and Windows 2000.  More information is available
 from
 
-@uref{http://www.simtel.net/pub/djgpp/v2gnu/emacs.README}
+@uref{ftp://ftp.delorie.com/pub/djgpp/current/v2gnu/emacs.README}
 
 The binary itself is available in the files @file{em*.zip} in the
 directory
 
-@uref{http://www.simtel.net/pub/djgpp/v2gnu/}
+@uref{ftp://ftp.delorie.com/pub/djgpp/current/v2gnu/}
 
 If you prefer to compile Emacs for yourself, you can do so with the
 current distribution directly.  You will need a 386 (or
 better) processor, and to be running MS-DOS 3.0 or later.  According to
-@email{eliz@@is.elta.co.il, Eli Zaretskii} and
+@email{eliz@@gnu.org, Eli Zaretskii} and
 @email{hankedr@@dms.auburn.edu, Darrel Hankerson}, you will need the
 following:
 
@@ -3664,7 +3650,7 @@
 You can get the latest release of DJGPP by retrieving all of
 the files in
 
-@uref{http://www.simtel.net/pub/gnu/djgpp/v2*}
+@uref{ftp://ftp.delorie.com/pub/djgpp/current/v2*}
 
 @item Unpacking program
 The easiest way is to use @code{djtar} which comes with DJGPP v2.x,
@@ -3683,7 +3669,7 @@
 @item make, mv, sed, and rm
 All of these utilities are available at
 
-@uref{http://www.simtel.net/pub/gnu/djgpp/v2gnu}
+@uref{ftp://ftp.delorie.com/pub/djgpp/current/v2gnu}
 
 16-bit utilities can be found in GNUish, at
 
@@ -3700,7 +3686,7 @@
 regarding Emacs under MS-DOS.
 
 For a list of other MS-DOS implementations of Emacs (and Emacs
-look-alikes), consult the list of "Emacs implementations and literature,"
+look-alikes), consult the list of ``Emacs implementations and literature,''
 available at
 
 @uref{ftp://rtfm.mit.edu/pub/usenet/comp.emacs/}
@@ -3785,18 +3771,11 @@
 @cindex Apple computers, Emacs for
 @cindex Macintosh, Emacs for
 
-An unofficial port of GNU Emacs 18.59 to the Macintosh is available at a
-number of ftp sites, the home being
-@uref{ftp://ftp.cs.cornell.edu/pub/parmet/Emacs-1.17.sit.bin}.
-
-A port of Emacs 20.4 is available at
-@uref{http://www.cs.hku.hk/~choi/emacs/index.html}.
-
 Beginning with version 21.1, the Macintosh is supported in the official
 Emacs distribution; see the files @file{mac/README} and
 @file{mac/INSTALL} in the Emacs distribution for build instructions.
 
-Apple's forthcoming "OS X" is based largely on NeXTSTEP and OpenStep.
+Apple's ``OS X'' is based largely on NeXTSTEP and OpenStep.
 @xref{Emacs for NeXTSTEP}, for more details about that version.
 
 @node Emacs for VMS and DECwindows, Modes for various languages, Emacs for Apple computers, Finding Emacs and related packages
@@ -4191,7 +4170,7 @@
 @end table
 
 @node Patch,  , JDE, Major packages and programs
-@section Patch --- program to apply "diffs" for updating files
+@section Patch --- program to apply ``diffs'' for updating files
 @cindex Updating files with diffs
 @cindex Patching source files with diffs
 @cindex Diffs and patching
@@ -4264,8 +4243,8 @@
 
 @noindent
 can be placed directly into the @file{.emacs} file.  If the key binding is
-local, the command is used in conjunction with the "add-hook" command.
-For example, in tex-mode, a local binding might be
+local, the command is used in conjunction with the @samp{add-hook} function.
+For example, in TeX mode, a local binding might be
 
 @lisp
 (add-hook 'tex-mode-hook
@@ -4304,7 +4283,7 @@
 @end itemize
 
 @node Invalid prefix characters, Terminal setup code works after Emacs has begun, Binding keys to commands, Key bindings
-@section Why does Emacs say "Key sequence XXX uses invalid prefix characters"?
+@section Why does Emacs say @samp{Key sequence XXX uses invalid prefix characters}?
 @cindex Prefix characters, invalid
 @cindex Invalid prefix characters
 @cindex Misspecified key sequences
@@ -4699,7 +4678,7 @@
 @cindex Generating control characters
 @cindex Control characters, generating
 
-On terminals (but not under X), some common "aliases" are:
+On terminals (but not under X), some common ``aliases'' are:
 
 @table @asis
 
--- a/man/frames.texi	Tue Aug 31 16:30:29 2004 +0000
+++ b/man/frames.texi	Tue Aug 31 16:31:03 2004 +0000
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
-@c Copyright (C) 1985, 86, 87, 93, 94, 95, 97, 99, 2000, 2001
+@c Copyright (C) 1985, 86, 87, 93, 94, 95, 97, 99, 2000, 2001, 2004
 @c   Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Frames, International, Windows, Top
@@ -230,6 +230,8 @@
 back into the window.  This way, you can mark regions that don't fit
 entirely on the screen.
 
+This way of setting the secondary selection does not alter the kill ring.
+
 @findex mouse-start-secondary
 @kindex M-Mouse-1
 @item M-Mouse-1
@@ -240,8 +242,9 @@
 @kindex M-Mouse-3
 @item M-Mouse-3
 Make a secondary selection, using the place specified with @kbd{M-Mouse-1}
-as the other end (@code{mouse-secondary-save-then-kill}).  A second click
-at the same place kills the secondary selection just made.
+as the other end (@code{mouse-secondary-save-then-kill}).  This also
+puts the selected text in the kill ring.  A second click at the same
+place kills the secondary selection just made.
 
 @findex mouse-yank-secondary
 @kindex M-Mouse-2
@@ -376,8 +379,7 @@
 
 @kindex C-Mouse-2 @r{(scroll bar)}
   @kbd{C-Mouse-2} on a scroll bar splits the corresponding window
-vertically, unless you are using an X toolkit's implementation of
-scroll bars.  @xref{Split Window}.
+vertically.  @xref{Split Window}.
 
   The commands above apply to areas of the mode line which do not have
 special mouse bindings of their own.  Some areas, such as the buffer
@@ -747,10 +749,8 @@
 down to the level where you click.  By clicking repeatedly in the same
 place, you can scroll by the same distance over and over.
 
-  If you are using Emacs's own implementation of scroll bars, as opposed
-to scroll bars from an X toolkit, you can also click @kbd{C-Mouse-2} in
-the scroll bar to split a window vertically.  The split occurs on the
-line where you click.
+  You can also click @kbd{C-Mouse-2} in the scroll bar to split a
+window vertically.  The split occurs on the line where you click.
 
 @findex scroll-bar-mode
 @vindex scroll-bar-mode
@@ -800,9 +800,9 @@
 @section Drag and drop in Emacs.
 
 @cindex drag and drop
-  Emacs supports drag and drop so that dropping of files and text is handeled.
+  Emacs supports drag and drop so that dropping of files and text is handled.
 Currently supported drag and drop protocols are XDND, Motif and the old
-KDE 1.x protocol.  There is no drag support yet. 
+KDE 1.x protocol.  There is no drag support yet.
 When text is dropped on Emacs, Emacs inserts the text where it is dropped.
 When a file is dragged from a file manager to Emacs, Emacs opens that file.
 As a special case, if a file is dropped on a dired buffer the file is
@@ -896,7 +896,7 @@
 
   You can customize the option @code{use-file-dialog} to suppress the
 use of file selection windows even if you still want other kinds
-of dialogs.  This option has no effect if you have supressed all dialog
+of dialogs.  This option has no effect if you have suppressed all dialog
 boxes with the option @code{use-dialog-box}.
 
 
--- a/man/indent.texi	Tue Aug 31 16:30:29 2004 +0000
+++ b/man/indent.texi	Tue Aug 31 16:31:03 2004 +0000
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
-@c Copyright (C) 1985, 86, 87, 93, 94, 95, 1997 Free Software Foundation, Inc.
+@c Copyright (C) 1985, 86, 87, 93, 94, 95, 1997, 2004 Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Indentation, Text, Major Modes, Top
 @chapter Indentation
@@ -75,7 +75,7 @@
   Normally, all of the above methods insert an optimal mix of tabs and
 spaces to align to the desired column.  @xref{Just Spaces}, for how to
 disable use of tabs.  However, @kbd{C-q @key{TAB}} always inserts a
-tab, even they are disabled for the indentation commands.
+tab, even when tabs are disabled for the indentation commands.
 
 @c   In Text mode, @key{TAB} runs the command @code{tab-to-tab-stop}, which
 @c indents to the next tab stop column.  You can set the tab stops with
@@ -95,7 +95,8 @@
 @findex back-to-indentation
   To move over the indentation on a line, do @kbd{M-m}
 (@code{back-to-indentation}).  This command, given anywhere on a line,
-positions point at the first nonblank character on the line.
+positions point at the first nonblank character on the line, if any,
+or else at the end of the line.
 
   To insert an indented line before the current line, do @kbd{C-a C-o
 @key{TAB}}.  To make an indented line after the current line, use
@@ -134,13 +135,13 @@
 @findex indent-region
 @findex indent-rigidly
   There are also commands for changing the indentation of several lines
-at once.  @kbd{C-M-\} (@code{indent-region}) applies to all the lines
-that begin in the region; it indents each line in the ``usual'' way, as
-if you had typed @key{TAB} at the beginning of the line.  A numeric
-argument specifies the column to indent to, and each line is shifted
-left or right so that its first nonblank character appears in that
-column.  @kbd{C-x @key{TAB}} (@code{indent-rigidly}) moves all of the
-lines in the region right by its argument (left, for negative
+at once.  They apply to all the lines that begin in the region.
+@kbd{C-M-\} (@code{indent-region}) indents each line in the ``usual''
+way, as if you had typed @key{TAB} at the beginning of the line.  A
+numeric argument specifies the column to indent to, and each line is
+shifted left or right so that its first nonblank character appears in
+that column.  @kbd{C-x @key{TAB}} (@code{indent-rigidly}) moves all of
+the lines in the region right by its argument (left, for negative
 arguments).  The whole group of lines moves rigidly sideways, which is
 how the command gets its name.@refill
 
@@ -152,12 +153,10 @@
 @findex indent-relative
   @kbd{M-x indent-relative} indents at point based on the previous line
 (actually, the last nonempty line).  It inserts whitespace at point, moving
-point, until it is underneath an indentation point in the previous line.
+point, until it is underneath the next indentation point in the previous line.
 An indentation point is the end of a sequence of whitespace or the end of
 the line.  If point is farther right than any indentation point in the
-previous line, the whitespace before point is deleted and the first
-indentation point then applicable is used.  If no indentation point is
-applicable even then, @code{indent-relative} runs @code{tab-to-tab-stop}
+previous line, @code{indent-relative} runs @code{tab-to-tab-stop}
 @ifinfo
 (@pxref{Tab Stops}),
 @end ifinfo
@@ -167,9 +166,6 @@
 unless it is called with a numeric argument, in which case it does
 nothing.
 
-  @code{indent-relative} is the definition of @key{TAB} in Indented Text
-mode.  @xref{Text}.
-
   @xref{Format Indentation}, for another way of specifying the
 indentation for part of your text.
 
@@ -181,10 +177,9 @@
 @cindex tables, indentation for
 @kindex M-i
 @findex tab-to-tab-stop
-  For typing in tables, you can use Text mode's definition of @key{TAB},
-@code{tab-to-tab-stop}.  This command inserts indentation before point,
-enough to reach the next tab stop column.  If you are not in Text mode,
-this command can be found on the key @kbd{M-i}.
+  For typing in tables, you can use @kbd{M-i} (@code{tab-to-tab-stop}).
+This command inserts indentation before point, enough to reach the
+next tab stop column.
 
 @findex edit-tab-stops
 @findex edit-tab-stops-note-changes
@@ -198,10 +193,11 @@
 edit-tab-stops}, which creates and selects a buffer containing a
 description of the tab stop settings.  You can edit this buffer to
 specify different tab stops, and then type @kbd{C-c C-c} to make those
-new tab stops take effect.  @code{edit-tab-stops} records which buffer
-was current when you invoked it, and stores the tab stops back in that
-buffer; normally all buffers share the same tab stops and changing them
-in one buffer affects all, but if you happen to make
+new tab stops take effect.  The buffer uses Overwrite mode
+(@pxref{Minor Modes}).  @code{edit-tab-stops} records which buffer was
+current when you invoked it, and stores the tab stops back in that
+buffer; normally all buffers share the same tab stops and changing
+them in one buffer affects all, but if you happen to make
 @code{tab-stop-list} local in one buffer then @code{edit-tab-stops} in
 that buffer will edit the local settings.
 
@@ -242,7 +238,7 @@
 @findex untabify
   There are also commands to convert tabs to spaces or vice versa, always
 preserving the columns of all nonblank text.  @kbd{M-x tabify} scans the
-region for sequences of spaces, and converts sequences of at least three
+region for sequences of spaces, and converts sequences of at least two
 spaces to tabs if that can be done without changing indentation.  @kbd{M-x
 untabify} changes all tabs in the region to appropriate numbers of spaces.
 
--- a/man/killing.texi	Tue Aug 31 16:30:29 2004 +0000
+++ b/man/killing.texi	Tue Aug 31 16:31:03 2004 +0000
@@ -25,6 +25,10 @@
 
 @end iftex
 
+@ifnottex
+@raisesections
+@end ifnottex
+
 @node Killing, Yanking, Mark, Top
 @section Deletion and Killing
 
@@ -646,6 +650,10 @@
 @code{string-rectangle}, but inserts the string on each line,
 shifting the original text to the right.
 
+@ifnottex
+@lowersections
+@end ifnottex
+
 @ignore
    arch-tag: d8da8f96-0928-449a-816e-ff2d3497866c
 @end ignore
--- a/man/misc.texi	Tue Aug 31 16:30:29 2004 +0000
+++ b/man/misc.texi	Tue Aug 31 16:31:03 2004 +0000
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
-@c Copyright (C) 1985, 86, 87, 93, 94, 95, 97, 2000, 2001
+@c Copyright (C) 1985, 86, 87, 93, 94, 95, 97, 2000, 2001, 2004
 @c   Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @iftex
@@ -14,6 +14,11 @@
 various diversions and amusements.
 
 @end iftex
+
+@ifnottex
+@raisesections
+@end ifnottex
+
 @node Gnus, Shell, Calendar/Diary, Top
 @section Gnus
 @cindex Gnus
@@ -1264,7 +1269,7 @@
 @end menu
 
 @node Invoking emacsclient,, Emacs Server, Emacs Server
-@section Invoking @code{emacsclient}
+@subsection Invoking @code{emacsclient}
 
   To run the @code{emacsclient} program, specify file names as arguments,
 and optionally line numbers as well.  Do it like this:
@@ -2448,6 +2453,10 @@
 The command @kbd{M-x zone} plays games with the display when Emacs is
 idle.
 
+@ifnottex
+@lowersections
+@end ifnottex
+
 @ignore
    arch-tag: 8f094220-c0d5-4e9e-af7d-3e0da8187474
 @end ignore
--- a/man/programs.texi	Tue Aug 31 16:30:29 2004 +0000
+++ b/man/programs.texi	Tue Aug 31 16:31:03 2004 +0000
@@ -31,8 +31,8 @@
 * Defuns::              Commands to operate on major top-level parts
                           of a program.
 * Program Indent::      Adjusting indentation to show the nesting.
+* Parentheses::         Commands that operate on parentheses.
 * Comments::	        Inserting, killing, and aligning comments.
-* Parentheses::         Commands that operate on parentheses.
 * Documentation::       Getting documentation of functions you plan to call.
 * Hideshow::            Displaying blocks selectively.
 * Symbol Completion::   Completion on symbol names of your program or language.
--- a/man/trouble.texi	Tue Aug 31 16:30:29 2004 +0000
+++ b/man/trouble.texi	Tue Aug 31 16:31:03 2004 +0000
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
-@c Copyright (C) 1985,86,87,93,94,95,1997,2001 Free Software Foundation, Inc.
+@c Copyright (C) 1985,86,87,93,94,95,1997,2001,2004 Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @iftex
 @chapter Dealing with Common Problems
@@ -10,6 +10,10 @@
 also considered.
 @end iftex
 
+@ifnottex
+@raisesections
+@end ifnottex
+
 @node Quitting, Lossage, Customization, Top
 @section Quitting and Aborting
 @cindex quitting
@@ -1044,7 +1048,7 @@
 possible to suggest ways to make your extension fit in better with the
 rest of Emacs.
 
-@node Service, Command Arguments, Contributing, Top
+@node Service, Copying, Contributing, Top
 @section How To Get Help with GNU Emacs
 
 If you need help installing, using or changing GNU Emacs, there are two
@@ -1063,6 +1067,10 @@
 Emacs distribution.
 @end itemize
 
+@ifnottex
+@lowersections
+@end ifnottex
+
 @ignore
    arch-tag: c9cba76d-b2cb-4e0c-ae3f-19d5ef35817c
 @end ignore
--- a/man/windows.texi	Tue Aug 31 16:30:29 2004 +0000
+++ b/man/windows.texi	Tue Aug 31 16:31:03 2004 +0000
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
-@c Copyright (C) 1985,86,87,93,94,95,97,2000,2001 Free Software Foundation, Inc.
+@c Copyright (C) 1985,86,87,93,94,95,97,2000,2001,2004 Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Windows, Frames, Buffers, Top
 @chapter Multiple Windows
@@ -36,11 +36,11 @@
   At any time, one of the windows is the @dfn{selected window}; the
 buffer this window is displaying is the current buffer.  The terminal's
 cursor shows the location of point in this window.  Each other window
-has a location of point as well, but since the terminal has only one
-cursor there is no way to show where those locations are.  When multiple
-frames are visible in X, each frame has a cursor which appears in the
-frame's selected window.  The cursor in the selected frame is solid; the
-cursor in other frames is a hollow box.
+has a location of point as well.  On text-only terminals, there is no
+way to show where those locations are, since the terminal has only one
+cursor.  If you are using a window system, the location of point in a
+non-selected window is indicated by a hollow box.  The cursor in the
+selected window is blinking or solid.
 
   Commands to move point affect the value of point for the selected Emacs
 window only.  They do not change the value of point in any other Emacs
@@ -93,20 +93,20 @@
 @findex split-window-horizontally
   @kbd{C-x 3} (@code{split-window-horizontally}) breaks the selected
 window into two side-by-side windows.  A numeric argument specifies how
-many columns to give the one on the left.  A line of vertical bars
-separates the two windows.  Windows that are not the full width of the
-screen have mode lines, but they are truncated.  On terminals where
-Emacs does not support highlighting, truncated mode lines sometimes do
-not appear in inverse video.
+many columns to give the one on the left.  If you are not using
+scrollbars, a line of vertical bars separates the two windows.
+Windows that are not the full width of the screen have mode lines, but
+they are truncated.  On terminals where Emacs does not support
+highlighting, truncated mode lines sometimes do not appear in inverse
+video.
 
 @kindex C-Mouse-2 @r{(scroll bar)}
   You can split a window horizontally or vertically by clicking
-@kbd{C-Mouse-2} in the mode line or the scroll bar.  (This does not
-work in scroll bars implemented by X toolkits.)  The line of splitting
-goes through the place where you click: if you click on the mode line,
-the new scroll bar goes above the spot; if you click in the scroll
-bar, the mode line of the split window is side by side with your
-click.
+@kbd{C-Mouse-2} in the mode line or the scroll bar.  The line of
+splitting goes through the place where you click: if you click on the
+mode line, the new scroll bar goes above the spot; if you click in the
+scroll bar, the mode line of the split window is side by side with
+your click.
 
 @vindex truncate-partial-width-windows
   When a window is less than the full width, text lines too long to fit are
@@ -319,8 +319,8 @@
 except for the echo area.
 
   You can also delete a window by clicking on its mode line with
-@kbd{Mouse-2}, and delete all the windows in a frame except one window
-by clicking on that window's mode line with @kbd{Mouse-3}.
+@kbd{Mouse-3}, and delete all the windows in a frame except one window
+by clicking on that window's mode line with @kbd{Mouse-2}.
 
   The easiest way to adjust window heights is with a mouse.  If you
 press @kbd{Mouse-1} on a mode line, you can drag that mode line up or
@@ -370,8 +370,8 @@
   @kbd{M-x winner-mode} is a global minor mode that records the
 changes in the window configuration (i.e. how the frames are
 partitioned into windows), so that you can ``undo'' them.  To undo,
-use @kbd{C-x left} (@code{winner-undo}).  If you change your mind
-while undoing, you can redo the changes you had undone using @kbd{C-x
+use @kbd{C-c left} (@code{winner-undo}).  If you change your mind
+while undoing, you can redo the changes you had undone using @kbd{C-c
 right} (@code{M-x winner-redo}).  Another way to enable Winner mode is
 by customizing the variable @code{winner-mode}.
 
--- a/src/ChangeLog	Tue Aug 31 16:30:29 2004 +0000
+++ b/src/ChangeLog	Tue Aug 31 16:31:03 2004 +0000
@@ -1,3 +1,48 @@
+2004-08-30  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
+
+	* macmenu.c (_widget_value): Added lname and lkey.
+	(single_submenu): Set lname and lkey in widget_value
+	instead of name and key.
+	(update_submenu_strings): New function.
+	(set_frame_menubar): Remove call to inhibit_garbage_collection,
+	call update_submenu_strings.
+
+	* xmenu.c (digest_single_submenu): Set lname and lkey in widget_value
+	instead of name and key.
+	(update_submenu_strings): New function.
+	(set_frame_menubar): Remove call to inhibit_garbage_collection,
+	call update_submenu_strings.
+
+	* gtkutil.h (_widget_value): Added lname and lkey.
+
+2004-08-30  Steven Tamm  <steventamm@mac.com>
+
+	* macmenu.c (mac_menu_show): Remove shadowing of menu variable
+	by using different names for inner loop variables.
+
+2004-08-27  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
+
+	* xmenu.c (set_frame_menubar): Reintroduce inhibit_garbage_collection
+	from 1.233 so that strings from ENCODE_UTF_8 isn't GC:ed before used.
+
+	* gtkutil.c (xg_create_frame_widgets): Compensate for tool bar when
+	tool bar items is 0.
+
+2004-08-26  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
+
+	* macmenu.c (ENCODE_MENU_STRING): Added to handle multibyte
+	strings in menu items.
+	(single_submenu): Use ENCODE_MENU_STRING
+	(mac_menu_show): Use ENCODE_MENU_STRING.  Reset grabbed because
+	button release isn't passed to event loop
+	(add_menu_item): Use SetMenuItemWithCFString
+
+2004-08-26  Steven Tamm  <steventamm@mac.com>
+
+	* fileio.c (Fread_file_name): Call x_file_dialog on carbon on
+	tool-bar/menu click
+	* macfns.c (Fx_file_dialog): Implemented using NavServices
+
 2004-08-24  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
 
 	* xterm.c (x_catch_errors_unwind): Do not XSync if display has closed.
--- a/src/fileio.c	Tue Aug 31 16:30:29 2004 +0000
+++ b/src/fileio.c	Tue Aug 31 16:31:03 2004 +0000
@@ -6306,7 +6306,7 @@
 
   GCPRO2 (insdef, default_filename);
 
-#if defined (USE_MOTIF) || defined (HAVE_NTGUI) || defined (USE_GTK)
+#if defined (USE_MOTIF) || defined (HAVE_NTGUI) || defined (USE_GTK) || defined (TARGET_API_MAC_CARBON)
   if ((NILP (last_nonmenu_event) || CONSP (last_nonmenu_event))
       && use_dialog_box
       && use_file_dialog
--- a/src/gtkutil.c	Tue Aug 31 16:30:29 2004 +0000
+++ b/src/gtkutil.c	Tue Aug 31 16:31:03 2004 +0000
@@ -793,7 +793,7 @@
      up in the wrong place as tool bar height has not been taken into account.
      So we cheat a bit by setting a height that is what it will have
      later on when tool bar items are added.  */
-  if (FRAME_EXTERNAL_TOOL_BAR (f) && FRAME_TOOLBAR_HEIGHT (f) == 0)
+  if (FRAME_EXTERNAL_TOOL_BAR (f) && f->n_tool_bar_items == 0)
     FRAME_TOOLBAR_HEIGHT (f) = 34;
 
 
--- a/src/gtkutil.h	Tue Aug 31 16:30:29 2004 +0000
+++ b/src/gtkutil.h	Tue Aug 31 16:31:03 2004 +0000
@@ -96,10 +96,12 @@
 typedef struct _widget_value
 {
   /* name of widget */
+  Lisp_Object   lname;
   char		*name;
   /* value (meaning depend on widget type) */
   char		*value;
   /* keyboard equivalent. no implications for XtTranslations */
+  Lisp_Object   lkey;
   char		*key;
   /* Help string or nil if none.
      GC finds this string through the frame's menu_bar_vector
--- a/src/macfns.c	Tue Aug 31 16:30:29 2004 +0000
+++ b/src/macfns.c	Tue Aug 31 16:31:03 2004 +0000
@@ -4192,19 +4192,27 @@
 
 
 
+#ifdef TARGET_API_MAC_CARBON
 /***********************************************************************
 			File selection dialog
  ***********************************************************************/
 
-#if 0 /* MAC_TODO: can standard file dialog */
+/**
+   There is a relatively standard way to do this using applescript to run
+   a (choose file) method.  However, this doesn't do "the right thing"
+   by working only if the find-file occurred during a menu or toolbar
+   click.  So we must do the file dialog by hand, using the navigation
+   manager.  This also has more flexibility in determining the default
+   directory and whether or not we are going to choose a file.
+ **/
+
 extern Lisp_Object Qfile_name_history;
 
 DEFUN ("x-file-dialog", Fx_file_dialog, Sx_file_dialog, 2, 4, 0,
        doc: /* Read file name, prompting with PROMPT in directory DIR.
 Use a file selection dialog.
 Select DEFAULT-FILENAME in the dialog's file selection box, if
-specified.  Don't let the user enter a file name in the file
-selection dialog's entry field, if MUSTMATCH is non-nil.  */)
+specified.  Ensure that file exists if MUSTMATCH is non-nil.  */)
   (prompt, dir, default_filename, mustmatch)
      Lisp_Object prompt, dir, default_filename, mustmatch;
 {
@@ -4212,9 +4220,8 @@
   Lisp_Object file = Qnil;
   int count = SPECPDL_INDEX ();
   struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
-  char filename[MAX_PATH + 1];
-  char init_dir[MAX_PATH + 1];
-  int use_dialog_p = 1;
+  char filename[1001];
+  int default_filter_index = 1; /* 1: All Files, 2: Directories only  */
 
   GCPRO5 (prompt, dir, default_filename, mustmatch, file);
   CHECK_STRING (prompt);
@@ -4223,87 +4230,150 @@
   /* Create the dialog with PROMPT as title, using DIR as initial
      directory and using "*" as pattern.  */
   dir = Fexpand_file_name (dir, Qnil);
-  strncpy (init_dir, SDATA (dir), MAX_PATH);
-  init_dir[MAX_PATH] = '\0';
-  unixtodos_filename (init_dir);
-
-  if (STRINGP (default_filename))
-    {
-      char *file_name_only;
-      char *full_path_name = SDATA (default_filename);
-
-      unixtodos_filename (full_path_name);
-
-      file_name_only = strrchr (full_path_name, '\\');
-      if (!file_name_only)
-        file_name_only = full_path_name;
-      else
-        {
-          file_name_only++;
-
-          /* If default_file_name is a directory, don't use the open
-             file dialog, as it does not support selecting
-             directories. */
-          if (!(*file_name_only))
-            use_dialog_p = 0;
-        }
-
-      strncpy (filename, file_name_only, MAX_PATH);
-      filename[MAX_PATH] = '\0';
+
+  {
+    OSStatus status;
+    NavDialogCreationOptions options;
+    NavDialogRef dialogRef;
+    NavTypeListHandle fileTypes = NULL;
+    NavUserAction userAction;
+    CFStringRef message=NULL, client=NULL, saveName = NULL;
+    
+    /* No need for a callback function because we are modal */
+    NavGetDefaultDialogCreationOptions(&options);
+    options.modality = kWindowModalityAppModal;
+    options.location.h = options.location.v = -1;
+    options.optionFlags = kNavDefaultNavDlogOptions;
+    options.optionFlags |= kNavAllFilesInPopup;  /* All files allowed */
+    options.optionFlags |= kNavSelectAllReadableItem;
+    if (!NILP(prompt))
+      {
+	message = CFStringCreateWithCStringNoCopy(NULL, SDATA(prompt),
+						  kCFStringEncodingUTF8, 
+						  kCFAllocatorNull);
+	options.message = message;
+      }
+    /* Don't set the application, let it use default.
+    client = CFStringCreateWithCStringNoCopy(NULL, "Emacs", 
+					     kCFStringEncodingMacRoman, NULL);
+    options.clientName = client;
+    */
+
+    /* Do Dired hack copied from w32fns.c */ 
+    if (!NILP(prompt) && strncmp (SDATA(prompt), "Dired", 5) == 0)
+      status = NavCreateChooseFolderDialog(&options, NULL, NULL, NULL,
+					   &dialogRef);
+    else if (NILP (mustmatch)) 
+      { 
+	/* This is a save dialog */
+	if (!NILP(default_filename))
+	  {
+	    saveName = CFStringCreateWithCString(NULL, SDATA(default_filename),
+						 kCFStringEncodingUTF8);
+	    options.saveFileName = saveName;
+	    options.optionFlags |= kNavSelectDefaultLocation;
+	  }
+	/* MAC_TODO: Find a better way to determine if this is a save
+	   or load dialog than comparing dir with default_filename */
+	if (EQ(dir, default_filename)) 
+	  {
+	    status = NavCreateChooseFileDialog(&options, fileTypes,
+					       NULL, NULL, NULL, NULL, 
+					       &dialogRef);
+	  }
+	else {
+	  status = NavCreatePutFileDialog(&options, 
+					  'TEXT', kNavGenericSignature,
+					  NULL, NULL, &dialogRef);
+	}
+      }
+    else
+      {
+	/* This is an open dialog*/
+	status = NavCreateChooseFileDialog(&options, fileTypes,
+					   NULL, NULL, NULL, NULL, 
+					   &dialogRef);
+      }
+    
+    /* Set the default location and continue*/
+    if (status == noErr) {
+      if (!NILP(dir)) {
+	FSRef defLoc;
+	AEDesc defLocAed;
+	status = FSPathMakeRef(SDATA(dir), &defLoc, NULL);
+	if (status == noErr) 
+	  {
+	    AECreateDesc(typeFSRef, &defLoc, sizeof(FSRef), &defLocAed);
+	    NavCustomControl(dialogRef, kNavCtlSetLocation, (void*) &defLocAed);
+	  }
+	AEDisposeDesc(&defLocAed);
+      }
+
+      BLOCK_INPUT;
+      status = NavDialogRun(dialogRef);
+      UNBLOCK_INPUT;
     }
-  else
-    filename[0] = '\0';
-
-  if (use_dialog_p)
-    {
-      OPENFILENAME file_details;
-      char *filename_file;
-
-      /* Prevent redisplay.  */
-      specbind (Qinhibit_redisplay, Qt);
-      BLOCK_INPUT;
-
-      bzero (&file_details, sizeof (file_details));
-      file_details.lStructSize = sizeof (file_details);
-      file_details.hwndOwner = FRAME_W32_WINDOW (f);
-      file_details.lpstrFile = filename;
-      file_details.nMaxFile = sizeof (filename);
-      file_details.lpstrInitialDir = init_dir;
-      file_details.lpstrTitle = SDATA (prompt);
-      file_details.Flags = OFN_HIDEREADONLY | OFN_NOCHANGEDIR;
-
-      if (!NILP (mustmatch))
-        file_details.Flags |= OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST;
-
-      if (GetOpenFileName (&file_details))
-        {
-          dostounix_filename (filename);
-          file = build_string (filename);
-        }
-      else
-        file = Qnil;
-
-      UNBLOCK_INPUT;
-      file = unbind_to (count, file);
+
+    if (saveName) CFRelease(saveName);
+    if (client) CFRelease(client);
+    if (message) CFRelease(message);
+
+    if (status == noErr) {
+      userAction = NavDialogGetUserAction(dialogRef);
+      switch (userAction)
+	{
+	case kNavUserActionNone:
+	case kNavUserActionCancel:
+	  NavDialogDispose(dialogRef);
+	  Fsignal (Qquit, Qnil);  /* Treat cancel like C-g */
+	  return;
+	case kNavUserActionOpen:
+	case kNavUserActionChoose:
+	case kNavUserActionSaveAs:
+	  {
+	    NavReplyRecord reply;
+	    AEDesc aed;
+	    FSRef fsRef;
+	    status = NavDialogGetReply(dialogRef, &reply);
+	    AECoerceDesc(&reply.selection, typeFSRef, &aed);
+	    AEGetDescData(&aed, (void *) &fsRef, sizeof (FSRef));
+	    FSRefMakePath(&fsRef, (UInt8 *) filename, 1000);
+	    AEDisposeDesc(&aed);
+	    if (reply.saveFileName)
+	      {
+		/* If it was a saved file, we need to add the file name */
+		int len = strlen(filename);
+		if (len && filename[len-1] != '/')
+		  filename[len++] = '/';
+		CFStringGetCString(reply.saveFileName, filename+len, 
+				   1000-len, kCFStringEncodingUTF8);
+	      }
+	    file = DECODE_FILE(build_string (filename));
+	    NavDisposeReply(&reply);
+	  }
+	  break;
+	}
+      NavDialogDispose(dialogRef);
     }
-  /* Open File dialog will not allow folders to be selected, so resort
-     to minibuffer completing reads for directories. */
-  else
-    file = Fcompleting_read (prompt, intern ("read-file-name-internal"),
-                             dir, mustmatch, dir, Qfile_name_history,
-                             default_filename, Qnil);
+    else {
+      /* Fall back on minibuffer if there was a problem */
+      file = Fcompleting_read (prompt, intern ("read-file-name-internal"),
+			       dir, mustmatch, dir, Qfile_name_history,
+			       default_filename, Qnil);
+    }
+  }
 
   UNGCPRO;
-
+  
   /* Make "Cancel" equivalent to C-g.  */
   if (NILP (file))
     Fsignal (Qquit, Qnil);
-
+  
   return unbind_to (count, file);
 }
-#endif /* MAC_TODO */
-
-
+
+
+#endif
 
 /***********************************************************************
 			    Initialization
@@ -4507,7 +4577,7 @@
   last_show_tip_args = Qnil;
   staticpro (&last_show_tip_args);
 
-#if 0 /* MAC_TODO */
+#if TARGET_API_MAC_CARBON
   defsubr (&Sx_file_dialog);
 #endif
 }
--- a/src/macmenu.c	Tue Aug 31 16:30:29 2004 +0000
+++ b/src/macmenu.c	Tue Aug 31 16:31:03 2004 +0000
@@ -90,10 +90,12 @@
 typedef struct _widget_value
 {
   /* name of widget */
+  Lisp_Object   lname;
   char*		name;
   /* value (meaning depend on widget type) */
   char*		value;
   /* keyboard equivalent. no implications for XtTranslations */
+  Lisp_Object   lkey;
   char*		key;
   /* Help string or nil if none.
      GC finds this string through the frame's menu_bar_vector
@@ -163,6 +165,12 @@
 
 extern Lisp_Object Qmenu_bar_update_hook;
 
+#if TARGET_API_MAC_CARBON
+#define ENCODE_MENU_STRING(str) ENCODE_UTF_8 (str)
+#else
+#define ENCODE_MENU_STRING(str) ENCODE_SYSTEM (str)
+#endif
+
 void set_frame_menubar ();
 
 static void push_menu_item P_ ((Lisp_Object, Lisp_Object, Lisp_Object,
@@ -1215,12 +1223,9 @@
 		save_wv->next = wv;
 	      else
 		first_wv->contents = wv;
-	      wv->name = pane_string;
-	      /* Ignore the @ that means "separate pane".
-		 This is a kludge, but this isn't worth more time.  */
-	      if (!NILP (prefix) && wv->name[0] == '@')
-		wv->name++;
-	      wv->value = 0;
+	      wv->lname = pane_name;
+              /* Set value to 1 so update_submenu_strings can handle '@'  */
+	      wv->value = (char *)1;
 	      wv->enabled = 1;
 	      wv->button_type = BUTTON_TYPE_NONE;
 	      wv->help = Qnil;
@@ -1246,13 +1251,13 @@
 #ifndef HAVE_MULTILINGUAL_MENU
 	  if (STRING_MULTIBYTE (item_name))
 	    {
-	      item_name = ENCODE_SYSTEM (item_name);
+	      item_name = ENCODE_MENU_STRING (item_name);
 	      AREF (menu_items, i + MENU_ITEMS_ITEM_NAME) = item_name;
 	    }
 
 	  if (STRINGP (descrip) && STRING_MULTIBYTE (descrip))
 	    {
-	      descrip = ENCODE_SYSTEM (descrip);
+	      descrip = ENCODE_MENU_STRING (descrip);
 	      AREF (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY) = descrip;
 	    }
 #endif /* not HAVE_MULTILINGUAL_MENU */
@@ -1263,9 +1268,9 @@
 	  else
 	    save_wv->contents = wv;
 
-	  wv->name = (char *) SDATA (item_name);
+	  wv->lname = item_name;
 	  if (!NILP (descrip))
-	    wv->key = (char *) SDATA (descrip);
+	    wv->lkey = descrip;
 	  wv->value = 0;
 	  /* The EMACS_INT cast avoids a warning.  There's no problem
 	     as long as pointers have enough bits to hold small integers.  */
@@ -1304,6 +1309,41 @@
 
   return first_wv;
 }
+/* Walk through the widget_value tree starting at FIRST_WV and update
+   the char * pointers from the corresponding lisp values.
+   We do this after building the whole tree, since GC may happen while the
+   tree is constructed, and small strings are relocated.  So we must wait
+   until no GC can happen before storing pointers into lisp values.  */
+static void
+update_submenu_strings (first_wv)
+     widget_value *first_wv;
+{
+  widget_value *wv;
+
+  for (wv = first_wv; wv; wv = wv->next)
+    {
+      if (wv->lname && ! NILP (wv->lname))
+        {
+          wv->name = SDATA (wv->lname);
+
+          /* Ignore the @ that means "separate pane".
+             This is a kludge, but this isn't worth more time.  */
+          if (wv->value == (char *)1)
+            {
+              if (wv->name[0] == '@')
+		wv->name++;
+              wv->value = 0;
+            }
+        }
+
+      if (wv->lkey && ! NILP (wv->lkey))
+        wv->key = SDATA (wv->lkey);
+
+      if (wv->contents)
+        update_submenu_strings (wv->contents);
+    }
+}
+
 
 /* Set the contents of the menubar widgets of frame F.
    The argument FIRST_TIME is currently ignored;
@@ -1382,8 +1422,6 @@
 
       items = FRAME_MENU_BAR_ITEMS (f);
 
-      inhibit_garbage_collection ();
-
       /* Save the frame's previous menu bar contents data.  */
       if (previous_menu_items_used)
 	bcopy (XVECTOR (f->menu_bar_vector)->contents, previous_items,
@@ -1448,6 +1486,7 @@
 	  if (NILP (string))
 	    break;
 	  wv->name = (char *) SDATA (string);
+          update_submenu_strings (wv->contents);
 	  wv = wv->next;
 	}
 
@@ -1705,12 +1744,12 @@
 #ifndef HAVE_MULTILINGUAL_MENU
           if (STRINGP (item_name) && STRING_MULTIBYTE (item_name))
 	    {
-	      item_name = ENCODE_SYSTEM (item_name);
+	      item_name = ENCODE_MENU_STRING (item_name);
 	      AREF (menu_items, i + MENU_ITEMS_ITEM_NAME) = item_name;
 	    }
           if (STRINGP (descrip) && STRING_MULTIBYTE (descrip))
             {
-	      descrip = ENCODE_SYSTEM (descrip);
+	      descrip = ENCODE_MENU_STRING (descrip);
 	      AREF (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY) = descrip;
 	    }
 #endif /* not HAVE_MULTILINGUAL_MENU */
@@ -1764,7 +1803,7 @@
 
 #ifndef HAVE_MULTILINGUAL_MENU
       if (STRING_MULTIBYTE (title))
-	title = ENCODE_SYSTEM (title);
+	title = ENCODE_MENU_STRING (title);
 #endif
       wv_title->name = (char *) SDATA (title);
       wv_title->enabled = TRUE;
@@ -1801,9 +1840,9 @@
   /* Get the refcon to find the correct item*/
   if (menu_item_selection)
     {
-      menu = GetMenuHandle (HiWord (menu_item_choice));
-      if (menu) {
-	GetMenuItemRefCon (menu, menu_item_selection, &refcon);
+      MenuHandle sel_menu = GetMenuHandle (HiWord (menu_item_choice));
+      if (sel_menu) {
+	GetMenuItemRefCon (sel_menu, menu_item_selection, &refcon);
       }
     }
 
@@ -1813,6 +1852,10 @@
   discard_mouse_events ();
 #endif
 
+  /* Must reset this manually because the button release event is not
+     passed to Emacs event loop. */
+  FRAME_MAC_DISPLAY_INFO (f)->grabbed = 0;
+
   /* Free the widget_value objects we used to specify the
      contents.  */
   free_menubar_widget_value_tree (first_wv);
@@ -1821,11 +1864,11 @@
   {
     int i = MIN_POPUP_SUBMENU_ID;
     MenuHandle submenu = GetMenuHandle (i);
-    while (menu != NULL)
+    while (submenu != NULL)
       {
 	DeleteMenu (i);
-	DisposeMenu (menu);
-	menu = GetMenuHandle (++i);
+	DisposeMenu (submenu);
+	submenu = GetMenuHandle (++i);
       }
   }
 
@@ -2219,8 +2262,18 @@
 	  strncat (item_name, wv->key, 255);
 	}
       item_name[255] = 0;
+#if TARGET_API_MAC_CARBON
+      {
+	CFStringRef string =
+	  CFStringCreateWithCString (NULL, item_name, kCFStringEncodingUTF8);
+
+	SetMenuItemTextWithCFString (menu, pos, string);
+	CFRelease (string);
+      }
+#else
       c2pstr (item_name);
       SetMenuItemText (menu, pos, item_name);
+#endif
 
       if (wv->enabled && !force_disable)
 #if TARGET_API_MAC_CARBON
--- a/src/xmenu.c	Tue Aug 31 16:30:29 2004 +0000
+++ b/src/xmenu.c	Tue Aug 31 16:31:03 2004 +0000
@@ -1701,12 +1701,9 @@
 		save_wv->next = wv;
 	      else
 		first_wv->contents = wv;
-	      wv->name = pane_string;
-	      /* Ignore the @ that means "separate pane".
-		 This is a kludge, but this isn't worth more time.  */
-	      if (!NILP (prefix) && wv->name[0] == '@')
-		wv->name++;
-	      wv->value = 0;
+	      wv->lname = pane_name;
+              /* Set value to 1 so update_submenu_strings can handle '@'  */
+	      wv->value = (char *)1;
 	      wv->enabled = 1;
 	      wv->button_type = BUTTON_TYPE_NONE;
 	      wv->help = Qnil;
@@ -1749,9 +1746,9 @@
 	  else
 	    save_wv->contents = wv;
 
-	  wv->name = (char *) SDATA (item_name);
+	  wv->lname = item_name;
 	  if (!NILP (descrip))
-	    wv->key = (char *) SDATA (descrip);
+	    wv->lkey = descrip;
 	  wv->value = 0;
 	  /* The EMACS_INT cast avoids a warning.  There's no problem
 	     as long as pointers have enough bits to hold small integers.  */
@@ -1790,6 +1787,42 @@
 
   return first_wv;
 }
+
+/* Walk through the widget_value tree starting at FIRST_WV and update
+   the char * pointers from the corresponding lisp values.
+   We do this after building the whole tree, since GC may happen while the
+   tree is constructed, and small strings are relocated.  So we must wait
+   until no GC can happen before storing pointers into lisp values.  */
+static void
+update_submenu_strings (first_wv)
+     widget_value *first_wv;
+{
+  widget_value *wv;
+
+  for (wv = first_wv; wv; wv = wv->next)
+    {
+      if (wv->lname && ! NILP (wv->lname))
+        {
+          wv->name = SDATA (wv->lname);
+
+          /* Ignore the @ that means "separate pane".
+             This is a kludge, but this isn't worth more time.  */
+          if (wv->value == (char *)1)
+            {
+              if (wv->name[0] == '@')
+		wv->name++;
+              wv->value = 0;
+            }
+        }
+
+      if (wv->lkey && ! NILP (wv->lkey))
+        wv->key = SDATA (wv->lkey);
+
+      if (wv->contents)
+        update_submenu_strings (wv->contents);
+    }
+}
+
 
 /* Recompute all the widgets of frame F, when the menu bar has been
    changed.  Value is non-zero if widgets were updated.  */
@@ -2022,9 +2055,10 @@
 	  Lisp_Object string;
 	  string = XVECTOR (items)->contents[i + 1];
 	  if (NILP (string))
-	    break;
-	  wv->name = (char *) SDATA (string);
-	  wv = wv->next;
+            break;
+          wv->name = (char *) SDATA (string);
+          update_submenu_strings (wv->contents);
+          wv = wv->next;
 	}
 
       f->menu_bar_vector = menu_items;