emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Suggestions for the temporary windows used from the minibuffer


From: Lennart Borgman
Subject: Re: Suggestions for the temporary windows used from the minibuffer
Date: Sun, 07 Aug 2005 01:03:33 +0200
User-agent: Mozilla Thunderbird 1.0.6 (Windows/20050716)

Richard M. Stallman wrote:

   It does not work for C-h ?. Maybe that is the only important case though.

That is handled by very special code.  Would you like to implement
C-M-v in it?
Attached is a patch for help.el and help-macro.el (from lisp directory). I tried to honor all current bindings to scroll-other-window(-down) and also added <prior>/<next>.

I have called <prior>/<next> for Page Up/Down which I think most new users will recognize.
Index: help.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/help.el,v
retrieving revision 1.283
diff -u -r1.283 help.el
--- help.el     4 Jul 2005 23:08:54 -0000       1.283
+++ help.el     6 Aug 2005 22:56:45 -0000
@@ -186,7 +186,7 @@
 (make-help-screen help-for-help-internal
   "a b c C e f F i I k C-k l L m p s t v w C-c C-d C-f C-n C-p C-t C-w . or ? 
:"
   "You have typed %THIS-KEY%, the help character.  Type a Help option:
-\(Use SPC or DEL to scroll through this text.  Type \\<help-map>\\[help-quit] 
to exit the Help command.)
+\(Use Page Up/Down to scroll through this text.  Type 
\\<help-map>\\[help-quit] to exit the Help command.)
 
 a  command-apropos.  Give a substring, and see a list of commands
        (functions that are interactively callable) that contain
Index: help-macro.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/help-macro.el,v
retrieving revision 1.33
diff -u -r1.33 help-macro.el
--- help-macro.el       4 Jul 2005 23:08:54 -0000       1.33
+++ help-macro.el       6 Aug 2005 22:56:53 -0000
@@ -1,6 +1,7 @@
 ;;; help-macro.el --- makes command line help such as help-for-help
 
-;; Copyright (C) 1993, 1994 Free Software Foundation, Inc.
+;; Copyright (C) 1993, 1994, 2002, 2003, 2004,
+;;   2005 Free Software Foundation, Inc.
 
 ;; Author: Lynn Slater <address@hidden>
 ;; Maintainer: FSF
@@ -104,6 +105,11 @@
                    ;; sections, *excluding* where we switch buffers
                    ;; and where we execute the chosen help command.
                    (local-map (make-sparse-keymap))
+                    ;; Some keys should still be available
+                    (still-map (make-sparse-keymap))
+                    (still-lst (list '(scroll-other-window-down . scroll-down)
+                                     '(scroll-other-window      . scroll-up)))
+                    still-cmd
                    (minor-mode-map-alist nil)
                    (prev-frame (selected-frame))
                    config new-frame key char)
@@ -111,6 +117,16 @@
                   (setq help-screen
                         (replace-match (key-description (substring 
(this-command-keys) 0 -1))
                                        t t help-screen)))
+               (mapc (lambda (elt)
+                       (let ((new (if (consp elt) (cdr elt) elt))
+                             (orig   (if (consp elt) (car elt) elt)))
+                         (mapc (lambda (key)
+                                 (define-key still-map key new))
+                               (where-is-internal orig))))
+                     still-lst)
+               ;; Maybe it is good for new users with just next/prior?
+               (define-key still-map [(next)]  'scroll-up)
+               (define-key still-map [(prior)] 'scroll-down)
               (unwind-protect
                   (progn
                     (setcdr local-map ,helped-map)
@@ -145,7 +161,8 @@
                           (while (or (memq char (append help-event-list
                                                         (cons help-char '(?? 
?\C-v ?\s ?\177 delete backspace vertical-scroll-bar ?\M-v))))
                                      (eq (car-safe char) 'switch-frame)
-                                     (equal key "\M-v"))
+                                     (equal key "\M-v")
+                                      still-cmd)
                             (condition-case nil
                                 (progn
                                   (if (eq (car-safe char) 'switch-frame)
@@ -160,12 +177,23 @@
                             (let ((cursor-in-echo-area t)
                                   (overriding-local-map local-map))
                               (setq key (read-key-sequence
-                                         (format "Type one of the options 
listed%s: "
-                                                 (if (pos-visible-in-window-p
-                                                      (point-max))
-                                                     "" ", or SPACE or DEL to 
scroll")))
-                                    char (aref key 0)))
-
+                                         (format "Type one of the options 
listed, or %s: "
+                                                 (if (pos-visible-in-window-p 
(point-max))
+                                                     "Page Up"
+                                                    (if 
(pos-visible-in-window-p (point-min))
+                                                        "Page Down"
+                                                      "or Page Up/Down to 
scroll"))))
+                                     char (aref key 0)))
+                             
+                             ;; If this is one of the commands we still should 
run then run it.
+                             (setq still-cmd (lookup-key still-map key))
+                             (when still-cmd
+                               (let ((cmd (assq still-cmd still-lst)))
+                                 (unless cmd (setq cmd still-cmd))
+                                 (condition-case nil
+                                     (command-execute cmd nil key)
+                                   (error nil))))
+                             
                             ;; If this is a scroll bar command, just run it.
                             (when (eq char 'vertical-scroll-bar)
                               (command-execute (lookup-key local-map key) nil 
key)))))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]