[gnu.emacs] Displaying X mouse button bindings

cooper@nunki.steinmetz.ge.com (Clark Cooper) (01/04/90)

	The following function will display the current X Windows mouse
button bindings in the help window:

(defun x-mouse-button-help ()
  "Display mouse button bindings"
  (interactive)
  (if (getenv "DISPLAY")
      (let ((mods 0)
	    (hbuff (set-buffer "*Help*"))
	    (tab-stop-list '(25)))
	(delete-region (point-min) (point-max))
	(insert "The following mouse buttons are bound:\n\n")
	(while (< mods 8)
	  (let ((modifiers (if (= (logand mods 4) 4)
			       "Control-"
			     ""))
		(button '("Right" "Middle" "Left"))
		(mn (* mods 16))
		(bn 0))
	    (if (= (logand mods 2) 2)
		(setq modifiers (concat modifiers "Meta-")))
	    (if (= (logand mods 1) 1)
		(setq modifiers (concat modifiers "Shift-")))
	    (while (< bn 3)
	      (let ((binding (aref mouse-map (+ mn bn))))
		(if (and binding (not (eq binding 'x-mouse-ignore)))
		    (progn
		      (insert "\n")
		      (insert modifiers)
		      (insert (nth bn button))
		      (tab-to-tab-stop)
		      (insert (symbol-name binding)))))
	      (setq bn (+ bn 1)))
	  (setq mods (+ mods 1))))
	(display-buffer hbuff))))
--
===================================================================
Clark Cooper	 GE Corporate R&D	  cooper@nunki.crd.ge.com
(518) 387-5887	 P.O. Box 8 / K-1 4C31	  coopercc@crdgw1.ge.com
		 Schenectady, NY  12301	  ...!uunet!crdgw1!coopercc