From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: =?iso-8859-1?q?Stefan_Reich=F6r?= Newsgroups: gmane.emacs.devel Subject: Improved help from minibuffer prompts Date: Tue, 13 Apr 2004 08:26:11 +0200 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1081837796 14434 80.91.224.253 (13 Apr 2004 06:29:56 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 13 Apr 2004 06:29:56 +0000 (UTC) Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Tue Apr 13 08:29:47 2004 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1BDHQZ-00064K-00 for ; Tue, 13 Apr 2004 08:29:47 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1BDHQY-0003jn-00 for ; Tue, 13 Apr 2004 08:29:47 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.30) id 1BDHQC-00087M-GN for emacs-devel@quimby.gnus.org; Tue, 13 Apr 2004 02:29:24 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30) id 1BDHOo-0007FQ-HY for emacs-devel@gnu.org; Tue, 13 Apr 2004 02:27:58 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30) id 1BDHNQ-0004mO-9s for emacs-devel@gnu.org; Tue, 13 Apr 2004 02:27:06 -0400 Original-Received: from [140.78.161.123] (helo=proxy.riic.at) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.30) id 1BDHNB-0004PT-Ma for emacs-devel@gnu.org; Tue, 13 Apr 2004 02:26:17 -0400 Original-Received: from nanni.riic.uni-linz.ac.at.riic.at (nanni.riic.uni-linz.ac.at [140.78.161.79]) by proxy.riic.at (8.12.7/8.12.7/SuSE Linux 0.6) with ESMTP id i3D6QB8a017337 for ; Tue, 13 Apr 2004 08:26:12 +0200 Original-To: emacs-devel User-Agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (berkeley-unix) X-Virus-Scanned: by AMaViS - amavis-milter (http://www.amavis.org/) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:21552 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:21552 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.