unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* C-h, F1, Backspace, and splash screen
@ 2009-05-28 16:26 Ken Brown
  2009-05-28 18:22 ` Stefan Monnier
  0 siblings, 1 reply; 12+ messages in thread
From: Ken Brown @ 2009-05-28 16:26 UTC (permalink / raw)
  To: Emacs

As I've announced in a different thread, I'm trying to bring cygwin's 
emacs packages up to date.  One annoyance that I've encountered, which 
may not be cygwin specific, is that C-h is not available as the help key 
when emacs is run in a text terminal.  I've looked at the documentation 
for normal-erase-is-backspace-mode, and it seems that this is to be 
expected.  But the splash screen still says that C-h is the help key, 
which could be confusing to new emacs users.  Such users may not know 
how to get to the documentation that tells them to use F1 as the help key.

It seems that the problem is in startup.el:

   ;; If keys have their default meanings,
   ;; use precomputed string to save lots of time.
   (if (and (eq (key-binding "\C-h") 'help-command)
	   (eq (key-binding "\C-xu") 'advertised-undo)
	   (eq (key-binding "\C-x\C-c") 'save-buffers-kill-terminal)
	   (eq (key-binding "\C-ht") 'help-with-tutorial)
	   (eq (key-binding "\C-hi") 'info)
	   (eq (key-binding "\C-hr") 'info-emacs-manual)
	   (eq (key-binding "\C-h\C-n") 'view-emacs-news))
       (progn
	(insert "
Get help\t   C-h  (Hold down CTRL and press h)
")

Given that C-h has been translated to DEL by 
normal-erase-is-backspace-mode, shouldn't the startup code detect this 
and tell the user that F1 is the help key?  Or am I misunderstanding 
something?

Ken




^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: C-h, F1, Backspace, and splash screen
  2009-05-28 16:26 C-h, F1, Backspace, and splash screen Ken Brown
@ 2009-05-28 18:22 ` Stefan Monnier
  2009-05-28 18:34   ` Ken Brown
  0 siblings, 1 reply; 12+ messages in thread
From: Stefan Monnier @ 2009-05-28 18:22 UTC (permalink / raw)
  To: Ken Brown; +Cc: Emacs

> packages up to date.  One annoyance that I've encountered, which may not be
> cygwin specific, is that C-h is not available as the help key when emacs is
> run in a text terminal.  I've looked at the documentation for

Nowadays under X11, this is considered as a bug in the
terminal's configuration (i.e. most/all terminals don't use C-h for the
backspace key any more).  Can't you fix the text terminal?


        Stefan






^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: C-h, F1, Backspace, and splash screen
  2009-05-28 18:22 ` Stefan Monnier
@ 2009-05-28 18:34   ` Ken Brown
  2009-05-28 21:01     ` Stefan Monnier
  2009-05-28 22:44     ` David Robinow
  0 siblings, 2 replies; 12+ messages in thread
From: Ken Brown @ 2009-05-28 18:34 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Emacs

On 5/28/2009 2:22 PM, Stefan Monnier wrote:
>> packages up to date.  One annoyance that I've encountered, which may not be
>> cygwin specific, is that C-h is not available as the help key when emacs is
>> run in a text terminal.  I've looked at the documentation for
> 
> Nowadays under X11, this is considered as a bug in the
> terminal's configuration (i.e. most/all terminals don't use C-h for the
> backspace key any more).  Can't you fix the text terminal?

I think I wasn't specific enough in asking my question, though your 
answer might be the same.  The problem doesn't occur under X11.  It 
occurs in various terminals running outside of X (rxvt, mintty,...). 
It's true that the terminals can be configured so that backspace doesn't 
send C-h, but I'm trying to set things up to work nicely with the 
default cygwin configuration, in which backspace sends C-h.  I don't 
have any control over these defaults.

Ken




^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: C-h, F1, Backspace, and splash screen
  2009-05-28 18:34   ` Ken Brown
@ 2009-05-28 21:01     ` Stefan Monnier
  2009-05-28 21:19       ` Ken Brown
  2009-05-28 22:44     ` David Robinow
  1 sibling, 1 reply; 12+ messages in thread
From: Stefan Monnier @ 2009-05-28 21:01 UTC (permalink / raw)
  To: Ken Brown; +Cc: Emacs

>>> packages up to date.  One annoyance that I've encountered, which may not be
>>> cygwin specific, is that C-h is not available as the help key when emacs is
>>> run in a text terminal.  I've looked at the documentation for
>> 
>> Nowadays under X11, this is considered as a bug in the
>> terminal's configuration (i.e. most/all terminals don't use C-h for the
>> backspace key any more).  Can't you fix the text terminal?

> I think I wasn't specific enough in asking my question, though your answer
> might be the same.  The problem doesn't occur under X11.  It occurs in
> various terminals running outside of X (rxvt, mintty,...). It's true that
> the terminals can be configured so that backspace doesn't send C-h, but I'm
> trying to set things up to work nicely with the default cygwin
> configuration, in which backspace sends C-h.

Indeed, the answer is the same: it is nowadays generally considered
a configuration error (or at least misfeature) for a terminal to use C-h
for backspace.

> I don't have any control over these defaults.

The first thing to do is to complain about those things: while you may
not be able to change them directly, you can at least influence those
who can.  Compatibility with xterm is usually a good argument.
`backspace' should send DEL and `delete' should send an escape sequence
(IIRC it should be ESC [ 3 ~).


        Stefan




^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: C-h, F1, Backspace, and splash screen
  2009-05-28 21:01     ` Stefan Monnier
@ 2009-05-28 21:19       ` Ken Brown
  2009-05-29  1:32         ` Stefan Monnier
  0 siblings, 1 reply; 12+ messages in thread
From: Ken Brown @ 2009-05-28 21:19 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Emacs

On 5/28/2009 5:01 PM, Stefan Monnier wrote:
> Indeed, the answer is the same: it is nowadays generally considered
> a configuration error (or at least misfeature) for a terminal to use C-h
> for backspace.

OK, I'll pass that on to the cygwin people.

Nevertheless, if you look back at my first post in this thread 
(http://lists.gnu.org/archive/html/emacs-devel/2009-05/msg00569.html), 
isn't there a bug in the way startup.el prepares the splash screen?

If you prefer, I'll prepare a formal bug report.  But since I'm new at 
this, I thought I'd start with a question to the list in case I was 
misunderstanding how normal-erase-is-backspace-mode is supposed to work.

Ken




^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: C-h, F1, Backspace, and splash screen
  2009-05-28 18:34   ` Ken Brown
  2009-05-28 21:01     ` Stefan Monnier
@ 2009-05-28 22:44     ` David Robinow
  2009-05-28 23:06       ` Ken Brown
  1 sibling, 1 reply; 12+ messages in thread
From: David Robinow @ 2009-05-28 22:44 UTC (permalink / raw)
  To: Ken Brown; +Cc: Emacs

On Thu, May 28, 2009 at 2:34 PM, Ken Brown <kbrown@cornell.edu> wrote:
> On 5/28/2009 2:22 PM, Stefan Monnier wrote:
>>>
>>> packages up to date.  One annoyance that I've encountered, which may not
>>> be
>>> cygwin specific, is that C-h is not available as the help key when emacs
>>> is
>>> run in a text terminal.  I've looked at the documentation for
>>
>> Nowadays under X11, this is considered as a bug in the
>> terminal's configuration (i.e. most/all terminals don't use C-h for the
>> backspace key any more).  Can't you fix the text terminal?
>
> I think I wasn't specific enough in asking my question, though your answer
> might be the same.  The problem doesn't occur under X11.  It occurs in
> various terminals running outside of X (rxvt, mintty,...). It's true that
> the terminals can be configured so that backspace doesn't send C-h, but I'm
> trying to set things up to work nicely with the default cygwin
> configuration, in which backspace sends C-h.  I don't have any control over
> these defaults.
>
> Ken
  Actually C-h sends backspace, not the other way around. (For some
definition of "backspace")
For rxvt, the user can edit "/etc/X11/app-defaults/Rxvt" to comment
out the line:
  Rxvt.backspacekey:     ^H
and   "emacs -nw" appears to work properly.

But really, what is your use case? I don't really see any point in
running cygwin emacs unless it's under X.
 If you have cygwin, you have Windows.
 If you have Windows, use the native Emacs.




^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: C-h, F1, Backspace, and splash screen
  2009-05-28 22:44     ` David Robinow
@ 2009-05-28 23:06       ` Ken Brown
  2009-05-29 14:23         ` Rupert Swarbrick
  0 siblings, 1 reply; 12+ messages in thread
From: Ken Brown @ 2009-05-28 23:06 UTC (permalink / raw)
  To: David Robinow; +Cc: Emacs

On 5/28/2009 6:44 PM, David Robinow wrote:
> But really, what is your use case? I don't really see any point in
> running cygwin emacs unless it's under X.

I personally use emacs under X almost exclusively.  But some cygwin 
users like to use emacs in a terminal.  And I occasionally find it 
useful to do that also (for instance, when I use ssh admin@localhost to 
simulate 'su' in order to make a quick edit).  As the emacs maintainer 
for cygwin, I'm trying to make this work as well as possible.

>  If you have cygwin, you have Windows.
>  If you have Windows, use the native Emacs.

This is a matter of personal preference.  For the kinds of things that I 
do, I find it more convenient to use cygwin emacs.

Ken





^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: C-h, F1, Backspace, and splash screen
  2009-05-28 21:19       ` Ken Brown
@ 2009-05-29  1:32         ` Stefan Monnier
  2009-05-29  4:17           ` Kevin Rodgers
  2009-05-29 11:48           ` Ken Brown
  0 siblings, 2 replies; 12+ messages in thread
From: Stefan Monnier @ 2009-05-29  1:32 UTC (permalink / raw)
  To: Ken Brown; +Cc: Emacs

>> Indeed, the answer is the same: it is nowadays generally considered
>> a configuration error (or at least misfeature) for a terminal to use C-h
>> for backspace.

> OK, I'll pass that on to the cygwin people.

> Nevertheless, if you look back at my first post in this thread
> (http://lists.gnu.org/archive/html/emacs-devel/2009-05/msg00569.html), isn't
> there a bug in the way startup.el prepares the splash screen?

Yes, indeed.
I've just installed the patch below which should address this problem.


        Stefan


--- startup.el.~1.530.~	2009-04-28 14:57:44.000000000 -0400
+++ startup.el	2009-05-28 21:26:50.000000000 -0400
@@ -1824,6 +1824,11 @@
 
   ;; If keys have their default meanings,
   ;; use precomputed string to save lots of time.
+  (let ((c-h-accessible
+         ;; If normal-erase-is-backspace is used on a tty, there's
+         ;; no way to invoke C-h and you have to use F1 instead.
+         (or (not (char-table-p keyboard-translate-table))
+             (eq (aref keyboard-translate-table ?\C-h) ?\C-h))))
   (if (and (eq (key-binding "\C-h") 'help-command)
 	   (eq (key-binding "\C-xu") 'advertised-undo)
 	   (eq (key-binding "\C-x\C-c") 'save-buffers-kill-terminal)
@@ -1831,34 +1836,33 @@
 	   (eq (key-binding "\C-hi") 'info)
 	   (eq (key-binding "\C-hr") 'info-emacs-manual)
 	   (eq (key-binding "\C-h\C-n") 'view-emacs-news))
-      (progn
+        (let ((help (if c-h-accessible "C-h" "<f1>")))
 	(insert "
-Get help\t   C-h  (Hold down CTRL and press h)
+Get help\t   " help "  (Hold down CTRL and press h)
 ")
 	(insert-button "Emacs manual"
 		       'action (lambda (button) (info-emacs-manual))
 		       'follow-link t)
-	(insert "	   C-h r\t")
+          (insert "	   " help " r\t")
 	(insert-button "Browse manuals"
 		       'action (lambda (button) (Info-directory))
 		       'follow-link t)
-	(insert "\t   C-h i
+          (insert "\t   " help " i
 ")
 	(insert-button "Emacs tutorial"
 		       'action (lambda (button) (help-with-tutorial))
 		       'follow-link t)
-	(insert "	   C-h t\tUndo changes\t   C-x u
+          (insert "	   " help " t\tUndo changes\t   C-x u
 ")
 	(insert-button "Buy manuals"
 		       'action (lambda (button) (view-order-manuals))
 		       'follow-link t)
-	(insert "\t   C-h C-m\tExit Emacs\t   C-x C-c"))
+          (insert "\t   " help " C-m\tExit Emacs\t   C-x C-c"))
 
     (insert (format "
 Get help\t   %s
 "
-		    (let ((where (where-is-internal
-				  'help-command nil t)))
+                      (let ((where (where-is-internal 'help-command nil t)))
 		      (if where
 			  (key-description where)
 			"M-x help"))))
@@ -1881,7 +1885,7 @@
 		   'action (lambda (button) (view-order-manuals))
 		   'follow-link t)
     (insert (substitute-command-keys
-	     "\t   \\[view-order-manuals]\tExit Emacs\t   \\[save-buffers-kill-terminal]")))
+	       "\t   \\[view-order-manuals]\tExit Emacs\t   \\[save-buffers-kill-terminal]"))))
 
   ;; Say how to use the menu bar with the keyboard.
   (insert "\n")




^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: C-h, F1, Backspace, and splash screen
  2009-05-29  1:32         ` Stefan Monnier
@ 2009-05-29  4:17           ` Kevin Rodgers
  2009-05-29 11:48           ` Ken Brown
  1 sibling, 0 replies; 12+ messages in thread
From: Kevin Rodgers @ 2009-05-29  4:17 UTC (permalink / raw)
  To: emacs-devel

Stefan Monnier wrote:
>> Nevertheless, if you look back at my first post in this thread
>> (http://lists.gnu.org/archive/html/emacs-devel/2009-05/msg00569.html), isn't
>> there a bug in the way startup.el prepares the splash screen?
> 
> Yes, indeed.
> I've just installed the patch below which should address this problem.
> 
> 
>         Stefan
> 
> 
> --- startup.el.~1.530.~	2009-04-28 14:57:44.000000000 -0400
> +++ startup.el	2009-05-28 21:26:50.000000000 -0400
> @@ -1824,6 +1824,11 @@
>  
>    ;; If keys have their default meanings,
>    ;; use precomputed string to save lots of time.
> +  (let ((c-h-accessible
> +         ;; If normal-erase-is-backspace is used on a tty, there's
> +         ;; no way to invoke C-h and you have to use F1 instead.
> +         (or (not (char-table-p keyboard-translate-table))
> +             (eq (aref keyboard-translate-table ?\C-h) ?\C-h))))
>    (if (and (eq (key-binding "\C-h") 'help-command)
>  	   (eq (key-binding "\C-xu") 'advertised-undo)
>  	   (eq (key-binding "\C-x\C-c") 'save-buffers-kill-terminal)
> @@ -1831,34 +1836,33 @@
>  	   (eq (key-binding "\C-hi") 'info)
>  	   (eq (key-binding "\C-hr") 'info-emacs-manual)
>  	   (eq (key-binding "\C-h\C-n") 'view-emacs-news))
> -      (progn
> +        (let ((help (if c-h-accessible "C-h" "<f1>")))
>  	(insert "
> -Get help\t   C-h  (Hold down CTRL and press h)
> +Get help\t   " help "  (Hold down CTRL and press h)

That can lead to the following confusing text:

Get help	   <f1> (Hold down CTRL and press h)

-- 
Kevin Rodgers
Denver, Colorado, USA





^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: C-h, F1, Backspace, and splash screen
  2009-05-29  1:32         ` Stefan Monnier
  2009-05-29  4:17           ` Kevin Rodgers
@ 2009-05-29 11:48           ` Ken Brown
  1 sibling, 0 replies; 12+ messages in thread
From: Ken Brown @ 2009-05-29 11:48 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Emacs

On 5/28/2009 9:32 PM, Stefan Monnier wrote:
>> Nevertheless, if you look back at my first post in this thread
>> (http://lists.gnu.org/archive/html/emacs-devel/2009-05/msg00569.html), isn't
>> there a bug in the way startup.el prepares the splash screen?
> 
> Yes, indeed.
> I've just installed the patch below which should address this problem.
> 
> 
>         Stefan
> 
> 
> --- startup.el.~1.530.~	2009-04-28 14:57:44.000000000 -0400
> +++ startup.el	2009-05-28 21:26:50.000000000 -0400
> @@ -1824,6 +1824,11 @@
>  
>    ;; If keys have their default meanings,
>    ;; use precomputed string to save lots of time.
> +  (let ((c-h-accessible
> +         ;; If normal-erase-is-backspace is used on a tty, there's
> +         ;; no way to invoke C-h and you have to use F1 instead.
> +         (or (not (char-table-p keyboard-translate-table))
> +             (eq (aref keyboard-translate-table ?\C-h) ?\C-h))))
>    (if (and (eq (key-binding "\C-h") 'help-command)
>  	   (eq (key-binding "\C-xu") 'advertised-undo)
>  	   (eq (key-binding "\C-x\C-c") 'save-buffers-kill-terminal)
> @@ -1831,34 +1836,33 @@
>  	   (eq (key-binding "\C-hi") 'info)
>  	   (eq (key-binding "\C-hr") 'info-emacs-manual)
>  	   (eq (key-binding "\C-h\C-n") 'view-emacs-news))
> -      (progn
> +        (let ((help (if c-h-accessible "C-h" "<f1>")))
>  	(insert "
> -Get help\t   C-h  (Hold down CTRL and press h)
> +Get help\t   " help "  (Hold down CTRL and press h)
>  ")
>  	(insert-button "Emacs manual"
>  		       'action (lambda (button) (info-emacs-manual))
>  		       'follow-link t)
> -	(insert "	   C-h r\t")
> +          (insert "	   " help " r\t")
>  	(insert-button "Browse manuals"
>  		       'action (lambda (button) (Info-directory))
>  		       'follow-link t)
> -	(insert "\t   C-h i
> +          (insert "\t   " help " i
>  ")
>  	(insert-button "Emacs tutorial"
>  		       'action (lambda (button) (help-with-tutorial))
>  		       'follow-link t)
> -	(insert "	   C-h t\tUndo changes\t   C-x u
> +          (insert "	   " help " t\tUndo changes\t   C-x u
>  ")
>  	(insert-button "Buy manuals"
>  		       'action (lambda (button) (view-order-manuals))
>  		       'follow-link t)
> -	(insert "\t   C-h C-m\tExit Emacs\t   C-x C-c"))
> +          (insert "\t   " help " C-m\tExit Emacs\t   C-x C-c"))
>  
>      (insert (format "
>  Get help\t   %s
>  "
> -		    (let ((where (where-is-internal
> -				  'help-command nil t)))
> +                      (let ((where (where-is-internal 'help-command nil t)))
>  		      (if where
>  			  (key-description where)
>  			"M-x help"))))
> @@ -1881,7 +1885,7 @@
>  		   'action (lambda (button) (view-order-manuals))
>  		   'follow-link t)
>      (insert (substitute-command-keys
> -	     "\t   \\[view-order-manuals]\tExit Emacs\t   \\[save-buffers-kill-terminal]")))
> +	       "\t   \\[view-order-manuals]\tExit Emacs\t   \\[save-buffers-kill-terminal]"))))
>  
>    ;; Say how to use the menu bar with the keyboard.
>    (insert "\n")

This doesn't work for me.  I start emacs in a tty in which the Backspace 
key sends ^H, but the splash screen still says that C-h is the help key. 
  Could this be a timing issue?  I see that startup.el calls 
(normal-erase-is-backspace-setup-frame), which I would think should take 
care of the timing.

Ken





^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: C-h, F1, Backspace, and splash screen
  2009-05-28 23:06       ` Ken Brown
@ 2009-05-29 14:23         ` Rupert Swarbrick
  2009-05-29 22:07           ` David Robinow
  0 siblings, 1 reply; 12+ messages in thread
From: Rupert Swarbrick @ 2009-05-29 14:23 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 506 bytes --]


>>  If you have cygwin, you have Windows.
>>  If you have Windows, use the native Emacs.
>
> This is a matter of personal preference.  For the kinds of things that
> I do, I find it more convenient to use cygwin emacs.

An example: using slime + sbcl on Windows. Works _much_ better running
sbcl from cygwin, but then native slime passes all the wrong pathnames
etc. and sbcl gets very confused unless you use the cygwin emacs.

Presumably interacting with other cygwin utilities works similarly.

Rupert

[-- Attachment #2: Type: application/pgp-signature, Size: 314 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: C-h, F1, Backspace, and splash screen
  2009-05-29 14:23         ` Rupert Swarbrick
@ 2009-05-29 22:07           ` David Robinow
  0 siblings, 0 replies; 12+ messages in thread
From: David Robinow @ 2009-05-29 22:07 UTC (permalink / raw)
  To: emacs-devel

On Fri, May 29, 2009 at 10:23 AM, Rupert Swarbrick <rswarbrick@gmail.com> wrote:
>
>>>  If you have cygwin, you have Windows.
>>>  If you have Windows, use the native Emacs.
>>
>> This is a matter of personal preference.  For the kinds of things that
>> I do, I find it more convenient to use cygwin emacs.
>
> An example: using slime + sbcl on Windows. Works _much_ better running
> sbcl from cygwin, but then native slime passes all the wrong pathnames
> etc. and sbcl gets very confused unless you use the cygwin emacs.
>
> Presumably interacting with other cygwin utilities works similarly.
>
> Rupert
>
Yikes, you've reminded me that I've actually used cygwin emacs for
just that reason.
Old age must be causing memory failure.
I take back everything bad I've ever said about cygwin emacs.




^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2009-05-29 22:07 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-28 16:26 C-h, F1, Backspace, and splash screen Ken Brown
2009-05-28 18:22 ` Stefan Monnier
2009-05-28 18:34   ` Ken Brown
2009-05-28 21:01     ` Stefan Monnier
2009-05-28 21:19       ` Ken Brown
2009-05-29  1:32         ` Stefan Monnier
2009-05-29  4:17           ` Kevin Rodgers
2009-05-29 11:48           ` Ken Brown
2009-05-28 22:44     ` David Robinow
2009-05-28 23:06       ` Ken Brown
2009-05-29 14:23         ` Rupert Swarbrick
2009-05-29 22:07           ` David Robinow

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).