changeset 90600:84dd84b43e1b

Merge from emacs--devo--0 Patches applied: * emacs--devo--0 (patch 423-426) - Update from CVS - Merge from gnus--rel--5.10 * gnus--rel--5.10 (patch 131-133) - Update from CVS Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-109
author Miles Bader <miles@gnu.org>
date Wed, 06 Sep 2006 07:30:39 +0000
parents c358d0861b16 (current diff) 65db3e72f648 (diff)
children a1a25ac6c88a
files admin/FOR-RELEASE lisp/ChangeLog lisp/emulation/cua-base.el lisp/gnus/ChangeLog lisp/gnus/gnus-art.el lisp/ido.el lisp/progmodes/compile.el lisp/progmodes/gdb-ui.el lisp/progmodes/gud.el lisp/simple.el lisp/term/xterm.el src/ChangeLog src/editfns.c src/lisp.h src/window.c src/xdisp.c
diffstat 18 files changed, 423 insertions(+), 176 deletions(-) [+]
line wrap: on
line diff
--- a/admin/FOR-RELEASE	Tue Sep 05 02:54:22 2006 +0000
+++ b/admin/FOR-RELEASE	Wed Sep 06 07:30:39 2006 +0000
@@ -44,18 +44,35 @@
 ** Drew Adams 12 Aug bug rpt: overlay  display artifact: trace left behind
 Windows only bug.
 
+** henman@it.to-be.co.jp 09 Aug 2006: ispell.el problem on Cygwin.
+  (Did we decide that is unreproducible?)
+
 * BUGS
 
-** Milan Zamazal's Aug 23 bug report about crashes with certain fonts.
+** How rcirc puts cursor at bottom.
+
+** rcirc uses member*.
+
+** Field handling in C-n.
+
+** cursor display on images that don't use :mask.
 
 ** C-g fails to interrupt accept-process-output in Gnus.
-
-** Implement buffer-chars-modified-tick.
-
-** henman@it.to-be.co.jp 09 Aug 2006: ispell.el problem.
+  (Is that fixed?)
 
 ** Make key-binding use the maps specified by positions given in the events.
 
+** Is it necessary to solve in another way the problem that was solved
+ by Satyaki Das's removed pgg patches?
+
+** mouse-autoselect-window delay patch
+
+** Bug in woman, Juri Linkov, Sep 3.
+
+** Problem of passing temp files to GPG thru call-process.
+
+** Image scrolling problems reported by David Kastrup.  (KFS working).
+
 
 * DOCUMENTATION
 
--- a/lisp/ChangeLog	Tue Sep 05 02:54:22 2006 +0000
+++ b/lisp/ChangeLog	Wed Sep 06 07:30:39 2006 +0000
@@ -1,3 +1,49 @@
+2006-09-06  Nick Roberts  <nickrob@snap.net.nz>
+
+	* progmodes/gdb-ui.el (gdb-var-list-children-regexp)
+	(gdb-var-list-children-regexp-1): Tweak regexps to catch full
+	string values.
+
+2006-09-06  Kim F. Storm  <storm@cua.dk>
+
+	* simple.el (line-move-partial): New function to do vscrolling for
+	partially visible images / tall lines.  Rewrite based on code
+	previously in line-move.  Simplify backwards vscrolling.
+	(line-move): Use it.  Simplify.
+
+2006-09-05  Kim F. Storm  <storm@cua.dk>
+
+	* emulation/cua-base.el (cua--pre-command-handler-1): Rewrite.
+
+2006-09-05  Chong Yidong  <cyd@stupidchicken.com>
+
+	* progmodes/compile.el (compilation-error-regexp-alist-alist):
+	Process the `gcc-include' after the `gnu' rule.
+
+2006-09-05  Kim F. Storm  <storm@cua.dk>
+
+	* ido.el (ido-visit-buffer): Use buffer name if buffer arg is a buffer.
+
+2006-09-05  Daiki Ueno  <ueno@unixuser.org>
+
+	* pgg.el (pgg-clear-string): Alias to clear-string for backward
+	compatibility.
+
+	* pgg-gpg.el (pgg-gpg-process-region): Avoid display blinking with
+	inhibit-redisplay; encode passphrase with locale-coding-system.
+
+2006-09-04  Dan Nicolaescu  <dann@ics.uci.edu>
+
+	* term/xterm.el (terminal-init-xterm): Add more C-M- bindings.
+
+2006-09-05  Nick Roberts  <nickrob@snap.net.nz>
+
+	* progmodes/gdb-ui.el (gdb-var-list-children-regexp)
+	(gdb-var-list-children-regexp): Make type field optional.
+
+	* progmodes/gud.el (gud-speedbar-buttons): Allow for no type
+	e.g public, protected in C++.
+
 2006-09-04  John Paul Wallington  <jpw@pobox.com>
 
 	* simple.el (completion-show-help): New defcustom.
--- a/lisp/emulation/cua-base.el	Tue Sep 05 02:54:22 2006 +0000
+++ b/lisp/emulation/cua-base.el	Wed Sep 06 07:30:39 2006 +0000
@@ -1097,73 +1097,79 @@
 ;;; Pre-command hook
 
 (defun cua--pre-command-handler-1 ()
-  (let ((movement (eq (get this-command 'CUA) 'move)))
+  ;; Cancel prefix key timeout if user enters another key.
+  (when cua--prefix-override-timer
+    (if (timerp cua--prefix-override-timer)
+	(cancel-timer cua--prefix-override-timer))
+    (setq cua--prefix-override-timer nil))
+
+  (cond
+   ;; Only symbol commands can have necessary properties
+   ((not (symbolp this-command))
+    nil)
 
-    ;; Cancel prefix key timeout if user enters another key.
-    (when cua--prefix-override-timer
-      (if (timerp cua--prefix-override-timer)
-	  (cancel-timer cua--prefix-override-timer))
-      (setq cua--prefix-override-timer nil))
+   ;; Handle delete-selection property on non-movement commands
+   ((not (eq (get this-command 'CUA) 'move))
+    (when (and mark-active (not deactivate-mark))
+      (let* ((ds (or (get this-command 'delete-selection)
+		     (get this-command 'pending-delete)))
+	     (nc (cond
+		  ((not ds) nil)
+		  ((eq ds 'yank)
+		   'cua-paste)
+		  ((eq ds 'kill)
+		   (if cua--rectangle
+		       'cua-copy-rectangle
+		     'cua-copy-region))
+		  ((eq ds 'supersede)
+		   (if cua--rectangle
+		       'cua-delete-rectangle
+		     'cua-delete-region))
+		  (t
+		   (if cua--rectangle
+		       'cua-delete-rectangle ;; replace?
+		     'cua-replace-region)))))
+	(if nc
+	    (setq this-original-command this-command
+		  this-command nc)))))
 
-    ;; Handle shifted cursor keys and other movement commands.
-    ;; If region is not active, region is activated if key is shifted.
-    ;; If region is active, region is cancelled if key is unshifted (and region not started with C-SPC).
-    ;; If rectangle is active, expand rectangle in specified direction and ignore the movement.
-    (if movement
-	(cond
-	 ((if window-system
-	      (memq 'shift (event-modifiers
-			    (aref (this-single-command-raw-keys) 0)))
-	    (or
-	     (memq 'shift (event-modifiers
-			   (aref (this-single-command-keys) 0)))
-	     ;; See if raw escape sequence maps to a shifted event, e.g. S-up or C-S-home.
-	     (and (boundp 'function-key-map)
-		  function-key-map
-		  (let ((ev (lookup-key function-key-map
-					(this-single-command-raw-keys))))
-		    (and (vector ev)
-			 (symbolp (setq ev (aref ev 0)))
-			 (string-match "S-" (symbol-name ev)))))))
-	  (unless mark-active
-	    (push-mark-command nil t))
-	  (setq cua--last-region-shifted t)
-	  (setq cua--explicit-region-start nil))
-	 ((or cua--explicit-region-start cua--rectangle)
-	  (unless mark-active
-	    (push-mark-command nil nil)))
-	 (t
-	  ;; If we set mark-active to nil here, the region highlight will not be
-	  ;; removed by the direct_output_ commands.
-	  (setq deactivate-mark t)))
+   ;; Handle shifted cursor keys and other movement commands.
+   ;; If region is not active, region is activated if key is shifted.
+   ;; If region is active, region is cancelled if key is unshifted (and region not started with C-SPC).
+   ;; If rectangle is active, expand rectangle in specified direction and ignore the movement.
+   ((if window-system
+	(memq 'shift (event-modifiers
+		      (aref (this-single-command-raw-keys) 0)))
+      (or
+       (memq 'shift (event-modifiers
+		     (aref (this-single-command-keys) 0)))
+       ;; See if raw escape sequence maps to a shifted event, e.g. S-up or C-S-home.
+       (and (boundp 'function-key-map)
+	    function-key-map
+	    (let ((ev (lookup-key function-key-map
+				  (this-single-command-raw-keys))))
+	      (and (vector ev)
+		   (symbolp (setq ev (aref ev 0)))
+		   (string-match "S-" (symbol-name ev)))))))
+    (unless mark-active
+      (push-mark-command nil t))
+    (setq cua--last-region-shifted t)
+    (setq cua--explicit-region-start nil))
 
-      ;; Handle delete-selection property on other commands
-      (if (and mark-active (not deactivate-mark))
-	  (let* ((ds (or (get this-command 'delete-selection)
-			 (get this-command 'pending-delete)))
-		 (nc (cond
-		      ((not ds) nil)
-		      ((eq ds 'yank)
-		       'cua-paste)
-		      ((eq ds 'kill)
-		       (if cua--rectangle
-			   'cua-copy-rectangle
-			 'cua-copy-region))
-		      ((eq ds 'supersede)
-		       (if cua--rectangle
-			   'cua-delete-rectangle
-			 'cua-delete-region))
-		      (t
-		       (if cua--rectangle
-			   'cua-delete-rectangle ;; replace?
-			 'cua-replace-region)))))
-	    (if nc
-		(setq this-original-command this-command
-		      this-command nc)))))
+   ;; Set mark if user explicitly said to do so
+   ((or cua--explicit-region-start cua--rectangle)
+    (unless mark-active
+      (push-mark-command nil nil)))
 
-    ;; Detect extension of rectangles by mouse or other movement
-    (setq cua--buffer-and-point-before-command
-	  (if cua--rectangle (cons (current-buffer) (point))))))
+   ;; Else clear mark after this command.
+   (t
+    ;; If we set mark-active to nil here, the region highlight will not be
+    ;; removed by the direct_output_ commands.
+    (setq deactivate-mark t)))
+
+  ;; Detect extension of rectangles by mouse or other movement
+  (setq cua--buffer-and-point-before-command
+	(if cua--rectangle (cons (current-buffer) (point)))))
 
 (defun cua--pre-command-handler ()
   (when cua-mode
--- a/lisp/gnus/ChangeLog	Tue Sep 05 02:54:22 2006 +0000
+++ b/lisp/gnus/ChangeLog	Wed Sep 06 07:30:39 2006 +0000
@@ -5,6 +5,12 @@
 
 2006-09-04  Katsumi Yamaoka  <yamaoka@jpl.org>
 
+	* gnus-art.el (article-decode-encoded-words): Make it fast.
+
+2006-09-04  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+	* gnus-art.el (article-decode-encoded-words): Don't infloop in XEmacs.
+
 	* rfc2047.el (rfc2047-strip-backslashes-in-quoted-strings): Decode `\\'
 	in quoted string into `\'.
 
--- a/lisp/gnus/gnus-art.el	Tue Sep 05 02:54:22 2006 +0000
+++ b/lisp/gnus/gnus-art.el	Wed Sep 06 07:30:39 2006 +0000
@@ -2381,22 +2381,23 @@
 			   (error))
 			 gnus-newsgroup-ignored-charsets))
 	(inhibit-read-only t)
-	start)
-    (save-restriction
-      (article-narrow-to-head)
-      (while (not (eobp))
-	(setq start (point))
-	(if (prog1
-		(looking-at "\
+	end start)
+    (goto-char (point-min))
+    (when (search-forward "\n\n" nil 'move)
+      (forward-line -1))
+    (setq end (point))
+    (while (not (bobp))
+      (while (progn
+	       (forward-line -1)
+	       (and (not (bobp))
+		    (memq (char-after) '(?\t ? )))))
+      (setq start (point))
+      (if (looking-at "\
 \\(?:Resent-\\)?\\(?:From\\|Cc\\|To\\|Bcc\\|\\(?:In-\\)?Reply-To\\|Sender\
 \\|Mail-Followup-To\\|Mail-Copies-To\\|Approved\\):")
-	      (while (progn
-		       (forward-line)
-		       (if (eobp)
-			   nil
-			 (memq (char-after) '(?\t ? ))))))
-	    (funcall gnus-decode-address-function start (point))
-	  (funcall gnus-decode-header-function start (point)))))))
+	  (funcall gnus-decode-address-function start end)
+	(funcall gnus-decode-header-function start end))
+      (goto-char (setq end start)))))
 
 (defun article-decode-group-name ()
   "Decode group names in `Newsgroups:'."
--- a/lisp/ido.el	Tue Sep 05 02:54:22 2006 +0000
+++ b/lisp/ido.el	Wed Sep 06 07:30:39 2006 +0000
@@ -3781,7 +3781,8 @@
 (defun ido-visit-buffer (buffer method &optional record)
   "Switch to BUFFER according to METHOD.
 Record command in `command-history' if optional RECORD is non-nil."
-
+  (if (bufferp buffer)
+      (setq buffer (buffer-name buffer)))
   (let (win newframe)
     (cond
      ((eq method 'kill)
--- a/lisp/pgg-gpg.el	Tue Sep 05 02:54:22 2006 +0000
+++ b/lisp/pgg-gpg.el	Wed Sep 06 07:30:39 2006 +0000
@@ -74,7 +74,10 @@
 	 (errors-buffer pgg-errors-buffer)
 	 (orig-mode (default-file-modes))
 	 (process-connection-type nil)
-	 process status exit-status)
+	 (inhibit-redisplay t)
+	 process status exit-status
+	 passphrase-with-newline
+	 encoded-passphrase-with-new-line)
     (with-current-buffer (get-buffer-create errors-buffer)
       (buffer-disable-undo)
       (erase-buffer))
@@ -87,7 +90,16 @@
 			 program args)))
 	  (set-process-sentinel process #'ignore)
 	  (when passphrase
-	    (process-send-string process (concat passphrase "\n")))
+	    (setq passphrase-with-newline (concat passphrase "\n"))
+	    (if (boundp 'locale-coding-system)
+		(progn
+		  (setq encoded-passphrase-with-new-line
+			(encode-coding-string passphrase-with-newline
+					      locale-coding-system))
+		  (pgg-clear-string passphrase-with-newline))
+	      (setq encoded-passphrase-with-new-line passphrase-with-newline
+		    passphrase-with-newline nil))
+	    (process-send-string process encoded-passphrase-with-new-line))
 	  (process-send-region process start end)
 	  (process-send-eof process)
 	  (while (eq 'run (process-status process))
@@ -108,6 +120,10 @@
 		(error "%s exited abnormally: '%s'" program exit-status))
 	    (if (= 127 exit-status)
 		(error "%s could not be found" program))))
+      (if passphrase-with-newline
+	  (pgg-clear-string passphrase-with-newline))
+      (if encoded-passphrase-with-new-line
+	  (pgg-clear-string encoded-passphrase-with-new-line))
       (if (and process (eq 'run (process-status process)))
 	  (interrupt-process process))
       (if (file-exists-p output-file-name)
--- a/lisp/pgg.el	Tue Sep 05 02:54:22 2006 +0000
+++ b/lisp/pgg.el	Wed Sep 06 07:30:39 2006 +0000
@@ -148,6 +148,11 @@
                            #'pgg-remove-passphrase-from-cache
                            key notruncate))))
 
+(if (fboundp 'clear-string)
+    (defalias 'pgg-clear-string 'clear-string)
+  (defun pgg-clear-string (string)
+    (fillarray string ?_)))
+
 (defun pgg-remove-passphrase-from-cache (key &optional notruncate)
   "Omit passphrase associated with KEY in time-limited passphrase cache.
 
@@ -166,7 +171,7 @@
          (interned-timer-key (intern-soft key pgg-pending-timers))
          (old-timer (symbol-value interned-timer-key)))
     (when passphrase
-      (fillarray passphrase ?_)
+      (pgg-clear-string passphrase)
       (unintern key pgg-passphrase-cache))
     (when old-timer
       (pgg-cancel-timer old-timer)
--- a/lisp/progmodes/compile.el	Tue Sep 05 02:54:22 2006 +0000
+++ b/lisp/progmodes/compile.el	Wed Sep 06 07:30:39 2006 +0000
@@ -218,10 +218,6 @@
      nil 1 nil 2 0
      (2 (compilation-face '(3))))
 
-    (gcc-include
-     "^\\(?:In file included\\|                \\) from \
-\\(.+\\):\\([0-9]+\\)\\(?:\\(:\\)\\|\\(,\\)\\)?" 1 2 nil (3 . 4))
-
     (gnu
      ;; I have no idea what this first line is supposed to match, but it
      ;; makes things ambiguous with output such as "foo:344:50:blabla" since
@@ -241,6 +237,12 @@
 \[0-9]?\\(?:[^0-9\n]\\|$\\)\\|[0-9][0-9][0-9]\\)"
      1 (2 . 5) (4 . 6) (7 . 8))
 
+    ;; The `gnu' style above can incorrectly match gcc's "In file
+    ;; included from" message, so we process that first. -- cyd
+    (gcc-include
+     "^\\(?:In file included\\|                \\) from \
+\\(.+\\):\\([0-9]+\\)\\(?:\\(:\\)\\|\\(,\\)\\)?" 1 2 nil (3 . 4))
+
     (lcc
      "^\\(?:E\\|\\(W\\)\\), \\([^(\n]+\\)(\\([0-9]+\\),[ \t]*\\([0-9]+\\)"
      2 3 4 (1))
--- a/lisp/progmodes/gdb-ui.el	Tue Sep 05 02:54:22 2006 +0000
+++ b/lisp/progmodes/gdb-ui.el	Wed Sep 06 07:30:39 2006 +0000
@@ -782,7 +782,7 @@
 
 (defconst gdb-var-list-children-regexp
  "child={.*?name=\"\\(.*?\\)\",.*?exp=\"\\(.*?\\)\",.*?\
-numchild=\"\\(.*?\\)\",.*?type=\"\\(.*?\\)\".*?}")
+numchild=\"\\(.*?\\)\"\\(}\\|,.*?\\(type=\"\\(.*?\\)\"\\)?.*?}\\)")
 
 (defun gdb-var-list-children-handler (varnum)
   (goto-char (point-min))
@@ -796,7 +796,7 @@
 		(let ((varchild (list (match-string 1)
 				      (match-string 2)
 				      (match-string 3)
-				      (match-string 4)
+				      (match-string 6)
 				      nil nil)))
 		  (if (assoc (car varchild) gdb-var-list)
 		      (throw 'child-already-watched nil))
@@ -3346,7 +3346,8 @@
 
 (defconst gdb-var-list-children-regexp-1
   "child={.*?name=\"\\(.+?\\)\",.*?exp=\"\\(.+?\\)\",.*?\
-numchild=\"\\(.+?\\)\",.*?value=\\(\".*?\"\\),.*?type=\"\\(.+?\\)\".*?}")
+numchild=\"\\(.+?\\)\",.*?value=\\(\".*?\"\\)\
+\\(}\\|,.*?\\(type=\"\\(.+?\\)\"\\)?.*?}\\)")
 
 (defun gdb-var-list-children-handler-1 (varnum)
   (goto-char (point-min))
@@ -3360,7 +3361,7 @@
 		(let ((varchild (list (match-string 1)
 				      (match-string 2)
 				      (match-string 3)
-				      (match-string 5)
+				      (match-string 7)
 				      (read (match-string 4))
 				      nil)))
 		  (if (assoc (car varchild) gdb-var-list)
--- a/lisp/progmodes/gud.el	Tue Sep 05 02:54:22 2006 +0000
+++ b/lisp/progmodes/gud.el	Wed Sep 06 07:30:39 2006 +0000
@@ -456,8 +456,8 @@
 	  (while var-list
 	    (let* (char (depth 0) (start 0) (var (car var-list))
 			(varnum (car var)) (expr (nth 1 var))
-			(type (nth 3 var)) (value (nth 4 var))
-			(status (nth 5 var)))
+			(type (if (nth 3 var) (nth 3 var) " "))
+			(value (nth 4 var)) (status (nth 5 var)))
 	      (put-text-property
 	       0 (length expr) 'face font-lock-variable-name-face expr)
 	      (put-text-property
--- a/lisp/simple.el	Tue Sep 05 02:54:22 2006 +0000
+++ b/lisp/simple.el	Wed Sep 06 07:30:39 2006 +0000
@@ -3477,6 +3477,56 @@
       (or (memq prop buffer-invisibility-spec)
 	  (assq prop buffer-invisibility-spec)))))
 
+;; Returns non-nil if partial move was done.
+(defun line-move-partial (arg noerror to-end)
+  (if (< arg 0)
+      ;; Move backward (up).
+      ;; If already vscrolled, reduce vscroll
+      (let ((vs (window-vscroll nil t)))
+	(when (> vs (frame-char-height))
+	  (set-window-vscroll nil (- vs (frame-char-height)) t)))
+
+    ;; Move forward (down).
+    (let* ((ppos (posn-at-point))
+	   (py (cdr (or (posn-actual-col-row ppos)
+			(posn-col-row ppos))))
+	   (vs (window-vscroll nil t))
+	   (evis (or (pos-visible-in-window-p (window-end nil t) nil t)
+		     (pos-visible-in-window-p (1- (window-end nil t)) nil t)))
+	   (rbot (nth 3 evis))
+	   (vpos (nth 5 evis)))
+      (cond
+       ;; (0) Last window line should be visible - fail if not.
+       ((null evis)
+	nil)
+       ;; If last line of window is fully visible, move forward.
+       ((null rbot)
+	nil)
+       ;; If cursor is not in the bottom scroll margin, move forward.
+       ((< py (min (- (window-text-height) scroll-margin 1)
+		   (1- vpos)))
+	nil)
+       ;; When already vscrolled, we vscroll some more if we can,
+       ;; or clear vscroll and move forward at end of tall image.
+       ((> vs 0)
+	(when (> rbot 0)
+	  (set-window-vscroll nil (+ vs (min rbot (frame-char-height))) t)))
+       ;; If cursor just entered the bottom scroll margin, move forward,
+       ;; but also vscroll one line so redisplay wont recenter.
+       ((= py (min (- (window-text-height) scroll-margin 1)
+		   (1- vpos)))
+	(set-window-vscroll nil (frame-char-height) t)
+	(line-move-1 arg noerror to-end)
+	t)
+       ;; If there are lines above the last line, scroll-up one line.
+       ((> vpos 0)
+	(scroll-up 1)
+	t)
+       ;; Finally, start vscroll.
+       (t
+	(set-window-vscroll nil (frame-char-height) t))))))
+
+
 ;; This is like line-move-1 except that it also performs
 ;; vertical scrolling of tall images if appropriate.
 ;; That is not really a clean thing to do, since it mixes
@@ -3484,37 +3534,14 @@
 ;; a cleaner solution to the problem of making C-n do something
 ;; useful given a tall image.
 (defun line-move (arg &optional noerror to-end try-vscroll)
-  (if (and auto-window-vscroll try-vscroll
-	   ;; But don't vscroll in a keyboard macro.
-	   (not defining-kbd-macro)
-	   (not executing-kbd-macro))
-      (let ((forward (> arg 0))
-	    (part (nth 2 (pos-visible-in-window-p (point) nil t))))
-	(if (and (consp part)
-		 (> (if forward (cdr part) (car part)) 0))
-	    (set-window-vscroll nil
-				(if forward
-				    (+ (window-vscroll nil t)
-				       (min (cdr part)
-					    (* (frame-char-height) arg)))
-				  (max 0
-				       (- (window-vscroll nil t)
-					  (min (car part)
-					       (* (frame-char-height) (- arg))))))
-				t)
-	  (set-window-vscroll nil 0)
-	  (when (line-move-1 arg noerror to-end)
-	    (when (not forward)
-	      ;; Update display before calling pos-visible-in-window-p,
-	      ;; because it depends on window-start being up-to-date.
-	      (sit-for 0)
-	      ;; If the current line is partly hidden at the bottom,
-	      ;; scroll it partially up so as to unhide the bottom.
-	      (if (and (setq part (nth 2 (pos-visible-in-window-p
-					  (line-beginning-position) nil t)))
-		       (> (cdr part) 0))
-		  (set-window-vscroll nil (cdr part) t)))
-	    t)))
+  (unless (and auto-window-vscroll try-vscroll
+	       ;; Only vscroll for single line moves
+	       (= (abs arg) 1)
+	       ;; But don't vscroll in a keyboard macro.
+	       (not defining-kbd-macro)
+	       (not executing-kbd-macro)
+	       (line-move-partial arg noerror to-end))
+    (set-window-vscroll nil 0 t)
     (line-move-1 arg noerror to-end)))
 
 ;; This is the guts of next-line and previous-line.
--- a/lisp/term/xterm.el	Tue Sep 05 02:54:22 2006 +0000
+++ b/lisp/term/xterm.el	Wed Sep 06 07:30:39 2006 +0000
@@ -261,6 +261,9 @@
       (define-key map "\e[27;6;62~"  [?\C->])
       (define-key map "\e[27;6;63~"  [(C-\?)])
 
+      ;; These are the strings emitted for various C-M- combinations
+      ;; for keyboards that the Meta and Alt modifiers are on the same
+      ;; key (usually labeled "Alt").
       (define-key map "\e[27;13;9~"  [(C-M-tab)])
       (define-key map "\e[27;13;13~" [(C-M-return)])
 
@@ -298,6 +301,43 @@
       (define-key map "\e[27;14;62~"  [?\C-\M->])
       (define-key map "\e[27;14;63~"  [(C-M-\?)])
 
+      (define-key map "\e[27;7;9~"  [(C-M-tab)])
+      (define-key map "\e[27;7;13~" [(C-M-return)])
+
+      (define-key map "\e[27;7;39~" [?\C-\M-\'])
+      (define-key map "\e[27;7;44~" [?\C-\M-,])
+      (define-key map "\e[27;7;45~" [?\C-\M--])
+      (define-key map "\e[27;7;46~" [?\C-\M-.])
+      (define-key map "\e[27;7;47~" [?\C-\M-/])
+      (define-key map "\e[27;7;48~" [?\C-\M-0])
+      (define-key map "\e[27;7;49~" [?\C-\M-1])
+      (define-key map "\e[27;7;50~" [?\C-\M-2])
+      (define-key map "\e[27;7;51~" [?\C-\M-3])
+      (define-key map "\e[27;7;52~" [?\C-\M-4])
+      (define-key map "\e[27;7;53~" [?\C-\M-5])
+      (define-key map "\e[27;7;54~" [?\C-\M-6])
+      (define-key map "\e[27;7;55~" [?\C-\M-7])
+      (define-key map "\e[27;7;56~" [?\C-\M-8])
+      (define-key map "\e[27;7;57~" [?\C-\M-9])
+      (define-key map "\e[27;7;59~" [?\C-\M-\;])
+      (define-key map "\e[27;7;61~" [?\C-\M-=])
+      (define-key map "\e[27;7;92~" [?\C-\M-\\])
+
+      (define-key map "\e[27;8;33~"  [?\C-\M-!])
+      (define-key map "\e[27;8;34~"  [?\C-\M-\"])
+      (define-key map "\e[27;8;35~"  [?\C-\M-#])
+      (define-key map "\e[27;8;36~"  [?\C-\M-$])
+      (define-key map "\e[27;8;37~"  [?\C-\M-%])
+      (define-key map "\e[27;8;38~"  [(C-M-&)])
+      (define-key map "\e[27;8;40~"  [?\C-\M-(])
+      (define-key map "\e[27;8;41~"  [?\C-\M-)])
+      (define-key map "\e[27;8;42~"  [?\C-\M-*])
+      (define-key map "\e[27;8;43~"  [?\C-\M-+])
+      (define-key map "\e[27;8;58~"  [?\C-\M-:])
+      (define-key map "\e[27;8;60~"  [?\C-\M-<])
+      (define-key map "\e[27;8;62~"  [?\C-\M->])
+      (define-key map "\e[27;8;63~"  [(C-M-\?)])
+
       (define-key map "\e[27;2;9~"   [S-tab])
       (define-key map "\e[27;2;13~"  [S-return])
 
--- a/src/ChangeLog	Tue Sep 05 02:54:22 2006 +0000
+++ b/src/ChangeLog	Wed Sep 06 07:30:39 2006 +0000
@@ -1,3 +1,29 @@
+2006-09-06  Kenichi Handa  <handa@m17n.org>
+
+	* editfns.c (Fformat_time_string): Use make_unibyte_string to make
+	a Lisp string from the result of emacs_memftimeu call.
+
+2006-09-06  Kim F. Storm  <storm@cua.dk>
+
+	* xdisp.c (pos_visible_p): Remove exact_mode_line_heights_p arg;
+	so always calculate heights even when pos-visible-in-window-p is
+	called with partially = t.  Don't overshoot last_visible_y in move_it_to.
+	Return row height and row number in new rowh and vpos args.
+	(cursor_row_fully_visible_p): First line is always "fully visible".
+	(try_window): Don't clear matrix if vscrolled.
+
+	* lisp.h (pos_visible_p): Update prototype.
+
+	* window.c (Fpos_visible_in_window_p): Adapt to new pos_visible_p.
+	Return row height and row number for partially visible rows.
+	Modify return value to a 2 element list for fully visible rows
+	and 6 for partially visible row.
+	(window_scroll_pixel_based): Use pos_visible_p directly instead of
+	Fpos_visible_in_window_p.  Fix auto vscrolling for partially visible lines.
+	Only vscroll backwards if already vscrolled forwards.  Unconditionally
+	vscroll forwards if PT is first (and only) line.  Set new window start
+	instead of scrolling at start/end of tall line.
+
 2006-09-05  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
 
 	* macterm.c (install_window_handler, mac_handle_window_event)
--- a/src/editfns.c	Tue Sep 05 02:54:22 2006 +0000
+++ b/src/editfns.c	Wed Sep 06 07:30:39 2006 +0000
@@ -1692,7 +1692,7 @@
 				SBYTES (format_string),
 				tm, ut);
       if ((result > 0 && result < size) || (result == 0 && buf[0] == '\0'))
-	return code_convert_string_norecord (make_string (buf, result),
+	return code_convert_string_norecord (make_unibyte_string (buf, result),
 					     Vlocale_coding_system, 0);
 
       /* If buffer was too small, make it bigger and try again.  */
--- a/src/lisp.h	Tue Sep 05 02:54:22 2006 +0000
+++ b/src/lisp.h	Wed Sep 06 07:30:39 2006 +0000
@@ -2551,7 +2551,7 @@
 extern void init_xdisp P_ ((void));
 extern Lisp_Object safe_eval P_ ((Lisp_Object));
 extern int pos_visible_p P_ ((struct window *, int, int *,
-			      int *, int *, int *, int));
+			      int *, int *, int *, int *, int *));
 
 /* Defined in vm-limit.c.  */
 extern void memory_warnings P_ ((POINTER_TYPE *, void (*warnfun) ()));
--- a/src/window.c	Tue Sep 05 02:54:22 2006 +0000
+++ b/src/window.c	Wed Sep 06 07:30:39 2006 +0000
@@ -336,10 +336,12 @@
 POS defaults to point in WINDOW; WINDOW defaults to the selected window.
 
 If POS is visible, return t if PARTIALLY is nil; if PARTIALLY is non-nil,
-return value is a list (X Y PARTIAL) where X and Y are the pixel coordinates
-relative to the top left corner of the window. PARTIAL is nil if the character
-after POS is fully visible; otherwise it is a cons (RTOP . RBOT) where RTOP
-and RBOT are the number of pixels invisible at the top and bottom of the row.  */)
+return value is a list of 2 or 6 elements (X Y [RTOP RBOT ROWH VPOS]),
+where X and Y are the pixel coordinates relative to the top left corner
+of the window.  The remaining elements are omitted if the character after
+POS is fully visible; otherwise, RTOP and RBOT are the number of pixels
+invisible at the top and bottom of the row, ROWH is the height of the display
+row, and VPOS is the row number (0-based) containing POS.  */)
      (pos, window, partially)
      Lisp_Object pos, window, partially;
 {
@@ -348,7 +350,7 @@
   register struct buffer *buf;
   struct text_pos top;
   Lisp_Object in_window = Qnil;
-  int rtop, rbot, fully_p = 1;
+  int rtop, rbot, rowh, vpos, fully_p = 1;
   int x, y;
 
   w = decode_window (window);
@@ -371,17 +373,20 @@
       && posint <= BUF_ZV (buf)
       && CHARPOS (top) >= BUF_BEGV (buf)
       && CHARPOS (top) <= BUF_ZV (buf)
-      && pos_visible_p (w, posint, &x, &y, &rtop, &rbot, NILP (partially))
+      && pos_visible_p (w, posint, &x, &y, &rtop, &rbot, &rowh, &vpos)
       && (fully_p = !rtop && !rbot, (!NILP (partially) || fully_p)))
     in_window = Qt;
 
   if (!NILP (in_window) && !NILP (partially))
-    in_window = Fcons (make_number (x),
-		       Fcons (make_number (y),
-			      Fcons ((fully_p ? Qnil
-				     : Fcons (make_number (rtop),
-					      make_number (rbot))),
-				     Qnil)));
+    {
+      Lisp_Object part = Qnil;
+      if (!fully_p)
+	part = list4 (make_number (rtop), make_number (rbot),
+			make_number (rowh), make_number (vpos));
+      in_window = Fcons (make_number (x),
+			 Fcons (make_number (y), part));
+    }
+
   return in_window;
 }
 
@@ -4818,10 +4823,10 @@
   struct it it;
   struct window *w = XWINDOW (window);
   struct text_pos start;
-  Lisp_Object tem;
   int this_scroll_margin;
   /* True if we fiddled the window vscroll field without really scrolling.   */
   int vscrolled = 0;
+  int x, y, rtop, rbot, rowh, vpos;
 
   SET_TEXT_POS_FROM_MARKER (start, w->start);
 
@@ -4829,8 +4834,8 @@
      the screen.  Allow PT to be partially visible, otherwise
      something like (scroll-down 1) with PT in the line before
      the partially visible one would recenter. */
-  tem = Fpos_visible_in_window_p (make_number (PT), window, Qt);
-  if (NILP (tem))
+
+  if (!pos_visible_p (w, PT, &x, &y, &rtop, &rbot, &rowh, &vpos))
     {
       /* Move backward half the height of the window.  Performance note:
 	 vmotion used here is about 10% faster, but would give wrong
@@ -4855,7 +4860,7 @@
     }
   else if (auto_window_vscroll_p)
     {
-      if (tem = XCAR (XCDR (XCDR (tem))), CONSP (tem))
+      if (rtop || rbot)		/* partially visible */
 	{
 	  int px;
 	  int dy = WINDOW_FRAME_LINE_HEIGHT (w);
@@ -4865,19 +4870,52 @@
 		      dy);
 	  dy *= n;
 
-	  if (n < 0 && (px = XINT (XCAR (tem))) > 0)
+	  if (n < 0)
 	    {
-	      px = max (0, -w->vscroll - min (px, -dy));
-	      Fset_window_vscroll (window, make_number (px), Qt);
-	      return;
+	      /* Only vscroll backwards if already vscrolled forwards.  */
+	      if (w->vscroll < 0 && rtop > 0)
+		{
+		  px = max (0, -w->vscroll - min (rtop, -dy));
+		  Fset_window_vscroll (window, make_number (px), Qt);
+		  return;
+		}
 	    }
-	  if (n > 0 && (px = XINT (XCDR (tem))) > 0)
+	  if (n > 0)
 	    {
-	      px = max (0, -w->vscroll + min (px, dy));
-	      Fset_window_vscroll (window, make_number (px), Qt);
-	      return;
+	      /* Do vscroll if already vscrolled or only display line.  */
+	      if (rbot > 0 && (w->vscroll < 0 || vpos == 0))
+		{
+		  px = max (0, -w->vscroll + min (rbot, dy));
+		  Fset_window_vscroll (window, make_number (px), Qt);
+		  return;
+		}
+
+	      /* Maybe modify window start instead of scrolling.  */
+	      if (rbot > 0 || w->vscroll < 0)
+		{
+		  int spos;
+
+		  Fset_window_vscroll (window, make_number (0), Qt);
+		  /* If there are other text lines above the current row,
+		     move window start to current row.  Else to next row. */
+		  if (rbot > 0)
+		    spos = XINT (Fline_beginning_position (Qnil));
+		  else
+		    spos = min (XINT (Fline_end_position (Qnil)) + 1, ZV);
+		  set_marker_restricted (w->start, make_number (spos),
+					 w->buffer);
+		  w->start_at_line_beg = Qt;
+		  w->update_mode_line = Qt;
+		  XSETFASTINT (w->last_modified, 0);
+		  XSETFASTINT (w->last_overlay_modified, 0);
+		  /* Set force_start so that redisplay_window will run the
+		     window-scroll-functions.  */
+		  w->force_start = Qt;
+		  return;
+		}
 	    }
 	}
+      /* Cancel previous vscroll.  */
       Fset_window_vscroll (window, make_number (0), Qt);
     }
 
@@ -4918,7 +4956,7 @@
       if (dy <= 0)
 	{
 	  move_it_vertically_backward (&it, -dy);
-	  /* Ensure we actually does move, e.g. in case we are currently
+	  /* Ensure we actually do move, e.g. in case we are currently
 	     looking at an image that is taller that the window height.  */
 	  while (start_pos == IT_CHARPOS (it)
 		 && start_pos > BEGV)
@@ -4928,7 +4966,7 @@
 	{
 	  move_it_to (&it, ZV, -1, it.current_y + dy, -1,
 		      MOVE_TO_POS | MOVE_TO_Y);
-	  /* Ensure we actually does move, e.g. in case we are currently
+	  /* Ensure we actually do move, e.g. in case we are currently
 	     looking at an image that is taller that the window height.  */
 	  while (start_pos == IT_CHARPOS (it)
 		 && start_pos < ZV)
@@ -6656,7 +6694,7 @@
     CHECK_NATNUM (left_width);
   if (!NILP (right_width))
     CHECK_NATNUM (right_width);
- 
+
   /* Do nothing on a tty.  */
   if (FRAME_WINDOW_P (WINDOW_XFRAME (w))
       && (!EQ (w->left_fringe_width, left_width)
--- a/src/xdisp.c	Tue Sep 05 02:54:22 2006 +0000
+++ b/src/xdisp.c	Wed Sep 06 07:30:39 2006 +0000
@@ -1281,13 +1281,12 @@
 /* Return 1 if position CHARPOS is visible in window W.
    If visible, set *X and *Y to pixel coordinates of top left corner.
    Set *RTOP and *RBOT to pixel height of an invisible area of glyph at POS.
-   EXACT_MODE_LINE_HEIGHTS_P non-zero means compute exact mode-line
-   and header-lines heights.  */
+   Set *ROWH and *VPOS to row's visible height and VPOS (row number).  */
 
 int
-pos_visible_p (w, charpos, x, y, rtop, rbot, exact_mode_line_heights_p)
-     struct window *w;
-     int charpos, *x, *y, *rtop, *rbot, exact_mode_line_heights_p;
+pos_visible_p (w, charpos, x, y, rtop, rbot, rowh, vpos)
+     struct window *w;
+     int charpos, *x, *y, *rtop, *rbot, *rowh, *vpos;
 {
   struct it it;
   struct text_pos top;
@@ -1305,22 +1304,19 @@
 
   SET_TEXT_POS_FROM_MARKER (top, w->start);
 
-  /* Compute exact mode line heights, if requested.  */
-  if (exact_mode_line_heights_p)
-    {
-      if (WINDOW_WANTS_MODELINE_P (w))
-	current_mode_line_height
-	  = display_mode_line (w, CURRENT_MODE_LINE_FACE_ID (w),
-			       current_buffer->mode_line_format);
-
-      if (WINDOW_WANTS_HEADER_LINE_P (w))
-	current_header_line_height
-	  = display_mode_line (w, HEADER_LINE_FACE_ID,
+  /* Compute exact mode line heights.  */
+  if (WINDOW_WANTS_MODELINE_P (w))
+    current_mode_line_height
+      = display_mode_line (w, CURRENT_MODE_LINE_FACE_ID (w),
+			   current_buffer->mode_line_format);
+
+  if (WINDOW_WANTS_HEADER_LINE_P (w))
+    current_header_line_height
+      = display_mode_line (w, HEADER_LINE_FACE_ID,
 			       current_buffer->header_line_format);
-    }
 
   start_display (&it, w, top);
-  move_it_to (&it, charpos, -1, it.last_visible_y, -1,
+  move_it_to (&it, charpos, -1, it.last_visible_y-1, -1,
 	      MOVE_TO_POS | MOVE_TO_Y);
 
   /* Note that we may overshoot because of invisible text.  */
@@ -1341,6 +1337,9 @@
 	  *y = max (top_y + max (0, it.max_ascent - it.ascent), window_top_y);
 	  *rtop = max (0, window_top_y - top_y);
 	  *rbot = max (0, bottom_y - it.last_visible_y);
+	  *rowh = max (0, (min (bottom_y, it.last_visible_y)
+			   - max (top_y, window_top_y)));
+	  *vpos = it.vpos;
 	}
     }
   else
@@ -1359,6 +1358,11 @@
 	  *rtop = max (0, -it2.current_y);
 	  *rbot = max (0, ((it2.current_y + it2.max_ascent + it2.max_descent)
 			   - it.last_visible_y));
+	  *rowh = max (0, (min (it2.current_y + it2.max_ascent + it2.max_descent,
+				it.last_visible_y)
+			   - max (it2.current_y,
+				  WINDOW_HEADER_LINE_HEIGHT (w))));
+	  *vpos = it2.vpos;
 	}
     }
 
@@ -1370,6 +1374,15 @@
   if (visible_p && XFASTINT (w->hscroll) > 0)
     *x -= XFASTINT (w->hscroll) * WINDOW_FRAME_COLUMN_WIDTH (w);
 
+#if 0
+  /* Debugging code.  */
+  if (visible_p)
+    fprintf (stderr, "+pv pt=%d vs=%d --> x=%d y=%d rt=%d rb=%d rh=%d vp=%d\n",
+	     charpos, w->vscroll, *x, *y, *rtop, *rbot, *rowh, *vpos);
+  else
+    fprintf (stderr, "-pv pt=%d vs=%d\n", charpos, w->vscroll);
+#endif
+
   return visible_p;
 }
 
@@ -12166,7 +12179,8 @@
   window_height = window_box_height (w);
   if (row->height >= window_height)
     {
-      if (!force_p || MINI_WINDOW_P (w) || w->vscroll)
+      if (!force_p || MINI_WINDOW_P (w)
+	  || w->vscroll || w->cursor.vpos == 0)
 	return 1;
     }
   return 0;
@@ -13650,7 +13664,8 @@
       this_scroll_margin = min (this_scroll_margin, WINDOW_TOTAL_LINES (w) / 4);
       this_scroll_margin *= FRAME_LINE_HEIGHT (it.f);
 
-      if ((w->cursor.y < this_scroll_margin
+      if ((w->cursor.y >= 0	/* not vscrolled */
+	   && w->cursor.y < this_scroll_margin
 	   && CHARPOS (pos) > BEGV
 	   && IT_CHARPOS (it) < ZV)
 	  /* rms: considering make_cursor_line_fully_visible_p here