From xemacs-m  Sun Feb  9 18:28:58 1997
Received: from mecca.spd.louisville.edu (mecca.spd.louisville.edu [136.165.40.148])
	by xemacs.org (8.8.5/8.8.5) with SMTP id SAA19470
	for <xemacs-beta@xemacs.org>; Sun, 9 Feb 1997 18:28:57 -0600 (CST)
Received: (from tjchol01@localhost) by mecca.spd.louisville.edu (950413.SGI.8.6.12/950213.SGI.AUTOCF) id TAA08906; Sun, 9 Feb 1997 19:29:01 -0500
Date: Sun, 9 Feb 1997 19:29:01 -0500
Message-Id: <199702100029.TAA08906@mecca.spd.louisville.edu>
From: "Tomasz J. Cholewo" <T.Cholewo@ieee.org>
To: xemacs-beta@xemacs.org
Subject: [patch] `help-char' documentation and usage
Mime-Version: 1.0 (generated by tm-edit 7.101)
Content-Type: text/plain; charset=US-ASCII

Hi,

The doc string of `help-char' says that:

    To disable the help-char, set it to a negative number.

This is no longer true in XEmacs.  About ten different packages try
to eval `(char-to-string help-char)' etc., which leads to errors when
`help-char' is negative.

Moreover, delbackspace.el executes:

    (setq help-char '(meta h))

which is OK according to the documentation and common sense but also
breaks all these above mentioned packages.  I modified them a bit but it
is only a partial solution as they are still using `read-char' to get
the keystrokes in most cases.

The following patch changes `help-char' handling in these packages and
its doc string.  Probably a sentence about how to disable the
`help-char' would be helpful, but it doesn't look like there is a simple
way to do it.  Any suggestions?

Tom
============== CUT HERE ===================
diff -dbur xemacs-20.0/lisp/dired/dired.el xemacs-20.0-work/lisp/dired/dired.el
--- xemacs-20.0/lisp/dired/dired.el	Thu Jan 23 00:29:23 1997
+++ xemacs-20.0-work/lisp/dired/dired.el	Sun Feb  9 18:24:44 1997
@@ -1986,7 +1986,7 @@
 				  (if help-form
 				      (format " [Type yn!q or %s] "
 					      (key-description
-					       (char-to-string help-char)))
+					       (vector help-char)))
 				    " [Type y, n, q or !] ")))
 		 result elt)
 	     ;; Actually it looks nicer without cursor-in-echo-area - you can
@@ -1994,7 +1994,7 @@
 	     (apply 'message qprompt qs-args)
 	     (setq char (set qs-var (read-char)))
 	     (while (not (setq elt (assoc char dired-query-alist)))
-	       (message "Invalid char - type %c for help." help-char)
+	       (message "Invalid char - type %s for help." (key-description (vector help-char)))
 	       (ding)
 	       (sit-for 1)
 	       (apply 'message qprompt qs-args)
diff -dbur xemacs-20.0/lisp/electric/ebuff-menu.el xemacs-20.0-work/lisp/electric/ebuff-menu.el
--- xemacs-20.0/lisp/electric/ebuff-menu.el	Sat Dec 21 15:47:14 1996
+++ xemacs-20.0-work/lisp/electric/ebuff-menu.el	Sun Feb  9 18:14:53 1997
@@ -193,7 +193,7 @@
 	(setq i (1+ i))))
     (define-key map "\C-z" 'suspend-emacs)
     (define-key map "v" 'Electric-buffer-menu-mode-view-buffer)
-    (define-key map (char-to-string help-char) 'Helper-help)
+    (define-key map (vector help-char) 'Helper-help)
     (define-key map "?" 'Helper-describe-bindings)
     (define-key map "\C-c" nil)
     (define-key map "\C-c\C-c" 'Electric-buffer-menu-quit)
@@ -280,7 +280,7 @@
   (message "%s"
 	   (if (and (eq (key-binding "\C-c\C-c") 'Electric-buffer-menu-quit)
 		    (eq (key-binding " ") 'Electric-buffer-menu-select)
-		    (eq (key-binding (char-to-string help-char)) 'Helper-help)
+		    (eq (key-binding (vector help-char)) 'Helper-help)
 		    (eq (key-binding "?") 'Helper-describe-bindings))
 	       (substitute-command-keys "Type C-c C-c to exit, Space to select,
 Type \\[Electric-buffer-menu-quit] to exit, \
diff -dbur xemacs-20.0/lisp/electric/echistory.el xemacs-20.0-work/lisp/electric/echistory.el
--- xemacs-20.0/lisp/electric/echistory.el	Wed Dec 18 17:49:59 1996
+++ xemacs-20.0-work/lisp/electric/echistory.el	Sun Feb  9 18:14:53 1997
@@ -67,7 +67,7 @@
   (define-key electric-history-map "\C-c\C-c" 'Electric-history-quit)
   (define-key electric-history-map "\C-]" 'Electric-history-quit)
   (define-key electric-history-map "\C-z" 'suspend-emacs)
-  (define-key electric-history-map (char-to-string help-char) 'Helper-help)
+  (define-key electric-history-map (vector help-char) 'Helper-help)
   ;; XEmacs
   (define-key electric-history-map 'backspace 'previous-line)
   (define-key electric-history-map "?" 'Helper-describe-bindings)
diff -dbur xemacs-20.0/lisp/electric/ehelp.el xemacs-20.0-work/lisp/electric/ehelp.el
--- xemacs-20.0/lisp/electric/ehelp.el	Wed Dec 18 17:49:58 1996
+++ xemacs-20.0-work/lisp/electric/ehelp.el	Sun Feb  9 18:14:52 1997
@@ -65,7 +65,7 @@
     (define-key map [(control ?7)] 'electric-help-undefined)
     (define-key map [(control ?8)] 'electric-help-undefined)
     (define-key map [(control ?9)] 'electric-help-undefined)
-    (define-key map (char-to-string help-char) 'electric-help-help)
+    (define-key map (vector help-char) 'electric-help-help)
     (define-key map "?" 'electric-help-help)
     ;; XEmacs addition
     (define-key map 'help 'electric-help-help)
diff -dbur xemacs-20.0/lisp/electric/helper.el xemacs-20.0-work/lisp/electric/helper.el
--- xemacs-20.0/lisp/electric/helper.el	Wed Dec 18 17:49:59 1996
+++ xemacs-20.0-work/lisp/electric/helper.el	Sun Feb  9 18:14:52 1997
@@ -52,7 +52,7 @@
   ;(define-key Helper-help-map "f" 'Helper-describe-function)
   ;(define-key Helper-help-map "v" 'Helper-describe-variable)
   (define-key Helper-help-map "?" 'Helper-help-options)
-  (define-key Helper-help-map (char-to-string help-char) 'Helper-help-options)
+  (define-key Helper-help-map (vector help-char) 'Helper-help-options)
   (fset 'Helper-help-map Helper-help-map))

 (defun Helper-help-scroller ()
diff -dbur xemacs-20.0/lisp/packages/hexl.el xemacs-20.0-work/lisp/packages/hexl.el
--- xemacs-20.0/lisp/packages/hexl.el	Wed Dec 18 17:50:47 1996
+++ xemacs-20.0-work/lisp/packages/hexl.el	Sun Feb  9 18:14:51 1997
@@ -706,8 +706,8 @@
   (define-key hexl-mode-map "\C-e" 'hexl-end-of-line)
   (define-key hexl-mode-map "\C-f" 'hexl-forward-char)

-  (if (not (eq (key-binding (char-to-string help-char)) 'help-command))
-      (define-key hexl-mode-map (char-to-string help-char) 'undefined))
+  (if (not (eq (key-binding (vector help-char)) 'help-command))
+      (define-key hexl-mode-map (vector help-char) 'undefined))

   (define-key hexl-mode-map "\C-i" 'hexl-self-insert-command)
   (define-key hexl-mode-map "\C-j" 'hexl-self-insert-command)
diff -dbur xemacs-20.0/lisp/packages/terminal.el xemacs-20.0-work/lisp/packages/terminal.el
--- xemacs-20.0/lisp/packages/terminal.el	Wed Dec 18 17:42:52 1996
+++ xemacs-20.0-work/lisp/packages/terminal.el	Sun Feb  9 18:14:49 1997
@@ -100,7 +100,7 @@
     (define-key map "m" 'te-toggle-more-processing)
     (define-key map "x" 'te-escape-extended-command)
     (define-key map "?" 'te-escape-help)
-    (define-key map (char-to-string help-char) 'te-escape-help)
+    (define-key map (vector help-char) 'te-escape-help)
     (setq terminal-escape-map map)))

 (defvar te-escape-command-alist '())
@@ -139,7 +139,7 @@
         (define-key map s 'te-more-break-unwind)
         (setq i (1+ i))))

-    (define-key map (char-to-string help-char) 'te-more-break-help)
+    (define-key map (vector help-char) 'te-more-break-help)
     (define-key map " " 'te-more-break-resume)
     (define-key map "\C-l" 'redraw-display)
     (define-key map "\C-o" 'te-more-break-flush-pending-output)
diff -dbur xemacs-20.0/lisp/prim/help.el xemacs-20.0-work/lisp/prim/help.el
--- xemacs-20.0/lisp/prim/help.el	Sat Jan 11 15:14:08 1997
+++ xemacs-20.0-work/lisp/prim/help.el	Sun Feb  9 18:14:48 1997
@@ -45,10 +45,7 @@
 ;; global-map definitions moved to keydefs.el
 (fset 'help-command help-map)

-(let ((ch help-char))
-  (if (or (characterp ch) (integerp ch))
-      (setq ch (char-to-string ch)))
-  (define-key help-map ch 'help-for-help))
+(define-key help-map (vector help-char) 'help-for-help)
 (define-key help-map "?" 'help-for-help)
 (define-key help-map 'help 'help-for-help)

diff -dbur xemacs-20.0/lisp/prim/keydefs.el xemacs-20.0-work/lisp/prim/keydefs.el
--- xemacs-20.0/lisp/prim/keydefs.el	Sat Dec 21 15:48:30 1996
+++ xemacs-20.0-work/lisp/prim/keydefs.el	Sun Feb  9 18:14:47 1997
@@ -142,10 +142,7 @@

 ;; FSFmacs help.el

-(let ((ch help-char))
-  (if (or (characterp ch) (integerp ch))
-      (setq ch (char-to-string ch)))
-  (define-key global-map ch 'help-command))
+(define-key global-map (vector help-char) 'help-command)
 (define-key global-map 'help 'help-command)
 (define-key global-map 'f1 'help-command)

diff -dbur xemacs-20.0/src/event-stream.c xemacs-20.0-work/src/event-stream.c
--- xemacs-20.0/src/event-stream.c	Wed Jan 29 21:23:00 1997
+++ xemacs-20.0-work/src/event-stream.c	Sun Feb  9 17:29:04 1997
@@ -1679,7 +1679,7 @@
       Lisp_Object sel_frame = DEVICE_SELECTED_FRAME (d);

       /* You'd think that maybe we should use FRAME_WITH_FOCUS_REAL,
-	 but that can cause us to end up in an infinite loop focussing
+	 but that can cause us to end up in an infinite loop focusing
 	 between two frames.  It seems that since the call to `select-frame'
 	 in emacs_handle_focus_change_final() is based on the _FOR_HOOKS
 	 value, we need to do so too. */
@@ -3912,7 +3912,7 @@
 function is treated like any other character, and `quit-flag' is not set.

 First arg PROMPT is a prompt string.  If nil, do not prompt specially.
-Second (optional) arg CONTINUE-ECHO, if non-nil, means this key echos
+Second (optional) arg CONTINUE-ECHO, if non-nil, means this key echoes
 as a continuation of the previous key.

 The third (optional) arg DONT-DOWNCASE-LAST, if non-nil, means do not
@@ -4369,7 +4369,7 @@
 When it is read, do `(eval help-form)', and display result if it's a string.
 If the value of `help-form' is nil, this char can be read normally.
 This can be any form recognized as a single key specifier.
-To disable the help-char, set it to a negative number.
+The help-char cannot be a negative number in XEmacs.
 */ );
   Vhelp_char = make_char (8); /* C-h */

