unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Improved help from minibuffer prompts
@ 2004-04-13  6:26 Stefan Reichör
  2004-04-13  6:57 ` Miles Bader
                   ` (2 more replies)
  0 siblings, 3 replies; 59+ messages in thread
From: Stefan Reichör @ 2004-04-13  6:26 UTC (permalink / raw)


Hi!

I am currently working on xtla.el (the arch interface for emacs).

In my mode the user is often asked some questions in the
minibuffer. Sometimes the questions need some more
explanations. So I decided to put the needed help in the
function's docstring.

The user can ask emacs for the documentation by hitting f1 in the
minibuffer prompt.

I think the idea could be nice for emacs as well.

Here is the relevant code from xtla.el:

(defun xtla-display-command-help (command &optional current-prompt)
  (save-excursion
    (other-window -1)
    (let ((cmd-help (when (fboundp command) 
		      (documentation command))))
      (with-current-buffer (get-buffer-create "*xtla-command-help*")
        (delete-region (point-min) (point-max))
        (insert (if cmd-help
                    (format "Help for %S:\n%s" command cmd-help)
                  (format "No help available for %S" command)))))
    (Electric-pop-up-window "*xtla-command-help*")
    (resize-temp-buffer-window)
    (other-window 1)))

(define-key minibuffer-local-map [f1] 'xtla-show-command-help)
(define-key minibuffer-local-completion-map [f1] 'xtla-show-command-help)
(define-key minibuffer-local-must-match-map [f1] 'xtla-show-command-help)

(defvar xtla-command-stack nil)
(defun xtla-minibuffer-setup ()
  (push  this-command xtla-command-stack))
(add-hook 'minibuffer-setup-hook 'xtla-minibuffer-setup)

(defun xtla-minibuffer-exit ()
  (pop xtla-command-stack))
(add-hook 'minibuffer-exit-hook 'xtla-minibuffer-exit)

(defun xtla-show-command-help ()
  (interactive)
  (xtla-display-command-help (car xtla-command-stack) 
			     (minibuffer-prompt)))


Now you can hit f1 when a minibuffer prompt is displayed and you get
the function's docstring.

I like this functionality very much - and I think it would be worth to
be added to the core emacs.

What do you think?

-- 
  Stefan.

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

end of thread, other threads:[~2004-05-09  2:03 UTC | newest]

Thread overview: 59+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-13  6:26 Improved help from minibuffer prompts Stefan Reichör
2004-04-13  6:57 ` Miles Bader
2004-04-13 10:48   ` Stefan Reichör
2004-04-14  1:22     ` Miles Bader
2004-04-14  5:35       ` Stefan Reichör
2004-04-14  6:49         ` Miles Bader
2004-04-14 10:04           ` Kim F. Storm
2004-04-14 10:39             ` Stefan Reichör
2004-04-15 16:44               ` Richard Stallman
2004-04-16  6:15                 ` Stefan Reichör
2004-04-16 10:04                   ` Kim F. Storm
2004-04-16 13:12                   ` Kai Grossjohann
2004-04-14 22:53           ` Richard Stallman
2004-04-15  1:23             ` Kim F. Storm
2004-04-16 18:08               ` Richard Stallman
2004-04-14  3:43   ` Masatake YAMATO
2004-04-14 18:02   ` Richard Stallman
2004-04-14 18:02 ` Richard Stallman
2004-04-15  5:50   ` Stefan Reichör
2004-04-16 18:07     ` Richard Stallman
2004-04-16 21:55       ` Kim F. Storm
2004-04-17 19:47         ` Richard Stallman
2004-04-19  7:51           ` Stefan Reichör
2004-04-19 11:50             ` Kim F. Storm
2004-04-29 23:48               ` Juanma Barranquero
2004-04-30  5:32                 ` Stefan Reichör
2004-04-30  9:07                   ` Juanma Barranquero
2004-05-01 17:51                     ` Richard Stallman
2004-05-01 18:33                       ` Juanma Barranquero
2004-05-02 19:52                         ` Richard Stallman
2004-05-02 22:45                           ` Juanma Barranquero
2004-05-03 22:20                             ` Richard Stallman
2004-05-06  1:08                           ` Juanma Barranquero
2004-05-06 14:13                             ` Stefan Monnier
2004-05-07  1:11                               ` Juanma Barranquero
2004-05-09  2:03                               ` Juanma Barranquero
2004-05-07  0:29                             ` Richard Stallman
2004-04-30 10:08                 ` Kim F. Storm
2004-04-30 13:39                   ` Juanma Barranquero
2004-04-30 15:50                     ` Kim F. Storm
2004-04-30 22:20                       ` Juanma Barranquero
2004-04-30 15:57                     ` Stefan Monnier
2004-04-30 21:28                       ` Juanma Barranquero
2004-04-30 22:49                         ` Stefan Monnier
2004-05-01  2:17                           ` Juanma Barranquero
2004-05-01 20:23                             ` Stefan Monnier
2004-05-02  1:52                               ` Juanma Barranquero
2004-05-04  0:32                                 ` Juanma Barranquero
2004-05-04 20:07                                   ` Richard Stallman
2004-05-04 22:52                                     ` Juanma Barranquero
2004-04-19 17:32             ` Drew Adams
2004-04-20 20:47               ` Richard Stallman
2004-04-20 23:13                 ` Drew Adams
2004-04-21  6:25                   ` Eli Zaretskii
2004-04-19 18:20             ` Richard Stallman
2004-04-16 18:07     ` Richard Stallman
2004-04-15 11:42 ` Matthew Mundell
2004-04-16  6:05   ` Stefan Reichör
2004-04-18 21:47   ` Richard Stallman

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