-
Notifications
You must be signed in to change notification settings - Fork 0
/
mi-octave.el
93 lines (69 loc) · 2.84 KB
/
mi-octave.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
;;; mi-octave.el --- Mode-info backend for Octave
;; Copyright (C) 1999 Rubikitch <[email protected]>
;; Copyright (C) 2001,2002 TSUCHIYA Masatoshi <[email protected]>
;; Author: Rubikitch <[email protected]>,
;; TSUCHIYA Masatoshi <[email protected]>
;; Keywords: octave info
;; This file is a part of mode-info.
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program; if not, you can either send email to this
;; program's maintainer or write to: The Free Software Foundation,
;; Inc.; 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
;;; Commentary:
;; Original code was octave-info.el written by
;; Rubikitch <[email protected]>.
;; This file provides mode-info backend stuffs to see the manual of
;; GNU Octave.
;;; Code:
(require 'mode-info)
(eval-when-compile
(require 'cl)
(require 'mi-index))
(defgroup mode-info-octave nil
"Various sorts of imporved help system for Octave."
:group 'mode-info)
(defcustom mode-info-octave-index-file
(expand-file-name "mi-octave.idx" mode-info-index-directory)
"*Index file of functions and variables described in Info about Octave."
:group 'mode-info-octave
:type 'file)
(defcustom mode-info-octave-titles
'("octave")
"*Info titles about Octave."
:group 'mode-info-octave
:type mode-info-titles-type)
(defconst mode-info-octave-entry-regexp
"^ +-.+\\(Command\\|Function\\|Keyword\\|Variable\\)[^:]*: +\\([^\n=]+= +\\)?\\([^ \t\n]+\\).*$")
(defconst mode-info-octave-entry-pos 3)
(mode-info-defclass octave)
(mode-info-defmethod function-at-point ((class octave))
(mode-info-load-index class)
(save-match-data
(when (re-search-backward (mode-info-function-regexp class) nil t)
(match-string 1))))
(mode-info-defmethod variable-at-point ((class octave))
(mode-info-load-index class)
(save-match-data
(when (re-search-backward (mode-info-function-regexp class) nil t)
(match-string 1))))
(defun mode-info-octave-make-index ()
"Make index of Info files listed in `mode-info-octave-titles'."
(interactive)
(mode-info-make-index 'octave
mode-info-octave-titles
mode-info-octave-entry-regexp
mode-info-octave-entry-pos))
(mode-info-defmethod write-index-file ((class octave) functions variables
&optional regexp)
(setq regexp t)
(mode-info-method-next))
(provide 'mi-octave)
;;; mi-octave.el ends here