* info-look.el and sh-mode
@ 2003-03-29 0:56 Kevin Ryde
0 siblings, 0 replies; only message in thread
From: Kevin Ryde @ 2003-03-29 0:56 UTC (permalink / raw)
[-- Attachment #1: Type: text/plain, Size: 552 bytes --]
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.
[-- Attachment #2: info-look.el.sh-mode.diff --]
[-- Type: text/plain, Size: 2831 bytes --]
--- 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"))))))
\f
(provide 'info-look)
[-- Attachment #3: Type: text/plain, Size: 142 bytes --]
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2003-03-29 0:56 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-03-29 0:56 info-look.el and sh-mode Kevin Ryde
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.