]> code.delx.au - gnu-emacs/commitdiff
Merge from origin/emacs-25
authorJohn Wiegley <johnw@newartisans.com>
Sat, 2 Apr 2016 21:51:33 +0000 (14:51 -0700)
committerJohn Wiegley <johnw@newartisans.com>
Sat, 2 Apr 2016 21:51:33 +0000 (14:51 -0700)
e65c307 * src/font.c (QCuser_spec): Add missing colon to :user-spec.
c8b868b Don't start the 'midnight' timer twice
278c8a7 * src/xwidget.c (Fxwidget_resize): Fix inappropriate use of X...
e5c17f4 Fix todo-mode category movement
bc70fda * lisp/xt-mouse.el (xterm-mouse-utf-8): Add :version.
cf40f38 Ignore non-nil. non-cons values of unread-command-events
8ee4c52 Improve documentatuon of 'truncate-partial-width-windows'
fb9a62c * src/ftfont.c (ftfont_shape_by_flt): Parenthesize as per GNU...
1e1ea22 Fix 'dired-goto-file' in Dired buffers produced by find-dired
3a13472 Fix map-put and map-delete for alists (Bug#23105)
422c3da Minor copyedits of documentation for temporary displays
90fb9b3 Add customization option for using UTF-8 coordinates in xt-mouse
f14d463 Minor doc string fixes in replace.el
e70ee9d Fix scrolling upwards with 'xwidget-webkit-browse-url'
44782de Fix display of Indic scripts
326c64f Fix splash screen display at startup
7ab2a97 ; In NEWS mention new display of minibuffer completions window
a1cd84c Describe temporary displays in Emacs manual
5ec1056 Avoid stray As next to IDLW icons
45577d5 Avoid GTK 3 crash with icons and masks
e99ff6e * lisp/minibuffer.el (minibuffer-completion-help): Use fit-wi...
077b78c Define make_save_ptr_ptr unconditionally
20a1003 Preserve current buffer when popping up TTY menus
7eba90c Improve font selection by family on MS-Windows
73d213f Comint, term, and compile now set EMACS
9524ec5 Ignore more merges when generating ChangeLog
ad250f2 Sync with gnulib
c0165ea Resurrect GNUS-NEWS autogeneration
1e5327c ; Backport ChangeLog.2 fixes from master
e643977 Make `toggle-frame-maximized' respect the dock on OS X (bug#2...
38a43f1 Fix bug in displaying header line with a box face
91e6676 Fix an Isearch var to be a string (Bug#23038)
76ef522 Fix (args-out-of-range 1) error in cursor-sensor--detect
8a35f83 Render empty <ul><li><ul> correctly
d8b2ce5 Ignore invalid base64 encoded embedded images
52ba24b Fix <p> and <div> newlines with or without <li> in shr
b8ea08b Avoid errors in 'newline'
fc3cd53 Fix Bug#23032
dd2737b Adjudicate review comments in abbrevs.texi
26f9c50 Fixup the "normal" matcher; highlight global var symbols, too
413e73b ; Small theme additions
cd950da Honor prefix arg in doc-view-next-line-or-next-page
ed909c0 ; Spelling fixes
6da3a6d Port to strict C99 offsetof
de7601f Port to GTK with strict C11 compiler
658aa2d Port to GTK with strict C99 compiler
1df7173 Avoid screen artifacts with new OS X visible bell after scrol...
7a2edd3 Merge branch 'emacs-25' of git.sv.gnu.org:/srv/git/emacs into...
dca240a Suppress some Tramp tests for OSX, do not merge with master
9094304 * lisp/progmodes/xref.el (xref-buffer-name, xref--window): Mo...
cbedfc2 * lisp/gnus/mm-decode.el (gnus-format-message): Autoload it.
005ac7c * lisp/mail/rmail.el (rmail-mime-entity-truncated): Declare.
9ab03f2 ; Auto-commit of loaddefs files.
56df617 Address compilation warnings due to 2016-01-03 mml refactoring.
a1ef911 * lisp/emacs-lisp/smie.el (smie-indent-keyword): Don't burp i...
79ae7fb * lisp/dired-x.el (dired-omit-here-always): Correct error mes...
253929f * lisp/dired-x.el (dired-omit-here-always): Replace undefined...
ce53389 * lisp/xml.el (xml-parse-tag-1): Replace undefined function.
d6d164f Avoid segfaults due to frame image cache being absent
bc7f6f6 Improve documentation of glyphless-character display
6b6916e ; * src/xdisp.c (with_echo_area_buffer): Fix typos in comments.
ee9a1f7 Support safe navigation operator in non-SMIE indentation code
c3ed95b Move xsd:base64Binary decoding fix to debbugs.el 0.9.1
2036be4 Fix Ruby's operator precedence
1d686c2 (ruby-interpolation-inside-another-interpolation): New failin...
7950e1d Port to clang 3.7.0 on x86-64
218ae59 * test/automated/package-test.el (package-test-signed): Tweak...
ba33b7c Sync with gnulib
38b276d Fix startup of "emacs -nw" on systems that CANNOT_DUMP
dbfbedd Do not tokenize a comment before continuation as ';'
0403620 Don't misindent arguments of a method call inside continuation
e6776f8 * src/keyboard.c (echo_keystrokes_p): Don't test cursor_in_ec...
8475f3d ASCII-only etc/NEWS etc.
5cc6919 Fix a cacheing bug, which led to inordinately slow c-beginnin...
0ce37ea Fix Isearch prompt when invoked with an argument
f3033d4 Fix a typo in the Emacs manual
4235d2d Curved quotes in etc/NEWS etc.
26b56dc Fix some single quotes in documentation
80ec484 Make lisp-completion-at-point's argument optional
9d463ae Tweak the left precedence of '=>'
5b705bc Indent '.' relative to the first sibling expression
04f5525 Make '.' associative, for easier sexp navigation
ba24c99 Revert "Simplify "Visit New File" to "New File""

1  2 
etc/NEWS
lisp/dired.el
lisp/net/tramp-sh.el
lisp/replace.el
lisp/term.el
src/alloc.c
src/frame.c
src/keyboard.c
src/xdisp.c
test/lisp/emacs-lisp/map-tests.el

diff --combined etc/NEWS
index 726b4b9b7118fd94966bdc547dbc58289e7455d3,96ec1f1ddfa542a102470b265f85eba0c1d0872d..d878228720e25d4ecc37761df67d84242c2e056e
+++ b/etc/NEWS
@@@ -22,204 -22,6 +22,204 @@@ Temporary note
  When you add a new item, use the appropriate mark if you are sure it applies,
  otherwise leave it unmarked.
  
 +\f
 +* Installation Changes in Emacs 25.2
 +
 ++++
 +** New configure option '--disable-build-details' attempts to build an
 +Emacs that is more likely to be reproducible; that is, if you build
 +and install Emacs twice, the second Emacs is a copy of the first.
 +Deterministic builds omit the build date from the output of the
 +emacs-version and erc-cmd-SV functions, and the leave the following
 +variables nil: emacs-build-system, emacs-build-time,
 +erc-emacs-build-time.
 +
 +** Emacs no longer works on IRIX.  We expect that Emacs users are not
 +affected by this, as SGI stopped supporting IRIX in December 2013.
 +
 +\f
 +* Startup Changes in Emacs 25.2
 +
 +\f
 +* Changes in Emacs 25.2
 +
 ++++
 +** A number of accessors for the value returned by 'file-attributes'
 +has been added.  They are: 'file-attribute-type',
 +'file-attribute-link-number', 'file-attribute-user-id',
 +'file-attribute-group-id', 'file-attribute-access-time',
 +'file-attribute-modification-time',
 +'file-attribute-status-change-time', 'file-attribute-size',
 +'file-attribute-modes', 'file-attribute-inode-number', and
 +'file-attribute-device-number'
 +
 ++++
 +** The new function 'buffer-hash' has been added, and can be used to
 +compute a fash, non-consing hash of the contents of a buffer.
 +
 +---
 +** 'fill-paragraph' no longer marks the buffer as changed unless it
 +actually changed something.
 +
 +---
 +** The locale language name 'ca' is now mapped to the language
 +environment 'Catalan', which has been added.
 +
 +---
 +** 'align-regexp' has a separate history for its interactive argument
 +'align-regexp' no longer shares its history with all other
 +history-less functions that use 'read-string'
 +
 ++++
 +** The networking code has been reworked so that it's more
 +asynchronous than it was (when specifying :nowait t in
 +'make-network-process').  How asynchronous it is varies based on the
 +capabilities of the system, but on a typical GNU/Linux system the DNS
 +resolution, the connection, and (for TLS streams) the TLS negotiation
 +are all done without blocking the main Emacs thread.  To get
 +asynchronous TLS, the TLS boot parameters have to be passed in (see
 +the manual for details).
 +
 +Certain process oriented functions (like 'process-datagram-address')
 +will block until socket setup has been performed.  The recommended way
 +to deal with asynchronous sockets is to avoid interacting with them
 +until they have changed status to "run".  This is most easily done
 +from a process sentinel.
 +
 +** 'make-network-process' and 'open-network-stream' sometimes allowed
 +:service to be an integer string (e.g., :service "993") and sometimes
 +required an integer (e.g., :service 993).  This difference has been
 +eliminated, and integer strings work everywhere.
 +
 +** It is possible to disable attempted recovery on fatal signals
 +
 +Two new variables allow to disable attempts to recover from stack
 +overflow and to avoid automatic auto-save when Emacs is delivered a
 +fatal signal.  'attempt-stack-overflow-recovery', if set to 'nil',
 +will disable attempts to recover from C stack overflows; Emacs will
 +then crash as with any other fatal signal.
 +'attempt-orderly-shutdown-on-fatal-signal', if set to 'nil', will
 +disable attempts to auto-save the session and shut down in an orderly
 +fashion when Emacs receives a fatal signal; instead, Emacs will
 +terminate immediately.  Both variables are non-'nil' by default.
 +These variables are for users who would like to avoid the small
 +probability of data corruption due to techniques Emacs uses to recover
 +in these situations.
 +
 +\f
 +* Editing Changes in Emacs 25.2
 +
 +\f
 +* Changes in Specialized Modes and Packages in Emacs 25.2
 +
 +** eww
 +
 ++++
 +*** A new 's' command for switching to another eww buffer via the minibuffer.
 +
 +---
 +*** The 'o' command ('shr-save-contents') has moved to 'O' to avoid collision
 +with the 'o' command from 'image-map'.
 +
 ++++
 +** The commands that add ChangeLog entries now prefer a VCS root directory
 +for the ChangeLog file, if none already exists.  Customize
 +'change-log-directory-files' to nil for the old behavior.
 +
 +---
 +** Support for non-string values of 'time-stamp-format' has been removed.
 +
 +** Tramp
 +
 ++++
 +*** New connection method "sg", which allows to edit files under
 +different group ID.
 +
 ++++
 +*** New connection method "doas" for OpenBSD hosts.
 +
 +---
 +** 'auto-revert-use-notify' is set back to t in 'global-auto-revert-mode'.
 +
 +** CSS mode
 +
 +---
 +*** Support for completing attribute values and bang-rules using the
 +'completion-at-point' command.
 +
 +\f
 +* New Modes and Packages in Emacs 25.2
 +
 +\f
 +* Incompatible Lisp Changes in Emacs 25.2
 +
 ++++
 +** Resizing a frame no longer runs 'window-configuration-change-hook'.
 +Put your function on 'window-size-change-functions' instead.
 +
 +\f
 +* Lisp Changes in Emacs 25.2
 +
 +** New var syntax-ppss-table to control the syntax-table used in syntax-ppss
 +
 +** Autoload files can be generated without timestamps,
 +by setting 'autoload-timestamps' to nil.
 +FIXME As an experiment, nil is the current default.
 +If no insurmountable problems before next release, it can stay that way.
 +
 +** 'ert-with-function-mocked' of 'ert-x package allows mocking of functions
 +in unit tests.
 +
 +---
 +** 'gnutls-boot' now takes a parameter :complete-negotiation that says
 +that negotiation should complete even on non-blocking sockets.
 +
 ++++
 +** New functions 'window-pixel-width-before-size-change' and
 +'window-pixel-height-before-size-change' allow to detect which window
 +changed size when 'window-size-change-functions' are run.
 +
 ++++
 +** New function 'display-buffer-reuse-mode-window' is an action function
 +suitable for use in 'display-buffer-alist'. For example, to avoid creating
 +a new window when opening man pages when there's already one, use
 +(add-to-list 'display-buffer-alist
 +     '("\\`\\*Man .*\\*\\'" .
 +       (display-buffer-reuse-mode-window
 +        (inhibit-same-window . nil)
 +        (mode . Man-mode))))
 +
 ++++
 +** New function 'func-arity' returns information about the argument list
 +of an arbitrary function.
 +This is a generalization of 'subr-arity' for functions that are not
 +built-in primitives.  We recommend using this new function instead of
 +'subr-arity'.
 +
 ++++
 +** 'parse-partial-sexp' state has a new element.  Element 10 is
 +non-nil when the last character scanned might be the first character
 +of a two character construct, i.e. a comment delimiter or escaped
 +character.  Its value is the syntax of that last character.
 +
 ++++
 +** 'parse-partial-sexp''s state, element 9, has now been confirmed as
 +permanent and documented, and may be used by Lisp programs.  Its value
 +is a list of currently open parenthesis positions, starting with the
 +outermost parenthesis.
 +
 +\f
 +* Changes in Emacs 25.2 on Non-Free Operating Systems
 +
 +** Intercepting hotkeys on Windows 7 and later now works better.
 +The new keyboard hooking code properly grabs system hotkeys such as
 +Win-* and Alt-TAB, in a way that Emacs can get at them before the
 +system.  This makes the 'w32-register-hot-key' functionality work
 +again on all versions of MS-Windows starting with Windows 7.  On
 +Windows NT and later you can now register any hotkey combination.  (On
 +Windows 9X, the previous limitations, spelled out in the Emacs manual,
 +still apply.)
 +
  \f
  * Installation Changes in Emacs 25.1
  
@@@ -321,6 -123,12 +321,12 @@@ command line when 'initial-buffer-choic
  ** The value of 'initial-scratch-message' is now treated as a doc string
  and can contain escape sequences for command keys, quotes, and the like.
  
+ ---
+ ** The default height of GUI frames was enlarged.
+ This is so there's enough space in the initial window to display the
+ optional text about recovering crashes sessions, without losing the
+ splash image display.
  \f
  * Changes in Emacs 25.1
  
@@@ -378,32 -186,17 +384,32 @@@ change in future releases.  For that re
  by default, and must be enabled by using the '--with-modules' option
  at configure time.
  
 ++++
 +** A second dir-local file (.dir-locals-2.el) is now accepted.
 +See the variable 'dir-locals-file-2' for more information.
 +
  +++
  ** Network security (TLS/SSL certificate validity and the like) is
  added via the new Network Security Manager (NSM) and controlled via
  the 'network-security-level' variable.
  
 +---
 +** International domain names (IDNA) are now encoded via the new
 +puny.el library, so that one can visit web sites with non-ASCII URLs.
 +
  +++
  ** C-h l now also lists the commands that were run.
  
 +** The new M-s M-w key binding uses eww to search the web for the
 +text in the region.
 +
  +++
 -** x-select-enable-clipboard is renamed select-enable-clipboard
 -and x-select-enable-primary is renamed select-enable-primary.
 +** The new 'timer-list' command lists all active timers in a buffer
 +where you can cancel them with the 'c' command.
 +
 +** M-x suggests shorthands and ignores obsolete commands for completion.
 +** x-select-enable-clipboard is renamed select-enable-clipboard.
 +x-select-enable-primary and renamed select-enable-primary.
  Additionally they both now apply to all systems (OSX, GNUstep, Windows, you
  name it), with the proviso that on some systems (e.g. Windows)
  select-enable-primary is ineffective since the system doesn't
@@@ -418,10 -211,6 +424,10 @@@ selected window is strongly dedicated t
  ** The option 'even-window-heights' has been renamed to
  'even-window-sizes' and now handles window widths as well.
  
 ++++
 +** New function 'read-multiple-choice' use to prompt for
 +multiple-choice questions, with a handy way to display help texts.
 +
  +++
  ** terpri gets an optional arg ENSURE to conditionally output a newline.
  
@@@ -544,11 -333,6 +550,11 @@@ is intended for adding to 'kill-emacs-q
  in favor of the global 'M-s h' bindings introduced in Emacs-23.1.
  They'll disappear soon.
  
 ++++
 +** New bindings for 'query-replace-map'.
 +'undo', undo the last replacement; bound to 'u'.
 +'undo-all', undo all replacements; bound to 'U'.
 +
  \f
  * Changes in Specialized Modes and Packages in Emacs 25.1
  
@@@ -679,9 -463,6 +685,9 @@@ obsolete alias for the new 'save-place-
  'erc-network-hide-list' and 'erc-channel-hide-list' will only hide the
  specified message types for the respective specified targets.
  
 +*** New variable 'erc-default-port-tls' used to connect to TLS IRC
 +servers.
 +
  ---
  *** Reconnection is now asynchronous.
  
@@@ -932,11 -713,6 +938,11 @@@ using mono-spaced font
  whether to use variable-pitch fonts or not.  The user can also
  customize the 'shr-use-fonts' variable.
  
 ++++
 +*** A new command 'C' ('eww-toggle-colors') can be used to toggle
 +whether to use the HTML-specified colors or not.  The user can also
 +customize the 'shr-use-colors' variable.
 +
  +++
  *** A new command 'R' ('eww-readable') will try do identify the main
  textual parts of a web page and display only that, leaving menus and
@@@ -946,13 -722,6 +952,13 @@@ the like off the page
  *** A new command 'D' ('eww-toggle-paragraph-direction') allows you to
  toggle the paragraph direction between left-to-right and right-to-left.
  
 +---
 +*** Images that are being loaded are now marked with grey
 +"placeholder" images of the size specified by the HTML.  They are then
 +replaced by the real images asynchronously, which will also now
 +respect width/height HTML specs (unless they specify widths/heights
 +bigger than the current window).
 +
  ---
  *** You can now use several eww buffers in parallel by renaming eww
  buffers you want to keep separate.
@@@ -992,17 -761,6 +998,17 @@@ invalid certificates are marked in red
  *** text/html messages that contain inline image parts will be
  transformed into multipart/related messages before sending.
  
 +---
 +*** The 'message-valid-fqdn-regexp' variable has been removed, since
 +there are now top-level domains added all the time.  Message will no
 +longer warn about sending emails to top-level domains it hasn't heard
 +about.
 +
 +*** 'message-beginning-of-line' (bound to C-a) understands folded headers.
 +In 'visual-line-mode' it will look for the true beginning of a header
 +while in non-'visual-line-mode' it will move the point to the indented
 +header's value.
 +
  +++
  ** In Show Paren Mode, a parenthesis can be highlighted when point
  stands inside it, and certain parens can be highlighted when point is
@@@ -1014,30 -772,6 +1020,30 @@@ respectively, 'show-paren-when-point-in
  ** If gpg2 exists on the system, it is now used as the default value
  of 'epg-gpg-program' (instead of gpg).
  
 +** Images
 +
 ++++
 +*** Images are automatically scaled before displaying based on the
 +'image-scaling-factor' variable (if Emacs supports scaling the images
 +in question).
 +
 ++++
 +*** Images inserted with 'insert-image' and related functions get a
 +keymap put into the text properties (or overlays) that span the
 +image.  This keymap binds keystrokes for manipulating size and
 +rotation, as well as saving the image to a file.  These commands are
 +also available in 'image-mode'.
 +
 ++++
 +*** A new library for creating and manipulating SVG images has been
 +added.  See the "SVG Images" section in the lispref manual for
 +details.
 +
 ++++
 +*** New setf-able function to access and set image parameters is
 +provided: 'image-property'.
 +
 +
  ** Lisp mode
  
  ---
@@@ -1211,11 -945,6 +1217,11 @@@ variable, meaning you can bind it aroun
  plist will contain a :peer element that has the output of
  'gnutls-peer-status' (if Emacs is built with GnuTLS support).
  
 ++++
 +*** The new function 'url-cookie-delete-cookie' can be used to
 +programmatically delete all cookies, or cookies from a specific
 +domain.
 +
  ** Tramp
  
  +++
@@@ -1265,11 -994,6 +1271,11 @@@ This command is useful when you perfor
  outside Emacs (e.g., from the shell prompt), or if you switch the VC
  back-end for the buffer's file, or remove it from version control.
  
 +---
 +*** The VC state indicator in the mode line now defaults to more
 +colorful faces to make it more obvious to the user what the state is.
 +See the 'vc-faces' customization group.
 +
  +++
  *** New option 'vc-annotate-background-mode' controls whether
  the color range from 'vc-annotate-color-map' is applied to the
@@@ -1547,15 -1271,6 +1553,15 @@@ compression command is determined from 
  'dired-compress-files-alist' variable.
  
  +++
 +*** In wdired, when editing files to contain slash characters,
 +the resulting directories are automatically created.  Whether
 +to do this or not is controlled by the
 +'wdired-create-parent-directories' variable.
 +
 ++++
 +*** 'W' is now bound to 'browse-url-of-dired-file', and is useful for
 +viewing HTML files and the like.
 +
  *** New user interface for the 'A' and 'Q' commands.
  These keys, now bound to 'dired-do-find-regexp' and
  'dired-do-find-regexp-and-replace', work similarly to 'xref-find-apropos'
@@@ -1695,17 -1410,10 +1701,18 @@@ symbol-function was changed not to sign
  *** As a consequence, the second arg of 'indirect-function' is now obsolete.
  
  +++
- ** Comint, term, and compile do not set the EMACS env var any more.
+ ** Although comint, term, and compile still set the EMACS variable,
+ this is now considered deprecated and will be removed in a future release.
  Use the INSIDE_EMACS environment variable instead.
  
 +** 'C-up', 'C-down', 'C-left' and 'C-right' are now defined in term
 +mode to send the same escape sequences that xterm does.  This makes
 +things like forward-word in readline work.
 +
 +---
 +** hideshow mode got four key bindings that are analogous to outline
 +mode bindings: 'C-c @ C-a',  'C-c @ C-t',  'C-c @ C-d', and 'C-c @ C-e.'
 +
  +++
  ** 'save-excursion' does not save&restore the mark any more.
  Use 'save-mark-and-excursion' if you want the old behavior.
@@@ -1800,10 -1508,6 +1807,10 @@@ behavior, set 'diff-switches' to '-c'
  dynamically.  Any third-party code that changes these templates should
  be updated accordingly.
  
 +** The grep/rgrep/lgrep functions will now ask about saving files
 +before running.  This is controlled by the 'grep-save-buffers'
 +variable.
 +
  +++
  ** '(/ N)' is now equivalent to '(/ 1 N)' rather than to '(/ N 1)'.
  The new behavior is compatible with Common Lisp and with XEmacs.
@@@ -1909,10 -1613,6 +1916,10 @@@ details
  It should be placed right where the docstring would be, and FORM is then
  evaluated (and should return a string) when the closure is built.
  
 +---
 +** The new command 'fortune-message' has been added, which displays
 +fortunes in the echo area.
 +
  +++
  ** define-inline provides a new way to define inlinable functions.
  
@@@ -1939,12 -1639,6 +1946,12 @@@ environment.  For the time being this i
  systems and for MS-Windows, for other systems they fall back to their
  counterparts 'string-lessp' and 'string-equal'.
  
 ++++
 +** The new function 'string-version-lessp' compares strings by
 +interpreting consecutive runs of numerical characters as numbers, and
 +compares their numerical values.  According to this predicate,
 +"foo2.png" is smaller than "foo12.png".
 +
  ---
  *** The ls-lisp package uses 'string-collate-lessp' to sort file names.
  The effect is that, on systems that use ls-lisp for Dired, the default
@@@ -2134,14 -1828,6 +2141,14 @@@ coding-system of your choice when invok
  ** New possible value for 'system-type': 'nacl'.
  This is used by Google's Native Client (NaCl).
  
 +---
 +** 'read-color' will now display the color names using the color itself
 +as the background color.
 +
 +---
 +** There is now a new variable 'flyspell-sort-corrections-function'
 +that allows changing the way corrections are sorted.
 +
  ** Miscellaneous name change
  
  ---
@@@ -2240,6 -1926,16 +2247,16 @@@ frames
  'window-divider-default-places', 'window-divider-default-bottom-width'
  and 'window-divider-default-right-width'.
  
+ +++
+ *** The window displaying the '*Completions*' buffer with minibuffer
+ completion candidates is now shown at the bottom of the selected
+ frame.  The size of that window is always as large as required to
+ display all the candidates, except when limited by the minimum size
+ of the other windows on that frame; those other windows are resized
+ to provide space for the '*Completions*' display.  The Emacs manual
+ describes how to customize 'display-buffer-alist' to get back the old
+ behavior, see the node "Temporary Displays" there.
  ---
  ** Tearoff menus and detachable toolbars for Gtk+ have been removed.
  Those features have been deprecated in Gtk+ for a long time.
diff --combined lisp/dired.el
index 6c7445c348680d4fcaaa825024578f8e537fd90a,5741872cfc875fd79ecd64ae9e3c744fd19c1cc0..2a65bd09cc5e69e19b4bba08f6ad3ffd0d638d04
@@@ -34,9 -34,6 +34,9 @@@
  
  ;;; Code:
  
 +;; When bootstrapping dired-loaddefs has not been generated.
 +(require 'dired-loaddefs nil t)
 +
  (declare-function dired-buffer-more-recently-used-p
                  "dired-x" (buffer1 buffer2))
  
@@@ -1538,7 -1535,6 +1538,7 @@@ Do so according to the former subdir al
      (define-key map "u" 'dired-unmark)
      (define-key map "v" 'dired-view-file)
      (define-key map "w" 'dired-copy-filename-as-kill)
 +    (define-key map "W" 'browse-url-of-dired-file)
      (define-key map "x" 'dired-do-flagged-delete)
      (define-key map "y" 'dired-show-file-type)
      (define-key map "+" 'dired-create-directory)
@@@ -2740,9 -2736,18 +2740,18 @@@ instead of `dired-actual-switches'.
                 (save-excursion
                   (goto-char (point-min))
                   (dired-goto-file-1 file file (point-max)))
-                ;; Otherwise, look for it as a relative name.  The
-                ;; hair is to get the result of `dired-goto-subdir'
-                ;; without calling it if we don't have any subdirs.
+                  ;; Next, look for it as a relative name with leading
+                  ;; subdirectories.  (This happens in Dired buffers
+                  ;; created by find-dired, for example.)
+                  (save-excursion
+                    (goto-char (point-min))
+                    (dired-goto-file-1 (file-relative-name file
+                                                           default-directory)
+                                       file (point-max)))
+                ;; Otherwise, look for it as a relative name, a base
+                ;; name only.  The hair is to get the result of
+                ;; `dired-goto-subdir' without calling it if we don't
+                ;; have any subdirs.
                 (save-excursion
                   (when (if (string= dir (expand-file-name default-directory))
                             (goto-char (point-min))
@@@ -3906,6 -3911,571 +3915,6 @@@ Ask means pop up a menu for the user t
  (add-to-list 'desktop-buffer-mode-handlers
             '(dired-mode . dired-restore-desktop-buffer))
  
 -\f
 -;;; Start of automatically extracted autoloads.
 -\f
 -;;;### (autoloads nil "dired-aux" "dired-aux.el" "17b411edeac40022109eb6f705b83079")
 -;;; Generated autoloads from dired-aux.el
 -
 -(autoload 'dired-diff "dired-aux" "\
 -Compare file at point with file FILE using `diff'.
 -If called interactively, prompt for FILE.  If the file at point
 -has a backup file, use that as the default.  If the file at point
 -is a backup file, use its original.  If the mark is active
 -in Transient Mark mode, use the file at the mark as the default.
 -\(That's the mark set by \\[set-mark-command], not by Dired's
 -\\[dired-mark] command.)
 -
 -FILE is the first file given to `diff'.  The file at point
 -is the second file given to `diff'.
 -
 -With prefix arg, prompt for second argument SWITCHES, which is
 -the string of command switches for the third argument of `diff'.
 -
 -\(fn FILE &optional SWITCHES)" t nil)
 -
 -(autoload 'dired-backup-diff "dired-aux" "\
 -Diff this file with its backup file or vice versa.
 -Uses the latest backup, if there are several numerical backups.
 -If this file is a backup, diff it with its original.
 -The backup file is the first file given to `diff'.
 -With prefix arg, prompt for argument SWITCHES which is options for `diff'.
 -
 -\(fn &optional SWITCHES)" t nil)
 -
 -(autoload 'dired-compare-directories "dired-aux" "\
 -Mark files with different file attributes in two dired buffers.
 -Compare file attributes of files in the current directory
 -with file attributes in directory DIR2 using PREDICATE on pairs of files
 -with the same name.  Mark files for which PREDICATE returns non-nil.
 -Mark files with different names if PREDICATE is nil (or interactively
 -with empty input at the predicate prompt).
 -
 -PREDICATE is a Lisp expression that can refer to the following variables:
 -
 -    size1, size2   - file size in bytes
 -    mtime1, mtime2 - last modification time in seconds, as a float
 -    fa1, fa2       - list of file attributes
 -                     returned by function `file-attributes'
 -
 -    where 1 refers to attribute of file in the current dired buffer
 -    and 2 to attribute of file in second dired buffer.
 -
 -Examples of PREDICATE:
 -
 -    (> mtime1 mtime2) - mark newer files
 -    (not (= size1 size2)) - mark files with different sizes
 -    (not (string= (nth 8 fa1) (nth 8 fa2))) - mark files with different modes
 -    (not (and (= (nth 2 fa1) (nth 2 fa2))   - mark files with different UID
 -              (= (nth 3 fa1) (nth 3 fa2))))   and GID.
 -
 -\(fn DIR2 PREDICATE)" t nil)
 -
 -(autoload 'dired-do-chmod "dired-aux" "\
 -Change the mode of the marked (or next ARG) files.
 -Symbolic modes like `g+w' are allowed.
 -Type M-n to pull the file attributes of the file at point
 -into the minibuffer.
 -
 -\(fn &optional ARG)" t nil)
 -
 -(autoload 'dired-do-chgrp "dired-aux" "\
 -Change the group of the marked (or next ARG) files.
 -Type M-n to pull the file attributes of the file at point
 -into the minibuffer.
 -
 -\(fn &optional ARG)" t nil)
 -
 -(autoload 'dired-do-chown "dired-aux" "\
 -Change the owner of the marked (or next ARG) files.
 -Type M-n to pull the file attributes of the file at point
 -into the minibuffer.
 -
 -\(fn &optional ARG)" t nil)
 -
 -(autoload 'dired-do-touch "dired-aux" "\
 -Change the timestamp of the marked (or next ARG) files.
 -This calls touch.
 -Type M-n to pull the file attributes of the file at point
 -into the minibuffer.
 -
 -\(fn &optional ARG)" t nil)
 -
 -(autoload 'dired-do-print "dired-aux" "\
 -Print the marked (or next ARG) files.
 -Uses the shell command coming from variables `lpr-command' and
 -`lpr-switches' as default.
 -
 -\(fn &optional ARG)" t nil)
 -
 -(autoload 'dired-clean-directory "dired-aux" "\
 -Flag numerical backups for deletion.
 -Spares `dired-kept-versions' latest versions, and `kept-old-versions' oldest.
 -Positive prefix arg KEEP overrides `dired-kept-versions';
 -Negative prefix arg KEEP overrides `kept-old-versions' with KEEP made positive.
 -
 -To clear the flags on these files, you can use \\[dired-flag-backup-files]
 -with a prefix argument.
 -
 -\(fn KEEP)" t nil)
 -
 -(autoload 'dired-do-async-shell-command "dired-aux" "\
 -Run a shell command COMMAND on the marked files asynchronously.
 -
 -Like `dired-do-shell-command', but adds `&' at the end of COMMAND
 -to execute it asynchronously.
 -
 -When operating on multiple files, asynchronous commands
 -are executed in the background on each file in parallel.
 -In shell syntax this means separating the individual commands
 -with `&'.  However, when COMMAND ends in `;' or `;&' then commands
 -are executed in the background on each file sequentially waiting
 -for each command to terminate before running the next command.
 -In shell syntax this means separating the individual commands with `;'.
 -
 -The output appears in the buffer `*Async Shell Command*'.
 -
 -\(fn COMMAND &optional ARG FILE-LIST)" t nil)
 -
 -(autoload 'dired-do-shell-command "dired-aux" "\
 -Run a shell command COMMAND on the marked files.
 -If no files are marked or a numeric prefix arg is given,
 -the next ARG files are used.  Just \\[universal-argument] means the current file.
 -The prompt mentions the file(s) or the marker, as appropriate.
 -
 -If there is a `*' in COMMAND, surrounded by whitespace, this runs
 -COMMAND just once with the entire file list substituted there.
 -
 -If there is no `*', but there is a `?' in COMMAND, surrounded by
 -whitespace, this runs COMMAND on each file individually with the
 -file name substituted for `?'.
 -
 -Otherwise, this runs COMMAND on each file individually with the
 -file name added at the end of COMMAND (separated by a space).
 -
 -`*' and `?' when not surrounded by whitespace have no special
 -significance for `dired-do-shell-command', and are passed through
 -normally to the shell, but you must confirm first.
 -
 -If you want to use `*' as a shell wildcard with whitespace around
 -it, write `*\"\"' in place of just `*'.  This is equivalent to just
 -`*' in the shell, but avoids Dired's special handling.
 -
 -If COMMAND ends in `&', `;', or `;&', it is executed in the
 -background asynchronously, and the output appears in the buffer
 -`*Async Shell Command*'.  When operating on multiple files and COMMAND
 -ends in `&', the shell command is executed on each file in parallel.
 -However, when COMMAND ends in `;' or `;&' then commands are executed
 -in the background on each file sequentially waiting for each command
 -to terminate before running the next command.  You can also use
 -`dired-do-async-shell-command' that automatically adds `&'.
 -
 -Otherwise, COMMAND is executed synchronously, and the output
 -appears in the buffer `*Shell Command Output*'.
 -
 -This feature does not try to redisplay Dired buffers afterward, as
 -there's no telling what files COMMAND may have changed.
 -Type \\[dired-do-redisplay] to redisplay the marked files.
 -
 -When COMMAND runs, its working directory is the top-level directory
 -of the Dired buffer, so output files usually are created there
 -instead of in a subdir.
 -
 -In a noninteractive call (from Lisp code), you must specify
 -the list of file names explicitly with the FILE-LIST argument, which
 -can be produced by `dired-get-marked-files', for example.
 -
 -\(fn COMMAND &optional ARG FILE-LIST)" t nil)
 -
 -(autoload 'dired-run-shell-command "dired-aux" "\
 -
 -
 -\(fn COMMAND)" nil nil)
 -
 -(autoload 'dired-do-kill-lines "dired-aux" "\
 -Kill all marked lines (not the files).
 -With a prefix argument, kill that many lines starting with the current line.
 -\(A negative argument kills backward.)
 -If you use this command with a prefix argument to kill the line
 -for a file that is a directory, which you have inserted in the
 -Dired buffer as a subdirectory, then it deletes that subdirectory
 -from the buffer as well.
 -To kill an entire subdirectory (without killing its line in the
 -parent directory), go to its directory header line and use this
 -command with a prefix argument (the value does not matter).
 -
 -\(fn &optional ARG FMT)" t nil)
 -
 -(autoload 'dired-do-compress-to "dired-aux" "\
 -Compress selected files and directories to an archive.
 -You are prompted for the archive name.
 -The archiving command is chosen based on the archive name extension and
 -`dired-compress-files-alist'.
 -
 -\(fn)" t nil)
 -
 -(autoload 'dired-compress-file "dired-aux" "\
 -Compress or uncompress FILE.
 -Return the name of the compressed or uncompressed file.
 -Return nil if no change in files.
 -
 -\(fn FILE)" nil nil)
 -
 -(autoload 'dired-query "dired-aux" "\
 -Format PROMPT with ARGS, query user, and store the result in SYM.
 -The return value is either nil or t.
 -
 -The user may type y or SPC to accept once; n or DEL to skip once;
 -! to accept this and subsequent queries; or q or ESC to decline
 -this and subsequent queries.
 -
 -If SYM is already bound to a non-nil value, this function may
 -return automatically without querying the user.  If SYM is !,
 -return t; if SYM is q or ESC, return nil.
 -
 -\(fn SYM PROMPT &rest ARGS)" nil nil)
 -
 -(autoload 'dired-do-compress "dired-aux" "\
 -Compress or uncompress marked (or next ARG) files.
 -
 -\(fn &optional ARG)" t nil)
 -
 -(autoload 'dired-do-byte-compile "dired-aux" "\
 -Byte compile marked (or next ARG) Emacs Lisp files.
 -
 -\(fn &optional ARG)" t nil)
 -
 -(autoload 'dired-do-load "dired-aux" "\
 -Load the marked (or next ARG) Emacs Lisp files.
 -
 -\(fn &optional ARG)" t nil)
 -
 -(autoload 'dired-do-redisplay "dired-aux" "\
 -Redisplay all marked (or next ARG) files.
 -If on a subdir line, redisplay that subdirectory.  In that case,
 -a prefix arg lets you edit the `ls' switches used for the new listing.
 -
 -Dired remembers switches specified with a prefix arg, so that reverting
 -the buffer will not reset them.  However, using `dired-undo' to re-insert
 -or delete subdirectories can bypass this machinery.  Hence, you sometimes
 -may have to reset some subdirectory switches after a `dired-undo'.
 -You can reset all subdirectory switches to the default using
 -\\<dired-mode-map>\\[dired-reset-subdir-switches].
 -See Info node `(emacs)Subdir switches' for more details.
 -
 -\(fn &optional ARG TEST-FOR-SUBDIR)" t nil)
 -
 -(autoload 'dired-add-file "dired-aux" "\
 -
 -
 -\(fn FILENAME &optional MARKER-CHAR)" nil nil)
 -
 -(autoload 'dired-remove-file "dired-aux" "\
 -
 -
 -\(fn FILE)" nil nil)
 -
 -(autoload 'dired-relist-file "dired-aux" "\
 -Create or update the line for FILE in all Dired buffers it would belong in.
 -
 -\(fn FILE)" nil nil)
 -
 -(autoload 'dired-copy-file "dired-aux" "\
 -
 -
 -\(fn FROM TO OK-FLAG)" nil nil)
 -
 -(autoload 'dired-rename-file "dired-aux" "\
 -
 -
 -\(fn FILE NEWNAME OK-IF-ALREADY-EXISTS)" nil nil)
 -
 -(autoload 'dired-create-directory "dired-aux" "\
 -Create a directory called DIRECTORY.
 -If DIRECTORY already exists, signal an error.
 -
 -\(fn DIRECTORY)" t nil)
 -
 -(autoload 'dired-do-copy "dired-aux" "\
 -Copy all marked (or next ARG) files, or copy the current file.
 -When operating on just the current file, prompt for the new name.
 -
 -When operating on multiple or marked files, prompt for a target
 -directory, and make the new copies in that directory, with the
 -same names as the original files.  The initial suggestion for the
 -target directory is the Dired buffer's current directory (or, if
 -`dired-dwim-target' is non-nil, the current directory of a
 -neighboring Dired window).
 -
 -If `dired-copy-preserve-time' is non-nil, this command preserves
 -the modification time of each old file in the copy, similar to
 -the \"-p\" option for the \"cp\" shell command.
 -
 -This command copies symbolic links by creating new ones, similar
 -to the \"-d\" option for the \"cp\" shell command.
 -
 -\(fn &optional ARG)" t nil)
 -
 -(autoload 'dired-do-symlink "dired-aux" "\
 -Make symbolic links to current file or all marked (or next ARG) files.
 -When operating on just the current file, you specify the new name.
 -When operating on multiple or marked files, you specify a directory
 -and new symbolic links are made in that directory
 -with the same names that the files currently have.  The default
 -suggested for the target directory depends on the value of
 -`dired-dwim-target', which see.
 -
 -For relative symlinks, use \\[dired-do-relsymlink].
 -
 -\(fn &optional ARG)" t nil)
 -
 -(autoload 'dired-do-hardlink "dired-aux" "\
 -Add names (hard links) current file or all marked (or next ARG) files.
 -When operating on just the current file, you specify the new name.
 -When operating on multiple or marked files, you specify a directory
 -and new hard links are made in that directory
 -with the same names that the files currently have.  The default
 -suggested for the target directory depends on the value of
 -`dired-dwim-target', which see.
 -
 -\(fn &optional ARG)" t nil)
 -
 -(autoload 'dired-do-rename "dired-aux" "\
 -Rename current file or all marked (or next ARG) files.
 -When renaming just the current file, you specify the new name.
 -When renaming multiple or marked files, you specify a directory.
 -This command also renames any buffers that are visiting the files.
 -The default suggested for the target directory depends on the value
 -of `dired-dwim-target', which see.
 -
 -\(fn &optional ARG)" t nil)
 -
 -(autoload 'dired-do-rename-regexp "dired-aux" "\
 -Rename selected files whose names match REGEXP to NEWNAME.
 -
 -With non-zero prefix argument ARG, the command operates on the next ARG
 -files.  Otherwise, it operates on all the marked files, or the current
 -file if none are marked.
 -
 -As each match is found, the user must type a character saying
 -  what to do with it.  For directions, type \\[help-command] at that time.
 -NEWNAME may contain \\=\\<n> or \\& as in `query-replace-regexp'.
 -REGEXP defaults to the last regexp used.
 -
 -With a zero prefix arg, renaming by regexp affects the absolute file name.
 -Normally, only the non-directory part of the file name is used and changed.
 -
 -\(fn REGEXP NEWNAME &optional ARG WHOLE-NAME)" t nil)
 -
 -(autoload 'dired-do-copy-regexp "dired-aux" "\
 -Copy selected files whose names match REGEXP to NEWNAME.
 -See function `dired-do-rename-regexp' for more info.
 -
 -\(fn REGEXP NEWNAME &optional ARG WHOLE-NAME)" t nil)
 -
 -(autoload 'dired-do-hardlink-regexp "dired-aux" "\
 -Hardlink selected files whose names match REGEXP to NEWNAME.
 -See function `dired-do-rename-regexp' for more info.
 -
 -\(fn REGEXP NEWNAME &optional ARG WHOLE-NAME)" t nil)
 -
 -(autoload 'dired-do-symlink-regexp "dired-aux" "\
 -Symlink selected files whose names match REGEXP to NEWNAME.
 -See function `dired-do-rename-regexp' for more info.
 -
 -\(fn REGEXP NEWNAME &optional ARG WHOLE-NAME)" t nil)
 -
 -(autoload 'dired-upcase "dired-aux" "\
 -Rename all marked (or next ARG) files to upper case.
 -
 -\(fn &optional ARG)" t nil)
 -
 -(autoload 'dired-downcase "dired-aux" "\
 -Rename all marked (or next ARG) files to lower case.
 -
 -\(fn &optional ARG)" t nil)
 -
 -(autoload 'dired-maybe-insert-subdir "dired-aux" "\
 -Insert this subdirectory into the same dired buffer.
 -If it is already present, just move to it (type \\[dired-do-redisplay] to refresh),
 -  else inserts it at its natural place (as `ls -lR' would have done).
 -With a prefix arg, you may edit the ls switches used for this listing.
 -  You can add `R' to the switches to expand the whole tree starting at
 -  this subdirectory.
 -This function takes some pains to conform to `ls -lR' output.
 -
 -Dired remembers switches specified with a prefix arg, so that reverting
 -the buffer will not reset them.  However, using `dired-undo' to re-insert
 -or delete subdirectories can bypass this machinery.  Hence, you sometimes
 -may have to reset some subdirectory switches after a `dired-undo'.
 -You can reset all subdirectory switches to the default using
 -\\<dired-mode-map>\\[dired-reset-subdir-switches].
 -See Info node `(emacs)Subdir switches' for more details.
 -
 -\(fn DIRNAME &optional SWITCHES NO-ERROR-IF-NOT-DIR-P)" t nil)
 -
 -(autoload 'dired-insert-subdir "dired-aux" "\
 -Insert this subdirectory into the same Dired buffer.
 -If it is already present, overwrite the previous entry;
 -  otherwise, insert it at its natural place (as `ls -lR' would
 -  have done).
 -With a prefix arg, you may edit the `ls' switches used for this listing.
 -  You can add `R' to the switches to expand the whole tree starting at
 -  this subdirectory.
 -This function takes some pains to conform to `ls -lR' output.
 -
 -\(fn DIRNAME &optional SWITCHES NO-ERROR-IF-NOT-DIR-P)" t nil)
 -
 -(autoload 'dired-prev-subdir "dired-aux" "\
 -Go to previous subdirectory, regardless of level.
 -When called interactively and not on a subdir line, go to this subdir's line.
 -
 -\(fn ARG &optional NO-ERROR-IF-NOT-FOUND NO-SKIP)" t nil)
 -
 -(autoload 'dired-goto-subdir "dired-aux" "\
 -Go to end of header line of DIR in this dired buffer.
 -Return value of point on success, otherwise return nil.
 -The next char is either \\n, or \\r if DIR is hidden.
 -
 -\(fn DIR)" t nil)
 -
 -(autoload 'dired-mark-subdir-files "dired-aux" "\
 -Mark all files except `.' and `..' in current subdirectory.
 -If the Dired buffer shows multiple directories, this command
 -marks the files listed in the subdirectory that point is in.
 -
 -\(fn)" t nil)
 -
 -(autoload 'dired-kill-subdir "dired-aux" "\
 -Remove all lines of current subdirectory.
 -Lower levels are unaffected.
 -
 -\(fn &optional REMEMBER-MARKS)" t nil)
 -
 -(autoload 'dired-tree-up "dired-aux" "\
 -Go up ARG levels in the dired tree.
 -
 -\(fn ARG)" t nil)
 -
 -(autoload 'dired-tree-down "dired-aux" "\
 -Go down in the dired tree.
 -
 -\(fn)" t nil)
 -
 -(autoload 'dired-hide-subdir "dired-aux" "\
 -Hide or unhide the current subdirectory and move to next directory.
 -Optional prefix arg is a repeat factor.
 -Use \\[dired-hide-all] to (un)hide all directories.
 -
 -\(fn ARG)" t nil)
 -
 -(autoload 'dired-hide-all "dired-aux" "\
 -Hide all subdirectories, leaving only their header lines.
 -If there is already something hidden, make everything visible again.
 -Use \\[dired-hide-subdir] to (un)hide a particular subdirectory.
 -
 -\(fn &optional IGNORED)" t nil)
 -
 -(autoload 'dired-isearch-filenames-setup "dired-aux" "\
 -Set up isearch to search in Dired file names.
 -Intended to be added to `isearch-mode-hook'.
 -
 -\(fn)" nil nil)
 -
 -(autoload 'dired-isearch-filenames "dired-aux" "\
 -Search for a string using Isearch only in file names in the Dired buffer.
 -
 -\(fn)" t nil)
 -
 -(autoload 'dired-isearch-filenames-regexp "dired-aux" "\
 -Search for a regexp using Isearch only in file names in the Dired buffer.
 -
 -\(fn)" t nil)
 -
 -(autoload 'dired-do-isearch "dired-aux" "\
 -Search for a string through all marked files using Isearch.
 -
 -\(fn)" t nil)
 -
 -(autoload 'dired-do-isearch-regexp "dired-aux" "\
 -Search for a regexp through all marked files using Isearch.
 -
 -\(fn)" t nil)
 -
 -(autoload 'dired-do-search "dired-aux" "\
 -Search through all marked files for a match for REGEXP.
 -Stops when a match is found.
 -To continue searching for next match, use command \\[tags-loop-continue].
 -
 -\(fn REGEXP)" t nil)
 -
 -(autoload 'dired-do-query-replace-regexp "dired-aux" "\
 -Do `query-replace-regexp' of FROM with TO, on all marked files.
 -Third arg DELIMITED (prefix arg) means replace only word-delimited matches.
 -If you exit (\\[keyboard-quit], RET or q), you can resume the query replace
 -with the command \\[tags-loop-continue].
 -
 -\(fn FROM TO &optional DELIMITED)" t nil)
 -
 -(autoload 'dired-do-find-regexp "dired-aux" "\
 -Find all matches for REGEXP in all marked files, recursively.
 -
 -\(fn REGEXP)" t nil)
 -
 -(autoload 'dired-do-find-regexp-and-replace "dired-aux" "\
 -Replace matches of FROM with TO, in all marked files, recursively.
 -
 -\(fn FROM TO)" t nil)
 -
 -(autoload 'dired-show-file-type "dired-aux" "\
 -Print the type of FILE, according to the `file' command.
 -If you give a prefix to this command, and FILE is a symbolic
 -link, then the type of the file linked to by FILE is printed
 -instead.
 -
 -\(fn FILE &optional DEREF-SYMLINKS)" t nil)
 -
 -;;;***
 -\f
 -;;;### (autoloads nil "dired-x" "dired-x.el" "f00ad5ec7383d017263855ad8add60a3")
 -;;; Generated autoloads from dired-x.el
 -
 -(autoload 'dired-jump "dired-x" "\
 -Jump to Dired buffer corresponding to current buffer.
 -If in a file, Dired the current directory and move to file's line.
 -If in Dired already, pop up a level and goto old directory's line.
 -In case the proper Dired file line cannot be found, refresh the dired
 -buffer and try again.
 -When OTHER-WINDOW is non-nil, jump to Dired buffer in other window.
 -Interactively with prefix argument, read FILE-NAME and
 -move to its line in dired.
 -
 -\(fn &optional OTHER-WINDOW FILE-NAME)" t nil)
 -
 -(autoload 'dired-jump-other-window "dired-x" "\
 -Like \\[dired-jump] (`dired-jump') but in other window.
 -
 -\(fn &optional FILE-NAME)" t nil)
 -
 -(autoload 'dired-do-relsymlink "dired-x" "\
 -Relative symlink all marked (or next ARG) files into a directory.
 -Otherwise make a relative symbolic link to the current file.
 -This creates relative symbolic links like
 -
 -    foo -> ../bar/foo
 -
 -not absolute ones like
 -
 -    foo -> /ugly/file/name/that/may/change/any/day/bar/foo
 -
 -For absolute symlinks, use \\[dired-do-symlink].
 -
 -\(fn &optional ARG)" t nil)
 -
 -;;;***
 -\f
 -;;; End of automatically extracted autoloads.
 -
  (provide 'dired)
  
  (run-hooks 'dired-load-hook)          ; for your customizations
diff --combined lisp/net/tramp-sh.el
index 402e1cc333272485a5ec920febe7d013db20940f,9fa46109a5a1c852fa8436db83648ab8114fcd12..7260107d0f79a50cb499a86c09239645d4b8dc3c
@@@ -32,6 -32,7 +32,6 @@@
  (eval-when-compile
    (require 'cl)
    (require 'dired))
 -(defvar directory-sep-char)
  (defvar tramp-gw-tunnel-method)
  (defvar tramp-gw-socks-method)
  (defvar vc-handled-backends)
@@@ -284,15 -285,6 +284,15 @@@ The string is used in `tramp-methods'."
      (tramp-remote-shell-args    ("-c"))
      (tramp-connection-timeout   10)))
  ;;;###tramp-autoload
 +(add-to-list
 + 'tramp-methods
 + '("sg"
 +   (tramp-login-program        "sg")
 +   (tramp-login-args           (("-") ("%u")))
 +   (tramp-remote-shell         "/bin/sh")
 +   (tramp-remote-shell-args    ("-c"))
 +   (tramp-connection-timeout   10)))
 +;;;###tramp-autoload
  (add-to-list 'tramp-methods
    '("sudo"
      (tramp-login-program        "sudo")
      (tramp-remote-shell-args    ("-c"))
      (tramp-connection-timeout   10)))
  ;;;###tramp-autoload
 +(add-to-list 'tramp-methods
 +  '("doas"
 +    (tramp-login-program        "doas")
 +    (tramp-login-args           (("-u" "%u") ("-s")))
 +    (tramp-remote-shell         "/bin/sh")
 +    (tramp-remote-shell-args    ("-c"))
 +    (tramp-connection-timeout   10)))
 +;;;###tramp-autoload
  (add-to-list 'tramp-methods
    '("ksu"
      (tramp-login-program        "ksu")
      (tramp-remote-shell-args    ("-c"))
      (tramp-copy-program         "pscp")
      (tramp-copy-args            (("-l" "%u") ("-P" "%p") ("-sftp") ("-p" "%k")
 -                               ("-q") ("-r")))
 -    (tramp-copy-keep-date       t)
 -    (tramp-copy-recursive       t)))
 +                               ("-q")))
 +    (tramp-copy-keep-date       t)))
  ;;;###tramp-autoload
  (add-to-list 'tramp-methods
    '("fcp"
  
  ;;;###tramp-autoload
  (add-to-list 'tramp-default-user-alist
 -           `(,(concat "\\`" (regexp-opt '("su" "sudo" "ksu")) "\\'")
 +           `(,(concat "\\`" (regexp-opt '("su" "sudo" "doas" "ksu")) "\\'")
               nil "root"))
  ;; Do not add "ssh" based methods, otherwise ~/.ssh/config would be ignored.
  ;; Do not add "plink" based methods, they ask interactively for the user.
    '((tramp-parse-passwd "/etc/passwd"))
    "Default list of (FUNCTION FILE) pairs to be examined for su methods.")
  
 +;;;###tramp-autoload
 +(defconst tramp-completion-function-alist-sg
 +  '((tramp-parse-etc-group "/etc/group"))
 +  "Default list of (FUNCTION FILE) pairs to be examined for sg methods.")
 +
  ;;;###tramp-autoload
  (defconst tramp-completion-function-alist-putty
    `((tramp-parse-putty
       ,(if (memq system-type '(windows-nt))
          "HKEY_CURRENT_USER\\Software\\SimonTatham\\PuTTY\\Sessions"
        "~/.putty/sessions")))
 -  "Default list of (FUNCTION REGISTRY) pairs to be examined for putty sessions.")
 + "Default list of (FUNCTION REGISTRY) pairs to be examined for putty sessions.")
  
  ;;;###tramp-autoload
  (eval-after-load 'tramp
       (tramp-set-completion-function "nc" tramp-completion-function-alist-telnet)
       (tramp-set-completion-function "su" tramp-completion-function-alist-su)
       (tramp-set-completion-function "sudo" tramp-completion-function-alist-su)
 +     (tramp-set-completion-function "doas" tramp-completion-function-alist-su)
       (tramp-set-completion-function "ksu" tramp-completion-function-alist-su)
 +     (tramp-set-completion-function "sg" tramp-completion-function-alist-sg)
       (tramp-set-completion-function
        "krlogin" tramp-completion-function-alist-rsh)
       (tramp-set-completion-function "plink" tramp-completion-function-alist-ssh)
  ;; "getconf PATH" yields:
  ;; HP-UX: /usr/bin:/usr/ccs/bin:/opt/ansic/bin:/opt/langtools/bin:/opt/fortran/bin
  ;; Solaris: /usr/xpg4/bin:/usr/ccs/bin:/usr/bin:/opt/SUNWspro/bin
 -;; GNU/Linux (Debian, Suse): /bin:/usr/bin
 +;; GNU/Linux (Debian, Suse, RHEL): /bin:/usr/bin
  ;; FreeBSD: /usr/bin:/bin:/usr/sbin:/sbin: - beware trailing ":"!
  ;; Darwin: /usr/bin:/bin:/usr/sbin:/sbin
  ;; IRIX64: /usr/bin
@@@ -542,6 -520,7 +542,7 @@@ as given in your `~/.profile'.
  (defcustom tramp-remote-process-environment
    `("TMOUT=0" "LC_CTYPE=''"
      ,(format "TERM=%s" tramp-terminal-type)
+     "EMACS=t" ;; Deprecated; remove this line once Bash 4.4-or-later is common.
      ,(format "INSIDE_EMACS='%s,tramp:%s'" emacs-version tramp-version)
      "CDPATH=" "HISTORY=" "MAIL=" "MAILCHECK=" "MAILPATH=" "PAGER=cat"
      "autocorrect=" "correct=")
@@@ -1008,7 -987,10 +1009,7 @@@ of command line."
      (directory-files . tramp-handle-directory-files)
      (directory-files-and-attributes
       . tramp-sh-handle-directory-files-and-attributes)
 -    ;; `dired-call-process' performed by default handler.
      (dired-compress-file . tramp-sh-handle-dired-compress-file)
 -    (dired-recursive-delete-directory
 -     . tramp-sh-handle-dired-recursive-delete-directory)
      (dired-uncache . tramp-handle-dired-uncache)
      (expand-file-name . tramp-sh-handle-expand-file-name)
      (file-accessible-directory-p . tramp-handle-file-accessible-directory-p)
      ;; `get-file-buffer' performed by default handler.
      (insert-directory . tramp-sh-handle-insert-directory)
      (insert-file-contents . tramp-handle-insert-file-contents)
 -    (insert-file-contents-literally
 -     . tramp-sh-handle-insert-file-contents-literally)
      (load . tramp-handle-load)
      (make-auto-save-file-name . tramp-handle-make-auto-save-file-name)
      (make-directory . tramp-sh-handle-make-directory)
      (shell-command . tramp-handle-shell-command)
      (start-file-process . tramp-sh-handle-start-file-process)
      (substitute-in-file-name . tramp-handle-substitute-in-file-name)
 -    (unhandled-file-name-directory . tramp-handle-unhandled-file-name-directory)
 +    (unhandled-file-name-directory . ignore)
      (vc-registered . tramp-sh-handle-vc-registered)
      (verify-visited-file-modtime . tramp-sh-handle-verify-visited-file-modtime)
      (write-region . tramp-sh-handle-write-region))
@@@ -1165,8 -1149,10 +1166,8 @@@ target of the symlink differ.
                   (format "tramp_perl_file_truename %s"
                           (tramp-shell-quote-argument localname)))))
  
 -         ;; Do it yourself.  We bind `directory-sep-char' here for
 -         ;; XEmacs on Windows, which would otherwise use backslash.
 -         (t (let ((directory-sep-char ?/)
 -                  (steps (tramp-compat-split-string localname "/"))
 +         ;; Do it yourself.
 +         (t (let ((steps (split-string localname "/" 'omit))
                    (thisstep nil)
                    (numchase 0)
                    ;; Don't make the following value larger than
                              symlink-target))
                           (setq symlink-target localname))
                         (setq steps
 -                             (append (tramp-compat-split-string
 -                                      symlink-target "/")
 -                                     steps)))
 +                             (append
 +                              (split-string symlink-target "/" 'omit) steps)))
                        (t
                         ;; It's a file.
                         (setq result (cons thisstep result)))))
             res-gid
             ;; 4. Last access time, as a list of integers.  Normally
             ;; this would be in the same format as `current-time', but
 -           ;; the subseconds part is not currently implemented, and (0
 -           ;; 0) denotes an unknown time.
 +           ;; the subseconds part is not currently implemented, and
 +         ;; (0 0) denotes an unknown time.
             ;; 5. Last modification time, likewise.
             ;; 6. Last status change time, likewise.
             '(0 0) '(0 0) '(0 0)               ;CCC how to find out?
             ;; 10. Inode number.
             res-inode
             ;; 11. Device number.  Will be replaced by a virtual device number.
 -           -1
 -           ))))))
 +           -1))))))
  
  (defun tramp-do-file-attributes-with-perl
    (vec localname &optional id-format)
               (attr (file-attributes f))
               ;; '(-1 65535) means file doesn't exists yet.
               (modtime (or (nth 5 attr) '(-1 65535))))
 -        (when (boundp 'last-coding-system-used)
 -          (setq coding-system-used (symbol-value 'last-coding-system-used)))
 +        (setq coding-system-used last-coding-system-used)
          ;; We use '(0 0) as a don't-know value.  See also
          ;; `tramp-do-file-attributes-with-ls'.
          (if (not (equal modtime '(0 0)))
              (setq attr (buffer-substring (point) (point-at-eol))))
            (tramp-set-file-property
             v localname "visited-file-modtime-ild" attr))
 -        (when (boundp 'last-coding-system-used)
 -          (set 'last-coding-system-used coding-system-used))
 +        (setq last-coding-system-used coding-system-used)
          nil)))))
  
  ;; This function makes the same assumption as
@@@ -1474,7 -1464,7 +1475,7 @@@ of.
        ;; connection.
        (if (or (not f)
              (eq (visited-file-modtime) 0)
 -            (not (tramp-file-name-handler 'file-remote-p f nil 'connected)))
 +            (not (file-remote-p f nil 'connected)))
          t
        (with-parsed-tramp-file-name f nil
          (let* ((remote-file-name-inhibit-cache t)
      ;; FIXME: extract the proper text from chmod's stderr.
      (tramp-barf-unless-okay
       v
 -     (format "chmod %s %s"
 -           (tramp-compat-decimal-to-octal mode)
 -           (tramp-shell-quote-argument localname))
 +     (format "chmod %o %s" mode (tramp-shell-quote-argument localname))
       "Error while changing file's mode %s" filename)))
  
  (defun tramp-sh-handle-set-file-times (filename &optional time)
    "Like `set-file-times' for Tramp files."
 -  (if (tramp-tramp-file-p filename)
 -      (with-parsed-tramp-file-name filename nil
 -      (when (tramp-get-remote-touch v)
 -        (tramp-flush-file-property v (file-name-directory localname))
 -        (tramp-flush-file-property v localname)
 -        (let ((time (if (or (null time) (equal time '(0 0)))
 -                        (current-time)
 -                      time))
 -              ;; With GNU Emacs, `format-time-string' has an
 -              ;; optional parameter UNIVERSAL.  This is preferred,
 -              ;; because we could handle the case when the remote
 -              ;; host is located in a different time zone as the
 -              ;; local host.
 -              (utc (not (featurep 'xemacs))))
 -          (tramp-send-command-and-check
 -           v (format
 -              "%s %s %s %s"
 -              (if utc "env TZ=UTC" "")
 -              (tramp-get-remote-touch v)
 -              (if (tramp-get-connection-property v "touch-t" nil)
 -                  (format "-t %s"
 -                          (if utc
 -                              (format-time-string "%Y%m%d%H%M.%S" time t)
 -                            (format-time-string "%Y%m%d%H%M.%S" time)))
 -                "")
 -              (tramp-shell-quote-argument localname))))))
 -
 -    ;; We handle also the local part, because in older Emacsen,
 -    ;; without `set-file-times', this function is an alias for this.
 -    ;; We are local, so we don't need the UTC settings.
 -    (zerop
 -     (tramp-call-process
 -      nil "touch" nil nil nil "-t"
 -      (format-time-string "%Y%m%d%H%M.%S" time)
 -      (tramp-shell-quote-argument filename)))))
 +  (with-parsed-tramp-file-name filename nil
 +    (when (tramp-get-remote-touch v)
 +      (tramp-flush-file-property v (file-name-directory localname))
 +      (tramp-flush-file-property v localname)
 +      (let ((time (if (or (null time) (equal time '(0 0)))
 +                    (current-time)
 +                  time)))
 +      (tramp-send-command-and-check
 +       v (format
 +          "env TZ=UTC %s %s %s"
 +          (tramp-get-remote-touch v)
 +          (if (tramp-get-connection-property v "touch-t" nil)
 +              (format "-t %s" (format-time-string "%Y%m%d%H%M.%S" time t))
 +            "")
 +          (tramp-shell-quote-argument localname)))))))
  
  (defun tramp-set-file-uid-gid (filename &optional uid gid)
    "Set the ownership for FILENAME.
@@@ -1642,7 -1654,8 +1643,7 @@@ be non-negative integers.
          (goto-char (point-max))
          (delete-blank-lines)
          (when (> (point-max) (point-min))
 -          (tramp-compat-funcall
 -           'substring-no-properties (buffer-string))))))))
 +          (substring-no-properties (buffer-string))))))))
  
  (defun tramp-sh-handle-set-file-acl (filename acl-string)
    "Like `set-file-acl' for Tramp files."
                  (when cache-hit (list cache-hit))))
              ;; We cannot use a length of 0, because file properties
              ;; for "foo" and "foo/" are identical.
 -            (tramp-compat-number-sequence (length filename) 1 -1)))))
 +            (number-sequence (length filename) 1 -1)))))
  
           ;; Cache expired or no matching cache entry found so we need
           ;; to perform a remote operation.
                    (format "tramp_perl_file_name_all_completions %s %s %d"
                            (tramp-shell-quote-argument localname)
                            (tramp-shell-quote-argument filename)
 -                          (if (symbol-value
 -                             ;; `read-file-name-completion-ignore-case'
 -                             ;; is introduced with Emacs 22.1.
 -                             (if (boundp
 -                                  'read-file-name-completion-ignore-case)
 -                                 'read-file-name-completion-ignore-case
 -                               'completion-ignore-case))
 -                            1 0)))
 +                          (if read-file-name-completion-ignore-case 1 0)))
  
                (format (concat
                         "(cd %s 2>&1 && (%s -a %s 2>/dev/null"
@@@ -2039,18 -2059,19 +2040,18 @@@ tramp-sh-handle-file-name-all-completio
      (tramp-do-copy-or-rename-file
       'copy filename newname ok-if-already-exists keep-date
       preserve-uid-gid preserve-extended-attributes))
 -   ;; Compat section.
 +   ;; Compat section.  PRESERVE-EXTENDED-ATTRIBUTES has been
 +   ;; introduced with Emacs 24.1 (as PRESERVE-SELINUX-CONTEXT), and
 +   ;; renamed in Emacs 24.3.
     (preserve-extended-attributes
      (tramp-run-real-handler
       'copy-file
       (list filename newname ok-if-already-exists keep-date
           preserve-uid-gid preserve-extended-attributes)))
 -   (preserve-uid-gid
 -    (tramp-run-real-handler
 -     'copy-file
 -     (list filename newname ok-if-already-exists keep-date preserve-uid-gid)))
     (t
      (tramp-run-real-handler
 -     'copy-file (list filename newname ok-if-already-exists keep-date)))))
 +     'copy-file
 +     (list filename newname ok-if-already-exists keep-date preserve-uid-gid)))))
  
  (defun tramp-sh-handle-copy-directory
    (dirname newname &optional keep-date parents copy-contents)
    (if (or (tramp-tramp-file-p filename)
            (tramp-tramp-file-p newname))
        (tramp-do-copy-or-rename-file
 -       'rename filename newname ok-if-already-exists t t)
 +       'rename filename newname ok-if-already-exists
 +       'keep-time 'preserve-uid-gid)
      (tramp-run-real-handler
       'rename-file (list filename newname ok-if-already-exists))))
  
@@@ -2272,11 -2292,11 +2273,11 @@@ the uid and gid from FILENAME.
                            op))))
             (localname1
              (if t1
 -                (tramp-file-name-handler 'file-remote-p filename 'localname)
 +                (file-remote-p filename 'localname)
                filename))
             (localname2
              (if t2
 -                (tramp-file-name-handler 'file-remote-p newname 'localname)
 +                (file-remote-p newname 'localname)
                newname))
             (prefix (file-remote-p (if t1 filename newname)))
               cmd-result)
                       (zerop
                        (logand
                         (file-modes (file-name-directory localname1))
 -                       (tramp-compat-octal-to-decimal "1000"))))
 +                       (string-to-number "1000" 8))))
                   (file-writable-p (file-name-directory localname2))
                   (or (file-directory-p localname2)
                       (file-writable-p localname2))))
            (if (eq op 'copy)
 -              (tramp-compat-copy-file
 +              (copy-file
                 localname1 localname2 ok-if-already-exists
                 keep-date preserve-uid-gid)
              (tramp-run-real-handler
                      ;; Since this does not work reliable, we also
                      ;; give read permissions.
                      (set-file-modes
 -                     (concat prefix tmpfile)
 -                     (tramp-compat-octal-to-decimal "0777"))
 +                     (concat prefix tmpfile) (string-to-number "0777" 8))
                      (tramp-set-file-uid-gid
                       (concat prefix tmpfile)
                       (tramp-get-local-uid 'integer)
                       (tramp-get-local-gid 'integer)))
                     (t2
                      (if (eq op 'copy)
 -                        (tramp-compat-copy-file
 +                        (copy-file
                           localname1 tmpfile t
                           keep-date preserve-uid-gid)
                        (tramp-run-real-handler
                      ;; We must change the ownership as local user.
                      ;; Since this does not work reliable, we also
                      ;; give read permissions.
 -                    (set-file-modes
 -                     tmpfile (tramp-compat-octal-to-decimal "0777"))
 +                    (set-file-modes tmpfile (string-to-number "0777" 8))
                      (tramp-set-file-uid-gid
                       tmpfile
                       (tramp-get-remote-uid v 'integer)
@@@ -2434,7 -2456,7 +2435,7 @@@ The method used must be an out-of-band 
              ;; Save exit.
              (ignore-errors
                (if dir-flag
 -                  (tramp-compat-delete-directory
 +                  (delete-directory
                     (expand-file-name ".." tmpfile) 'recursive)
                  (delete-file tmpfile)))))
  
                   orig-vec 6 "%s"
                   (mapconcat 'identity (process-command p) " "))
                  (tramp-set-connection-property p "vector" orig-vec)
 -                (tramp-compat-set-process-query-on-exit-flag p nil)
 +                (set-process-query-on-exit-flag p nil)
  
                  ;; We must adapt `tramp-local-end-of-line' for
                  ;; sending the password.
        (unless (eq op 'copy)
        (if (file-regular-p filename)
            (delete-file filename)
 -        (tramp-compat-delete-directory filename 'recursive))))))
 +        (delete-directory filename 'recursive))))))
  
  (defun tramp-sh-handle-make-directory (dir &optional parents)
    "Like `make-directory' for Tramp files."
  
  ;; Dired.
  
 -;; CCC: This does not seem to be enough. Something dies when
 -;;      we try and delete two directories under Tramp :/
 -(defun tramp-sh-handle-dired-recursive-delete-directory (filename)
 -  "Recursively delete the directory given.
 -This is like `dired-recursive-delete-directory' for Tramp files."
 -  (with-parsed-tramp-file-name filename nil
 -    ;; Run a shell command 'rm -r <localname>'.
 -    ;; Code shamelessly stolen from the dired implementation and, um, hacked :)
 -    (unless (file-exists-p filename)
 -      (tramp-error v 'file-error "No such directory: %s" filename))
 -    ;; Which is better, -r or -R? (-r works for me <daniel@danann.net>).
 -    (tramp-send-command
 -     v
 -     (format "rm -rf %s" (tramp-shell-quote-argument localname))
 -     ;; Don't read the output, do it explicitly.
 -     nil t)
 -    ;; Wait for the remote system to return to us...
 -    ;; This might take a while, allow it plenty of time.
 -    (tramp-wait-for-output (tramp-get-connection-process v) 120)
 -    ;; Make sure that it worked...
 -    (tramp-flush-file-property v (file-name-directory localname))
 -    (tramp-flush-directory-property v localname)
 -    (and (file-exists-p filename)
 -       (tramp-error
 -        v 'file-error "Failed to recursively delete %s" filename))))
 +(defvar dired-compress-file-suffixes)
 +(declare-function dired-remove-file "dired-aux")
  
 -(defun tramp-sh-handle-dired-compress-file (file &rest _ok-flag)
 +(defun tramp-sh-handle-dired-compress-file (file)
    "Like `dired-compress-file' for Tramp files."
 -  ;; OK-FLAG is valid for XEmacs only, but not implemented.
    ;; Code stolen mainly from dired-aux.el.
    (with-parsed-tramp-file-name file nil
      (tramp-flush-file-property v localname)
      (save-excursion
 -      (let ((suffixes
 -           (if (not (featurep 'xemacs))
 -               ;; Emacs case
 -               (symbol-value 'dired-compress-file-suffixes)
 -             ;; XEmacs has `dired-compression-method-alist', which is
 -             ;; transformed into `dired-compress-file-suffixes' structure.
 -             (mapcar
 -              (lambda (x)
 -                (list (concat (regexp-quote (nth 1 x)) "\\'")
 -                      nil
 -                      (mapconcat 'identity (nth 3 x) " ")))
 -              (symbol-value 'dired-compression-method-alist))))
 +      (let ((suffixes dired-compress-file-suffixes)
            suffix)
        ;; See if any suffix rule matches this file name.
        (while suffixes
                 (when (tramp-send-command-and-check
                        v (concat (nth 2 suffix) " "
                                  (tramp-shell-quote-argument localname)))
 -                 ;; `dired-remove-file' is not defined in XEmacs.
 -                 (tramp-compat-funcall 'dired-remove-file file)
 +                 (dired-remove-file file)
                   (string-match (car suffix) file)
                   (concat (substring file 0 (match-beginning 0))))))
              (t
                 (when (tramp-send-command-and-check
                        v (concat "gzip -f "
                                  (tramp-shell-quote-argument localname)))
 -                 ;; `dired-remove-file' is not defined in XEmacs.
 -                 (tramp-compat-funcall 'dired-remove-file file)
 +                 (dired-remove-file file)
                   (cond ((file-exists-p (concat file ".gz"))
                          (concat file ".gz"))
                         ((file-exists-p (concat file ".z"))
          (narrow-to-region (point) (point))
          ;; We cannot use `insert-buffer-substring' because the Tramp
          ;; buffer changes its contents before insertion due to calling
 -        ;; `expand-file' and alike.
 +        ;; `expand-file-name' and alike.
          (insert
           (with-current-buffer (tramp-get-buffer v)
             (buffer-string)))
          ;; Decode the output, it could be multibyte.
          (decode-coding-region
           beg (point-max)
 -         (or file-name-coding-system
 -             (and (boundp 'default-file-name-coding-system)
 -                  (symbol-value 'default-file-name-coding-system))))
 +         (or file-name-coding-system default-file-name-coding-system))
  
          ;; The inserted file could be from somewhere else.
          (when (and (not wildcard) (not full-directory-p))
@@@ -2869,10 -2930,9 +2870,10 @@@ the result will be a local, non-Tramp, 
    ;; Unless NAME is absolute, concat DIR and NAME.
    (unless (file-name-absolute-p name)
      (setq name (concat (file-name-as-directory dir) name)))
 -  ;; If NAME is not a Tramp file, run the real handler.
 +  ;; If connection is not established yet, run the real handler.
    (if (not (tramp-connectable-p name))
 -      (tramp-run-real-handler 'expand-file-name (list name nil))
 +      (tramp-drop-volume-letter
 +       (tramp-run-real-handler 'expand-file-name (list name nil)))
      ;; Dissect NAME.
      (with-parsed-tramp-file-name name nil
        (unless (tramp-run-real-handler 'file-name-absolute-p (list localname))
        (while (string-match "//" localname)
        (setq localname (replace-match "/" t t localname)))
        ;; No tilde characters in file name, do normal
 -      ;; `expand-file-name' (this does "/./" and "/../").  We bind
 -      ;; `directory-sep-char' here for XEmacs on Windows, which would
 -      ;; otherwise use backslash.  `default-directory' is bound,
 -      ;; because on Windows there would be problems with UNC shares or
 -      ;; Cygwin mounts.
 -      (let ((directory-sep-char ?/)
 -          (default-directory (tramp-compat-temporary-file-directory)))
 +      ;; `expand-file-name' (this does "/./" and "/../").
 +      ;; `default-directory' is bound, because on Windows there would
 +      ;; be problems with UNC shares or Cygwin mounts.
 +      (let ((default-directory (tramp-compat-temporary-file-directory)))
        (tramp-make-tramp-file-name
         method user host
         (tramp-drop-volume-letter
                        ;; Send the command.
                        (tramp-send-command v command nil t) ; nooutput
                      ;; Check, whether a pty is associated.
 -                    (unless (tramp-compat-process-get
 +                    (unless (process-get
                               (tramp-get-connection-process v) 'remote-tty)
                        (tramp-error
                         v 'file-error
                    ;; process.  We ignore errors, because the process
                    ;; could have finished already.
                    (ignore-errors
 -                    (tramp-compat-set-process-query-on-exit-flag p t)
 +                    (set-process-query-on-exit-flag p t)
                      (set-marker (process-mark p) (point)))
                    ;; Return process.
                    p))))
        ;; because the remote process could have changed them.
        (when tmpinput (delete-file tmpinput))
  
 -      ;; `process-file-side-effects' has been introduced with GNU
 -      ;; Emacs 23.2.  If set to nil, no remote file will be changed
 -      ;; by `program'.  If it doesn't exist, we assume its default
 -      ;; value t.
 -      (unless (and (boundp 'process-file-side-effects)
 -                 (not (symbol-value 'process-file-side-effects)))
 +      (unless process-file-side-effects
          (tramp-flush-directory-property v ""))
  
        ;; Return exit status.
           ;; `copy-file' handles direct copy and out-of-band methods.
           ((or (tramp-local-host-p v)
                (tramp-method-out-of-band-p v size))
 -          (copy-file filename tmpfile t t))
 +          (copy-file filename tmpfile 'ok-if-already-exists 'keep-time))
  
           ;; Use inline encoding for file transfer.
           (rem-enc
        (run-hooks 'tramp-handle-file-local-copy-hook)
        tmpfile)))
  
 -;; This is needed for XEmacs only.  Code stolen from files.el.
 -(defun tramp-sh-handle-insert-file-contents-literally
 -  (filename &optional visit beg end replace)
 -  "Like `insert-file-contents-literally' for Tramp files."
 -  (let ((format-alist nil)
 -      (after-insert-file-functions nil)
 -      (coding-system-for-read 'no-conversion)
 -      (coding-system-for-write 'no-conversion)
 -      (find-buffer-file-type-function
 -       (if (fboundp 'find-buffer-file-type)
 -           (symbol-function 'find-buffer-file-type)
 -         nil))
 -      (inhibit-file-name-handlers
 -       '(epa-file-handler image-file-handler jka-compr-handler))
 -      (inhibit-file-name-operation 'insert-file-contents))
 -    (unwind-protect
 -      (progn
 -        (fset 'find-buffer-file-type (lambda (_filename) t))
 -        (insert-file-contents filename visit beg end replace))
 -      ;; Save exit.
 -      (if find-buffer-file-type-function
 -        (fset 'find-buffer-file-type find-buffer-file-type-function)
 -      (fmakunbound 'find-buffer-file-type)))))
 -
  ;; CCC grok LOCKNAME
  (defun tramp-sh-handle-write-region
    (start end filename &optional append visit lockname confirm)
      ;;    (error
      ;;     "tramp-sh-handle-write-region: LOCKNAME must be nil or equal FILENAME"))
  
 -    ;; XEmacs takes a coding system as the seventh argument, not `confirm'.
 -    (when (and (not (featurep 'xemacs)) confirm (file-exists-p filename))
 +    (when (and confirm (file-exists-p filename))
        (unless (y-or-n-p (format "File %s exists; overwrite anyway? " filename))
        (tramp-error v 'file-error "File not overwritten")))
  
 -    (let ((uid (or (nth 2 (tramp-compat-file-attributes filename 'integer))
 +    (let ((uid (or (nth 2 (file-attributes filename 'integer))
                   (tramp-get-remote-uid v 'integer)))
 -        (gid (or (nth 3 (tramp-compat-file-attributes filename 'integer))
 +        (gid (or (nth 3 (file-attributes filename 'integer))
                   (tramp-get-remote-gid v 'integer))))
  
        (if (and (tramp-local-host-p v)
               (signal (car err) (cdr err))))
  
            ;; Now, `last-coding-system-used' has the right value.  Remember it.
 -          (when (boundp 'last-coding-system-used)
 -            (setq coding-system-used
 -                  (symbol-value 'last-coding-system-used))))
 +          (setq coding-system-used last-coding-system-used))
  
          ;; The permissions of the temporary file should be set.  If
          ;; FILENAME does not exist (eq modes nil) it has been
          (when modes
            (set-file-modes
             tmpfile
 -           (logior (or modes 0) (tramp-compat-octal-to-decimal "0400"))))
 +           (logior (or modes 0) (string-to-number "0400" 8))))
  
          ;; This is a bit lengthy due to the different methods
          ;; possible for file transfer.  First, we check whether the
        (let (last-coding-system-used (need-chown t))
        ;; Set file modification time.
        (when (or (eq visit t) (stringp visit))
 -          (let ((file-attr (tramp-compat-file-attributes filename 'integer)))
 +          (let ((file-attr (file-attributes filename 'integer)))
              (set-visited-file-modtime
               ;; We must pass modtime explicitly, because FILENAME can
               ;; be different from (buffer-file-name), f.e. if
  ;; any other remote command.
  (defun tramp-sh-handle-vc-registered (file)
    "Like `vc-registered' for Tramp files."
 -  (tramp-compat-with-temp-message ""
 +  (with-temp-message ""
      (with-parsed-tramp-file-name file nil
        (with-tramp-progress-reporter
          v 3 (format-message "Checking `vc-registered' for %s" file)
@@@ -3674,12 -3769,7 +3675,12 @@@ Fall back to normal file name handler i
                (concat "create,modify,move,moved_from,moved_to,move_self,"
                        "delete,delete_self,ignored"))
               ((memq 'attribute-change flags) "attrib,ignored"))
 -            sequence `(,command "-mq" "-e" ,events ,localname)))
 +            sequence `(,command "-mq" "-e" ,events ,localname)
 +            ;; Make events a list of symbols.
 +            events
 +            (mapcar
 +             (lambda (x) (intern-soft (replace-regexp-in-string "_" "-" x)))
 +             (split-string events "," 'omit))))
         ;; None.
         (t (tramp-error
           v 'file-notify-error
           (mapconcat 'identity sequence " "))
        (tramp-message v 6 "Run `%s', %S" (mapconcat 'identity sequence " ") p)
        (tramp-set-connection-property p "vector" v)
 -      ;; Needed for `tramp-sh-gvfs-monitor-dir-process-filter'.
 -      (tramp-compat-process-put p 'events events)
 -      (tramp-compat-process-put p 'watch-name localname)
 -      (tramp-compat-set-process-query-on-exit-flag p nil)
 +      ;; Needed for process filter.
 +      (process-put p 'events events)
 +      (process-put p 'watch-name localname)
 +      (set-process-query-on-exit-flag p nil)
        (set-process-filter p filter)
        ;; There might be an error if the monitor is not supported.
        ;; Give the filter a chance to read the output.
  (defun tramp-sh-gvfs-monitor-dir-process-filter (proc string)
    "Read output from \"gvfs-monitor-dir\" and add corresponding \
  file-notify events."
 -  (let ((remote-prefix
 +  (let ((events (process-get proc 'events))
 +      (remote-prefix
         (with-current-buffer (process-buffer proc)
           (file-remote-p default-directory)))
 -      (rest-string (tramp-compat-process-get proc 'rest-string)))
 +      (rest-string (process-get proc 'rest-string)))
      (when rest-string
        (tramp-message proc 10 "Previous string:\n%s" rest-string))
      (tramp-message proc 6 "%S\n%s" proc string)
      (setq string (concat rest-string string)
          ;; Attribute change is returned in unused wording.
 -        string (tramp-compat-replace-regexp-in-string
 +        string (replace-regexp-in-string
                  "ATTRIB CHANGED" "ATTRIBUTE_CHANGED" string))
      (when (string-match "Monitoring not supported" string)
        (delete-process proc))
             (object
              (list
               proc
 -             (intern-soft
 -              (tramp-compat-replace-regexp-in-string
 -               "_" "-" (downcase (match-string 4 string))))
 +             (list
 +              (intern-soft
 +               (replace-regexp-in-string
 +                "_" "-" (downcase (match-string 4 string)))))
               ;; File names are returned as absolute paths.  We must
               ;; add the remote prefix.
               (concat remote-prefix file)
               (when file1 (concat remote-prefix file1)))))
        (setq string (replace-match "" nil nil string))
        ;; Remove watch when file or directory to be watched is deleted.
 -      (when (and (member (cadr object) '(moved deleted))
 -                 (string-equal
 -                  file (tramp-compat-process-get proc 'watch-name)))
 +      (when (and (member (caadr object) '(moved deleted))
 +                 (string-equal file (process-get proc 'watch-name)))
          (delete-process proc))
        ;; Usually, we would add an Emacs event now.  Unfortunately,
        ;; `unread-command-events' does not accept several events at
 -      ;; once.  Therefore, we apply the callback directly.
 -      (when (member (cadr object) (tramp-compat-process-get proc 'events))
 -        (tramp-compat-funcall 'file-notify-callback object))))
 +      ;; once.  Therefore, we apply the handler directly.
 +      (when (member (caadr object) events)
 +        (tramp-compat-funcall
 +         'file-notify-handle-event
 +         `(file-notify ,object file-notify-callback)))))
  
      ;; Save rest of the string.
      (when (zerop (length string)) (setq string nil))
      (when string (tramp-message proc 10 "Rest string:\n%s" string))
 -    (tramp-compat-process-put proc 'rest-string string)))
 +    (process-put proc 'rest-string string)))
  
  (defun tramp-sh-inotifywait-process-filter (proc string)
    "Read output from \"inotifywait\" and add corresponding file-notify events."
 -  (tramp-message proc 6 "%S\n%s" proc string)
 -  (dolist (line (split-string string "[\n\r]+" 'omit-nulls))
 -    ;; Check, whether there is a problem.
 -    (unless
 -      (string-match
 -       (concat "^[^[:blank:]]+"
 -               "[[:blank:]]+\\([^[:blank:]]+\\)+"
 -               "\\([[:blank:]]+\\([^\n\r]+\\)\\)?")
 -       line)
 -      (tramp-error proc 'file-notify-error "%s" line))
 -
 -    (let ((object
 -         (list
 -          proc
 -          (mapcar
 -           (lambda (x)
 -             (intern-soft
 -              (tramp-compat-replace-regexp-in-string "_" "-" (downcase x))))
 -           (split-string (match-string 1 line) "," 'omit-nulls))
 -          (match-string 3 line))))
 -      ;; Remove watch when file or directory to be watched is deleted.
 -      (when (equal (cadr object) 'ignored)
 -      (delete-process proc))
 -      ;; Usually, we would add an Emacs event now.  Unfortunately,
 -      ;; `unread-command-events' does not accept several events at
 -      ;; once.  Therefore, we apply the callback directly.
 -      (tramp-compat-funcall 'file-notify-callback object))))
 +  (let ((events (process-get proc 'events)))
 +    (tramp-message proc 6 "%S\n%s" proc string)
 +    (dolist (line (split-string string "[\n\r]+" 'omit))
 +      ;; Check, whether there is a problem.
 +      (unless
 +        (string-match
 +         (concat "^[^[:blank:]]+"
 +                 "[[:blank:]]+\\([^[:blank:]]+\\)+"
 +                 "\\([[:blank:]]+\\([^\n\r]+\\)\\)?")
 +         line)
 +      (tramp-error proc 'file-notify-error "%s" line))
 +
 +      (let ((object
 +           (list
 +            proc
 +            (mapcar
 +             (lambda (x)
 +               (intern-soft
 +                (replace-regexp-in-string "_" "-" (downcase x))))
 +             (split-string (match-string 1 line) "," 'omit))
 +            (match-string 3 line))))
 +      ;; Remove watch when file or directory to be watched is deleted.
 +      (when (member (caadr object) '(move-self delete-self ignored))
 +        (delete-process proc))
 +      ;; Usually, we would add an Emacs event now.  Unfortunately,
 +      ;; `unread-command-events' does not accept several events at
 +      ;; once.  Therefore, we apply the handler directly.
 +      (when (member (caadr object) events)
 +        (tramp-compat-funcall
 +         'file-notify-handle-event
 +         `(file-notify ,object file-notify-callback)))))))
  
  ;;; Internal Functions:
  
@@@ -3817,7 -3900,7 +3818,7 @@@ Only send the definition if it has not 
          vec 5 (format-message "Sending script `%s'" name)
        ;; In bash, leading TABs like in `tramp-vc-registered-read-file-names'
        ;; could result in unwanted command expansion.  Avoid this.
 -      (setq script (tramp-compat-replace-regexp-in-string
 +      (setq script (replace-regexp-in-string
                      (make-string 1 ?\t) (make-string 8 ? ) script))
        ;; The script could contain a call of Perl.  This is masked with `%s'.
        (when (and (string-match "%s" script)
@@@ -3890,7 -3973,8 +3891,7 @@@ This function expects to be in the righ
            (setq result (concat "\\" progname))))
        (unless result
        (when ignore-tilde
 -        ;; Remove all ~/foo directories from dirlist.  In XEmacs,
 -        ;; `remove' is in CL, and we want to avoid CL dependencies.
 +        ;; Remove all ~/foo directories from dirlist.
          (let (newdl d)
            (while dirlist
              (setq d (car dirlist))
@@@ -4133,36 -4217,45 +4134,36 @@@ process to set up.  VEC specifies the c
    ;; CCC this can't be the right way to do it.  Hm.
    (tramp-message vec 5 "Determining coding system")
    (with-current-buffer (process-buffer proc)
 -    (if (featurep 'mule)
 -      ;; Use MULE to select the right EOL convention for communicating
 -      ;; with the process.
 -      (let ((cs (or (and (memq 'utf-8 (coding-system-list))
 -                         (string-match "utf-?8" (tramp-get-remote-locale vec))
 -                         (cons 'utf-8 'utf-8))
 -                    (tramp-compat-funcall 'process-coding-system proc)
 -                    (cons 'undecided 'undecided)))
 -            cs-decode cs-encode)
 -        (when (symbolp cs) (setq cs (cons cs cs)))
 -        (setq cs-decode (or (car cs) 'undecided)
 -                cs-encode (or (cdr cs) 'undecided))
 -        (setq cs-encode
 -              (tramp-compat-coding-system-change-eol-conversion
 -               cs-encode
 -               (if (string-match
 -                    "^Darwin" (tramp-get-connection-property vec "uname" ""))
 -                   'mac 'unix)))
 -        (tramp-send-command vec "echo foo ; echo bar" t)
 -        (goto-char (point-min))
 -        (when (search-forward "\r" nil t)
 -          (setq cs-decode (tramp-compat-coding-system-change-eol-conversion
 -                           cs-decode 'dos)))
 -          ;; Special setting for Mac OS X.
 -          (when (and (string-match
 -                      "^Darwin" (tramp-get-connection-property vec "uname" ""))
 -                     (memq 'utf-8-hfs (coding-system-list)))
 -            (setq cs-decode 'utf-8-hfs
 -                  cs-encode 'utf-8-hfs))
 -          (tramp-compat-funcall
 -         'set-buffer-process-coding-system cs-decode cs-encode)
 -        (tramp-message
 -         vec 5 "Setting coding system to `%s' and `%s'" cs-decode cs-encode))
 -      ;; Look for ^M and do something useful if found.
 +    ;; Use MULE to select the right EOL convention for communicating
 +    ;; with the process.
 +    (let ((cs (or (and (memq 'utf-8 (coding-system-list))
 +                     (string-match "utf-?8" (tramp-get-remote-locale vec))
 +                     (cons 'utf-8 'utf-8))
 +                (process-coding-system proc)
 +                (cons 'undecided 'undecided)))
 +        cs-decode cs-encode)
 +      (when (symbolp cs) (setq cs (cons cs cs)))
 +      (setq cs-decode (or (car cs) 'undecided)
 +          cs-encode (or (cdr cs) 'undecided)
 +          cs-encode
 +          (coding-system-change-eol-conversion
 +           cs-encode
 +           (if (string-match
 +                "^Darwin" (tramp-get-connection-property vec "uname" ""))
 +               'mac 'unix)))
 +      (tramp-send-command vec "echo foo ; echo bar" t)
 +      (goto-char (point-min))
        (when (search-forward "\r" nil t)
 -      ;; We have found a ^M but cannot frob the process coding system
 -      ;; because we're running on a non-MULE Emacs.  Let's try
 -      ;; stty, instead.
 -      (tramp-send-command vec "stty -onlcr" t))))
 +      (setq cs-decode (coding-system-change-eol-conversion cs-decode 'dos)))
 +      ;; Special setting for Mac OS X.
 +      (when (and (string-match
 +                "^Darwin" (tramp-get-connection-property vec "uname" ""))
 +               (memq 'utf-8-hfs (coding-system-list)))
 +      (setq cs-decode 'utf-8-hfs
 +            cs-encode 'utf-8-hfs))
 +      (set-buffer-process-coding-system cs-decode cs-encode)
 +      (tramp-message
 +       vec 5 "Setting coding system to `%s' and `%s'" cs-decode cs-encode)))
  
    (tramp-send-command vec "set +o vi +o emacs" t)
  
    ;; Set `remote-tty' process property.
    (let ((tty (tramp-send-command-and-read vec "echo \\\"`tty`\\\"" 'noerror)))
      (unless (zerop (length tty))
 -      (tramp-compat-process-put proc 'remote-tty tty)))
 +      (process-put proc 'remote-tty tty)))
  
    ;; Dump stty settings in the traces.
    (when (>= tramp-verbose 9)
                     (copy-sequence tramp-remote-process-environment)))
        unset vars item)
      (while env
 -      (setq item (tramp-compat-split-string (car env) "="))
 +      (setq item (split-string (car env) "=" 'omit))
        (setcdr item (mapconcat 'identity (cdr item) "="))
        (if (and (stringp (cdr item)) (not (string-equal (cdr item) "")))
          (push (format "%s %s" (car item) (cdr item)) vars)
@@@ -4422,7 -4515,8 +4423,7 @@@ Goes through the list `tramp-local-codi
                               value
                               (format-spec-make
                                ?t
 -                              (tramp-file-name-handler
 -                               'file-remote-p tmpfile 'localname)))))
 +                              (file-remote-p tmpfile 'localname)))))
                      (tramp-maybe-send-script vec value name)
                      (setq rem-dec name)))
                  (tramp-message
@@@ -4618,7 -4712,7 +4619,7 @@@ Gateway hops are already opened.
        (push
         (vector
          (tramp-file-name-method hop) (tramp-file-name-user hop)
 -        (tramp-compat-funcall 'tramp-gw-open-connection vec gw hop) nil nil)
 +        (tramp-gw-open-connection vec gw hop) nil nil)
         target-alist)
        ;; For the password prompt, we need the correct values.
        ;; Therefore, we must remember the gateway vector.  But we
@@@ -4752,7 -4846,6 +4753,7 @@@ connection if a previous connection ha
        (unless (and p (processp p) (memq (process-status p) '(run open)))
  
          ;; If `non-essential' is non-nil, don't reopen a new connection.
 +        ;; This variable has been introduced with Emacs 24.1.
          (when (and (boundp 'non-essential) (symbol-value 'non-essential))
            (throw 'non-essential 'non-essential))
  
                ;; Set sentinel and query flag.
                (tramp-set-connection-property p "vector" vec)
                (set-process-sentinel p 'tramp-process-sentinel)
 -              (tramp-compat-set-process-query-on-exit-flag p nil)
 +              (set-process-query-on-exit-flag p nil)
                (setq tramp-current-connection
                      (cons (butlast (append vec nil) 2) (current-time))
                      tramp-current-host (system-name))
@@@ -5104,12 -5197,12 +5105,12 @@@ Return ATTR.
      (when (and (numberp (nth 2 attr)) (< (nth 2 attr) 0))
        (setcar (nthcdr 2 attr) -1))
      (when (and (floatp (nth 2 attr))
 -               (<= (nth 2 attr) (tramp-compat-most-positive-fixnum)))
 +               (<= (nth 2 attr) most-positive-fixnum))
        (setcar (nthcdr 2 attr) (round (nth 2 attr))))
      (when (and (numberp (nth 3 attr)) (< (nth 3 attr) 0))
        (setcar (nthcdr 3 attr) -1))
      (when (and (floatp (nth 3 attr))
 -               (<= (nth 3 attr) (tramp-compat-most-positive-fixnum)))
 +               (<= (nth 3 attr) most-positive-fixnum))
        (setcar (nthcdr 3 attr) (round (nth 3 attr))))
      ;; Convert last access time.
      (unless (listp (nth 4 attr))
      (when (< (nth 7 attr) 0)
        (setcar (nthcdr 7 attr) -1))
      (when (and (floatp (nth 7 attr))
 -               (<= (nth 7 attr) (tramp-compat-most-positive-fixnum)))
 +               (<= (nth 7 attr) most-positive-fixnum))
        (setcar (nthcdr 7 attr) (round (nth 7 attr))))
      ;; Convert file mode bits to string.
      (unless (stringp (nth 8 attr))
        (when elt1
        (setcdr elt1
                (append
 -               (tramp-compat-split-string (or default-remote-path "") ":")
 +                 (split-string (or default-remote-path "") ":" 'omit)
                 (cdr elt1)))
        (setq remote-path (delq 'tramp-default-remote-path remote-path)))
  
        (when elt2
        (setcdr elt2
                (append
 -               (tramp-compat-split-string (or own-remote-path "") ":")
 +                 (split-string (or own-remote-path "") ":" 'omit)
                 (cdr elt2)))
        (setq remote-path (delq 'tramp-own-remote-path remote-path)))
  
           "%s -t %s %s"
           result
           (format-time-string "%Y%m%d%H%M.%S")
 -         (tramp-file-name-handler 'file-remote-p tmpfile 'localname))))
 +         (file-remote-p tmpfile 'localname))))
        (delete-file tmpfile))
        result)))
  
diff --combined lisp/replace.el
index a2ce78a8bb22826f627e71e6aef87a9722b321ee,428be3c3b65856203eab516a744e0e63ee3025c7..2c6a23ae6185883ab496e0eb510c8fac201005fa
@@@ -293,7 -293,8 +293,8 @@@ As each match is found, the user must t
  what to do with it.  For directions, type \\[help-command] at that time.
  
  In Transient Mark mode, if the mark is active, operate on the contents
- of the region.  Otherwise, operate from point to the end of the buffer.
+ of the region.  Otherwise, operate from point to the end of the buffer's
+ accessible portion.
  
  Use \\<minibuffer-local-map>\\[next-history-element] \
  to pull the last incremental search string to the minibuffer
@@@ -355,7 -356,8 +356,8 @@@ As each match is found, the user must t
  what to do with it.  For directions, type \\[help-command] at that time.
  
  In Transient Mark mode, if the mark is active, operate on the contents
- of the region.  Otherwise, operate from point to the end of the buffer.
+ of the region.  Otherwise, operate from point to the end of the buffer's
+ accessible portion.
  
  Use \\<minibuffer-local-map>\\[next-history-element] \
  to pull the last incremental search regexp to the minibuffer
@@@ -452,7 -454,8 +454,8 @@@ Use `\\#&' or `\\#N' if you want a numb
  In interactive use, `\\#' in itself stands for `replace-count'.
  
  In Transient Mark mode, if the mark is active, operate on the contents
- of the region.  Otherwise, operate from point to the end of the buffer.
+ of the region.  Otherwise, operate from point to the end of the buffer's
+ accessible portion.
  
  Use \\<minibuffer-local-map>\\[next-history-element] \
  to pull the last incremental search regexp to the minibuffer
@@@ -507,7 -510,8 +510,8 @@@ each successive replacement uses the ne
  wrapping around from the last such string to the first.
  
  In Transient Mark mode, if the mark is active, operate on the contents
- of the region.  Otherwise, operate from point to the end of the buffer.
+ of the region.  Otherwise, operate from point to the end of the buffer's
+ accessible portion.
  
  Non-interactively, TO-STRINGS may be a list of replacement strings.
  
@@@ -573,7 -577,7 +577,7 @@@ replace backward
  Operates on the region between START and END (if both are nil, from point
  to the end of the buffer).  Interactively, if Transient Mark mode is
  enabled and the mark is active, operates on the contents of the region;
- otherwise from point to the end of the buffer.
+ otherwise from point to the end of the buffer's accessible portion.
  
  Use \\<minibuffer-local-map>\\[next-history-element] \
  to pull the last incremental search string to the minibuffer
@@@ -620,7 -624,8 +624,8 @@@ regexp in `search-whitespace-regexp'
  This function is not affected by `replace-character-fold'
  
  In Transient Mark mode, if the mark is active, operate on the contents
- of the region.  Otherwise, operate from point to the end of the buffer.
+ of the region.  Otherwise, operate from point to the end of the buffer's
+ accessible portion.
  
  Third arg DELIMITED (prefix arg if interactive), if non-nil, means replace
  only matches surrounded by word boundaries.  A negative prefix arg means
@@@ -1825,8 -1830,6 +1830,8 @@@ C-w to delete match and recursive edit
  C-l to clear the screen, redisplay, and offer same replacement again,
  ! to replace all remaining matches in this buffer with no more questions,
  ^ to move point back to previous match,
 +u to undo previous replacement,
 +U to undo all replacements,
  E to edit the replacement string.
  In multi-buffer replacements type `Y' to replace all remaining
  matches in all remaining buffers with no more questions,
@@@ -1856,8 -1859,6 +1861,8 @@@ in the current buffer.
      (define-key map "\C-l" 'recenter)
      (define-key map "!" 'automatic)
      (define-key map "^" 'backup)
 +    (define-key map "u" 'undo)
 +    (define-key map "U" 'undo-all)
      (define-key map "\C-h" 'help)
      (define-key map [f1] 'help)
      (define-key map [help] 'help)
@@@ -1883,7 -1884,7 +1888,7 @@@ The valid answers include `act', `skip'
  `act-and-exit', `exit', `exit-prefix', `recenter', `scroll-up',
  `scroll-down', `scroll-other-window', `scroll-other-window-down',
  `edit', `edit-replacement', `delete-and-edit', `automatic',
 -`backup', `quit', and `help'.
 +`backup', `undo', `undo-all', `quit', and `help'.
  
  This keymap is used by `y-or-n-p' as well as `query-replace'.")
  
@@@ -2137,10 -2138,6 +2142,10 @@@ It must return a string.
           (noedit nil)
           (keep-going t)
           (stack nil)
 +         (search-string-replaced nil)    ; last string matching `from-string'
 +         (next-replacement-replaced nil) ; replacement string
 +                                         ; (substituted regexp)
 +         (last-was-undo)
           (replace-count 0)
           (skip-read-only-count 0)
           (skip-filtered-count 0)
                   (match-beginning 0) (match-end 0)
                   start end search-string
                   regexp-flag delimited-flag case-fold-search backward)
 -                ;; Bind message-log-max so we don't fill up the message log
 -                ;; with a bunch of identical messages.
 +                  ;; Obtain the matched groups: needed only when
 +                  ;; regexp-flag non nil.
 +                  (when (and last-was-undo regexp-flag)
 +                    (setq last-was-undo nil
 +                          real-match-data
 +                          (save-excursion
 +                            (goto-char (match-beginning 0))
 +                            (looking-at search-string)
 +                            (match-data t real-match-data))))
 +                  ;; Matched string and next-replacement-replaced
 +                  ;; stored in stack.
 +                  (setq search-string-replaced (buffer-substring-no-properties
 +                                                (match-beginning 0)
 +                                                (match-end 0))
 +                        next-replacement-replaced
 +                        (query-replace-descr
 +                         (save-match-data
 +                           (set-match-data real-match-data)
 +                           (match-substitute-replacement
 +                            next-replacement nocasify literal))))
 +                ;; Bind message-log-max so we don't fill up the
 +                ;; message log with a bunch of identical messages.
                  (let ((message-log-max nil)
                        (replacement-presentation
                         (if query-replace-show-replacement
                               (query-replace-descr from-string)
                               (query-replace-descr replacement-presentation)))
                  (setq key (read-event))
 -                ;; Necessary in case something happens during read-event
 -                ;; that clobbers the match data.
 +                ;; Necessary in case something happens during
 +                ;; read-event that clobbers the match data.
                  (set-match-data real-match-data)
                  (setq key (vector key))
                  (setq def (lookup-key map key))
                            (concat "Query replacing "
                                    (if delimited-flag
                                        (or (and (symbolp delimited-flag)
 -                                               (get delimited-flag 'isearch-message-prefix))
 +                                               (get delimited-flag
 +                                                      'isearch-message-prefix))
                                            "word ") "")
                                    (if regexp-flag "regexp " "")
                                    (if backward "backward " "")
                           (message "No previous match")
                           (ding 'no-terminate)
                           (sit-for 1)))
 +                      ((or (eq def 'undo) (eq def 'undo-all))
 +                       (if (null stack)
 +                             (progn
 +                               (message "Nothing to undo")
 +                               (ding 'no-terminate)
 +                               (sit-for 1))
 +                         (let ((stack-idx         0)
 +                                 (stack-len         (length stack))
 +                                 (num-replacements  0)
 +                                 search-string
 +                                 next-replacement)
 +                             (while (and (< stack-idx stack-len)
 +                                         stack
 +                                         (null replaced))
 +                               (let* ((elt (nth stack-idx stack)))
 +                                 (setq
 +                                  stack-idx (1+ stack-idx)
 +                                  replaced (nth 1 elt)
 +                                  ;; Bind swapped values
 +                                  ;; (search-string <--> replacement)
 +                                  search-string (nth (if replaced 4 3) elt)
 +                                  next-replacement (nth (if replaced 3 4) elt)
 +                                  search-string-replaced search-string
 +                                  next-replacement-replaced next-replacement)
 +
 +                                 (when (and (= stack-idx stack-len)
 +                                            (null replaced)
 +                                            (zerop num-replacements))
 +                                          (message "Nothing to undo")
 +                                          (ding 'no-terminate)
 +                                          (sit-for 1))
 +
 +                                 (when replaced
 +                                   (setq stack (nthcdr stack-idx stack))
 +                                   (goto-char (nth 0 elt))
 +                                   (set-match-data (nth 2 elt))
 +                                   (setq real-match-data
 +                                         (save-excursion
 +                                           (goto-char (match-beginning 0))
 +                                           (looking-at search-string)
 +                                           (match-data t (nth 2 elt)))
 +                                         noedit
 +                                         (replace-match-maybe-edit
 +                                          next-replacement nocasify literal
 +                                          noedit real-match-data backward)
 +                                         replace-count (1- replace-count)
 +                                         real-match-data
 +                                         (save-excursion
 +                                           (goto-char (match-beginning 0))
 +                                           (looking-at next-replacement)
 +                                           (match-data t (nth 2 elt))))
 +                                   ;; Set replaced nil to keep in loop
 +                                   (when (eq def 'undo-all)
 +                                     (setq replaced nil
 +                                           stack-len (- stack-len stack-idx)
 +                                           stack-idx 0
 +                                           num-replacements
 +                                           (1+ num-replacements))))))
 +                             (when (and (eq def 'undo-all)
 +                                        (null (zerop num-replacements)))
 +                               (message "Undid %d %s" num-replacements
 +                                        (if (= num-replacements 1)
 +                                            "replacement"
 +                                          "replacements"))
 +                               (ding 'no-terminate)
 +                               (sit-for 1)))
 +                         (setq replaced nil last-was-undo t)))
                        ((eq def 'act)
                         (or replaced
                             (setq noedit
                                 (match-beginning 0)
                                 (match-end 0)
                                 (current-buffer))
 -                            (match-data t)))
 -                    stack))))))
 -
 +                            (match-data t))
 +                              search-string-replaced
 +                              next-replacement-replaced)
 +                    stack)
 +                (setq next-replacement-replaced nil
 +                      search-string-replaced    nil))))))
        (replace-dehighlight))
      (or unread-command-events
        (message "Replaced %d occurrence%s%s"
diff --combined lisp/term.el
index c1e827875d1652d06a686583d0f551d36eb34f4b,6fd3a5e62615ac6dd40a10bab289241d8333cdab..ecaca505683072b17fe939a3fe8106fe646adac2
@@@ -834,10 -834,6 +834,10 @@@ is buffer-local.
      (define-key map [down] 'term-send-down)
      (define-key map [right] 'term-send-right)
      (define-key map [left] 'term-send-left)
 +    (define-key map [C-up] 'term-send-ctrl-up)
 +    (define-key map [C-down] 'term-send-ctrl-down)
 +    (define-key map [C-right] 'term-send-ctrl-right)
 +    (define-key map [C-left] 'term-send-ctrl-left)
      (define-key map [delete] 'term-send-del)
      (define-key map [deletechar] 'term-send-del)
      (define-key map [backspace] 'term-send-backspace)
@@@ -1221,10 -1217,6 +1221,10 @@@ without any interpretation.
  (defun term-send-down  () (interactive) (term-send-raw-string "\eOB"))
  (defun term-send-right () (interactive) (term-send-raw-string "\eOC"))
  (defun term-send-left  () (interactive) (term-send-raw-string "\eOD"))
 +(defun term-send-ctrl-up    () (interactive) (term-send-raw-string "\e[1;5A"))
 +(defun term-send-ctrl-down  () (interactive) (term-send-raw-string "\e[1;5B"))
 +(defun term-send-ctrl-right () (interactive) (term-send-raw-string "\e[1;5C"))
 +(defun term-send-ctrl-left  () (interactive) (term-send-raw-string "\e[1;5D"))
  (defun term-send-home  () (interactive) (term-send-raw-string "\e[1~"))
  (defun term-send-insert() (interactive) (term-send-raw-string "\e[2~"))
  (defun term-send-end   () (interactive) (term-send-raw-string "\e[4~"))
@@@ -1462,6 -1454,13 +1462,13 @@@ Using \"emacs\" loses, because bash dis
           (format "TERMINFO=%s" data-directory)
           (format term-termcap-format "TERMCAP="
                   term-term-name term-height term-width)
+          ;; This is for backwards compatibility with Bash 4.3 and earlier.
+          ;; Remove this hack once Bash 4.4-or-later is common, because
+          ;; it breaks './configure' of some packages that expect it to
+          ;; say where to find EMACS.
+          (format "EMACS=%s (term:%s)" emacs-version term-protocol-version)
           (format "INSIDE_EMACS=%s,term:%s" emacs-version term-protocol-version)
           (format "LINES=%d" term-height)
           (format "COLUMNS=%d" term-width))
diff --combined src/alloc.c
index 1e4ec8b0573a0c89bcbaaf13a7c0736fd6f23e62,4c9cbf1072470d48ea1027addad256ae3d31ea39..56a535411c8318a77ae67bbee7cd9dd483e8dd32
@@@ -22,7 -22,10 +22,7 @@@ along with GNU Emacs.  If not, see <htt
  
  #include <stdio.h>
  #include <limits.h>           /* For CHAR_BIT.  */
 -
 -#ifdef ENABLE_CHECKING
 -#include <signal.h>           /* For SIGABRT.  */
 -#endif
 +#include <signal.h>           /* For SIGABRT, SIGDANGER.  */
  
  #ifdef HAVE_PTHREAD
  #include <pthread.h>
@@@ -32,7 -35,6 +32,7 @@@
  #include "dispextern.h"
  #include "intervals.h"
  #include "puresize.h"
 +#include "sheap.h"
  #include "systime.h"
  #include "character.h"
  #include "buffer.h"
  #include "dosfns.h"           /* For dos_memory_info.  */
  #endif
  
 +#ifdef HAVE_MALLOC_H
 +# include <malloc.h>
 +#endif
 +
  #if (defined ENABLE_CHECKING                  \
       && defined HAVE_VALGRIND_VALGRIND_H      \
       && !defined USE_VALGRIND)
@@@ -108,6 -106,8 +108,6 @@@ my_heap_start (void
  
  #ifdef DOUG_LEA_MALLOC
  
 -#include <malloc.h>
 -
  /* Specify maximum number of areas to mmap.  It would be nice to use a
     value that explicitly means "no limit".  */
  
     inside glibc's malloc.  */
  static void *malloc_state_ptr;
  
 -/* Get and free this pointer; useful around unexec.  */
 -void
 -alloc_unexec_pre (void)
 -{
 -  malloc_state_ptr = malloc_get_state ();
 -}
 -void
 -alloc_unexec_post (void)
 -{
 -  free (malloc_state_ptr);
 -}
 -
  /* Restore the dumped malloc state.  Because malloc can be invoked
     even before main (e.g. by the dynamic linker), the dumped malloc
     state must be restored as early as possible using this special hook.  */
@@@ -157,40 -169,14 +157,40 @@@ malloc_initialize_hook (void
      }
  }
  
 +/* Declare the malloc initialization hook, which runs before 'main' starts.
 +   EXTERNALLY_VISIBLE works around Bug#22522.  */
  # ifndef __MALLOC_HOOK_VOLATILE
  #  define __MALLOC_HOOK_VOLATILE
  # endif
 -voidfuncptr __MALLOC_HOOK_VOLATILE __malloc_initialize_hook
 +voidfuncptr __MALLOC_HOOK_VOLATILE __malloc_initialize_hook EXTERNALLY_VISIBLE
    = malloc_initialize_hook;
  
  #endif
  
 +/* Allocator-related actions to do just before and after unexec.  */
 +
 +void
 +alloc_unexec_pre (void)
 +{
 +#ifdef DOUG_LEA_MALLOC
 +  malloc_state_ptr = malloc_get_state ();
 +#endif
 +#ifdef HYBRID_MALLOC
 +  bss_sbrk_did_unexec = true;
 +#endif
 +}
 +
 +void
 +alloc_unexec_post (void)
 +{
 +#ifdef DOUG_LEA_MALLOC
 +  free (malloc_state_ptr);
 +#endif
 +#ifdef HYBRID_MALLOC
 +  bss_sbrk_did_unexec = false;
 +#endif
 +}
 +
  /* Mark, unmark, query mark bit of a Lisp string.  S must be a pointer
     to a struct Lisp_String.  */
  
@@@ -564,8 -550,6 +564,8 @@@ static struct Lisp_Finalizer doomed_fin
                                Malloc
   ************************************************************************/
  
 +#if defined SIGDANGER || (!defined SYSTEM_MALLOC && !defined HYBRID_MALLOC)
 +
  /* Function malloc calls this if it finds we are near exhausting storage.  */
  
  void
@@@ -574,7 -558,6 +574,7 @@@ malloc_warning (const char *str
    pending_malloc_warning = str;
  }
  
 +#endif
  
  /* Display an already-pending malloc warning.  */
  
@@@ -1128,14 -1111,23 +1128,14 @@@ lisp_free (void *block
     unexmacosx.c, so don't use it on Darwin.  */
  
  #if ! ADDRESS_SANITIZER && !defined DARWIN_OS
 -# if !defined SYSTEM_MALLOC && !defined DOUG_LEA_MALLOC && !defined HYBRID_MALLOC
 -#  define USE_ALIGNED_ALLOC 1
 -#  ifndef HAVE_ALIGNED_ALLOC
 -/* Defined in gmalloc.c.  */
 -void *aligned_alloc (size_t, size_t);
 -#  endif
 -# elif defined HYBRID_MALLOC
 -#  if defined HAVE_ALIGNED_ALLOC || defined HAVE_POSIX_MEMALIGN
 -#   define USE_ALIGNED_ALLOC 1
 -#   define aligned_alloc hybrid_aligned_alloc
 -/* Defined in gmalloc.c.  */
 -void *aligned_alloc (size_t, size_t);
 -#  endif
 -# elif defined HAVE_ALIGNED_ALLOC
 +# if (defined HAVE_ALIGNED_ALLOC                                      \
 +      || (defined HYBRID_MALLOC                                               \
 +        ? defined HAVE_POSIX_MEMALIGN                                 \
 +        : !defined SYSTEM_MALLOC && !defined DOUG_LEA_MALLOC))
  #  define USE_ALIGNED_ALLOC 1
 -# elif defined HAVE_POSIX_MEMALIGN
 +# elif !defined HYBRID_MALLOC && defined HAVE_POSIX_MEMALIGN
  #  define USE_ALIGNED_ALLOC 1
 +#  define aligned_alloc my_aligned_alloc /* Avoid collision with lisp.h.  */
  static void *
  aligned_alloc (size_t alignment, size_t size)
  {
@@@ -3399,13 -3391,22 +3399,13 @@@ allocate_buffer (void
  DEFUN ("make-vector", Fmake_vector, Smake_vector, 2, 2, 0,
         doc: /* Return a newly created vector of length LENGTH, with each element being INIT.
  See also the function `vector'.  */)
 -  (register Lisp_Object length, Lisp_Object init)
 +  (Lisp_Object length, Lisp_Object init)
  {
 -  Lisp_Object vector;
 -  register ptrdiff_t sizei;
 -  register ptrdiff_t i;
 -  register struct Lisp_Vector *p;
 -
    CHECK_NATNUM (length);
 -
 -  p = allocate_vector (XFASTINT (length));
 -  sizei = XFASTINT (length);
 -  for (i = 0; i < sizei; i++)
 +  struct Lisp_Vector *p = allocate_vector (XFASTINT (length));
 +  for (ptrdiff_t i = 0; i < XFASTINT (length); i++)
      p->contents[i] = init;
 -
 -  XSETVECTOR (vector, p);
 -  return vector;
 +  return make_lisp_ptr (p, Lisp_Vectorlike);
  }
  
  DEFUN ("vector", Fvector, Svector, 0, MANY, 0,
@@@ -3414,9 -3415,12 +3414,9 @@@ Any number of arguments, even zero argu
  usage: (vector &rest OBJECTS)  */)
    (ptrdiff_t nargs, Lisp_Object *args)
  {
 -  ptrdiff_t i;
 -  register Lisp_Object val = make_uninit_vector (nargs);
 -  register struct Lisp_Vector *p = XVECTOR (val);
 -
 -  for (i = 0; i < nargs; i++)
 -    p->contents[i] = args[i];
 +  Lisp_Object val = make_uninit_vector (nargs);
 +  struct Lisp_Vector *p = XVECTOR (val);
 +  memcpy (p->contents, args, nargs * sizeof *args);
    return val;
  }
  
@@@ -3455,8 -3459,9 +3455,8 @@@ stack before executing the byte-code
  usage: (make-byte-code ARGLIST BYTE-CODE CONSTANTS DEPTH &optional DOCSTRING INTERACTIVE-SPEC &rest ELEMENTS)  */)
    (ptrdiff_t nargs, Lisp_Object *args)
  {
 -  ptrdiff_t i;
 -  register Lisp_Object val = make_uninit_vector (nargs);
 -  register struct Lisp_Vector *p = XVECTOR (val);
 +  Lisp_Object val = make_uninit_vector (nargs);
 +  struct Lisp_Vector *p = XVECTOR (val);
  
    /* We used to purecopy everything here, if purify-flag was set.  This worked
       OK for Emacs-23, but with Emacs-24's lexical binding code, it can be
       just wasteful and other times plainly wrong (e.g. those free vars may want
       to be setcar'd).  */
  
 -  for (i = 0; i < nargs; i++)
 -    p->contents[i] = args[i];
 +  memcpy (p->contents, args, nargs * sizeof *args);
    make_byte_code (p);
    XSETCOMPILED (val, p);
    return val;
@@@ -3724,7 -3730,6 +3724,6 @@@ make_save_ptr_int (void *a, ptrdiff_t b
    return val;
  }
  
- #if ! (defined USE_X_TOOLKIT || defined USE_GTK)
  Lisp_Object
  make_save_ptr_ptr (void *a, void *b)
  {
    p->data[1].pointer = b;
    return val;
  }
- #endif
  
  Lisp_Object
  make_save_funcptr_ptr_obj (void (*a) (void), void *b, Lisp_Object c)
@@@ -5427,7 -5431,7 +5425,7 @@@ purecopy (Lisp_Object obj
      }
    else
      {
 -      Lisp_Object fmt = build_pure_c_string ("Don't know how to purify: %S");
 +      AUTO_STRING (fmt, "Don't know how to purify: %S");
        Fsignal (Qerror, list1 (CALLN (Fformat, fmt, obj)));
      }
  
@@@ -5658,7 -5662,7 +5656,7 @@@ garbage_collect_1 (void *end
      return Qnil;
  
    /* Record this function, so it appears on the profiler's backtraces.  */
 -  record_in_backtrace (Qautomatic_gc, 0, 0);
 +  record_in_backtrace (QAutomatic_GC, 0, 0);
  
    check_cons_list ();
  
@@@ -7388,7 -7392,7 +7386,7 @@@ do hash-consing of the objects allocate
    DEFSYM (Qstring_bytes, "string-bytes");
    DEFSYM (Qvector_slots, "vector-slots");
    DEFSYM (Qheap, "heap");
 -  DEFSYM (Qautomatic_gc, "Automatic GC");
 +  DEFSYM (QAutomatic_GC, "Automatic GC");
  
    DEFSYM (Qgc_cons_threshold, "gc-cons-threshold");
    DEFSYM (Qchar_table_extra_slots, "char-table-extra-slots");
diff --combined src/frame.c
index 88102a366259b68002b592239b9ffb9376b04808,53ff05965c154c590fd26af34740b351e31f6615..9c8926c42c76b541afcf32a8a9ff6f87fc28c9b9
@@@ -534,7 -534,7 +534,7 @@@ adjust_frame_size (struct frame *f, in
  #endif
      }
    else if (new_cols != old_cols)
 -    call2 (Qwindow_pixel_to_total, frame, Qt);
 +    call2 (Qwindow__pixel_to_total, frame, Qt);
  
    if (new_windows_height != old_windows_height
        /* When the top margin has changed we have to recalculate the top
        FrameRows (FRAME_TTY (f)) = new_lines + FRAME_TOP_MARGIN (f);
      }
    else if (new_lines != old_lines)
 -    call2 (Qwindow_pixel_to_total, frame, Qnil);
 +    call2 (Qwindow__pixel_to_total, frame, Qnil);
  
    frame_size_history_add
      (f, Qadjust_frame_size_3, new_text_width, new_text_height,
                  || new_pixel_height != old_pixel_height);
  
    unblock_input ();
 -
 -  run_window_configuration_change_hook (f);
  }
  
  /* Allocate basically initialized frame.  */
@@@ -3641,7 -3643,7 +3641,7 @@@ x_set_font (struct frame *f, Lisp_Objec
    x_new_font (f, font_object, fontset);
    store_frame_param (f, Qfont, arg);
  #ifdef HAVE_X_WINDOWS
 -  store_frame_param (f, Qfont_param, font_param);
 +  store_frame_param (f, Qfont_parameter, font_param);
  #endif
    /* Recalculate toolbar height.  */
    f->n_tool_bar_rows = 0;
@@@ -4563,7 -4565,7 +4563,7 @@@ On Nextstep, this just calls `ns-parse-
  
     This function does not make the coordinates positive.  */
  
- #define DEFAULT_ROWS 35
+ #define DEFAULT_ROWS 36
  #define DEFAULT_COLS 80
  
  long
@@@ -4884,7 -4886,7 +4884,7 @@@ syms_of_frame (void
    DEFSYM (Qframep, "framep");
    DEFSYM (Qframe_live_p, "frame-live-p");
    DEFSYM (Qframe_windows_min_size, "frame-windows-min-size");
 -  DEFSYM (Qwindow_pixel_to_total, "window--pixel-to-total");
 +  DEFSYM (Qwindow__pixel_to_total, "window--pixel-to-total");
    DEFSYM (Qexplicit_name, "explicit-name");
    DEFSYM (Qheight, "height");
    DEFSYM (Qicon, "icon");
@@@ -5262,21 -5264,6 +5262,21 @@@ The function `frame--size-history' disp
  in a more readable form.  */);
      frame_size_history = Qnil;
  
 +  DEFVAR_BOOL ("tooltip-reuse-hidden-frame", tooltip_reuse_hidden_frame,
 +             doc: /* Non-nil means reuse hidden tooltip frames.
 +When this is nil, delete a tooltip frame when hiding the associated
 +tooltip.  When this is non-nil, make the tooltip frame invisible only,
 +so it can be reused when the next tooltip is shown.
 +
 +Setting this to non-nil may drastically reduce the consing overhead
 +incurred by creating new tooltip frames.  However, a value of non-nil
 +means also that intermittent changes of faces or `default-frame-alist'
 +are not applied when showing a tooltip in a reused frame.
 +
 +This variable is effective only with the X toolkit (and there only when
 +Gtk+ tooltips are not used) and on Windows.  */);
 +  tooltip_reuse_hidden_frame = false;
 +
    staticpro (&Vframe_list);
  
    defsubr (&Sframep);
diff --combined src/keyboard.c
index 1a5dbd0f617ec5d90d95b1c73c2dee1834e00119,9618e38e5757edb5a89201819257c445a15e95ac..54643eebba495a526752af241a45481ffdd283fd
@@@ -2529,7 -2529,7 +2529,7 @@@ read_char (int commandflag, Lisp_Objec
    if (KEYMAPP (map) && INTERACTIVE
        && !NILP (prev_event) && ! EVENT_HAS_PARAMETERS (prev_event)
        /* Don't bring up a menu if we already have another event.  */
-       && NILP (Vunread_command_events)
+       && !CONSP (Vunread_command_events)
        && !detect_input_pending_run_timers (0))
      {
        c = read_char_minibuf_menu_prompt (commandflag, map);
        && !EQ (XCAR (prev_event), Qmenu_bar)
        && !EQ (XCAR (prev_event), Qtool_bar)
        /* Don't bring up a menu if we already have another event.  */
-       && NILP (Vunread_command_events))
+       && !CONSP (Vunread_command_events))
      {
        c = read_char_x_menu_prompt (map, prev_event, used_mouse_menu);
  
@@@ -5971,6 -5971,7 +5971,6 @@@ make_lispy_event (struct input_event *e
        }
  #endif
  
 -
  #if defined HAVE_INOTIFY || defined HAVE_KQUEUE || defined HAVE_GFILENOTIFY
      case FILE_NOTIFY_EVENT:
        {
@@@ -9877,7 -9878,7 +9877,7 @@@ clear_input_pending (void
  bool
  requeued_events_pending_p (void)
  {
-   return (!NILP (Vunread_command_events));
+   return (CONSP (Vunread_command_events));
  }
  
  DEFUN ("input-pending-p", Finput_pending_p, Sinput_pending_p, 0, 1, 0,
@@@ -9888,7 -9889,7 +9888,7 @@@ if there is a doubt, the value is t
  If CHECK-TIMERS is non-nil, timers that are ready to run will do so.  */)
    (Lisp_Object check_timers)
  {
-   if (!NILP (Vunread_command_events)
+   if (CONSP (Vunread_command_events)
        || !NILP (Vunread_post_input_method_events)
        || !NILP (Vunread_input_method_events))
      return (Qt);
@@@ -10308,9 -10309,6 +10308,9 @@@ handle_interrupt (bool in_signal_handle
         is used.  Note that [Enter] is not echoed by dos.  */
        cursor_to (SELECTED_FRAME (), 0, 0);
  #endif
 +
 +      write_stdout ("Emacs is resuming after an emergency escape.\n");
 +
        /* It doesn't work to autosave while GC is in progress;
         the code used for auto-saving doesn't cope with the mark bit.  */
        if (!gc_in_progress)
@@@ -11715,25 -11713,6 +11715,25 @@@ Currently, the only supported values fo
  variable are `sigusr1' and `sigusr2'.  */);
    Vdebug_on_event = intern_c_string ("sigusr2");
  
 +  DEFVAR_BOOL ("attempt-stack-overflow-recovery",
 +               attempt_stack_overflow_recovery,
 +               doc: /* If non-nil, attempt to recover from C stack
 +overflow.  This recovery is unsafe and may lead to deadlocks or data
 +corruption, but it usually works and may preserve modified buffers
 +that would otherwise be lost.  If nil, treat stack overflow like any
 +other kind of crash.  */);
 +  attempt_stack_overflow_recovery = true;
 +
 +  DEFVAR_BOOL ("attempt-orderly-shutdown-on-fatal-signal",
 +               attempt_orderly_shutdown_on_fatal_signal,
 +               doc: /* If non-nil, attempt to perform an orderly
 +shutdown when Emacs receives a fatal signal (e.g., a crash).
 +This cleanup is unsafe and may lead to deadlocks or data corruption,
 +but it usually works and may preserve modified buffers that would
 +otherwise be lost.  If nil, crash immediately in response to fatal
 +signals.  */);
 +  attempt_orderly_shutdown_on_fatal_signal = true;
 +
    /* Create the initial keyboard.  Qt means 'unset'.  */
    initial_kboard = allocate_kboard (Qt);
  }
diff --combined src/xdisp.c
index bdc8af8b5bfea840754045f1ad27190865d65351,d701306b22cb7fe6f8209e3a7ff37c1c55406e69..290f69878da6496553ac005b00dec4206f91b61b
@@@ -9827,28 -9827,26 +9827,28 @@@ the maximum pixel-height of all text li
  
  The optional argument FROM, if non-nil, specifies the first text
  position and defaults to the minimum accessible position of the buffer.
 -If FROM is t, use the minimum accessible position that is not a newline
 -character.  TO, if non-nil, specifies the last text position and
 +If FROM is t, use the minimum accessible position that starts a
 +non-empty line.  TO, if non-nil, specifies the last text position and
  defaults to the maximum accessible position of the buffer.  If TO is t,
 -use the maximum accessible position that is not a newline character.
 +use the maximum accessible position that ends a non-empty line.
  
  The optional argument X-LIMIT, if non-nil, specifies the maximum text
  width that can be returned.  X-LIMIT nil or omitted, means to use the
 -pixel-width of WINDOW's body; use this if you do not intend to change
 -the width of WINDOW.  Use the maximum width WINDOW may assume if you
 -intend to change WINDOW's width.  In any case, text whose x-coordinate
 -is beyond X-LIMIT is ignored.  Since calculating the width of long lines
 -can take some time, it's always a good idea to make this argument as
 -small as possible; in particular, if the buffer contains long lines that
 -shall be truncated anyway.
 +pixel-width of WINDOW's body; use this if you want to know how high
 +WINDOW should be become in order to fit all of its buffer's text with
 +the width of WINDOW unaltered.  Use the maximum width WINDOW may assume
 +if you intend to change WINDOW's width.  In any case, text whose
 +x-coordinate is beyond X-LIMIT is ignored.  Since calculating the width
 +of long lines can take some time, it's always a good idea to make this
 +argument as small as possible; in particular, if the buffer contains
 +long lines that shall be truncated anyway.
  
  The optional argument Y-LIMIT, if non-nil, specifies the maximum text
 -height that can be returned.  Text lines whose y-coordinate is beyond
 -Y-LIMIT are ignored.  Since calculating the text height of a large
 -buffer can take some time, it makes sense to specify this argument if
 -the size of the buffer is unknown.
 +height (exluding the height of the mode- or header-line, if any) that
 +can be returned.  Text lines whose y-coordinate is beyond Y-LIMIT are
 +ignored.  Since calculating the text height of a large buffer can take
 +some time, it makes sense to specify this argument if the size of the
 +buffer is large or unknown.
  
  Optional argument MODE-AND-HEADER-LINE nil or omitted means do not
  include the height of the mode- or header-line of WINDOW in the return
@@@ -9866,7 -9864,7 +9866,7 @@@ include the height of both, if present
    ptrdiff_t start, end, pos;
    struct text_pos startp;
    void *itdata = NULL;
 -  int c, max_y = -1, x = 0, y = 0;
 +  int c, max_x = 0, max_y = 0, x = 0, y = 0;
  
    CHECK_BUFFER (buffer);
    b = XBUFFER (buffer);
        end = max (start, min (XINT (to), ZV));
      }
  
 -  if (!NILP (y_limit))
 -    {
 -      CHECK_NUMBER (y_limit);
 -      max_y = min (XINT (y_limit), INT_MAX);
 -    }
 +  if (!NILP (x_limit) && RANGED_INTEGERP (0, x_limit, INT_MAX))
 +    max_x = XINT (x_limit);
 +
 +  if (NILP (y_limit))
 +    max_y = INT_MAX;
 +  else if (RANGED_INTEGERP (0, y_limit, INT_MAX))
 +    max_y = XINT (y_limit);
  
    itdata = bidi_shelve_cache ();
    SET_TEXT_POS (startp, start, CHAR_TO_BYTE (start));
      x = move_it_to (&it, end, -1, max_y, -1, MOVE_TO_POS | MOVE_TO_Y);
    else
      {
 -      CHECK_NUMBER (x_limit);
 -      it.last_visible_x = min (XINT (x_limit), INFINITY);
 +      it.last_visible_x = max_x;
        /* Actually, we never want move_it_to stop at to_x.  But to make
         sure that move_it_in_display_line_to always moves far enough,
 -       we set it to INT_MAX and specify MOVE_TO_X.  */
 -      x = move_it_to (&it, end, INT_MAX, max_y, -1,
 -                    MOVE_TO_POS | MOVE_TO_X | MOVE_TO_Y);
 +       we set it to INT_MAX and specify MOVE_TO_X.  Also bound width
 +       value by X-LIMIT.  */
 +      x = min (move_it_to (&it, end, INT_MAX, max_y, -1,
 +                         MOVE_TO_POS | MOVE_TO_X | MOVE_TO_Y),
 +             max_x);
      }
  
 -  y = it.current_y + it.max_ascent + it.max_descent;
 +  /* Subtract height of header-line which was counted automatically by
 +     start_display.  */
 +  y = min (it.current_y + it.max_ascent + it.max_descent
 +         - WINDOW_HEADER_LINE_HEIGHT (w),
 +         max_y);
  
 -  if (!EQ (mode_and_header_line, Qheader_line)
 -      && !EQ (mode_and_header_line, Qt))
 -    /* Do not count the header-line which was counted automatically by
 -       start_display.  */
 -    y = y - WINDOW_HEADER_LINE_HEIGHT (w);
 +  if (EQ (mode_and_header_line, Qheader_line)
 +      || EQ (mode_and_header_line, Qt))
 +    /* Re-add height of header-line as requested.  */
 +    y = y + WINDOW_HEADER_LINE_HEIGHT (w);
  
    if (EQ (mode_and_header_line, Qmode_line)
        || EQ (mode_and_header_line, Qt))
 -    /* Do count the mode-line which is not included automatically by
 -       start_display.  */
 +    /* Add height of mode-line as requested.  */
      y = y + WINDOW_MODE_LINE_HEIGHT (w);
  
    bidi_unshelve_cache (itdata, false);
@@@ -11833,7 -11826,24 +11833,7 @@@ prepare_menu_bars (void
              && !XBUFFER (w->contents)->text->redisplay)
            continue;
  
 -        /* If a window on this frame changed size, report that to
 -           the user and clear the size-change flag.  */
 -        if (FRAME_WINDOW_SIZES_CHANGED (f))
 -          {
 -            Lisp_Object functions;
 -
 -            /* Clear flag first in case we get an error below.  */
 -            FRAME_WINDOW_SIZES_CHANGED (f) = false;
 -            functions = Vwindow_size_change_functions;
 -
 -            while (CONSP (functions))
 -              {
 -                if (!EQ (XCAR (functions), Qt))
 -                  call1 (XCAR (functions), frame);
 -                functions = XCDR (functions);
 -              }
 -          }
 -
 +        run_window_size_change_functions (frame);
          menu_bar_hooks_run = update_menu_bar (f, false, menu_bar_hooks_run);
  #ifdef HAVE_WINDOW_SYSTEM
          update_tool_bar (f, false);
@@@ -13508,7 -13518,7 +13508,7 @@@ redisplay_internal (void
    specbind (Qinhibit_free_realized_faces, Qnil);
  
    /* Record this function, so it appears on the profiler's backtraces.  */
 -  record_in_backtrace (Qredisplay_internal, 0, 0);
 +  record_in_backtrace (Qredisplay_internal_xC_functionx, 0, 0);
  
    FOR_EACH_FRAME (tail, frame)
      XFRAME (frame)->already_hscrolled_p = false;
         it's too late for the hooks in window-size-change-functions,
         which have been examined already in prepare_menu_bars.  So in
         that case we call the hooks here only for the selected frame.  */
 -      if (sf->redisplay && FRAME_WINDOW_SIZES_CHANGED (sf))
 +      if (sf->redisplay)
        {
 -        Lisp_Object functions;
          ptrdiff_t count1 = SPECPDL_INDEX ();
  
          record_unwind_save_match_data ();
 -
 -        /* Clear flag first in case we get an error below.  */
 -        FRAME_WINDOW_SIZES_CHANGED (sf) = false;
 -        functions = Vwindow_size_change_functions;
 -
 -        while (CONSP (functions))
 -          {
 -            if (!EQ (XCAR (functions), Qt))
 -              call1 (XCAR (functions), selected_frame);
 -            functions = XCDR (functions);
 -          }
 -
 +        run_window_size_change_functions (selected_frame);
          unbind_to (count1, Qnil);
        }
  
      {
        if (sf->redisplay)
        {
 -        Lisp_Object functions;
          ptrdiff_t count1 = SPECPDL_INDEX ();
  
          record_unwind_save_match_data ();
 -
 -        /* Clear flag first in case we get an error below.  */
 -        FRAME_WINDOW_SIZES_CHANGED (sf) = false;
 -        functions = Vwindow_size_change_functions;
 -
 -        while (CONSP (functions))
 -          {
 -            if (!EQ (XCAR (functions), Qt))
 -              call1 (XCAR (functions), selected_frame);
 -            functions = XCDR (functions);
 -          }
 -
 +        run_window_size_change_functions (selected_frame);
          unbind_to (count1, Qnil);
        }
  
      }
    else if (FRAME_VISIBLE_P (sf) && !FRAME_OBSCURED_P (sf))
      {
 -      Lisp_Object mini_window = FRAME_MINIBUF_WINDOW (sf);
 -      struct frame *mini_frame;
 -
        displayed_buffer = XBUFFER (XWINDOW (selected_window)->contents);
        /* Use list_of_error, not Qerror, so that
         we catch only errors and don't run the debugger.  */
                                 list_of_error,
                                 redisplay_window_error);
        if (update_miniwindow_p)
 -      internal_condition_case_1 (redisplay_window_1, mini_window,
 -                                 list_of_error,
 +      internal_condition_case_1 (redisplay_window_1,
 +                                 FRAME_MINIBUF_WINDOW (sf), list_of_error,
                                   redisplay_window_error);
  
        /* Compare desired and current matrices, perform output.  */
         have put text on a frame other than the selected one, so the
         above call to update_frame would not have caught it.  Catch
         it here.  */
 -      mini_window = FRAME_MINIBUF_WINDOW (sf);
 -      mini_frame = XFRAME (WINDOW_FRAME (XWINDOW (mini_window)));
 +      Lisp_Object mini_window = FRAME_MINIBUF_WINDOW (sf);
 +      struct frame *mini_frame = XFRAME (WINDOW_FRAME (XWINDOW (mini_window)));
  
        if (mini_frame != sf && FRAME_WINDOW_P (mini_frame))
        {
@@@ -16085,7 -16122,6 +16085,7 @@@ redisplay_window (Lisp_Object window, b
    bool last_line_misfit = false;
    ptrdiff_t beg_unchanged, end_unchanged;
    int frame_line_height;
 +  bool use_desired_matrix;
  
    SET_TEXT_POS (lpoint, PT, PT_BYTE);
    opoint = lpoint;
    startp = run_window_scroll_functions (window, it.current.pos);
  
    /* Redisplay the window.  */
 -  bool use_desired_matrix = false;
 +  use_desired_matrix = false;
    if (!current_matrix_up_to_date_p
        || windows_or_buffers_changed
        || f->cursor_type_changed
@@@ -31117,7 -31153,7 +31117,7 @@@ syms_of_xdisp (void
    /* Non-nil means don't actually do any redisplay.  */
    DEFSYM (Qinhibit_redisplay, "inhibit-redisplay");
  
 -  DEFSYM (Qredisplay_internal, "redisplay_internal (C function)");
 +  DEFSYM (Qredisplay_internal_xC_functionx, "redisplay_internal (C function)");
  
    DEFVAR_BOOL("inhibit-message", inhibit_message,
                doc:  /* Non-nil means calls to `message' are not displayed.
@@@ -31386,8 -31422,11 +31386,11 @@@ Value is a number or a cons (WIDTH-DPI 
               Vtruncate_partial_width_windows,
      doc: /* Non-nil means truncate lines in windows narrower than the frame.
  For an integer value, truncate lines in each window narrower than the
- full frame width, provided the window width is less than that integer;
- otherwise, respect the value of `truncate-lines'.
+ full frame width, provided the total window width in column units is less
+ than that integer; otherwise, respect the value of `truncate-lines'.
+ The total width of the window is as returned by `window-total-width', it
+ includes the fringes, the continuation and truncation glyphs, the
+ display margins (if any), and the scroll bar
  
  For any other non-nil value, truncate lines in all windows that do
  not span the full frame width.
@@@ -31451,6 -31490,16 +31454,6 @@@ If nil, disable message logging.  If t
  the buffer when it becomes large.  */);
    Vmessage_log_max = make_number (1000);
  
 -  DEFVAR_LISP ("window-size-change-functions", Vwindow_size_change_functions,
 -    doc: /* Functions called during redisplay, if window sizes have changed.
 -The value should be a list of functions that take one argument.
 -During the first part of redisplay, for each frame, if any of its windows
 -have changed size since the last redisplay, or have been split or deleted,
 -all the functions in the list are called, with the frame as argument.
 -If redisplay decides to resize the minibuffer window, it calls these
 -functions on behalf of that as well.  */);
 -  Vwindow_size_change_functions = Qnil;
 -
    DEFVAR_LISP ("window-scroll-functions", Vwindow_scroll_functions,
      doc: /* List of functions to call before redisplaying a window with scrolling.
  Each function is called with two arguments, the window and its new
index d145c197a4e6c5958dea8bf3199e6d603786a402,20cb0f6b39967a7d16aef7832eaf8b02530ed840..20cb0f6b39967a7d16aef7832eaf8b02530ed840
@@@ -87,9 -87,16 +87,16 @@@ Evaluate BODY for each created map
    (let ((vec [3 4 5]))
     (should-error (setf (map-elt vec 3) 6))))
  
+ (ert-deftest test-map-put-alist-new-key ()
+   "Regression test for Bug#23105."
+   (let ((alist '((0 . a))))
+     (map-put alist 2 'b)
+     (should (eq (map-elt alist 2)
+                 'b))))
  (ert-deftest test-map-put-return-value ()
    (let ((ht (make-hash-table)))
-     (should (eq (map-put ht 'a 'hello) ht))))
+     (should (eq (map-put ht 'a 'hello) 'hello))))
  
  (ert-deftest test-map-delete ()
    (with-maps-do map