changeset 90853:d1039e83b4a7

Merge from emacs--devo--0 Patches applied: * emacs--devo--0 (patch 771-772) - Update from CVS - Merge from emacs--rel--22 * emacs--rel--22 (patch 26-27) - Update from CVS - lisp/vc-hooks.el (vc-find-root): Fix file attribute test Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-210
author Miles Bader <miles@gnu.org>
date Fri, 25 May 2007 05:05:41 +0000
parents 7004567d576d (current diff) b3bd944f9137 (diff)
children 03ec96a627ba
files ChangeLog admin/nt/dump.bat admin/nt/makedist.bat lisp/ChangeLog lisp/textmodes/flyspell.el lisp/vc-hooks.el src/ChangeLog src/image.c
diffstat 10 files changed, 344 insertions(+), 42 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu May 24 21:31:25 2007 +0000
+++ b/ChangeLog	Fri May 25 05:05:41 2007 +0000
@@ -1,3 +1,7 @@
+2007-05-25  Chong Yidong  <cyd@stupidchicken.com>
+
+	* mkinstalldirs: Sync to version in automake CVS.
+
 2007-05-22  Andreas Schwab  <schwab@suse.de>
 
 	* configure.in: Prefer build_alias over host when host_alias is
--- a/admin/nt/dump.bat	Thu May 24 21:31:25 2007 +0000
+++ b/admin/nt/dump.bat	Fri May 25 05:05:41 2007 +0000
@@ -10,8 +10,6 @@
 
 :dump
 rem Overwrites emacs.exe if still present
-mkdir ..\lib-src
-copy fns* ..\lib-src
 mkdir obj
 mkdir obj\i386
 mkdir obj\etc
--- a/admin/nt/makedist.bat	Thu May 24 21:31:25 2007 +0000
+++ b/admin/nt/makedist.bat	Fri May 25 05:05:41 2007 +0000
@@ -25,8 +25,6 @@
 rem Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 rem Boston, MA 02110-1301, USA.
 
-set ZIP=zip
-
 if (%3) == () goto usage
 if not (%4) == () goto %4
 
@@ -34,18 +32,25 @@
 
 echo Create full bin distribution
 copy %3\README.W32 emacs-%1\README.W32
-
-%ZIP% -x emacs.mdp -x *.pdb -x *.opt -x *~ -x CVS -9 emacs-%1/BUGS emacs-%1/README emacs-%1/README.W32 emacs-%1/bin emacs-%1/etc emacs-%1/info emacs-%1/lisp %2-bin-i386.zip
+rem Info-ZIP zip seems to be broken on Windows.
+rem It always writes to zip.zip and treats the zipfile argument as one
+rem of the files to go in it.
+rem zip -9 -r %2-bin-i386 emacs-%1/BUGS emacs-%1/README emacs-%1/README.W32 emacs-%1/bin emacs-%1/etc emacs-%1/info emacs-%1/lisp emacs-%1/leim -x emacs.mdp *.pdb *.opt *~ CVS
+7z a -tZIP -mx=9 -xr!emacs.mdp -xr!*.pdb -xr!*.opt -xr!*~ -xr!CVS -xr!.arch-inventory %2-bin-i386.zip emacs-%1/BUGS emacs-%1/README emacs-%1/README.W32 emacs-%1/bin emacs-%1/etc emacs-%1/info emacs-%1/lisp emacs-%1/leim 
 del emacs-%1\README.W32
 if not (%4) == () goto end
 
 :barebin
-
 echo Create archive with just the basic binaries and generated files
 echo (the user needs to unpack the full source distribution for
 echo  everything else)
 copy %3\README.W32 emacs-%1\README.W32
-%ZIP% -9 emacs-%1/README.W32 emacs-%1/bin emacs-%1/etc/DOC emacs-%1/etc/DOC-X %2-barebin-i386.zip
+copy %3\dump.bat emacs-%1\bin\dump.bat
+rem Info-ZIP zip seems to be broken on Windows.
+rem It always writes to zip.zip and treats the zipfile argument as one
+rem of the files to go in it.
+rem zip -9 -r %2-barebin-i386.zip emacs-%1/README.W32 emacs-%1/bin emacs-%1/etc/DOC-X
+7z a -tZIP -mx=9 %2-barebin-i386.zip emacs-%1/README.W32 emacs-%1/bin emacs-%1/etc/DOC-X
 del emacs-%1\README.W32
 if not (%4) == () goto end
 
--- a/lisp/ChangeLog	Thu May 24 21:31:25 2007 +0000
+++ b/lisp/ChangeLog	Fri May 25 05:05:41 2007 +0000
@@ -1,3 +1,24 @@
+2007-05-25  Miles Bader  <miles@fencepost.gnu.org>
+
+	* vc-hooks.el (vc-find-root): Fix file attribute test.
+
+2007-05-24  Richard Stallman  <rms@gnu.org>
+
+	* textmodes/flyspell.el (flyspell-correct-word-before-point):
+	Don't let opoint be nil.
+	(flyspell-emacs-popup): Explicit error if no dialogs.
+
+2007-05-24  Chong Yidong  <cyd@stupidchicken.com>
+
+	* image-mode.el (image-forward-hscroll, image-backward-hscroll)
+	(image-next-line, image-previous-line, image-scroll-up)
+	(image-scroll-down, image-bol, image-eol, image-bob, image-eob):
+	New functions.
+	(image-mode-map): Remap motion commands.
+	(image-mode-text-map): New keymap for viewing images as text.
+	(image-mode): Use image-mode-map.
+	(image-toggle-display): Toggle auto-hscroll-mode and mode keymaps.
+
 2007-05-24  Stefan Monnier  <monnier@iro.umontreal.ca>
 
 	* textmodes/fill.el (canonically-space-region): Make the second arg
--- a/lisp/image-mode.el	Thu May 24 21:31:25 2007 +0000
+++ b/lisp/image-mode.el	Fri May 25 05:05:41 2007 +0000
@@ -43,11 +43,162 @@
 ;;;###autoload (push '("\\.p[bpgn]m\\'" . image-mode) auto-mode-alist)
 ;;;###autoload (push '("\\.x[bp]m\\'"   . image-mode-maybe) auto-mode-alist)
 
+;;; Image scrolling functions
+
+(defun image-forward-hscroll (&optional n)
+  "Scroll image in current window to the left by N character widths.
+Stop if the right edge of the image is reached."
+  (interactive "p")
+  (cond ((= n 0) nil)
+	((< n 0)
+	 (set-window-hscroll (selected-window)
+			     (max 0 (+ (window-hscroll) n))))
+	(t
+	 (let* ((image (get-text-property 1 'display))
+		(edges (window-inside-edges))
+		(win-width (- (nth 2 edges) (nth 0 edges)))
+		(img-width (ceiling (car (image-size image)))))
+	   (set-window-hscroll (selected-window)
+			       (min (max 0 (- img-width win-width))
+				    (+ n (window-hscroll))))))))
+
+(defun image-backward-hscroll (&optional n)
+  "Scroll image in current window to the right by N character widths.
+Stop if the left edge of the image is reached."
+  (interactive "p")
+  (image-forward-hscroll (- n)))
+
+(defun image-next-line (&optional n)
+  "Scroll image in current window upward by N lines.
+Stop if the bottom edge of the image is reached."
+  (interactive "p")
+  (cond ((= n 0) nil)
+	((< n 0)
+	 (set-window-vscroll (selected-window)
+			     (max 0 (+ (window-vscroll) n))))
+	(t
+	 (let* ((image (get-text-property 1 'display))
+		(edges (window-inside-edges))
+		(win-height (- (nth 3 edges) (nth 1 edges)))
+		(img-height (ceiling (cdr (image-size image)))))
+	   (set-window-vscroll (selected-window)
+			       (min (max 0 (- img-height win-height))
+				    (+ n (window-vscroll))))))))
+
+(defun image-previous-line (&optional n)
+  "Scroll image in current window downward by N lines.
+Stop if the top edge of the image is reached."
+  (interactive "p")
+  (image-next-line (- n)))
+
+(defun image-scroll-up (&optional n)
+  "Scroll image in current window upward by N lines.
+Stop if the bottom edge of the image is reached.
+If ARG is omitted or nil, scroll upward by a near full screen.
+A near full screen is `next-screen-context-lines' less than a full screen.
+Negative ARG means scroll downward.
+If ARG is the atom `-', scroll downward by nearly full screen.
+When calling from a program, supply as argument a number, nil, or `-'."
+  (interactive "P")
+  (cond ((null n)
+	 (let* ((edges (window-inside-edges))
+		(win-height (- (nth 3 edges) (nth 1 edges))))
+	   (image-next-line
+	    (max 0 (- win-height next-screen-context-lines)))))
+	((eq n '-)
+	 (let* ((edges (window-inside-edges))
+		(win-height (- (nth 3 edges) (nth 1 edges))))
+	   (image-next-line
+	    (min 0 (- next-screen-context-lines win-height)))))
+	(t (image-next-line (prefix-numeric-value n)))))
+
+(defun image-scroll-down (&optional n)
+  "Scroll image in current window downward by N lines
+Stop if the top edge of the image is reached.
+If ARG is omitted or nil, scroll downward by a near full screen.
+A near full screen is `next-screen-context-lines' less than a full screen.
+Negative ARG means scroll upward.
+If ARG is the atom `-', scroll upward by nearly full screen.
+When calling from a program, supply as argument a number, nil, or `-'."
+  (interactive "P")
+  (cond ((null n)
+	 (let* ((edges (window-inside-edges))
+		(win-height (- (nth 3 edges) (nth 1 edges))))
+	   (image-next-line
+	    (min 0 (- next-screen-context-lines win-height)))))
+	((eq n '-)
+	 (let* ((edges (window-inside-edges))
+		(win-height (- (nth 3 edges) (nth 1 edges))))
+	   (image-next-line
+	    (max 0 (- win-height next-screen-context-lines)))))
+	(t (image-next-line (- (prefix-numeric-value n))))))
+
+(defun image-bol (arg)
+  "Scroll horizontally to the left edge of the image in the current window.
+With argument ARG not nil or 1, move forward ARG - 1 lines first,
+stopping if the top or bottom edge of the image is reached."
+  (interactive "p")
+  (and arg
+       (/= (setq arg (prefix-numeric-value arg)) 1)
+       (image-next-line (- arg 1)))
+  (set-window-hscroll (selected-window) 0))
+
+(defun image-eol (arg)
+  "Scroll horizontally to the right edge of the image in the current window.
+With argument ARG not nil or 1, move forward ARG - 1 lines first,
+stopping if the top or bottom edge of the image is reached."
+  (interactive "p")
+  (and arg
+       (/= (setq arg (prefix-numeric-value arg)) 1)
+       (image-next-line (- arg 1)))
+  (let* ((image (get-text-property 1 'display))
+	 (edges (window-inside-edges))
+	 (win-width (- (nth 2 edges) (nth 0 edges)))
+	 (img-width (ceiling (car (image-size image)))))
+    (set-window-hscroll (selected-window)
+			(max 0 (- img-width win-width)))))
+
+(defun image-bob ()
+  "Scroll to the top-left corner of the image in the current window."
+  (interactive)
+  (set-window-hscroll (selected-window) 0)
+  (set-window-vscroll (selected-window) 0))
+
+(defun image-eob ()
+  "Scroll to the bottom-right corner of the image in the current window."
+  (interactive)
+  (let* ((image (get-text-property 1 'display))
+	 (edges (window-inside-edges))
+	 (win-width (- (nth 2 edges) (nth 0 edges)))
+	 (img-width (ceiling (car (image-size image))))
+	 (win-height (- (nth 3 edges) (nth 1 edges)))
+	 (img-height (ceiling (cdr (image-size image)))))
+    (set-window-hscroll (selected-window) (max 0 (- img-width win-width)))
+    (set-window-vscroll (selected-window) (max 0 (- img-height win-height)))))
+
+;;; Image Mode setup
+
 (defvar image-mode-map
   (let ((map (make-sparse-keymap)))
     (define-key map "\C-c\C-c" 'image-toggle-display)
+    (define-key map [remap forward-char] 'image-forward-hscroll)
+    (define-key map [remap backward-char] 'image-backward-hscroll)
+    (define-key map [remap previous-line] 'image-previous-line)
+    (define-key map [remap next-line] 'image-next-line)
+    (define-key map [remap scroll-up] 'image-scroll-up)
+    (define-key map [remap scroll-down] 'image-scroll-down)
+    (define-key map [remap move-beginning-of-line] 'image-bol)
+    (define-key map [remap move-end-of-line] 'image-eol)
+    (define-key map [remap beginning-of-buffer] 'image-bob)
+    (define-key map [remap end-of-buffer] 'image-eob)
     map)
-  "Major mode keymap for Image mode.")
+  "Major mode keymap for viewing images in Image mode.")
+
+(defvar image-mode-text-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map "\C-c\C-c" 'image-toggle-display)
+    map)
+  "Major mode keymap for viewing images as text in Image mode.")
 
 ;;;###autoload
 (defun image-mode ()
@@ -58,13 +209,13 @@
   (kill-all-local-variables)
   (setq mode-name "Image")
   (setq major-mode 'image-mode)
-  (use-local-map image-mode-map)
   (add-hook 'change-major-mode-hook 'image-toggle-display-text nil t)
   (if (and (display-images-p)
 	   (not (get-text-property (point-min) 'display)))
       (image-toggle-display)
     ;; Set next vars when image is already displayed but local
     ;; variables were cleared by kill-all-local-variables
+    (use-local-map image-mode-map)
     (setq cursor-type nil truncate-lines t))
   (run-mode-hooks 'image-mode-hook)
   (if (display-images-p)
@@ -140,6 +291,8 @@
 	(set-buffer-modified-p modified)
 	(kill-local-variable 'cursor-type)
 	(kill-local-variable 'truncate-lines)
+	(kill-local-variable 'auto-hscroll-mode)
+	(use-local-map image-mode-text-map)
 	(if (called-interactively-p)
 	    (message "Repeat this command to go back to displaying the image")))
     ;; Turn the image data into a real image, but only if the whole file
@@ -161,12 +314,9 @@
 	       nil t)))
 	   (props
 	    `(display ,image
-		      intangible ,image
-		      rear-nonsticky (display intangible)
-		      ;; This a cheap attempt to make the whole buffer
-		      ;; read-only when we're visiting the file (as
-		      ;; opposed to just inserting it).
-		      read-only t front-sticky (read-only)))
+	      intangible ,image
+	      rear-nonsticky (display intangible)
+	      read-only t front-sticky (read-only)))
 	   (inhibit-read-only t)
 	   (buffer-undo-list t)
 	   (modified (buffer-modified-p)))
@@ -179,6 +329,9 @@
       ;; This just makes the arrow displayed in the right fringe
       ;; area look correct when the image is wider than the window.
       (setq truncate-lines t)
+      ;; Allow navigation of large images
+      (set (make-local-variable 'auto-hscroll-mode) nil)
+      (use-local-map image-mode-map)
       (if (called-interactively-p)
 	  (message "Repeat this command to go back to displaying the file as text")))))
 
--- a/lisp/textmodes/flyspell.el	Thu May 24 21:31:25 2007 +0000
+++ b/lisp/textmodes/flyspell.el	Fri May 25 05:05:41 2007 +0000
@@ -2025,6 +2025,7 @@
     (error "Pop-up menus do not work on this terminal"))
   ;; use the correct dictionary
   (flyspell-accept-buffer-local-defs)
+  (or opoint (setq opoint (point-marker)))
   (let ((cursor-location (point))
 	(word (flyspell-get-word nil)))
     (if (consp word)
@@ -2133,6 +2134,8 @@
 ;;*---------------------------------------------------------------------*/
 (defun flyspell-emacs-popup (event poss word)
   "The Emacs popup menu."
+  (unless window-system
+    (error "This command requires pop-up dialogs"))
   (if (not event)
       (let* ((mouse-pos  (mouse-position))
 	     (mouse-pos  (if (nth 1 mouse-pos)
--- a/lisp/vc-hooks.el	Thu May 24 21:31:25 2007 +0000
+++ b/lisp/vc-hooks.el	Fri May 25 05:05:41 2007 +0000
@@ -325,7 +325,7 @@
                    ;; to another user.  This should save us from looking in
                    ;; things like /net and /afs.  This assumes that all the
                    ;; files inside a project belong to the same user.
-                   (not (equal user (file-attributes file)))
+                   (not (equal user (nth 2 (file-attributes file))))
                    (string-match vc-ignore-dir-regexp file)))
       (if (file-exists-p (expand-file-name witness file))
          (setq root file)
--- a/mkinstalldirs	Thu May 24 21:31:25 2007 +0000
+++ b/mkinstalldirs	Fri May 25 05:05:41 2007 +0000
@@ -1,38 +1,152 @@
 #! /bin/sh
 # mkinstalldirs --- make directory hierarchy
-# Author: Noah Friedman <friedman@prep.ai.mit.edu>
+
+scriptversion=2006-05-11.19
+
+# Original author: Noah Friedman <friedman@prep.ai.mit.edu>
 # Created: 1993-05-16
-# Public domain
+# Public domain.
+#
+# This file is maintained in Automake, please report
+# bugs to <bug-automake@gnu.org> or send patches to
+# <automake-patches@gnu.org>.
+
+nl='
+'
+IFS=" ""	$nl"
+errstatus=0
+dirmode=
+
+usage="\
+Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ...
+
+Create each directory DIR (with mode MODE, if specified), including all
+leading file name components.
+
+Report bugs to <bug-automake@gnu.org>."
 
-errstatus=0
+# process command line arguments
+while test $# -gt 0 ; do
+  case $1 in
+    -h | --help | --h*)         # -h for help
+      echo "$usage"
+      exit $?
+      ;;
+    -m)                         # -m PERM arg
+      shift
+      test $# -eq 0 && { echo "$usage" 1>&2; exit 1; }
+      dirmode=$1
+      shift
+      ;;
+    --version)
+      echo "$0 $scriptversion"
+      exit $?
+      ;;
+    --)                         # stop option processing
+      shift
+      break
+      ;;
+    -*)                         # unknown option
+      echo "$usage" 1>&2
+      exit 1
+      ;;
+    *)                          # first non-opt arg
+      break
+      ;;
+  esac
+done
 
 for file
 do
-   set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
-   shift
+  if test -d "$file"; then
+    shift
+  else
+    break
+  fi
+done
 
-   pathcomp=
-   for d
-   do
-     pathcomp="$pathcomp$d"
-     case "$pathcomp" in
-       -* ) pathcomp=./$pathcomp ;;
-     esac
+case $# in
+  0) exit 0 ;;
+esac
 
-     if test ! -d "$pathcomp"; then
-        echo "mkdir $pathcomp" 1>&2
-
-        (mkdir "$pathcomp" && chmod a+rx "$pathcomp") || lasterr=$?
+# Solaris 8's mkdir -p isn't thread-safe.  If you mkdir -p a/b and
+# mkdir -p a/c at the same time, both will detect that a is missing,
+# one will create a, then the other will try to create a and die with
+# a "File exists" error.  This is a problem when calling mkinstalldirs
+# from a parallel make.  We use --version in the probe to restrict
+# ourselves to GNU mkdir, which is thread-safe.
+case $dirmode in
+  '')
+    if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
+      echo "mkdir -p -- $*"
+      exec mkdir -p -- "$@"
+    else
+      # On NextStep and OpenStep, the `mkdir' command does not
+      # recognize any option.  It will interpret all options as
+      # directories to create, and then abort because `.' already
+      # exists.
+      test -d ./-p && rmdir ./-p
+      test -d ./--version && rmdir ./--version
+    fi
+    ;;
+  *)
+    if mkdir -m "$dirmode" -p --version . >/dev/null 2>&1 &&
+       test ! -d ./--version; then
+      echo "mkdir -m $dirmode -p -- $*"
+      exec mkdir -m "$dirmode" -p -- "$@"
+    else
+      # Clean up after NextStep and OpenStep mkdir.
+      for d in ./-m ./-p ./--version "./$dirmode";
+      do
+        test -d $d && rmdir $d
+      done
+    fi
+    ;;
+esac
 
-        if test ! -d "$pathcomp"; then
-  	  errstatus=$lasterr
-        fi
-     fi
+for file
+do
+  case $file in
+    /*) pathcomp=/ ;;
+    *)  pathcomp= ;;
+  esac
+  oIFS=$IFS
+  IFS=/
+  set fnord $file
+  shift
+  IFS=$oIFS
+
+  for d
+  do
+    test "x$d" = x && continue
+
+    pathcomp=$pathcomp$d
+    case $pathcomp in
+      -*) pathcomp=./$pathcomp ;;
+    esac
 
-     pathcomp="$pathcomp/"
-   done
+    if test ! -d "$pathcomp"; then
+      echo "mkdir $pathcomp"
+
+      mkdir "$pathcomp" || lasterr=$?
+
+      if test ! -d "$pathcomp"; then
+	errstatus=$lasterr
+      else
+	if test ! -z "$dirmode"; then
+	  echo "chmod $dirmode $pathcomp"
+	  lasterr=
+	  chmod "$dirmode" "$pathcomp" || lasterr=$?
+
+	  if test ! -z "$lasterr"; then
+	    errstatus=$lasterr
+	  fi
+	fi
+      fi
+    fi
+
+    pathcomp=$pathcomp/
+  done
 done
 
 exit $errstatus
-
-# mkinstalldirs ends here
--- a/src/ChangeLog	Thu May 24 21:31:25 2007 +0000
+++ b/src/ChangeLog	Fri May 25 05:05:41 2007 +0000
@@ -3,6 +3,10 @@
 	* macterm.c [USE_CARBON_EVENTS] (mac_handle_window_event):
 	Call mac_wakeup_from_rne on window size change.
 
+2007-05-25  Chong Yidong  <cyd@stupidchicken.com>
+
+	* image.c (uncache_image): Fix typo.
+
 2007-05-23  Johannes Weiner <hannes@saeurebad.de> (tiny change)
 
 	* keyboard.c (make_lispy_movement): Condition on HAVE_GPM too.
--- a/src/image.c	Thu May 24 21:31:25 2007 +0000
+++ b/src/image.c	Fri May 25 05:05:41 2007 +0000
@@ -1639,7 +1639,7 @@
      Lisp_Object spec;
 {
   struct image_cache *c = FRAME_X_IMAGE_CACHE (f);
-  struct image *img = IMAGE_FROM_ID (f, lookup_image (f, spec));
+  struct image *img;
   unsigned hash = sxhash (spec, 0);
   int i = hash % IMAGE_CACHE_BUCKETS_SIZE;