changeset 109468:af1c1a57ee7f

Merge from mainline.
author Katsumi Yamaoka <katsumi@flagship2>
date Sun, 18 Jul 2010 22:30:24 +0000
parents d92d0e17a7ce (current diff) d898f8a84d48 (diff)
children f2f8baec8e43
files
diffstat 15 files changed, 464 insertions(+), 126 deletions(-) [+]
line wrap: on
line diff
--- a/etc/NEWS	Sat Jul 17 10:55:12 2010 +0000
+++ b/etc/NEWS	Sun Jul 18 22:30:24 2010 +0000
@@ -42,7 +42,7 @@
 This is only useful if your crt*.o files are in a non-standard location.
 
 ---
-** Emacs can be compiled against Gtk+ 3.0 if you pass --with-x-toolkit=gtk3 
+** Emacs can be compiled against Gtk+ 3.0 if you pass --with-x-toolkit=gtk3
 to configure.  Note that other libraries used by Emacs, RSVG and GConf,
 also depend on Gtk+.  You can disable them with --without-rsvg and
 --without-gconf.
@@ -256,9 +256,9 @@
 
 ** SQL Mode enhancements.
 
-*** Several variables have been marked as safe local variables.
-The variables `sql-product', `sql-user', `sql-server', and
-`sql-database' can now be safely used as local variables.
+*** Several variables have been marked as safe local variables.  The
+variables `sql-product', `sql-user', `sql-server', `sql-database' and
+`sql-port' can now be safely used as local variables.
 
 *** Added ability to login with a port on MySQL.
 The custom variable `sql-port' can be specified for connection to
@@ -269,15 +269,42 @@
 which is a list of the parameters to be prompted for before a
 connection is established.
 
+*** Added `sql-connection-alist' to record login parameter values.
+An alist for recording different username, database and server
+values.  If there are multiple databases that you connect to the
+parameters needed can be stored in this alist.
+
+For example, the following might be set in the user's init.el:
+
+  (setq sql-connection-alist
+        '((dev (sql-product 'sqlite)
+               (sql-database "/home/mmaug/dev.db"))
+          (prd (sql-product 'oracle)
+               (sql-user "mmaug")
+               (sql-database "iprd2a"))))
+
+This defines two connections named "dev" and "prd".
+
+*** Added `sql-connect' to use predefined connections.
+Sets the login parameters based on the values in the
+`sql-connection-alist' and start a SQL interactive session.  Any
+values specified in the connection will not be prompted for.
+
+In the example above, if the user were to invoke M-x sql-connect, they
+would be prompted for the connection.  The user can respond with
+either "dev" or "prd".  The "dev" connection would connect to the
+SQLite database without prompting; the "prd" connection would prompt
+for the users password and then connect to the Oracle database.
+
 *** Added option `sql-send-terminator'.
 When set makes sure that each command sent with `sql-send-*' commands
 are properly terminated and submitted to the SQL processor.
 
 *** Added option `sql-oracle-scan-on'.
 When set commands sent to Oracle's SQL*Plus are scanned for strings
-starting with an ampersand and the user is asked for replacement
-text.  In general, the SQL*Plus option SCAN should be set OFF under
-SQL interactive mode.
+starting with an ampersand and the user is asked for replacement text.
+In general, the SQL*Plus option SCAN should always be set OFF under
+SQL interactive mode and this option used in its place.
 
 *** SQL interactive mode will replace tabs with spaces.
 This prevents the comand interpretter for MySQL and Postgres from
--- a/lisp/ChangeLog	Sat Jul 17 10:55:12 2010 +0000
+++ b/lisp/ChangeLog	Sun Jul 18 22:30:24 2010 +0000
@@ -1,3 +1,56 @@
+2010-07-18  Alan Mackenzie  <acm@muc.de>
+
+	Enhance `c-file-style' in file/directory local variables.
+	* cc-mode.el (c-count-cfss): New function.
+	(c-before-hack-hook): Call `c-set-style' differently according to
+	whether c-file-style was set in file or directory local
+	variables.
+
+2010-07-18  Michael R. Mauger  <mmaug@yahoo.com>
+
+	* progmodes/sql.el: Version 2.2.
+	(sql-product, sql-user, sql-database, sql-server, sql-port): Use
+	defcustom :safe keyword rather than putting safe-local-variable
+	property.
+	(sql-password): Use defcustom :risky keyword rather than putting
+	risky-local-variable property.
+	(sql-oracle-login-params, sql-sqlite-login-params)
+	(sql-solid-login-params, sql-sybase-login-params)
+	(sql-informix-login-params, sql-ingres-login-params)
+	(sql-ms-login-params, sql-postgres-login-params)
+	(sql-interbase-login-params, sql-db2-login-params)
+	(sql-linter-login-params): Add `port' option
+	(sql-get-product-feature): Added NO-INDIRECT parameter.
+	(sql-comint-oracle, sql-comint-sybase)
+	(sql-comint-informix, sql-comint-sqlite, sql-comint-mysql)
+	(sql-comint-solid, sql-comint-ingres, sql-comint-ms)
+	(sql-comint-postgres, sql-comint-interbase, sql-comint-db2)
+	(sql-comint-linter): Renamed sql-connect-* functions to
+	sql-comint-*.
+	(sql-product-alist, sql-mode-menu): Renamed as above and
+	:sqli-connect-func to :sqli-comint-func.
+	(sql-connection): New variable
+	(sql-interactive-mode): Set it.
+	(sql-connection-alist): New variable.
+	(sql-connect): New function.
+	(sql--alt-buffer-part, sql--alt-if-not-empty)
+	(sql-make-alternate-buffer-name): Improved alternative buffer
+	name.
+
+2010-07-17  Thierry Volpiatto  <thierry.volpiatto@gmail.com>
+
+	* image-mode.el (image-bookmark-make-record): Do not set context
+	in an image (Bug#6650).
+
+2010-07-17  Chong Yidong  <cyd@stupidchicken.com>
+
+	* simple.el (select-active-region): New function.
+	(push-mark-command, set-mark, activate-mark)
+	(handle-shift-selection): Use it.
+	(deactivate-mark): Don't check for size of region.
+
+	* mouse.el (mouse-drag-track): Use select-active-region.
+
 2010-07-17  Michael Albinus  <michael.albinus@gmx.de>
 
 	* net/tramp.el (tramp-get-ls-command-with-dired): Make test for
--- a/lisp/image-mode.el	Sat Jul 17 10:55:12 2010 +0000
+++ b/lisp/image-mode.el	Sun Jul 18 22:30:24 2010 +0000
@@ -522,9 +522,9 @@
 (declare-function bookmark-default-handler "bookmark" (bmk))
 
 (defun image-bookmark-make-record ()
-  (nconc (bookmark-make-record-default)
-         `((image-type . ,image-type)
-           (handler    . image-bookmark-jump))))
+  `(,@(bookmark-make-record-default nil 'no-context 0)
+      (image-type . ,image-type)
+      (handler    . image-bookmark-jump)))
 
 ;;;###autoload
 (defun image-bookmark-jump (bmk)
--- a/lisp/mouse.el	Sat Jul 17 10:55:12 2010 +0000
+++ b/lisp/mouse.el	Sun Jul 18 22:30:24 2010 +0000
@@ -1027,9 +1027,7 @@
 	      ;; For `select-active-regions' non-nil, ensure that
 	      ;; further alterations of the region (e.g. via
 	      ;; shift-selection) continue to update PRIMARY.
-	      (and select-active-regions
-		   (display-selections-p)
-		   (x-set-selection 'PRIMARY (current-buffer))))
+	      (select-active-region))
 
 	  ;; If point hasn't moved, run the binding of the
 	  ;; terminating up-event.
--- a/lisp/progmodes/cc-mode.el	Sat Jul 17 10:55:12 2010 +0000
+++ b/lisp/progmodes/cc-mode.el	Sun Jul 18 22:30:24 2010 +0000
@@ -662,6 +662,17 @@
       (and (cdr rfn)
 	   (setq require-final-newline mode-require-final-newline)))))
 
+(defun c-count-cfss (lv-alist)
+  ;; LV-ALIST is an alist like `file-local-variables-alist'.  Count how many
+  ;; elements with the key `c-file-style' there are in it.
+  (let ((elt-ptr lv-alist) elt (cownt 0))
+    (while elt-ptr
+      (setq elt (car elt-ptr)
+	    elt-ptr (cdr elt-ptr))
+      (when (eq (car elt) 'c-file-style)
+	(setq cownt (1+ cownt))))
+    cownt))
+							  
 (defun c-before-hack-hook ()
   "Set the CC Mode style and \"offsets\" when in the buffer's local variables.
 They are set only when, respectively, the pseudo variables
@@ -678,7 +689,15 @@
 	      (delq mode-cons file-local-variables-alist)))
       (when stile
 	(or (stringp stile) (error "c-file-style is not a string"))
-	(c-set-style stile))
+	(if (boundp 'dir-local-variables-alist)
+	    ;; Determine whether `c-file-style' was set in the file's local
+	    ;; variables or in a .dir-locals.el (a directory setting).
+	    (let ((cfs-in-file-and-dir-count
+		   (c-count-cfss file-local-variables-alist))
+		  (cfs-in-dir-count (c-count-cfss dir-local-variables-alist)))
+	      (c-set-style stile
+			   (= cfs-in-file-and-dir-count cfs-in-dir-count)))
+	  (c-set-style stile)))
       (when offsets
 	(mapc
 	 (lambda (langentry)
--- a/lisp/progmodes/sql.el	Sat Jul 17 10:55:12 2010 +0000
+++ b/lisp/progmodes/sql.el	Sun Jul 18 22:30:24 2010 +0000
@@ -5,7 +5,7 @@
 
 ;; Author: Alex Schroeder <alex@gnu.org>
 ;; Maintainer: Michael Mauger <mmaug@yahoo.com>
-;; Version: 2.1
+;; Version: 2.2
 ;; Keywords: comm languages processes
 ;; URL: http://savannah.gnu.org/cgi-bin/viewcvs/emacs/emacs/lisp/progmodes/sql.el
 ;; URL: http://www.emacswiki.org/cgi-bin/wiki.pl?SqlMode
@@ -156,7 +156,8 @@
 ;;                        (const user)
 ;;                        (const password)
 ;;                        (const server)
-;;                        (const database)))
+;;                        (const database)
+;;                        (const port)))
 ;;       :group 'SQL)
 ;;
 ;;     (sql-set-product-feature 'xyz
@@ -170,7 +171,7 @@
 ;;     (sql-set-product-feature 'xyz
 ;;                              :sqli-options 'my-sql-xyz-options))
 
-;;     (defun my-sql-connect-xyz (product options)
+;;     (defun my-sql-comint-xyz (product options)
 ;;       "Connect ti XyzDB in a comint buffer."
 ;;
 ;;         ;; Do something with `sql-user', `sql-password',
@@ -184,10 +185,10 @@
 ;;               (setq params (append (list "-P" sql-password) params)))
 ;;           (if (not (string= "" sql-user))
 ;;               (setq params (append (list "-U" sql-user) params)))
-;;           (sql-connect product params)))
+;;           (sql-comint product params)))
 ;;
 ;;     (sql-set-product-feature 'xyz
-;;                              :sqli-connect-func 'my-sql-connect-xyz)
+;;                              :sqli-connect-func 'my-sql-comint-xyz)
 
 ;; 6) Define a convienence function to invoke the SQL interpreter.
 
@@ -235,6 +236,7 @@
 (eval-when-compile
   (require 'regexp-opt))
 (require 'custom)
+(require 'assoc)
 (eval-when-compile ;; needed in Emacs 19, 20
   (setq max-specpdl-size 2000))
 
@@ -255,8 +257,8 @@
 (defcustom sql-user ""
   "Default username."
   :type 'string
-  :group 'SQL)
-(put 'sql-user 'safe-local-variable 'stringp)
+  :group 'SQL
+  :safe 'stringp)
 
 (defcustom sql-password ""
   "Default password.
@@ -264,32 +266,36 @@
 Storing your password in a textfile such as ~/.emacs could be dangerous.
 Customizing your password will store it in your ~/.emacs file."
   :type 'string
-  :group 'SQL)
-(put 'sql-password 'risky-local-variable t)
+  :group 'SQL
+  :risky t)
 
 (defcustom sql-database ""
   "Default database."
   :type 'string
-  :group 'SQL)
-(put 'sql-database 'safe-local-variable 'stringp)
+  :group 'SQL
+  :safe 'stringp)
 
 (defcustom sql-server ""
   "Default server or host."
   :type 'string
-  :group 'SQL)
-(put 'sql-server 'safe-local-variable 'stringp)
+  :group 'SQL
+  :safe 'stringp)
 
 (defcustom sql-port nil
   "Default server or host."
+  :version "24.1"
   :type 'number
-  :group 'SQL)
-(put 'sql-port 'safe-local-variable 'numberp)
+  :group 'SQL
+  :safe 'numberp)
 
 ;; SQL Product support
 
 (defvar sql-interactive-product nil
   "Product under `sql-interactive-mode'.")
 
+(defvar sql-connection nil
+  "Connection name if interactive session started by `sql-connect'.")
+
 (defvar sql-product-alist
   '((ansi
      :name "ANSI"
@@ -301,7 +307,7 @@
      :sqli-program sql-db2-program
      :sqli-options sql-db2-options
      :sqli-login sql-db2-login-params
-     :sqli-connect-func sql-connect-db2
+     :sqli-comint-func sql-comint-db2
      :prompt-regexp "^db2 => "
      :prompt-length 7
      :input-filter sql-escape-newlines-filter)
@@ -312,7 +318,7 @@
      :sqli-program sql-informix-program
      :sqli-options sql-informix-options
      :sqli-login sql-informix-login-params
-     :sqli-connect-func sql-connect-informix
+     :sqli-comint-func sql-comint-informix
      :prompt-regexp "^> "
      :prompt-length 2
      :syntax-alist ((?{ . "<") (?} . ">")))
@@ -323,7 +329,7 @@
      :sqli-program sql-ingres-program
      :sqli-options sql-ingres-options
      :sqli-login sql-ingres-login-params
-     :sqli-connect-func sql-connect-ingres
+     :sqli-comint-func sql-comint-ingres
      :prompt-regexp "^\* "
      :prompt-length 2)
 
@@ -333,7 +339,7 @@
      :sqli-program sql-interbase-program
      :sqli-options sql-interbase-options
      :sqli-login sql-interbase-login-params
-     :sqli-connect-func sql-connect-interbase
+     :sqli-comint-func sql-comint-interbase
      :prompt-regexp "^SQL> "
      :prompt-length 5)
 
@@ -343,7 +349,7 @@
      :sqli-program sql-linter-program
      :sqli-options sql-linter-options
      :sqli-login sql-linter-login-params
-     :sqli-connect-func sql-connect-linter
+     :sqli-comint-func sql-comint-linter
      :prompt-regexp "^SQL>"
      :prompt-length 4)
 
@@ -353,7 +359,7 @@
      :sqli-program sql-ms-program
      :sqli-options sql-ms-options
      :sqli-login sql-ms-login-params
-     :sqli-connect-func sql-connect-ms
+     :sqli-comint-func sql-comint-ms
      :prompt-regexp "^[0-9]*>"
      :prompt-length 5
      :syntax-alist ((?@ . "w"))
@@ -366,7 +372,7 @@
      :sqli-program sql-mysql-program
      :sqli-options sql-mysql-options
      :sqli-login sql-mysql-login-params
-     :sqli-connect-func sql-connect-mysql
+     :sqli-comint-func sql-comint-mysql
      :prompt-regexp "^mysql> "
      :prompt-length 6
      :input-filter sql-remove-tabs-filter)
@@ -377,7 +383,7 @@
      :sqli-program sql-oracle-program
      :sqli-options sql-oracle-options
      :sqli-login sql-oracle-login-params
-     :sqli-connect-func sql-connect-oracle
+     :sqli-comint-func sql-comint-oracle
      :prompt-regexp "^SQL> "
      :prompt-length 5
      :syntax-alist ((?$ . "w") (?# . "w"))
@@ -391,7 +397,7 @@
      :sqli-program sql-postgres-program
      :sqli-options sql-postgres-options
      :sqli-login sql-postgres-login-params
-     :sqli-connect-func sql-connect-postgres
+     :sqli-comint-func sql-comint-postgres
      :prompt-regexp "^.*[#>] *"
      :prompt-length 5
      :input-filter sql-remove-tabs-filter
@@ -403,7 +409,7 @@
      :sqli-program sql-solid-program
      :sqli-options sql-solid-options
      :sqli-login sql-solid-login-params
-     :sqli-connect-func sql-connect-solid
+     :sqli-comint-func sql-comint-solid
      :prompt-regexp "^"
      :prompt-length 0)
 
@@ -414,7 +420,7 @@
      :sqli-program sql-sqlite-program
      :sqli-options sql-sqlite-options
      :sqli-login sql-sqlite-login-params
-     :sqli-connect-func sql-connect-sqlite
+     :sqli-comint-func sql-comint-sqlite
      :prompt-regexp "^sqlite> "
      :prompt-length 8)
 
@@ -424,7 +430,7 @@
      :sqli-program sql-sybase-program
      :sqli-options sql-sybase-options
      :sqli-login sql-sybase-login-params
-     :sqli-connect-func sql-connect-sybase
+     :sqli-comint-func sql-comint-sybase
      :prompt-regexp "^SQL> "
      :prompt-length 5
      :syntax-alist ((?@ . "w"))
@@ -463,7 +469,7 @@
                         database and server) needed to connect to
                         the database.
 
- :sqli-connect-func     name of a function which accepts no
+ :sqli-comint-func      name of a function which accepts no
                         parameters that will use the values of
                         `sql-user', `sql-password',
                         `sql-database' and `sql-server' to open a
@@ -508,6 +514,51 @@
   '(:font-lock :sqli-program :sqli-options :sqli-login))
 
 ;;;###autoload
+(defcustom sql-connection-alist nil
+  "An alist of connection parameters for interacting with a SQL
+  product.
+
+Each element of the alist is as follows:
+
+  \(CONNECTION \(SQL-VARIABLE VALUE) ...)
+
+Where CONNECTION is a symbol identifying the connection, SQL-VARIABLE
+is the symbol name of a SQL mode variable, and VALUE is the value to
+be assigned to the variable.
+
+The most common SQL-VARIABLE settings associated with a connection
+are:
+
+  `sql-product'
+  `sql-user'
+  `sql-password'
+  `sql-port'
+  `sql-server'
+  `sql-database'
+
+If a SQL-VARIABLE is part of the connection, it will not be
+prompted for during login."
+
+  :type `(alist :key-type (symbol :tag "Connection")
+                :value-type
+                (set
+                 (group (const :tag "Product"  sql-product)
+                        (choice
+                         ,@(mapcar (lambda (prod-info)
+                                     `(const :tag
+                                             ,(or (plist-get (cdr prod-info) :name)
+                                                  (capitalize (symbol-name (car prod-info))))
+                                             (quote ,(car prod-info))))
+                                   sql-product-alist)))
+                 (group (const :tag "Username" sql-user)     string)
+                 (group (const :tag "Password" sql-password) string)
+                 (group (const :tag "Server"   sql-server)   string)
+                 (group (const :tag "Database" sql-database) string)
+                 (group (const :tag "Port"     sql-port)     integer)))
+  :version "24.1"
+  :group 'SQL)
+
+;;;###autoload
 (defcustom sql-product 'ansi
   "Select the SQL database product used so that buffers can be
 highlighted properly when you open them."
@@ -518,11 +569,8 @@
                                    (capitalize (symbol-name (car prod-info))))
                               ,(car prod-info)))
                     sql-product-alist))
-  :group 'SQL)
-(put 'sql-product 'safe-local-variable 'symbolp)
-
-(defvar sql-interactive-product nil
-  "Product under `sql-interactive-mode'.")
+  :group 'SQL
+  :safe 'symbolp)
 
 ;; misc customization of sql.el behaviour
 
@@ -681,7 +729,8 @@
 		  (const user)
 		  (const password)
 		  (const server)
-		  (const database)))
+		  (const database)
+                  (const port)))
   :version "24.1"
   :group 'SQL)
 
@@ -721,7 +770,8 @@
 		  (const user)
 		  (const password)
 		  (const server)
-		  (const database)))
+		  (const database)
+                  (const port)))
   :version "24.1"
   :group 'SQL)
 
@@ -768,7 +818,8 @@
 		  (const user)
 		  (const password)
 		  (const server)
-		  (const database)))
+		  (const database)
+                  (const port)))
   :version "24.1"
   :group 'SQL)
 
@@ -794,7 +845,8 @@
 		  (const user)
 		  (const password)
 		  (const server)
-		  (const database)))
+		  (const database)
+                  (const port)))
   :version "24.1"
   :group 'SQL)
 
@@ -813,7 +865,8 @@
 		  (const user)
 		  (const password)
 		  (const server)
-		  (const database)))
+		  (const database)
+                  (const port)))
   :version "24.1"
   :group 'SQL)
 
@@ -832,7 +885,8 @@
 		  (const user)
 		  (const password)
 		  (const server)
-		  (const database)))
+		  (const database)
+                  (const port)))
   :version "24.1"
   :group 'SQL)
 
@@ -858,7 +912,8 @@
 		  (const user)
 		  (const password)
 		  (const server)
-		  (const database)))
+		  (const database)
+                  (const port)))
   :version "24.1"
   :group 'SQL)
 
@@ -889,7 +944,8 @@
 		  (const user)
 		  (const password)
 		  (const server)
-		  (const database)))
+		  (const database)
+                  (const port)))
   :version "24.1"
   :group 'SQL)
 
@@ -914,7 +970,8 @@
 		  (const user)
 		  (const password)
 		  (const server)
-		  (const database)))
+		  (const database)
+                  (const port)))
   :version "24.1"
   :group 'SQL)
 
@@ -939,7 +996,8 @@
 		  (const user)
 		  (const password)
 		  (const server)
-		  (const database)))
+		  (const database)
+                  (const port)))
   :version "24.1"
   :group 'SQL)
 
@@ -964,7 +1022,8 @@
 		  (const user)
 		  (const password)
 		  (const server)
-		  (const database)))
+		  (const database)
+                  (const port)))
   :version "24.1"
   :group 'SQL)
 
@@ -1057,7 +1116,7 @@
    ["Send String" sql-send-string (and (buffer-live-p sql-buffer)
 				       (get-buffer-process sql-buffer))]
    ["--" nil nil]
-   ["Start SQLi session" sql-product-interactive (sql-get-product-feature sql-product :sqli-connect-func)]
+   ["Start SQLi session" sql-product-interactive (sql-get-product-feature sql-product :sqli-comint-func)]
    ["Show SQLi buffer" sql-show-sqli-buffer t]
    ["Set SQLi buffer" sql-set-sqli-buffer t]
    ["Pop to SQLi buffer after send"
@@ -2016,13 +2075,17 @@
           (setcdr p (plist-put (cdr p) feature newvalue)))
       (message "`%s' is not a known product; use `sql-add-product' to add it first." product))))
 
-(defun sql-get-product-feature (product feature &optional fallback)
+(defun sql-get-product-feature (product feature &optional fallback not-indirect)
   "Lookup FEATURE associated with a SQL PRODUCT.
 
 If the FEATURE is nil for PRODUCT, and FALLBACK is specified,
 then the FEATURE associated with the FALLBACK product is
 returned.
 
+If the FEATURE is in the list `sql-indirect-features', and the
+NOT-INDIRECT parameter is not set, then the value of the symbol
+stored in the connect alist is returned.
+
 See `sql-product-alist' for a list of products and supported features."
   (let* ((p (assoc product sql-product-alist))
          (v (plist-get (cdr p) feature)))
@@ -2036,6 +2099,7 @@
 
           (if (and
                (member feature sql-indirect-features)
+               (not not-indirect)
                (symbolp v))
               (symbol-value v)
             v))
@@ -2329,6 +2393,7 @@
       (setq sql-database
 	    (read-from-minibuffer "Database: " sql-database nil nil
 				  'sql-database-history))))
+
     (setq what (cdr what))))
 
 (defun sql-find-sqli-buffer ()
@@ -2415,21 +2480,62 @@
 	(message "Buffer %s has no process." (buffer-name sql-buffer))
       (message "Current SQLi buffer is %s." (buffer-name sql-buffer)))))
 
+(defun sql--alt-buffer-part (delim part)
+  (unless (string= "" part)
+    (list delim part)))
+
+(defun sql--alt-if-not-empty (s)
+  (if (string= "" s) nil s))
+
 (defun sql-make-alternate-buffer-name ()
   "Return a string that can be used to rename a SQLi buffer.
 
 This is used to set `sql-alternate-buffer-name' within
-`sql-interactive-mode'."
-  (concat (if (string= "" sql-user)
-	      (if (string= "" (user-login-name))
-		  ()
-		(concat (user-login-name) "/"))
-	    (concat sql-user "/"))
-	  (if (string= "" sql-database)
-	      (if (string= "" sql-server)
-		  (system-name)
-		sql-server)
-	    sql-database)))
+`sql-interactive-mode'.
+
+If the session was started with `sql-connect' then the alternate
+name would be the name of the connection.
+
+Otherwise, it uses the parameters identified by the :sqlilogin
+parameter.
+
+If all else fails, the alternate name would be the user and
+server/database name."
+
+  (or
+   ;; If started by sql-connect, use that
+   (sql--alt-if-not-empty
+    (when sql-connection (symbol-name sql-connection)))
+
+   ;; based on :sqli-login setting
+   (sql--alt-if-not-empty
+    (apply 'concat
+           (cdr
+            (apply 'append nil
+                   (mapcar
+                    (lambda (v)
+                      (cond
+                       ((eq v 'user)     (sql--alt-buffer-part "/" sql-user))
+                       ((eq v 'server)   (sql--alt-buffer-part "@" sql-server))
+                       ((eq v 'database) (sql--alt-buffer-part "@" sql-database))
+                       ((eq v 'port)     (sql--alt-buffer-part ":" sql-port))
+
+                       ((eq v 'password) nil)
+                       (t                nil)))
+                    (sql-get-product-feature sql-product :sqli-login))))))
+
+   ;; Default: username/server format
+   (sql--alt-if-not-empty
+    (concat (if (string= "" sql-user)
+                (if (string= "" (user-login-name))
+                    ()
+                  (concat (user-login-name) "/"))
+              (concat sql-user "/"))
+            (if (string= "" sql-database)
+                (if (string= "" sql-server)
+                    (system-name)
+                  sql-server)
+              sql-database)))))
 
 (defun sql-rename-buffer ()
   "Rename a SQLi buffer."
@@ -2788,6 +2894,8 @@
   (setq abbrev-all-caps 1)
   ;; Exiting the process will call sql-stop.
   (set-process-sentinel (get-buffer-process sql-buffer) 'sql-stop)
+  ;; Save the connection name
+  (make-local-variable 'sql-connection)
   ;; Create a usefull name for renaming this buffer later.
   (make-local-variable 'sql-alternate-buffer-name)
   (setq sql-alternate-buffer-name (sql-make-alternate-buffer-name))
@@ -2854,7 +2962,7 @@
          ((symbolp product) product)    ; Product specified
          (t sql-product)))              ; Default to sql-product
 
-  (when (sql-get-product-feature product :sqli-connect-func)
+  (when (sql-get-product-feature product :sqli-comint-func)
     (if (and sql-buffer
              (buffer-live-p sql-buffer)
 	     (comint-check-proc sql-buffer))
@@ -2882,7 +2990,7 @@
 
 	;; Connect to database.
 	(message "Login...")
-	(funcall (sql-get-product-feature product :sqli-connect-func)
+	(funcall (sql-get-product-feature product :sqli-comint-func)
                  product
                  (sql-get-product-feature product :sqli-options))
 
@@ -2901,16 +3009,82 @@
 	(message "Login...done")
 	(pop-to-buffer sql-buffer)))))
 
-(defun sql-connect (product params)
-  "Set up a comint buffer to connect to the SQL processor.
+(defun sql-comint (product params)
+  "Set up a comint buffer to run the SQL processor.
 
 PRODUCT is the SQL product.  PARAMS is a list of strings which are
 passed as command line arguments."
   (let ((program (sql-get-product-feature product :sqli-program)))
     (set-buffer
-     (if params
-         (apply 'make-comint "SQL" program nil params)
-       (make-comint "SQL" program nil)))))
+     (apply 'make-comint "SQL" program nil params))))
+
+;;;###autoload
+(defun sql-connect (connection)
+  "Connect to an interactive session using CONNECTION settings.
+
+See `sql-connection-alist' to see how to define connections and
+their settings.
+
+The user will not be prompted for any login parameters if a value
+is specified in the connection settings."
+
+  ;; Prompt for the connection from those defined in the alist
+  (interactive
+   (if sql-connection-alist
+       (list
+        (intern
+         (completing-read "Connection: "
+                          (mapcar (lambda (c) (symbol-name (car c)))
+                                  sql-connection-alist)
+                          nil t)))
+     nil))
+
+  ;; Are there connections defined
+  (if sql-connection-alist
+      ;; Was one selected
+      (when connection
+        ;; Get connection settings
+        (let ((connect-set  (aget sql-connection-alist connection)))
+          ;; Settings are defined
+          (if connect-set
+              ;; Set the desired parameters
+              (eval `(let*
+                         (,@connect-set
+                          ;; :sqli-login params variable
+                          (param-var    (sql-get-product-feature sql-product
+                                                                 :sqli-login nil t))
+                          ;; :sqli-login params value
+                          (login-params (sql-get-product-feature sql-product
+                                                                 :sqli-login))
+                          ;; which params are in the connection
+                          (set-params   (mapcar
+                                         (lambda (v)
+                                           (cond
+                                            ((eq (car v) 'sql-user)     'user)
+                                            ((eq (car v) 'sql-password) 'password)
+                                            ((eq (car v) 'sql-server)   'server)
+                                            ((eq (car v) 'sql-database) 'database)
+                                            ((eq (car v) 'sql-port)     'port)
+                                            (t                          (car v))))
+                                         connect-set))
+                          ;; the remaining params (w/o the connection params)
+                          (rem-params   (apply 'append nil
+                                               (mapcar
+                                                (lambda (l)
+                                                  (unless (member l set-params)
+                                                    (list l)))
+                                                login-params)))
+                          ;; Remember the connection
+                          (sql-connection connection))
+
+                       ;; Set the remaining parameters and start the
+                       ;; interactive session
+                       (eval `(let ((,param-var ',rem-params))
+                                (sql-product-interactive sql-product)))))
+            (message "SQL Connection \"%s\" does not exist" connection)
+            nil)))
+    (message "No SQL Connections defined")
+    nil))
 
 ;;;###autoload
 (defun sql-oracle ()
@@ -2939,7 +3113,7 @@
   (interactive)
   (sql-product-interactive 'oracle))
 
-(defun sql-connect-oracle (product options)
+(defun sql-comint-oracle (product options)
   "Create comint buffer and connect to Oracle."
   ;; Produce user/password@database construct.  Password without user
   ;; is meaningless; database without user/password is meaningless,
@@ -2955,7 +3129,7 @@
     (if parameter
 	(setq parameter (nconc (list parameter) options))
       (setq parameter options))
-    (sql-connect product parameter)))
+    (sql-comint product parameter)))
 
 
 
@@ -2986,7 +3160,7 @@
   (interactive)
   (sql-product-interactive 'sybase))
 
-(defun sql-connect-sybase (product options)
+(defun sql-comint-sybase (product options)
   "Create comint buffer and connect to Sybase."
   ;; Put all parameters to the program (if defined) in a list and call
   ;; make-comint.
@@ -2999,7 +3173,7 @@
 	(setq params (append (list "-P" sql-password) params)))
     (if (not (string= "" sql-user))
 	(setq params (append (list "-U" sql-user) params)))
-    (sql-connect product params)))
+    (sql-comint product params)))
 
 
 
@@ -3028,7 +3202,7 @@
   (interactive)
   (sql-product-interactive 'informix))
 
-(defun sql-connect-informix (product options)
+(defun sql-comint-informix (product options)
   "Create comint buffer and connect to Informix."
   ;; username and password are ignored.
   (let ((db (if (string= "" sql-database)
@@ -3036,7 +3210,7 @@
 	      (if (string= "" sql-server)
 		  sql-database
 		(concat sql-database "@" sql-server)))))
-    (sql-connect product (append `(,db "-") options))))
+    (sql-comint product (append `(,db "-") options))))
 
 
 
@@ -3069,7 +3243,7 @@
   (interactive)
   (sql-product-interactive 'sqlite))
 
-(defun sql-connect-sqlite (product options)
+(defun sql-comint-sqlite (product options)
   "Create comint buffer and connect to SQLite."
   ;; Put all parameters to the program (if defined) in a list and call
   ;; make-comint.
@@ -3077,7 +3251,7 @@
     (if (not (string= "" sql-database))
 	(setq params (append (list sql-database) params)))
     (setq params (append options params))
-    (sql-connect product params)))
+    (sql-comint product params)))
 
 
 
@@ -3110,7 +3284,7 @@
   (interactive)
   (sql-product-interactive 'mysql))
 
-(defun sql-connect-mysql (product options)
+(defun sql-comint-mysql (product options)
   "Create comint buffer and connect to MySQL."
   ;; Put all parameters to the program (if defined) in a list and call
   ;; make-comint.
@@ -3126,7 +3300,7 @@
     (if (not (string= "" sql-user))
 	(setq params (append (list (concat "--user=" sql-user)) params)))
     (setq params (append options params))
-    (sql-connect product params)))
+    (sql-comint product params)))
 
 
 
@@ -3156,7 +3330,7 @@
   (interactive)
   (sql-product-interactive 'solid))
 
-(defun sql-connect-solid (product options)
+(defun sql-comint-solid (product options)
   "Create comint buffer and connect to Solid."
   ;; Put all parameters to the program (if defined) in a list and call
   ;; make-comint.
@@ -3167,7 +3341,7 @@
 	(setq params (append (list sql-user sql-password) params)))
     (if (not (string= "" sql-server))
 	(setq params (append (list sql-server) params)))
-    (sql-connect product params)))
+    (sql-comint product params)))
 
 
 
@@ -3196,10 +3370,10 @@
   (interactive)
   (sql-product-interactive 'ingres))
 
-(defun sql-connect-ingres (product options)
+(defun sql-comint-ingres (product options)
   "Create comint buffer and connect to Ingres."
   ;; username and password are ignored.
-  (sql-connect product
+  (sql-comint product
                (append (if (string= "" sql-database)
                            nil
                          (list sql-database))
@@ -3234,7 +3408,7 @@
   (interactive)
   (sql-product-interactive 'ms))
 
-(defun sql-connect-ms (product options)
+(defun sql-comint-ms (product options)
   "Create comint buffer and connect to Microsoft SQL Server."
   ;; Put all parameters to the program (if defined) in a list and call
   ;; make-comint.
@@ -3254,7 +3428,7 @@
 	;; If -P is passed to ISQL as the last argument without a
 	;; password, it's considered null.
 	(setq params (append params (list "-P")))))
-    (sql-connect product params)))
+    (sql-comint product params)))
 
 
 
@@ -3290,7 +3464,7 @@
   (interactive)
   (sql-product-interactive 'postgres))
 
-(defun sql-connect-postgres (product options)
+(defun sql-comint-postgres (product options)
   "Create comint buffer and connect to Postgres."
   ;; username and password are ignored.  Mark Stosberg suggest to add
   ;; the database at the end.  Jason Beegan suggest using --pset and
@@ -3304,7 +3478,7 @@
 	(setq params (append (list "-h" sql-server) params)))
     (if (not (string= "" sql-user))
 	(setq params (append (list "-U" sql-user) params)))
-    (sql-connect product params)))
+    (sql-comint product params)))
 
 
 
@@ -3334,7 +3508,7 @@
   (interactive)
   (sql-product-interactive 'interbase))
 
-(defun sql-connect-interbase (product options)
+(defun sql-comint-interbase (product options)
   "Create comint buffer and connect to Interbase."
   ;; Put all parameters to the program (if defined) in a list and call
   ;; make-comint.
@@ -3345,7 +3519,7 @@
 	(setq params (append (list "-p" sql-password) params)))
     (if (not (string= "" sql-database))
         (setq params (cons sql-database params))) ; add to the front!
-    (sql-connect product params)))
+    (sql-comint product params)))
 
 
 
@@ -3379,11 +3553,11 @@
   (interactive)
   (sql-product-interactive 'db2))
 
-(defun sql-connect-db2 (product options)
+(defun sql-comint-db2 (product options)
   "Create comint buffer and connect to DB2."
   ;; Put all parameters to the program (if defined) in a list and call
   ;; make-comint.
-  (sql-connect product options)
+  (sql-comint product options)
 )
 ;;   ;; Properly escape newlines when DB2 is interactive.
 ;;   (setq comint-input-sender 'sql-escape-newlines-and-send))
@@ -3415,7 +3589,7 @@
   (interactive)
   (sql-product-interactive 'linter))
 
-(defun sql-connect-linter (product options)
+(defun sql-comint-linter (product options)
   "Create comint buffer and connect to Linter."
   ;; Put all parameters to the program (if defined) in a list and call
   ;; make-comint.
@@ -3430,7 +3604,7 @@
     (if (string= "" sql-database)
 	(setenv "LINTER_MBX" nil)
       (setenv "LINTER_MBX" sql-database))
-    (sql-connect product params)
+    (sql-comint product params)
     (setenv "LINTER_MBX" old-mbx)))
 
 
--- a/lisp/simple.el	Sat Jul 17 10:55:12 2010 +0000
+++ b/lisp/simple.el	Sun Jul 18 22:30:24 2010 +0000
@@ -3687,7 +3687,6 @@
 	 mark-active
 	 (display-selections-p)
 	 (x-selection-owner-p 'PRIMARY)
-	 (not (eq (region-beginning) (region-end)))
 	 (x-set-selection 'PRIMARY (buffer-substring-no-properties
 				    (region-beginning) (region-end))))
     (if (and (null force)
@@ -3708,9 +3707,13 @@
     (setq mark-active t)
     (unless transient-mark-mode
       (setq transient-mark-mode 'lambda))
-    (when (and select-active-regions
-	       (display-selections-p))
-      (x-set-selection 'PRIMARY (current-buffer)))))
+    (select-active-region)))
+
+(defsubst select-active-region ()
+  "Set the PRIMARY X selection if `select-active-regions' is non-nil."
+  (and select-active-regions
+       (display-selections-p)
+       (x-set-selection 'PRIMARY (current-buffer))))
 
 (defun set-mark (pos)
   "Set this buffer's mark to POS.  Don't use this function!
@@ -3733,9 +3736,7 @@
       (progn
 	(setq mark-active t)
 	(run-hooks 'activate-mark-hook)
-	(when (and select-active-regions
-		   (display-selections-p))
-	  (x-set-selection 'PRIMARY (current-buffer)))
+	(select-active-region)
 	(set-marker (mark-marker) pos (current-buffer)))
     ;; Normally we never clear mark-active except in Transient Mark mode.
     ;; But when we actually clear out the mark value too, we must
@@ -3819,8 +3820,7 @@
 	(push-mark nil nomsg t)
       (setq mark-active t)
       (run-hooks 'activate-mark-hook)
-      (and select-active-regions (display-selections-p)
-	   (x-set-selection 'PRIMARY (current-buffer)))
+      (select-active-region)
       (unless nomsg
 	(message "Mark activated")))))
 
@@ -4008,9 +4008,12 @@
 deactivate it, and restore the variable `transient-mark-mode' to
 its earlier value."
   (cond ((and shift-select-mode this-command-keys-shift-translated)
-         (unless (and mark-active
-                      (eq (car-safe transient-mark-mode) 'only))
-           (setq transient-mark-mode
+         (if (and mark-active
+		  (eq (car-safe transient-mark-mode) 'only))
+	     ;; Another program may have grabbed the selection; make
+	     ;; sure we get it back now.
+	     (select-active-region)
+	   (setq transient-mark-mode
                  (cons 'only
                        (unless (eq transient-mark-mode 'lambda)
                          transient-mark-mode)))
--- a/nt/ChangeLog	Sat Jul 17 10:55:12 2010 +0000
+++ b/nt/ChangeLog	Sun Jul 18 22:30:24 2010 +0000
@@ -1,3 +1,9 @@
+2010-07-18  Juanma Barranquero  <lekktu@gmail.com>
+
+	* configure.bat: New option --enable-checking.
+	* gmake.defs, nmake.defs (CHECKING_CFLAGS): New define.
+	(CFLAGS): Include it.
+
 2010-07-12  Dan Nicolaescu  <dann@ics.uci.edu>
 
 	* config.nt (volatile): Remove definition.
--- a/nt/configure.bat	Sat Jul 17 10:55:12 2010 +0000
+++ b/nt/configure.bat	Sun Jul 18 22:30:24 2010 +0000
@@ -80,6 +80,7 @@
 set prefix=
 set nodebug=N
 set noopt=N
+set enablechecking=N
 set profile=N
 set nocygwin=N
 set COMPILER=
@@ -100,6 +101,7 @@
 if "%1" == "--with-msvc" goto withmsvc
 if "%1" == "--no-debug" goto nodebug
 if "%1" == "--no-opt" goto noopt
+if "%1" == "--enable-checking" goto enablechecking
 if "%1" == "--profile" goto profile
 if "%1" == "--no-cygwin" goto nocygwin
 if "%1" == "--cflags" goto usercflags
@@ -119,6 +121,7 @@
 echo.   --with-msvc             use MSVC to compile Emacs
 echo.   --no-debug              exclude debug info from executables
 echo.   --no-opt                disable optimization
+echo.   --enable-checking       enable checks and assertions
 echo.   --profile               enable profiling
 echo.   --no-cygwin             use -mno-cygwin option with GCC
 echo.   --cflags FLAG           pass FLAG to compiler
@@ -157,6 +160,11 @@
 shift
 goto again
 rem ----------------------------------------------------------------------
+:enablechecking
+set enablechecking=Y
+shift
+goto again
+rem ----------------------------------------------------------------------
 :profile
 set profile=Y
 shift
@@ -529,6 +537,7 @@
 if not "(%dbginfo%)" == "()" echo DEBUG_INFO=%dbginfo%>>config.settings
 if (%nodebug%) == (Y) echo NODEBUG=1 >>config.settings
 if (%noopt%) == (Y) echo NOOPT=1 >>config.settings
+if (%enablechecking%) == (Y) echo ENABLECHECKS=1 >>config.settings
 if (%profile%) == (Y) echo PROFILE=1 >>config.settings
 if (%nocygwin%) == (Y) echo NOCYGWIN=1 >>config.settings
 if not "(%prefix%)" == "()" echo INSTALL_DIR=%prefix%>>config.settings
@@ -660,6 +669,7 @@
 set prefix=
 set nodebug=
 set noopt=
+set enablechecking=
 set profile=
 set nocygwin=
 set COMPILER=
--- a/nt/gmake.defs	Sat Jul 17 10:55:12 2010 +0000
+++ b/nt/gmake.defs	Sun Jul 18 22:30:24 2010 +0000
@@ -198,7 +198,14 @@
 else
 DEBUG_CFLAGS	=
 endif
-CFLAGS          = -I. $(ARCH_CFLAGS) $(DEBUG_CFLAGS) $(PROFILE_CFLAGS) $(USER_CFLAGS) $(LOCAL_FLAGS)
+
+ifdef ENABLECHECKS
+CHECKING_CFLAGS	= -DENABLE_CHECKING -DXASSERTS
+else
+CHECKING_CFLAGS	=
+endif
+
+CFLAGS          = -I. $(ARCH_CFLAGS) $(DEBUG_CFLAGS) $(CHECKING_CFLAGS) $(PROFILE_CFLAGS) $(USER_CFLAGS) $(LOCAL_FLAGS)
 EMACS_EXTRA_C_FLAGS = -DUSE_CRT_DLL=1
 
 ifdef PROFILE
--- a/nt/nmake.defs	Sat Jul 17 10:55:12 2010 +0000
+++ b/nt/nmake.defs	Sun Jul 18 22:30:24 2010 +0000
@@ -136,8 +136,15 @@
 !else
 DEBUG_CFLAGS	=
 !endif
+
+!ifdef ENABLECHECKS
+CHECKING_CFLAGS	= -DENABLE_CHECKING -DXASSERTS
+!else
+CHECKING_CFLAGS	=
+!endif
+
 CFLAGS          = -I. $(ARCH_CFLAGS) \
-		  $(DEBUG_CFLAGS) $(USER_CFLAGS) $(LOCAL_FLAGS)
+		  $(DEBUG_CFLAGS) $(CHECKING_CFLAGS) $(USER_CFLAGS) $(LOCAL_FLAGS)
 EMACS_EXTRA_C_FLAGS =
 
 SYS_LDFLAGS	= -nologo -release -incremental:no -version:3.10 -swaprun:cd -swaprun:net setargv.obj
--- a/src/ChangeLog	Sat Jul 17 10:55:12 2010 +0000
+++ b/src/ChangeLog	Sun Jul 18 22:30:24 2010 +0000
@@ -1,4 +1,18 @@
-2010-07-14  Jan Djärv  <jan.h.d@swipnet.se>
+2010-07-18  Juanma Barranquero  <lekktu@gmail.com>
+
+	* makefile.w32-in ($(BLD)/keyboard.$(O)): Update dependencies.
+
+2010-07-17  Chong Yidong  <cyd@stupidchicken.com>
+
+	* frame.c (make_initial_frame): Use set_menu_bar_lines (Bug#6660).
+
+2010-07-17  Jan Djärv  <jan.h.d@swipnet.se>
+
+	* gtkutil.c (xg_event_is_for_menubar): Also check that event window
+	is related to the menu bar (Bug#6499).
+	(xg_frame_resized): GTK_IS_MAPPED => gtk_widget_get_mapped, for Gtk 3.0
+
+2010-07-16  Jan Djärv  <jan.h.d@swipnet.se>
 
 	* xterm.h (x_menubar_window_to_frame): Second parameter is XEvent*.
 
@@ -15,7 +29,7 @@
 
 	* gtkutil.c (xg_event_is_for_menubar): New function (Bug#6499).
 
-2010-07-14  Eli Zaretskii  <eliz@gnu.org>
+2010-07-16  Eli Zaretskii  <eliz@gnu.org>
 
 	* w32fns.c (x_set_foreground_color): Fix setting the cursor color
 	when it's the same as the old foreground.  (Bug#6609)
@@ -55,8 +69,8 @@
 	(prepare_menu_bars): Remove setting of pending_menu_activation.
 
 	* xmenu.c (pending_menu_activation): Remove.
-	(x_activate_menubar): Set popup_activated_flag for Xt also. Remove
-	setting of pending_menu_activation.
+	(x_activate_menubar): Set popup_activated_flag for Xt also.
+	Remove setting of pending_menu_activation.
 	(set_frame_menubar): Remove check of pending_menu_activation.
 	Declare menubar_size before code.  Correct spelling in comment.
 
@@ -1164,7 +1178,7 @@
 	* nsterm.m (ns_draw_fringe_bitmap): Likewise.
 
 	* fringe.c (draw_fringe_bitmap_1): Don't clip bitmap here.
-	Take account of	bitmap offset.
+	Take account of bitmap offset.
 	(draw_window_fringes): Take account of window vscroll.
 	(update_window_fringes): Likewise.  Extend top-aligned top indicator
 	or bottom-aligned bottom indicator to adjacent rows if it doesn't fit
--- a/src/frame.c	Sat Jul 17 10:55:12 2010 +0000
+++ b/src/frame.c	Sun Jul 18 22:30:24 2010 +0000
@@ -553,7 +553,9 @@
 
   FRAME_CAN_HAVE_SCROLL_BARS (f) = 0;
   FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = vertical_scroll_bar_none;
-  FRAME_MENU_BAR_LINES(f) = NILP (Vmenu_bar_mode) ? 0 : 1;
+
+  /* The default value of menu-bar-mode is t.  */
+  set_menu_bar_lines (f, make_number (1), Qnil);
 
 #ifdef CANNOT_DUMP
   if (!noninteractive)
--- a/src/gtkutil.c	Sat Jul 17 10:55:12 2010 +0000
+++ b/src/gtkutil.c	Sun Jul 18 22:30:24 2010 +0000
@@ -2860,6 +2860,13 @@
 xg_event_is_for_menubar (FRAME_PTR f, XEvent *event)
 {
   struct x_output *x = f->output_data.x;
+  GList *iter;
+  GdkRectangle rec;
+  GList *list;
+  GdkDisplay *gdpy;
+  GdkWindow *gw;
+  GdkEvent gevent;
+  GtkWidget *gwdesc;
 
   if (! x->menubar_widget) return 0;
 
@@ -2870,18 +2877,28 @@
          && event->xbutton.same_screen))
     return 0;
 
-  GList *list = gtk_container_get_children (GTK_CONTAINER (x->menubar_widget));
+  gdpy = gdk_x11_lookup_xdisplay (FRAME_X_DISPLAY (f));
+  gw = gdk_xid_table_lookup_for_display (gdpy, event->xbutton.window);
+  if (! gw) return 0;
+  gevent.any.window = gw;
+  gwdesc = gtk_get_event_widget (&gevent);
+  if (! gwdesc) return 0;
+  if (! GTK_IS_MENU_BAR (gwdesc)
+      && ! GTK_IS_MENU_ITEM (gwdesc)
+      && ! gtk_widget_is_ancestor (x->menubar_widget, gwdesc))
+    return 0;
+
+  list = gtk_container_get_children (GTK_CONTAINER (x->menubar_widget));
   if (! list) return 0;
-  GList *iter;
-  GdkRectangle rec;
   rec.x = event->xbutton.x;
   rec.y = event->xbutton.y;
   rec.width = 1;
   rec.height = 1;
+
   for (iter = list ; iter; iter = g_list_next (iter))
     {
       GtkWidget *w = GTK_WIDGET (iter->data);
-      if (GTK_WIDGET_MAPPED (w) && gtk_widget_intersect (w, &rec, NULL))
+      if (gtk_widget_get_mapped (w) && gtk_widget_intersect (w, &rec, NULL))
         break;
     }
   g_list_free (list);
--- a/src/makefile.w32-in	Sat Jul 17 10:55:12 2010 +0000
+++ b/src/makefile.w32-in	Sun Jul 18 22:30:24 2010 +0000
@@ -965,6 +965,7 @@
 	$(SRC)/keyboard.h \
 	$(SRC)/keymap.h \
 	$(SRC)/macros.h \
+	$(SRC)/process.h \
 	$(SRC)/puresize.h \
 	$(SRC)/syntax.h \
 	$(SRC)/syssignal.h \