unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] eww-mode-map doesn't bind TAB on tty.
@ 2014-02-28 12:37 Mario Lang
  2014-03-04 19:39 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 12+ messages in thread
From: Mario Lang @ 2014-02-28 12:37 UTC (permalink / raw)
  To: emacs-devel

Hi.

Just built Emacs from trunk to check out eww.
It appears that the usage of [tab] and [backtab] does not work for my
TTY Emacs.  If I replace that with (kbd "TAB") and (kbd "M-TAB")
jumping between links works as expected on TTY Emacs.

--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -412,8 +412,8 @@ word(s) will be searched for via `eww-search-prefix'."
     (suppress-keymap map)
     (define-key map "q" 'quit-window)
     (define-key map "g" 'eww-reload)
-    (define-key map [tab] 'shr-next-link)
-    (define-key map [backtab] 'shr-previous-link)
+    (define-key map (kbd "TAB") 'shr-next-link)
+    (define-key map (kbd "M-TAB") 'shr-previous-link)
     (define-key map [delete] 'scroll-down-command)
     (define-key map [?\S-\ ] 'scroll-down-command)
     (define-key map "\177" 'scroll-down-command)

-- 
CYa,
  ⡍⠁⠗⠊⠕



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

* Re: [PATCH] eww-mode-map doesn't bind TAB on tty.
  2014-02-28 12:37 [PATCH] eww-mode-map doesn't bind TAB on tty Mario Lang
@ 2014-03-04 19:39 ` Lars Ingebrigtsen
  2014-03-04 20:07   ` Eli Zaretskii
  0 siblings, 1 reply; 12+ messages in thread
From: Lars Ingebrigtsen @ 2014-03-04 19:39 UTC (permalink / raw)
  To: Mario Lang; +Cc: emacs-devel

Mario Lang <mlang@delysid.org> writes:

> Just built Emacs from trunk to check out eww.
> It appears that the usage of [tab] and [backtab] does not work for my
> TTY Emacs.  If I replace that with (kbd "TAB") and (kbd "M-TAB")
> jumping between links works as expected on TTY Emacs.

[...]

> -    (define-key map [tab] 'shr-next-link)
> -    (define-key map [backtab] 'shr-previous-link)
> +    (define-key map (kbd "TAB") 'shr-next-link)
> +    (define-key map (kbd "M-TAB") 'shr-previous-link)

Hm.  I don't quite understand the patch.  [tab] should work in Emacs,
also under tty, shouldn't it?  But you're right -- [tab] doesn't work in
this case.

Does anybody know why, and is TAB a special case here?

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/



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

* Re: [PATCH] eww-mode-map doesn't bind TAB on tty.
  2014-03-04 19:39 ` Lars Ingebrigtsen
@ 2014-03-04 20:07   ` Eli Zaretskii
  2014-03-04 20:13     ` Eli Zaretskii
  0 siblings, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2014-03-04 20:07 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: mlang, emacs-devel

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Date: Tue, 04 Mar 2014 20:39:29 +0100
> Cc: emacs-devel@gnu.org
> 
> > -    (define-key map [tab] 'shr-next-link)
> > -    (define-key map [backtab] 'shr-previous-link)
> > +    (define-key map (kbd "TAB") 'shr-next-link)
> > +    (define-key map (kbd "M-TAB") 'shr-previous-link)
> 
> Hm.  I don't quite understand the patch.  [tab] should work in Emacs,
> also under tty, shouldn't it?  But you're right -- [tab] doesn't work in
> this case.
> 
> Does anybody know why, and is TAB a special case here?

[tab] is a function key, not the character TAB.  Try ?\t instead.



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

* Re: [PATCH] eww-mode-map doesn't bind TAB on tty.
  2014-03-04 20:07   ` Eli Zaretskii
@ 2014-03-04 20:13     ` Eli Zaretskii
  2014-03-05 12:39       ` Lars Ingebrigtsen
  0 siblings, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2014-03-04 20:13 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: mlang, larsi, emacs-devel

> Date: Tue, 04 Mar 2014 22:07:49 +0200
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: mlang@delysid.org, emacs-devel@gnu.org
> 
> [tab] is a function key, not the character TAB.  Try ?\t instead.

And [?\M-\t] for backtab.



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

* Re: [PATCH] eww-mode-map doesn't bind TAB on tty.
  2014-03-04 20:13     ` Eli Zaretskii
@ 2014-03-05 12:39       ` Lars Ingebrigtsen
  2014-03-05 15:02         ` Mario Lang
  0 siblings, 1 reply; 12+ messages in thread
From: Lars Ingebrigtsen @ 2014-03-05 12:39 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: mlang, emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

>> [tab] is a function key, not the character TAB.  Try ?\t instead.
>
> And [?\M-\t] for backtab.

Right; thanks.

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/



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

* Re: [PATCH] eww-mode-map doesn't bind TAB on tty.
  2014-03-05 12:39       ` Lars Ingebrigtsen
@ 2014-03-05 15:02         ` Mario Lang
  2014-03-05 17:18           ` Eli Zaretskii
  2014-03-05 18:01           ` Lars Ingebrigtsen
  0 siblings, 2 replies; 12+ messages in thread
From: Mario Lang @ 2014-03-05 15:02 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: emacs-devel

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Eli Zaretskii <eliz@gnu.org> writes:
>
>>> [tab] is a function key, not the character TAB.  Try ?\t instead.
>>
>> And [?\M-\t] for backtab.
>
> Right; thanks.

`eww-text-map', `eww-textarea-map' and `shr-map' likely have the same
problem as `eww-mode-map' used to have:

--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -592,8 +592,8 @@ appears in a <link> or <a> tag."
     (define-key map [(control a)] 'eww-beginning-of-text)
     (define-key map [(control c) (control c)] 'eww-submit)
     (define-key map [(control e)] 'eww-end-of-text)
-    (define-key map [tab] 'shr-next-link)
-    (define-key map [backtab] 'shr-previous-link)
+    (define-key map [?\t] 'shr-next-link)
+    (define-key map [?\M-\t] 'shr-previous-link)
     map))
 
 (defvar eww-textarea-map
@@ -601,8 +601,8 @@ appears in a <link> or <a> tag."
     (set-keymap-parent map text-mode-map)
     (define-key map "\r" 'forward-line)
     (define-key map [(control c) (control c)] 'eww-submit)
-    (define-key map [tab] 'shr-next-link)
-    (define-key map [backtab] 'shr-previous-link)
+    (define-key map [?\t] 'shr-next-link)
+    (define-key map [?\M-\t] 'shr-previous-link)
     map))
 
 (defvar eww-select-map
--- a/lisp/net/shr.el
+++ b/lisp/net/shr.el
@@ -147,8 +147,8 @@ cid: URL as the argument.")
     (define-key map "a" 'shr-show-alt-text)
     (define-key map "i" 'shr-browse-image)
     (define-key map "z" 'shr-zoom-image)
-    (define-key map [tab] 'shr-next-link)
-    (define-key map [backtab] 'shr-previous-link)
+    (define-key map [?\t] 'shr-next-link)
+    (define-key map [?\M-\t] 'shr-previous-link)
     (define-key map [follow-link] 'mouse-face)
     (define-key map [mouse-2] 'shr-browse-url)
     (define-key map "I" 'shr-insert-image)


And here is the result of grepping for the pattern in all Emacs Lisp files:

lisp/calendar/todo-mode.el:    (define-key map [tab] 'todo-next-button)
lisp/eshell/em-cmpl.el:  (define-key eshell-command-map [tab] 'pcomplete-expand-and-complete)
lisp/eshell/em-cmpl.el:  (define-key eshell-mode-map [tab] 'eshell-pcomplete)
lisp/gnus/gnus-html.el:    (define-key map [tab] 'widget-forward)
lisp/image-dired.el:  (define-key image-dired-thumbnail-mode-map [tab] 'image-dired-jump-original-dired-buffer)
lisp/image-dired.el:  (define-key dired-mode-map [tab] 'image-dired-jump-thumbnail-buffer)
lisp/international/quail.el:    (define-key map [tab] 'quail-completion)
lisp/kmacro.el:    (define-key map [tab] 'act-repeat)
lisp/play/5x5.el:    (define-key map [tab]                     #'5x5-right)

-- 
CYa,
  ⡍⠁⠗⠊⠕



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

* Re: [PATCH] eww-mode-map doesn't bind TAB on tty.
  2014-03-05 15:02         ` Mario Lang
@ 2014-03-05 17:18           ` Eli Zaretskii
  2014-03-05 18:01           ` Lars Ingebrigtsen
  1 sibling, 0 replies; 12+ messages in thread
From: Eli Zaretskii @ 2014-03-05 17:18 UTC (permalink / raw)
  To: Mario Lang; +Cc: larsi, emacs-devel

> From: Mario Lang <mlang@delysid.org>
> Date: Wed, 05 Mar 2014 16:02:54 +0100
> Cc: emacs-devel@gnu.org
> 
> And here is the result of grepping for the pattern in all Emacs Lisp files:
> 
> lisp/calendar/todo-mode.el:    (define-key map [tab] 'todo-next-button)
> lisp/eshell/em-cmpl.el:  (define-key eshell-command-map [tab] 'pcomplete-expand-and-complete)
> lisp/eshell/em-cmpl.el:  (define-key eshell-mode-map [tab] 'eshell-pcomplete)
> lisp/gnus/gnus-html.el:    (define-key map [tab] 'widget-forward)
> lisp/image-dired.el:  (define-key image-dired-thumbnail-mode-map [tab] 'image-dired-jump-original-dired-buffer)
> lisp/image-dired.el:  (define-key dired-mode-map [tab] 'image-dired-jump-thumbnail-buffer)
> lisp/international/quail.el:    (define-key map [tab] 'quail-completion)
> lisp/kmacro.el:    (define-key map [tab] 'act-repeat)
> lisp/play/5x5.el:    (define-key map [tab]                     #'5x5-right)

Thanks for the footwork.  I think image-dired is the only one that
might not need changing, because thumbnails are only supported on GUI
terminals which do have TAB as a function key.



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

* Re: [PATCH] eww-mode-map doesn't bind TAB on tty.
  2014-03-05 15:02         ` Mario Lang
  2014-03-05 17:18           ` Eli Zaretskii
@ 2014-03-05 18:01           ` Lars Ingebrigtsen
  2014-03-05 18:10             ` Lars Ingebrigtsen
  1 sibling, 1 reply; 12+ messages in thread
From: Lars Ingebrigtsen @ 2014-03-05 18:01 UTC (permalink / raw)
  To: Mario Lang; +Cc: emacs-devel

Mario Lang <mlang@delysid.org> writes:

> And here is the result of grepping for the pattern in all Emacs Lisp files:

Thanks; I'll replace all those (except the image-dired one)...

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/



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

* Re: [PATCH] eww-mode-map doesn't bind TAB on tty.
  2014-03-05 18:01           ` Lars Ingebrigtsen
@ 2014-03-05 18:10             ` Lars Ingebrigtsen
  2014-03-05 18:37               ` Eli Zaretskii
  0 siblings, 1 reply; 12+ messages in thread
From: Lars Ingebrigtsen @ 2014-03-05 18:10 UTC (permalink / raw)
  To: emacs-devel

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Mario Lang <mlang@delysid.org> writes:
>
>> And here is the result of grepping for the pattern in all Emacs Lisp files:
>
> Thanks; I'll replace all those (except the image-dired one)...

Actually...  before I do that...

Some modes define both [?\M-\t] (or "\e\t"), which are the same thing, I
think, as well as [backtab].  Same for [tab].  Like:

    (define-key map "\t" 'widget-forward)
    (define-key map "\e\t" 'widget-backward)
    (define-key map [(shift tab)] 'widget-backward)
    (put 'widget-backward :advertised-binding [(shift tab)])
    (define-key map [backtab] 'widget-backward)

Are there situations where just removing the latter binding is wrong?
I.e., is there a difference between [?\M-\t] and [backtab] that should
be preserved?

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/



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

* Re: [PATCH] eww-mode-map doesn't bind TAB on tty.
  2014-03-05 18:10             ` Lars Ingebrigtsen
@ 2014-03-05 18:37               ` Eli Zaretskii
  2014-03-05 18:39                 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2014-03-05 18:37 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: emacs-devel

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Date: Wed, 05 Mar 2014 19:10:01 +0100
> 
>     (define-key map "\t" 'widget-forward)
>     (define-key map "\e\t" 'widget-backward)
>     (define-key map [(shift tab)] 'widget-backward)
>     (put 'widget-backward :advertised-binding [(shift tab)])
>     (define-key map [backtab] 'widget-backward)
> 
> Are there situations where just removing the latter binding is wrong?
> I.e., is there a difference between [?\M-\t] and [backtab] that should
> be preserved?

If both are present, I don't think you should delete one of them.
E.g., some terminal might define an escape sequence to [backtab].



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

* Re: [PATCH] eww-mode-map doesn't bind TAB on tty.
  2014-03-05 18:37               ` Eli Zaretskii
@ 2014-03-05 18:39                 ` Lars Ingebrigtsen
  2014-03-07 20:12                   ` Stefan Monnier
  0 siblings, 1 reply; 12+ messages in thread
From: Lars Ingebrigtsen @ 2014-03-05 18:39 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Lars Ingebrigtsen <larsi@gnus.org>
>> Date: Wed, 05 Mar 2014 19:10:01 +0100
>> 
>>     (define-key map "\t" 'widget-forward)
>>     (define-key map "\e\t" 'widget-backward)
>>     (define-key map [(shift tab)] 'widget-backward)
>>     (put 'widget-backward :advertised-binding [(shift tab)])
>>     (define-key map [backtab] 'widget-backward)
>> 
>> Are there situations where just removing the latter binding is wrong?
>> I.e., is there a difference between [?\M-\t] and [backtab] that should
>> be preserved?
>
> If both are present, I don't think you should delete one of them.
> E.g., some terminal might define an escape sequence to [backtab].

Hm.  Should we always have two bindings each for [tab] and [backtab],
then?  This all seems kinda inconsistent.

And should perhaps wait until after the feature freeze, anyway.

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/



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

* Re: [PATCH] eww-mode-map doesn't bind TAB on tty.
  2014-03-05 18:39                 ` Lars Ingebrigtsen
@ 2014-03-07 20:12                   ` Stefan Monnier
  0 siblings, 0 replies; 12+ messages in thread
From: Stefan Monnier @ 2014-03-07 20:12 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Eli Zaretskii, emacs-devel

> Hm.  Should we always have two bindings each for [tab] and [backtab],
> then?

No.  We should basically always use just TAB (aka ?\t).  `tab' should
only be used in special cases where it's justified with a comment
explaining why it's needed.


        Stefan



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

end of thread, other threads:[~2014-03-07 20:12 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-28 12:37 [PATCH] eww-mode-map doesn't bind TAB on tty Mario Lang
2014-03-04 19:39 ` Lars Ingebrigtsen
2014-03-04 20:07   ` Eli Zaretskii
2014-03-04 20:13     ` Eli Zaretskii
2014-03-05 12:39       ` Lars Ingebrigtsen
2014-03-05 15:02         ` Mario Lang
2014-03-05 17:18           ` Eli Zaretskii
2014-03-05 18:01           ` Lars Ingebrigtsen
2014-03-05 18:10             ` Lars Ingebrigtsen
2014-03-05 18:37               ` Eli Zaretskii
2014-03-05 18:39                 ` Lars Ingebrigtsen
2014-03-07 20:12                   ` Stefan Monnier

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).