changeset 487:54fa1a5c2d12

[xemacs-hg @ 2001-04-28 07:48:36 by ben] misc changes, some for 21.4 remove bogus lines setting zmacs_region_stays to 0. remove debug lines. Correct general info about init file. Fix up Cygwin section. More contributions. Fix spurious setting of zmacs-region-stays to t after a non-shift motion command. Sync up with FSF 20.7, to fix bugs handling some etags line formats. Move non-window-system specific code that was duplicated in all window systems into the generic code. * gutter.el (init-gutter): Removed. (unused) Clean up the rectangle code w.r.t. selections. You'll now get the right text copied into the primary selection (but not the clipboard yet, unfortunately -- that really requires defining our own rectangle type).
author ben
date Sat, 28 Apr 2001 07:48:46 +0000
parents a83afd50994d
children 1e7b510d04f6
files etc/photos/jason.png etc/photos/jasonm.png etc/photos/oscar.png etc/photos/oscarm.png lisp/ChangeLog lisp/about.el lisp/etags.el lisp/gtk-init.el lisp/gutter.el lisp/keydefs.el lisp/mouse.el lisp/msw-init.el lisp/select.el lisp/simple.el lisp/startup.el lisp/toolbar-items.el lisp/toolbar.el lisp/x-init.el lwlib/ChangeLog lwlib/lwlib-utils.c src/ChangeLog src/buffer.c src/editfns.c src/event-msw.c src/scrollbar-msw.c
diffstat 25 files changed, 314 insertions(+), 235 deletions(-) [+]
line wrap: on
line diff
Binary file etc/photos/jason.png has changed
Binary file etc/photos/jasonm.png has changed
Binary file etc/photos/oscar.png has changed
Binary file etc/photos/oscarm.png has changed
--- a/lisp/ChangeLog	Sat Apr 28 02:10:57 2001 +0000
+++ b/lisp/ChangeLog	Sat Apr 28 07:48:46 2001 +0000
@@ -1,3 +1,52 @@
+2001-04-28  Ben Wing  <ben@xemacs.org>
+
+	* about.el (xemacs-hackers):
+	* about.el (about-url-alist):
+	* about.el (about-personal-info):
+	* about.el (about-hacker-contribution):
+	More contributions.
+	
+	* simple.el (handle-post-motion-command):
+	Fix spurious setting of zmacs-region-stays to t after a non-shift
+	motion command.
+
+	* etags.el (find-tag-internal):
+	Sync up with FSF 20.7, to fix bugs handling some etags line formats.
+	
+	* gtk-init.el (init-post-gtk-win):
+	* msw-init.el (init-post-mswindows-win):
+	* x-init.el:
+	* x-init.el (x-activate-region-as-selection): Removed.
+	* x-init.el (init-post-x-win):
+	* keydefs.el (global-map):
+	* simple.el:
+	* startup.el (command-line):
+	* toolbar-items.el:
+	* toolbar-items.el (init-x-toolbar-list): Removed.
+	* toolbar-items.el (init-toolbar-list): New.
+	* toolbar-items.el (init-x-toolbar): Removed.
+	* toolbar-items.el (init-toolbar): New.
+	* toolbar-items.el (x-init-toolbar-from-resources): Removed.
+	* toolbar.el:
+	Move non-window-system specific code that was duplicated in
+	all window systems into the generic code.
+	
+	* gutter.el:
+	* gutter.el (init-gutter): Removed. (unused)
+	
+	* mouse.el:
+	* mouse.el (default-mouse-track-maybe-own-selection):
+	* mouse.el (mouse-track-activate-rectangular-selection): New.
+	* select.el:
+	* select.el (disown-selection):
+	* select.el (activate-region-as-selection):
+	* select.el (primary-selection-extent):
+	* select.el (valid-simple-selection-p):
+	Clean up the rectangle code w.r.t. selections.  You'll now get
+	the right text copied into the primary selection (but not the
+	clipboard yet, unfortunately -- that really requires defining
+	our own rectangle type).
+
 2001-04-25  IKEYAMA Tomonori <tomonori@suiyokai.org>
 
 	* faces.el (make-face-bold):
--- a/lisp/about.el	Sat Apr 28 02:10:57 2001 +0000
+++ b/lisp/about.el	Sat Apr 28 07:48:46 2001 +0000
@@ -150,7 +150,7 @@
     (rose     "John Rose"         "rose@xemacs.org")
     (rossini  "Anthony Rossini"   "rossini@xemacs.org")
     (slb      "Steve Baur"        "steve@xemacs.org")
-    (sperber  "Michael Sperber"   "sperber@xemacs.org")
+    (sperber  "Michael Sperber"   "mike@xemacs.org")
     (stig     "Jonathan Stigelman" "stig@xemacs.org")
     (stigb    "Stig Bjorlykke"    "stigb@xemacs.org")
     (thiessel "Marcus Thiessel"   "marcus@xemacs.org")
@@ -188,6 +188,7 @@
     ;; to sort the stuff below, use M-x sort-regexp-fields RET
     ;; ^.*$ RET (\([a-z]*\) RET
   '((ajc        . "http://www-personal.monash.edu.au/~ajc/")
+    (alastair   . "http://website.lineone.net/~ajhoughton/")
     (baw        . "http://barry.wooz.org/")
     (ben        . "http://www.666.com/ben/")
     (ben-xemacs . "http://www.xemacs.org/Architecting-XEmacs/index.html")
@@ -757,7 +758,15 @@
     (alastair
      (widget-insert
       "\
-Sorry, no personal information available about me yet.\n"))
+Alastair, apart from being an all-round hacker, occasional contributor
+to free software projects and general good egg(!), currently works for
+Telsis, a manufacturer of telephony equipment on the south coast of
+England.  He'd quite like to have his own company one day, but has yet
+to think of that killer product...
+
+See also ")
+        (about-url-link 'alastair nil "Visit Alastair's home page")
+        (widget-insert ".\n"))
     (baw
      (widget-insert "\
 As of November 2000, I am a software engineer with the Pythonlabs at
@@ -857,21 +866,12 @@
 Sorry, no personal information available about me yet.\n"))
     (cthomp
      (widget-insert "\
-Chuck, through being in the wrong place at the right time, got stuck
-with being Jamie's replacement as the primary maintainer of XEmacs.
-This caused his hair to begin falling out and quadrupled his daily
-coffee dosage.  Though he works at and for the University of Illinois
-his funding for XEmacs work actually came from Sun Microsystems.
-
-He has worked on XEmacs since November 1992, which fact occasionally
-gives him nightmares.  As of October 1995, he no longer works
-full-time on XEmacs, though he does continue as an active maintainer.
-His main contributions have been the greatly enhanced redisplay
-engine, scrollbar support, the toolbars, configure support and
-numerous other features and fixes.
-
-Rumors that Chuck is aka Black Francis aka Frank Black are completely
-unfounded.\n"))
+Chuck is a senior system and network administrator for the Computer
+Science department at the Unversity of Illinois.  In one previous life
+he spent every waking hour working on XEmacs.  In another he dabbled
+as a project manager for a streaming video startup (RIP).  His current
+reason for not having time to contribute to XEmacs is the Thompson
+Twins.\n"))
     (daiki
      (about-url-link 'daiki nil "Visit Daiki's page"))
     (dan
@@ -1050,12 +1050,13 @@
       (widget-insert ".\n"))
     (jens
      (widget-insert "\
-I'm currently working at the University of Karlsruhe, Germany on
-getting my diploma thesis on Supersymmetry (uuh, that's physics) done.
-After that (and all the remaining exams) I'm looking forward to make a
-living out of my hobbies -- computers (and graphics). But because I
-have no deadline for the exams and XEmacs betas are released at a high
-rate this may take some time...\n"))
+I'm currently working for 1&1 Internet AG, a large Domain and Webspace
+Provider in Germany and Europe.  I do mostly Java/XML/OO/Component
+stuff today.  I'm interested EJB, Corba and other middleware or
+distributed Systems.  Besides work, I occasionally hack on The Gimp
+and other gtk/gnome related projects.  Maybe the advent of XEmacs/Gtk
+will get me back to spend some time again hacking on XEmacs in the
+near future.\n"))
     (jmiller
      (widget-insert "\
 Jeff grew up in Indiana and is a country boy at heart.  He currently
@@ -1215,9 +1216,11 @@
       "\
 Sorry, no personal information available about me yet.\n"))
     (oscar
-     (widget-insert
-      "\
-Sorry, no personal information available about me yet.\n"))
+     (widget-insert "\
+Oscar heads the Computer Science department at CPE Lyon, a french
+engineering school in France. Besides his administrative tasks he
+teaches networking basics, Internet technologies (you know, all these
+xxML and hairy script languages !)  and the Scheme language.\n"))
     (pelegri
      (widget-insert
       "\
@@ -1249,11 +1252,11 @@
 Sorry, no personal information available about me yet.\n"))
     (rickc
      (widget-insert "\
-The hacker formerly known as Rick Busdiecker develops and maintains
-libraries for financial applications at Lehman Brothers during
-daylight hours.  In the evenings he maintains three children, and
-when he ought to be sleeping he co-maintains ILISP, builds XEmacs
-betas, and tinkers with various personal hacking projects.\n"))
+The hacker formerly known as Rick Busdiecker is a developer and
+technical manager at Deutsche Bank in New York during daylight hours.
+In the evenings he maintains three children, and when he ought to be
+sleeping he builds XEmacs betas, and tinkers with various personal
+hacking projects.\n"))
     (rose
      (widget-insert
       "\
@@ -1348,7 +1351,8 @@
      (widget-insert ".\n"))
     (wmperry
      (widget-insert "\
-Currently working at Aventail, Corp. on SOCKS v5 servers.\n"))
+Happily living in Indiana telecommuting for a company based in Seattle
+\(who I now prefer not to name), wishing I was in Ireland instead.\n"))
     (yoshiki
      (widget-insert
       "\
@@ -1456,8 +1460,9 @@
      (widget-insert
       "\
 Maintainer of XEmacs from mid-1994 through 1996.  Author of the
-redisplay engine and some of the device-abstraction, TTY and glyph
-code.  Creator of the xemacs.org domain.\n"))
+redisplay engine, the original toolbar and scrollbars and some of the
+device-abstraction, TTY and glyph code.  Creator of the xemacs.org
+domain and comp.emacs.xemacs.\n"))
     (daiki
      (widget-insert
       "\
@@ -1579,7 +1584,9 @@
 kit manager.  Also, originator and maintainer of the gnus.org domain.\n"))
     (jens
      (widget-insert "\
-Jens did the artwork for graphics added to XEmacs 20.2 and 19.15.\n"))
+Jens did the artwork for graphics added to XEmacs 20.2 and 19.15. He's
+also the author of \"XEmacs Mine\", a game similar to Minesweeper, but
+running in XEmacs\n"))
     (jmiller
      (widget-insert "\
 Beta tester and last hacker of calendar.\n"))
@@ -1659,9 +1666,10 @@
       "\
 Author of the portable dumper.\n"))
     (oscar
-     (widget-insert
-      "\
-Author of the LDAP support in XEmacs.\n"))
+     (widget-insert "\
+Oscar's major contributions to XEmacs are the internal LDAP support
+and the EUDC package, an interface to query various directory services
+in a uniform manner (when composing mail for instance).\n"))
     (pelegri
      (widget-insert "\
 Author of EOS, a package included in the standard XEmacs distribution
--- a/lisp/etags.el	Sat Apr 28 02:10:57 2001 +0000
+++ b/lisp/etags.el	Sat Apr 28 07:48:46 2001 +0000
@@ -622,6 +622,7 @@
 (autoload 'get-symbol-syntax-table "symbol-syntax")
 
 (defun find-tag-internal (tagname)
+  
   (let ((next (null tagname))
 	(tmpnext (null tagname))
 	;; If tagname is a list: (TAGNAME), this indicates
@@ -631,7 +632,7 @@
 	(exact-syntax-table (get-symbol-syntax-table (syntax-table)))
 	tag-table-currently-matching-exact
 	tag-target exact-tagname
-	tag-tables tag-table-point file linebeg startpos buf
+	tag-tables tag-table-point file linebeg line startpos buf
 	offset found pat syn-tab)
     (when (consp tagname)
       (setq tagname (car tagname)))
@@ -697,45 +698,117 @@
 	       (if exact "matching" "containing")
 	       tagname))
       (beginning-of-line)
-      (search-forward "\C-?")
-      (setq file (expand-file-name (file-of-tag)
-				   ;; In XEmacs, this needs to be
-				   ;; relative to:
-				   (or (file-name-directory (car tag-tables))
-				       "./")))
-      (setq linebeg (buffer-substring (1- (point)) (point-at-bol)))
-      (search-forward ",")
-      (setq startpos (read (current-buffer)))
+
+      ;; from here down, synched with FSF 20.7
+      ;; etags-snarf-tag and etags-goto-tag-location. --ben
+
+      (if (save-excursion
+	    (forward-line -1)
+	    (looking-at "\f\n"))
+	  (progn
+	    ;; The match was for a source file name, not any tag
+	    ;; within a file.  Give text of t, meaning to go exactly
+	    ;; to the location we specify, the beginning of the file.
+	    (setq linebeg t
+		  line nil
+		  startpos 1)
+	    (setq file
+		  (expand-file-name (file-of-tag)
+				    ;; In XEmacs, this needs to be
+				    ;; relative to:
+				    (or (file-name-directory (car tag-tables))
+					"./"))))
+	(search-forward "\C-?")
+	(setq file
+	      (expand-file-name (file-of-tag)
+				;; In XEmacs, this needs to be
+				;; relative to:
+				(or (file-name-directory (car tag-tables))
+				    "./")))
+	(setq linebeg (buffer-substring (1- (point)) (point-at-bol)))
+	;; Skip explicit tag name if present.
+	(search-forward "\001" (save-excursion (forward-line 1) (point)) t)
+	(if (looking-at "[0-9]")
+	    (setq line (string-to-int (buffer-substring
+				       (point)
+				       (progn (skip-chars-forward "0-9")
+					      (point))))))
+	(search-forward ",")
+	(if (looking-at "[0-9]")
+	    (setq startpos (string-to-int (buffer-substring
+					   (point)
+					   (progn (skip-chars-forward "0-9")
+						  (point)))))))
+      ;; Leave point on the next line of the tags file.
+      (forward-line 1)
       (setq last-tag-data
 	    (nconc (list tagname (point) tag-table-currently-matching-exact)
 		   tag-tables))
       (setq buf (find-file-noselect file))
+
+      ;; LINEBEG is the initial part of a line containing the tag and
+      ;; STARTPOS is the character position of LINEBEG within the file
+      ;; (starting from 1); LINE is the line number.  If LINEBEG is t,
+      ;; it means the tag refers to exactly LINE or STARTPOS
+      ;; (whichever is present, LINE having preference, no searching).
+      ;; Either LINE or STARTPOS may be nil; STARTPOS is used if
+      ;; present.  If the tag isn't exactly at the given position then
+      ;; look around that position using a search window which expands
+      ;; until it hits the start of file.
+
       (with-current-buffer buf
 	(save-excursion
 	  (save-restriction
 	    (widen)
-	    ;; Here we search for PAT in the range [STARTPOS - OFFSET,
-	    ;; STARTPOS + OFFSET], with increasing values of OFFSET.
-	    ;;
-	    ;; We used to set the initial offset to 1000, but the
-	    ;; actual sources show that finer-grained control is
-	    ;; needed (e.g. two `hash_string's in src/symbols.c.)  So,
-	    ;; I changed 100 to 100, and (* 3 offset) to (* 5 offset).
-	    (setq offset 100)
-	    (setq pat (concat "^" (regexp-quote linebeg)))
-	    (or startpos (setq startpos (point-min)))
-	    (while (and (not found)
-			(progn
-			  (goto-char (- startpos offset))
-			  (not (bobp))))
-	      (setq found (re-search-forward pat (+ startpos offset) t))
-	      (setq offset (* 5 offset)))
-	    ;; Finally, try finding it anywhere in the buffer.
-	    (or found
-		(re-search-forward pat nil t)
-		(error "%s not found in %s" pat file))
-	    (beginning-of-line)
-	    (setq startpos (point)))))
+	    (if (eq linebeg t)
+		;; Direct file tag.
+		(cond (line (goto-line line))
+		      (startpos (goto-char startpos))
+		      (t (error "etags.el BUG: bogus direct file tag")))
+	      ;; Here we search for PAT in the range [STARTPOS - OFFSET,
+	      ;; STARTPOS + OFFSET], with increasing values of OFFSET.
+	      ;;
+	      ;; We used to set the initial offset to 1000, but the
+	      ;; actual sources show that finer-grained control is
+	      ;; needed (e.g. two `hash_string's in src/symbols.c.)  So,
+	      ;; I changed 1000 to 100, and (* 3 offset) to (* 5 offset).
+	      (setq offset 100)
+	      (setq pat (concat (if (eq selective-display t)
+				    "\\(^\\|\^m\\)" "^")
+				(regexp-quote linebeg)))
+
+	      ;; The character position in the tags table is 0-origin.
+	      ;; Convert it to a 1-origin Emacs character position.
+	      (if startpos (setq startpos (1+ startpos)))
+	      ;; If no char pos was given, try the given line number.
+	      (or startpos
+		  (if line
+		      (setq startpos (progn (goto-line line)
+					    (point)))))
+	      (or startpos
+		  (setq startpos (point-min)))
+	      ;; First see if the tag is right at the specified location.
+	      (goto-char startpos)
+	      (setq found (looking-at pat))
+	      (while (and (not found)
+			  (progn
+			    (goto-char (- startpos offset))
+			    (not (bobp))))
+		(setq found
+		      (re-search-forward pat (+ startpos offset) t)
+		      offset (* 5 offset))) ; expand search window
+	      ;; Finally, try finding it anywhere in the buffer.
+	      (or found
+		  (re-search-forward pat nil t)
+		  (error "Rerun etags: `%s' not found in %s"
+			 pat file))))
+	  ;; Position point at the right place
+	  ;; if the search string matched an extra Ctrl-m at the beginning.
+	  (and (eq selective-display t)
+	       (looking-at "\^m")
+	       (forward-char 1))
+	  (beginning-of-line)
+	  (setq startpos (point))))
       (cons buf startpos))))
 
 ;;;###autoload
--- a/lisp/gtk-init.el	Sat Apr 28 02:10:57 2001 +0000
+++ b/lisp/gtk-init.el	Sat Apr 28 07:48:46 2001 +0000
@@ -126,11 +126,6 @@
 
 (defun init-post-gtk-win ()
   (unless gtk-post-win-initted
-    (if (and (not (featurep 'infodock)) (featurep 'toolbar))
-        (init-x-toolbar))
-    (if (and (featurep 'infodock) (featurep 'toolbar))
-	(require 'id-x-toolbar))
-
     (when (featurep 'mule)
       (define-specifier-tag 'mule-fonts
 	(lambda (device) (eq 'gtk (device-type device))))
@@ -187,20 +182,6 @@
 	 )
        'global '(mule-fonts) 'append))
     
-    (add-hook 'zmacs-deactivate-region-hook
-	      (lambda ()
-		(if (console-on-window-system-p)
-		    (disown-selection))))
-    (add-hook 'zmacs-activate-region-hook
-	      (lambda ()
-		(if (console-on-window-system-p)
-		    (activate-region-as-selection))))
-    (add-hook 'zmacs-update-region-hook
-	      (lambda ()
-		(if (console-on-window-system-p)
-		    (activate-region-as-selection))))
-
-    (define-key global-map 'menu 'popup-mode-menu)
     (setq gtk-post-win-initted t)))
     
 (push '("-geometry" . gtk-init-handle-geometry) command-switch-alist)
--- a/lisp/gutter.el	Sat Apr 28 02:10:57 2001 +0000
+++ b/lisp/gutter.el	Sat Apr 28 07:48:46 2001 +0000
@@ -178,11 +178,6 @@
 corresponding symbol occurs in the gutter-visible instantiator."
   (make-specifier-and-init 'gutter-visible spec-list))
 
-(defun init-gutter ()
-  "Initialize the gutter."
-  ;; do nothing as yet.
-  )
-
 ;;; gutter.el ends here.
 
 
--- a/lisp/keydefs.el	Sat Apr 28 02:10:57 2001 +0000
+++ b/lisp/keydefs.el	Sat Apr 28 07:48:46 2001 +0000
@@ -265,7 +265,7 @@
 ;;; Done.  -hniksic
 ;(put 'set-goal-column 'disabled t)
 
-(define-key global-map [menu] 'execute-extended-command)
+(define-key global-map 'menu 'popup-mode-menu)
 (define-key global-map [find] 'search-forward)
 
 (define-key global-map "\C-t" 'transpose-chars)
--- a/lisp/mouse.el	Sat Apr 28 02:10:57 2001 +0000
+++ b/lisp/mouse.el	Sat Apr 28 07:48:46 2001 +0000
@@ -1039,30 +1039,34 @@
 	     ;;
 	     (and (eq (console-type) 'x)
 		  (sit-for 0.15 t))
+	     ;; zmacs-activate-region -> zmacs-activate-region-hook ->
+	     ;; activate-region-as-selection -> either own-selection or
+	     ;; mouse-track-activate-rectangular-selection
 	     (zmacs-activate-region)))
 	  ((console-on-window-system-p)
+	   ;; #### do we need this?  we don't do it when zmacs-regions = t
 	   (if (= start end)
 	       (disown-selection type)
-	     (if (consp default-mouse-track-extent)
-		 ;; own the rectangular region
-		 ;; this is a hack
-		 (let ((r default-mouse-track-extent))
-		   (save-excursion
-		     (set-buffer (get-buffer-create " *rect yank temp buf*"))
-		     (while r
-		       (insert (extent-string (car r)) "\n")
-		       (setq r (cdr r)))
-		     (own-selection (buffer-substring (point-min) (point-max)))
-		     (kill-buffer (current-buffer))))
-	       (own-selection (cons (set-marker (make-marker) start)
-				    (set-marker (make-marker) end))
-			      type)))))
+	     (activate-region-as-selection))))
     (if (and (eq 'x (console-type))
 	     (not (= start end)))
 	;; I guess cutbuffers should do something with rectangles too.
 	;; does anybody use them?
 	(x-store-cutbuffer (buffer-substring start end)))))
 
+(defun mouse-track-activate-rectangular-selection ()
+  (if (consp default-mouse-track-extent)
+      ;; own the rectangular region
+      ;; this is a hack
+      (let ((r default-mouse-track-extent))
+	(save-excursion
+	  (set-buffer (get-buffer-create " *rect yank temp buf*"))
+	  (erase-buffer)
+	  (while r
+	    (insert (extent-string (car r)) "\n")
+	    (setq r (cdr r)))
+	  (own-selection (buffer-substring (point-min) (point-max)))))))
+
 (defun default-mouse-track-deal-with-down-event (click-count)
   (let ((event default-mouse-track-down-event))
     (if (null event) nil
--- a/lisp/msw-init.el	Sat Apr 28 02:10:57 2001 +0000
+++ b/lisp/msw-init.el	Sat Apr 28 07:48:46 2001 +0000
@@ -43,23 +43,6 @@
 (defun init-post-mswindows-win (console)
   "Initialize mswindows GUI at startup (post).  Don't call this."
   (unless mswindows-post-win-initted
-    (if (featurep 'toolbar)
-	(if (featurep 'infodock)
-	    (require 'id-x-toolbar)
-	  (init-x-toolbar)))
-    (if (featurep 'gutter) (init-gutter))
-    (add-hook 'zmacs-deactivate-region-hook
-	      (lambda ()
-		(if (console-on-window-system-p)
-		    (disown-selection))))
-    (add-hook 'zmacs-activate-region-hook
-	      (lambda ()
-		(if (console-on-window-system-p)
-		    (activate-region-as-selection))))
-    (add-hook 'zmacs-update-region-hook
-	      (lambda ()
-		(if (console-on-window-system-p)
-		    (activate-region-as-selection))))
     ;; Old-style mswindows bindings. The new-style mswindows bindings
     ;; (namely Ctrl-X, Ctrl-C and Ctrl-V) are already spoken for by XEmacs.
     (global-set-key '(shift delete)   'kill-primary-selection)
@@ -69,8 +52,5 @@
 
     (global-set-key '(meta f4)	      'save-buffers-kill-emacs)
 
-    ;; Random stuff
-    (global-set-key 'menu	'popup-mode-menu)
-
     (setq mswindows-post-win-initted t)))
 
--- a/lisp/select.el	Sat Apr 28 02:10:57 2001 +0000
+++ b/lisp/select.el	Sat Apr 28 07:48:46 2001 +0000
@@ -196,8 +196,9 @@
   (own-selection string 'CLIPBOARD))
 
 (defun disown-selection (&optional secondary-p)
-  "Assuming we own the selection, disown it.  With an argument, discard the
-secondary selection instead of the primary selection."
+  "Assuming we own the selection, disown it.
+With an argument, discard the secondary selection instead of the
+primary selection."
   (disown-selection-internal (if secondary-p 'SECONDARY 'PRIMARY))
   (when (and selection-sets-clipboard
 	     (or (not secondary-p)
@@ -205,7 +206,6 @@
 		 (eq secondary-p 'CLIPBOARD)))
     (disown-selection-internal 'CLIPBOARD)))
 
-;; from x-init.el
 ;; selections and active regions
 
 ;; If and only if zmacs-regions is true:
@@ -220,10 +220,10 @@
 ;; application asserts the selection.  This is probably not a big deal.
 
 (defun activate-region-as-selection ()
-  (if (marker-buffer (mark-marker t))
-      (own-selection (cons (point-marker t) (mark-marker t)))))
+  (cond (mouse-track-rectangle-p (mouse-track-activate-rectangular-selection))
+	((marker-buffer (mark-marker t))
+	 (own-selection (cons (point-marker t) (mark-marker t))))))
 
-; moved from x-select.el
 (defvar primary-selection-extent nil
   "The extent of the primary selection; don't use this.")
 
@@ -294,7 +294,6 @@
 	  ))
 	previous-extent))))
 
-;; moved from x-select.el
 (defun valid-simple-selection-p (data)
   "An obsolete function that tests whether something was a valid simple
 selection using the old XEmacs selection support. You shouldn't use this
--- a/lisp/simple.el	Sat Apr 28 02:10:57 2001 +0000
+++ b/lisp/simple.el	Sat Apr 28 07:48:46 2001 +0000
@@ -2088,9 +2088,7 @@
 	     (setq zmacs-region-stays t))
 	    ((and (getf last-command-properties 'shifted-motion-command)
 		  unshifted-motion-keys-deselect-region)
-	     (setq zmacs-region-stays nil))
-	    (t
-	     (setq zmacs-region-stays t)))))
+	     (setq zmacs-region-stays nil)))))
 
 (defun forward-char-command (&optional arg buffer)
   "Move point right ARG characters (left if ARG negative) in BUFFER.
@@ -3893,6 +3891,10 @@
 This is called after each command that sets `zmacs-region-stays' to t.
 See the variable `zmacs-regions'.")
 
+(add-hook 'zmacs-deactivate-region-hook 'disown-selection)
+(add-hook 'zmacs-activate-region-hook 'activate-region-as-selection)
+(add-hook 'zmacs-update-region-hook 'activate-region-as-selection)
+
 (defvar zmacs-region-extent nil
   "The extent of the zmacs region; don't use this.")
 
--- a/lisp/startup.el	Sat Apr 28 02:10:57 2001 +0000
+++ b/lisp/startup.el	Sat Apr 28 07:48:46 2001 +0000
@@ -595,6 +595,11 @@
       (when (featurep 'toolbar)
 	(init-toolbar-location))
 
+      (if (featurep 'toolbar)
+	  (if (featurep 'infodock)
+	      (require 'id-x-toolbar)
+	    (init-toolbar)))
+
       ;; Run the window system's init function.  tty is considered to be
       ;; a type of window system for this purpose.  This creates the
       ;; initial (non stdio) device.
--- a/lisp/toolbar-items.el	Sat Apr 28 02:10:57 2001 +0000
+++ b/lisp/toolbar-items.el	Sat Apr 28 07:48:46 2001 +0000
@@ -425,7 +425,7 @@
 
 ;;; each entry maps a variable to the prefix used.
 
-(defvar init-x-toolbar-list
+(defvar init-toolbar-list
   '((toolbar-last-win-icon . "last-win")
     (toolbar-next-win-icon . "next-win")
     (toolbar-file-icon     . "file")
@@ -444,18 +444,18 @@
     (toolbar-debug-icon    . "debug")
     (toolbar-news-icon     . "news")))
 
-(defun init-x-toolbar ()
-  (toolbar-add-item-data init-x-toolbar-list )
+(defun init-toolbar ()
+  (toolbar-add-item-data init-toolbar-list)
   ;; do this now because errors will occur if the icon symbols
   ;; are not initted
   (set-specifier default-toolbar initial-toolbar-spec))
   
-(defun toolbar-add-item-data ( icon-list &optional icon-dir )
+(defun toolbar-add-item-data (icon-list &optional icon-dir)
   (if (eq icon-dir nil)
       (setq icon-dir toolbar-icon-directory))
   (mapcar
    (lambda (cons)
-     (let ((prefix (expand-file-name (cdr cons)  icon-dir)))
+     (let ((prefix (expand-file-name (cdr cons) icon-dir)))
        ;; #### This should use a better mechanism for finding the
        ;; glyphs, allowing for formats other than x[pb]m.  Look at
        ;; `widget-glyph-find' for an example how it might be done.
@@ -568,30 +568,4 @@
     )
   "The initial toolbar for a buffer.")
 
-(defun x-init-toolbar-from-resources (locale)
-  (x-init-specifier-from-resources
-   top-toolbar-height 'natnum locale
-   '("topToolBarHeight" . "TopToolBarHeight"))
-  (x-init-specifier-from-resources
-   bottom-toolbar-height 'natnum locale
-   '("bottomToolBarHeight" . "BottomToolBarHeight"))
-  (x-init-specifier-from-resources
-   left-toolbar-width 'natnum locale
-   '("leftToolBarWidth" . "LeftToolBarWidth"))
-  (x-init-specifier-from-resources
-   right-toolbar-width 'natnum locale
-   '("rightToolBarWidth" . "RightToolBarWidth"))
-  (x-init-specifier-from-resources
-   top-toolbar-border-width 'natnum locale
-   '("topToolBarBorderWidth" . "TopToolBarBorderWidth"))
-  (x-init-specifier-from-resources
-   bottom-toolbar-border-width 'natnum locale
-   '("bottomToolBarBorderWidth" . "BottomToolBarBorderWidth"))
-  (x-init-specifier-from-resources
-   left-toolbar-border-width 'natnum locale
-   '("leftToolBarBorderWidth" . "LeftToolBarBorderWidth"))
-  (x-init-specifier-from-resources
-   right-toolbar-border-width 'natnum locale
-   '("rightToolBarBorderWidth" . "RightToolBarBorderWidth")))
-
 ;;; toolbar-items.el ends here
--- a/lisp/toolbar.el	Sat Apr 28 02:10:57 2001 +0000
+++ b/lisp/toolbar.el	Sat Apr 28 07:48:46 2001 +0000
@@ -101,6 +101,7 @@
 	    (setq toolbar-icon-directory
 		  (file-name-as-directory name))))))
 
+;; called from toolbar.c during device and frame initialization
 (defun init-toolbar-from-resources (locale)
   (if (and (featurep 'x)
 	   (not (featurep 'infodock))
--- a/lisp/x-init.el	Sat Apr 28 02:10:57 2001 +0000
+++ b/lisp/x-init.el	Sat Apr 28 07:48:46 2001 +0000
@@ -40,23 +40,6 @@
   "The X Window system."
   :group 'environment)
 
-;; selections and active regions
-
-;; If and only if zmacs-regions is true:
-
-;; When a mark is pushed and the region goes into the "active" state, we
-;; assert it as the Primary selection.  This causes it to be hilighted.
-;; When the region goes into the "inactive" state, we disown the Primary
-;; selection, causing the region to be dehilighted.
-
-;; Note that it is possible for the region to be in the "active" state
-;; and not be hilighted, if it is in the active state and then some other
-;; application asserts the selection.  This is probably not a big deal.
-
-(defun x-activate-region-as-selection ()
-  (if (marker-buffer (mark-marker t))
-      (own-selection (cons (point-marker t) (mark-marker t)))))
-
 ;; OpenWindows-like "find" processing.  These functions are really Sunisms,
 ;; but we put them here instead of in x-win-sun.el in case someone wants
 ;; to use them when not running on a Sun console (presumably after binding
@@ -298,28 +281,7 @@
 (defun init-post-x-win ()
   "Initialize X Windows at startup (post).  Don't call this."
   (when (not post-x-win-initted)
-    ;; We can't load this until after the initial X device is created
-    ;; because the icon initialization needs to access the display to get
-    ;; any toolbar-related color resources.
-    (if (and (not (featurep 'infodock)) (featurep 'toolbar))
-        (init-x-toolbar))
-    (if (and (featurep 'infodock) (featurep 'toolbar))
-	(require 'id-x-toolbar))
-    (if (featurep 'gutter) (init-gutter))
     (if (featurep 'mule) (init-mule-x-win))
-    ;; these are only ever called if zmacs-regions is true.
-    (add-hook 'zmacs-deactivate-region-hook
-	      (lambda ()
-		(when (console-on-window-system-p)
-		  (disown-selection))))
-    (add-hook 'zmacs-activate-region-hook
-	      (lambda ()
-		(when (console-on-window-system-p)
-		  (x-activate-region-as-selection))))
-    (add-hook 'zmacs-update-region-hook
-	      (lambda ()
-		(when (console-on-window-system-p)
-		  (x-activate-region-as-selection))))
     ;; Motif-ish bindings
     ;; The following two were generally unliked.
     ;;(define-key global-map '(shift delete)   'kill-primary-selection)
@@ -331,7 +293,6 @@
     (define-key global-map 'paste	'yank-clipboard-selection)
     (define-key global-map 'cut		'kill-primary-selection)
 
-    (define-key global-map 'menu	'popup-mode-menu)
     ;;(define-key global-map '(shift menu) 'x-goto-menubar) ;NYI
 
     (setq post-x-win-initted t)))
--- a/lwlib/ChangeLog	Sat Apr 28 02:10:57 2001 +0000
+++ b/lwlib/ChangeLog	Sat Apr 28 07:48:46 2001 +0000
@@ -1,3 +1,8 @@
+2001-04-28  Ben Wing  <ben@xemacs.org>
+
+	* lwlib-utils.c (destroy_all_children): fix warning reported by
+	Isaac Hollander <ysh@mindspring.com>.
+
 2001-04-18  Martin Buchholz  <martin@xemacs.org>
 
 	* XEmacs 21.5.0 "alfalfa" is released.
--- a/lwlib/lwlib-utils.c	Sat Apr 28 02:10:57 2001 +0000
+++ b/lwlib/lwlib-utils.c	Sat Apr 28 07:48:46 2001 +0000
@@ -43,7 +43,7 @@
     {
       /* Unmanage all children and destroy them.  They will only be
        * really destroyed when we get out of DispatchEvent. */
-      for (i = 0; i < number; i++)
+      for (i = 0; i < (int) number; i++)
 	{
 	  Widget child = children [i];
 	  if (!child->core.being_destroyed)
--- a/src/ChangeLog	Sat Apr 28 02:10:57 2001 +0000
+++ b/src/ChangeLog	Sat Apr 28 07:48:46 2001 +0000
@@ -1,3 +1,27 @@
+2001-04-28  Ben Wing  <ben@xemacs.org>
+
+	* buffer.c (Ferase_buffer):
+	* editfns.c (buffer_insert1):
+	* editfns.c (Finsert_before_markers):
+	* editfns.c (Finsert_string):
+	* editfns.c (Finsert_char):
+	* editfns.c (Fdelete_region):
+	* editfns.c (Fwiden):
+	* editfns.c (Fnarrow_to_region):
+	remove bogus lines setting zmacs_region_stays to 0.
+	
+	* scrollbar-msw.c (mswindows_handle_mousewheel_event):
+	remove debug lines.
+
+2001-03-08  Mike Alexander  <mta@arbortext.com>
+
+	* event-msw.c (mswindows_need_event_in_modal_loop):
+	Don't dispatch a message if we didn't get one.
+	(mswindows_need_event):
+	Terminate the correct process when one exits instead of the first
+	one on Vprocess_list and look for process termination when in
+	mswindows_protect_modal_loop.
+
 2001-04-20  Ben Wing  <ben@xemacs.org>
 
 	* .cvsignore: Added stuff for Windows.
--- a/src/buffer.c	Sat Apr 28 02:10:57 2001 +0000
+++ b/src/buffer.c	Sat Apr 28 07:48:46 2001 +0000
@@ -1624,7 +1624,6 @@
      implies that the future text is not really related to the past text.  */
   b->saved_size = Qzero;
 
-  zmacs_region_stays = 0;
   return Qnil;
 }
 
--- a/src/editfns.c	Sat Apr 28 02:10:57 2001 +0000
+++ b/src/editfns.c	Sat Apr 28 07:48:46 2001 +0000
@@ -1490,7 +1490,6 @@
       arg = wrong_type_argument (Qchar_or_string_p, arg);
       goto retry;
     }
-  zmacs_region_stays = 0;
   UNGCPRO;
 }
 
@@ -1551,7 +1550,6 @@
 	  goto retry;
 	}
     }
-  zmacs_region_stays = 0;
   return Qnil;
 }
 
@@ -1567,7 +1565,6 @@
   struct buffer *b = decode_buffer (buffer, 1);
   CHECK_STRING (string);
   buffer_insert_lisp_string (b, string);
-  zmacs_region_stays = 0;
   return Qnil;
 }
 
@@ -1638,7 +1635,6 @@
     buffer_insert_raw_string (b, string, n);
 #endif
 
-  zmacs_region_stays = 0;
   return Qnil;
 }
 
@@ -2004,7 +2000,6 @@
 
   get_buffer_range_char (buf, start, end, &bp_start, &bp_end, 0);
   buffer_delete_range (buf, bp_start, bp_end, 0);
-  zmacs_region_stays = 0;
   return Qnil;
 }
 
@@ -2041,7 +2036,6 @@
 {
   struct buffer *b = decode_buffer (buffer, 1);
   widen_buffer (b, 0);
-  zmacs_region_stays = 0;
   return Qnil;
 }
 
@@ -2077,7 +2071,6 @@
   /* Changing the buffer bounds invalidates any recorded current column.  */
   invalidate_current_column ();
   narrow_line_number_cache (buf);
-  zmacs_region_stays = 0;
   return Qnil;
 }
 
--- a/src/event-msw.c	Sat Apr 28 02:10:57 2001 +0000
+++ b/src/event-msw.c	Sat Apr 28 07:48:46 2001 +0000
@@ -1340,6 +1340,10 @@
  * fetching WM_TIMER messages. Instead of trying to fetch a WM_TIMER
  * which will never come when there are no pending timers, which leads
  * to deadlock, we simply signal an error.
+ *
+ * It might be possible to combine this with mswindows_drain_windows_queue
+ * which fetches events when not in a modal loop.  It's not clear
+ * whether the result would be more complex than is justified.
  */
 static void
 mswindows_need_event_in_modal_loop (int badly_p)
@@ -1363,8 +1367,8 @@
 	error ("Deadlock due to an attempt to call next-event in a wrong context");
 
       /* Fetch and dispatch any pending timers */
-      GetMessage (&msg, NULL, WM_TIMER, WM_TIMER);
-      DispatchMessage (&msg);
+      if (GetMessage (&msg, NULL, WM_TIMER, WM_TIMER) > 0)
+       DispatchMessage (&msg);
     }
 }
 
@@ -1380,12 +1384,6 @@
 {
   int active;
 
-  if (mswindows_in_modal_loop)
-    {
-      mswindows_need_event_in_modal_loop (badly_p);
-      return;
-    }
-
   while (NILP (mswindows_u_dispatch_event_queue)
 	 && NILP (mswindows_s_dispatch_event_queue))
     {
@@ -1402,6 +1400,10 @@
 	  EMACS_SET_SECS_USECS (sometime, 0, 0);
 	  EMACS_TIME_TO_SELECT_TIME (sometime, select_time_to_block);
 	  pointer_to_this = &select_time_to_block;
+         if (mswindows_in_modal_loop)
+           /* In modal loop with badly_p false, don't care about
+              Windows events. */
+           FD_CLR (windows_fd, &temp_mask);
 	}
 
       active = select (MAXDESC, &temp_mask, 0, 0, pointer_to_this);
@@ -1415,7 +1417,10 @@
 	{
 	  if (FD_ISSET (windows_fd, &temp_mask))
 	    {
-	      mswindows_drain_windows_queue ();
+             if (mswindows_in_modal_loop)
+               mswindows_need_event_in_modal_loop (badly_p);
+             else
+               mswindows_drain_windows_queue ();
 	    }
 	  else
 	    {
@@ -1480,10 +1485,24 @@
 	}
 #else
       /* Now try getting a message or process event */
+      DWORD what_events;
+      if (mswindows_in_modal_loop)
+       /* In a modal loop, only look for timer events, and only if
+          we really need one. */
+       {
+         if (badly_p)
+           what_events = QS_TIMER;
+         else
+           what_events = 0;
+       }
+      else
+       /* Look for any event */
+       what_events = QS_ALLINPUT;
+
       active = MsgWaitForMultipleObjects (mswindows_waitable_count,
 					  mswindows_waitable_handles,
 					  FALSE, badly_p ? INFINITE : 0,
-					  QS_ALLINPUT);
+                                         what_events);
 
       /* This will assert if handle being waited for becomes abandoned.
 	 Not the case currently tho */
@@ -1499,7 +1518,10 @@
       else if (active == WAIT_OBJECT_0 + mswindows_waitable_count)
 	{
 	  /* Got your message, thanks */
-	  mswindows_drain_windows_queue ();
+         if (mswindows_in_modal_loop)
+           mswindows_need_event_in_modal_loop (badly_p);
+         else
+           mswindows_drain_windows_queue ();
 	}
       else
 	{
@@ -1516,7 +1538,12 @@
 	    {
 	      /* None. This means that the process handle itself has signaled.
 		 Remove the handle from the wait vector, and make status_notify
-		 note the exited process */
+                note the exited process.  First find the process object if
+                possible. */
+             LIST_LOOP_3 (vaffanculo, Vprocess_list, vproctail)
+               if (get_nt_process_handle (XPROCESS (vaffanculo)) ==
+                   mswindows_waitable_handles [ix])
+                 break;
 	      mswindows_waitable_handles [ix] =
 		mswindows_waitable_handles [--mswindows_waitable_count];
 	      kick_status_notify ();
@@ -1525,10 +1552,12 @@
 		 process, and (2) status notifications will happen in
 		 accept-process-output, sleep-for, and sit-for. */
 	      /* #### horrible kludge till my real process fixes go in.
+                #### Replaced with a slightly less horrible kluge that
+                     at least finds the right process instead of axing the
+                     first one on the list.
 	       */
-	      if (!NILP (Vprocess_list))
+             if (!NILP (vproctail))
 		{
-		  Lisp_Object vaffanculo = XCAR (Vprocess_list);
 		  mswindows_enqueue_process_event (XPROCESS (vaffanculo));
 		}
 	      else /* trash me soon. */
--- a/src/scrollbar-msw.c	Sat Apr 28 02:10:57 2001 +0000
+++ b/src/scrollbar-msw.c	Sat Apr 28 07:48:46 2001 +0000
@@ -296,7 +296,6 @@
     Lisp_Object corpore, sano;
     struct window *needle_in_haystack;
 
-    // stderr_out ("donde_esta: %d %d\n", donde_esta.x, donde_esta.y);
     pixel_to_glyph_translation (XFRAME (frame), donde_esta.x, donde_esta.y,
 				&mene, &_mene, &tekel, &upharsin,
 				&needle_in_haystack,
@@ -305,8 +304,6 @@
     if (needle_in_haystack)
       {
 	XSETWINDOW (win, needle_in_haystack);
-	// stderr_out ("found needle\n");
-	// debug_print (win);
       }
     else
       {