Mercurial > emacs
annotate lisp/progmodes/octave-hlp.el @ 78750:c727abfbb05e
Merge upstream 5.23.
(cperl-where-am-i): Remove function.
(cperl-backward-to-noncomment): Don't go too far when skipping POD/HEREs
(cperl-sniff-for-indent): De-invert [string] and [comment].
When looking for label, skip s:m:y:tr.
(cperl-indent-line): Likewise.
(cperl-mode): Don't assume `font-lock-multiline' is auto-local.
(cperl-windowed-init): Wrong `ps-print' handling.
Both thanks to Chong Yidong.
(cperl-look-at-leading-count): Could fail with unfinished RExen.
(cperl-find-pods-heres): If the second part of s()[] is missing,
don't try to highlight delimiters...
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Fri, 07 Sep 2007 04:37:28 +0000 |
parents | c1ec1c8a8d2e |
children | a1342e6e097a f55f9811f5d7 |
rev | line source |
---|---|
17517 | 1 ;;; octave-hlp.el --- getting help on Octave symbols using info |
16903 | 2 |
75347 | 3 ;; Copyright (C) 1997, 2001, 2002, 2003, 2004, 2005, 2006, 2007 |
64699
629afbe74e61
Update copyright for release of 22.1 for progmodes directory.
Nick Roberts <nickrob@snap.net.nz>
parents:
64085
diff
changeset
|
4 ;; Free Software Foundation, Inc. |
16903 | 5 |
65152
7a3342784b7e
Change Author and Maintainer address.
Eli Zaretskii <eliz@gnu.org>
parents:
64699
diff
changeset
|
6 ;; Author: Kurt Hornik <Kurt.Hornik@wu-wien.ac.at> |
16903 | 7 ;; Author: John Eaton <jwe@bevo.che.wisc.edu> |
65152
7a3342784b7e
Change Author and Maintainer address.
Eli Zaretskii <eliz@gnu.org>
parents:
64699
diff
changeset
|
8 ;; Maintainer: Kurt Hornik <Kurt.Hornik@wu-wien.ac.at> |
16903 | 9 ;; Keywords: languages |
10 | |
11 ;; This file is part of GNU Emacs. | |
12 | |
13 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
14 ;; it under the terms of the GNU General Public License as published by | |
78234
c1ec1c8a8d2e
Switch license to GPLv3 or later.
Glenn Morris <rgm@gnu.org>
parents:
75347
diff
changeset
|
15 ;; the Free Software Foundation; either version 3, or (at your option) |
16903 | 16 ;; any later version. |
17 | |
18 ;; GNU Emacs is distributed in the hope that it will be useful, | |
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 ;; GNU General Public License for more details. | |
22 | |
23 ;; You should have received a copy of the GNU General Public License | |
24 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
64085 | 25 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
26 ;; Boston, MA 02110-1301, USA. | |
16903 | 27 |
28 ;;; Commentary: | |
29 | |
30 ;; Provides the command `octave-help' which allows index lookup of a | |
31 ;; symbol in the Octave-related info files, as specified by the list | |
32 ;; `octave-help-files'. | |
33 | |
34 ;; Other features may be added in future versions. | |
35 | |
36 ;;; Code: | |
37 | |
16904
2bc5f76917e0
Require octave-mod, not octave.
Richard M. Stallman <rms@gnu.org>
parents:
16903
diff
changeset
|
38 (require 'octave-mod) |
16903 | 39 (require 'info) |
40 | |
41 (defvar octave-help-files '("octave") | |
42 "List of info files with documentation for Octave. | |
43 Default is (\"octave\").") | |
44 | |
45 (defvar octave-help-lookup-alist nil | |
46 "Alist of Octave index entries for lookup.") | |
47 | |
48 (defvar octave-help-completion-alist nil | |
49 "Alist of Octave index entries for completion. | |
50 The entries are of the form (VAR . VAR), where VAR runs through all | |
51 different keys in `octave-help-lookup-alist'.") | |
52 | |
53 ;;;###autoload | |
54 (defun octave-help (key) | |
55 "Get help on Octave symbols from the Octave info files. | |
56 Look up KEY in the function, operator and variable indices of the files | |
57 specified by `octave-help-files'. | |
58 If KEY is not a string, prompt for it with completion." | |
59 (interactive | |
60 (list | |
61 (completing-read (format "Describe Octave symbol: ") | |
62 (octave-help-get-completion-alist) | |
63 nil t))) | |
64 (if (get-buffer "*info*") | |
65 (set-buffer "*info*")) | |
66 (if (zerop (length key)) | |
67 (Info-find-node (car octave-help-files) "Top") | |
68 (let ((alist (copy-alist (octave-help-get-lookup-alist))) | |
69 entry matches) | |
70 (while (setq entry (car alist)) | |
71 (if (string-match key (car entry)) | |
72 (add-to-list 'matches entry)) | |
73 (setq alist (cdr alist))) | |
74 (if matches | |
75 (progn | |
76 (setq Info-index-alternatives matches) | |
77 (Info-index-next 0)))))) | |
78 | |
79 (defun octave-help-get-lookup-alist () | |
80 "Build the index lookup alist from all Octave info files. | |
81 The files specified by `octave-help-files' are searched." | |
82 (if octave-help-lookup-alist | |
83 () | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
17517
diff
changeset
|
84 (message "Building help lookup alist...") |
16903 | 85 (let ((files octave-help-files) file key node) |
86 (save-window-excursion | |
87 (while files | |
88 (setq file (car files)) | |
89 (Info-goto-node (concat "(" file ")")) | |
90 (condition-case nil | |
91 (progn | |
92 (Info-index "") | |
93 (while | |
94 (progn | |
95 (while (re-search-forward | |
96 "^\\* \\([^(:]+\\)[^:]*: *\\(.+\\)\\.$" | |
97 nil t) | |
98 (setq key (match-string 1) | |
99 node (concat "(" file ")" (match-string 2))) | |
100 (and (string-match "\\(.*\\>\\) *$" key) | |
101 (setq key (replace-match "\\1" t nil key))) | |
102 (add-to-list 'octave-help-lookup-alist | |
103 (list key | |
104 node | |
105 (concat (concat "(" file ")") | |
106 Info-current-node) | |
107 0))) | |
108 (and (setq node (Info-extract-pointer "next" t)) | |
109 (string-match | |
110 (concat "\\(Function\\|Operator\\|Variable\\) " | |
111 "\\<Index\\>") | |
112 node))) | |
113 (Info-goto-node node))) | |
114 (error nil)) | |
115 (setq files (cdr files))))) | |
116 (message "Building help lookup alist...done")) | |
117 octave-help-lookup-alist) | |
118 | |
119 (defun octave-help-get-completion-alist () | |
120 "Build the index completion alist from all Octave info files. | |
121 The files specified by `octave-help-files' are searched." | |
122 (if octave-help-completion-alist | |
123 () | |
124 (message "Building help completion alist...") | |
125 (let ((alist (octave-help-get-lookup-alist)) entry) | |
126 (while alist | |
127 (setq entry (car alist)) | |
128 (add-to-list 'octave-help-completion-alist | |
129 (cons (car entry) (car entry))) | |
130 (setq alist (cdr alist)))) | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
17517
diff
changeset
|
131 (message "Building help completion alist...done")) |
16903 | 132 octave-help-completion-alist) |
133 | |
17149 | 134 ;;; provide ourself |
135 | |
136 (provide 'octave-hlp) | |
137 | |
52401 | 138 ;;; arch-tag: df5ef8fa-76c9-44e5-9835-cb5a502c6282 |
16904
2bc5f76917e0
Require octave-mod, not octave.
Richard M. Stallman <rms@gnu.org>
parents:
16903
diff
changeset
|
139 ;;; octave-hlp.el ends here |