- (progn
- (setq config (current-window-configuration))
- (switch-to-buffer-other-window "*Help*")
- (and (fboundp 'make-frame)
- (not (eq (window-frame (selected-window))
- prev-frame))
- (setq new-frame (window-frame (selected-window))
- config nil))
- (setq buffer-read-only nil)
- (let ((inhibit-read-only t))
- (erase-buffer)
- (insert help-screen))
- (help-mode)
- (goto-char (point-min))
- (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"))
- (condition-case nil
- (progn
- (if (eq (car-safe char) 'switch-frame)
- (handle-switch-frame char))
- (if (memq char '(?\C-v ?\s))
- (scroll-up))
- (if (or (memq char '(?\177 ?\M-v
- delete backspace))
- (equal key "\M-v"))
- (scroll-down)))
- (error nil))
- (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)))
-
- ;; 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)))))
- ;; We don't need the prompt any more.
- (message "")
- ;; Mouse clicks are not part of the help feature,
- ;; so reexecute them in the standard environment.
- (if (listp char)
- (setq unread-command-events
- (cons char unread-command-events)
- config nil)
- (let ((defn (lookup-key local-map key)))
- (if defn
- (progn
- (if config
- (progn
- (set-window-configuration config)
- (setq config nil)))
- (if new-frame
- (progn (iconify-frame new-frame)
- (setq new-frame nil)))
- (call-interactively defn))
- (ding)))))
- (if new-frame (iconify-frame new-frame))
- (if config
- (set-window-configuration config))))))
- )))
+ (setq config (current-window-configuration))
+ (switch-to-buffer-other-window "*Help*")
+ (and (fboundp 'make-frame)
+ (not (eq (window-frame (selected-window))
+ prev-frame))
+ (setq new-frame (window-frame (selected-window))
+ config nil))
+ (setq buffer-read-only nil)
+ (let ((inhibit-read-only t))
+ (erase-buffer)
+ (insert help-screen))
+ (let ((minor-mode-map-alist new-minor-mode-map-alist))
+ (help-mode)
+ (setq new-minor-mode-map-alist minor-mode-map-alist))
+ (goto-char (point-min))
+ (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"))
+ (condition-case nil
+ (cond
+ ((eq (car-safe char) 'switch-frame)
+ (handle-switch-frame char))
+ ((memq char '(?\C-v ?\s))
+ (scroll-up))
+ ((or (memq char '(?\177 ?\M-v delete backspace))
+ (equal key "\M-v"))
+ (scroll-down)))
+ (error nil))
+ (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)))
+
+ ;; 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))))
+ ;; We don't need the prompt any more.
+ (message "")
+ ;; Mouse clicks are not part of the help feature,
+ ;; so reexecute them in the standard environment.
+ (if (listp char)
+ (setq unread-command-events
+ (cons char unread-command-events)
+ config nil)
+ (let ((defn (lookup-key local-map key)))
+ (if defn
+ (progn
+ (when config
+ (set-window-configuration config)
+ (setq config nil))
+ ;; `defn' must make sure that its frame is
+ ;; selected, so we won't iconify it below.
+ (call-interactively defn)
+ (when new-frame
+ ;; Do not iconify the selected frame.
+ (unless (eq new-frame (selected-frame))
+ (iconify-frame new-frame))
+ (setq new-frame nil)))
+ (ding)))))
+ (when config
+ (set-window-configuration config))
+ (when new-frame
+ (iconify-frame new-frame))
+ (setq minor-mode-map-alist new-minor-mode-map-alist))))))))