changeset 90984:a1be62cbd32a

Merge from emacs--devo--0 Patches applied: * emacs--devo--0 (patch 814-815) - Update from CVS Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-232
author Miles Bader <miles@gnu.org>
date Wed, 18 Jul 2007 22:15:15 +0000
parents 8cdd8b5fa891 (current diff) 7447c9b7efeb (diff)
children 89cd46b93749
files etc/ChangeLog etc/NEWS etc/TODO leim/ChangeLog leim/makefile.w32-in lib-src/ChangeLog lib-src/etags.c lib-src/makefile.w32-in lisp/ChangeLog lisp/bookmark.el lisp/calendar/calendar.el lisp/delsel.el lisp/emacs-lisp/cl-loaddefs.el lisp/emacs-lisp/lisp-mode.el lisp/emulation/cua-base.el lisp/files.el lisp/makefile.w32-in lisp/mouse.el lisp/net/ange-ftp.el lisp/net/tramp-smb.el lisp/net/tramp.el lisp/progmodes/grep.el lisp/progmodes/sh-script.el lisp/ps-print.el lisp/recentf.el lisp/term/xterm.el lisp/textmodes/tex-mode.el lisp/vc-bzr.el lisp/vc-hooks.el lisp/vc.el lispref/ChangeLog lispref/files.texi man/ChangeLog man/info.texi man/tramp.texi nt/ChangeLog nt/inc/sys/socket.h nt/makefile.w32-in src/ChangeLog src/abbrev.c src/makefile.w32-in src/process.c src/window.c
diffstat 45 files changed, 869 insertions(+), 443 deletions(-) [+]
line wrap: on
line diff
--- a/etc/ChangeLog	Mon Jul 16 19:26:14 2007 +0000
+++ b/etc/ChangeLog	Wed Jul 18 22:15:15 2007 +0000
@@ -1,3 +1,7 @@
+2007-07-17  Michael Albinus  <michael.albinus@gmx.de>
+
+	* NEWS: `file-remote-p' has a new optional parameter IDENTIFICATION.
+
 2007-07-15  Karl Fogel  <kfogel@red-bean.com>
 
 	* NEWS: Revert revision 1.1509 (commitid xdXJjPiU1ZfI9Fps), which
--- a/etc/NEWS	Mon Jul 16 19:26:14 2007 +0000
+++ b/etc/NEWS	Wed Jul 18 22:15:15 2007 +0000
@@ -150,7 +150,7 @@
 
 * Lisp Changes in Emacs 23.1
 
-+++ 
++++
 ** In `condition-case', a handler can specify "let the debugger run first".
 
 You do this by writing `debug' in the list of conditions to be handled,
@@ -180,9 +180,10 @@
 `default-directory'.
 
 +++
-** `file-remote-p' has a new optional parameter CONNECTED.
-With this paramter passed non-nil, it is checked whether a remote
-connection has been established already.
+** `file-remote-p' has new optional parameters IDENTIFICATION and CONNECTED.
+IDENTIFICATION specifies which part of the remote identifier has to be
+returned.  With CONNECTED passed non-nil, it is checked whether a
+remote connection has been established already.
 
 ** The two new functions `looking-at-p' and `string-match-p' can do
 the same matching as `looking-at' and `string-match' without changing
--- a/etc/TODO	Mon Jul 16 19:26:14 2007 +0000
+++ b/etc/TODO	Wed Jul 18 22:15:15 2007 +0000
@@ -14,6 +14,9 @@
 
 * Small but important fixes needed in existing features:
 
+** "Options -> Save Options" should save the font set via "Set Font/Fontset"
+I.e. mouse-set-font should use customize-face.
+
 ** Compute the list of active keymaps *after* reading the first event.
 
 ** Avoid using "iff" in doc strings.
--- a/leim/ChangeLog	Mon Jul 16 19:26:14 2007 +0000
+++ b/leim/ChangeLog	Wed Jul 18 22:15:15 2007 +0000
@@ -1,3 +1,7 @@
+2007-07-16  Eli Zaretskii  <eliz@gnu.org>
+
+	* makefile.w32-in (extraclean): Don't delete *~.
+
 2007-06-02  Chong Yidong  <cyd@stupidchicken.com>
 
 	* Version 22.1 released.
--- a/leim/makefile.w32-in	Mon Jul 16 19:26:14 2007 +0000
+++ b/leim/makefile.w32-in	Wed Jul 18 22:15:15 2007 +0000
@@ -215,5 +215,7 @@
 maintainer-clean: distclean
 	- $(FOREACH) $(WORLD) $(FORDO) $(DEL) $(FORVAR) $(ENDFOR)
 
+# We used to delete *~ here, but that might inadvertently remove
+# precious files if it happens to match their short 8+3 aliases.
 extraclean: maintainer-clean
-	- $(FOREACH) *~ "#*" $(FORDO) $(DEL) $(FORVAR) $(ENDFOR)
+	- $(FOREACH) *.el~ "#*" $(FORDO) $(DEL) $(FORVAR) $(ENDFOR)
--- a/lib-src/ChangeLog	Mon Jul 16 19:26:14 2007 +0000
+++ b/lib-src/ChangeLog	Wed Jul 18 22:15:15 2007 +0000
@@ -1,3 +1,14 @@
+2007-07-17  Francesco Potort,Al(B  <pot@gnu.org>
+
+	* etags.c (C_entries): Reset the fvdef machine when out of function.
+	(PRINT_UNDOCUMENTED_OPTIONS_HELP): #define as FALSE if undefined.
+	(print_help): Use it in if() rather than #if.
+	(print_help): Conditionally print help about --no-line-directive.
+
+2007-07-16  Eli Zaretskii  <eliz@gnu.org>
+
+	* makefile.w32-in (clean): Don't delete *~.
+
 2007-06-07  Glenn Morris  <rgm@gnu.org>
 
 	* etags.c (print_version): Add `emacs_copyright' string, for
--- a/lib-src/etags.c	Mon Jul 16 19:26:14 2007 +0000
+++ b/lib-src/etags.c	Wed Jul 18 22:15:15 2007 +0000
@@ -80,7 +80,7 @@
  * configuration file containing regexp definitions for etags.
  */
 
-char pot_etags_version[] = "@(#) pot revision number is 17.31";
+char pot_etags_version[] = "@(#) pot revision number is 17.34";
 
 #define	TRUE	1
 #define	FALSE	0
@@ -882,7 +882,7 @@
 # define EMACS_NAME "standalone"
 #endif
 #ifndef VERSION
-# define VERSION "17.31"
+# define VERSION "17.34"
 #endif
 static void
 print_version ()
@@ -897,6 +897,10 @@
   exit (EXIT_SUCCESS);
 }
 
+#ifndef PRINT_UNDOCUMENTED_OPTIONS_HELP
+# define PRINT_UNDOCUMENTED_OPTIONS_HELP FALSE
+#endif
+
 static void
 print_help (argbuffer)
      argument *argbuffer;
@@ -979,6 +983,11 @@
     puts ("--no-globals\n\
 	Do not create tag entries for global variables in some\n\
 	languages.  This makes the tags file smaller.");
+
+  if (PRINT_UNDOCUMENTED_OPTIONS_HELP)
+    puts ("--no-line-directive\n\
+        Ignore #line preprocessor directives in C and derived languages.");
+
   if (CTAGS)
     puts ("--members\n\
 	Create tag entries for members of structures in some languages.");
@@ -999,13 +1008,17 @@
 	MODS are optional one-letter modifiers: `i' means to ignore case,\n\
 	`m' means to allow multi-line matches, `s' implies `m' and\n\
 	causes dot to match any character, including newline.");
+
   puts ("-R, --no-regex\n\
         Don't create tags from regexps for the following files.");
+
   puts ("-I, --ignore-indentation\n\
         In C and C++ do not assume that a closing brace in the first\n\
         column is the final brace of a function or structure definition.");
+
   puts ("-o FILE, --output=FILE\n\
         Write the tags to FILE.");
+
   puts ("--parse-stdin=NAME\n\
         Read from standard input and record tags as belonging to file NAME.");
 
@@ -1033,13 +1046,16 @@
         Print on the standard output an index of items intended for\n\
         human consumption, similar to the output of vgrind.  The index\n\
         is sorted, and gives the page number of each item.");
-# if PRINT_UNDOCUMENTED_OPTIONS_HELP
-      puts ("-w, --no-duplicates\n\
+
+      if (PRINT_UNDOCUMENTED_OPTIONS_HELP)
+	puts ("-w, --no-duplicates\n\
         Do not create duplicate tag entries, for compatibility with\n\
 	traditional ctags.");
-      puts ("-w, --no-warn\n\
+
+      if (PRINT_UNDOCUMENTED_OPTIONS_HELP)
+	puts ("-w, --no-warn\n\
         Suppress warning messages about duplicate tag entries.");
-# endif /* PRINT_UNDOCUMENTED_OPTIONS_HELP */
+
       puts ("-x, --cxref\n\
         Like --vgrind, but in the style of cxref, rather than vgrind.\n\
         The output uses line numbers instead of page numbers, but\n\
@@ -3982,10 +3998,16 @@
 	      bracelev = 0;	/* reset brace level if first column */
 	      parlev = 0;	/* also reset paren level, just in case... */
 	    }
-	  else if (bracelev > 0)
-	    bracelev--;
 	  else
-	    token.valid = FALSE; /* something gone amiss, token unreliable */
+	    {
+	      if (--bracelev < 0)
+		{
+		  bracelev = 0;
+		  token.valid = FALSE; /* something gone amiss, token unreliable */
+		}
+	      if (bracelev == 0 && fvdef == vignore)
+		fvdef = fvnone;		/* end of function */
+	    }
 	  popclass_above (bracelev);
 	  structdef = snone;
 	  /* Only if typdef == tinbody is typdefbracelev significant. */
--- a/lib-src/makefile.w32-in	Mon Jul 16 19:26:14 2007 +0000
+++ b/lib-src/makefile.w32-in	Wed Jul 18 22:15:15 2007 +0000
@@ -314,8 +314,10 @@
 #
 # Maintenance
 #
+# We used to delete *~ here, but that might inadvertently remove
+# precious files if it happens to match their short 8+3 aliases.
 clean:
-		- $(DEL) *~ DOC* $(COMPILER_TEMP_FILES)
+		- $(DEL) DOC* $(COMPILER_TEMP_FILES)
 		- $(DEL) ctags.c
 		- $(DEL) getopt.h
 		- $(DEL_TREE) $(OBJDIR)
--- a/lisp/ChangeLog	Mon Jul 16 19:26:14 2007 +0000
+++ b/lisp/ChangeLog	Wed Jul 18 22:15:15 2007 +0000
@@ -1,3 +1,120 @@
+2007-07-17  Michael Albinus  <michael.albinus@gmx.de>
+
+	* files.el (file-remote-p): Introduce optional parameter
+	IDENTIFICATION.
+
+	* recentf.el (recentf-keep-default-predicate): Adapt call of
+	`file-remote-p'.
+
+	* progmodes/grep.el (grep-probe): Use `process-file'.
+	(grep-compute-defaults): Handle variables host specific.
+
+	* net/ange-ftp.el: (ange-ftp-file-remote-p): Handle optional
+	parameter IDENTIFICATION.
+
+	* net/tramp.el (tramp-handle-file-remote-p): Handle optional
+	parameter IDENTIFICATION.
+	(tramp-handle-set-file-times): New defun.  Replaces `tramp-touch'.
+	(tramp-file-name-handler-alist, tramp-file-name-for-operation):
+	Add entry for `set-file-times'.
+	(tramp-do-copy-or-rename-file-via-buffer)
+	(tramp-do-copy-or-rename-file-out-of-band): Use `set-file-times'.
+	(tramp-handle-unhandled-file-name-directory): Rewrite.
+	(tramp-convert-file-attributes): Add error handling when inode is
+	extraordinary big.
+	(tramp-get-inode): Change parameter from FILE to VEC.
+	(tramp-handle-start-file-process ): Use (current-buffer) if BUFFER
+	is NIL.  This is according to the specification.  Goto (point-max)
+	when ready.
+	(tramp-handle-shell-command): Rewrite completely, using
+	`process-file' and `start-file-process'.
+	(tramp-methods, tramp-find-shell)
+	(tramp-open-connection-setup-interactive-shell)
+	(tramp-maybe-open-connection): Guard against $PROMPT_COMMAND shell
+	var.  Reported by Steve Youngs <steve@sxemacs.org>.
+
+	* net/tramp-fish.el (tramp-fish-file-name-handler-alist): Add
+	entry for `set-file-times'.  Rename `start-process' into
+	`start-file-process'.  Remove `call-process' entry.
+	(tramp-fish-handle-set-file-times): New defun.
+	(tramp-fish-handle-executable-find): Use `process-file'.
+	(tramp-fish-handle-process-file): New defun.  Replaces
+	`tramp-fish-handle-call-process'.
+	(tramp-fish-do-copy-or-rename-file-directly): Use
+	`set-file-times'.
+	(tramp-fish-get-file-entries): Change `tramp-get-inode' parameter.
+
+	* net/tramp-smb.el (tramp-smb-handle-file-attributes): Change
+	`tramp-get-inode' parameter.
+
+2007-07-17  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* vc-bzr.el (vc-bzr-version, vc-bzr-at-least-version)
+	(vc-bzr-post-command-function): Remove.  Version 0.8 is already old
+	nowadays, and by the time Emacs-23 comes out, nobody will even remember
+	it has ever existed.
+
+2007-07-17  Dan Nicolaescu  <dann@ics.uci.edu>
+
+	* vc.el: Undo previous change.
+
+2007-07-16  Eli Zaretskii  <eliz@gnu.org>
+
+	* makefile.w32-in (clean): Don't delete *~.
+
+2007-07-16  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* textmodes/tex-mode.el (tex-verbatim-environments):
+	Add safe-local-variable property.
+	(tex-font-lock-syntactic-keywords): Lookup tex-verbatim-environments
+	when starting font-lock rather than when loading tex-mode.el.
+
+	* progmodes/sh-script.el (sh-font-lock-quoted-subshell): Skip over the
+	whole $( rather than just the $.  Rename from sh-quoted-subshell.
+	(sh-font-lock-syntactic-keywords): Adjust call accordingly.
+
+2007-07-16  Thien-Thi Nguyen  <ttn@gnuvola.org>
+
+	* bookmark.el (bookmark-maybe-sort-alist): Don't modify
+	bookmark-alist.  Instead, if not sorting, simply return it.
+	(bookmark-bmenu-list): Call bookmark-maybe-sort-alist
+	for its return value, not for its side effect.
+
+	* emacs-lisp/lisp-mode.el (calculate-lisp-indent): In the
+	case of alignment under a constant symbol, find and consider
+	the sexp actually at indentation to be the "last sexp".
+
+2007-07-16  Drew Adams  <drew.adams@oracle.com>
+
+	* mouse.el (mouse-yank-secondary): Better error message if no
+	secondary selection.
+
+2007-07-16  Dan Nicolaescu  <dann@ics.uci.edu>
+
+	* vc-hooks.el (vc-handled-backends): Move BZR later in the list.
+
+	* term/xterm.el (xterm-turn-on-modify-other-keys)
+	(xterm-turn-off-modify-other-keys): New functions.
+	(terminal-init-xterm): Enable the modifyOtherKeys feature if the
+	terminal supports it.
+
+2007-07-16  Thien-Thi Nguyen  <ttn@gnuvola.org>
+
+	* bookmark.el (bookmark-show-all-annotations):
+	Make sure each inserted annotation ends with newline.
+
+2007-07-15  Juri Linkov  <juri@jurta.org>
+
+	* delsel.el (delete-selection-pre-hook):
+	* emulation/cua-base.el (cua-paste): Before a yank command,
+	check also whether last-command is one of mouse-save-then-kill,
+	mouse-secondary-save-then-kill, mouse-set-region, mouse-drag-region.
+
+2007-07-15  Michael Albinus  <michael.albinus@gmx.de>
+
+	* recentf.el (recentf-keep-default-predicate): New defun.
+	(recentf-keep): Use it as initial value.
+
 2007-07-15  Karl Fogel  <kfogel@red-bean.com>
 
 	* bookmark.el: Revert revision 1.90 (commitid mWoPbju3pgNotDps),
@@ -6,8 +123,7 @@
 
 2007-07-15  Jeff Miller  <jmiller@cablespeed.com>  (tiny change)
 
-	* calendar/cal-bahai.el (calendar-goto-bahai-date): Add autoload
-	cookie.
+	* calendar/calendar.el (calendar-goto-bahai-date): Autoload it.
 
 2007-07-15  Jason Rumney  <jasonr@gnu.org>
 
@@ -36,7 +152,7 @@
 	* replace.el (match): Use yellow1 instead of yellow.
 
 	* progmodes/gdb-ui.el (breakpoint-enabled): Use red1 instead of
-	red. 
+	red.
 
 	* pcvs-info.el (cvs-unknown): Likewise.
 
--- a/lisp/bookmark.el	Mon Jul 16 19:26:14 2007 +0000
+++ b/lisp/bookmark.el	Wed Jul 18 22:15:15 2007 +0000
@@ -1045,10 +1045,10 @@
   ;;Return the bookmark-alist for display.  If the bookmark-sort-flag
   ;;is non-nil, then return a sorted copy of the alist.
   (if bookmark-sort-flag
-      (setq bookmark-alist
-            (sort (copy-alist bookmark-alist)
-                  (function
-                   (lambda (x y) (string-lessp (car x) (car y))))))))
+      (sort (copy-alist bookmark-alist)
+            (function
+             (lambda (x y) (string-lessp (car x) (car y)))))
+    bookmark-alist))
 
 
 (defvar bookmark-after-jump-hook nil
@@ -1590,7 +1590,6 @@
     (insert "% Bookmark\n- --------\n")
     (add-text-properties (point-min) (point)
 			 '(font-lock-face bookmark-menu-heading))
-    (bookmark-maybe-sort-alist)
     (mapcar
      (lambda (full-record)
        ;; if a bookmark has an annotation, prepend a "*"
@@ -1613,7 +1612,7 @@
 		  help-echo "mouse-2: go to this bookmark in other window")))
 	   (insert "\n")
 	   )))
-     bookmark-alist))
+     (bookmark-maybe-sort-alist)))
   (goto-char (point-min))
   (forward-line 2)
   (bookmark-bmenu-mode)
@@ -1816,7 +1815,8 @@
          (if (and ann (not (string-equal ann "")))
              ;; insert the annotation, indented by 4 spaces.
              (progn
-               (save-excursion (insert ann))
+               (save-excursion (insert ann) (unless (bolp)
+                                              (insert "\n")))
                (while (< (point) (point-max))
                  (beginning-of-line) ; paranoia
                  (insert "    ")
--- a/lisp/calendar/cal-bahai.el	Mon Jul 16 19:26:14 2007 +0000
+++ b/lisp/calendar/cal-bahai.el	Wed Jul 18 22:15:15 2007 +0000
@@ -149,7 +149,6 @@
   (message "Baha'i date: %s"
            (calendar-bahai-date-string (calendar-cursor-to-date t))))
 
-;;;###autoload
 (defun calendar-goto-bahai-date (date &optional noecho)
   "Move cursor to Baha'i date DATE.
 Echo Baha'i date unless NOECHO is t."
--- a/lisp/calendar/calendar.el	Mon Jul 16 19:26:14 2007 +0000
+++ b/lisp/calendar/calendar.el	Wed Jul 18 22:15:15 2007 +0000
@@ -1821,6 +1821,11 @@
 (autoload 'calendar-islamic-date-string "cal-islam"
   "String of Islamic date of Gregorian date.")
 
+(autoload 'calendar-goto-bahai-date "cal-bahai"
+  "Move cursor to Baha'i date DATE.
+Echo Baha'i date unless NOECHO is t."
+  t)
+
 (autoload 'calendar-print-bahai-date "cal-bahai"
   "Show the Baha'i date equivalents of date."
   t)
--- a/lisp/delsel.el	Mon Jul 16 19:26:14 2007 +0000
+++ b/lisp/delsel.el	Wed Jul 18 22:15:15 2007 +0000
@@ -87,12 +87,16 @@
 	  (cond ((eq type 'kill)
 		 (delete-active-region t))
 		((eq type 'yank)
-		 ;; Before a yank command,
-		 ;; make sure we don't yank the same region
-		 ;; that we are going to delete.
-		 ;; That would make yank a no-op.
-		 (when (string= (buffer-substring-no-properties (point) (mark))
-				(car kill-ring))
+		 ;; Before a yank command, make sure we don't yank the
+		 ;; head of the kill-ring that really comes from the
+		 ;; currently active region we are going to delete
+		 ;; (when last-command is one that uses copy-region-as-kill
+		 ;; or kill-new).  That would make yank a no-op.
+		 (when (and (string= (buffer-substring-no-properties (point) (mark))
+				     (car kill-ring))
+			    (memq last-command
+				  '(mouse-set-region mouse-drag-region
+				    mouse-save-then-kill mouse-secondary-save-then-kill)))
 		   (current-kill 1))
 		 (delete-active-region))
 		((eq type 'supersede)
--- a/lisp/emacs-lisp/cl-loaddefs.el	Mon Jul 16 19:26:14 2007 +0000
+++ b/lisp/emacs-lisp/cl-loaddefs.el	Wed Jul 18 22:15:15 2007 +0000
@@ -283,7 +283,7 @@
 ;;;;;;  do* do loop return-from return block etypecase typecase ecase
 ;;;;;;  case load-time-value eval-when destructuring-bind function*
 ;;;;;;  defmacro* defun* gentemp gensym cl-compile-time-init) "cl-macs"
-;;;;;;  "cl-macs.el" "7ccc827d272482ca276937ca18a7895a")
+;;;;;;  "cl-macs.el" "6990af555f962480552cf0867f3d5bab")
 ;;; Generated autoloads from cl-macs.el
 
 (autoload (quote cl-compile-time-init) "cl-macs" "\
--- a/lisp/emacs-lisp/lisp-mode.el	Mon Jul 16 19:26:14 2007 +0000
+++ b/lisp/emacs-lisp/lisp-mode.el	Wed Jul 18 22:15:15 2007 +0000
@@ -932,6 +932,16 @@
                        (goto-char indent-point)
                        (skip-chars-forward " \t")
                        (looking-at ":"))
+                     ;; The last sexp may not be at the indentation
+                     ;; where it begins, so find that one, instead.
+                     (save-excursion
+                       (goto-char calculate-lisp-indent-last-sexp)
+                       (while (and (not (looking-back "^[ \t]*"))
+                                   (or (not containing-sexp)
+                                       (< (1+ containing-sexp) (point))))
+                         (forward-sexp -1)
+                         (backward-prefix-chars))
+                       (setq calculate-lisp-indent-last-sexp (point)))
                      (> calculate-lisp-indent-last-sexp
                         (save-excursion
                           (goto-char (1+ containing-sexp))
--- a/lisp/emulation/cua-base.el	Mon Jul 16 19:26:14 2007 +0000
+++ b/lisp/emulation/cua-base.el	Wed Jul 18 22:15:15 2007 +0000
@@ -898,9 +898,6 @@
      (t
       ;; Must save register here, since delete may override reg 0.
       (if mark-active
-	  ;; Before a yank command, make sure we don't yank
-	  ;; the same region that we are going to delete.
-	  ;; That would make yank a no-op.
 	  (if cua--rectangle
 	      (progn
 		(goto-char (min (mark) (point)))
@@ -908,8 +905,16 @@
 		(setq paste-lines (cua--delete-rectangle))
 		(if (= paste-lines 1)
 		    (setq paste-lines nil))) ;; paste all
-	    (if (string= (filter-buffer-substring (point) (mark))
-			 (car kill-ring))
+	    ;; Before a yank command, make sure we don't yank the
+	    ;; head of the kill-ring that really comes from the
+	    ;; currently active region we are going to delete
+	    ;; (when last-command is one that uses copy-region-as-kill
+	    ;; or kill-new).  That would make yank a no-op.
+	    (if (and (string= (filter-buffer-substring (point) (mark))
+			      (car kill-ring))
+		     (memq last-command
+			   '(mouse-set-region mouse-drag-region
+			     mouse-save-then-kill mouse-secondary-save-then-kill)))
 		(current-kill 1))
 	    (cua-delete-region)))
       (cond
--- a/lisp/files.el	Mon Jul 16 19:26:14 2007 +0000
+++ b/lisp/files.el	Wed Jul 18 22:15:15 2007 +0000
@@ -727,7 +727,7 @@
 			  (cons load-path (get-load-suffixes)))))
   (load library))
 
-(defun file-remote-p (file &optional connected)
+(defun file-remote-p (file &optional identification connected)
   "Test whether FILE specifies a location on a remote system.
 Return an identification of the system if the location is indeed
 remote.  The identification of the system may comprise a method
@@ -736,6 +736,11 @@
 For example, the filename \"/user@host:/foo\" specifies a location
 on the system \"/user@host:\".
 
+IDENTIFICATION specifies which part of the identification shall
+be returned as string.  IDENTIFICATION can be the symbol
+`method', `user' or `host'; any other value is handled like nil
+and means to return the complete identification string.
+
 If CONNECTED is non-nil, the function returns an identification only
 if FILE is located on a remote system, and a connection is established
 to that remote system.
@@ -743,7 +748,7 @@
 `file-remote-p' will never open a connection on its own."
   (let ((handler (find-file-name-handler file 'file-remote-p)))
     (if handler
-	(funcall handler 'file-remote-p file connected)
+	(funcall handler 'file-remote-p file identification connected)
       nil)))
 
 (defun file-local-copy (file)
--- a/lisp/makefile.w32-in	Mon Jul 16 19:26:14 2007 +0000
+++ b/lisp/makefile.w32-in	Wed Jul 18 22:15:15 2007 +0000
@@ -444,5 +444,7 @@
 #
 # Maintenance
 #
+# We used to delete *~ here, but that might inadvertently remove
+# precious files if it happens to match their short 8+3 aliases.
 clean:
-		- $(DEL) *~
+		- $(DEL) *.el~
--- a/lisp/mouse.el	Mon Jul 16 19:26:14 2007 +0000
+++ b/lisp/mouse.el	Wed Jul 18 22:15:15 2007 +0000
@@ -1631,7 +1631,10 @@
   ;; Give temporary modes such as isearch a chance to turn off.
   (run-hooks 'mouse-leave-buffer-hook)
   (or mouse-yank-at-point (mouse-set-point click))
-  (insert (x-get-selection 'SECONDARY)))
+  (let ((secondary (x-get-selection 'SECONDARY)))
+    (if secondary
+        (insert (x-get-selection 'SECONDARY))
+      (error "No secondary selection"))))
 
 (defun mouse-kill-secondary ()
   "Kill the text in the secondary selection.
--- a/lisp/net/ange-ftp.el	Mon Jul 16 19:26:14 2007 +0000
+++ b/lisp/net/ange-ftp.el	Wed Jul 18 22:15:15 2007 +0000
@@ -4132,15 +4132,19 @@
 				       (format "Getting %s" fn1))
 	  tmp1))))
 
-(defun ange-ftp-file-remote-p (file &optional connected)
-  (and (or (not connected)
-	   (let* ((parsed (ange-ftp-ftp-name file))
-		  (host (nth 0 parsed))
-		  (user (nth 1 parsed))
-		  (proc (get-process (ange-ftp-ftp-process-buffer host user))))
-	     (and proc (processp proc)
-		  (memq (process-status proc) '(run open)))))
-       (ange-ftp-replace-name-component file "")))
+(defun ange-ftp-file-remote-p (file &optional identification connected)
+  (let* ((parsed (ange-ftp-ftp-name file))
+	 (host (nth 0 parsed))
+	 (user (nth 1 parsed)))
+    (and (or (not connected)
+	     (let ((proc (get-process (ange-ftp-ftp-process-buffer host user))))
+	       (and proc (processp proc)
+		    (memq (process-status proc) '(run open)))))
+	 (cond
+	  ((eq identification 'method) (and parsed "ftp"))
+	  ((eq identification 'user) user)
+	  ((eq identification 'host) host)
+	  (t (ange-ftp-replace-name-component file ""))))))
 
 (defun ange-ftp-load (file &optional noerror nomessage nosuffix)
   (if (ange-ftp-ftp-name file)
--- a/lisp/net/tramp-fish.el	Mon Jul 16 19:26:14 2007 +0000
+++ b/lisp/net/tramp-fish.el	Wed Jul 18 22:15:15 2007 +0000
@@ -263,6 +263,7 @@
     (make-symbolic-link . tramp-fish-handle-make-symbolic-link)
     (rename-file . tramp-fish-handle-rename-file)
     (set-file-modes . tramp-fish-handle-set-file-modes)
+    (set-file-times . tramp-fish-handle-set-file-times)
     (set-visited-file-modtime . ignore)
     (shell-command . tramp-handle-shell-command)
     (substitute-in-file-name . tramp-handle-substitute-in-file-name)
@@ -271,9 +272,8 @@
     (verify-visited-file-modtime . ignore)
     (write-region . tramp-fish-handle-write-region)
     (executable-find . tramp-fish-handle-executable-find)
-    (start-process . ignore)
-    (call-process . tramp-fish-handle-call-process)
-    (process-file . tramp-handle-process-file)
+    (start-file-process . ignore)
+    (process-file . tramp-fish-handle-process-file)
 )
   "Alist of handler functions for Tramp FISH method.
 Operations not mentioned here will be handled by the default Emacs primitives.")
@@ -698,6 +698,15 @@
       (tramp-error
        v 'file-error "Error while changing file's mode %s" filename))))
 
+(defun tramp-fish-handle-set-file-times (filename &optional time)
+  "Like `set-file-times' for Tramp files."
+  (with-parsed-tramp-file-name filename nil
+    (let ((time (if (or (null time) (equal time '(0 0))) (current-time) time)))
+      (zerop (process-file
+	      "touch" nil nil nil "-t"
+	      (format-time-string "%Y%m%d%H%M.%S" time)
+	      (tramp-shell-quote-argument localname))))))
+
 (defun tramp-fish-handle-write-region
   (start end filename &optional append visit lockname confirm)
   "Like `write-region' for Tramp files."
@@ -731,14 +740,14 @@
 (defun tramp-fish-handle-executable-find (command)
   "Like `executable-find' for Tramp files."
   (with-temp-buffer
-    (if (zerop (call-process "which" nil t nil command))
+    (if (zerop (process-file "which" nil t nil command))
 	(progn
 	  (goto-char (point-min))
 	  (buffer-substring (point-min) (tramp-line-end-position))))))
 
-(defun tramp-fish-handle-call-process
+(defun tramp-fish-handle-process-file
   (program &optional infile destination display &rest args)
-  "Like `call-process' for Tramp files."
+  "Like `process-file' for Tramp files."
   ;; The implementation is not complete yet.
   (when (and (numberp destination) (zerop destination))
     (error "Implementation does not handle immediate return"))
@@ -926,11 +935,8 @@
 	       (tramp-shell-quote-argument v1-localname)
 	       (tramp-shell-quote-argument v2-localname)))))
   ;; KEEP-DATE handling.
-  (when keep-date
-    (let ((modtime (nth 5 (file-attributes filename))))
-      (when (and (not (null modtime))
-		 (not (equal modtime '(0 0))))
-	(tramp-touch newname modtime))))
+  (when (and keep-date (functionp 'set-file-times))
+    (apply 'set-file-times (list newname (nth 5 (file-attributes filename)))))
   ;; Set the mode.
   (set-file-modes newname (file-modes filename)))
 
@@ -942,7 +948,8 @@
 SIZE MODE WEIRD INODE DEVICE)."
   (block nil
     (with-current-buffer (tramp-get-buffer vec)
-      ;; #LIST does not work properly with trailing "/", at least in .fishsrv.pl
+      ;; #LIST does not work properly with trailing "/", at least in
+      ;; .fishsrv.pl.
       (when (string-match "/$" localname)
 	(setq localname (concat localname ".")))
 
@@ -974,7 +981,7 @@
 	    ;; Add inode and device.
 	    (add-to-list
 	     'res (append item
-			  (list (tramp-get-inode (car item))
+			  (list (tramp-get-inode vec)
 				(tramp-get-device vec))))))
 
 	;; Read return code
--- a/lisp/net/tramp-smb.el	Mon Jul 16 19:26:14 2007 +0000
+++ b/lisp/net/tramp-smb.el	Wed Jul 18 22:15:15 2007 +0000
@@ -346,7 +346,7 @@
 			 (assoc (file-name-nondirectory filename) entries)))
 	     (uid (if (and id-format (equal id-format 'string)) "nobody" -1))
 	     (gid (if (and id-format (equal id-format 'string)) "nogroup" -1))
-	     (inode (tramp-get-inode filename))
+	     (inode (tramp-get-inode v))
 	     (device (tramp-get-device v)))
 
         ;; Check result.
--- a/lisp/net/tramp.el	Mon Jul 16 19:26:14 2007 +0000
+++ b/lisp/net/tramp.el	Wed Jul 18 22:15:15 2007 +0000
@@ -571,8 +571,9 @@
     ("plinkx"
              (tramp-login-program        "plink")
 	     (tramp-login-args           (("-load" "%h") ("-t")
-					  (,(format "env 'TERM=%s' 'PS1=$ '"
-						    tramp-terminal-type))
+					  (,(format
+					     "env 'TERM=%s' 'PROMPT_COMMAND=' 'PS1=$ '"
+					     tramp-terminal-type))
 					  ("/bin/sh")))
 	     (tramp-remote-sh            "/bin/sh")
 	     (tramp-copy-program         nil)
@@ -1772,6 +1773,7 @@
     (copy-file . tramp-handle-copy-file)
     (rename-file . tramp-handle-rename-file)
     (set-file-modes . tramp-handle-set-file-modes)
+    (set-file-times . tramp-handle-set-file-times)
     (make-directory . tramp-handle-make-directory)
     (delete-directory . tramp-handle-delete-directory)
     (delete-file . tramp-handle-delete-file)
@@ -2493,6 +2495,40 @@
       (tramp-error
        v 'file-error "Error while changing file's mode %s" filename))))
 
+(defun tramp-handle-set-file-times (filename &optional time)
+  "Like `set-file-times' for Tramp files."
+  (zerop
+   (if (file-remote-p filename)
+       (with-parsed-tramp-file-name filename nil
+	 (let ((time (if (or (null time) (equal time '(0 0)))
+			 (current-time)
+		       time))
+	       (utc
+		;; 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.
+		(and (functionp 'subr-arity)
+		     (subrp (symbol-function 'format-time-string))
+		     (= 3 (cdr (funcall (symbol-function 'subr-arity)
+					(symbol-function
+					 'format-time-string)))))))
+	   (tramp-send-command-and-check
+	    v (format "%s touch -t %s %s"
+		      (if utc "TZ=UTC; export TZ;" "")
+		      (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.
+     (call-process
+      "touch" nil nil nil "-t"
+      (format-time-string "%Y%m%d%H%M.%S" time)
+      (tramp-shell-quote-argument filename)))))
+
 ;; Simple functions using the `test' command.
 
 (defun tramp-handle-file-executable-p (filename)
@@ -2926,10 +2962,8 @@
 		(jka-compr-inhibit t))
 	    (write-region (point-min) (point-max) newname))))
     ;; KEEP-DATE handling.
-    (when keep-date
-      (when (and (not (null modtime))
-		 (not (equal modtime '(0 0))))
-	(tramp-touch newname modtime)))
+    (when (and keep-date (functionp 'set-file-times))
+      (apply 'set-file-times (list newname modtime)))
     ;; Set the mode.
     (set-file-modes newname (file-modes filename))
     ;; If the operation was `rename', delete the original file.
@@ -3078,8 +3112,9 @@
       (tramp-message v 0 "Transferring %s to %s...done" filename newname)
 
       ;; Handle KEEP-DATE argument.
-      (when (and keep-date (not copy-keep-date))
-	(set-file-times newname (nth 5 (file-attributes filename))))
+      (when (and keep-date (not copy-keep-date) (functionp 'set-file-times))
+	(apply 'set-file-times
+	       (list newname (nth 5 (file-attributes filename)))))
 
       ;; Set the mode.
       (unless (and keep-date copy-keep-date)
@@ -3282,8 +3317,7 @@
 ;; CCC is this the right thing to do?
 (defun tramp-handle-unhandled-file-name-directory (filename)
   "Like `unhandled-file-name-directory' for Tramp files."
-  (with-parsed-tramp-file-name filename nil
-    (expand-file-name (tramp-make-tramp-file-name method user host "~/"))))
+  (expand-file-name "~/"))
 
 ;; Canonicalization of file names.
 
@@ -3446,9 +3480,8 @@
 	  (tramp-set-connection-property v "process-name" name)
 	  (tramp-set-connection-property
 	   v "process-buffer"
-	   (get-buffer-create
-	    ;; BUFFER can be nil.
-	    (or buffer (generate-new-buffer-name (tramp-buffer-name v)))))
+	   ;; BUFFER can be nil.
+	   (get-buffer-create (or buffer (current-buffer))))
 	  ;; Activate narrowing in order to save BUFFER contents.
 	  (with-current-buffer (tramp-get-connection-buffer v)
 	    (narrow-to-region (point-max) (point-max)))
@@ -3466,7 +3499,9 @@
 	  ;; Return process.
 	  (tramp-get-connection-process v))
       ;; Save exit.
-      (with-current-buffer (tramp-get-connection-buffer v) (widen))
+      (with-current-buffer (tramp-get-connection-buffer v)
+	(widen)
+	(goto-char (point-max)))
       (tramp-set-connection-property v "process-name" nil)
       (tramp-set-connection-property v "process-buffer" nil))))
 
@@ -3575,12 +3610,33 @@
 (defun tramp-handle-shell-command
   (command &optional output-buffer error-buffer)
   "Like `shell-command' for Tramp files."
-  (with-parsed-tramp-file-name default-directory nil
-    (let ((shell-file-name
-	   (tramp-get-connection-property v "remote-shell" "/bin/sh"))
-	  (shell-command-switch "-c"))
-      (tramp-run-real-handler
-       'shell-command (list command output-buffer error-buffer)))))
+  (let* ((asynchronous (string-match "[ \t]*&[ \t]*\\'" command))
+	 (args (split-string (substring command 0 asynchronous) " "))
+	 (output-buffer
+	  (or output-buffer
+	      (if asynchronous
+		  "*Async Shell Command*"
+		"*Shell Command Output*")))
+	 (buffer
+	  (if (and (not asynchronous) (bufferp error-buffer))
+	      (with-parsed-tramp-file-name default-directory nil
+		(list output-buffer (tramp-make-tramp-temp-file v)))
+	    output-buffer)))
+
+    (prog1
+	;; Run the process.  We cannot use `process-file' and
+	;; `start-file-process', because these functions might not
+	;; exist in older Emacsen.
+	(if (integerp asynchronous)
+	    (apply 'tramp-handle-start-file-process
+		   "*Async Shell*" buffer args)
+	  (apply 'tramp-handle-process-file
+		 (car args) nil buffer nil (cdr args)))
+      ;; Insert error messages if they were separated.
+      (when (listp buffer)
+	(with-current-buffer error-buffer
+	  (insert-file-contents (cadr buffer)))
+	(delete-file (cadr buffer))))))
 
 ;; File Editing.
 
@@ -3657,14 +3713,18 @@
       (run-hooks 'tramp-handle-file-local-copy-hook)
       tmpfil)))
 
-(defun tramp-handle-file-remote-p (filename &optional connected)
+(defun tramp-handle-file-remote-p (file &optional identification connected)
   "Like `file-remote-p' for Tramp files."
   (when (tramp-tramp-file-p filename)
     (with-parsed-tramp-file-name filename nil
       (and (or (not connected)
 	       (let ((p (tramp-get-connection-process v)))
 		 (and p (processp p) (memq (process-status p) '(run open)))))
-	   (tramp-make-tramp-file-name method user host "")))))
+	   (cond
+	    ((eq identification 'method) method)
+	    ((eq identification 'user) user)
+	    ((eq identification 'host) host)
+	    (t (tramp-make-tramp-file-name method user host "")))))))
 
 (defun tramp-handle-insert-file-contents
   (filename &optional visit beg end replace)
@@ -4025,6 +4085,8 @@
 		  'load 'make-directory 'make-directory-internal
 		  'set-file-modes 'substitute-in-file-name
 		  'unhandled-file-name-directory 'vc-registered
+		  ; Emacs 22 only
+		  'set-file-times
 		  ; XEmacs only
 		  'abbreviate-file-name 'create-file-buffer
 		  'dired-file-modtime 'dired-make-compressed-filename
@@ -4886,40 +4948,6 @@
 	       (tramp-shell-quote-argument v1-localname)
 	       (tramp-shell-quote-argument v2-localname))))))
 
-(defun tramp-touch (file time)
-  "Set the last-modified timestamp of the given file.
-TIME is an Emacs internal time value as returned by `current-time'."
-  (let* ((utc
-	  ;; With GNU Emacs, `format-time-string' has an optional
-	  ;; parameter UNIVERSAL.  This is preferred.
-	  (and (functionp 'subr-arity)
-	       (subrp (symbol-function 'format-time-string))
-	       (= 3 (cdr (funcall (symbol-function 'subr-arity)
-				  (symbol-function 'format-time-string))))))
-	 (touch-time
-	  (if utc
-	      (format-time-string "%Y%m%d%H%M.%S" time t)
-	    (format-time-string "%Y%m%d%H%M.%S" time)))
-	 (default-directory (file-name-directory file)))
-
-    (if (eq (tramp-find-foreign-file-name-handler file)
-	    'tramp-sh-file-name-handler)
-	(with-parsed-tramp-file-name file nil
-	  (tramp-send-command
-	   v (format "%s touch -t %s %s"
-		     (if utc "TZ=UTC; export TZ;" "")
-		     touch-time
-		     (tramp-shell-quote-argument localname))))
-      (with-temp-buffer
-	(shell-command
-	 (format "%s touch -t %s %s"
-		 (if utc "TZ=UTC; export TZ;" "")
-		 touch-time
-		 (tramp-shell-quote-argument
-		  (if (tramp-tramp-file-p file)
-		      (with-parsed-tramp-file-name file nil localname) file)))
-	 (current-buffer))))))
-
 (defun tramp-buffer-name (vec)
   "A name for the connection buffer VEC."
   ;; We must use `tramp-file-name-real-host', because for gateway
@@ -5179,7 +5207,8 @@
 	    (when extra-args (setq shell (concat shell " " extra-args))))
 	  (tramp-message
 	   vec 5 "Starting remote shell `%s' for tilde expansion..." shell)
-	  (tramp-send-command-internal vec (concat "PS1='$ ' exec " shell))
+	  (tramp-send-command-internal
+	   vec (concat "PROMPT_COMMAND='' PS1='$ ' exec " shell))
 	  (tramp-message vec 5 "Setting remote shell prompt...")
 	  ;; Douglas Gray Stephens <DGrayStephens@slb.com> says that we
 	  ;; must use "\n" here, not tramp-rsh-end-of-line.  Kai left the
@@ -5187,7 +5216,7 @@
 	  ;; as well.
 	  (tramp-send-command
 	   vec
-	   (format "PS1='%s%s%s'; PS2=''; PS3=''"
+	   (format "PROMPT_COMMAND=''; PS1='%s%s%s'; PS2=''; PS3=''"
 		   tramp-rsh-end-of-line
 		   tramp-end-of-output
 		   tramp-rsh-end-of-line))
@@ -5455,10 +5484,11 @@
   ;; makes it work under `rc', too.  We also unset the variable $ENV
   ;; because that is read by some sh implementations (eg, bash when
   ;; called as sh) on startup; this way, we avoid the startup file
-  ;; clobbering $PS1.
+  ;; clobbering $PS1.  $PROMP_COMMAND is another way to set the prompt
+  ;; in /bin/bash, it must be discarded as well.
   (tramp-send-command-internal
    vec
-   (format "exec env 'ENV=' 'PS1=$ ' %s"
+   (format "exec env 'ENV=' 'PROMPT_COMMAND=' 'PS1=$ ' %s"
 	   (tramp-get-method-parameter
 	    (tramp-file-name-method vec) 'tramp-remote-sh)))
   (tramp-message vec 5 "Setting up remote shell environment")
@@ -5512,7 +5542,7 @@
   ;; send "echo are you awake".
   (tramp-send-command
    vec
-   (format "PS1='%s%s%s'; PS2=''; PS3=''"
+   (format "PROMPT_COMMAND=''; PS1='%s%s%s'; PS2=''; PS3=''"
 	   tramp-rsh-end-of-line
            tramp-end-of-output
 	   tramp-rsh-end-of-line))
@@ -5893,6 +5923,7 @@
       (when (and p (processp p))
 	(delete-process p))
       (setenv "TERM" tramp-terminal-type)
+      (setenv "PROMPT_COMMAND")
       (setenv "PS1" "$ ")
       (let* ((target-alist (tramp-compute-multi-hops vec))
 	     (process-environment (copy-sequence process-environment))
@@ -6243,17 +6274,24 @@
   ;; Convert inode.
   (unless (listp (nth 10 attr))
     (setcar (nthcdr 10 attr)
-            (list (floor (nth 10 attr) 65536)
-                  (floor (mod (nth 10 attr) 65536)))))
+	    (condition-case nil
+		(list (floor (nth 10 attr) 65536)
+		      (floor (mod (nth 10 attr) 65536)))
+	      ;; Inodes can be incredible huge.  We must hide this.
+	      (error (tramp-get-inode vec)))))
   ;; Set virtual device number.
   (setcar (nthcdr 11 attr)
           (tramp-get-device vec))
   attr)
 
-(defun tramp-get-inode (file)
+(defun tramp-get-inode (vec)
   "Returns the virtual inode number.
 If it doesn't exist, generate a new one."
-  (let ((string (directory-file-name file)))
+  (let ((string (tramp-make-tramp-file-name
+		 (tramp-file-name-method vec)
+		 (tramp-file-name-user vec)
+		 (tramp-file-name-host vec)
+		 "")))
     (unless (assoc string tramp-inodes)
       (add-to-list 'tramp-inodes
 		   (list string (length tramp-inodes))))
--- a/lisp/progmodes/grep.el	Mon Jul 16 19:26:14 2007 +0000
+++ b/lisp/progmodes/grep.el	Wed Jul 18 22:15:15 2007 +0000
@@ -371,92 +371,134 @@
 
 (defun grep-probe (command args &optional func result)
   (equal (condition-case nil
-	     (apply (or func 'call-process) command args)
+	     (apply (or func 'process-file) command args)
 	   (error nil))
 	 (or result 0)))
 
 ;;;###autoload
 (defun grep-compute-defaults ()
-  (unless (or (not grep-use-null-device) (eq grep-use-null-device t))
-    (setq grep-use-null-device
-	  (with-temp-buffer
-	    (let ((hello-file (expand-file-name "HELLO" data-directory)))
-	      (not
-	       (and (if grep-command
-			;; `grep-command' is already set, so
-			;; use that for testing.
-			(grep-probe grep-command
-				    `(nil t nil "^English" ,hello-file)
-				    #'call-process-shell-command)
-		      ;; otherwise use `grep-program'
-		      (grep-probe grep-program
-				  `(nil t nil "-nH" "^English" ,hello-file)))
-		    (progn
-		      (goto-char (point-min))
-		      (looking-at
-		       (concat (regexp-quote hello-file)
-			       ":[0-9]+:English")))))))))
-  (unless (and grep-command grep-find-command
-	       grep-template grep-find-template)
-    (let ((grep-options
-	   (concat (if grep-use-null-device "-n" "-nH")
-		   (if (grep-probe grep-program
-				   `(nil nil nil "-e" "foo" ,null-device)
-				   nil 1)
-		       " -e"))))
-      (unless grep-command
-	(setq grep-command
-	      (format "%s %s " grep-program grep-options)))
-      (unless grep-template
-	(setq grep-template
-	      (format "%s <C> %s <R> <F>" grep-program grep-options)))
-      (unless grep-find-use-xargs
-	(setq grep-find-use-xargs
-	      (cond
-	       ((and
-		 (grep-probe find-program `(nil nil nil ,null-device "-print0"))
-		 (grep-probe "xargs" `(nil nil nil "-0" "-e" "echo")))
-		'gnu)
-	       (t
-		'exec))))
-      (unless grep-find-command
-	(setq grep-find-command
-	      (cond ((eq grep-find-use-xargs 'gnu)
-		     (format "%s . -type f -print0 | xargs -0 -e %s"
-			     find-program grep-command))
-		    ((eq grep-find-use-xargs 'exec)
-		     (let ((cmd0 (format "%s . -type f -exec %s"
-					 find-program grep-command)))
-		       (cons
-			(format "%s {} %s %s"
-				cmd0 null-device
-				(shell-quote-argument ";"))
-			(1+ (length cmd0)))))
-		    (t
-		     (format "%s . -type f -print | xargs %s"
-			     find-program grep-command)))))
-      (unless grep-find-template
-	(setq grep-find-template
-	      (let ((gcmd (format "%s <C> %s <R>"
-				  grep-program grep-options)))
+  (let ((host-id
+	 (intern (or (file-remote-p default-directory 'host) "localhost"))))
+    ;; There are different defaults on different hosts.  They must be
+    ;; computed for every host once, then they are kept in the
+    ;; variables' property host-id for reuse.
+    (setq grep-command
+	  (or (get 'grep-command host-id)
+	      (eval (car (get 'grep-command 'standard-value))))
+
+	  grep-template
+          (or (get 'grep-template host-id)
+	      (eval (car (get 'grep-template 'standard-value))))
+
+	  grep-use-null-device
+	  (or (get 'grep-use-null-device host-id)
+	      (eval (car (get 'grep-use-null-device 'standard-value))))
+
+	  grep-find-command
+	  (or (get 'grep-find-command host-id)
+	      (eval (car (get 'grep-find-command 'standard-value))))
+
+	  grep-find-template
+	  (or (get 'grep-find-template host-id)
+	      (eval (car (get 'grep-find-template 'standard-value))))
+
+	  grep-find-use-xargs
+	  (or (get 'grep-find-use-xargs host-id)
+	      (eval (car (get 'grep-find-use-xargs 'standard-value))))
+
+	  grep-highlight-matches
+	  (or (get 'grep-highlight-matches host-id)
+	      (eval (car (get 'grep-highlight-matches 'standard-value)))))
+
+    (unless (or (not grep-use-null-device) (eq grep-use-null-device t))
+      (setq grep-use-null-device
+	    (with-temp-buffer
+	      (let ((hello-file (expand-file-name "HELLO" data-directory)))
+		(not
+		 (and (if grep-command
+			  ;; `grep-command' is already set, so
+			  ;; use that for testing.
+			  (grep-probe grep-command
+				      `(nil t nil "^English" ,hello-file)
+				      #'call-process-shell-command)
+			;; otherwise use `grep-program'
+			(grep-probe grep-program
+				    `(nil t nil "-nH" "^English" ,hello-file)))
+		      (progn
+			(goto-char (point-min))
+			(looking-at
+			 (concat (regexp-quote hello-file)
+				 ":[0-9]+:English")))))))))
+    (unless (and grep-command grep-find-command
+		 grep-template grep-find-template)
+      (let ((grep-options
+	     (concat (if grep-use-null-device "-n" "-nH")
+		     (if (grep-probe grep-program
+				     `(nil nil nil "-e" "foo" ,null-device)
+				     nil 1)
+			 " -e"))))
+	(unless grep-command
+	  (setq grep-command
+		(format "%s %s " grep-program grep-options)))
+	(unless grep-template
+	  (setq grep-template
+		(format "%s <C> %s <R> <F>" grep-program grep-options)))
+	(unless grep-find-use-xargs
+	  (setq grep-find-use-xargs
+		(cond
+		 ((and
+		   (grep-probe find-program `(nil nil nil ,null-device "-print0"))
+		   (grep-probe "xargs" `(nil nil nil "-0" "-e" "echo")))
+		  'gnu)
+		 (t
+		  'exec))))
+	(unless grep-find-command
+	  (setq grep-find-command
 		(cond ((eq grep-find-use-xargs 'gnu)
-		       (format "%s . <X> -type f <F> -print0 | xargs -0 -e %s"
-			       find-program gcmd))
+		       (format "%s . -type f -print0 | xargs -0 -e %s"
+			       find-program grep-command))
 		      ((eq grep-find-use-xargs 'exec)
-		       (format "%s . <X> -type f <F> -exec %s {} %s %s"
-			       find-program gcmd null-device
-			       (shell-quote-argument ";")))
+		       (let ((cmd0 (format "%s . -type f -exec %s"
+					   find-program grep-command)))
+			 (cons
+			  (format "%s {} %s %s"
+				  cmd0 null-device
+				  (shell-quote-argument ";"))
+			  (1+ (length cmd0)))))
 		      (t
-		       (format "%s . <X> -type f <F> -print | xargs %s"
-			       find-program gcmd))))))))
-  (unless (or (not grep-highlight-matches) (eq grep-highlight-matches t))
-    (setq grep-highlight-matches
-	  (with-temp-buffer
-	    (and (grep-probe grep-program '(nil t nil "--help"))
-		 (progn
-		   (goto-char (point-min))
-		   (search-forward "--color" nil t))
-		 t)))))
+		       (format "%s . -type f -print | xargs %s"
+			       find-program grep-command)))))
+	(unless grep-find-template
+	  (setq grep-find-template
+		(let ((gcmd (format "%s <C> %s <R>"
+				    grep-program grep-options)))
+		  (cond ((eq grep-find-use-xargs 'gnu)
+			 (format "%s . <X> -type f <F> -print0 | xargs -0 -e %s"
+				 find-program gcmd))
+			((eq grep-find-use-xargs 'exec)
+			 (format "%s . <X> -type f <F> -exec %s {} %s %s"
+				 find-program gcmd null-device
+				 (shell-quote-argument ";")))
+			(t
+			 (format "%s . <X> -type f <F> -print | xargs %s"
+				 find-program gcmd))))))))
+    (unless (or (not grep-highlight-matches) (eq grep-highlight-matches t))
+      (setq grep-highlight-matches
+	    (with-temp-buffer
+	      (and (grep-probe grep-program '(nil t nil "--help"))
+		   (progn
+		     (goto-char (point-min))
+		     (search-forward "--color" nil t))
+		   t))))
+
+    ;; Save defaults for this host.
+    (put 'grep-command host-id grep-command)
+    (put 'grep-template host-id grep-template)
+    (put 'grep-use-null-device host-id grep-use-null-device)
+    (put 'grep-find-command host-id grep-find-command)
+    (put 'grep-find-template host-id grep-find-template)
+    (put 'grep-find-use-xargs host-id grep-find-use-xargs)
+    (put 'grep-highlight-matches host-id grep-highlight-matches)))
 
 (defun grep-tag-default ()
   (or (and transient-mark-mode mark-active
--- a/lisp/progmodes/sh-script.el	Mon Jul 16 19:26:14 2007 +0000
+++ b/lisp/progmodes/sh-script.el	Wed Jul 18 22:15:15 2007 +0000
@@ -986,7 +986,7 @@
   ;; This looks silly, but it's because `sh-here-doc-re' keeps changing.
   (re-search-forward sh-here-doc-re limit t))
 
-(defun sh-quoted-subshell (limit)
+(defun sh-font-lock-quoted-subshell (limit)
   "Search for a subshell embedded in a string.
 Find all the unescaped \" characters within said subshell, remembering that
 subshells can nest."
@@ -1018,6 +1018,7 @@
                  (t (push state states) (setq state 'backquote))))
           (?\$ (if (not (eq (char-after (1+ (point))) ?\())
                    nil
+                 (forward-char 1)
                  (case state
                    (t (push state states) (setq state 'code)))))
           (?\( (case state
@@ -1026,7 +1027,7 @@
           (?\) (case state
                  (double-quote nil)
                  (t (setq state (pop states)))))
-          (t (error "Internal error in sh-quoted-subshell")))
+          (t (error "Internal error in sh-font-lock-quoted-subshell")))
         (forward-char 1)))
     t))
             
@@ -1111,7 +1112,7 @@
     (")" 0 (sh-font-lock-paren (match-beginning 0)))
     ;; highlight (possibly nested) subshells inside "" quoted regions correctly.
     ;; This should be at the very end because it uses syntax-ppss.
-    (sh-quoted-subshell)))
+    (sh-font-lock-quoted-subshell)))
 
 (defun sh-font-lock-syntactic-face-function (state)
   (let ((q (nth 3 state)))
--- a/lisp/ps-print.el	Mon Jul 16 19:26:14 2007 +0000
+++ b/lisp/ps-print.el	Wed Jul 18 22:15:15 2007 +0000
@@ -6467,10 +6467,8 @@
 ;; To make this file smaller, some commands go in a separate file.
 ;; But autoload them here to make the separation invisible.
 
-;;;### (autoloads (ps-mule-begin-page ps-mule-begin-job ps-mule-encode-header-string
-;;;;;;  ps-mule-initialize ps-mule-plot-composition ps-mule-plot-string
-;;;;;;  ps-mule-set-ascii-font ps-mule-prepare-ascii-font ps-multibyte-buffer)
-;;;;;;  "ps-mule" "ps-mule.el" "464a9fb9d59f7561a46bcd5ca87d85db")
+;;;### (autoloads (ps-mule-end-job ps-mule-begin-job ps-mule-initialize
+;;;;;;  ps-multibyte-buffer) "ps-mule" "ps-mule.el" "bb18668f99d691db470ec2a32753ba28")
 ;;; Generated autoloads from ps-mule.el
 
 (defvar ps-multibyte-buffer nil "\
@@ -6518,69 +6516,19 @@
 
 (custom-autoload (quote ps-multibyte-buffer) "ps-mule" t)
 
-(autoload (quote ps-mule-prepare-ascii-font) "ps-mule" "\
-Setup special ASCII font for STRING.
-STRING should contain only ASCII characters.
-
-\(fn STRING)" nil nil)
-
-(autoload (quote ps-mule-set-ascii-font) "ps-mule" "\
-Not documented
-
-\(fn)" nil nil)
-
-(autoload (quote ps-mule-plot-string) "ps-mule" "\
-Generate PostScript code for plotting characters in the region FROM and TO.
-
-It is assumed that all characters in this region belong to the same charset.
-
-Optional argument BG-COLOR specifies background color.
-
-Returns the value:
-
-	(ENDPOS . RUN-WIDTH)
-
-Where ENDPOS is the end position of the sequence and RUN-WIDTH is the width of
-the sequence.
-
-\(fn FROM TO &optional BG-COLOR)" nil nil)
-
-(autoload (quote ps-mule-plot-composition) "ps-mule" "\
-Generate PostScript code for plotting composition in the region FROM and TO.
-
-It is assumed that all characters in this region belong to the same
-composition.
-
-Optional argument BG-COLOR specifies background color.
-
-Returns the value:
-
-	(ENDPOS . RUN-WIDTH)
-
-Where ENDPOS is the end position of the sequence and RUN-WIDTH is the width of
-the sequence.
-
-\(fn FROM TO &optional BG-COLOR)" nil nil)
-
 (autoload (quote ps-mule-initialize) "ps-mule" "\
 Initialize global data for printing multi-byte characters.
 
 \(fn)" nil nil)
 
-(autoload (quote ps-mule-encode-header-string) "ps-mule" "\
-Generate PostScript code for ploting STRING by font FONTTAG.
-FONTTAG should be a string \"/h0\" or \"/h1\".
-
-\(fn STRING FONTTAG)" nil nil)
-
 (autoload (quote ps-mule-begin-job) "ps-mule" "\
 Start printing job for multi-byte chars between FROM and TO.
 This checks if all multi-byte characters in the region are printable or not.
 
 \(fn FROM TO)" nil nil)
 
-(autoload (quote ps-mule-begin-page) "ps-mule" "\
-Not documented
+(autoload (quote ps-mule-end-job) "ps-mule" "\
+Finish printing job for multi-byte chars.
 
 \(fn)" nil nil)
 
--- a/lisp/recentf.el	Mon Jul 16 19:26:14 2007 +0000
+++ b/lisp/recentf.el	Wed Jul 18 22:15:15 2007 +0000
@@ -89,7 +89,7 @@
   :group 'recentf
   :type '(choice (const :tag "Don't change" nil)
           integer))
-  
+
 (defcustom recentf-exclude nil
   "*List of regexps and predicates for filenames excluded from the recent list.
 When a filename matches any of the regexps or satisfies any of the
@@ -99,19 +99,27 @@
   :group 'recentf
   :type '(repeat (choice regexp function)))
 
+(defun recentf-keep-default-predicate (file)
+  "Return non-nil if FILE should be kept in the recent list.
+It handles the case of remote files as well."
+  (cond
+   ((file-remote-p file nil t) (file-readable-p file))
+   ((file-remote-p file))
+   ((file-readable-p file))))
+
 (defcustom recentf-keep
-  '(file-readable-p)
+  '(recentf-keep-default-predicate)
   "*List of regexps and predicates for filenames kept in the recent list.
 Regexps and predicates are tried in the specified order.
 When nil all filenames are kept in the recent list.
 When a filename matches any of the regexps or satisfies any of the
 predicates it is kept in the recent list.
-The default is to keep readable files.
+The default is to keep readable files.  Remote files are checked
+for readability only in case a connection is established to that
+remote system, otherwise they are kept in the recent list without
+checking their readability.
 A predicate is a function that is passed a filename to check and that
-must return non-nil to keep it.  For example, you can add the
-`file-remote-p' predicate in front of this list to keep remote file
-names in the recent list without checking their readability through a
-remote access."
+must return non-nil to keep it."
   :group 'recentf
   :type '(repeat (choice regexp function)))
 
--- a/lisp/term/xterm.el	Mon Jul 16 19:26:14 2007 +0000
+++ b/lisp/term/xterm.el	Wed Jul 18 22:15:15 2007 +0000
@@ -400,7 +400,37 @@
     ;; Do it!
     (xterm-register-default-colors)
     ;; This recomputes all the default faces given the colors we've just set up.
-    (tty-set-up-initial-frame-faces)))
+    (tty-set-up-initial-frame-faces)
+
+    ;; Try to turn on the modifyOtherKeys feature on modern xterms.
+    ;; When it is turned on much more key bindings work: things like
+    ;; C-. C-, etc.
+    ;; To do that we need to find out if the current terminal supports
+    ;; modifyOtherKeys. At this time only xterm does.
+    (let ((coding-system-for-read 'binary)
+	  (chr nil)
+	  (str nil))
+      ;; Try to find out the type of terminal by sending a "Secondary
+      ;; Device Attributes (DA)" query.
+      (send-string-to-terminal "\e[>0c")
+
+      ;; The reply should be of the form: \e [ > NUMBER1 ; NUMBER2 ; NUMBER3 c
+      (when (equal (read-event nil nil 0.1) ?\e)
+	(when (equal (read-event nil nil 0.1) ?\[)
+	  (while (not (equal (setq chr (read-event nil nil 0.1)) ?c))
+	    (setq str (concat str (string chr))))
+	  (when (string-match ">0;\\([0-9]+\\);0" str)
+	    ;; NUMBER2 is the xterm version number, look for something
+	    ;; greater than 216, the version when modifyOtherKeys was
+	    ;; introduced.
+	    (when (>= (string-to-number 
+		       (substring str (match-beginning 1) (match-end 1))) 216)
+	      ;; Make sure that the modifyOtherKeys state is restored when
+	      ;; suspending, resuming and exiting.
+	      (add-hook 'suspend-hook 'xterm-turn-off-modify-other-keys)
+	      (add-hook 'suspend-resume-hook 'xterm-turn-on-modify-other-keys)
+	      (add-hook 'kill-emacs-hook 'xterm-turn-off-modify-other-keys)
+	      (xterm-turn-on-modify-other-keys))))))))
 
 ;; Set up colors, for those versions of xterm that support it.
 (defvar xterm-standard-colors
@@ -518,5 +548,13 @@
     ;; right colors, so clear them.
     (clear-face-cache)))
 
+(defun xterm-turn-on-modify-other-keys ()
+  "Turn on the modifyOtherKeys feature of xterm."
+  (send-string-to-terminal "\e[>4;1m"))
+
+(defun xterm-turn-off-modify-other-keys ()
+  "Turn off the modifyOtherKeys feature of xterm."
+  (send-string-to-terminal "\e[>4m"))
+
 ;; arch-tag: 12e7ebdd-1e6c-4b25-b0f9-35ace25e855a
 ;;; xterm.el ends here
--- a/lisp/textmodes/tex-mode.el	Mon Jul 16 19:26:14 2007 +0000
+++ b/lisp/textmodes/tex-mode.el	Wed Jul 18 22:15:15 2007 +0000
@@ -637,26 +637,31 @@
 
 (defvar tex-verbatim-environments
   '("verbatim" "verbatim*"))
+(put 'tex-verbatim-environments 'safe-local-variable
+     (lambda (x) (require 'cl) (every 'stringp x)))
 
 (defvar tex-font-lock-syntactic-keywords
-  (let ((verbs (regexp-opt tex-verbatim-environments t)))
-    `((,(concat "^\\\\begin *{" verbs "}.*\\(\n\\)") 2 "|")
-      ;; Technically, we'd like to put the "|" property on the \n preceding
-      ;; the \end, but this would have 2 disadvantages:
-      ;; 1 - it's wrong if the verbatim env is empty (the same \n is used to
-      ;;     start and end the fenced-string).
-      ;; 2 - font-lock considers the preceding \n as being part of the
-      ;;     preceding line, so things gets screwed every time the previous
-      ;;     line is re-font-locked on its own.
-      ;; There's a hack in tex-font-lock-keywords-1 to remove the verbatim
-      ;; face from the \ but C-M-f still jumps to the wrong spot :-(  --Stef
-      (,(concat "^\\(\\\\\\)end *{" verbs "}\\(.?\\)") (1 "|") (3 "<"))
-      ;; ("^\\(\\\\\\)begin *{comment}" 1 "< b")
-      ;; ("^\\\\end *{comment}.*\\(\n\\)" 1 "> b")
-      ("\\\\verb\\**\\([^a-z@*]\\)"
-       ;; Do it last, because it uses syntax-ppss which needs the
-       ;; syntax-table properties of previous entries.
-       1 (tex-font-lock-verb (match-end 1))))))
+  '((eval . `(,(concat "^\\\\begin *{"
+                       (regexp-opt tex-verbatim-environments t)
+                       "}.*\\(\n\\)") 2 "|"))
+    ;; Technically, we'd like to put the "|" property on the \n preceding
+    ;; the \end, but this would have 2 disadvantages:
+    ;; 1 - it's wrong if the verbatim env is empty (the same \n is used to
+    ;;     start and end the fenced-string).
+    ;; 2 - font-lock considers the preceding \n as being part of the
+    ;;     preceding line, so things gets screwed every time the previous
+    ;;     line is re-font-locked on its own.
+    ;; There's a hack in tex-font-lock-keywords-1 to remove the verbatim
+    ;; face from the \ but C-M-f still jumps to the wrong spot :-(  --Stef
+    (eval . `(,(concat "^\\(\\\\\\)end *{"
+                       (regexp-opt tex-verbatim-environments t)
+                       "}\\(.?\\)") (1 "|") (3 "<")))
+    ;; ("^\\(\\\\\\)begin *{comment}" 1 "< b")
+    ;; ("^\\\\end *{comment}.*\\(\n\\)" 1 "> b")
+    ("\\\\verb\\**\\([^a-z@*]\\)"
+     ;; Do it last, because it uses syntax-ppss which needs the
+     ;; syntax-table properties of previous entries.
+     1 (tex-font-lock-verb (match-end 1)))))
 
 (defun tex-font-lock-unfontify-region (beg end)
   (font-lock-default-unfontify-region beg end)
--- a/lisp/vc-bzr.el	Mon Jul 16 19:26:14 2007 +0000
+++ b/lisp/vc-bzr.el	Wed Jul 18 22:15:15 2007 +0000
@@ -88,30 +88,6 @@
                  (repeat :tag "Argument List" :value ("") string))
   :group 'vc-bzr)
 
-(defvar vc-bzr-version nil
-  "Internal use.")
-
-;; Could be used for compatibility checks if bzr changes.
-(defun vc-bzr-version ()
-  "Return a three-numeric element list with components of the bzr version.
-This is of the form (X Y Z) for revision X.Y.Z.  The elements are zero
-if running `vc-bzr-program' doesn't produce the expected output."
-  (or vc-bzr-version
-      (setq vc-bzr-version
-            (let ((s (shell-command-to-string
-                      (concat (shell-quote-argument vc-bzr-program)
-                              " --version"))))
-              (if (string-match "\\([0-9]+\\)\\.\\([0-9]+\\)\\.\\([0-9]+\\)$" s)
-                  (list (string-to-number (match-string 1 s))
-                        (string-to-number (match-string 2 s))
-                        (string-to-number (match-string 3 s)))
-                '(0 0 0))))))
-
-(defun vc-bzr-at-least-version (vers)
-  "Return t if the bzr command reports being a least version VERS.
-First argument VERS is a list of the form (X Y Z), as returned by `vc-bzr-version'."
-  (version-list-<= vers (vc-bzr-version)))
-
 ;; since v0.9, bzr supports removing the progress indicators
 ;; by setting environment variable BZR_PROGRESS_BAR to "none".
 (defun vc-bzr-command (bzr-command buffer okstatus file &rest args)
@@ -128,29 +104,7 @@
         (process-connection-type nil))
     (apply 'vc-do-command buffer okstatus vc-bzr-program
            file bzr-command (append vc-bzr-program-args args))))
-  
-(unless (vc-bzr-at-least-version '(0 9))
-  ;; For older versions, we fall back to washing the log buffer
-  ;; when all output has been gathered.
-  (defun vc-bzr-post-command-function (command file flags)
-    "`vc-post-command-functions' function to remove progress messages."
-    ;; Note that using this requires that the vc command is run
-    ;; synchronously.  Otherwise, the ^Ms in the leading progress
-    ;; message on stdout cause the stream to be interpreted as having
-    ;; DOS line endings, losing the ^Ms, so the search fails.  I don't
-    ;; know how this works under Windows.
-    (when (equal command vc-bzr-program)
-      (save-excursion
-        (goto-char (point-min))
-        (if (looking-at "^\\(\r.*\r\\)[^\r]+$")
-            (replace-match "" nil nil nil 1)))
-      (save-excursion
-        (goto-char (point-min))
-        ;; This is inserted by bzr 0.11 `log', at least
-        (while (looking-at "read knit.*\n")
-          (replace-match "")))))
 
-  (add-hook 'vc-post-command-functions 'vc-bzr-post-command-function))
 
 ;;;###autoload
 (defconst vc-bzr-admin-dirname ".bzr")    ; FIXME: "_bzr" on w32?
--- a/lisp/vc-hooks.el	Mon Jul 16 19:26:14 2007 +0000
+++ b/lisp/vc-hooks.el	Wed Jul 18 22:15:15 2007 +0000
@@ -62,8 +62,9 @@
   :type 'regexp
   :group 'vc)
 
-(defcustom vc-handled-backends '(RCS CVS BZR SVN SCCS HG Arch MCVS)
-  ;; Arch and MCVS come last because they are per-tree rather than per-dir.
+(defcustom vc-handled-backends '(RCS CVS SVN SCCS BZR HG Arch MCVS)
+  ;; BZR, HG, Arch and MCVS come last because they are per-tree rather
+  ;; than per-dir.
   "List of version control backends for which VC will be used.
 Entries in this list will be tried in order to determine whether a
 file is under that sort of version control.
@@ -71,7 +72,7 @@
 when visiting a file managed by that backend.
 An empty list disables VC altogether."
   :type '(repeat symbol)
-  :version "21.1"
+  :version "23.1"
   :group 'vc)
 
 (defcustom vc-path
--- a/lisp/vc.el	Mon Jul 16 19:26:14 2007 +0000
+++ b/lisp/vc.el	Wed Jul 18 22:15:15 2007 +0000
@@ -224,7 +224,7 @@
 ;;   The implementation should pass the value of vc-checkout-switches
 ;;   to the backend command.
 ;;
-;; - checkout (file &optional editable rev)
+;; * checkout (file &optional editable rev)
 ;;
 ;;   Check out revision REV of FILE into the working area.  If EDITABLE
 ;;   is non-nil, FILE should be writable by the user and if locking is
--- a/lispref/ChangeLog	Mon Jul 16 19:26:14 2007 +0000
+++ b/lispref/ChangeLog	Wed Jul 18 22:15:15 2007 +0000
@@ -1,3 +1,8 @@
+2007-07-17  Michael Albinus  <michael.albinus@gmx.de>
+
+	* files.texi (Magic File Names): Introduce optional parameter
+	IDENTIFICATION for `file-remote-p'.
+
 2007-07-14  Richard Stallman  <rms@gnu.org>
 
 	* control.texi (Handling Errors): Document `debug' in handler list.
--- a/lispref/files.texi	Mon Jul 16 19:26:14 2007 +0000
+++ b/lispref/files.texi	Wed Jul 18 22:15:15 2007 +0000
@@ -2768,7 +2768,7 @@
 of the local copy file.
 @end defun
 
-@defun file-remote-p filename &optional connected
+@defun file-remote-p filename &optional identification connected
 This function tests whether @var{filename} is a remote file.  If
 @var{filename} is local (not remote), the return value is @code{nil}.
 If @var{filename} is indeed remote, the return value is a string that
@@ -2786,6 +2786,13 @@
 files at the same time.  Implementors of file handlers need to ensure
 this principle is valid.
 
+@var{identification} specifies which part of the identifier shall be
+returned as string.  @var{identification} can be the symbol
+@code{method}, @code{user} or @code{host}; any other value is handled
+like @code{nil} and means to return the complete identifier string.
+In the example above, the remote @code{user} identifier string would
+be @code{root}.
+
 If @var{connected} is non-@code{nil}, this function returns @code{nil}
 even if @var{filename} is remote, if Emacs has no network connection
 to its host.  This is useful when you want to avoid the delay of
--- a/man/ChangeLog	Mon Jul 16 19:26:14 2007 +0000
+++ b/man/ChangeLog	Wed Jul 18 22:15:15 2007 +0000
@@ -1,3 +1,18 @@
+2007-07-17  Michael Albinus  <michael.albinus@gmx.de>
+
+	* tramp.texi: Move @setfilename ../info/tramp up, outside the header
+	section.  Reported by <poti@potis.org>.
+	(Remote processes): Arguments of the program to be debugged are taken
+	literally.
+	(Frequently Asked Questions): Simplify recentf example.
+
+2007-07-14  Karl Berry  <karl@gnu.org>
+
+	* info.texi (@copying): New Back-Cover Text.
+
+	* info.texi (Quitting Info): Move to proper place in source.
+	(Reported by Benno Schulenberg.)
+
 2007-07-13  Eli Zaretskii  <eliz@gnu.org>
 
 	* Makefile.in (../info/emacs-mime): Use --enable-encoding.
--- a/man/info.texi	Mon Jul 16 19:26:14 2007 +0000
+++ b/man/info.texi	Wed Jul 18 22:15:15 2007 +0000
@@ -26,9 +26,10 @@
 license is included in the section entitled ``GNU Free Documentation
 License'' in the Emacs manual.
 
-(a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
-this GNU Manual, like GNU software.  Copies published by the Free
-Software Foundation raise funds for GNU development.''
+(a) The FSF's Back-Cover Text is: ``You have freedom to copy and
+modify this GNU Manual, like GNU software.  Buying copies from GNU
+Press supports the FSF in developing GNU and promoting software
+freedom.''
 
 This document is part of a collection distributed under the GNU Free
 Documentation License.  If you want to distribute this document
@@ -900,6 +901,39 @@
 @c If a menu appears at the end of this node, remove it.
 @c It is an accident of the menu updating command.
 
+@node Help-Q,  , Help-Int, Getting Started
+@comment  node-name,  next,  previous,  up
+@section Quitting Info
+
+@kindex q @r{(Info mode)}
+@findex Info-exit
+@cindex quitting Info mode
+  To get out of Info, back to what you were doing before, type @kbd{q}
+for @dfn{Quit}.  This runs @code{Info-exit} in Emacs.
+
+  This is the end of the basic course on using Info.  You have learned
+how to move in an Info document, and how to follow menus and cross
+references.  This makes you ready for reading manuals top to bottom,
+as new users should do when they learn a new package.
+
+  Another set of Info commands is useful when you need to find
+something quickly in a manual---that is, when you need to use a manual
+as a reference rather than as a tutorial.  We urge you to learn
+these search commands as well.  If you want to do that now, follow this
+cross reference to @ref{Advanced}.
+
+Yet another set of commands are meant for experienced users; you can
+find them by looking in the Directory node for documentation on Info.
+Finding them will be a good exercise in using Info in the usual
+manner.
+
+@format
+>> Type @kbd{d} to go to the Info directory node; then type
+   @kbd{mInfo} and Return, to get to the node about Info and
+   see what other help is available.
+@end format
+
+
 @node Advanced
 @chapter Advanced Info Commands
 
@@ -926,6 +960,7 @@
 * Emacs Info Variables:: Variables modifying the behavior of Emacs Info.
 @end menu
 
+
 @node Search Text, Search Index,  , Advanced
 @comment  node-name,  next,  previous,  up
 @section How to search Info documents
@@ -1390,39 +1425,6 @@
 >> Type @kbd{l} to return to the node where the cross reference was.
 @end format
 
-@node Help-Q,  , Help-Int, Getting Started
-@comment  node-name,  next,  previous,  up
-@section Quitting Info
-
-@kindex q @r{(Info mode)}
-@findex Info-exit
-@cindex quitting Info mode
-  To get out of Info, back to what you were doing before, type @kbd{q}
-for @dfn{Quit}.  This runs @code{Info-exit} in Emacs.
-
-  This is the end of the basic course on using Info.  You have learned
-how to move in an Info document, and how to follow menus and cross
-references.  This makes you ready for reading manuals top to bottom,
-as new users should do when they learn a new package.
-
-  Another set of Info commands is useful when you need to find
-something quickly in a manual---that is, when you need to use a manual
-as a reference rather than as a tutorial.  We urge you to learn
-these search commands as well.  If you want to do that now, follow this
-cross reference to @ref{Advanced}.
-
-Yet another set of commands are meant for experienced users; you can
-find them by looking in the Directory node for documentation on Info.
-Finding them will be a good exercise in using Info in the usual
-manner.
-
-@format
->> Type @kbd{d} to go to the Info directory node; then type
-   @kbd{mInfo} and Return, to get to the node about Info and
-   see what other help is available.
-@end format
-
-
 @node Tags, Checking, Cross-refs, Expert Info
 @comment  node-name,  next,  previous,  up
 @section Tags Tables for Info Files
--- a/man/tramp.texi	Mon Jul 16 19:26:14 2007 +0000
+++ b/man/tramp.texi	Wed Jul 18 22:15:15 2007 +0000
@@ -1,6 +1,6 @@
 \input texinfo   @c -*-texinfo-*-
+@setfilename ../info/tramp
 @c %**start of header
-@setfilename ../info/tramp
 @settitle TRAMP User Manual
 @setchapternewpage odd
 @c %**end of header
@@ -2306,7 +2306,7 @@
 @end example
 
 
-@anchor{Running a debugger on a remote host} 
+@anchor{Running a debugger on a remote host}
 @subsection Running a debugger on a remote host
 @cindex gud
 @cindex gdb
@@ -2337,7 +2337,12 @@
 @end example
 
 It is not possible to use just the absolute local part of a remote
-file name, like @kbd{perl -d /home/user/myprog.pl}, though.
+file name as program to debug, like @kbd{perl -d
+/home/user/myprog.pl}, though.
+
+Arguments of the program to be debugged are taken literally.  That
+means file names as arguments must be given as ordinary relative or
+absolute file names, without any remote specification.
 
 
 @node Bug Reports
@@ -2838,8 +2843,6 @@
 
 @lisp
 @ifset emacs
-(require 'recentf)
-(add-to-list 'recentf-keep 'file-remote-p)
 (recentf-mode 1)
 @end ifset
 @ifset xemacs
--- a/nt/ChangeLog	Mon Jul 16 19:26:14 2007 +0000
+++ b/nt/ChangeLog	Wed Jul 18 22:15:15 2007 +0000
@@ -1,3 +1,14 @@
+2007-07-16  Eli Zaretskii  <eliz@gnu.org>
+
+	* makefile.w32-in (bootstrap, bootstrap-nmake, bootstrap-gmake):
+	Depend on cmdproxy.
+	(cleanall): Don't delete *~.
+
+2007-07-15  Jason Rumney  <jasonr@gnu.org>
+
+	* inc/sys/socket.h (uint16_t): Define if C99 does not appear to
+	be fully supported.
+
 2007-07-14  Jason Rumney  <jasonr@gnu.org>
 
 	* inc/sys/socket.h: Include winsock2.h and ws2tcpip.h instead
--- a/nt/inc/sys/socket.h	Mon Jul 16 19:26:14 2007 +0000
+++ b/nt/inc/sys/socket.h	Wed Jul 18 22:15:15 2007 +0000
@@ -53,6 +53,11 @@
 
 #include <winsock2.h>
 #include <ws2tcpip.h>
+/* process.c uses uint16_t (from C99) for IPv6, but
+   apparently it is not defined in some versions of mingw and msvc.  */
+#ifndef UINT16_C
+typedef unsigned short uint16_t;
+#endif
 
 /* redefine select to reference our version */
 #ifdef MUST_REDEF_SELECT
--- a/nt/makefile.w32-in	Mon Jul 16 19:26:14 2007 +0000
+++ b/nt/makefile.w32-in	Wed Jul 18 22:15:15 2007 +0000
@@ -138,10 +138,12 @@
 	  exit -1; \
 	fi
 
-bootstrap:	addsection bootstrap-$(MAKETYPE)
+# Bootstrap depends on cmdproxy because some Lisp functions
+# loaded during bootstrap may need to run shell commands.
+bootstrap:	addsection cmdproxy bootstrap-$(MAKETYPE)
 	$(MAKE) $(MFLAGS) $(XMFLAGS) all
 
-bootstrap-nmake: addsection
+bootstrap-nmake: addsection cmdproxy
 	cd ..\lisp
 	$(MAKE) $(MFLAGS) bootstrap-clean
 	cd ..\src
@@ -151,18 +153,20 @@
 	cd ..\src
 	$(MAKE) $(MFLAGS) bootstrap
 	$(MAKE) $(MFLAGS) bootstrap-clean
+	$(CP) $(BLD)/cmdproxy.exe ../bin
 	cd ..\lisp
 	$(MAKE) $(MFLAGS) SHELL=$(SHELLTYPE) bootstrap
 	cd ..\lib-src
 	$(MAKE) $(MFLAGS) DOC
 	cd ..\nt
 
-bootstrap-gmake: addsection
+bootstrap-gmake: addsection cmdproxy
 	$(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp bootstrap-clean
 	$(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src clean
 	$(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src clean
 	$(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src bootstrap
 	$(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src bootstrap-clean
+	$(CP) $(BLD)/cmdproxy.exe ../bin
 	$(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp bootstrap
 	$(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src DOC
 
@@ -248,7 +252,7 @@
 # Maintenance
 #
 clean:	clean-other-dirs-$(MAKETYPE)
-	- $(DEL) *~ $(COMPILER_TEMP_FILES)
+	- $(DEL) $(COMPILER_TEMP_FILES)
 	- $(DEL_TREE) $(OBJDIR)
 	- $(DEL) stamp_BLD
 	- $(DEL) ../etc/DOC ../etc/DOC-X
@@ -287,6 +291,8 @@
 	$(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src cleanall
 	$(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src cleanall
 
+# We used to delete *~ here, but that might inadvertently remove
+# precious files if it happens to match their short 8+3 aliases.
 cleanall: clean cleanall-other-dirs-$(MAKETYPE)
 	 - $(DEL_TREE) obj
 	 - $(DEL_TREE) obj-spd
--- a/src/ChangeLog	Mon Jul 16 19:26:14 2007 +0000
+++ b/src/ChangeLog	Wed Jul 18 22:15:15 2007 +0000
@@ -1,3 +1,46 @@
+2007-07-17  Martin Rudalics  <rudalics@gmx.at>
+
+	* window.c (Fdisplay_buffer): If largest or LRU window is the
+	only window, split it even if it is not eligible for splitting.
+	This restores the original behavior broken by the 2007-07-15
+	change.
+
+2007-07-17  Glenn Morris  <rgm@gnu.org>
+
+	* abbrev.c (abbrev_check_chars): New function.
+	(Fdefine_global_abbrev, Fdefine_mode_abbrev): Call
+	abbrev_check_chars to check abbrev characters are word
+	constituents.  Doc fix.
+
+2007-07-17  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* process.c (Fstart_process, Fmake_network_process)
+	(read_process_output): Fix up last changes.
+
+2007-07-16  Eli Zaretskii  <eliz@gnu.org>
+
+	* makefile.w32-in (clean): Don't delete *~.
+
+2007-07-16  Andreas Schwab  <schwab@suse.de>
+
+	* window.c (Fdisplay_buffer): Use NILP.
+	(Fset_window_scroll_bars): Likewise.
+
+2007-07-15  Martin Rudalics  <rudalics@gmx.at>
+
+	* window.c (window_min_size_2): New function.
+	(window_min_size_1, size_window, Fdisplay_buffer)
+	(Fsplit_window, adjust_window_trailing_edge): Use it to avoid
+	windows without mode- or header-lines when window-min-height is
+	too small.
+	(size_window): Reset nodelete_p after testing it, following an
+	earlier note by Kim F. Storm.
+	(display_buffer): Do not set split_height_threshold to twice the
+	value of window_min_height to avoid changing the value of a
+	customizable variable.  Rather explicitly check whether the
+	height of the window that shall be splitted is at least as large
+	as split_height_threshold.
+
 2007-07-14  Jason Rumney  <jasonr@gnu.org>
 
 	* process.c [WINDOWSNT]: Don't undefine AF_INET6.
--- a/src/abbrev.c	Mon Jul 16 19:26:14 2007 +0000
+++ b/src/abbrev.c	Wed Jul 18 22:15:15 2007 +0000
@@ -172,12 +172,79 @@
   return name;
 }
 
+/* Check if the characters in ABBREV have word syntax in either the
+ * current (if global == 0) or standard syntax table. */
+static void
+abbrev_check_chars (abbrev, global)
+     Lisp_Object abbrev;
+     int global;
+{
+  int i, i_byte, len, nbad = 0;
+  int j, found, nuniq = 0;
+  char *badchars, *baduniq;
+
+  CHECK_STRING (abbrev);
+  len = SCHARS (abbrev);
+
+  badchars = (char *) alloca (len + 1);
+
+  for (i = 0, i_byte = 0; i < len; )
+    {
+      int c;
+
+      FETCH_STRING_CHAR_ADVANCE (c, abbrev, i, i_byte);
+
+      if (global)
+        {
+          /* Copied from SYNTAX in syntax.h, except using FOLLOW_PARENT. */
+          Lisp_Object syntax_temp
+            = SYNTAX_ENTRY_FOLLOW_PARENT (Vstandard_syntax_table, c);
+          if ( (CONSP (syntax_temp)
+                ? (enum syntaxcode) (XINT (XCAR (syntax_temp)) & 0xff)
+                : Swhitespace) != Sword ) badchars[nbad++] = c;
+        }
+      else if (SYNTAX (c) != Sword)
+        badchars[nbad++] = c;
+    }
+
+  if (nbad == 0) return;
+
+  baduniq = (char *) alloca (nbad + 1);
+
+  for (i = 0; i < nbad; i++)
+    {
+      found = 0;
+
+      for (j = 0; j < nuniq; j++)
+        {
+          if (badchars[i] == baduniq[j])
+            {
+              found = 1;
+              break;
+            }
+        }
+
+      if (found) continue ;
+
+      baduniq[nuniq++] = badchars[i];
+    }
+
+  baduniq[nuniq] = '\0';
+
+  error ("Some abbrev characters (%s) are not word constituents %s",
+         baduniq, global ? "in the standard syntax" : "in this mode" );
+}
+
 DEFUN ("define-global-abbrev", Fdefine_global_abbrev, Sdefine_global_abbrev, 2, 2,
        "sDefine global abbrev: \nsExpansion for %s: ",
-       doc: /* Define ABBREV as a global abbreviation for EXPANSION.  */)
+       doc: /* Define ABBREV as a global abbreviation for EXPANSION.
+The characters in ABBREV must all be word constituents in the standard
+syntax table.  */)
      (abbrev, expansion)
      Lisp_Object abbrev, expansion;
 {
+  abbrev_check_chars (abbrev, 1);
+
   Fdefine_abbrev (Vglobal_abbrev_table, Fdowncase (abbrev),
 		  expansion, Qnil, make_number (0), Qnil);
   return abbrev;
@@ -185,13 +252,16 @@
 
 DEFUN ("define-mode-abbrev", Fdefine_mode_abbrev, Sdefine_mode_abbrev, 2, 2,
        "sDefine mode abbrev: \nsExpansion for %s: ",
-       doc: /* Define ABBREV as a mode-specific abbreviation for EXPANSION.  */)
+       doc: /* Define ABBREV as a mode-specific abbreviation for EXPANSION.
+The characters in ABBREV must all be word-constituents in the current mode.  */)
      (abbrev, expansion)
      Lisp_Object abbrev, expansion;
 {
   if (NILP (current_buffer->abbrev_table))
     error ("Major mode has no abbrev table");
 
+  abbrev_check_chars (abbrev, 0);
+
   Fdefine_abbrev (current_buffer->abbrev_table, Fdowncase (abbrev),
 		  expansion, Qnil, make_number (0), Qnil);
   return abbrev;
--- a/src/makefile.w32-in	Mon Jul 16 19:26:14 2007 +0000
+++ b/src/makefile.w32-in	Wed Jul 18 22:15:15 2007 +0000
@@ -257,8 +257,10 @@
 #
 # Maintenance
 #
+# We used to delete *~, s/*~, m/*~ here, but that might inadvertently
+# remove precious files if it happens to match their short 8+3 aliases.
 clean:
-	- $(DEL) *~ "s/*~" "m/*~"
+	- $(DEL) "s/*.h~" "m/*.h~"
 	- $(DEL) $(COMPILER_TEMP_FILES)
 	- $(DEL_TREE) $(OBJDIR)
 	- $(DEL) stamp_BLD
--- a/src/process.c	Mon Jul 16 19:26:14 2007 +0000
+++ b/src/process.c	Wed Jul 18 22:15:15 2007 +0000
@@ -1775,7 +1775,7 @@
   XPROCESS (proc)->encoding_buf = make_uninit_string (0);
 
   XPROCESS (proc)->inherit_coding_system_flag
-    = (NILP (buffer) || !inherit_process_coding_system);
+    = !(NILP (buffer) || !inherit_process_coding_system);
 
   create_process (proc, (char **) new_argv, current_dir);
 
@@ -3547,7 +3547,7 @@
   p->encoding_buf = make_uninit_string (0);
 
   p->inherit_coding_system_flag
-    = (!NILP (tem) || NILP (buffer) || !inherit_process_coding_system);
+    = !(!NILP (tem) || NILP (buffer) || !inherit_process_coding_system);
 
   UNGCPRO;
   return proc;
@@ -5176,7 +5176,7 @@
 	  p->decoding_carryover = coding->carryover_bytes;
 	}
       /* Adjust the multibyteness of TEXT to that of the filter.  */
-      if (p->filter_multibyte != STRING_MULTIBYTE (text))
+      if (!p->filter_multibyte != !STRING_MULTIBYTE (text))
 	text = (STRING_MULTIBYTE (text)
 		? Fstring_as_unibyte (text)
 		: Fstring_to_multibyte (text));
--- a/src/window.c	Mon Jul 16 19:26:14 2007 +0000
+++ b/src/window.c	Wed Jul 18 22:15:15 2007 +0000
@@ -62,6 +62,7 @@
 static void window_scroll_pixel_based P_ ((Lisp_Object, int, int, int));
 static void window_scroll_line_based P_ ((Lisp_Object, int, int, int));
 static int window_min_size_1 P_ ((struct window *, int));
+static int window_min_size_2 P_ ((struct window *, int));
 static int window_min_size P_ ((struct window *, int, int, int *));
 static void size_window P_ ((Lisp_Object, int, int, int, int, int));
 static int freeze_window_start P_ ((struct window *, void *));
@@ -2553,7 +2554,6 @@
     *cols = MIN_SAFE_WINDOW_WIDTH;
 }
 
-
 /* Value is non-zero if window W is fixed-size.  WIDTH_P non-zero means
    check if W's width can be changed, otherwise check W's height.
    CHECK_SIBLINGS_P non-zero means check resizablity of WINDOW's
@@ -2655,6 +2655,33 @@
   return fixed_p;
 }
 
+/* Return the minimum size for leaf window W.  WIDTH_P non-zero means
+   take into account fringes and the scrollbar of W.  WIDTH_P zero
+   means take into account mode-line and header-line of W.  Return 1
+   for the minibuffer.  */
+
+static int
+window_min_size_2 (w, width_p)
+     struct window *w;
+     int width_p;
+{
+  int size;
+  
+  if (width_p)
+    size = max (window_min_width,
+		(MIN_SAFE_WINDOW_WIDTH
+		 + WINDOW_FRINGE_COLS (w)
+		 + WINDOW_SCROLL_BAR_COLS (w)));
+  else if (MINI_WINDOW_P (w))
+    size = 1;
+  else
+    size = max (window_min_height,
+		(MIN_SAFE_WINDOW_HEIGHT
+		 + (WINDOW_WANTS_MODELINE_P (w) ? 1 : 0)
+		 + (WINDOW_WANTS_HEADER_LINE_P (w) ? 1 : 0 )));
+
+  return size;
+}
 
 /* Return the minimum size of window W, not taking fixed-width windows
    into account.  WIDTH_P non-zero means return the minimum width,
@@ -2724,22 +2751,7 @@
 	}
     }
   else
-    {
-      if (width_p)
-	size = max (window_min_width,
-		    (MIN_SAFE_WINDOW_WIDTH
-		     + WINDOW_FRINGE_COLS (w)
-		     + WINDOW_SCROLL_BAR_COLS (w)));
-      else
-	{
-	  if (MINI_WINDOW_P (w)
-	      || (!WINDOW_WANTS_MODELINE_P (w)
-		  && !WINDOW_WANTS_HEADER_LINE_P (w)))
-	    size = 1;
-	  else
-	    size = window_min_height;
-	}
-    }
+    size = window_min_size_2 (w, width_p);
 
   return size;
 }
@@ -2981,11 +2993,6 @@
   Lisp_Object child, *forward, *sideward;
   int old_size, min_size, safe_min_size;
 
-  /* We test nodelete_p != 2 and nodelete_p != 1 below, so it
-     seems like it's too soon to do this here.  ++KFS.  */
-  if (nodelete_p == 2)
-    nodelete_p = 0;
-
   check_min_window_sizes ();
   size = max (0, size);
 
@@ -2996,22 +3003,23 @@
     {
       old_size = WINDOW_TOTAL_COLS (w);
       min_size = window_min_width;
-      /* Ensure that there is room for the scroll bar and fringes!
-         We may reduce display margins though.  */
-      safe_min_size = (MIN_SAFE_WINDOW_WIDTH
-		       + WINDOW_FRINGE_COLS (w)
-		       + WINDOW_SCROLL_BAR_COLS (w));
+      safe_min_size = window_min_size_2 (w, 1);
     }
   else
     {
       old_size = XINT (w->total_lines);
       min_size = window_min_height;
-      safe_min_size = MIN_SAFE_WINDOW_HEIGHT;
+      safe_min_size = window_min_size_2 (w, 0);
     }
 
   if (old_size < min_size && nodelete_p != 2)
     w->too_small_ok = Qt;
 
+  /* Move the following test here since otherwise the
+     preceding test doesn't make sense.  martin. */
+  if (nodelete_p == 2)
+    nodelete_p = 0;
+
   /* Maybe delete WINDOW if it's too small.  */
   if (nodelete_p != 1 && !NILP (w->parent))
     {
@@ -3708,9 +3716,6 @@
       frames = Qnil;
       if (FRAME_MINIBUF_ONLY_P (f))
 	XSETFRAME (frames, last_nonminibuf_frame);
-      /* Don't try to create a window if we would get an error.  */
-      if (split_height_threshold < window_min_height << 1)
-	split_height_threshold = window_min_height << 1;
 
       /* Note that both Fget_largest_window and Fget_lru_window
 	 ignore minibuffers and dedicated windows.
@@ -3733,25 +3738,30 @@
       else
 	window = Fget_largest_window (frames, Qt);
 
-      /* If we got a tall enough full-width window that can be split,
-	 split it.  */
+      /* If the largest window is tall enough, full-width, and either eligible
+	 for splitting or the only window, split it.  */
       if (!NILP (window)
 	  && ! FRAME_NO_SPLIT_P (XFRAME (XWINDOW (window)->frame))
-	  && window_height (window) >= split_height_threshold
-	  && WINDOW_FULL_WIDTH_P (XWINDOW (window)))
+	  && WINDOW_FULL_WIDTH_P (XWINDOW (window))
+	  && (window_height (window) >= split_height_threshold
+	      || (NILP (XWINDOW (window)->parent)))
+	  && (window_height (window)
+	      >= (2 * window_min_size_2 (XWINDOW (window), 0))))
 	window = Fsplit_window (window, Qnil, Qnil);
       else
 	{
 	  Lisp_Object upper, other;
 
 	  window = Fget_lru_window (frames, Qt);
-	  /* If the LRU window is selected, and big enough,
-	     and can be split, split it.  */
+	  /* If the LRU window is tall enough, and either eligible for splitting
+	  and selected or the only window, split it.  */
 	  if (!NILP (window)
 	      && ! FRAME_NO_SPLIT_P (XFRAME (XWINDOW (window)->frame))
-	      && (EQ (window, selected_window)
-		  || EQ (XWINDOW (window)->parent, Qnil))
-	      && window_height (window) >= window_min_height << 1)
+	      && ((EQ (window, selected_window)
+		   && window_height (window) >= split_height_threshold)
+		  || (NILP (XWINDOW (window)->parent)))
+	      && (window_height (window)
+		  >= (2 * window_min_size_2 (XWINDOW (window), 0))))
 	    window = Fsplit_window (window, Qnil, Qnil);
 	  else
 	    window = Fget_lru_window (frames, Qnil);
@@ -4000,9 +4010,11 @@
 
   if (NILP (horflag))
     {
-      if (size_int < window_min_height)
+      int window_safe_height = window_min_size_2 (o, 0);
+      
+      if (size_int < window_safe_height)
 	error ("Window height %d too small (after splitting)", size_int);
-      if (size_int + window_min_height > XFASTINT (o->total_lines))
+      if (size_int + window_safe_height > XFASTINT (o->total_lines))
 	error ("Window height %d too small (after splitting)",
 	       XFASTINT (o->total_lines) - size_int);
       if (NILP (o->parent)
@@ -4015,10 +4027,11 @@
     }
   else
     {
-      if (size_int < window_min_width)
+      int window_safe_width = window_min_size_2 (o, 1);
+      
+      if (size_int < window_safe_width)
 	error ("Window width %d too small (after splitting)", size_int);
-
-      if (size_int + window_min_width > XFASTINT (o->total_cols))
+      if (size_int + window_safe_width > XFASTINT (o->total_cols))
 	error ("Window width %d too small (after splitting)",
 	       XFASTINT (o->total_cols) - size_int);
       if (NILP (o->parent)
@@ -4499,7 +4512,7 @@
 
       /* Don't make this window too small.  */
       if (XINT (CURSIZE (window)) + delta
-	  < (horiz_flag ? window_min_width : window_min_height))
+	  < window_min_size_2 (XWINDOW (window), horiz_flag))
 	{
 	  Fset_window_configuration (old_config);
 	  error ("Cannot adjust window size as specified");
@@ -6897,7 +6910,7 @@
 	vertical_type = Qnil;
     }
 
-  if (!(EQ (vertical_type, Qnil)
+  if (!(NILP (vertical_type)
 	|| EQ (vertical_type, Qleft)
 	|| EQ (vertical_type, Qright)
 	|| EQ (vertical_type, Qt)))
@@ -7589,4 +7602,4 @@
 }
 
 /* arch-tag: 90a9c576-0590-48f1-a5f1-6c96a0452d9f
-   (do not change this comment) */
+   (do not change thisc omment) */