unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Setting key bindings in view-mode-hook
@ 2005-11-27  3:26 Bill Wohler
  2005-11-27 16:57 ` Drew Adams
  2005-11-27 19:36 ` Richard M. Stallman
  0 siblings, 2 replies; 7+ messages in thread
From: Bill Wohler @ 2005-11-27  3:26 UTC (permalink / raw)


I'd like to bind "q" in `view-mode' to `View-kill-and-leave'.

I customized view-mode-hook with

  (lambda nil (local-set-key "q" (quote View-kill-and-leave)))

However, "C-h c q" in a buffer in view mode still shows View-quit.

What gives? How come my setting isn't honored?

This is in recent CVS snapshot of Emacs 22, but a quick check reveals
that this Emacs 21 shows the same behavior.

-- 
Bill Wohler <wohler@newt.com>  http://www.newt.com/wohler/  GnuPG ID:610BD9AD
Maintainer of comp.mail.mh FAQ and MH-E. Vote Libertarian!
If you're passed on the right, you're in the wrong lane.

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

* RE: Setting key bindings in view-mode-hook
  2005-11-27  3:26 Setting key bindings in view-mode-hook Bill Wohler
@ 2005-11-27 16:57 ` Drew Adams
  2005-11-27 19:03   ` Bill Wohler
  2005-11-27 19:36 ` Richard M. Stallman
  1 sibling, 1 reply; 7+ messages in thread
From: Drew Adams @ 2005-11-27 16:57 UTC (permalink / raw)


    I'd like to bind "q" in `view-mode' to `View-kill-and-leave'.
    I customized view-mode-hook with

      (lambda nil (local-set-key "q" (quote View-kill-and-leave)))

    However, "C-h c q" in a buffer in view mode still shows View-quit.
    What gives? How come my setting isn't honored?
    This is in recent CVS snapshot of Emacs 22, but a quick check reveals
    that this Emacs 21 shows the same behavior.

It might help (I don't know) to look at my messages of 9/8/2005 and
9/9/2005, subject "quitting help buffer" (which are really about quitting
view-mode).

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

* Re: Setting key bindings in view-mode-hook
  2005-11-27 16:57 ` Drew Adams
@ 2005-11-27 19:03   ` Bill Wohler
  0 siblings, 0 replies; 7+ messages in thread
From: Bill Wohler @ 2005-11-27 19:03 UTC (permalink / raw)


"Drew Adams" <drew.adams@oracle.com> writes:

>     I'd like to bind "q" in `view-mode' to `View-kill-and-leave'.
>     I customized view-mode-hook with
>
>       (lambda nil (local-set-key "q" (quote View-kill-and-leave)))
>
>     However, "C-h c q" in a buffer in view mode still shows View-quit.
>     What gives? How come my setting isn't honored?
>     This is in recent CVS snapshot of Emacs 22, but a quick check reveals
>     that this Emacs 21 shows the same behavior.
>
> It might help (I don't know) to look at my messages of 9/8/2005 and
> 9/9/2005, subject "quitting help buffer" (which are really about quitting
> view-mode).

Thanks. It helps since misery loves company.

> But that is not the behavior I get. For me, it iconifies the frame. And, in
> some (rarer) cases, it leaves the frame displayed (no change): `q' does
> nothing at all in those cases.

I'm not using frames. However, I tried view-file-other-frame and hit
`q'. I expected either the buffer or the frame to go away, but as you
said, it was iconified instead. Ew.

At best, I'd like `q' to kill the *Help* buffer or buffer in
view-mode. At worst, I'd like to bury it. But for me, `q' either does
nothing (maybe after visiting the *Help* buffer), or closes the window
but leaves the *Help* buffer in the #2 spot so a subsequent C-x b
takes me not to the mh-e.texi file that I was expecting but to *Help*.

I find that the use of `C' reliably does what I want (as well as C-x
k, of course). However, my fingers really prefer `q'. I think it's a
bug that I can't bind `q' to View-kill-and-leave.

I agree with you that all those ways of quitting view-mode are silly.
Once you're in view-mode, how you got there is immaterial. I want `q'
to do the same thing whether I ran view-mode manually, whether I'm in
a *Help* buffer, whether I ran `v' from dired, or have view-read-only
turned on. KISS. Perhaps you and I need to come up with recipes that
reliably show what we mean, but I would argue that if the exit path
were more simple, we wouldn't be here in the first place. Rather than
try to find and isolate a small bug, we should redesign and simplify
the exit path.

For example, I think view-mode should take the same design as
customize, in which there is a single function to exit
(Custom-buffer-done), bound to `q', which buries the buffer, unless
the option custom-buffer-done-kill is turned on, in which case the
buffer is killed.

However, I would agree that now is not the time to do this.

My 2c anyway.

-- 
Bill Wohler <wohler@newt.com>  http://www.newt.com/wohler/  GnuPG ID:610BD9AD
Maintainer of comp.mail.mh FAQ and MH-E. Vote Libertarian!
If you're passed on the right, you're in the wrong lane.

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

* Re: Setting key bindings in view-mode-hook
  2005-11-27  3:26 Setting key bindings in view-mode-hook Bill Wohler
  2005-11-27 16:57 ` Drew Adams
@ 2005-11-27 19:36 ` Richard M. Stallman
  2005-11-27 19:49   ` Bill Wohler
  1 sibling, 1 reply; 7+ messages in thread
From: Richard M. Stallman @ 2005-11-27 19:36 UTC (permalink / raw)
  Cc: emacs-devel

    I customized view-mode-hook with

      (lambda nil (local-set-key "q" (quote View-kill-and-leave)))

    However, "C-h c q" in a buffer in view mode still shows View-quit.

You need to bind it in the View mode keymap.
Do C-h b and you will see what I mean.

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

* Re: Setting key bindings in view-mode-hook
  2005-11-27 19:36 ` Richard M. Stallman
@ 2005-11-27 19:49   ` Bill Wohler
  2005-11-28  4:46     ` Richard M. Stallman
  2005-12-01  0:50     ` Drew Adams
  0 siblings, 2 replies; 7+ messages in thread
From: Bill Wohler @ 2005-11-27 19:49 UTC (permalink / raw)
  Cc: emacs-devel

Richard M. Stallman <rms@gnu.org> wrote:

>     I customized view-mode-hook with
> 
>       (lambda nil (local-set-key "q" (quote View-kill-and-leave)))
> 
>     However, "C-h c q" in a buffer in view mode still shows View-quit.
> 
> You need to bind it in the View mode keymap.
> Do C-h b and you will see what I mean.

Thanks. I was under the impression that local-set-key in a foo-mode-hook
DTRT. Does it not work in this case because view-mode is a minor mode?

Is this what you mean? It does the trick.

  (define-key view-mode-map "q" 'View-kill-and-leave)

Would you recommend adding this to:

- top-level in .emacs

- view-mode-hook

- (eval-after-load "view-mode")

-- 
Bill Wohler <wohler@newt.com>  http://www.newt.com/wohler/  GnuPG ID:610BD9AD
Maintainer of comp.mail.mh FAQ and MH-E. Vote Libertarian!
If you're passed on the right, you're in the wrong lane.

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

* Re: Setting key bindings in view-mode-hook
  2005-11-27 19:49   ` Bill Wohler
@ 2005-11-28  4:46     ` Richard M. Stallman
  2005-12-01  0:50     ` Drew Adams
  1 sibling, 0 replies; 7+ messages in thread
From: Richard M. Stallman @ 2005-11-28  4:46 UTC (permalink / raw)
  Cc: emacs-devel

    Would you recommend adding this to:

    - top-level in .emacs

Won't work.

    - view-mode-hook

    - (eval-after-load "view-mode")

Those will work.

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

* RE: Setting key bindings in view-mode-hook
  2005-11-27 19:49   ` Bill Wohler
  2005-11-28  4:46     ` Richard M. Stallman
@ 2005-12-01  0:50     ` Drew Adams
  1 sibling, 0 replies; 7+ messages in thread
From: Drew Adams @ 2005-12-01  0:50 UTC (permalink / raw)


FYI - I just filed a bug for this.  Users should not have to customize Emacs
just to get a view-mode window to go away. This is a very annoying new
"feature".

`q' should not just do nothing; it should delete the frame if it is
one-window-p and it is not the sole frame. Or, at least, it should delete
the window (my delete-window will then delete a one-window frame). That is,
behavior like this should be the default behavior - quitting view mode
should get rid of the window, by default.

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

end of thread, other threads:[~2005-12-01  0:50 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-11-27  3:26 Setting key bindings in view-mode-hook Bill Wohler
2005-11-27 16:57 ` Drew Adams
2005-11-27 19:03   ` Bill Wohler
2005-11-27 19:36 ` Richard M. Stallman
2005-11-27 19:49   ` Bill Wohler
2005-11-28  4:46     ` Richard M. Stallman
2005-12-01  0:50     ` Drew Adams

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