changeset 90317:34c8b755296d

Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-23 Merge from emacs--devo--0 Patches applied: * emacs--devo--0 (patch 113-118) - Update from CVS - Merge from gnus--rel--5.10 * gnus--rel--5.10 (patch 38-39) - Update from CVS
author Miles Bader <miles@gnu.org>
date Fri, 24 Feb 2006 08:08:56 +0000
parents 458ed0c8c4c3 (current diff) 12d289b6e5de (diff)
children 8dfaaddb06fc
files etc/ChangeLog etc/TUTORIAL.cn lisp/ChangeLog lisp/allout.el lisp/compare-w.el lisp/ediff-diff.el lisp/gnus/ChangeLog lisp/gnus/flow-fill.el lisp/gnus/message.el lisp/gnus/mm-util.el lisp/gnus/mm-view.el lisp/gnus/nnimap.el lisp/gnus/qp.el lisp/gnus/utf7.el lisp/help.el lisp/info.el lisp/progmodes/gdb-ui.el lisp/progmodes/glasses.el lisp/progmodes/gud.el lisp/textmodes/org.el lisp/textmodes/reftex-auc.el lisp/textmodes/reftex-cite.el lisp/textmodes/reftex-dcr.el lisp/textmodes/reftex-global.el lisp/textmodes/reftex-index.el lisp/textmodes/reftex-parse.el lisp/textmodes/reftex-ref.el lisp/textmodes/reftex-sel.el lisp/textmodes/reftex-toc.el lisp/textmodes/reftex-vars.el lisp/textmodes/reftex.el man/ChangeLog man/faq.texi man/reftex.texi src/ChangeLog src/dispnew.c src/indent.c src/macgui.h src/macmenu.c src/macterm.c src/window.c
diffstat 43 files changed, 1585 insertions(+), 629 deletions(-) [+]
line wrap: on
line diff
--- a/etc/ChangeLog	Fri Feb 24 06:32:18 2006 +0000
+++ b/etc/ChangeLog	Fri Feb 24 08:08:56 2006 +0000
@@ -1,3 +1,12 @@
+2006-02-23  Herbert Euler  <herberteuler@hotmail.com>  (tiny change)
+
+	* TUTORIAL.cn: Fix omission bug: Add dot (ASCII 0x2E) on first line.
+
+2006-02-22  Carsten Dominik  <dominik@science.uva.nl>
+
+	* orgcard.tex: (section{Links}): Rewritten to cover the modified
+	link system.
+
 2006-02-18  Bill Wohler  <wohler@newt.com>
 
 	Release MH-E version 7.92.
--- a/etc/TUTORIAL.cn	Fri Feb 24 06:32:18 2006 +0000
+++ b/etc/TUTORIAL.cn	Fri Feb 24 08:08:56 2006 +0000
@@ -1,4 +1,4 @@
-Emacs 快速指南(查看版权声明请至本文末尾)
+Emacs 快速指南.(查看版权声明请至本文末尾)
 
 【注意:位于【】之间的内容是译注,比如本行,下同。】
 
--- a/etc/orgcard.tex	Fri Feb 24 06:32:18 2006 +0000
+++ b/etc/orgcard.tex	Fri Feb 24 08:08:56 2006 +0000
@@ -1,11 +1,11 @@
-% Reference Card for Org Mode 4.04
+% Reference Card for Org Mode 4.06
 %
 %**start of header
 \newcount\columnsperpage
 
 % This file can be printed with 1, 2, or 3 columns per page (see below).
 % At the moment this card works quite nicely in 3 column format and
-% currently takes 2 full pages.  It is thus suited to producing one
+% currently takes 2 full pages.  It is thus suited to producing one 
 % double-side page when printed.
 
 % There are a couple of tweaks in the format of this card which make it work
@@ -18,8 +18,7 @@
 
 \columnsperpage=3
 
-% Copyright (C) 2005, 2006 Free Software Foundation, Inc.
-% Copyright (c) 2004 Philip Rooke
+% Copyright (c) 2004 Philip Rooke, 2005, 2006 Free Software Foundation
 
 % GNU Emacs is free software; you can redistribute it and/or modify
 % it under the terms of the GNU General Public License as published by
@@ -59,7 +58,7 @@
 % Thanks to Paul Rubin, Bob Chassell, Len Tower, and Richard Mlynarik
 % for their many good ideas.
 
-\def\orgversionnumber{4.04}
+\def\orgversionnumber{4.06}
 \def\year{2006}
 
 \def\shortcopyrightnotice{\vskip 1ex plus 2 fill
@@ -89,7 +88,7 @@
 
 \def\ncolumns{\the\columnsperpage}
 
-\message{[\ncolumns\space
+\message{[\ncolumns\space 
   column\if 1\ncolumns\else s\fi\space per page]}
 
 \def\scaledmag#1{ scaled \magstep #1}
@@ -174,7 +173,7 @@
   \def\bye{\par\vfill\supereject
     \if a\abc \else\null\vfill\eject\fi
     \if a\abc \else\null\vfill\eject\fi
-    \end}
+    \end}  
 \fi
 
 % we won't be using math mode much, so redefine some of the characters
@@ -356,18 +355,8 @@
 \key{raise priority of current item}{S-UP$^4$}
 \key{lower priority of current item}{S-DOWN$^4$}
 
-\vskip 1mm
-per-file TODO workflow states: add line(s) like$^3$:
-\vskip -1mm
-\beginexample%
-\#+SEQ_TODO: TODO PROCRASTINATE BLUFF DONE
-\endexample
-\vskip -1mm
-per-file TODO keywords: add line(s) like$^3$:
-\vskip -1mm
-\beginexample%
-\#+TYP_TODO: Phil home work DONE
-\endexample
+\key{\kbd{\#+SEQ_TODO: TODO TRY BLUFF DONE}}{\rm todo workflow}
+\key{\kbd{\#+TYP_TODO: Phil home work DONE}}{\rm todo types}
 
 \section{Timestamps}
 
@@ -398,21 +387,26 @@
 \key{insert a link (TAB completes stored links)}{C-c C-l}
 \key{insert file link with file name completion}{C-u C-c C-l}
 
-\key{open link at point}{C-c C-o}
-\key{open file links in emacs}{C-u C-c C-o}
-\key{open link at point}{mouse-2}
-\key{open file links in emacs}{mouse-3}
+\key{open file links in emacs (\kbd{C-u} : in emacs)}{C-c C-o}
+\key{open link at point (3: in emacs)}{mouse-2/3}
+%\key{open file links in emacs}{mouse-3}
+\key{record a position in mark ring}{C-c \%}
+\key{jump back to last followed link(s)}{C-c \&}
+
+{\bf Internal Links}
 
-{\bf Link types}
+\key{\kbd{<<My Target>>}}{\rm target}
+\key{\kbd{<<<My Target>>>}}{\rm radio target$^3$}
+\key{\kbd{[[*this text]]}}{\rm find headline}
+\metax{\kbd{[[this text]]}}{\rm find target or text in buffer}
 
-\key{\kbd{*CamelCaseWord}}{\rm search headline}
-\key{\kbd{CamelCaseWord}}{\rm search in buffer}
+{\bf External Links}
+
 \key{\kbd{<file:/home/dominik/img/mars.jpg>}}{\rm file, absolute}
 \key{\kbd{<file:papers/last.pdf>}}{\rm file, relative}
-\key{\kbd{<file:~/code/main.c:255>}}{\rm file with line nr.}
-\key{\kbd{<file:projects.org::*CamelCaseWord>}}{\rm search headline}
-\key{\kbd{<file:projects.org::find me>}}{\rm search string}
-\key{\kbd{<file:projects.org::/regexp/>}}{\rm search regexp}
+\key{\kbd{<file:projects.org::*that text>}}{\rm find headline}
+\key{\kbd{<file:projects.org::find me>}}{\rm find tgt/string}
+\key{\kbd{<file:projects.org::/regexp/>}}{\rm regexp search}
 \key{\kbd{<http://www.astro.uva.nl/~dominik>}}{\rm on the web}
 \key{\kbd{<mailto:adent@galaxy.net>}}{\rm EMail address}
 \key{\kbd{<news:comp.emacs>}}{\rm Usenet group}
@@ -420,15 +414,9 @@
 \key{\kbd{<shell:ls *.org>}}{\rm shell command}
 \key{\kbd{<gnus:group>}}{\rm GNUS group}
 \key{\kbd{<gnus:group\#id>}}{\rm GNUS message}
-\key{\kbd{<vm:folder>}}{\rm VM folder}
-\key{\kbd{<vm:folder\#id>}}{\rm VM message}
-% FIXME: would like to get this back in.
+\key{\kbd{<vm|wl|mhe|rmail:folder>}}{\rm Mail folder}
+\key{\kbd{<vm|wl|mhe|rmail:folder\#id>}}{\rm Mail message}
 %\key{\kbd{<vm://myself@some.where.org/folder\#id>}}{\rm VM remote}
-Wanderlust \kbd{<wl:...>} and RMAIL \kbd{<rmail:...>} like VM
-%\key{\kbd{<wl:folder>}}{\rm Wanderlust f.}
-%\key{\kbd{<wl:folder\#id>}}{\rm Wanderlust m.}
-%\key{\kbd{<rmail:folder>}}{\rm RMAIL folder}
-%\key{\kbd{<rmail:folder\#id>}}{\rm RMAIL msg}
 
 \section{Tables}
 
@@ -711,7 +699,7 @@
 \key{next heading}{DOWN}
 \key{previous heading}{UP}
 
-Insert the note with one of the following:
+Insert the note with one of the following: 
 
 \key{as sublevel of heading at cursor}{RET}
 \key{right here (cursor not on heading)}{RET}
@@ -741,8 +729,8 @@
 $^2$ This is only a suggestion for a binding of this command.  Choose
 you own key as shown under INSTALLATION.
 
-$^3$ After changing a \kbd{\#+KEYWORD} line, press \kbd{C-c C-c} with
-the cursor still in a line to make Org-mode notice the change.
+$^3$ After changing a \kbd{\#+KEYWORD} or \kbd{<<<target>>>} line,
+press \kbd{C-c C-c} with the cursor still in the line to update.
 
 $^4$ Keybinding affected by {\tt org-CUA-compatibility}.
 
@@ -753,7 +741,7 @@
 
 % arch-tag: 139f6750-5cfc-49ca-92b5-237fe5795290
 
-%%% Local Variables:
+%%% Local Variables: 
 %%% mode: latex
 %%% TeX-master: t
-%%% End:
+%%% End: 
--- a/lisp/ChangeLog	Fri Feb 24 06:32:18 2006 +0000
+++ b/lisp/ChangeLog	Fri Feb 24 08:08:56 2006 +0000
@@ -1,3 +1,135 @@
+2006-02-24  Juanma Barranquero  <lekktu@gmail.com>
+
+	* help.el (help): Revert last part of 2006-02-23 change (deletion
+	of the `provide' call).
+
+2006-02-23  Juri Linkov  <juri@jurta.org>
+
+	* compare-w.el (compare-windows-highlight): Add new value
+	`persistent' and change :type from `boolean' to `choice'.
+	(compare-windows-overlays1, compare-windows-overlays2):
+	New internal variables.
+	(compare-windows-highlight): If compare-windows-highlight is
+	`persistent', add current overlays to compare-windows-overlays[12]
+	instead of adding compare-windows-dehighlight to pre-command-hook.
+	(compare-windows-dehighlight): Delete all overlays from
+	compare-windows-overlays[12].
+
+	* info.el (Info-search): Don't bind search-spaces-regexp to
+	Info-search-whitespace-regexp in non-regexp isearch mode.
+
+2006-02-23  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* help.el (describe-mode): Pass `mode-name' to format-mode-line.
+
+2006-02-23  Juanma Barranquero  <lekktu@gmail.com>
+
+	* textmodes/org.el (org-xemacs-p)
+	(org-export-html-show-new-buffer, org-table-may-need-update)
+	(org-insert-item, org-mhe-get-message-real-folder)
+	(org-mhe-get-message-folder-from-index)
+	(org-mhe-get-message-folder, org-mhe-get-message-num)
+	(org-mhe-get-header, org-make-org-heading-search-string)
+	(org-make-org-heading-camel, org-table-sort-lines)
+	(org-format-org-table-html, org-format-table-table-html):
+	Fix typos in docstrings.
+
+12006-02-23  Carsten Dominik  <dominik@science.uva.nl>
+
+	* textmodes/org.el (org-cleaned-string-for-export)
+	(org-solidify-link-text): New function.
+	(org-add-hook): Use `add-local-hook' instead of `make-local-hook' for
+	XEmacs, just to silence the compiler.
+	(org-export-as-ascii, org-export-as-html-and-open):
+	Use `org-cleaned-string-for-export' and create internal links.
+	(org-follow-mhe-link): Require mh-e, use folder.
+
+2006-02-23  Nick Roberts  <nickrob@snap.net.nz>
+
+	* progmodes/gud.el (gud-speedbar-buttons): Use shadow face properly.
+
+	* progmodes/gdb-ui.el (gdb-debug-ring-max): Rename from
+	gdb-debug-log-length.
+	(gdb-debug-ring): Rename from gdb-debug-log-ring.  Don't make
+	it a real ring but...
+	(gud-gdba-marker-filter): ...make it work like mark-ring.
+	(gdb-enable-debug): Rename from gdb-enable-debug-log.
+	(gdb-mouse-jump): New function.  Add bindings.
+
+2006-02-23  Nick Roberts  <nickrob@snap.net.nz>
+
+	* progmodes/gdb-ui.el (gdb-signalled): New variable and function.
+	(gdb-debug-log-ring): Rename from gdb-debug-log and make a ring.
+	(gdb-send, gdb-send-item, gud-gdba-marker-filter): Use it.
+	(gdb-debug-log-length): Customize it's length.
+	(gud-watch, gdb-var-create-handler): Display function::var format
+	but don't use to create variable object.
+	(gdb-var-create-handler): Use message-box in place of message.
+	(gdb-stopped): Call gdb-exited if signalled.
+
+2006-02-22  Carsten Dominik  <dominik@science.uva.nl>
+
+	* textmodes/reftex.el (reftex-locate-file): Remove duplicate function.
+
+	* textmodes/reftex-vars.el (reftex-try-all-extensions): New option.
+
+	* textmodes/reftex.el (reftex-locate-file): Search all extensions
+	if `reftex-try-all-extensions' is set.
+
+	* textmodes/org.el (org-mark-ring-push, org-mark-ring-goto):
+	New commands.
+	(org-mark-ring): New variable.
+	(org-mark-ring-length): New option.
+	(org-open-at-point, org-goto, org-open-file): Push old position
+	onto the mark ring.
+	(org-add-hook): New function.
+	(org-export-table-remove-special-lines): New option.
+	(org-skip-comments, org-format-org-table-html): Respect new
+	option `org-export-table-remove-special-lines'.
+	(org-open-file): Allow special command configuration for
+	directory link.
+	(org-file-apps): Fix bugs in customize type, added setting
+	for directories.
+	(org-activate-tags, org-format-agenda-item, org-complete)
+	(org-get-tags-at, org-scan-tags, org-make-tags-matcher)
+	(org-get-tags, org-get-buffer-tags, org-open-at-point)
+	(org-link-search, org-make-org-heading-search-string)
+	(org-make-org-heading-camel): Allow @ and 0-9 as tags characters.
+	(org-radio-targets, org-file-link-context-use-camel-case)
+	(org-activate-camels): New options.
+	(org-update-radio-target-regexp, org-all-targets)
+	(org-make-target-link-regexp, org-activate-target-links):
+	New functions.
+	(org-make-org-heading-search-string): New function.
+	(org-store-link, org-insert-link): Use new option
+	`org-file-link-context-use-camel-case'.
+	(org-activate-camels): Use new option `org-activate-camels'.
+	(org-link-regexp): Add mhe prefix.
+	(org-open-at-point, org-store-link): Support for mhe links.
+	(org-mhe-get-message-real-folder, org-mhe-get-message-folder)
+	(org-mhe-get-message-folder-from-index, org-mhe-get-message-num)
+	(org-mhe-get-header, org-follow-mhe-link): New functions.
+	(org-remove-angle-brackets, org-add-angle-brackets):
+	New functions.
+	(org-bracket-link-regexp): New constant.
+	(org-read-date): Fix bug that was rejecting all typed dates.
+	(org-link-search): Make hierarchy above visible after a match.
+	(org-follow-bbdb-link): Inhibit electric mode for BBDB.
+	(org-store-link): Fix bug with link creation when cursor is in
+	an empty line.
+	(org-open-at-point): Fix bug with matching a link.
+	Fixed buggy argument sequence in call to `org-view-tags'.
+	(org-compile-prefix-format): Set `org-prefix-has-tag'.
+	(org-prefix-has-tag): New variable.
+	(org-format-agenda-item): Remove tags from headline
+	if appropriate.
+	(org-agenda-remove-tags-when-in-prefix): New option.
+
+2006-02-21  Michael Kifer  <kifer@cs.stonybrook.edu>
+
+	* ediff-diff.el (ediff-setup-diff-regions, ediff-setup-diff-regions3):
+	Fix the regular expressions.
+
 2006-02-21  Richard M. Stallman  <rms@gnu.org>
 
 	* progmodes/sh-script.el (sh-mode): Set shell type based on file name
@@ -49,8 +181,8 @@
 
 2006-02-20  Chong Yidong  <cyd@stupidchicken.com>
 
-	* custom.el (customize-mark-to-save, customize-mark-as-set): Load
-	the symbol first.
+	* custom.el (customize-mark-to-save, customize-mark-as-set):
+	Load the symbol first.
 
 2006-02-20  Juanma Barranquero  <lekktu@gmail.com>
 
@@ -163,7 +295,7 @@
 	* progmodes/gdb-ui.el (gdb-var-evaluate-expression-handler)
 	(gdb-var-update-handler): Detect out of scope variables with pre
 	GDB 6.4 too.
-	(gdb-post-prompt): Revert changet 2006-02-17 (force update).
+	(gdb-post-prompt): Revert change from 2006-02-17 (force update).
 	Reset status of variable objects to nil in update handlers.
 	(gdb-var-update-handler-1): Detect when a variable object comes
 	in scope.  setcar on var changes gdb-var-list directly.
--- a/lisp/allout.el	Fri Feb 24 06:32:18 2006 +0000
+++ b/lisp/allout.el	Fri Feb 24 08:08:56 2006 +0000
@@ -1,7 +1,7 @@
 ;;; allout.el --- extensive outline mode for use alone and with other modes
 
 ;; Copyright (C) 1992, 1993, 1994, 2001, 2002, 2003, 2004,
-;;   2005 Free Software Foundation, Inc.
+;;   2005, 2006 Free Software Foundation, Inc.
 
 ;; Author: Ken Manheimer <ken dot manheimer at gmail dot com>
 ;; Maintainer: Ken Manheimer <ken dot manheimer at gmail dot com>
@@ -5811,14 +5811,14 @@
 (provide 'allout)
 
 ;;;_* Local emacs vars.
-;;; The following `allout-layout' local variable setting:
-;;;  - closes all topics from the first topic to just before the third-to-last,
-;;;  - shows the children of the third to last (config vars)
-;;;  - and the second to last (code section),
-;;;  - and closes the last topic (this local-variables section).
-;;;Local variables:
-;;;allout-layout: (0 : -1 -1 0)
-;;;End:
-
-;;; arch-tag: cf38fbc3-c044-450f-8bff-afed8ba5681c
+;; The following `allout-layout' local variable setting:
+;;  - closes all topics from the first topic to just before the third-to-last,
+;;  - shows the children of the third to last (config vars)
+;;  - and the second to last (code section),
+;;  - and closes the last topic (this local-variables section).
+;;Local variables:
+;;allout-layout: (0 : -1 -1 0)
+;;End:
+
+;; arch-tag: cf38fbc3-c044-450f-8bff-afed8ba5681c
 ;;; allout.el ends here
--- a/lisp/compare-w.el	Fri Feb 24 06:32:18 2006 +0000
+++ b/lisp/compare-w.el	Fri Feb 24 08:08:56 2006 +0000
@@ -117,8 +117,14 @@
   :version "22.1")
 
 (defcustom compare-windows-highlight t
-  "*Non-nil means compare-windows highlights the differences."
-  :type 'boolean
+  "*Non-nil means compare-windows highlights the differences.
+The value t removes highlighting immediately after invoking a command
+other than `compare-windows'.
+The value `persistent' leaves all highlighted differences.  You can clear
+out all highlighting later with the command `compare-windows-dehighlight'."
+  :type '(choice (const :tag "No highlighting" nil)
+		 (const :tag "Persistent highlighting" persistent)
+		 (other :tag "Highlight until next command" t))
   :group 'compare-w
   :version "22.1")
 
@@ -130,6 +136,8 @@
 
 (defvar compare-windows-overlay1 nil)
 (defvar compare-windows-overlay2 nil)
+(defvar compare-windows-overlays1 nil)
+(defvar compare-windows-overlays2 nil)
 (defvar compare-windows-sync-point nil)
 
 ;;;###autoload
@@ -351,13 +359,22 @@
       (overlay-put compare-windows-overlay2 'face 'compare-windows)
       (overlay-put compare-windows-overlay2 'priority 1000))
     (overlay-put compare-windows-overlay2 'window w2)
-    ;; Remove highlighting before next command is executed
-    (add-hook 'pre-command-hook 'compare-windows-dehighlight)))
+    (if (not (eq compare-windows-highlight 'persistent))
+	;; Remove highlighting before next command is executed
+	(add-hook 'pre-command-hook 'compare-windows-dehighlight)
+      (when compare-windows-overlay1
+	(push (copy-overlay compare-windows-overlay1) compare-windows-overlays1)
+	(delete-overlay compare-windows-overlay1))
+      (when compare-windows-overlay2
+	(push (copy-overlay compare-windows-overlay2) compare-windows-overlays2)
+	(delete-overlay compare-windows-overlay2)))))
 
 (defun compare-windows-dehighlight ()
   "Remove highlighting created by `compare-windows-highlight'."
   (interactive)
   (remove-hook 'pre-command-hook 'compare-windows-dehighlight)
+  (mapc 'delete-overlay compare-windows-overlays1)
+  (mapc 'delete-overlay compare-windows-overlays2)
   (and compare-windows-overlay1 (delete-overlay compare-windows-overlay1))
   (and compare-windows-overlay2 (delete-overlay compare-windows-overlay2)))
 
--- a/lisp/ediff-diff.el	Fri Feb 24 06:32:18 2006 +0000
+++ b/lisp/ediff-diff.el	Fri Feb 24 08:08:56 2006 +0000
@@ -251,7 +251,8 @@
 ;; ediff-setup-diff-regions3, which takes 4 arguments.
 (defun ediff-setup-diff-regions (file-A file-B file-C)
   ;; looking for '-c', '-i', or a 'c', 'i' among clustered non-long options
-  (if (string-match "^-[ci]\\| -[ci]\\|-[^- ]+[ci]" ediff-diff-options)
+  (if (string-match "^-[ci]\\| -[ci]\\|\\(^\\| \\)-[^- ]+[ci]"
+		    ediff-diff-options)
       (error "Options `-c' and `-i' are not allowed in `ediff-diff-options'"))
 
   ;; create, if it doesn't exist
@@ -1215,7 +1216,7 @@
 ;; or it is the ancestor file.
 (defun ediff-setup-diff-regions3 (file-A file-B file-C)
   ;; looking for '-i' or a 'i' among clustered non-long options
-  (if (string-match "^-i\\| -i\\|-[^- ]+i" ediff-diff-options)
+  (if (string-match "^-i\\| -i\\|\\(^\\| \\)-[^- ]+i" ediff-diff-options)
       (error "Option `-i' is not allowed in `ediff-diff3-options'"))
 
   (or (ediff-buffer-live-p ediff-diff-buffer)
--- a/lisp/gnus/ChangeLog	Fri Feb 24 06:32:18 2006 +0000
+++ b/lisp/gnus/ChangeLog	Fri Feb 24 08:08:56 2006 +0000
@@ -1,3 +1,38 @@
+2006-02-23  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+	* flow-fill.el (fill-flowed): Bind adaptive-fill-mode to nil.
+	Remove space stuffing, and only do quotes that actually start with
+	">" at the beginning of the lines.
+	Merge of 2005-11-17 and 2004-07-25 from the trunk.
+
+2006-02-23  Reiner Steib  <Reiner.Steib@gmx.de>
+
+	* utf7.el (utf7-utf-16-coding-system): Fix comment.  utf-16-be is
+	also available in Emacs 21.3.
+
+	* message.el (message-fix-before-sending): Change "Emacs 22" to
+	"Emacs 23 (unicode)" in comment.
+
+	* qp.el (quoted-printable-encode-region): Change "Emacs 22" to
+	"Emacs 23 (unicode)" in comment.
+
+	* mm-util.el: Change "Emacs 22" to "Emacs 23 (unicode)" in
+	comment.
+	(mm-coding-system-p): Add comment about no-MULE XEmacs.
+
+	* mm-view.el (mm-fill-flowed): Add :version.
+
+2006-02-23  Ralf Angeli  <angeli@iwi.uni-sb.de>
+
+	* mm-view.el (mm-fill-flowed): New variable.
+	(mm-inline-text): Use it.
+
+2006-02-21  Wolfram Fenske  <wolfram.fenske@student.uni-magdeburg.de>
+	(tiny change)
+
+	* nnimap.el (nnimap-request-move-article): Change folder back to
+	source group before deleting.
+
 2006-02-20  Katsumi Yamaoka  <yamaoka@jpl.org>
 
 	* rfc2047.el (rfc2047-charset-to-coding-system): Don't check the
@@ -1266,7 +1301,7 @@
 
 	* gnus-topic.el (gnus-topic-mode): Ditto.
 
-2005-07-08  Ralf Angeli  <angeli@iwi.uni-sb.de>  (tiny change)
+2005-07-08  Ralf Angeli  <angeli@iwi.uni-sb.de>
 
 	* gnus-art.el (gnus-article-next-page, gnus-article-next-page-1)
 	(gnus-article-prev-page): Take scroll-margin into consideration.
--- a/lisp/gnus/flow-fill.el	Fri Feb 24 06:32:18 2006 +0000
+++ b/lisp/gnus/flow-fill.el	Fri Feb 24 08:08:56 2006 +0000
@@ -113,10 +113,15 @@
   (save-excursion
     (set-buffer (or (current-buffer) buffer))
     (goto-char (point-min))
+    ;; Remove space stuffing.
+    (while (re-search-forward "^ " nil t)
+      (delete-char -1)
+      (forward-line 1))
+    (goto-char (point-min))
     (while (re-search-forward " $" nil t)
       (when (save-excursion
 	      (beginning-of-line)
-	      (looking-at "^\\(>*\\)\\( ?\\)"))
+	      (looking-at "^\\(>+\\)\\( ?\\)"))
 	(let ((quote (match-string 1))
 	      sig)
 	  (if (string= quote "")
@@ -146,7 +151,8 @@
 	    (condition-case nil
 		(let ((fill-prefix (when quote (concat quote " ")))
 		      (fill-column (eval fill-flowed-display-column))
-		      filladapt-mode)
+		      filladapt-mode
+		      adaptive-fill-mode)
 		  (fill-region (fill-flowed-point-at-bol)
 			       (min (1+ (fill-flowed-point-at-eol))
 				    (point-max))
--- a/lisp/gnus/message.el	Fri Feb 24 06:32:18 2006 +0000
+++ b/lisp/gnus/message.el	Fri Feb 24 08:08:56 2006 +0000
@@ -3615,8 +3615,8 @@
 	  (when (let ((char (char-after)))
 		  (or (< (mm-char-int char) 128)
 		      (and (mm-multibyte-p)
-			   ;; Fixme: Wrong for Emacs 23 and for things
-			   ;; like undectable utf-8.  Should at least
+			   ;; FIXME: Wrong for Emacs 23 (unicode) and for
+			   ;; things like undecable utf-8.  Should at least
 			   ;; use find-coding-systems-region.
 			   (memq (char-charset char)
 				 '(eight-bit-control eight-bit-graphic
--- a/lisp/gnus/mm-util.el	Fri Feb 24 06:32:18 2006 +0000
+++ b/lisp/gnus/mm-util.el	Fri Feb 24 08:08:56 2006 +0000
@@ -174,7 +174,7 @@
     (if (fboundp 'coding-system-p)
 	(when (coding-system-p cs)
 	  cs)
-      ;; Is this branch ever actually useful?
+      ;; no-MULE XEmacs:
       (car (memq cs (mm-get-coding-system-list))))))
 
 (defvar mm-charset-synonym-alist
@@ -331,7 +331,7 @@
 	  cs mime mule alist)
       (while css
 	(setq cs (pop css)
-	      mime (or (coding-system-get cs :mime-charset) ; Emacs 23
+	      mime (or (coding-system-get cs :mime-charset); Emacs 23 (unicode)
 		       (coding-system-get cs 'mime-charset)))
 	(when (and mime
 		   (not (eq t (setq mule
--- a/lisp/gnus/mm-view.el	Fri Feb 24 06:32:18 2006 +0000
+++ b/lisp/gnus/mm-view.el	Fri Feb 24 08:08:56 2006 +0000
@@ -72,6 +72,12 @@
     (html2text  html2text))
   "The attributes of washer types for text/html.")
 
+(defcustom mm-fill-flowed t
+  "If non-nil an format=flowed article will be displayed flowed."
+  :type 'boolean
+  :version "22.1"
+  :group 'mime-display)
+
 ;;; Internal variables.
 
 ;;;
@@ -407,7 +413,8 @@
 	  (mm-insert-part handle)
 	  (goto-char (point-max)))
       (insert (mm-decode-string (mm-get-part handle) charset)))
-    (when (and (equal type "plain")
+    (when (and mm-fill-flowed
+	       (equal type "plain")
 	       (equal (cdr (assoc 'format (mm-handle-type handle)))
 		      "flowed"))
       (save-restriction
--- a/lisp/gnus/nnimap.el	Fri Feb 24 06:32:18 2006 +0000
+++ b/lisp/gnus/nnimap.el	Fri Feb 24 08:08:56 2006 +0000
@@ -1492,6 +1492,7 @@
 	       (setq result (eval accept-form))
 	       (kill-buffer buf)
 	       result)
+	     (nnimap-possibly-change-group group server)
 	     (imap-message-flags-add
 	      (imap-range-to-message-set (list article))
 	      "\\Deleted" 'silent nnimap-server-buffer))
--- a/lisp/gnus/qp.el	Fri Feb 24 06:32:18 2006 +0000
+++ b/lisp/gnus/qp.el	Fri Feb 24 08:08:56 2006 +0000
@@ -118,7 +118,7 @@
 		  (not (eobp)))
 	(insert
 	 (prog1
-	     ;; To unibyte in case of Emacs 23 eight-bit.
+	     ;; To unibyte in case of Emacs 23 (unicode) eight-bit.
 	     (format "=%02X" (mm-multibyte-char-to-unibyte (char-after)))
 	   (delete-char 1))))
       ;; Encode white space at the end of lines.
--- a/lisp/gnus/utf7.el	Fri Feb 24 06:32:18 2006 +0000
+++ b/lisp/gnus/utf7.el	Fri Feb 24 08:08:56 2006 +0000
@@ -80,7 +80,7 @@
 (defconst utf7-utf-16-coding-system
   (cond ((mm-coding-system-p 'utf-16-be-no-signature) ; Mule-UCS
 	 'utf-16-be-no-signature)
-	((and (mm-coding-system-p 'utf-16-be) ; Emacs 23.1
+	((and (mm-coding-system-p 'utf-16-be) ; Emacs 21.3, Emacs 22
 	      ;; Avoid versions with BOM.
 	      (= 2 (length (encode-coding-string "a" 'utf-16-be))))
 	 'utf-16-be)
--- a/lisp/help.el	Fri Feb 24 06:32:18 2006 +0000
+++ b/lisp/help.el	Fri Feb 24 08:08:56 2006 +0000
@@ -835,8 +835,9 @@
 	;; Document the major mode.
 	(let ((mode mode-name))
 	  (with-current-buffer standard-output
-	    (insert mode)
-	    (add-text-properties (- (point) (length mode)) (point) '(face bold))))
+            (let ((start (point)))
+              (insert (format-mode-line mode))
+              (add-text-properties start (point) '(face bold)))))
 	(princ " mode:\n")
 	(princ (documentation major-mode)))
       (print-help-return-message))))
@@ -932,7 +933,7 @@
 ;;; Automatic resizing of temporary buffers.
 
 (defcustom temp-buffer-max-height (lambda (buffer) (/ (- (frame-height) 2) 2))
-  "*Maximum height of a window displaying a temporary buffer.
+  "Maximum height of a window displaying a temporary buffer.
 This is the maximum height (in text lines) which `resize-temp-buffer-window'
 will give to a window displaying a temporary buffer.
 It can also be a function which will be called with the object corresponding
@@ -971,8 +972,7 @@
 	 (funcall temp-buffer-max-height (current-buffer))
        temp-buffer-max-height))))
 
-;; Provide this for the sake of define-minor-mode which generates
-;; defcustoms which require 'help'.
+
 (provide 'help)
 
 ;; arch-tag: cf427352-27e9-49b7-9a6f-741ebab02423
--- a/lisp/info.el	Fri Feb 24 06:32:18 2006 +0000
+++ b/lisp/info.el	Fri Feb 24 08:08:56 2006 +0000
@@ -1642,7 +1642,9 @@
 			      (and (search-backward "\^_" nil t)
 				   (looking-at
 				    "\^_\n\\(Tag Table\\|Local Variables\\)"))))))
-	    (let ((search-spaces-regexp Info-search-whitespace-regexp))
+	    (let ((search-spaces-regexp
+		   (if (or (not isearch-mode) isearch-regexp)
+		       Info-search-whitespace-regexp)))
 	      (if (if backward
 		      (re-search-backward regexp bound t)
 		    (re-search-forward regexp bound t))
@@ -1660,7 +1662,9 @@
       ;; If no subfiles, give error now.
       (if give-up
 	  (if (null Info-current-subfile)
-	      (let ((search-spaces-regexp Info-search-whitespace-regexp))
+	      (let ((search-spaces-regexp
+		     (if (or (not isearch-mode) isearch-regexp)
+			 Info-search-whitespace-regexp)))
 		(if backward
 		    (re-search-backward regexp)
 		  (re-search-forward regexp)))
@@ -1731,7 +1735,9 @@
 				    (and (search-backward "\^_" nil t)
 					 (looking-at
 					  "\^_\n\\(Tag Table\\|Local Variables\\)"))))))
-		  (let ((search-spaces-regexp Info-search-whitespace-regexp))
+		  (let ((search-spaces-regexp
+			 (if (or (not isearch-mode) isearch-regexp)
+			     Info-search-whitespace-regexp)))
 		    (if (if backward
 			    (re-search-backward regexp nil t)
 			  (re-search-forward regexp nil t))
--- a/lisp/progmodes/gdb-ui.el	Fri Feb 24 06:32:18 2006 +0000
+++ b/lisp/progmodes/gdb-ui.el	Fri Feb 24 08:08:56 2006 +0000
@@ -123,6 +123,7 @@
 (defvar gdb-macro-info nil
   "Non-nil if GDB knows that the inferior includes preprocessor macro info.")
 (defvar gdb-buffer-fringe-width nil)
+(defvar gdb-signalled nil)
 
 (defvar gdb-buffer-type nil
   "One of the symbols bound in `gdb-buffer-rules'.")
@@ -258,11 +259,19 @@
   (gdb command-line)
   (gdb-init-1))
 
-(defvar gdb-debug-log nil)
+(defcustom gdb-debug-ring-max 128
+  "Maximum size of `gdb-debug-ring'."
+  :group 'gud
+  :type 'integer
+  :version "22.1")
+
+(defvar gdb-debug-ring nil
+  "List of commands, most recent first, sent to and replies received from GDB.
+This variable is used to debug GDB-UI.")
 
 ;;;###autoload
-(defcustom gdb-enable-debug-log nil
-  "Non-nil means record the process input and output in `gdb-debug-log'."
+(defcustom gdb-enable-debug nil
+  "Non-nil means record the process input and output in `gdb-debug-ring'."
   :type 'boolean
   :group 'gud
   :version "22.1")
@@ -390,7 +399,6 @@
     expr))
 
 (defun gdb-init-1 ()
-  (setq gdb-debug-log nil)
   (set (make-local-variable 'gud-minor-mode) 'gdba)
   (set (make-local-variable 'gud-marker-filter) 'gud-gdba-marker-filter)
   ;;
@@ -436,11 +444,21 @@
     'gdb-mouse-set-clear-breakpoint)
   (define-key gud-minor-mode-map [left-fringe mouse-2]
     'gdb-mouse-until)
+  (define-key gud-minor-mode-map [left-margin drag-mouse-1]
+    'gdb-mouse-until)
   (define-key gud-minor-mode-map [left-fringe drag-mouse-1]
     'gdb-mouse-until)
   (define-key gud-minor-mode-map [left-margin mouse-2]
     'gdb-mouse-until)
-  (define-key gud-minor-mode-map [left-margin mouse-3]
+  (define-key gud-minor-mode-map [left-margin C-drag-mouse-1]
+    'gdb-mouse-jump)
+  (define-key gud-minor-mode-map [left-fringe C-drag-mouse-1]
+    'gdb-mouse-jump)
+  (define-key gud-minor-mode-map [left-fringe C-mouse-2]
+    'gdb-mouse-jump)
+  (define-key gud-minor-mode-map [left-margin C-mouse-2]
+    'gdb-mouse-jump)
+   (define-key gud-minor-mode-map [left-margin mouse-3]
     'gdb-mouse-toggle-breakpoint-margin)
   (define-key gud-minor-mode-map [left-fringe mouse-3]
     'gdb-mouse-toggle-breakpoint-fringe)
@@ -469,14 +487,15 @@
 	gdb-source-file-list nil
 	gdb-error nil
 	gdb-macro-info nil
-	gdb-buffer-fringe-width (car (window-fringes)))
+	gdb-buffer-fringe-width (car (window-fringes))
+	gdb-debug-ring nil
+	gdb-signalled nil)
 
   (setq gdb-buffer-type 'gdba)
 
   (if gdb-use-separate-io-buffer (gdb-clear-inferior-io))
 
   ;; Hack to see test for GDB 6.4+ (-stack-info-frame was implemented in 6.4)
-  (setq gdb-version nil)
   (gdb-enqueue-input (list "server interpreter mi -stack-info-frame\n"
 			   'gdb-get-version)))
 
@@ -516,7 +535,9 @@
   (gdb-init-2))
 
 (defun gdb-mouse-until (event)
-  "Execute source lines by dragging the overlay arrow (fringe) with the mouse."
+  "Continue running until a source line past the current line.
+The destination source line can be selected either by clicking with mouse-2
+on the fringe/margin or dragging the arrow with mouse-1 (default bindings)."
   (interactive "e")
   (if gud-overlay-arrow-position
       (let ((start (event-start event))
@@ -542,6 +563,40 @@
 		  (forward-char 2)
 		  (gud-call (concat "until *%a")))))))))
 
+(defun gdb-mouse-jump (event)
+  "Set execution address/line.
+The destination source line can be selected either by clicking with mouse-2
+on the fringe/margin or dragging the arrow with mouse-1 (default bindings).
+Unlike gdb-mouse-until the destination address can be before the current
+line, and no execution takes place."
+  (interactive "e")
+  (if gud-overlay-arrow-position
+      (let ((start (event-start event))
+	    (end  (event-end event))
+	    (buffer (marker-buffer gud-overlay-arrow-position)) (line))
+	(if (not (string-match "Machine" mode-name))
+	    (if (equal buffer (window-buffer (posn-window end)))
+		(with-current-buffer buffer
+		  (when (or (equal start end)
+			    (equal (posn-point start)
+				   (marker-position
+				    gud-overlay-arrow-position)))
+		    (setq line (line-number-at-pos (posn-point end)))
+	   (progn (gud-call (concat "tbreak " (number-to-string line)))
+		  (gud-call (concat "jump " (number-to-string line)))))))
+	  (if (equal (marker-buffer gdb-overlay-arrow-position)
+		     (window-buffer (posn-window end)))
+	      (when (or (equal start end)
+			(equal (posn-point start)
+			       (marker-position
+				gdb-overlay-arrow-position)))
+		(save-excursion
+		  (goto-line (line-number-at-pos (posn-point end)))
+		  (forward-char 2)
+		  (progn
+		    (gud-call (concat "tbreak *%a"))
+		    (gud-call (concat "jump *%a"))))))))))
+
 (defcustom gdb-speedbar-auto-raise nil
   "If non-nil raise speedbar every time display of watch expressions is\
  updated."
@@ -573,9 +628,6 @@
   (require 'tooltip)
   (save-selected-window
     (let ((expr (tooltip-identifier-from-point (point))))
-      (if (and (string-equal gdb-current-language "c")
-	       gdb-use-colon-colon-notation gdb-selected-frame)
-	  (setq expr (concat gdb-selected-frame "::" expr)))
       (catch 'already-watched
 	(dolist (var gdb-var-list)
 	  (if (string-equal expr (car var)) (throw 'already-watched nil)))
@@ -593,11 +645,15 @@
 (defun gdb-var-create-handler (expr)
   (goto-char (point-min))
   (if (re-search-forward gdb-var-create-regexp nil t)
-      (let ((var (list expr
-		       (match-string 1)
-		       (match-string 2)
-		       (match-string 3)
-		       nil nil)))
+      (let ((var (list
+		  (if (and (string-equal gdb-current-language "c")
+			   gdb-use-colon-colon-notation gdb-selected-frame)
+		      (setq expr (concat gdb-selected-frame "::" expr))
+		    expr)
+		  (match-string 1)
+		  (match-string 2)
+		  (match-string 3)
+		  nil nil)))
 	(push var gdb-var-list)
 	(speedbar 1)
 	(unless (string-equal
@@ -613,7 +669,7 @@
 		       ,(nth 1 var) nil)))))
     (if (search-forward "Undefined command" nil t)
 	(message-box "Watching expressions requires gdb 6.0 onwards")
-      (message "No symbol \"%s\" in current context." expr))))
+      (message-box "No symbol \"%s\" in current context." expr))))
 
 (defun gdb-var-evaluate-expression-handler (varnum changed)
   (goto-char (point-min))
@@ -864,7 +920,7 @@
 	  "*"))
 
 (defun gdb-display-separate-io-buffer ()
-  "Display IO of inferior in a separate window."
+  "Display IO of debugged program in a separate window."
   (interactive)
   (if gdb-use-separate-io-buffer
       (gdb-display-buffer
@@ -963,7 +1019,7 @@
   (let ((item (concat string "\n")))
     (if gud-running
       (progn
-	(if gdb-enable-debug-log (push (cons 'send item) gdb-debug-log))
+	(if gdb-enable-debug (push (cons 'send item) gdb-debug-ring))
 	(process-send-string proc item))
       (gdb-enqueue-input item))))
 
@@ -986,7 +1042,7 @@
 
 (defun gdb-send-item (item)
   (setq gdb-flush-pending-output nil)
-  (if gdb-enable-debug-log (push (cons 'send-item item) gdb-debug-log))
+  (if gdb-enable-debug (push (cons 'send-item item) gdb-debug-ring))
   (setq gdb-current-item item)
   (let ((process (get-buffer-process gud-comint-buffer)))
     (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba)
@@ -1039,7 +1095,7 @@
     ("source" gdb-source)
     ("starting" gdb-starting)
     ("exited" gdb-exited)
-    ("signalled" gdb-exited)
+    ("signalled" gdb-signalled)
     ("signal" gdb-stopping)
     ("breakpoint" gdb-stopping)
     ("watchpoint" gdb-stopping)
@@ -1156,6 +1212,9 @@
   (setq gdb-overlay-arrow-position nil)
   (gdb-stopping ignored))
 
+(defun gdb-signalled (ignored)
+  (setq gdb-signalled t))
+
 (defun gdb-frame-begin (ignored)
   (let ((sink gdb-output-sink))
     (cond
@@ -1172,7 +1231,6 @@
 It is just like `gdb-stopping', except that if we already set the output
 sink to `user' in `gdb-stopping', that is fine."
   (setq gud-running nil)
-  (setq gdb-active-process t)
   (let ((sink gdb-output-sink))
     (cond
      ((eq sink 'inferior)
@@ -1180,7 +1238,8 @@
      ((eq sink 'user) t)
      (t
       (gdb-resync)
-      (error "Unexpected stopped annotation")))))
+      (error "Unexpected stopped annotation"))))
+  (if gdb-signalled (gdb-exited ignored)))
 
 (defun gdb-error (ignored)
   (setq gdb-error (not gdb-error)))
@@ -1233,7 +1292,10 @@
   "A gud marker filter for gdb.  Handle a burst of output from GDB."
   (if gdb-flush-pending-output
       nil
-    (if gdb-enable-debug-log (push (cons 'recv string) gdb-debug-log))
+    (when gdb-enable-debug
+	(push (cons 'recv string) gdb-debug-ring)
+	(if (> (length gdb-debug-ring) gdb-debug-ring-max)
+	  (setcdr (nthcdr (1- gdb-debug-ring-max) gdb-debug-ring) nil)))
     ;; Recall the left over gud-marker-acc from last time.
     (setq gud-marker-acc (concat gud-marker-acc string))
     ;; Start accumulating output for the GUD buffer.
--- a/lisp/progmodes/glasses.el	Fri Feb 24 06:32:18 2006 +0000
+++ b/lisp/progmodes/glasses.el	Fri Feb 24 08:08:56 2006 +0000
@@ -67,7 +67,7 @@
 
 
 (defcustom glasses-separator "_"
-  "*String to be displayed as a visual separator in identifiers.
+  "String to be displayed as a visual separator in identifiers.
 It is used both for adding missing separators and for replacing separators
 defined by `glasses-original-separator'.  If you don't want to add missing
 separators, set `glasses-separator' to an empty string.  If you don't want to
@@ -93,7 +93,7 @@
 
 
 (defcustom glasses-face nil
-  "*Face to be put on capitals of an identifier looked through glasses.
+  "Face to be put on capitals of an identifier looked through glasses.
 If it is nil, no face is placed at the capitalized letter.
 
 For example, you can set `glasses-separator' to an empty string and
@@ -106,13 +106,13 @@
 
 
 (defcustom glasses-separate-parentheses-p t
-  "*If non-nil, ensure space between an identifier and an opening parenthesis."
+  "If non-nil, ensure space between an identifier and an opening parenthesis."
   :group 'glasses
   :type 'boolean)
 
 
 (defcustom glasses-uncapitalize-p nil
-  "*If non-nil, downcase embedded capital letters in identifiers.
+  "If non-nil, downcase embedded capital letters in identifiers.
 Only identifiers starting with lower case letters are affected, letters inside
 other identifiers are unchanged."
   :group 'glasses
@@ -122,7 +122,7 @@
 
 
 (defcustom glasses-uncapitalize-regexp "[a-z]"
-  "*Regexp matching beginnings of words to be uncapitalized.
+  "Regexp matching beginnings of words to be uncapitalized.
 Only words starting with this regexp are uncapitalized.
 The regexp is case sensitive.
 It has any effect only when `glasses-uncapitalize-p' is non-nil."
@@ -133,7 +133,7 @@
 
 
 (defcustom glasses-convert-on-write-p nil
-  "*If non-nil, remove separators when writing glasses buffer to a file.
+  "If non-nil, remove separators when writing glasses buffer to a file.
 If you are confused by glasses so much, that you write the separators into code
 during coding, set this variable to t.  The separators will be removed on each
 file write then.
@@ -313,5 +313,5 @@
 (provide 'glasses)
 
 
-;;; arch-tag: a3515167-c89e-484f-90a1-d85143e52b12
+;; arch-tag: a3515167-c89e-484f-90a1-d85143e52b12
 ;;; glasses.el ends here
--- a/lisp/progmodes/gud.el	Fri Feb 24 06:32:18 2006 +0000
+++ b/lisp/progmodes/gud.el	Fri Feb 24 08:08:56 2006 +0000
@@ -456,7 +456,8 @@
 	    (while var-list
 	      (let* (char (depth 0) (start 0) (var (car var-list))
 			  (expr (car var)) (varnum (nth 1 var))
-			  (type (nth 3 var)) (status (nth 5 var)))
+			  (type (nth 3 var)) (value (nth 4 var))
+			  (status (nth 5 var)))
 		(put-text-property
 		 0 (length expr) 'face font-lock-variable-name-face expr)
 		(put-text-property
@@ -470,7 +471,7 @@
 			     (string-match "char \\*$" type)))
 		    (speedbar-make-tag-line
 		     'bracket ?? nil nil
-		     (concat expr "\t" (nth 4 var))
+		     (concat expr "\t" value)
 		     (if (or parent (eq status 'out-of-scope))
 			 nil 'gdb-edit-value)
 		     nil
@@ -491,14 +492,12 @@
 		      (speedbar-make-tag-line
 		       'bracket char
 		       'gdb-speedbar-expand-node varnum
-		       (concat expr "\t"
-			       type "\t"
-			       (nth 4 var))
-		       (if (or parent status 'out-of-scope)
+		       (concat expr "\t" type "\t" value)
+		       (if (or parent status)
 			 nil 'gdb-edit-value)
 		       nil
-		       (if (and (or parent status) gdb-show-changed-values)
-			   'shadow t)
+		       (if (and (or parent (eq status 'out-of-scope))
+				gdb-show-changed-values) 'shadow t)
 		       depth)
 		    (speedbar-make-tag-line
 		     'bracket char
--- a/lisp/textmodes/org.el	Fri Feb 24 06:32:18 2006 +0000
+++ b/lisp/textmodes/org.el	Fri Feb 24 08:08:56 2006 +0000
@@ -5,7 +5,7 @@
 ;; Author: Carsten Dominik <dominik at science dot uva dot nl>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://www.astro.uva.nl/~dominik/Tools/org/
-;; Version: 4.04
+;; Version: 4.06
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -81,6 +81,21 @@
 ;;
 ;; Changes since version 4.00:
 ;; ---------------------------
+;; Version 4.06
+;;    - HTML exporter treats targeted internal links.
+;;    - Bug fixes.
+;;
+;; Version 4.05
+;;    - Changes to internal link system (thanks to David Wainberg for ideas).
+;;      - in-file links: [[Search String]] instead of <file:::Search String>
+;;      - automatic links to "radio targets".
+;;      - CamelCase not longer active by default, configure org-activate-camels
+;;        if you want to turn it back on.
+;;      - After following a link, `C-c &' jumps back to it.
+;;    - MH-E link support (thanks to Thomas Baumann).
+;;    - Special table lines are no longer exported.
+;;    - Bug fixes and minor improvements.
+;;
 ;; Version 4.04
 ;;    - Cleanup tags display in agenda.
 ;;    - Bug fixes.
@@ -115,7 +130,7 @@
 
 ;;; Customization variables
 
-(defvar org-version "4.04"
+(defvar org-version "4.06"
   "The version number of the file org.el.")
 (defun org-version ()
   (interactive)
@@ -125,7 +140,7 @@
 ;; versions (Emacs versus XEmacs) and with different versions of outline.el.
 ;; The compatibility code in org.el is based on these two constants.
 (defconst org-xemacs-p (featurep 'xemacs)
-  "Are we running xemacs?")
+  "Are we running XEmacs?")
 (defconst org-noutline-p (featurep 'noutline)
   "Are we using the new outline mode?")
 
@@ -775,7 +790,7 @@
 (defcustom org-level-color-stars-only nil
   "Non-nil means fontify only the stars in each headline.
 When nil, the entire headline is fontified.
-Changing it requires a restart of Emacs to become effective."
+Changing it requires restart of Emacs to become effective."
   :group 'org-structure
   :type 'boolean)
 
@@ -930,6 +945,12 @@
   :group 'org-link
   :type 'boolean)
 
+(defcustom org-mark-ring-length 4
+  "Number of different positions to be recorded in the ring
+Changing this requires a restart of Emacs to work correctly."
+  :group 'org-link
+  :type 'interger)
+
 (defcustom org-link-format "<%s>"
   "Default format for linkes in the buffer.
 This is a format string for printf, %s will be replaced by the link text.
@@ -948,13 +969,27 @@
 When nil, it becomes possible to put several links into a line.
 Note that in tables, a link never extends accross fields, so in a table
 it is always possible to put several links into a line.
-Changing this variable requires a restart of Emacs to become effective."
+Changing this variable requires a restart of Emacs of become effective."
+  :group 'org-link
+  :type 'boolean)
+
+(defcustom org-radio-targets t
+  "Non-nil means activate text matching a link target.
+Radio targets are strings in triple angular brackets, like <<<My Target>>>.
+When this option is set, any occurrence of \"my target\" in normal text
+becomes a link."
+  :group 'org-link
+  :type 'boolean)
+
+(defcustom org-activate-camels nil
+  "Non-nil means, treat words in CamelCase as in-file links.
+Changing this requires restart of Emacs to become effective."
   :group 'org-link
   :type 'boolean)
 
 (defcustom org-context-in-file-links t
   "Non-nil means, file links from `org-store-link' contain context.
-The line number will be added to the file name with :: as separator and
+A search string will be added to the file name with :: as separator and
 used to find the context when the link is activated by the command
 `org-open-at-point'.
 Using a prefix arg to the command \\[org-store-link] (`org-store-link')
@@ -962,6 +997,12 @@
   :group 'org-link
   :type 'boolean)
 
+(defcustom org-file-link-context-use-camel-case nil
+  "Non-nil means, use CamelCase to store a search context in a file link.
+When nil, the search string simply consists of the words of the string."
+  :group 'org-link
+  :type 'boolean)
+
 (defcustom org-keep-stored-link-after-insertion nil
   "Non-nil means, keep link in list for entire session.
 
@@ -1082,13 +1123,15 @@
 `org-file-apps-defaults-gnu'."
   :group 'org-link
   :type '(repeat
-	  (cons (string :tag "Extension")
+	  (cons (choice :value ""
+			(string :tag "Extension")
+			(const :tag "Default for unrecognized files" t)
+			(const :tag "Links to a directory" directory))
 		(choice :value ""
-		 (const :tag "Visit with Emacs" 'emacs)
-		 (const :tag "Use system default" 'default)
-		 (string :tag "Command")
-		 (sexp :tag "Lisp form")))))
-
+			(const :tag "Visit with Emacs" emacs)
+			(const :tag "Use system default" default)
+			(string :tag "Command")
+			(sexp :tag "Lisp form")))))
 
 (defgroup org-remember nil
   "Options concerning interaction with remember.el."
@@ -1508,6 +1551,15 @@
   :group 'org-export
   :type 'boolean)
 
+(defcustom org-export-table-remove-special-lines t
+  "Remove special lines and marking characters in calculating tables.
+This removes the special marking character column from tables that are set
+up for spreadsheet calculations.  It also removes the entire lines
+marked with `!', `_', or `^'.  The lines with `$' are kept, because
+the values of constants may be useful to have."
+  :group 'org-export
+  :type 'boolean)
+
 (defcustom org-export-prefer-native-exporter-for-tables nil
   "Non-nil means, always export tables created with table.el natively.
 Natively means, use the HTML code generator in table.el.
@@ -1599,7 +1651,7 @@
   :type 'boolean)
 
 (defcustom org-export-html-show-new-buffer nil
-  "Non-nil means,  popup buffer containing the exported html text.
+  "Non-nil means, popup buffer containing the exported HTML text.
 Otherwise, the buffer will just be saved to a file and stay hidden."
   :group 'org-export
   :type 'boolean)
@@ -1923,6 +1975,10 @@
   (defvar gnus-group-name)
   (defvar gnus-article-current)
   (defvar w3m-current-url)
+  (defvar mh-progs)
+  (defvar mh-current-folder)
+  (defvar mh-show-folder-buffer)
+  (defvar mh-index-folder)
   (defvar org-selected-point)
   (defvar calendar-mode-map)
   (defvar remember-save-after-remembering)
@@ -1943,8 +1999,8 @@
 ;; an update.
 (defvar org-table-may-need-update t
   "Indicates that a table might need an update.
-This variable is set by `org-before-change-function'. `org-table-align'
-sets it back to nil.")
+This variable is set by `org-before-change-function'.
+`org-table-align'sets it back to nil.")
 (defvar org-mode-hook nil)
 (defvar org-inhibit-startup nil)        ; Dynamically-scoped param.
 (defvar org-agenda-keep-modes nil)      ; Dynamically-scoped param.
@@ -1981,17 +2037,11 @@
        'org-unfontify-region)
   ;; Activate before-change-function
   (set (make-local-variable 'org-table-may-need-update) t)
-  (make-local-hook 'before-change-functions)  ;; needed for XEmacs
-  (add-hook 'before-change-functions 'org-before-change-function nil
-	    'local)
-  ;; FIXME: The following does not work because isearch-mode-end-hook
-  ;; is called *before* the visibility overlays as removed.
-  ;; There should be another hook then for me to be used.
-;;  (make-local-hook 'isearch-mode-end-hook)  ;; needed for XEmacs
-;;  (add-hook 'isearch-mode-end-hook 'org-show-hierarchy-above nil
-;;	    'local)
+  (org-add-hook 'before-change-functions 'org-before-change-function nil
+		'local)
   ;; Paragraphs and auto-filling
   (org-set-autofill-regexps)
+  (org-update-radio-target-regexp)
   ;; Settings for Calc embedded mode
   (set (make-local-variable 'calc-embedded-open-formula) "|\\|\n")
   (set (make-local-variable 'calc-embedded-close-formula) "|\\|\n")
@@ -2053,9 +2103,9 @@
 (defconst org-link-regexp
   (if org-allow-space-in-links
       (concat
-       "\\(https?\\|ftp\\|mailto\\|file\\|news\\|bbdb\\|vm\\|wl\\|rmail\\|gnus\\|shell\\):\\([^" org-non-link-chars "]+[^ " org-non-link-chars "]\\)")
+       "\\(https?\\|ftp\\|mailto\\|file\\|news\\|bbdb\\|vm\\|wl\\|mhe\\|rmail\\|gnus\\|shell\\):\\([^" org-non-link-chars "]+[^ " org-non-link-chars "]\\)")
     (concat
-     "\\(https?\\|ftp\\|mailto\\|file\\|news\\|bbdb\\|vm\\|wl\\|rmail\\|gnus\\|shell\\):\\([^ " org-non-link-chars "]+\\)")
+     "\\(https?\\|ftp\\|mailto\\|file\\|news\\|bbdb\\|vm\\|wl\\|mhe\\|rmail\\|gnus\\|shell\\):\\([^ " org-non-link-chars "]+\\)")
     )
   "Regular expression for matching links.")
 (defconst org-link-maybe-angles-regexp
@@ -2065,6 +2115,10 @@
   (concat "\000" org-link-regexp "\000")
   "Matches a link and optionally surrounding angle brackets.")
 
+(defconst org-bracket-link-regexp
+  "\\[\\[\\([^]]+\\)\\]\\(\\[\\([^]]+\\)\\]\\)?\\]"
+  "Matches a link in double brackets.")
+
 (defconst org-ts-lengths
   (cons (length (format-time-string (car org-time-stamp-formats)))
 	(length (format-time-string (cdr org-time-stamp-formats))))
@@ -2092,6 +2146,15 @@
 				   'keymap org-mouse-map))
 	t)))
 
+(defun org-activate-links2 (limit)
+  "Run through the buffer and add overlays to links."
+  (if (re-search-forward org-bracket-link-regexp limit t)
+      (progn
+	(add-text-properties (match-beginning 0) (match-end 0)
+			     (list 'mouse-face 'highlight
+				   'keymap org-mouse-map))
+	t)))
+
 (defun org-activate-dates (limit)
   "Run through the buffer and add overlays to dates."
   (if (re-search-forward org-tsr-regexp limit t)
@@ -2101,19 +2164,75 @@
 				   'keymap org-mouse-map))
 	t)))
 
+(defvar org-target-link-regexp nil
+  "Regular expression matching radio targets in plain text.")
+(defvar org-target-regexp "<<\\([^<>\n\r]+\\)>>"
+  "Regular expression matching a link target.")
+(defvar org-radio-target-regexp "<<<\\([^<>\n\r]+\\)>>>"
+  "Regular expression matching a link target.")
+
+(defun org-activate-target-links (limit)
+  "Run through the buffer and add overlays to target matches."
+  (when org-radio-targets
+    (let ((case-fold-search t))
+      (if (re-search-forward org-target-link-regexp limit t)
+	  (progn
+	    (add-text-properties (match-beginning 0) (match-end 0)
+				 (list 'mouse-face 'highlight
+				       'keymap org-mouse-map
+				       'org-linked-text t))
+	    t)))))
+
+(defun org-update-radio-target-regexp ()
+  "Find all radio targets in this file and update the regular expression."
+  (interactive)
+  (when org-radio-targets
+    (setq org-target-link-regexp
+	  (org-make-target-link-regexp (org-all-targets 'radio)))
+    (font-lock-mode -1)
+    (font-lock-mode 1)))
+
+(defun org-all-targets (&optional radio)
+  "Return a list of all targets in this file.
+With optional argument RADIO, only find radio targets."
+  (let ((re (if radio org-radio-target-regexp org-target-regexp))
+	rtn)
+    (save-excursion
+      (goto-char (point-min))
+      (while (re-search-forward re nil t)
+	(add-to-list 'rtn (downcase (match-string-no-properties 1))))
+      rtn)))
+
+(defun org-make-target-link-regexp (targets)
+  "Make regular expression matching all strings in TARGETS.
+The regular expression finds the targets also if there is a line break
+between words."
+  (concat
+   "\\<\\("
+   (mapconcat
+    (lambda (x)
+      (while (string-match " +" x)
+	(setq x (replace-match "\\s-+" t t x)))
+      x)
+    targets
+    "\\|")
+   "\\)\\>"))
+
 (defvar org-camel-regexp "\\*?\\<[A-Z]+[a-z]+[A-Z][a-zA-Z]*\\>"
   "Matches CamelCase words, possibly with a star before it.")
+
 (defun org-activate-camels (limit)
   "Run through the buffer and add overlays to dates."
-  (if (re-search-forward org-camel-regexp limit t)
-      (progn
-	(add-text-properties (match-beginning 0) (match-end 0)
-			     (list 'mouse-face 'highlight
-				   'keymap org-mouse-map))
-	t)))
+  (if org-activate-camels
+      (if (re-search-forward org-camel-regexp limit t)
+	  (progn
+	    (add-text-properties (match-beginning 0) (match-end 0)
+				 (list 'mouse-face 'highlight
+				       'keymap org-mouse-map))
+	    t))))
 
 (defun org-activate-tags (limit)
-  (if (re-search-forward "[ \t]\\(:[A-Za-z_:]+:\\)[ \r\n]" limit t)
+  (if (re-search-forward "[ \t]\\(:[A-Za-z_@0-9:]+:\\)[ \r\n]" limit t)
       (progn
 	(add-text-properties (match-beginning 1) (match-end 1)
 			     (list 'mouse-face 'highlight
@@ -2138,6 +2257,8 @@
   (let ((org-font-lock-extra-keywords
 	 (list
 	  '(org-activate-links (0 'org-link t))
+	  '(org-activate-links2 (0 'org-link t))
+	  '(org-activate-target-links (0 'org-link t))
 	  '(org-activate-dates (0 'org-link t))
 	  '(org-activate-camels (0 'org-link t))
 	  '(org-activate-tags (1 'org-link t))
@@ -2199,7 +2320,8 @@
 	 (inhibit-read-only t) (inhibit-point-motion-hooks t)
 	 (inhibit-modification-hooks t)
 	 deactivate-mark buffer-file-name buffer-file-truename)
-    (remove-text-properties beg end '(mouse-face nil keymap nil))))
+    (remove-text-properties beg end
+			    '(mouse-face nil keymap nil org-linked-text nil))))
 
 ;;; Visibility cycling
 
@@ -2433,8 +2555,10 @@
 	  (org-get-location (current-buffer) org-goto-help)))
     (if selected-point
 	(progn
+	  (org-mark-ring-push org-goto-start-pos)
 	  (goto-char selected-point)
-	  (if (org-invisible-p) (org-show-hierarchy-above)))
+	  (if (or (org-invisible-p) (org-invisible-p2))
+	      (org-show-hierarchy-above)))
       (error "Quit"))))
 
 (defun org-get-location (buf help)
@@ -2536,7 +2660,7 @@
 
 (defun org-insert-item ()
   "Insert a new item at the current level.
-Return t when tings worked, nil when we are not in an item."
+Return t when things worked, nil when we are not in an item."
   (when (save-excursion
 	  (condition-case nil
 	      (progn
@@ -3213,7 +3337,7 @@
     (let* ((end (point))
 	   (beg1 (save-excursion
 		   (if (equal (char-before (point)) ?\ ) (backward-char 1))
-		   (skip-chars-backward "a-zA-Z_")
+		   (skip-chars-backward "a-zA-Z_@0-9")
 		   (point)))
 	   (beg (save-excursion
 		  (if (equal (char-before (point)) ?\ ) (backward-char 1))
@@ -3247,7 +3371,11 @@
 		    (save-excursion
 		      (goto-char (point-min))
 		      (while (re-search-forward org-todo-line-regexp nil t)
-			(push (list (org-make-org-heading-camel (match-string 3)))
+			(push (list
+			       (if org-file-link-context-use-camel-case
+				   (org-make-org-heading-camel (match-string 3) t)
+				 (org-make-org-heading-search-string
+				  (match-string 3) t)))
 			      tbl)))
 		    tbl)
 		   (tag (setq type :tag beg beg1)
@@ -3475,9 +3603,8 @@
 	  (setq cnt (1+ cnt))
 	  (org-highlight-new-match (match-beginning 0) (match-end 0))
 	  (org-show-hierarchy-above))))
-    (make-local-hook 'before-change-functions) ; needed for XEmacs
-    (add-hook 'before-change-functions 'org-remove-occur-highlights
-	      nil 'local)
+    (org-add-hook 'before-change-functions 'org-remove-occur-highlights
+		  nil 'local)
     (run-hooks 'org-occur-hook)
     (if (interactive-p)
 	(message "%d match(es) for regexp %s" cnt regexp))
@@ -3488,7 +3615,8 @@
   (catch 'exit
     (if (org-on-heading-p t)
 	(org-flag-heading nil)    ; only show the heading
-      (and (org-invisible-p) (org-show-hidden-entry)))    ; show entire entry
+      (and (or (org-invisible-p) (org-invisible-p2))
+	   (org-show-hidden-entry)))    ; show entire entry
     (save-excursion
       (and org-show-following-heading
 	   (outline-next-heading)
@@ -3765,7 +3893,8 @@
 		  (progn
 		    (use-local-map map)
 		    (setq ans (read-string prompt "" nil nil))
-		    (setq ans (or ans1 ans2 ans)))
+		    (if (not (string-match "\\S-" ans)) (setq ans nil))
+		    (setq ans (or ans1 ans ans2)))
 		(use-local-map old-map)))))
       ;; Naked prompt only
       (setq ans (read-string prompt "" nil timestr)))
@@ -4133,10 +4262,8 @@
   (use-local-map org-agenda-mode-map)
   (easy-menu-add org-agenda-menu)
   (if org-startup-truncated (setq truncate-lines t))
-  (make-local-hook 'post-command-hook)  ; Needed for XEmacs
-  (add-hook 'post-command-hook 'org-agenda-post-command-hook nil 'local)
-  (make-local-hook 'pre-command-hook)  ; Needed for XEmacs
-  (add-hook 'pre-command-hook 'org-unhighlight nil 'local)
+  (org-add-hook 'post-command-hook 'org-agenda-post-command-hook nil 'local)
+  (org-add-hook 'pre-command-hook 'org-unhighlight nil 'local)
   (unless org-agenda-keep-modes
     (setq org-agenda-follow-mode nil
 	  org-agenda-show-log nil))
@@ -5285,27 +5412,6 @@
 	     (throw 'exit t)))
       nil)))
 
-(defun org-get-tags-at (&optional pos)
-  "Get a list of all headline targs applicable at POS.
-POS defaults to point.  If tags are inherited, the list contains
-the targets in the same sequence as the headlines appear, i.e.
-the tags of the current headline come last."
-  (interactive)
-  (let (tags)
-    (save-excursion
-      (goto-char (or pos (point)))
-      (save-match-data
-	(org-back-to-heading t)
-	(condition-case nil
-	    (while t
-	      (if (looking-at "[^\r\n]+?:\\([a-zA-Z_:]+\\):[ \t]*\\([\n\r]\\|\\'\\)")
-		  (setq tags (append (org-split-string (match-string 1) ":") tags)))
-	      (or org-use-tag-inheritance (error ""))
-	      (org-up-heading-all 1))
-	  (error nil))))
-    (message "%s" tags)
-    tags))
-
 (defun org-agenda-get-todos ()
   "Return the TODO information for agenda display."
   (let* ((props (list 'face nil
@@ -5726,7 +5832,7 @@
       (when (and (or (eq org-agenda-remove-tags-when-in-prefix t)
 		     (and org-agenda-remove-tags-when-in-prefix
 			  org-prefix-has-tag))
-		 (string-match ":[a-zA-Z_:]+:[ \t]*$" txt))
+		 (string-match ":[a-zA-Z_@0-9:]+:[ \t]*$" txt))
 	(setq txt (replace-match "" t t txt)))
 
       ;; Create the final string
@@ -6076,6 +6182,27 @@
     (org-agenda-change-all-lines newhead hdmarker)
     (beginning-of-line 1)))
 
+(defun org-get-tags-at (&optional pos)
+  "Get a list of all headline targs applicable at POS.
+POS defaults to point.  If tags are inherited, the list contains
+the targets in the same sequence as the headlines appear, i.e.
+the tags of the current headline come last."
+  (interactive)
+  (let (tags)
+    (save-excursion
+      (goto-char (or pos (point)))
+      (save-match-data
+	(org-back-to-heading t)
+	(condition-case nil
+	    (while t
+	      (if (looking-at "[^\r\n]+?:\\([a-zA-Z_@0-9:]+\\):[ \t]*\\([\n\r]\\|\\'\\)")
+		  (setq tags (append (org-split-string (match-string 1) ":") tags)))
+	      (or org-use-tag-inheritance (error ""))
+	      (org-up-heading-all 1))
+	  (error nil))))
+    (message "%s" tags)
+    tags))
+
 (defun org-agenda-set-tags ()
   "Set tags for the current headline."
   (interactive)
@@ -6298,7 +6425,7 @@
 		     (mapconcat 'regexp-quote
 				(nreverse (cdr (reverse org-todo-keywords)))
 				"\\|")
-		     "\\>\\)\\)? *\\(.*?\\)\\(:[A-Za-z_:]+:\\)?[ \t]*[\n\r]"))
+		     "\\>\\)\\)? *\\(.*?\\)\\(:[A-Za-z_@0-9:]+:\\)?[ \t]*[\n\r]"))
 	 (props (list 'face nil
 		      'done-face 'org-done
 		      'undone-face nil
@@ -6386,7 +6513,7 @@
   (let ((match0 match) minus tag mm matcher orterms term orlist)
     (setq orterms (org-split-string match "|"))
     (while (setq term (pop orterms))
-      (while (string-match "^&?\\([-+:]\\)?\\([A-Za-z_]+\\)" term)
+      (while (string-match "^&?\\([-+:]\\)?\\([A-Za-z_@0-9]+\\)" term)
 	(setq minus (and (match-end 1)
 			 (equal (match-string 1 term) "-"))
 	      tag (match-string 2 term)
@@ -6481,7 +6608,7 @@
 	 (re (concat "^" outline-regexp))
 	 (col (current-column))
 	 (current (org-get-tags))
-	 tags hd empty)
+	 tags hd empty invis)
     (if arg
 	(save-excursion
 	  (goto-char (point-min))
@@ -6505,19 +6632,23 @@
       (if (equal current "")
 	  (progn
 	    (end-of-line 1)
-	    (or empty (insert " ")))
+	    (or empty (insert-before-markers " ")))
 	(beginning-of-line 1)
+	(setq invis (org-invisible-p))
 	(looking-at (concat "\\(.*\\)\\(" (regexp-quote current) "\\)[ \t]*"))
 	(setq hd (match-string 1))
 	(delete-region (match-beginning 0) (match-end 0))
-	(insert (org-trim hd) (if empty "" " ")))
+	(insert-before-markers (org-trim hd) (if empty "" " ")))
+      ;; FIXME:  What happens when adding a new tag???  Seems OK!!!
       (unless (equal tags "")
 	(move-to-column (max (current-column)
 			     (if (> org-tags-column 0)
 				 org-tags-column
 			       (- (- org-tags-column) (length tags))))
 			t)
-	(insert tags))
+	(insert-before-markers tags)
+	(if (and (not invis) (org-invisible-p))
+	    (outline-flag-region (point-at-bol) (point) nil)))
       (move-to-column col))))
 
 (defun org-tags-completion-function (string predicate &optional flag)
@@ -6551,7 +6682,7 @@
     (error "Not on a heading"))
   (save-excursion
     (beginning-of-line 1)
-    (if (looking-at ".*[ \t]\\(:[A-Za-z_:]+:\\)[ \t]*\\(\r\\|$\\)")
+    (if (looking-at ".*[ \t]\\(:[A-Za-z_@0-9:]+:\\)[ \t]*\\(\r\\|$\\)")
 	(match-string 1)
       "")))
 
@@ -6560,7 +6691,7 @@
   (let (tags)
     (save-excursion
       (goto-char (point-min))
-      (while (re-search-forward "[ \t]:\\([A-Za-z_:]+\\):[ \t\r\n]" nil t)
+      (while (re-search-forward "[ \t]:\\([A-Za-z_@0-9:]+\\):[ \t\r\n]" nil t)
 	(mapc (lambda (x) (add-to-list 'tags x))
 	      (org-split-string (match-string 1) ":"))))
     (mapcar 'list tags)))
@@ -6591,9 +6722,34 @@
       (org-agenda-list nil (time-to-days (org-time-string-to-time
 					  (substring (match-string 1) 0 10)))
 		       1)
-    (let (type path line search (pos (point)))
+    (let (type path link line search (pos (point)))
       (catch 'match
 	(save-excursion
+	  (skip-chars-forward "^]\n\r")
+	  (when (and (re-search-backward "\\[\\[" nil t)
+		     (looking-at org-bracket-link-regexp)
+		     (<= (match-beginning 0) pos)
+		     (>= (match-end 0) pos))
+	    (setq link (match-string 1))
+	    (while (string-match " *\n *" link)
+	      (setq link (replace-match " " t t link)))
+	    (if (string-match org-link-regexp link)
+		(setq type (match-string 1)
+		      path (match-string 2))
+	      (setq type "thisfile"
+		    path link))
+	    (throw 'match t)))
+
+	(when (get-text-property (point) 'org-linked-text)
+	  (setq type "thisfile"
+		pos (if (get-text-property (1+ (point)) 'org-linked-text)
+			(1+ (point)) (point))
+		path (buffer-substring
+		      (previous-single-property-change pos 'org-linked-text)
+		      (next-single-property-change pos 'org-linked-text)))
+	  (throw 'match t))
+
+	(save-excursion
 	  (skip-chars-backward
 	   (concat (if org-allow-space-in-links "^" "^ ")
 		   org-non-link-chars))
@@ -6606,7 +6762,7 @@
 	    (throw 'match t)))
 	(save-excursion
 	  (skip-chars-backward "^ \t\n\r")
-	  (when (looking-at "\\(:[A-Za-z_:]+\\):[ \t\r\n]")
+	  (when (looking-at "\\(:[A-Za-z_@0-9:]+\\):[ \t\r\n]")
 	    (setq type "tags"
 		  path (match-string 1))
 	    (while (string-match ":" path)
@@ -6614,7 +6770,8 @@
 	    (throw 'match t)))
 	(save-excursion
 	  (skip-chars-backward "a-zA-Z_")
-	  (when (looking-at org-camel-regexp)
+	  (when (and org-activate-camels
+		     (looking-at org-camel-regexp))
 	    (setq type "camel" path (match-string 0))
 	    (if (equal (char-before) ?*)
 		(setq path (concat "*" path))))
@@ -6639,7 +6796,9 @@
 
        ((string= type "tags")
 	(org-tags-view in-emacs path))
-       ((string= type "camel")
+       ((or (string= type "camel")
+	    (string= type "thisfile"))
+	(org-mark-ring-push)
 	(org-link-search
 	 path
 	 (cond ((equal in-emacs '(4)) 'occur)
@@ -6686,6 +6845,14 @@
 		article (match-string 3 path))
 	  (org-follow-wl-link folder article)))
 
+       ((string= type "mhe")
+	(let (folder article)
+	  (if (not (string-match "\\`\\([^#]+\\)\\(#\\(.*\\)\\)?" path))
+	      (error "Error in MHE link"))
+	  (setq folder (match-string 1 path)
+		article (match-string 3 path))
+	  (org-follow-mhe-link folder article)))
+
        ((string= type "rmail")
 	(let (folder article)
 	  (if (not (string-match "\\`\\([^#]+\\)\\(#\\(.*\\)\\)?" path))
@@ -6717,11 +6884,19 @@
 If the current buffer is in `dired-mode', grep will be used to search
 in all files."
   (let ((case-fold-search t)
-	(s0 s)
+	(s0 (mapconcat 'identity (org-split-string s "[ \t\r\n]+") " "))
 	(pos (point))
 	(pre "") (post "")
-	words re0 re1 re2 re3 re4 re5 reall)
-    (cond ((string-match "^/\\(.*\\)/$" s)
+	words re0 re1 re2 re3 re4 re5 reall camel)
+    (cond ((save-excursion
+	     (goto-char (point-min))
+	     (and
+	      (re-search-forward
+	       (concat "<<" (regexp-quote s0) ">>") nil t)
+	      (setq pos (match-beginning 0))))
+	   ;; There is an exact target for this
+	   (goto-char pos))
+	  ((string-match "^/\\(.*\\)/$" s)
 	   ;; A regular expression
 	   (cond
 	    ((eq major-mode 'org-mode)
@@ -6729,17 +6904,22 @@
 	    ;;((eq major-mode 'dired-mode)
 	    ;; (grep (concat "grep -n -e '" (match-string 1 s) "' *")))
 	    (t (org-do-occur (match-string 1 s)))))
-	  ((string-match (concat "^" org-camel-regexp) s)
-	   ;; A camel
-	   (if (equal (string-to-char s) ?*)
-	       (setq pre "^\\*+[ \t]*\\(\\sw+\\)?[ \t]*"
-		     post "[ \t]*$"
-		     s (substring s 1)))
+	  ((or (setq camel (string-match (concat "^" org-camel-regexp "$") s))
+	       t)
+	   ;; A camel or a normal search string
+	   (when (equal (string-to-char s) ?*)
+	     ;; Anchor on headlines, post may include tags.
+	     (setq pre "^\\*+[ \t]*\\(\\sw+\\)?[ \t]*"
+		   post "[ \t]*\\([ \t]+:[a-zA-Z_@0-9:+]:[ \t]*\\)?$"
+		   s (substring s 1)))
 	   (remove-text-properties
 	    0 (length s)
 	    '(face nil mouse-face nil keymap nil fontified nil) s)
 	   ;; Make a series of regular expressions to find a match
-	   (setq words (org-camel-to-words s)
+	   (setq words
+		 (if camel
+		     (org-camel-to-words s)
+		   (org-split-string s "[ \n\r\t]+"))
 		 re0 (concat "<<" (regexp-quote s0) ">>")
 		 re2 (concat "\\<" (mapconcat 'downcase words "[ \t]+") "\\>")
 		 re4 (concat "\\<" (mapconcat 'downcase words "[^a-zA-Z_\r\n]+") "\\>")
@@ -6770,7 +6950,8 @@
 	   (goto-char (point-min))
 	   (if (search-forward s nil t)
 	       (goto-char (match-beginning 0))
-	     (error "No match"))))))
+	     (error "No match"))))
+    (and (eq major-mode 'org-mode) (org-show-hierarchy-above))))
 
 (defun org-do-occur (regexp &optional cleanup)
   "Call the Emacs command `occur'.
@@ -6791,6 +6972,47 @@
       (goto-char (point-min))
       (select-window cwin))))
 
+(defvar org-mark-ring nil
+  "Mark ring for positions before jumps in Org-mode.")
+(defvar org-mark-ring-last-goto nil
+  "Last position in the mark ring used to go back.")
+;; Fill and close the ring
+(setq org-mark-ring nil org-mark-ring-last-goto nil) ;; in case file is reloaded
+(loop for i from 1 to org-mark-ring-length do
+      (push (make-marker) org-mark-ring))
+(setcdr (nthcdr (1- org-mark-ring-length) org-mark-ring)
+	org-mark-ring)
+
+(defun org-mark-ring-push (&optional pos buffer)
+  "Put the current position or POS into the mark ring and rotate it."
+  (interactive)
+  (setq pos (or pos (point)))
+  (setq org-mark-ring (nthcdr (1- org-mark-ring-length) org-mark-ring))
+  (move-marker (car org-mark-ring)
+	       (or pos (point))
+	       (or buffer (current-buffer)))
+  (message
+   (substitute-command-keys
+    "Position saved to mark ring, go back with \\[org-mark-ring-goto].")))
+
+(defun org-mark-ring-goto (&optional n)
+  "Jump to the previous position in the mark ring.
+With prefix arg N, jump back that many stored positions.  When
+called several times in succession, walk through the entire ring.
+Org-mode commands jumping to a different position in the current file,
+or to another Org-mode file, automatically push the old position
+onto the ring."
+  (interactive "p")
+  (let (p m)
+    (if (eq last-command this-command)
+	(setq p (nthcdr n (or org-mark-ring-last-goto org-mark-ring)))
+      (setq p org-mark-ring))
+    (setq org-mark-ring-last-goto p)
+    (setq m (car p))
+    (switch-to-buffer (marker-buffer m))
+    (goto-char m)
+    (if (or (org-invisible-p) (org-invisible-p2)) (org-show-hierarchy-above))))
+
 (defun org-camel-to-words (s)
   "Split \"CamelCaseWords\" to (\"Camel\" \"Case\" \"Words\")."
   (let ((case-fold-search nil)
@@ -6800,10 +7022,20 @@
       (setq s (substring s (1+ (match-beginning 0)))))
     (nreverse (cons s words))))
 
+(defun org-remove-angle-brackets (s)
+  (if (equal (substring s 0 1) "<") (setq s (substring s 1)))
+  (if (equal (substring s -1) ">") (setq s (substring s 0 -1)))
+  s)
+(defun org-add-angle-brackets (s)
+  (if (equal (substring s 0 1) "<") nil (setq s (concat "<" s)))
+  (if (equal (substring s -1) ">") nil (setq s (concat s ">")))
+  s)
+
 (defun org-follow-bbdb-link (name)
   "Follow a BBDB link to NAME."
   (require 'bbdb)
-  (let ((inhibit-redisplay t))
+  (let ((inhibit-redisplay t)
+	(bbdb-electric-p nil))
     (catch 'exit
       ;; Exact match on name
       (bbdb-name (concat "\\`" name "\\'") nil)
@@ -6839,6 +7071,7 @@
 (defun org-follow-vm-link (&optional folder article readonly)
   "Follow a VM link to FOLDER and ARTICLE."
   (require 'vm)
+  (setq article (org-add-angle-brackets article))
   (if (string-match "^//\\([a-zA-Z]+@\\)?\\([^:]+\\):\\(.*\\)" folder)
       ;; ange-ftp or efs or tramp access
       (let ((user (or (match-string 1 folder) (user-login-name)))
@@ -6872,12 +7105,14 @@
 
 (defun org-follow-wl-link (folder article)
   "Follow a Wanderlust link to FOLDER and ARTICLE."
+  (setq article (org-add-angle-brackets article))
   (wl-summary-goto-folder-subr folder 'no-sync t nil t)
-  (if article (wl-summary-jump-to-msg-by-message-id article))
+  (if article (wl-summary-jump-to-msg-by-message-id article ">"))
   (wl-summary-redisplay))
 
 (defun org-follow-rmail-link (folder article)
   "Follow an RMAIL link to FOLDER and ARTICLE."
+  (setq article (org-add-angle-brackets article))
   (let (message-number)
     (save-excursion
       (save-window-excursion
@@ -6898,6 +7133,106 @@
 	  message-number)
       (error "Message not found"))))
 
+;; mh-e integration based on planner-mode
+(defun org-mhe-get-message-real-folder ()
+  "Return the name of the current message real folder, so if you use
+sequences, it will now work."
+  (save-excursion
+    (let* ((folder
+            (if (equal major-mode 'mh-folder-mode)
+                mh-current-folder
+              ;; Refer to the show buffer
+              mh-show-folder-buffer))
+           (end-index
+            (if (boundp 'mh-index-folder)
+                (min (length mh-index-folder) (length folder))))
+           )
+      ;; a simple test on mh-index-data does not work, because
+      ;; mh-index-data is always nil in a show buffer.
+      (if (and (boundp 'mh-index-folder)
+               (string= mh-index-folder (substring folder 0 end-index)))
+          (if (equal major-mode 'mh-show-mode)
+              (save-window-excursion
+                (when (buffer-live-p (get-buffer folder))
+                  (progn
+                    (pop-to-buffer folder)
+                    (org-mhe-get-message-folder-from-index)
+                    )
+                  ))
+            (org-mhe-get-message-folder-from-index)
+            )
+        folder
+        )
+      )))
+
+(defun org-mhe-get-message-folder-from-index ()
+  "Returns the name of the message folder in a index folder buffer."
+  (save-excursion
+    (mh-index-previous-folder)
+    (if (not (re-search-forward "^\\(+.*\\)$" nil t))
+        (message "Problem getting folder from index.")
+      (message (match-string 1)))))
+
+(defun org-mhe-get-message-folder ()
+  "Return the name of the current message folder.  Be careful if you
+use sequences."
+  (save-excursion
+    (if (equal major-mode 'mh-folder-mode)
+        mh-current-folder
+      ;; Refer to the show buffer
+      mh-show-folder-buffer)))
+
+(defun org-mhe-get-message-num ()
+  "Return the number of the current message.  Be careful if you
+use sequences."
+  (save-excursion
+    (if (equal major-mode 'mh-folder-mode)
+        (mh-get-msg-num nil)
+      ;; Refer to the show buffer
+      (mh-show-buffer-message-number))))
+
+(defun org-mhe-get-header (header)
+  "Return a header of the message in folder mode.  This will create a
+show buffer for the corresponding message.  If you have a more clever
+idea..."
+  (let* ((folder (org-mhe-get-message-folder))
+         (num (org-mhe-get-message-num))
+         (buffer (get-buffer-create (concat "show-" folder)))
+         (header-field))
+  (with-current-buffer buffer
+    (mh-display-msg num folder)
+    (if (equal major-mode 'mh-folder-mode)
+        (mh-header-display)
+      (mh-show-header-display))
+    (set-buffer buffer)
+    (setq header-field (mh-get-header-field header))
+    (if (equal major-mode 'mh-folder-mode)
+        (mh-show)
+      (mh-show-show))
+    header-field)))
+
+(defun org-follow-mhe-link (folder article)
+  "Follow an MHE link to FOLDER and ARTICLE."
+  (setq article (org-add-angle-brackets article))
+  (require 'mh-e)
+  (mh-find-path)
+  (let* ((show-buf (concat "show-" folder)))
+    (mh-visit-folder folder)
+    (get-buffer-create show-buf)
+    (mh-show-msg
+     (string-to-number
+      (car (split-string
+	    (with-temp-buffer
+	      (call-process
+	       (expand-file-name "pick" mh-progs)
+	       nil t nil
+	       folder
+	       "--message-id"
+	       article)
+	      (buffer-string))
+	    "\n"))))
+    (pop-to-buffer show-buf)))
+
 (defun org-open-file (path &optional in-emacs line search)
   "Open the file at PATH.
 First, this expands any special file name abbreviations.  Then the
@@ -6913,7 +7248,11 @@
   (let* ((file (if (equal path "")
 		   (buffer-file-name)
 		 (convert-standard-filename (org-expand-file-name path))))
+	 (dirp (file-directory-p file))
 	 (dfile (downcase file))
+	 (old-buffer (current-buffer))
+	 (old-pos (point))
+	 (old-mode major-mode)
 	 ext cmd apps)
     (if (and (not (file-exists-p file))
 	     (not org-open-non-existing-files))
@@ -6925,7 +7264,8 @@
     (setq apps (append org-file-apps (org-default-apps)))
     (if in-emacs
 	(setq cmd 'emacs)
-      (setq cmd (or (cdr (assoc ext apps))
+      (setq cmd (or (and dirp (cdr (assoc 'directory apps)))
+		    (cdr (assoc ext apps))
 		    (cdr (assoc t apps)))))
     (when (eq cmd 'mailcap)
       (require 'mailcap)
@@ -6948,7 +7288,11 @@
 	(if search (org-link-search search))))
      ((consp cmd)
       (eval cmd))
-     (t (funcall (cdr (assq 'file org-link-frame-setup)) file)))))
+     (t (funcall (cdr (assq 'file org-link-frame-setup)) file)))
+    (and (eq major-mode 'org-mode) (eq old-mode 'org-mode)
+	 (or (not (equal old-buffer (current-buffer)))
+	     (not (equal old-pos (point))))
+	 (org-mark-ring-push old-pos old-buffer))))
 
 (defun org-default-apps ()
   "Return the default applications for this operating system."
@@ -6979,7 +7323,7 @@
 For links to usenet articles, arg negates `org-usenet-links-prefer-google'.
 For file links, arg negates `org-context-in-file-links'."
   (interactive "P")
-  (let (link cpltxt)
+  (let (link cpltxt txt (pos (point)))
     (cond
 
      ((eq major-mode 'bbdb-mode)
@@ -7009,6 +7353,7 @@
 	      (subject (vm-su-subject message))
 	      (author (vm-su-full-name message))
 	      (message-id (vm-su-message-id message)))
+	 (setq message-id (org-remove-angle-brackets message-id))
 	 (setq folder (abbreviate-file-name folder))
 	 (if (string-match (concat "^" (regexp-quote vm-folder-directory))
 			   folder)
@@ -7026,12 +7371,25 @@
 				 msgnum (wl-summary-buffer-msgdb)))
 	     (author (wl-summary-line-from)) ; FIXME: how to get author name?
 	     (subject "???"))   ; FIXME: How to get subject of email?
+	(setq message-id (org-remove-angle-brackets message-id))
 	(setq cpltxt (concat author  " on: " subject))
 	(setq link (concat cpltxt "\n  "
 			   (org-make-link
 			    "wl:" wl-summary-buffer-folder-name
 			   "#" message-id)))))
 
+     ((or (equal major-mode 'mh-folder-mode)
+	  (equal major-mode 'mh-show-mode))
+      (let ((from-header (org-mhe-get-header "From:"))
+	    (to-header (org-mhe-get-header "To:"))
+	    (subject (org-mhe-get-header "Subject:")))
+	(setq cpltxt (concat from-header " on: " subject))
+	(setq link (concat cpltxt "\n  "
+			   (org-make-link
+			    "mhe:" (org-mhe-get-message-real-folder) "#"
+			    (org-remove-angle-brackets
+			     (org-mhe-get-header "Message-Id:")))))))
+
      ((eq major-mode 'rmail-mode)
       (save-excursion
 	(save-restriction
@@ -7040,6 +7398,7 @@
 		(message-id (mail-fetch-field "message-id"))
 		(author (mail-fetch-field "from"))
 		(subject (mail-fetch-field "subject")))
+	    (setq message-id (org-remove-angle-brackets message-id))
 	    (setq cpltxt (concat author  " on: " subject))
 	    (setq link (concat cpltxt "\n  "
 			       (org-make-link
@@ -7093,19 +7452,26 @@
 			   (abbreviate-file-name (buffer-file-name))))
       ;; Add a context search string
       (when (org-xor org-context-in-file-links arg)
+	;; Check if we are on a target
 	(if (save-excursion
-	      (skip-chars-backward "a-zA-Z<")
-	      (looking-at (concat "<<\\(" org-camel-regexp "\\)>>")))
+	      (skip-chars-forward "^>\n\r")
+	      (and (re-search-backward "<<" nil t)
+		   (looking-at "<<\\(.*?\\)>>")
+		   (<= (match-beginning 0) pos)
+		   (>= (match-end 0) pos)))
 	    (setq cpltxt (concat cpltxt "::" (match-string 1)))
+	  (setq txt (cond
+		     ((org-on-heading-p) nil)
+		     ((org-region-active-p)
+		      (buffer-substring (region-beginning) (region-end)))
+		     (t (buffer-substring (point-at-bol) (point-at-eol)))))
 	  (setq cpltxt
 		(concat cpltxt "::"
-			(org-make-org-heading-camel
-			 (cond
-			  ((org-on-heading-p) nil)
-			  ((org-region-active-p)
-			   (buffer-substring (region-beginning) (region-end)))
-			  (t (buffer-substring (point-at-bol) (point-at-eol))))
-			 )))))
+			(if org-file-link-context-use-camel-case
+			    (org-make-org-heading-camel txt)
+			  (org-make-org-heading-search-string txt))))))
+      (if (string-match "::\\'" cpltxt)
+	  (setq cpltxt (substring cpltxt 0 -2)))
       (setq link (org-make-link cpltxt)))
 
      ((buffer-file-name)
@@ -7114,12 +7480,14 @@
 			   (abbreviate-file-name (buffer-file-name))))
       ;; Add a context string
       (when (org-xor org-context-in-file-links arg)
+	(setq txt (if (org-region-active-p)
+		      (buffer-substring (region-beginning) (region-end))
+		    (buffer-substring (point-at-bol) (point-at-eol))))
 	(setq cpltxt
 	      (concat cpltxt "::"
-		      (org-make-org-heading-camel
-		       (if (org-region-active-p)
-			   (buffer-substring (region-beginning) (region-end))
-			 (buffer-substring (point-at-bol) (point-at-eol)))))))
+		      (if org-file-link-context-use-camel-case
+			  (org-make-org-heading-camel txt)
+			(org-make-org-heading-search-string txt)))))
       (setq link (org-make-link cpltxt)))
 
      ((interactive-p)
@@ -7134,14 +7502,37 @@
 	  (message "Stored: %s" (or cpltxt link)))
       link)))
 
-(defun org-make-org-heading-camel (&optional string)
-  "Make a CamelCase string for S or the current headline."
+(defun org-make-org-heading-search-string (&optional string heading)
+  "Make search string for STRING or current headline."
   (interactive)
   (let ((s (or string (org-get-heading))))
-    (unless string
+    (unless (and string (not heading))
       ;; We are using a headline, clean up garbage in there.
       (if (string-match org-todo-regexp s)
 	  (setq s (replace-match "" t t s)))
+      (if (string-match ":[a-zA-Z_@0-9:]+:[ \t]*$" s)
+	  (setq s (replace-match "" t t s)))
+      (setq s (org-trim s))
+      (if (string-match (concat "^\\(" org-quote-string "\\|"
+				org-comment-string "\\)") s)
+	  (setq s (replace-match "" t t s)))
+      (while (string-match org-ts-regexp s)
+	(setq s (replace-match "" t t s))))
+    (while (string-match "[^a-zA-Z_0-9 \t]+" s)
+      (setq s (replace-match " " t t s)))
+    (or string (setq s (concat "*" s)))  ; Add * for headlines
+    (mapconcat 'identity (org-split-string s "[ \t]+") " ")))
+
+(defun org-make-org-heading-camel (&optional string heading)
+  "Make a CamelCase string for STRING or the current headline."
+  (interactive)
+  (let ((s (or string (org-get-heading))))
+    (unless (and string (not heading))
+      ;; We are using a headline, clean up garbage in there.
+      (if (string-match org-todo-regexp s)
+	  (setq s (replace-match "" t t s)))
+      (if (string-match ":[a-zA-Z_@0-9:]+:[ \t]*$" s)
+	  (setq s (replace-match "" t t s)))
       (setq s (org-trim s))
       (if (string-match (concat "^\\(" org-quote-string "\\|"
 				org-comment-string "\\)") s)
@@ -7157,6 +7548,12 @@
   "Concatenate STRINGS, format resulting string with `org-link-format'."
   (format org-link-format (apply 'concat strings)))
 
+(defun org-make-link2 (link &optional description)
+  "Make a link with brackets."
+  (concat "[[" link "]"
+	  (if description (concat "[" description "]") "")
+	  "]"))
+
 (defun org-xor (a b)
   "Exclusive or."
   (if a (not b) b))
@@ -7245,15 +7642,18 @@
 	(let* ((path (match-string 1 link))
 	       (case-fold-search nil)
 	       (search (match-string 2 link)))
-	    (when (save-match-data
-		    (equal (file-truename (buffer-file-name))
-			   (file-truename path)))
-	      (if (save-match-data
-		    (string-match (concat "^" org-camel-regexp "$") search))
-		  (setq link (replace-match search t t link)
-			matched t)
-		(setq link (replace-match (concat "<file:::" search ">")
-					  t t link))))))
+	  (when (save-match-data
+		  (equal (file-truename (buffer-file-name))
+			 (file-truename path)))
+	    ;; We are linking to this same file
+	    (if (and org-file-link-context-use-camel-case
+		     (save-match-data
+		       (string-match (concat "^" org-camel-regexp "$") search)))
+		(setq link (replace-match search t t link)
+		      matched t)
+	      (setq link (replace-match (concat "[[" search "]]")
+					t t link)
+		    matched t)))))
       (let ((lines (org-split-string link "\n")))
 	(insert (car lines))
 	(setq matched (or matched (string-match org-link-regexp (car lines))))
@@ -8241,8 +8641,8 @@
 mark should be in the column that is used for sorting.  For example, to
 sort according to column 3, put the mark in the first line to sort, in
 table column 3.  Put point into the last line to be included in the sorting,
-also in table column 3. The command will prompt for the sorting method (n for
-numerical, a for alphanumeric)."
+also in table column 3.  The command will prompt for the sorting method
+\(n for numerical, a for alphanumeric)."
   (interactive "r\nsSorting method: [n]=numeric [a]=alpha: ")
   (setq numericp (string-match "[nN]" numericp))
   (org-table-align) ;; Just to be safe
@@ -9081,8 +9481,8 @@
 	    (if (= c ?p) (setq modes (org-set-calc-mode 'calc-internal-prec n))
 	      (setq modes (org-set-calc-mode
 			   'calc-float-format
-			   (list (cdr (assoc c '((?n. float) (?f. fix)
-						 (?s. sci) (?e. eng))))
+			   (list (cdr (assoc c '((?n . float) (?f . fix)
+						 (?s . sci) (?e . eng))))
 				 n))))
 	    (setq fmt (replace-match "" t t fmt)))
 	  (while (string-match "[DRFS]" fmt)
@@ -9467,9 +9867,8 @@
 	    (and c (setq minor-mode-map-alist
 			 (cons c (delq c minor-mode-map-alist)))))
 	  (set (make-local-variable (quote org-table-may-need-update)) t)
-	  (make-local-hook (quote before-change-functions)) ; needed for XEmacs
-	  (add-hook 'before-change-functions 'org-before-change-function
-		    nil 'local)
+	  (org-add-hook 'before-change-functions 'org-before-change-function
+			nil 'local)
 	  (set (make-local-variable 'org-old-auto-fill-inhibit-regexp)
 	       auto-fill-inhibit-regexp)
 	  (set (make-local-variable 'auto-fill-inhibit-regexp)
@@ -9734,6 +10133,10 @@
        ((string-match "^#" line)
 	;; an ordinary comment line
 	)
+       ((and org-export-table-remove-special-lines
+	     (string-match "^[ \t]*| *[!_^] *|" line))
+	;; a special table line that should be removed
+	)
        (t (setq rtn (cons line rtn)))))
     (nreverse rtn)))
 
@@ -10040,6 +10443,45 @@
 It is supplemented by a number of commonly used TeX macros with appropriate
 translations.  There is currently no way for users to extend this.")
 
+(defun org-cleaned-string-for-export (string)
+  "Cleanup a buffer substring so that links can be created safely."
+  (interactive)
+  (let* ((cb (current-buffer))
+	 (re-radio (concat "\\([^<]\\)\\(" org-target-link-regexp "\\)"))
+	 rtn)
+    (save-excursion
+      (set-buffer (get-buffer-create " org-mode-tmp"))
+      (erase-buffer)
+      (insert string)
+      (org-mode)
+      ;; Find targets in comments and move them out of comments
+      (goto-char (point-min))
+      (while (re-search-forward "^#.*?\\(<<<?[^>\r\n]+>>>?\\).*" nil t)
+	(replace-match "\\1"))
+      ;; Find matches for radio targets and turn them into links
+      (goto-char (point-min))
+      (while (re-search-forward re-radio nil t)
+	(replace-match "\\1[[\\2]]"))
+      ;; Find all links that contain a newline and put them into a single line
+      (goto-char (point-min))
+      (while (re-search-forward "\\(\\[\\[[^]]*?\\)[ \t]*\n[ \t]*\\([^]]*\\]\\]\\)" nil t)
+	(replace-match "\\1 \\2")
+	(goto-char (match-beginning 0)))
+      ;; Remove comments
+      (goto-char (point-min))
+      (while (re-search-forward "^#.*\n?" nil t)
+	(replace-match ""))
+      (setq rtn (buffer-string)))
+    (kill-buffer " org-mode-tmp")
+    rtn))
+
+(defun org-solidify-link-text (s)
+  "Take link text and make a safe target out of it."
+  (save-match-data
+    (mapconcat
+     'identity
+     (org-split-string s "[ \t\r\n]+") "--")))
+
 (defvar org-last-level nil) ; dynamically scoped variable
 
 (defun org-export-as-ascii (arg)
@@ -10054,7 +10496,10 @@
 	   (if (org-region-active-p) (region-beginning) (point-min))
 	   (if (org-region-active-p) (region-end) (point-max))))
 	 (lines (org-export-find-first-heading-line
-		 (org-skip-comments (org-split-string region "[\r\n]"))))
+		 (org-skip-comments
+		  (org-split-string
+		   (org-cleaned-string-for-export region)
+		   "[\r\n]"))))
 	 (org-startup-with-deadline-check nil)
 	 (level 0) line txt
 	 (umax nil)
@@ -10143,6 +10588,14 @@
     (while (setq line (pop lines))
       ;; Remove the quoted HTML tags.
       (setq line (org-html-expand-for-ascii line))
+      ;; Remove targets
+      (while (string-match "<<<?[^<>]*>>>?[ \t]*\n?" line)
+	(setq line (replace-match "" t t line)))
+      ;; Replace internal links
+      (while (string-match org-bracket-link-regexp line)
+	(setq line (replace-match
+		    (if (match-end 3) "[\\3]" "[\\1]")
+		    t nil line)))
       (cond
        ((string-match "^\\(\\*+\\)[ \t]*\\(.*\\)" line)
 	;; a Headline
@@ -10381,7 +10834,9 @@
            (if region-p (region-beginning) (point-min))
            (if region-p (region-end) (point-max))))
          (all_lines
-          (org-skip-comments (org-split-string region "[\r\n]")))
+          (org-skip-comments (org-split-string
+			      (org-cleaned-string-for-export region)
+			      "[\r\n]")))
          (lines (org-export-find-first-heading-line all_lines))
          (level 0) (line "") (origline "") txt todo
          (umax nil)
@@ -10544,7 +10999,26 @@
 	      (insert "</pre>\n"))
 	    (throw 'nextline nil))
 
-	  ;; Protect the links
+
+	  ;; make targets to anchors
+	  (while (string-match "<<<?\\([^<>]*\\)>>>?[ \t]*\n?" line)
+	    (setq line (replace-match
+			(concat "@<a name=\""
+				(org-solidify-link-text (match-string 1 line))
+				"\">\\nbsp@</a>")
+			t t line)))
+	  ;; Replace internal links
+	  (while (string-match org-bracket-link-regexp line)
+	    (setq line (replace-match
+			(concat
+			    "@<a href=\"#"
+			    (org-solidify-link-text (match-string 1 line))
+			    "\">"
+			    (match-string (if (match-end 3) 3 1) line)
+			    "@</a>")
+			t t line)))
+
+	  ;; Protect the external links
 	  (setq start 0)
 	  (while (string-match org-link-maybe-angles-regexp line start)
 	    (setq start (match-end 0))
@@ -10587,7 +11061,7 @@
 			      (concat "<a href=\"" thefile "\">\\1:\\2</a>"))
 			    nil nil line))))
 
-	     ((member type '("bbdb" "vm" "wl" "rmail" "gnus" "shell"))
+	     ((member type '("bbdb" "vm" "wl" "mhe" "rmail" "gnus" "shell"))
 	      (setq line (replace-match
 			  "<i>&lt;\\1:\\2&gt;</i>" nil nil line)))))
 
@@ -10722,11 +11196,34 @@
 	(org-format-table-table-html-using-table-generate-source olines)))))
 
 (defun org-format-org-table-html (lines)
-  "Format a table into html."
+  "Format a table into HTML."
   (if (string-match "^[ \t]*|-" (car lines)) (setq lines (cdr lines)))
   (setq lines (nreverse lines))
   (if (string-match "^[ \t]*|-" (car lines)) (setq lines (cdr lines)))
   (setq lines (nreverse lines))
+  (when org-export-table-remove-special-lines
+    ;; Check if the table has a marking column.  If yes remove the
+    ;; column and the special lines
+    (let* ((special
+	    (not
+	     (memq nil
+		   (mapcar
+		    (lambda (x)
+		      (or (string-match "^[ \t]*|-" x)
+			  (string-match "^[ \t]*| *\\([#!$*_^ ]\\) *|" x)))
+		    lines)))))
+      (if special
+	  (setq lines
+		(delq nil
+		      (mapcar
+		       (lambda (x)
+			 (if (string-match "^[ \t]*| *[!_^] *|" x)
+			     nil ; ignore this line
+			   (and (or (string-match "^[ \t]*|-+\\+" x)
+				    (string-match "^[ \t]*|[^|]*|" x))
+				(replace-match "|" t t x))))
+		       lines))))))
+
   (let ((head (and org-export-highlight-first-table-line
 		   (delq nil (mapcar
 			      (lambda (x) (string-match "^[ \t]*|-" x))
@@ -10765,7 +11262,7 @@
     newstr))
 
 (defun org-format-table-table-html (lines)
-  "Format a table generated by table.el into html.
+  "Format a table generated by table.el into HTML.
 This conversion does *not* use `table-generate-source' from table.el.
 This has the advantage that Org-mode's HTML conversions can be used.
 But it has the disadvantage, that no cell- or row-spanning is allowed."
@@ -11210,10 +11707,10 @@
 
 ;; - Bindings in Org-mode map are currently
 ;;   0123456789abcdefghijklmnopqrstuvwxyz!?@#$%^&-+*/=()_{}[]:;"|,.<>~`'\t  the alphabet
-;;             abcd fgh j lmnopqrstuvwxyz!? #$   -+*/=     [] ; |,.<>~  \t  necessary bindings
+;;             abcd fgh j lmnopqrstuvwxyz!? #$ ^ -+*/=     [] ; |,.<>~ '\t  necessary bindings
 ;;                 e                                                        (?) useful from outline-mode
 ;;                     i k                 @                                expendable from outline-mode
-;;   0123456789                               %^&     ()_{}    "      `'    free
+;;   0123456789                               % &     ()_{}    "      `     free
 
 ;; Make `C-c C-x' a prefix key
 (define-key org-mode-map "\C-c\C-x" (make-sparse-keymap))
@@ -11281,6 +11778,8 @@
 (define-key org-mode-map "\M-\C-m"  'org-insert-heading)
 (define-key org-mode-map "\C-c\C-l" 'org-insert-link)
 (define-key org-mode-map "\C-c\C-o" 'org-open-at-point)
+(define-key org-mode-map "\C-c%"    'org-mark-ring-push)
+(define-key org-mode-map "\C-c&"    'org-mark-ring-goto)
 (define-key org-mode-map "\C-c\C-z" 'org-time-stamp)  ; Alternative binding
 (define-key org-mode-map "\C-c."    'org-time-stamp)  ; Minor-mode reserved
 (define-key org-mode-map "\C-c!"    'org-time-stamp-inactive) ; Minor-mode r.
@@ -11594,6 +12093,7 @@
   (interactive "P")
   (let  ((org-enable-table-editor t))
     (cond
+     ((org-on-target-p) (org-update-radio-target-regexp))
      ((org-on-heading-p) (org-set-tags arg))
      ((org-at-table.el-p)
       (require 'table)
@@ -11935,6 +12435,12 @@
 
 ;; Functions needed for Emacs/XEmacs region compatibility
 
+(defun org-add-hook (hook function &optional append local)
+  "Add-hook, compatible with both Emacsen."
+  (if (and local org-xemacs-p)
+      (add-local-hook hook function append)
+    (add-hook hook function append local)))
+
 (defun org-region-active-p ()
   "Is `transient-mark-mode' on and the region active?
 Works on both Emacs and XEmacs."
@@ -12030,6 +12536,19 @@
       (skip-chars-backward "^\r\n")
       (equal (char-before) ?\r))))
 
+(defun org-invisible-p2 ()
+  "Check if point is at a character currently not visible."
+  (save-excursion
+    (if org-noutline-p
+	(progn
+	  (if (and (eolp) (not (bobp))) (backward-char 1))
+	  ;; Early versions of noutline don't have `outline-invisible-p'.
+	  (if (fboundp 'outline-invisible-p)
+	      (outline-invisible-p)
+	    (get-char-property (point) 'invisible)))
+      (skip-chars-backward "^\r\n")
+      (equal (char-before) ?\r))))
+
 (defun org-back-to-heading (&optional invisible-ok)
   "Move to previous heading line, or beg of this line if it's a heading.
 Only visible heading lines are considered, unless INVISIBLE-OK is non-nil."
@@ -12058,6 +12577,16 @@
 	       (bobp)
 	       (equal (char-before) ?\n))))))
 
+(defun org-on-target-p ()
+  (let ((pos (point)))
+    (save-excursion
+      (skip-chars-forward "<")
+      (and (re-search-backward "<<" nil t)
+	   (or (looking-at org-target-regexp)
+	       (looking-at org-radio-target-regexp))
+	   (<= (match-beginning 0) pos)
+	   (>= (match-end 0) pos)))))
+
 (defun org-up-heading-all (arg)
   "Move to the heading line of which the present line is a subheading.
 This function considers both visible and invisible heading lines.
@@ -12195,4 +12724,3 @@
 ;; arch-tag: e77da1a7-acc7-4336-b19e-efa25af3f9fd
 ;;; org.el ends here
 
-
--- a/lisp/textmodes/reftex-auc.el	Fri Feb 24 06:32:18 2006 +0000
+++ b/lisp/textmodes/reftex-auc.el	Fri Feb 24 08:08:56 2006 +0000
@@ -3,7 +3,7 @@
 ;;   2006 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <dominik@science.uva.nl>
-;; Version: VERSIONTAG
+;; Version: 4.31
 
 ;; This file is part of GNU Emacs.
 
--- a/lisp/textmodes/reftex-cite.el	Fri Feb 24 06:32:18 2006 +0000
+++ b/lisp/textmodes/reftex-cite.el	Fri Feb 24 08:08:56 2006 +0000
@@ -3,7 +3,7 @@
 ;;   2006 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <dominik@science.uva.nl>
-;; Version: VERSIONTAG
+;; Version: 4.31
 
 ;; This file is part of GNU Emacs.
 
--- a/lisp/textmodes/reftex-dcr.el	Fri Feb 24 06:32:18 2006 +0000
+++ b/lisp/textmodes/reftex-dcr.el	Fri Feb 24 08:08:56 2006 +0000
@@ -3,7 +3,7 @@
 ;;   2006 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <dominik@science.uva.nl>
-;; Version: VERSIONTAG
+;; Version: 4.31
 ;;
 
 ;; This file is part of GNU Emacs.
@@ -33,7 +33,7 @@
 (require 'reftex)
 ;;;
 
-(defun reftex-view-crossref (&optional arg auto-how)
+(defun reftex-view-crossref (&optional arg auto-how fail-quietly)
   "View cross reference of macro at point.  Point must be on the KEY
 argument.  When at at `\\ref' macro, show corresponding `\\label'
 definition, also in external documents (`xr').  When on a label, show
@@ -56,52 +56,53 @@
          dw)
 
     (if (or (null macro) (reftex-in-comment))
-        (error "Not on a crossref macro argument"))
-
-    (setq reftex-call-back-to-this-buffer (current-buffer))
+	(or fail-quietly
+	    (error "Not on a crossref macro argument"))
 
-    (cond
-     ((string-match "\\`\\\\cite\\|cite\\*?\\'\\|bibentry" macro)
-      ;; A citation macro: search for bibitems or BibTeX entries
-      (setq dw (reftex-view-cr-cite arg key auto-how)))
-     ((string-match "\\`\\\\ref\\|ref\\(range\\)?\\*?\\'" macro)
-      ;; A reference macro: search for labels
-      (setq dw (reftex-view-cr-ref arg key auto-how)))
-     (auto-how nil)  ;; No further action for automatic display (speed)
-     ((or (equal macro "\\label")
-          (member macro reftex-macros-with-labels))
-      ;; A label macro: search for reference macros
-      (reftex-access-scan-info arg)
-      (setq dw (reftex-view-regexp-match
-                (format reftex-find-reference-format (regexp-quote key))
-                4 nil nil)))
-     ((equal macro "\\bibitem")
-      ;; A bibitem macro: search for citations
-      (reftex-access-scan-info arg)
-      (setq dw (reftex-view-regexp-match
-                (format reftex-find-citation-regexp-format (regexp-quote key))
-                4 nil nil)))
-     ((member macro reftex-macros-with-index)
-      (reftex-access-scan-info arg)
-      (setq dw (reftex-view-regexp-match
-                (format reftex-find-index-entry-regexp-format
-                        (regexp-quote key))
-                3 nil nil)))
-     (t 
-      (reftex-access-scan-info arg)
-      (catch 'exit
-        (let ((list reftex-view-crossref-extra)
-              entry mre action group)
-          (while (setq entry (pop list))
-            (setq mre (car entry)
-                  action (nth 1 entry)
-                  group (nth 2 entry))
-            (when (string-match mre macro)
-              (setq dw (reftex-view-regexp-match 
-                        (format action key) group nil nil))
-              (throw 'exit t))))
-        (error "Not on a crossref macro argument"))))
-    (if (and (eq arg 2) (windowp dw)) (select-window dw))))
+      (setq reftex-call-back-to-this-buffer (current-buffer))
+      
+      (cond
+       ((string-match "\\`\\\\cite\\|cite\\*?\\'\\|bibentry" macro)
+	;; A citation macro: search for bibitems or BibTeX entries
+	(setq dw (reftex-view-cr-cite arg key auto-how)))
+       ((string-match "\\`\\\\ref\\|ref\\(range\\)?\\*?\\'" macro)
+	;; A reference macro: search for labels
+	(setq dw (reftex-view-cr-ref arg key auto-how)))
+       (auto-how nil)  ;; No further action for automatic display (speed)
+       ((or (equal macro "\\label")
+	    (member macro reftex-macros-with-labels))
+	;; A label macro: search for reference macros
+	(reftex-access-scan-info arg)
+	(setq dw (reftex-view-regexp-match
+		  (format reftex-find-reference-format (regexp-quote key))
+		  4 nil nil)))
+       ((equal macro "\\bibitem")
+	;; A bibitem macro: search for citations
+	(reftex-access-scan-info arg)
+	(setq dw (reftex-view-regexp-match
+		  (format reftex-find-citation-regexp-format (regexp-quote key))
+		  4 nil nil)))
+       ((member macro reftex-macros-with-index)
+	(reftex-access-scan-info arg)
+	(setq dw (reftex-view-regexp-match
+		  (format reftex-find-index-entry-regexp-format
+			  (regexp-quote key))
+		  3 nil nil)))
+       (t 
+	(reftex-access-scan-info arg)
+	(catch 'exit
+	  (let ((list reftex-view-crossref-extra)
+		entry mre action group)
+	    (while (setq entry (pop list))
+	      (setq mre (car entry)
+		    action (nth 1 entry)
+		    group (nth 2 entry))
+	      (when (string-match mre macro)
+		(setq dw (reftex-view-regexp-match 
+			  (format action key) group nil nil))
+		(throw 'exit t))))
+	  (error "Not on a crossref macro argument"))))
+      (if (and (eq arg 2) (windowp dw)) (select-window dw)))))
      
 (defun reftex-view-cr-cite (arg key how)
   ;; View crossreference of a ref cite.  HOW can have the values 
@@ -243,7 +244,7 @@
        (not (memq last-command '(reftex-view-crossref
                                  reftex-mouse-view-crossref)))
        ;; Quick precheck if this might be a relevant spot
-       ;; FIXME: Can fail with backslash in comment
+       ;; `reftex-view-crossref' will do a more thorough check.
        (save-excursion  
          (search-backward "\\" nil t)
          (looking-at "\\\\[a-zA-Z]*\\(cite\\|ref\\|bibentry\\)"))
@@ -252,9 +253,9 @@
            (let ((current-prefix-arg nil))
              (cond
               ((eq reftex-auto-view-crossref t)
-               (reftex-view-crossref -1 'echo))
+               (reftex-view-crossref -1 'echo 'quiet))
               ((eq reftex-auto-view-crossref 'window)
-               (reftex-view-crossref -1 'tmp-window))
+               (reftex-view-crossref -1 'tmp-window 'quiet))
               (t nil)))
          (error nil))))
 
@@ -267,7 +268,8 @@
   ;; Display crossref info in echo area.
   (cond
    ((null docstruct)
-    (message "%s" (substitute-command-keys (format reftex-no-info-message "ref"))))
+    (message "%s" 
+	     (substitute-command-keys (format reftex-no-info-message "ref"))))
    ((null entry)
     (message "ref: unknown label: %s" label))
    (t
@@ -301,7 +303,7 @@
                (if (and files (= (length all-files) (length files)))
                    (message "cite: no such database entry: %s" key)
                  (message "%s" (substitute-command-keys 
-                           (format reftex-no-info-message "cite"))))
+				(format reftex-no-info-message "cite"))))
                nil)))
       (when entry
         (if item
--- a/lisp/textmodes/reftex-global.el	Fri Feb 24 06:32:18 2006 +0000
+++ b/lisp/textmodes/reftex-global.el	Fri Feb 24 08:08:56 2006 +0000
@@ -3,7 +3,7 @@
 ;;   2006 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <dominik@science.uva.nl>
-;; Version: VERSIONTAG
+;; Version: 4.31
 
 ;; This file is part of GNU Emacs.
 
--- a/lisp/textmodes/reftex-index.el	Fri Feb 24 06:32:18 2006 +0000
+++ b/lisp/textmodes/reftex-index.el	Fri Feb 24 08:08:56 2006 +0000
@@ -3,7 +3,7 @@
 ;;   2006 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <dominik@science.uva.nl>
-;; Version: VERSIONTAG
+;; Version: 4.31
 
 ;; This file is part of GNU Emacs.
 
--- a/lisp/textmodes/reftex-parse.el	Fri Feb 24 06:32:18 2006 +0000
+++ b/lisp/textmodes/reftex-parse.el	Fri Feb 24 08:08:56 2006 +0000
@@ -3,7 +3,7 @@
 ;;   2006 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <dominik@science.uva.nl>
-;; Version: VERSIONTAG
+;; Version: 4.31
 ;;
 
 ;; This file is part of GNU Emacs.
--- a/lisp/textmodes/reftex-ref.el	Fri Feb 24 06:32:18 2006 +0000
+++ b/lisp/textmodes/reftex-ref.el	Fri Feb 24 08:08:56 2006 +0000
@@ -3,7 +3,7 @@
 ;;   2006 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <dominik@science.uva.nl>
-;; Version: VERSIONTAG
+;; Version: 4.31
 
 ;; This file is part of GNU Emacs.
 
--- a/lisp/textmodes/reftex-sel.el	Fri Feb 24 06:32:18 2006 +0000
+++ b/lisp/textmodes/reftex-sel.el	Fri Feb 24 08:08:56 2006 +0000
@@ -3,7 +3,7 @@
 ;;   2006 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <dominik@science.uva.nl>
-;; Version: VERSIONTAG
+;; Version: 4.31
 
 ;; This file is part of GNU Emacs.
 
--- a/lisp/textmodes/reftex-toc.el	Fri Feb 24 06:32:18 2006 +0000
+++ b/lisp/textmodes/reftex-toc.el	Fri Feb 24 08:08:56 2006 +0000
@@ -3,7 +3,7 @@
 ;;   2006 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <dominik@science.uva.nl>
-;; Version: VERSIONTAG
+;; Version: 4.31
 
 ;; This file is part of GNU Emacs.
 
--- a/lisp/textmodes/reftex-vars.el	Fri Feb 24 06:32:18 2006 +0000
+++ b/lisp/textmodes/reftex-vars.el	Fri Feb 24 08:08:56 2006 +0000
@@ -3,7 +3,7 @@
 ;;   2006 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <dominik@science.uva.nl>
-;; Version: VERSIONTAG
+;; Version: 4.31
 
 ;; This file is part of GNU Emacs.
 
@@ -1555,6 +1555,18 @@
   :type '(repeat (cons (string :tag "File type")
                        (repeat (string :tag "Extension")))))
 
+(defcustom reftex-try-all-extensions nil
+  "Non-nil means, try all extensions listed in `reftex-file-extensions'.
+When searching for a file, LaTeX uses only the default extension.  However,
+if you are working with a noweb system that produces the .tex files from
+some other file, and you want RefTeX to scan the web file instead of the
+tex file, you need to set this option.  You also need to make the noweb
+extension the default extension, i.e. the first in the list in
+`reftex-file-extensions'.
+Note that if you are using external file finders, this option has no effect."
+  :group 'reftex-finding-files
+  :type 'boolean)
+
 (defcustom reftex-search-unrecursed-path-first t
   "*Non-nil means, search all specified directories before trying recursion.
 Thus, in a path \".//:/tex/\", search first \"./\", then \"/tex/\" and then
--- a/lisp/textmodes/reftex.el	Fri Feb 24 06:32:18 2006 +0000
+++ b/lisp/textmodes/reftex.el	Fri Feb 24 08:08:56 2006 +0000
@@ -3,7 +3,7 @@
 ;;   2006 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <dominik@science.uva.nl>
-;; Version: VERSIONTAG
+;; Version: 4.31
 ;; Keywords: tex
 
 ;; This file is part of GNU Emacs.
@@ -301,7 +301,7 @@
 ;;; Define the formal stuff for a minor mode named RefTeX.
 ;;;
 
-(defconst reftex-version "RefTeX version VERSIONTAG"
+(defconst reftex-version "RefTeX version 4.31"
   "Version string for RefTeX.")
 
 (defvar reftex-mode nil
@@ -1437,14 +1437,17 @@
                          "\\)\\'"))
          (files (if (string-match ext-re file)
                     (cons file nil)
-                  (cons (concat file def-ext) file)))
-         path old-path file1)
+		  (if reftex-try-all-extensions
+		      (append (mapcar (lambda (x) (concat file x))
+				      extensions)
+			      (list file))
+		    (list (concat file def-ext) file))))
+         path old-path file1 f fs)
     (cond
      ((file-name-absolute-p file)
-      (setq file1 
-            (or 
-             (and (car files) (file-regular-p (car files)) (car files))
-             (and (cdr files) (file-regular-p (cdr files)) (cdr files)))))
+      (while (setq f (pop files))
+	(if (file-regular-p f)
+	    (setq file1 f files nil))))
      ((and reftex-use-external-file-finders
            (assoc type reftex-external-file-finders))
       (setq file1 (reftex-find-file-externally file type master-dir)))
@@ -1452,16 +1455,13 @@
       (while (and (null file1) rec-values)
         (setq path (reftex-access-search-path
                     type (pop rec-values) master-dir file))
-        (if (or (null old-path)
-                (not (eq old-path path)))
-            (setq old-path path
-                  path (cons master-dir path)
-                  file1 (or (and (car files)
-                                 (reftex-find-file-on-path 
-                                  (car files) path master-dir))
-                            (and (cdr files)
-                                 (reftex-find-file-on-path 
-                                  (cdr files) path master-dir))))))))
+	(setq fs files)
+	(while (and (null file1) (setq f (pop fs)))
+	  (when (or (null old-path)
+		    (not (eq old-path path)))
+	    (setq old-path path
+		  path (cons master-dir path))
+	    (setq file1 (reftex-find-file-on-path f path master-dir)))))))
     (cond (file1 file1)
           (die (error "No such file: %s" file) nil)
           (t (message "No such file: %s (ignored)" file) nil))))
--- a/man/ChangeLog	Fri Feb 24 06:32:18 2006 +0000
+++ b/man/ChangeLog	Fri Feb 24 08:08:56 2006 +0000
@@ -1,3 +1,37 @@
+2006-02-23  Juri Linkov  <juri@jurta.org>
+
+	* faq.texi (Common requests): Move `Turning on auto-fill by
+	default' after `Wrapping words automatically'.  Move `Working with
+	unprintable characters' before `Searching for/replacing newlines'.
+	Move `Replacing highlighted text' after `Highlighting a region'.
+	Merge `Repeating commands' and `Repeating a command as many times
+	as possible' into the former.
+	(Packages that do not come with Emacs): Add refs to Gmane and
+	etc/MORE.STUFF.
+
+2006-02-23  Juri Linkov  <juri@jurta.org>
+
+	* faq.texi (Newsgroup archives): Update URLs of GNU mail archives.
+	(Reporting bugs): Suggest using `M-x report-emacs-bug'.
+	Add xref to `(emacs)Reporting Bugs'.
+	(Getting a printed manual): Add URL to other formats of the manual.
+	(Common requests): Fix menu.
+	(Highlighting a region): Remove ref to `Turning on syntax highlighting'.
+	(Horizontal scrolling): Mention `truncate-partial-width-windows'.
+	(Inserting text at the beginning of each line): Add pxref to
+	`Changing the included text prefix'.
+	(Forcing the cursor to remain in the same column): Mention `track-eol'
+	and `set-goal-column'.  Add pxref to `(emacs)Moving Point'.
+	(Replacing text across multiple files): Add keybinding `Q' for
+	`dired-do-query-replace'.
+
+2006-02-22  Carsten Dominik  <dominik@science.uva.nl>
+
+	* reftex.texi: Version number and date change only.
+
+	* org.texi: (Internal Links): Rewritten to cover the modified
+	linking system.
+
 2006-02-21  Nick Roberts  <nickrob@snap.net.nz>
 
 	* building.texi (Watch Expressions): Update and describe
--- a/man/faq.texi	Fri Feb 24 06:32:18 2006 +0000
+++ b/man/faq.texi	Fri Feb 24 08:08:56 2006 +0000
@@ -423,14 +423,17 @@
 archive is not particularly well organized or easy to retrieve
 individual postings from, but pretty much everything is there.
 
-The archive is at @uref{ftp://ftp-mailing-list-archives.gnu.org}.
+The archive is at @uref{ftp://lists.gnu.org/}.
 
 The archive can be browsed over the web at
-@uref{http://mail.gnu.org/archive/html/, the GNU mail archive}.
+@uref{http://lists.gnu.org/archive/html/, the GNU mail archive}.
 
 Web-based Usenet search services, such as
-@uref{http://groups.google.com, Google}, also archive the
-@code{gnu.*} groups.
+@uref{http://groups.google.com/groups/dir?sel=33592484, Google}, also
+archive the @code{gnu.*} groups.
+
+You can read the archives of the @code{gnu.*} groups and post new
+messages at @uref{http://gmane.org/, Gmane}.
 
 @node Reporting bugs, Unsubscribing from Emacs lists, Newsgroup archives, General questions
 @section Where should I report bugs and other problems with Emacs?
@@ -439,16 +442,19 @@
 @cindex How to submit a bug report
 @cindex Reporting bugs
 
-The correct way to report Emacs bugs is by e-mail to
-@email{bug-gnu-emacs@@gnu.org}.  Anything sent here also appears in the
+The correct way to report Emacs bugs is to use the command
+@kbd{M-x report-emacs-bug}.  It sets up a mail buffer with the
+essential information and the correct e-mail address which is
+@email{bug-gnu-emacs@@gnu.org} for the released versions of Emacs.
+Anything sent to @email{bug-gnu-emacs@@gnu.org} also appears in the
 newsgroup @uref{news:gnu.emacs.bug}, but please use e-mail instead of
 news to submit the bug report.  This ensures a reliable return address
 so you can be contacted for further details.
 
 Be sure to read the ``Bugs'' section of the Emacs manual before reporting
-a bug to bug-gnu-emacs!  The manual describes in detail how to submit a
-useful bug report.  (@xref{On-line manual}, if you don't know how to read the
-manual.)
+a bug!  The manual describes in detail how to submit a useful bug
+report (@pxref{Bugs, , Reporting Bugs, emacs, The GNU Emacs Manual}).
+(@xref{On-line manual}, if you don't know how to read the manual.)
 
 RMS says:
 
@@ -674,6 +680,10 @@
 
 @uref{http://www.gnu.org/software/emacs/manual/emacs.html}
 
+The manual is available in other formats at
+
+@uref{http://www.gnu.org/software/emacs/manual/}
+
 @xref{Learning how to do something}, for how to view the manual on-line.
 
 @node Emacs Lisp documentation, Installing Texinfo documentation, Getting a printed manual, Getting help
@@ -763,12 +773,19 @@
 
 @itemize @bullet
 @item
-Info files don't actually need to be installed before being used.  You
-can feed a file name to the @code{Info-goto-node} command (invoked by
-pressing @key{g} in Info mode) by typing the name of the file in
-parentheses.  This goes to the node named ``Top'' in that file.  For
-example, to view a Info file named @file{@var{info-file}} in your home
-directory, you can type this:
+Info files don't actually need to be installed before being used.
+You can use a prefix argument for the @code{info} command and specify
+the name of the Info file in the minibuffer.  This goes to the node
+named @samp{Top} in that file.  For example, to view a Info file named
+@file{@var{info-file}} in your home directory, you can type this:
+
+@example
+@kbd{C-u C-h i ~/@var{info-file} @key{RET}}
+@end example
+
+Alternatively, you can feed a file name to the @code{Info-goto-node}
+command (invoked by pressing @key{g} in Info mode) by typing the name
+of the file in parentheses, like this:
 
 @example
 @kbd{C-h i g (~/@var{info-file}) @key{RET}}
@@ -1074,7 +1091,7 @@
 
 Emacs @value{VER} is the current version as of this writing.
 
-@node New in Emacs 20,  New in Emacs 21, Latest version of Emacs, Status of Emacs
+@node New in Emacs 20, New in Emacs 21, Latest version of Emacs, Status of Emacs
 @section What is different about Emacs 20?
 @cindex Differences between Emacs 19 and Emacs 20
 @cindex Emacs 20, new features in
@@ -1122,7 +1139,7 @@
 that you can now have colors when you run Emacs on a GNU/Linux console
 and on @code{xterm} with @kbd{emacs -nw}.
 
-@node New in Emacs 22, , New in Emacs 21, Status of Emacs
+@node New in Emacs 22,  , New in Emacs 21, Status of Emacs
 @section What is different about Emacs 22?
 @cindex Differences between Emacs 21 and Emacs 22
 @cindex Emacs 22, new features in
@@ -1163,19 +1180,20 @@
 @menu
 * Setting up a customization file::
 * Using Customize::
+* Colors on a TTY::
 * Debugging a customization file::
-* Colors on a TTY::
 * Displaying the current line or column::
 * Displaying the current file name in the titlebar::
 * Turning on abbrevs by default::
-* Turning on auto-fill by default::
 * Associating modes with files::
+* Highlighting a region::
+* Replacing highlighted text::
+* Controlling case sensitivity::
 * Working with unprintable characters::
-* Highlighting a region::
-* Controlling case sensitivity::
-* Wrapping words automatically::
 * Searching for/replacing newlines::
 * Yanking text in isearch::
+* Wrapping words automatically::
+* Turning on auto-fill by default::
 * Spell-checkers::
 * Checking TeX and *roff documents::
 * Changing load-path::
@@ -1196,7 +1214,6 @@
 * Changing the length of a Tab::
 * Inserting text at the beginning of each line::
 * Underlining paragraphs::
-* Repeating a command as many times as possible::
 * Forcing the cursor to remain in the same column::
 * Forcing Emacs to iconify itself::
 * Using regular expressions::
@@ -1209,7 +1226,6 @@
 * Deleting menus and menu options::
 * Turning on syntax highlighting::
 * Scrolling only one line::
-* Replacing highlighted text::
 * Editing MS-DOS files::
 * Filling paragraphs with a single space::
 * Escape sequences in shell output::
@@ -1387,7 +1403,7 @@
 (setq frame-title-format "%b")
 @end lisp
 
-@node Turning on abbrevs by default, Turning on auto-fill by default, Displaying the current file name in the titlebar, Common requests
+@node Turning on abbrevs by default, Associating modes with files, Displaying the current file name in the titlebar, Common requests
 @section How do I turn on abbrevs by default just in mode @var{mymode}?
 @cindex Abbrevs, turning on by default
 
@@ -1406,30 +1422,7 @@
 Starting with Emacs 22, the standard abbrevs file is read automatically
 at startup, so the first of these two forms becomes unnecessary.
 
-@node Turning on auto-fill by default, Associating modes with files, Turning on abbrevs by default, Common requests
-@section How do I turn on @code{auto-fill-mode} by default?
-@cindex @code{auto-fill-mode}, activating automatically
-@cindex Filling automatically
-@cindex Automatic entry to @code{auto-fill-mode}
-
-To turn on @code{auto-fill-mode} just once for one buffer, use @kbd{M-x
-auto-fill-mode}.
-
-To turn it on for every buffer in a certain mode, you must use the hook
-for that mode.  For example, to turn on @code{auto-fill} mode for all
-text buffers, including the following in your @file{.emacs} file:
-
-@lisp
-(add-hook 'text-mode-hook 'turn-on-auto-fill)
-@end lisp
-
-If you want @code{auto-fill} mode on in all major modes, do this:
-
-@lisp
-(setq-default auto-fill-function 'do-auto-fill)
-@end lisp
-
-@node Associating modes with files, Working with unprintable characters, Turning on auto-fill by default, Common requests
+@node Associating modes with files, Highlighting a region, Turning on abbrevs by default, Common requests
 @section How do I make Emacs use a certain major mode for certain files?
 @cindex Associating modes with files
 @cindex File extensions and modes
@@ -1459,7 +1452,81 @@
 indicate which mode to use.  Use @kbd{C-h v} (or @kbd{M-x
 describe-variable}) on @code{interpreter-mode-alist} to learn more.
 
-@node Working with unprintable characters, Highlighting a region, Associating modes with files, Common requests
+@node Highlighting a region, Replacing highlighted text, Associating modes with files, Common requests
+@section How can I highlight a region of text in Emacs?
+@cindex Highlighting text
+@cindex Text, highlighting
+@cindex @code{transient-mark-mode}
+@cindex Region, highlighting a
+
+You can cause the region to be highlighted when the mark is active by
+including
+
+@lisp
+(transient-mark-mode t)
+@end lisp
+
+@noindent
+in your @file{.emacs} file.
+
+@node Replacing highlighted text, Controlling case sensitivity, Highlighting a region, Common requests
+@section How can I replace highlighted text with what I type?
+@cindex @code{delete-selection-mode}
+@cindex Replacing highlighted text
+@cindex Highlighting and replacing text
+
+Use @code{delete-selection-mode}, which you can start automatically by
+placing the following Lisp form in your @file{.emacs} file:
+
+@lisp
+(delete-selection-mode 1)
+@end lisp
+
+According to the documentation string for @code{delete-selection-mode}
+(which you can read using @kbd{M-x describe-function @key{RET}
+delete-selection-mode @key{RET}}):
+
+@quotation
+When ON, typed text replaces the selection if the selection is active.
+When OFF, typed text is just inserted at point.
+@end quotation
+
+This mode also allows you to delete (not kill) the highlighted region by
+pressing @key{DEL}.
+
+@node Controlling case sensitivity, Working with unprintable characters, Replacing highlighted text, Common requests
+@section How do I control Emacs's case-sensitivity when searching/replacing?
+@cindex @code{case-fold-search}
+@cindex Case sensitivity of searches
+@cindex Searching without case sensitivity
+@cindex Ignoring case in searches
+
+For searching, the value of the variable @code{case-fold-search}
+determines whether they are case sensitive:
+
+@lisp
+(setq case-fold-search nil) ; make searches case sensitive
+(setq case-fold-search t)   ; make searches case insensitive
+@end lisp
+
+@cindex Case sensitivity in replacements
+@cindex Replacing, and case sensitivity
+@cindex @code{case-replace}
+Similarly, for replacing, the variable @code{case-replace} determines
+whether replacements preserve case.
+
+You can also toggle case sensitivity at will in isearch with @kbd{M-c}.
+
+To change the case sensitivity just for one major mode, use the major
+mode's hook.  For example:
+
+@lisp
+(add-hook '@var{foo}-mode-hook
+          (lambda ()
+           (setq case-fold-search nil)))
+@end lisp
+
+@node Working with unprintable characters, Searching for/replacing newlines, Controlling case sensitivity, Common requests
 @section How do I search for, delete, or replace unprintable (eight-bit or control) characters?
 @cindex Unprintable characters, working with
 @cindex Working with unprintable characters
@@ -1507,65 +1574,7 @@
 
 M-x replace-regexp @key{RET} [^ @key{TAB} C-q @key{LFD} C-q @key{RET} C-q C-l @key{SPC} -~] @key{RET} : @key{RET}
 
-@itemize @bullet
-
-@item
-You don't need to quote @key{TAB} with either isearch or typing
-something in the minibuffer.
-
-@end itemize
-
-@node Highlighting a region, Controlling case sensitivity, Working with unprintable characters, Common requests
-@section How can I highlight a region of text in Emacs?
-@cindex Highlighting text
-@cindex Text, highlighting
-@cindex @code{transient-mark-mode}
-@cindex Region, highlighting a
-
-You can cause the region to be highlighted when the mark is active by
-including
-
-@lisp
-(transient-mark-mode t)
-@end lisp
-
-@noindent
-in your @file{.emacs} file.  (Also see @ref{Turning on syntax
-highlighting}.)
-
-@node Controlling case sensitivity, Searching for/replacing newlines, Highlighting a region, Common requests
-@section How do I control Emacs's case-sensitivity when searching/replacing?
-@cindex @code{case-fold-search}
-@cindex Case sensitivity of searches
-@cindex Searching without case sensitivity
-@cindex Ignoring case in searches
-
-For searching, the value of the variable @code{case-fold-search}
-determines whether they are case sensitive:
-
-@lisp
-(setq case-fold-search nil) ; make searches case sensitive
-(setq case-fold-search t)   ; make searches case insensitive
-@end lisp
-
-@cindex Case sensitivity in replacements
-@cindex Replacing, and case sensitivity
-@cindex @code{case-replace}
-Similarly, for replacing, the variable @code{case-replace} determines
-whether replacements preserve case.
-
-You can also toggle case sensitivity at will in isearch with @kbd{M-c}.
-
-To change the case sensitivity just for one major mode, use the major
-mode's hook.  For example:
-
-@lisp
-(add-hook '@var{foo}-mode-hook
-          (lambda ()
-           (setq case-fold-search nil)))
-@end lisp
-
-@node Searching for/replacing newlines, Yanking text in isearch, Controlling case sensitivity, Common requests
+@node Searching for/replacing newlines, Yanking text in isearch, Working with unprintable characters, Common requests
 @section How do I input a newline character in isearch or query-replace?
 @cindex Searching for newlines
 @cindex Replacing newlines
@@ -1581,7 +1590,7 @@
 
 Use @kbd{M-y}.  @inforef{Isearch Yank, Isearch Yanking, emacs}.
 
-@node Wrapping words automatically, Spell-checkers, Yanking text in isearch, Common requests
+@node Wrapping words automatically, Turning on auto-fill by default, Yanking text in isearch, Common requests
 @section How do I make Emacs wrap words for me?
 @cindex Wrapping word automatically
 @cindex Wrapping lines
@@ -1595,7 +1604,30 @@
 @code{fill-column}.  To learn how to turn this on automatically, see
 @ref{Turning on auto-fill by default}.
 
-@node Spell-checkers, Checking TeX and *roff documents, Wrapping words automatically, Common requests
+@node Turning on auto-fill by default, Spell-checkers, Wrapping words automatically, Common requests
+@section How do I turn on @code{auto-fill-mode} by default?
+@cindex @code{auto-fill-mode}, activating automatically
+@cindex Filling automatically
+@cindex Automatic entry to @code{auto-fill-mode}
+
+To turn on @code{auto-fill-mode} just once for one buffer, use @kbd{M-x
+auto-fill-mode}.
+
+To turn it on for every buffer in a certain mode, you must use the hook
+for that mode.  For example, to turn on @code{auto-fill} mode for all
+text buffers, including the following in your @file{.emacs} file:
+
+@lisp
+(add-hook 'text-mode-hook 'turn-on-auto-fill)
+@end lisp
+
+If you want @code{auto-fill} mode on in all major modes, do this:
+
+@lisp
+(setq-default auto-fill-function 'do-auto-fill)
+@end lisp
+
+@node Spell-checkers, Checking TeX and *roff documents, Turning on auto-fill by default, Common requests
 @section Where can I get a better spelling checker for Emacs?
 @cindex Checking spelling
 @cindex Spelling, checking text documents
@@ -1845,6 +1877,10 @@
 automatically scrolls the display horizontally when point moves off the
 left or right edge of the window.
 
+Note that this is overridden by the variable
+@code{truncate-partial-width-windows} if that variable is non-nil
+and the current buffer is not full-frame width.
+
 In Emacs 20, use the @code{hscroll-mode}.  Here is some information from
 the documentation, available by typing @kbd{C-h f hscroll-mode @key{RET}}:
 
@@ -2035,14 +2071,11 @@
 to investigate @file{cpp.el}, which is distributed with Emacs.
 
 @node Repeating commands, Valid X resources, Hiding #ifdef lines, Common requests
-@section Is there an equivalent to the @code{.} (dot) command of vi?
-@cindex Repeating commands as with @code{vi}
-@cindex Command, repeat last
+@section How do I repeat a command as many times as possible?
+@cindex Repeating commands many times
+@cindex Commands, repeating many times
 @cindex @code{.}, equivalent to @code{vi} command
 
-(@code{.} is the redo command in @code{vi}.  It redoes the last
-insertion/deletion.)
-
 As of Emacs 20.3, there is indeed a @code{repeat} command (@kbd{C-x z})
 that repeats the last command.  If you preface it with a prefix
 argument, the prefix arg is applied to the command.
@@ -2054,12 +2087,14 @@
 keyboard has these keys) to scan through all the different complex
 commands you've typed.
 
-To repeat a set of commands, use keyboard macros.  (@inforef{Keyboard
-Macros, Keyboard Macros, emacs}.)
-
-If you're really desperate for the @code{.} command, use VIPER, a
-@code{vi} emulation mode which comes with Emacs, and which appears to
-support it.  (@xref{VIPER}.)
+To repeat a set of commands, use keyboard macros.  Use @kbd{C-x (} and
+@kbd{C-x )} to make a keyboard macro that invokes the command and then
+type @kbd{C-x e}.  (@inforef{Keyboard Macros, Keyboard Macros, emacs}.)
+
+If you're really desperate for the @code{.} command in @code{vi} that
+redoes the last insertion/deletion, use VIPER, a @code{vi} emulation
+mode which comes with Emacs, and which appears to support it.
+(@xref{VIPER}.)
 
 @node Valid X resources, Evaluating Emacs Lisp code, Repeating commands, Common requests
 @section What are the valid X resource settings (i.e., stuff in .Xdefaults)?
@@ -2158,35 +2193,26 @@
 might want to set the variable @code{mail-yank-prefix}.  In Message
 buffers, you can even use @kbd{M-;} to cite yanked messages (@kbd{M-;}
 runs the function @code{comment-region}, it is a general-purpose
-mechanism to comment regions).
-
-@node Underlining paragraphs, Repeating a command as many times as possible, Inserting text at the beginning of each line, Common requests
+mechanism to comment regions) (@pxref{Changing the included text prefix}).
+
+@node Underlining paragraphs, Forcing the cursor to remain in the same column, Inserting text at the beginning of each line, Common requests
 @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}
 
 Mark the region and then type @kbd{M-x underline-region @key{RET}}.
 
-@node Repeating a command as many times as possible, Forcing the cursor to remain in the same column, Underlining paragraphs, Common requests
-@section How do I repeat a command as many times as possible?
-@cindex Repeating commands many times
-@cindex Commands, repeating many times
-
-Use @kbd{C-x (} and @kbd{C-x )} to make a keyboard macro that invokes
-the command and then type @kbd{M-0 C-x e}.
-
-Any messages your command prints in the echo area will be suppressed.
-
-If you need to repeat a command a small number of times, you can use
-@kbd{C-x z} (@pxref{Repeating commands}) or @kbd{C-x e}.
-
-@node Forcing the cursor to remain in the same column, Forcing Emacs to iconify itself, Repeating a command as many times as possible, Common requests
+@node Forcing the cursor to remain in the same column, Forcing Emacs to iconify itself, Underlining paragraphs, Common requests
 @section How do I make Emacs behave like this: when I go up or down, the cursor should stay in the same column even if the line is too short?
 @cindex @code{picture-mode}
 @cindex Remaining in the same column, regardless of contents
 @cindex Vertical movement in empty documents
 
-@kbd{M-x picture-mode}.
+Use @kbd{M-x picture-mode}.
+
+See also the variable @code{track-eol} and the command
+@code{set-goal-column} bound to @kbd{C-x C-n}
+(@pxref{Moving Point, , , emacs, The GNU Emacs Manual}).
 
 @node Forcing Emacs to iconify itself, Using regular expressions, Forcing the cursor to remain in the same column, Common requests
 @section How do I tell Emacs to iconify itself?
@@ -2240,8 +2266,8 @@
 files mentioned in the @file{TAGS} file.  @inforef{Tags Search, Tags Search,
 emacs}.
 
-As of Emacs 19.29, Dired mode (@kbd{M-x dired @key{RET}}, or @kbd{C-x
-d}) supports the command @code{dired-do-query-replace}, which allows
+As of Emacs 19.29, Dired mode (@kbd{M-x dired @key{RET}}, or @kbd{C-x d})
+supports the command @code{dired-do-query-replace} (@kbd{Q}), which allows
 users to replace regular expressions in multiple files.
 
 @node Documentation for etags, Disabling backups, Replacing text across multiple files, Common requests
@@ -2537,7 +2563,7 @@
 consult the documentation of the variables @code{ps-printer-name},
 @code{ps-lpr-command}, and @code{ps-lpr-switches} for more details.
 
-@node Scrolling only one line, Replacing highlighted text, Turning on syntax highlighting, Common requests
+@node Scrolling only one line, Editing MS-DOS files, Turning on syntax highlighting, Common requests
 @section How can I force Emacs to scroll only one line when I move past the bottom of the screen?
 @cindex Scrolling only one line
 @cindex Reducing the increment when scrolling
@@ -2553,32 +2579,7 @@
 (setq scroll-conservatively most-positive-fixnum)
 @end lisp
 
-@node Replacing highlighted text, Editing MS-DOS files, Scrolling only one line, Common requests
-@section How can I replace highlighted text with what I type?
-@cindex @code{delete-selection-mode}
-@cindex Replacing highlighted text
-@cindex Highlighting and replacing text
-
-Use @code{delete-selection-mode}, which you can start automatically by
-placing the following Lisp form in your @file{.emacs} file:
-
-@lisp
-(delete-selection-mode 1)
-@end lisp
-
-According to the documentation string for @code{delete-selection-mode}
-(which you can read using @kbd{M-x describe-function @key{RET}
-delete-selection-mode @key{RET}}):
-
-@quotation
-When ON, typed text replaces the selection if the selection is active.
-When OFF, typed text is just inserted at point.
-@end quotation
-
-This mode also allows you to delete (not kill) the highlighted region by
-pressing @key{DEL}.
-
-@node Editing MS-DOS files, Filling paragraphs with a single space, Replacing highlighted text, Common requests
+@node Editing MS-DOS files, Filling paragraphs with a single space, Scrolling only one line, Common requests
 @section How can I edit MS-DOS files using Emacs?
 @cindex Editing MS-DOS files
 @cindex MS-DOS files, editing
@@ -2601,7 +2602,7 @@
 and saved, allowing you to ignore the different conventions that Unix
 and MS-DOS have for delineating the end of a line.
 
-@node Filling paragraphs with a single space,  Escape sequences in shell output, Editing MS-DOS files, Common requests
+@node Filling paragraphs with a single space, Escape sequences in shell output, Editing MS-DOS files, Common requests
 @section How can I tell Emacs to fill paragraphs with a single space after each period?
 @cindex One space following periods
 @cindex Single space following periods
@@ -2613,7 +2614,7 @@
 (setq sentence-end-double-space nil)
 @end lisp
 
-@node Escape sequences in shell output, , Filling paragraphs with a single space, Common requests
+@node Escape sequences in shell output,  , Filling paragraphs with a single space, Common requests
 @section Why these strange escape sequences from @code{ls} from the Shell mode?
 @cindex Escape sequences in @code{ls} output
 @cindex @code{ls} in Shell mode
@@ -3478,7 +3479,8 @@
 
 Many authors post their packages to the @uref{news:gnu.emacs.sources,
 Emacs sources newsgroup}.  You can search the archives of this
-group with @uref{http://groups.google.com, Google}, for example.
+group with @uref{http://groups.google.com/group/gnu.emacs.sources, Google},
+or @uref{http://dir.gmane.org/gmane.emacs.sources, Gmane}, for example.
 
 Several packages are stored in
 @uref{http://emacswiki.org/elisp/, the Lisp area of the Emacs Wiki}.
@@ -3489,6 +3491,9 @@
 
 @uref{ftp://ftp.cis.ohio-state.edu/pub/emacs-lisp/WWW/index.html}
 
+Read the file @file{etc/MORE.STUFF} for more information about
+external packages.
+
 @node Current GNU distributions, Difference between Emacs and XEmacs, Packages that do not come with Emacs, Finding Emacs and related packages
 @section Where can I get other up-to-date GNU stuff?
 @cindex Current GNU distributions
@@ -3715,7 +3720,7 @@
 Up-to-date information about GNU software (including Emacs) for VMS is
 available at @uref{http://vms.gnu.org/}.
 
-@node Modes for various languages, , Emacs for VMS and DECwindows, Finding Emacs and related packages
+@node Modes for various languages,  , Emacs for VMS and DECwindows, Finding Emacs and related packages
 @section Where can I get modes for Lex, Yacc/Bison, Bourne shell, csh, C@t{++}, Objective-C, Pascal, Java, and Awk?
 @cindex Awk, mode for
 @cindex @code{awk-mode}
@@ -4782,7 +4787,7 @@
 This will disable the use of the extra keysyms systemwide, which may be
 undesirable if you actually intend to use them.
 
-@node SPC no longer completes file names, , ExtendChar key does not work as Meta, Key bindings
+@node SPC no longer completes file names,  , ExtendChar key does not work as Meta, Key bindings
 @section Why doesn't SPC complete file names anymore?
 @cindex @kbd{SPC} file name completion
 
--- a/man/org.texi	Fri Feb 24 06:32:18 2006 +0000
+++ b/man/org.texi	Fri Feb 24 08:08:56 2006 +0000
@@ -4,8 +4,8 @@
 @setfilename ../info/org
 @settitle Org Mode Manual
 
-@set VERSION 4.04
-@set DATE January 2006
+@set VERSION 4.06
+@set DATE February 2006
 
 @dircategory Emacs
 @direntry
@@ -35,7 +35,7 @@
 @copying
 This manual is for Org-mode (version @value{VERSION}).
 
-Copyright @copyright{} 2004, 2005, 2006 Free Software Foundation, Inc.
+Copyright @copyright{} 2004, 2005, 2006 Free Software Foundation
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
@@ -126,12 +126,17 @@
 
 Hyperlinks
 
-* Internal Links::              CamelCaseWords as internal links
+* Internal Links::              Links to other places in the current file
 * External Links::              URL-like links to the world
 * Managing links::              Creating, inserting and following
 * Search Options::              Linking to a specific location
 * Remember::                    Org-trees store quick notes
 
+Internal Links
+
+* Radio targets::               Make targets trigger links in plain text.
+* CamelCase links::             Activating CamelCase words as links
+
 TODO items
 
 * TODO basics::                 Marking and displaying TODO entries
@@ -155,12 +160,12 @@
 * Agenda files::                Files being searched for agenda information
 * Agenda dispatcher::           Keyboard access to agenda views
 * Weekly/Daily Agenda::         The calendar page with current tasks
-* Global TODO list::            All infinished action items
+* Global TODO list::            All unfinished action items
 * Matching headline tags::      Structured information with fine-tuned search
 * Timeline::                    Time-sorted view for single file
 * Agenda commands::             Remote editing of org trees
 
-Weekly/Daily Agenda
+The weekly/daily agenda
 
 * Categories::                  Not all tasks are equal
 * Time-of-day specifications::  How the agenda knows the time
@@ -1314,7 +1319,8 @@
 
 Complex ASCII tables with automatic line wrapping, column- and
 row-spanning, and alignment can be created using the Emacs table
-package by Takaaki Ota (@uref{http://sourceforge.net/projects/table}).
+package by Takaaki Ota (@uref{http://sourceforge.net/projects/table},
+and also part of Emacs 22).
 When @key{TAB} or @kbd{C-c C-c} is pressed in such a table, Org-mode
 will call @command{table-recognize-table} and move the cursor into the
 table.  Inside a table, the keymap of Org-mode is inactive.  In order
@@ -1343,7 +1349,7 @@
 links to other files, Usenet articles, emails and much more.
 
 @menu
-* Internal Links::              CamelCaseWords as internal links
+* Internal Links::              Links to other places in the current file
 * External Links::              URL-like links to the world
 * Managing links::              Creating, inserting and following
 * Search Options::              Linking to a specific location
@@ -1356,44 +1362,73 @@
 @cindex links, internal
 @cindex CamelCase links
 
-Similar to Wiki implementations, Org-mode interprets words spelled in
-CamelCase (i.e. mixed case with at least one capital letter following
-on a small letter inside the word) as links.  While in Wiki these
-links usually point to another file, in Org-mode they point to a
-target in the current file.  Targets are CamelCased words in double
-angular brackets, and may be located anywhere, also in a comment line.
-For example
+Strings inside double brackets like @samp{[[My Target]]} are links
+that lead to a text search in the current file.  The link can be
+followed with @kbd{C-c C-o} or with a mouse click (@pxref{Managing
+links}).  The preferred match for such a link is a dedicated target:
+The same string in double angular brackets.  Targets may be located
+anywhere, often it is convenient to put them into a comment line, for
+example
 @example
-# <<MyTarget>>
+# <<My Target>>
 @end example
 
-Each occurrence of @samp{MyTarget} in the file is an active link that
-can be followed with @kbd{C-c C-o} or with a mouse click
-(@pxref{Managing links}).  If no dedicated target exists, org-mode will
-search for the words in the link separated by white space, in the
-above example for @samp{my target}.  If the link starts with a star
-like @samp{*MyTarget}, the search is restricted to headlines.
-Org-mode will first try an exact match of a full headline, but then
-move on to more and more lenient searches.  The link @samp{*MyTargets}
-will find any of the following
+If no dedicated target exists, Org-mode will search for the words in
+the link, in the above example for @samp{my target}.  Links starting
+with a star like @samp{*My Target} restrict the search to headlines.
+When searching, Org-mode will first try an exact match, but then move
+on to more and more lenient searches.  For example, the link
+@samp{[[*My Targets]]} will find any of the following
 @example
 ** My targets
 ** TODO my targets are bright
 ** my 20 targets are
 @end example
+It is therefore often not necessary to set a dedicated target.  To
+insert a link targeting a headline, in-buffer completion can be used.
+Just type a star followed by a few optional letters into the buffer
+and press @kbd{M-@key{TAB}}.  All headlines in the current buffer will
+be offered as completions.  @xref{Managing links}, for more commands
+creating links.
+
+Following a link pushes a mark onto Org-mode's own mark ring.  You can
+return to the previous position with @kbd{C-c &}.  Using this command
+several times in direct succession goes back to positions recorded
+earlier.
+
+@menu
+* Radio targets::               Make targets trigger links in plain text.
+* CamelCase links::             Activating CamelCase words as links
+@end menu
+
+@node Radio targets, CamelCase links, Internal Links, Internal Links
+@subsection Radio targets
+
+You can configure Org-mode to link any occurrences of certain target
+names in normal text.  So without explicitly creating a link, the text
+connects to the target radioing its position.  Radio targets are
+enclosed by triple angular brackets.  For example, a target
+@samp{<<<My Target>>>} causes each occurrence of @samp{my target} in
+normal text to become activated as a link.  The Org-mode file is
+scanned automatically for radio targets only when the file is first
+loaded into Emacs.  To update the target list during editing, press
+@kbd{C-c C-c} with the cursor on or at a target.
+
+@node CamelCase links,  , Radio targets, Internal Links
+@subsection CamelCase words as links
 @cindex completion, of CamelCase links
 @cindex CamelCase links, completion of
-It is therefore often not even necessary to set a dedicated target.
-The link will automatically find a target.  If you want to see what
-lines in the current buffer are matched by a given CamelCase link,
-open the link with @kbd{C-u C-c C-o}.  Even if there are several
-matches, org-mode will usually find the right one since it tries
-targets and exact matches first.  To insert links targeting a
-headline, in-buffer completion can be used.  Just type a star followed
-by a few optional letters into the buffer and press @kbd{M-@key{TAB}}.
-CamelCased versions of all headlines in the current buffer will be
-offered as completions.  @xref{Managing links}, for more commands
-creating links.
+
+As an alternative to @samp{[[...]]} links, Org-mode also supports
+CamelCase words as links.  This feature is not turned on by default
+because of the occasional inconsistencies this system suffers from.
+To activate CamelCase words as links, and to make headline completion
+offer CamelCase version of headlines, the following customization is
+needed:
+@lisp
+(setq org-activate-camels t
+      org-file-link-context-use-camel-case t)
+@end lisp
 
 @node External Links, Managing links, Internal Links, Hyperlinks
 @section External Links
@@ -1407,6 +1442,7 @@
 @cindex VM links
 @cindex RMAIL links
 @cindex WANDERLUST links
+@cindex MH-E links
 @cindex USENET links
 @cindex SHELL links
 
@@ -1426,6 +1462,8 @@
 <vm://myself@@some.where.org/folder#id>     @r{VM on remote machine}
 <wl:folder>                                @r{WANDERLUST folder link}
 <wl:folder#id>                             @r{WANDERLUST message link}
+<mhe:folder>                               @r{MH-E folder link}
+<mhe:folder#id>                            @r{MH-E message link}
 <rmail:folder>                             @r{RMAIL folder link}
 <rmail:folder#id>                          @r{RMAIL message link}
 <gnus:group>                               @r{GNUS group link}
@@ -1458,7 +1496,7 @@
 the current article/entry.  For W3 and W3M buffer, the link goes to
 the current URL.  For Org-mode files, the current headline is
 targeted.  For any other files, the link will point to the file, with
-a CamelCase (@pxref{Search Options}) search string pointing to the
+a search string (@pxref{Search Options}) pointing to the
 contents of the current line.  If there is an active region, the
 selected words will form the basis of the search string.  The key
 binding @kbd{C-c l} is only a suggestion - see @ref{Installation and
@@ -1510,6 +1548,20 @@
 @kindex mouse-3
 @item mouse-3
 Like @kbd{mouse-2}, but force file links to be opened with Emacs.
+
+@cindex mark ring
+@kindex C-c %
+@item C-c %
+Push the current position onto the mark ring, to be able to return
+easily. Commands following an internal link do this automatically.
+
+@cindex links, returning to
+@kindex C-c &
+@item C-c &
+Jump back to a recorded position.  A position is recorded by the
+commands following internal links, and by @kbd{C-c %}.  Using this
+command several times in direct succession moves through a ring of
+previously recorded positions.
 @end table
 
 
@@ -1525,8 +1577,8 @@
 For example:
 @example
 <file:~/code/main.c::255>
-<file:~/xx.org::MyTarget>
-<file:~/xx.org::find me>
+<file:~/xx.org::My Target>
+<file:~/xx.org::*My Target>
 <file:~/xx.org::/regexp/>
 @end example
 @noindent Here is what these options do.
@@ -1534,12 +1586,12 @@
 @table @code
 @item 255
 Jump to line 255.
-@item MyGoal
-Search for a link target with name MyGoal, or do a text search for
-@samp{my target}, similar to the CamelCase search in internal links,
-see @ref{Internal Links}.
-@item find me
-Do a normal text search for the text @samp{find me}.
+@item My Target
+Search for a link target @samp{<<My Target>>}, or do a text search for
+@samp{my target}, similar to the search in internal links, see
+@ref{Internal Links}.
+@item *My Target
+In an Org-mode file, restrict search to headlines.
 @item /regexp/
 Do a regular expression search for @code{regexp}.  This uses the Emacs
 command @code{occur} to list all matches in a separate window.  If the
@@ -1549,10 +1601,10 @@
 @c @code{grep} will be used to search all files in the directory.
 @end table
 
-To use the search options also for a search in the current file, a
-file link with an empty file name can be used.  For example,
-@code{<file:::find me>} does a search for @samp{find me} in the
-current file.
+As a degenerate case, a file link with an empty file name can be used
+to search the current file.  For example, @code{<file:::find me>} does
+a search for @samp{find me} in the current file, just like
+@samp{[[find me]]} would.
 
 @node Remember,  , Search Options, Hyperlinks
 @section Remember
@@ -3248,6 +3300,8 @@
 
 @itemize @bullet
 @item
+Thomas Baumann contributed the code for links to the MH-E email system.
+@item
 Pavel Chalmoviansky reported bugs and suggested improvements
 related to the agenda treatment of items with specified time.
 @item
@@ -3267,7 +3321,7 @@
 Tim O'Callaghan suggested in-file links, search options for
 general file links, and TAGS.
 @item
-Oliver Oppitz made useful suggestions.
+Oliver Oppitz suggested multi-state TODO items.
 @item
 Pete Phillips helped the development of the TAGS feature with beta
 testing and suggestions.
@@ -3289,8 +3343,8 @@
 Juergen Vollmer contributed code generating the table of contents
 in HTML output, and other export improvements.
 @item
-David Wainberg suggested to implement an archiving mechanism and helped
-testing.
+David Wainberg suggested the archiving mechanism and shaped the
+internal link system with many suggestions and ideas.
 @item
 Scheduling TODO items was inspired by John Wiegley's @file{planner.el}.
 @item
--- a/man/reftex.texi	Fri Feb 24 06:32:18 2006 +0000
+++ b/man/reftex.texi	Fri Feb 24 08:08:56 2006 +0000
@@ -7,9 +7,9 @@
 @syncodeindex fn cp
 
 @c Version and Contact Info
-@set VERSION 4.30
-@set EDITION 4.30
-@set DATE September 2005
+@set VERSION 4.31
+@set EDITION 4.31
+@set DATE February 2006
 @set AUCTEXSITE @uref{http://www.nongnu.org/auctex/,AUCTeX distribution site}
 @set MAINTAINERSITE @uref{http://www.astro.uva.nl/~dominik/Tools/,maintainers webpage}
 @set MAINTAINER Carsten Dominik
@@ -25,8 +25,7 @@
 This is edition @value{EDITION} of the @b{Ref@TeX{}} User Manual for
 @b{Ref@TeX{}} @value{VERSION}
 
-Copyright (c) 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2005,
-   2006 Free Software Foundation, Inc.
+Copyright (c) 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2005 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
--- a/src/ChangeLog	Fri Feb 24 06:32:18 2006 +0000
+++ b/src/ChangeLog	Fri Feb 24 08:08:56 2006 +0000
@@ -1,3 +1,43 @@
+2006-02-23  Zhang Wei  <id.brep@gmail.com>  (tiny change)
+
+	* xfns.c (Fx_file_dialog): Return a decoded file name.
+
+2006-02-23  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
+
+	* dispnew.c (update_text_area): Avoid needless redraw of rightmost
+	glyph whose face is extended to the text area end.
+
+	* macterm.c (x_set_toolkit_scroll_bar_thumb): Don't set control
+	values if control is not visible or values are not changed.
+
+2006-02-22  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* window.c (Fwindow_list): Check `window' before doing XWINDOW.
+	The default `window' should not be "on a different frame".
+
+2006-02-22  Kim F. Storm  <storm@cua.dk>
+
+	* indent.c (Fvertical_motion): Only try to move back if we can.
+
+2006-02-22  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
+
+	* macgui.h (struct _XGC) [!MAC_OSX || !USE_ATSUI]: New member
+	n_clip_rects.
+
+	* macmenu.c (digest_single_submenu): Apply 2006-02-19 change for
+	xmenu.c.
+
+	* macterm.c (GC_CLIP_REGION): Remove macro.
+	(mac_begin_clip, mac_end_clip): Take arg GC instead of REGION.
+	All uses changed.  Don't do clipping if n_clip_rects is zero.
+	(mac_set_clip_rectangles): Use xassert instead of abort.
+	Set n_clip_rects.  Don't make clip_region empty when number of
+	clipping rectangles is zero.
+	(mac_reset_clip_rectangles): Set n_clip_rects directly instead of
+	calling mac_set_clip_rectangles.
+	(x_set_toolkit_scroll_bar_thumb): Temporarily hide scroll bar to
+	avoid multiple redraws.
+
 2006-02-22  Kim F. Storm  <storm@cua.dk>
 
 	* fringe.c (draw_fringe_bitmap): Fix overlay-arrow display.
@@ -22,8 +62,8 @@
 	BG_WIDTH.  All uses changed.  Draw background if BG_WIDTH is not zero.
 	(mac_draw_image_string, mac_draw_image_string_16): New arg BG_WIDTH.
 	[USE_CG_TEXT_DRAWING] (mac_draw_image_string_cg): Rename from
-	mac_draw_string_cg.  New arg BG_WIDTH.  All uses changed.  Draw
-	background if BG_WIDTH is not zero.  Use float constants as
+	mac_draw_string_cg.  New arg BG_WIDTH.  All uses changed.
+	Draw background if BG_WIDTH is not zero.  Use float constants as
 	divisors instead of double.  Use alloca instead of xmalloc/xfree.
 	(x_draw_glyph_string_background, x_draw_glyph_string_foreground)
 	[!MAC_OS8 || USE_ATSUI]: Background may be drawn using
@@ -34,6 +74,11 @@
 	(mac_set_clip_rectangles): When resetting clip region, make it
 	empty instead of disposing of it.
 
+2006-02-20  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* keymap.c (store_in_keymap): Change `def' arg to not be `register'.
+	Seems to trigger a bug in gcc-amd64 4.0.2 20051125 (Red Hat 4.0.2-8).
+
 2006-02-20  Kim F. Storm  <storm@cua.dk>
 
 	* Makefile.in: Add fringe.elc to WINDOW_SUPPORT.
@@ -59,10 +104,10 @@
 	(left_curly_arrow_bits): Rename from continuation_bits.
 	(right_curly_arrow_bits): Rename from continued_bits.
 	(left_triangle_bits): Rename from ov_bits.
-	(right_triangle_bits): Added.
+	(right_triangle_bits): Add.
 	(filled_rectangle_bits): Rename from filled_box_cursor_bits.
 	(hollow_rectangle_bits): Rename from hollow_box_cursor_bits.
-	(filled_square_bits): Added.
+	(filled_square_bits): Add.
 	(vertical_bar_bits): Rename from bar_cursor_bits.
 	(horizontal_bar_bits): Rename from hbar_cursor_bits.
 	(empty_line_bits): Rename from zv_bits.
--- a/src/dispnew.c	Fri Feb 24 06:32:18 2006 +0000
+++ b/src/dispnew.c	Fri Feb 24 08:08:56 2006 +0000
@@ -4344,10 +4344,14 @@
       int overlapping_glyphs_p = current_row->contains_overlapping_glyphs_p;
       int desired_stop_pos = desired_row->used[TEXT_AREA];
 
-      /* If the desired row extends its face to the text area end,
+      /* If the desired row extends its face to the text area end, and
+	 unless the current row also does so at the same position,
 	 make sure we write at least one glyph, so that the face
 	 extension actually takes place.  */
-      if (MATRIX_ROW_EXTENDS_FACE_P (desired_row))
+      if (MATRIX_ROW_EXTENDS_FACE_P (desired_row)
+	  && (desired_stop_pos < current_row->used[TEXT_AREA]
+	      || (desired_stop_pos == current_row->used[TEXT_AREA]
+		  && !MATRIX_ROW_EXTENDS_FACE_P (current_row))))
 	--desired_stop_pos;
 
       stop = min (current_row->used[TEXT_AREA], desired_stop_pos);
@@ -4466,7 +4470,10 @@
 	     has to be cleared, if and only if we did a write_glyphs
 	     above.  This is made sure by setting desired_stop_pos
 	     appropriately above.  */
-	  xassert (i < desired_row->used[TEXT_AREA]);
+	  xassert (i < desired_row->used[TEXT_AREA]
+		   || ((desired_row->used[TEXT_AREA]
+			== current_row->used[TEXT_AREA])
+		       && MATRIX_ROW_EXTENDS_FACE_P (current_row)));
 	}
       else if (MATRIX_ROW_EXTENDS_FACE_P (current_row))
 	{
--- a/src/indent.c	Fri Feb 24 06:32:18 2006 +0000
+++ b/src/indent.c	Fri Feb 24 08:08:56 2006 +0000
@@ -2107,7 +2107,8 @@
       it.vpos = 0;
       /* Do this even if LINES is 0, so that we move back
 	 to the beginning of the current line as we ought.  */
-      move_it_by_lines (&it, XINT (lines), 0);
+      if (XINT (lines) >= 0 || IT_CHARPOS (it) > 0)
+	move_it_by_lines (&it, XINT (lines), 0);
 
       SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it));
     }
--- a/src/macgui.h	Fri Feb 24 06:32:18 2006 +0000
+++ b/src/macgui.h	Fri Feb 24 08:08:56 2006 +0000
@@ -217,13 +217,13 @@
   RGBColor back_color;
 
 #define MAX_CLIP_RECTS 2
-  /* QuickDraw clipping region.  */
+  /* Number of clipping rectangles.  */
+  int n_clip_rects;
+
+  /* QuickDraw clipping region.  Ignored if n_clip_rects == 0.  */
   RgnHandle clip_region;
 
 #if defined (MAC_OSX) && USE_ATSUI
-  /* Number of clipping rectangles used in Quartz 2D drawing.  */
-  int n_clip_rects;
-
   /* Clipping rectangles used in Quartz 2D drawing.  The y-coordinate
      is in QuickDraw's.  */
   CGRect clip_rects[MAX_CLIP_RECTS];
--- a/src/macmenu.c	Fri Feb 24 06:32:18 2006 +0000
+++ b/src/macmenu.c	Fri Feb 24 08:08:56 2006 +0000
@@ -1257,8 +1257,11 @@
 	      wv->enabled = 1;
 	      wv->button_type = BUTTON_TYPE_NONE;
 	      wv->help = Qnil;
+	      save_wv = wv;
 	    }
-	  save_wv = wv;
+	  else
+	    save_wv = first_wv;
+
 	  prev_wv = 0;
 	  i += MENU_ITEMS_PANE_LENGTH;
 	}
--- a/src/macterm.c	Fri Feb 24 06:32:18 2006 +0000
+++ b/src/macterm.c	Fri Feb 24 08:08:56 2006 +0000
@@ -269,14 +269,13 @@
 #define GC_FORE_COLOR(gc)	(&(gc)->fore_color)
 #define GC_BACK_COLOR(gc)	(&(gc)->back_color)
 #define GC_FONT(gc)		((gc)->xgcv.font)
-#define GC_CLIP_REGION(gc)	((gc)->clip_region)
 #define FRAME_NORMAL_GC(f)	((f)->output_data.mac->normal_gc)
 
 static RgnHandle saved_port_clip_region = NULL;
 
 static void
-mac_begin_clip (region)
-     RgnHandle region;
+mac_begin_clip (gc)
+     GC gc;
 {
   static RgnHandle new_region = NULL;
 
@@ -285,19 +284,19 @@
   if (new_region == NULL)
     new_region = NewRgn ();
 
-  if (region && !EmptyRgn (region))
+  if (gc->n_clip_rects)
     {
       GetClip (saved_port_clip_region);
-      SectRgn (saved_port_clip_region, region, new_region);
+      SectRgn (saved_port_clip_region, gc->clip_region, new_region);
       SetClip (new_region);
     }
 }
 
 static void
-mac_end_clip (region)
-     RgnHandle region;
-{
-  if (region && !EmptyRgn (region))
+mac_end_clip (gc)
+     GC gc;
+{
+  if (gc->n_clip_rects)
     SetClip (saved_port_clip_region);
 }
 
@@ -325,10 +324,10 @@
 
   RGBForeColor (GC_FORE_COLOR (gc));
 
-  mac_begin_clip (GC_CLIP_REGION (gc));
+  mac_begin_clip (gc);
   MoveTo (x1, y1);
   LineTo (x2, y2);
-  mac_end_clip (GC_CLIP_REGION (gc));
+  mac_end_clip (gc);
 }
 
 void
@@ -369,9 +368,9 @@
   RGBBackColor (GC_BACK_COLOR (gc));
   SetRect (&r, x, y, x + width, y + height);
 
-  mac_begin_clip (GC_CLIP_REGION (gc));
+  mac_begin_clip (gc);
   EraseRect (&r);
-  mac_end_clip (GC_CLIP_REGION (gc));
+  mac_end_clip (gc);
 
   RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f)));
 }
@@ -434,7 +433,7 @@
   RGBBackColor (GC_BACK_COLOR (gc));
   SetRect (&r, x, y, x + width, y + height);
 
-  mac_begin_clip (GC_CLIP_REGION (gc));
+  mac_begin_clip (gc);
 #if TARGET_API_MAC_CARBON
   {
     CGrafPtr port;
@@ -449,7 +448,7 @@
   CopyBits (&bitmap, &(FRAME_MAC_WINDOW (f)->portBits), &(bitmap.bounds), &r,
 	    overlay_p ? srcOr : srcCopy, 0);
 #endif /* not TARGET_API_MAC_CARBON */
-  mac_end_clip (GC_CLIP_REGION (gc));
+  mac_end_clip (gc);
 
   RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f)));
 }
@@ -581,9 +580,9 @@
   RGBForeColor (GC_FORE_COLOR (gc));
   SetRect (&r, x, y, x + width, y + height);
 
-  mac_begin_clip (GC_CLIP_REGION (gc));
+  mac_begin_clip (gc);
   PaintRect (&r); /* using foreground color of gc */
-  mac_end_clip (GC_CLIP_REGION (gc));
+  mac_end_clip (gc);
 }
 
 
@@ -603,9 +602,9 @@
   RGBForeColor (GC_FORE_COLOR (gc));
   SetRect (&r, x, y, x + width + 1, y + height + 1);
 
-  mac_begin_clip (GC_CLIP_REGION (gc));
+  mac_begin_clip (gc);
   FrameRect (&r); /* using foreground color of gc */
-  mac_end_clip (GC_CLIP_REGION (gc));
+  mac_end_clip (gc);
 }
 
 
@@ -720,7 +719,7 @@
       if (!mac_use_core_graphics)
 	{
 #endif
-	  mac_begin_clip (GC_CLIP_REGION (gc));
+	  mac_begin_clip (gc);
 	  RGBForeColor (GC_FORE_COLOR (gc));
 	  if (bg_width)
 	    {
@@ -736,7 +735,7 @@
 	  ATSUDrawText (text_layout,
 			kATSUFromTextBeginning, kATSUToTextEnd,
 			kATSUUseGrafPortPenLoc, kATSUUseGrafPortPenLoc);
-	  mac_end_clip (GC_CLIP_REGION (gc));
+	  mac_end_clip (gc);
 #ifdef MAC_OSX
 	}
       else
@@ -809,7 +808,7 @@
       if (mac_use_core_graphics)
 	savedFlags = SwapQDTextFlags (kQDUseCGTextRendering);
 #endif
-      mac_begin_clip (GC_CLIP_REGION (gc));
+      mac_begin_clip (gc);
       RGBForeColor (GC_FORE_COLOR (gc));
 #ifdef MAC_OS8
       if (bg_width)
@@ -845,7 +844,7 @@
       DrawText (buf, 0, nchars * bytes_per_char);
       if (bg_width)
 	RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f)));
-      mac_end_clip (GC_CLIP_REGION (gc));
+      mac_end_clip (gc);
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1020
       if (mac_use_core_graphics)
@@ -1187,7 +1186,7 @@
   ForeColor (blackColor);
   BackColor (whiteColor);
 
-  mac_begin_clip (GC_CLIP_REGION (gc));
+  mac_begin_clip (gc);
   LockPixels (GetGWorldPixMap (src));
 #if TARGET_API_MAC_CARBON
   {
@@ -1205,7 +1204,7 @@
 	    &src_r, &dest_r, srcCopy, 0);
 #endif /* not TARGET_API_MAC_CARBON */
   UnlockPixels (GetGWorldPixMap (src));
-  mac_end_clip (GC_CLIP_REGION (gc));
+  mac_end_clip (gc);
 
   RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f)));
 }
@@ -1231,7 +1230,7 @@
   ForeColor (blackColor);
   BackColor (whiteColor);
 
-  mac_begin_clip (GC_CLIP_REGION (gc));
+  mac_begin_clip (gc);
   LockPixels (GetGWorldPixMap (src));
   LockPixels (GetGWorldPixMap (mask));
 #if TARGET_API_MAC_CARBON
@@ -1251,7 +1250,7 @@
 #endif /* not TARGET_API_MAC_CARBON */
   UnlockPixels (GetGWorldPixMap (mask));
   UnlockPixels (GetGWorldPixMap (src));
-  mac_end_clip (GC_CLIP_REGION (gc));
+  mac_end_clip (gc);
 
   RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f)));
 }
@@ -1289,9 +1288,9 @@
      color mapping in CopyBits.  Otherwise, it will be slow.  */
   ForeColor (blackColor);
   BackColor (whiteColor);
-  mac_begin_clip (GC_CLIP_REGION (gc));
+  mac_begin_clip (gc);
   CopyBits (&(w->portBits), &(w->portBits), &src_r, &dest_r, srcCopy, 0);
-  mac_end_clip (GC_CLIP_REGION (gc));
+  mac_end_clip (gc);
 
   RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f)));
 #endif /* not TARGET_API_MAC_CARBON */
@@ -1427,14 +1426,10 @@
 {
   int i;
 
-  if (n < 0 || n > MAX_CLIP_RECTS)
-    abort ();
-  if (n == 0)
-    {
-      if (gc->clip_region)
-	SetEmptyRgn (gc->clip_region);
-    }
-  else
+  xassert (n >= 0 && n <= MAX_CLIP_RECTS);
+
+  gc->n_clip_rects = n;
+  if (n > 0)
     {
       if (gc->clip_region == NULL)
 	gc->clip_region = NewRgn ();
@@ -1452,8 +1447,6 @@
 	}
     }
 #if defined (MAC_OSX) && USE_ATSUI
-  gc->n_clip_rects = n;
-
   for (i = 0; i < n; i++)
     {
       Rect *rect = rectangles + i;
@@ -1473,7 +1466,7 @@
      Display *display;
      GC gc;
 {
-  mac_set_clip_rectangles (display, gc, NULL, 0);
+  gc->n_clip_rects = 0;
 }
 
 
@@ -4538,7 +4531,6 @@
      int portion, position, whole;
 {
   ControlHandle ch = SCROLL_BAR_CONTROL_HANDLE (bar);
-
   int value, viewsize, maximum;
 
   if (whole == 0 || XINT (bar->track_height) == 0)
@@ -4552,10 +4544,20 @@
 
   BLOCK_INPUT;
 
-  SetControl32BitMinimum (ch, 0);
-  SetControl32BitMaximum (ch, maximum);
-  SetControl32BitValue (ch, value);
-  SetControlViewSize (ch, viewsize);
+  if (IsControlVisible (ch)
+      && (GetControlViewSize (ch) != viewsize
+	  || GetControl32BitValue (ch) != value
+	  || GetControl32BitMaximum (ch) != maximum))
+    {
+      /* Temporarily hide the scroll bar to avoid multiple redraws.  */
+      SetControlVisibility (ch, false, false);
+
+      SetControl32BitMaximum (ch, maximum);
+      SetControl32BitValue (ch, value);
+      SetControlViewSize (ch, viewsize);
+
+      SetControlVisibility (ch, true, true);
+    }
 
   UNBLOCK_INPUT;
 }
--- a/src/window.c	Fri Feb 24 06:32:18 2006 +0000
+++ b/src/window.c	Fri Feb 24 08:08:56 2006 +0000
@@ -1861,7 +1861,8 @@
      Lisp_Object frame, minibuf, window;
 {
   if (NILP (window))
-    window = selected_window;
+    window = FRAMEP (frame) ? XFRAME (frame)->selected_window : selected_window;
+  CHECK_WINDOW (window);
   if (NILP (frame))
     frame = selected_frame;