From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Kevin Ryde Newsgroups: gmane.emacs.devel Subject: info-look.el and sh-mode Date: Sat, 29 Mar 2003 10:56:07 +1000 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <87of3vq9co.fsf@zip.com.au> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: main.gmane.org 1048899509 28136 80.91.224.249 (29 Mar 2003 00:58:29 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sat, 29 Mar 2003 00:58:29 +0000 (UTC) Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Sat Mar 29 01:58:27 2003 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18z4fz-0007JS-00 for ; Sat, 29 Mar 2003 01:58:27 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 18z4ia-0002ZG-00 for ; Sat, 29 Mar 2003 02:01:09 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18z4fM-00046D-02 for emacs-devel@quimby.gnus.org; Fri, 28 Mar 2003 19:57:48 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 18z4ea-0003QQ-00 for emacs-devel@gnu.org; Fri, 28 Mar 2003 19:57:00 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 18z4eP-0002ua-00 for emacs-devel@gnu.org; Fri, 28 Mar 2003 19:56:50 -0500 Original-Received: from snoopy.pacific.net.au ([61.8.0.36]) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.10.13) id 18z4e4-0002I5-00 for emacs-devel@gnu.org; Fri, 28 Mar 2003 19:56:28 -0500 Original-Received: from sunny.pacific.net.au (sunny.pacific.net.au [203.2.228.40]) h2T0uPRk026937 for ; Sat, 29 Mar 2003 11:56:25 +1100 Original-Received: from wisma.pacific.net.au (wisma.pacific.net.au [210.23.129.72]) by sunny.pacific.net.au with ESMTP id h2T0uPoJ029869 for ; Sat, 29 Mar 2003 11:56:25 +1100 (EST) Original-Received: from localhost (ppp100.dyn228.pacific.net.au [203.143.228.100]) by wisma.pacific.net.au (8.12.8/8.12.8) with ESMTP id h2T0uNqn023406 for ; Sat, 29 Mar 2003 11:56:23 +1100 (EST) Original-Received: from gg by localhost with local (Exim 3.35 #1 (Debian)) id 18z4dl-0001ST-00; Sat, 29 Mar 2003 10:56:09 +1000 Original-To: emacs-devel@gnu.org Mail-Copies-To: never User-Agent: Gnus/5.090017 (Oort Gnus v0.17) Emacs/21.2 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Emacs development discussions. List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:12735 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:12735 --=-=-= I'd like to propose an addition to info-look.el for sh-mode command and variable lookups. For commands I think the invocation is the most pertinent information when writing a shell script. This is the natural form in the bash and coreutils manuals, I fudged the sed and awk entries to go to their command line sections too. I guess almost every program is a candidate for sh-mode lookup, but there's no call to go overboard, the theory would just be to cover the common things. * info-look.el (sh-mode): Add doc-specs for commands and variables. --=-=-= Content-Disposition: attachment; filename=info-look.el.sh-mode.diff --- info-look.el.~1.29.~ 2003-01-25 08:36:17.000000000 +1000 +++ info-look.el 2003-03-28 16:14:25.000000000 +1000 @@ -795,6 +795,52 @@ (info-lookup-maybe-add-help (t nil))) nil; "^ - [^:]+:[ ]+" don't think this prefix is useful here. nil))) + +;; coreutils and bash builtins overlap in places, eg. printf, so there's a +;; question which should come first. Some of the sh-utils descriptions are +;; more detailed, but if bash is usually /bin/sh on a GNU system then the +;; builtins will be what's normally run. +;; +;; Maybe special variables like $? should be matched as $?, not just ?. +;; This would avoid a clash between variable $! and negation !, or variable +;; $# and comment # (though comment # is not currently indexed in bash). +;; Unfortunately if $? etc is the symbol, then we wouldn't be taken to the +;; exact spot in the relevant node, since the bash manual has just `?' etc +;; there. Maybe an extension to the prefix/suffix scheme could help this. + +(info-lookup-maybe-add-help + :mode 'sh-mode :topic 'symbol + ;; bash has "." and ":" in its index, but those chars will probably never + ;; work in info, so don't bother matching them in the regexp. + :regexp "\\([a-zA-Z0-9_-]+\\|[!{}@*#?$]\\|\\[\\[?\\|]]?\\)" + :doc-spec '(("(bash)Builtin Index" nil "^`" "[ .']") + ("(bash)Reserved Word Index" nil "^`" "[ .']") + ("(bash)Variable Index" nil "^`" "[ .']") + ;; coreutils (version 4.5.10) doesn't have a separate program + ;; index, so exclude extraneous stuff (most of it) by demanding + ;; "[a-z]+" in the trans-func. + ("(coreutils)Index" + (lambda (item) (if (string-match "\\`[a-z]+\\'" item) item))) + ;; diff (version 2.8.1) has only a few programs, index entries + ;; are things like "foo invocation". + ("(diff)Index" + (lambda (item) + (if (string-match "\\`\\([a-z]+\\) invocation\\'" item) + (match-string 1 item)))) + ;; there's no plain "sed" index entry as such, mung another + ;; hopefully unique one to get to the invocation section + ("(sed)Concept Index" + (lambda (item) + (if (string-equal item "Standard input, processing as input") + "sed"))) + ;; there's no plain "awk" or "gawk" index entries, mung other + ;; hopefully unique ones to get to the command line options + ("(gawk)Index" + (lambda (item) + (cond ((string-equal item "gawk, extensions, disabling") + "awk") + ((string-equal item "gawk, versions of, information about, printing") + "gawk")))))) (provide 'info-look) --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://mail.gnu.org/mailman/listinfo/emacs-devel --=-=-=--