Announcements and discussions for Gnus, the GNU Emacs Usenet newsreader
 help / color / mirror / Atom feed
* overwriting c catchup shortcut in Group buffer
@ 2015-05-10 19:40 Stefan Huchler
  2015-05-10 22:10 ` Emanuel Berg
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Huchler @ 2015-05-10 19:40 UTC (permalink / raw)
  To: info-gnus-english

I try to overwrite the gnus group buffer with some keyboard-shortcuts,
but I dont find the right hook or method to do so.

I want to use direction keys on my home-row instead of the emacs C-f
standard keys or the normal arrow keys and in dvorak the 4 logical keys
under 8 on the right side are c/h/t/n.


(progn
  (defun spiderbit-gnus-group-prepare-setup ()
    "for `gnus-group-prepare'."
    (local-set-key (kbd "c") 'previous-line) 
    (local-set-key (kbd "t") 'next-line)
    (local-set-key (kbd "h") 'backward-char)
    (local-set-key (kbd "n") 'forward-char))
  (add-hook 'gnus-group-prepare-hook
  'spiderbit-gnus-group-prepare-setup))


it worked well with the summary buffer with this hook:

'gnus-summary-mode-hook

but in the Group buffer I cant find the right hook I tried this 3:

'gnus-group-prepare-hook
'gnus-group-menu-hook
'gnus-group-mode-hook

I cant get gnus stop calling the catchup command instead
previous-line. Thanks for your help in advance.



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

* Re: overwriting c catchup shortcut in Group buffer
  2015-05-10 19:40 overwriting c catchup shortcut in Group buffer Stefan Huchler
@ 2015-05-10 22:10 ` Emanuel Berg
  2015-05-10 22:44   ` Stefan Huchler
       [not found]   ` <mailman.2723.1431297892.904.info-gnus-english@gnu.org>
  0 siblings, 2 replies; 7+ messages in thread
From: Emanuel Berg @ 2015-05-10 22:10 UTC (permalink / raw)
  To: info-gnus-english

Stefan Huchler <stefan.huchler@mail.de> writes:

> (progn
>   (defun spiderbit-gnus-group-prepare-setup ()
>     "for `gnus-group-prepare'."
>     (local-set-key (kbd "c") 'previous-line) 
>     (local-set-key (kbd "t") 'next-line)
>     (local-set-key (kbd "h") 'backward-char)
>     (local-set-key (kbd "n") 'forward-char))
>   (add-hook 'gnus-group-prepare-hook
>   'spiderbit-gnus-group-prepare-setup))

Do you have a `progn' here in order to be able to
evaluate it all at once? Otherwise you don't need it.

> gnus-group-prepare-hook
> gnus-group-menu-hook
> gnus-group-mode-hook

Try without using hooks:

    (require 'gnus-group)
    (define-key gnus-group-mode-map "h" 'backward-char)
    ;; (define-key ...

-- 
underground experts united
http://user.it.uu.se/~embe8573



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

* Re: overwriting c catchup shortcut in Group buffer
  2015-05-10 22:10 ` Emanuel Berg
@ 2015-05-10 22:44   ` Stefan Huchler
       [not found]   ` <mailman.2723.1431297892.904.info-gnus-english@gnu.org>
  1 sibling, 0 replies; 7+ messages in thread
From: Stefan Huchler @ 2015-05-10 22:44 UTC (permalink / raw)
  To: info-gnus-english

Emanuel Berg <embe8573@student.uu.se> writes:

> Stefan Huchler <stefan.huchler@mail.de> writes:
>
>> (progn
>>   (defun spiderbit-gnus-group-prepare-setup ()
>>     "for `gnus-group-prepare'."
>>     (local-set-key (kbd "c") 'previous-line) 
>>     (local-set-key (kbd "t") 'next-line)
>>     (local-set-key (kbd "h") 'backward-char)
>>     (local-set-key (kbd "n") 'forward-char))
>>   (add-hook 'gnus-group-prepare-hook
>>   'spiderbit-gnus-group-prepare-setup))
>
> Do you have a `progn' here in order to be able to
> evaluate it all at once? Otherwise you don't need it.


I am using the package here:

https://github.com/xahlee/xah-fly-keys

the author told me that he handles mode specific overwrites in that
file:

https://github.com/xahlee/xah-fly-keys/blob/master/xah-fly-keys-mode-specific.el

he used there much progn so I did the same, no special choice from me.



>> gnus-group-prepare-hook
>> gnus-group-menu-hook
>> gnus-group-mode-hook
>
> Try without using hooks:
>
>     (require 'gnus-group)
>     (define-key gnus-group-mode-map "h" 'backward-char)
>     ;; (define-key ...


I did try it this way did not work too: I added your suggested blog to
this mode specific file mentioned above and evaluated it.


(progn
  (require 'gnus-group)
  (define-key gnus-group-mode-map (kbd "c") 'previous-line) 
  (define-key gnus-group-mode-map (kbd "t") 'next-line)
  (define-key gnus-group-mode-map (kbd "h") 'backward-char)
  (define-key gnus-group-mode-map (kbd "n") 'forward-char)
  )




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

* Re: overwriting c catchup shortcut in Group buffer
       [not found]   ` <mailman.2723.1431297892.904.info-gnus-english@gnu.org>
@ 2015-05-10 23:00     ` Emanuel Berg
  2015-05-10 23:21       ` Stefan Huchler
       [not found]       ` <mailman.2726.1431300114.904.info-gnus-english@gnu.org>
  0 siblings, 2 replies; 7+ messages in thread
From: Emanuel Berg @ 2015-05-10 23:00 UTC (permalink / raw)
  To: info-gnus-english

Stefan Huchler <stefan.huchler@mail.de> writes:

> he used there much progn so I did the same, no
> special choice from me.

You don't need a progn there save for if you change
the defun and would like to evaluate the whole thing
once which would include updating the hook. So it has
no meaning save for ergonomics which is a good meaning
but only if you were to change this frequently, which
of course can be the case.

>> Try without using hooks:
>>
>> (require 'gnus-group)
>> (define-key gnus-group-mode-map "h" 'backward-char)
>> ;; (define-key ...
>
> I did try it this way did not work too: I added your
> suggested blog to this mode specific file mentioned
> above and evaluated it.

It works for me, so perhaps your mode, whatever it is,
resets the keymap after that?

> (progn (require 'gnus-group) (define-key
> gnus-group-mode-map (kbd "c") 'previous-line)
> (define-key gnus-group-mode-map (kbd "t") 'next-line)
> (define-key gnus-group-mode-map (kbd "h")
> 'backward-char) (define-key gnus-group-mode-map (kbd
> "n") 'forward-char) )

You don't need the progn and you only need to require
gnus-group once. I never bothered with `kbd' but
perhaps there is some subtle advantage. But regardless
of whatever that should work, so the only reason I can
see it doesn't is you have some other goofy
stuff interfering.

-- 
underground experts united
http://user.it.uu.se/~embe8573

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

* Re: overwriting c catchup shortcut in Group buffer
  2015-05-10 23:00     ` Emanuel Berg
@ 2015-05-10 23:21       ` Stefan Huchler
       [not found]       ` <mailman.2726.1431300114.904.info-gnus-english@gnu.org>
  1 sibling, 0 replies; 7+ messages in thread
From: Stefan Huchler @ 2015-05-10 23:21 UTC (permalink / raw)
  To: info-gnus-english

Emanuel Berg <embe8573@student.uu.se> writes:

> but only if you were to change this frequently, which
> of course can be the case.

fly-keys is a modal mode you have a key to activate it and one to
deactivate it, in other modes you can type the letter c as example, and
in command mode you use it for previous-line.

So I think there is your frequent change?

> It works for me, so perhaps your mode, whatever it is,
> resets the keymap after that?

ok then I add that to the bugtracker to the author or fly-keys, just
wondered why it did work for Summary mode so I thought I just picked the
wrong hook map.




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

* Re: overwriting c catchup shortcut in Group buffer
       [not found]       ` <mailman.2726.1431300114.904.info-gnus-english@gnu.org>
@ 2015-05-11  0:00         ` Emanuel Berg
  2015-05-23  0:41           ` Stefan Huchler
  0 siblings, 1 reply; 7+ messages in thread
From: Emanuel Berg @ 2015-05-11  0:00 UTC (permalink / raw)
  To: info-gnus-english

Stefan Huchler <stefan.huchler@mail.de> writes:

> fly-keys is a modal mode you have a key to activate
> it and one to deactivate it, in other modes you can
> type the letter c as example, and in command mode
> you use it for previous-line.
>
> So I think there is your frequent change?

I mean if you were to frequently edit the code and
thus there would be a need to (re)evaluate it, you
would save some keystrokes by putting the hook updater
(add-hook) and the defun (i.e. the to-be definition of
the hook) in the same construct (the progn) so it
would only take one evaluation to do both. But it is
unrelated to this issue, it doesn't matter if there is
a progn there or not as for the behavior of the
software in execution...

>> It works for me, so perhaps your mode, whatever it
>> is, resets the keymap after that?
>
> ok then I add that to the bugtracker to the author
> or fly-keys, just wondered why it did work for
> Summary mode so I thought I just picked the wrong
> hook map.

I don't see why you should need hooks to set keys for
stuff that you use everyday and this `require' at
initialization and do not have loaded on-the-fly at
invocation time of some related command.

I do this for Gnus group, summary, and article modes.
`require' and then set the keymap.

If it is done in hooks, that means the same thing
would be evaluated many, many times an Emacs session.
Much better to load it, then set it, and then keep the
settings happily ever after.

Does it work without that mode? I don't see why it
shouldn't. You can also examine all the hooks of the
mode. Is there something *else* there that overrides
the desired settings?

-- 
underground experts united
http://user.it.uu.se/~embe8573

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

* Re: overwriting c catchup shortcut in Group buffer
  2015-05-11  0:00         ` Emanuel Berg
@ 2015-05-23  0:41           ` Stefan Huchler
  0 siblings, 0 replies; 7+ messages in thread
From: Stefan Huchler @ 2015-05-23  0:41 UTC (permalink / raw)
  To: info-gnus-english

so a few days I found out what the problem was, I have activated
topic-mode that shadows the gnus-group-mode-map and I had to override
the gnus-topic-mode-map instead:

  (define-key gnus-topic-mode-map (kbd "c") 'previous-line)



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

end of thread, other threads:[~2015-05-23  0:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-10 19:40 overwriting c catchup shortcut in Group buffer Stefan Huchler
2015-05-10 22:10 ` Emanuel Berg
2015-05-10 22:44   ` Stefan Huchler
     [not found]   ` <mailman.2723.1431297892.904.info-gnus-english@gnu.org>
2015-05-10 23:00     ` Emanuel Berg
2015-05-10 23:21       ` Stefan Huchler
     [not found]       ` <mailman.2726.1431300114.904.info-gnus-english@gnu.org>
2015-05-11  0:00         ` Emanuel Berg
2015-05-23  0:41           ` Stefan Huchler

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 NNTP newsgroup(s).