Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
2701 views
1
;;; ess-menu.el --- Menu and Speedbar support for statistical
2
;;; programming and analysis
3
4
;; Copyright (C) 2000--2005 A.J. Rossini, Richard M. Heiberger, Martin
5
;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen.
6
7
;; Author: A.J. Rossini
8
;; Created: September 4, 2000
9
;; Maintainer: ESS Core Team <[email protected]>
10
11
;; Keywords: statistics, languages
12
13
;; Summary: general functions for ESS
14
15
;; This file is part of ESS
16
17
;; This file is free software; you can redistribute it and/or modify
18
;; it under the terms of the GNU General Public License as published by
19
;; the Free Software Foundation; either version 2, or (at your option)
20
;; any later version.
21
;;
22
;; This file is distributed in the hope that it will be useful,
23
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
24
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25
;; GNU General Public License for more details.
26
;;
27
;; A copy of the GNU General Public License is available at
28
;; http://www.r-project.org/Licenses/
29
30
31
;;; Commentary:
32
33
;;; Code:
34
35
;;*;; Requires and autoloads
36
;;;=====================================================
37
38
(require 'ess-custom)
39
(if (and (featurep 'xemacs); need this, since require in XEmacs has only 2 arg
40
(not (require 'imenu "imenu.elc")))
41
(message "** warning: 'imenu not available for this version of XEmacs"))
42
43
;;(defgroup ess-menu nil
44
;; "ESS: object menu systems."
45
;; :group 'ess
46
;; :prefix "ess-")
47
48
49
;;; Function Menu (func-menu) for XEmacs:
50
51
;; (if ess-funcmenu-use-p
52
;; (defvar fume-function-name-regexp-S
53
;; (append
54
;; '((s-mode . fume-function-name-regexp-smode)
55
;; (r-mode . fume-function-name-regexp-smode))
56
;; fume-function-name-regexp-alist)
57
;; "Expression to get function names"))
58
59
;;; Imenu for Emacs/XEmacs...
60
61
;;; XLS imenu support
62
63
;; (defun ess-imenu-XLS (&optional arg)
64
;; "XLispStat Language Imenu support for ESS."
65
;; (interactive)
66
;; (setq imenu-generic-expression
67
;; '( (nil "New one needed" 1)))
68
;; (imenu-add-to-menubar "XLS-fcts"))
69
70
;; (defun imenu-example--XLS-extract-index-name ()
71
;; ;; Example of a candidate for `imenu-extract-index-name-function'.
72
;; ;; This will generate a flat index of definitions in a lisp file.
73
;; (save-match-data
74
;; (and (looking-at "(def")
75
;; (condition-case nil
76
;; (progn
77
;; (down-list 1)
78
;; (forward-sexp 2)
79
;; (let ((beg (point))
80
;; (end (progn (forward-sexp -1) (point))))
81
;; (buffer-substring beg end)))
82
;; (error nil)))))
83
84
;; (defun imenu-example--create-XLS-index ()
85
;; ;; Example of a candidate for `imenu-create-index-function'.
86
;; ;; It will generate a nested index of definitions.
87
;; (let ((index-alist '())
88
;; (index-var-alist '())
89
;; (index-type-alist '())
90
;; (index-unknown-alist '())
91
;; prev-pos)
92
;; (goto-char (point-max))
93
;; (imenu-progress-message prev-pos 0)
94
;; ;; Search for the function
95
;; (while (beginning-of-defun)
96
;; (imenu-progress-message prev-pos nil t)
97
;; (save-match-data
98
;; (and (looking-at "(def")
99
;; (save-excursion
100
;; (down-list 1)
101
;; (cond
102
;; ((looking-at "def\\(var\\|const\\)")
103
;; (forward-sexp 2)
104
;; (push (imenu-example--name-and-position)
105
;; index-var-alist))
106
;; ((looking-at "def\\(un\\|subst\\|macro\\|advice\\)")
107
;; (forward-sexp 2)
108
;; (push (imenu-example--name-and-position)
109
;; index-alist))
110
;; ((looking-at "def\\(type\\|struct\\|class\\|ine-condition\\)")
111
;; (forward-sexp 2)
112
;; (if (= (char-after (1- (point))) ?\))
113
;; (progn
114
;; (forward-sexp -1)
115
;; (down-list 1)
116
;; (forward-sexp 1)))
117
;; (push (imenu-example--name-and-position)
118
;; index-type-alist))
119
;; (t
120
;; (forward-sexp 2)
121
;; (push (imenu-example--name-and-position)
122
;; index-unknown-alist)))))))
123
;; (imenu-progress-message prev-pos 100)
124
;; (and index-var-alist
125
;; (push (cons "Variables" index-var-alist)
126
;; index-alist))
127
;; (and index-type-alist
128
;; (push (cons "Types" index-type-alist)
129
;; index-alist))
130
;; (and index-unknown-alist
131
;; (push (cons "Syntax-unknown" index-unknown-alist)
132
;; index-alist))
133
;; index-alist))
134
135
;; (defun ess-imenu-STA (&optional arg)
136
;; "Stata Language Imenu support for ESS."
137
;; (interactive)
138
;; (setq imenu-generic-expression
139
;; '( (nil "New one needed" 1)))
140
;; (imenu-add-to-menubar "Stata-fcts"))
141
142
; Run load hook and provide package
143
144
(provide 'ess-menu)
145
146
; Local variables section
147
148
;;; This file is automatically placed in Outline minor mode.
149
;;; The file is structured as follows:
150
;;; Chapters: ^L ;
151
;;; Sections: ;;*;;
152
;;; Subsections: ;;;*;;;
153
;;; Components: defuns, defvars, defconsts
154
;;; Random code beginning with a ;;;;* comment
155
156
;;; Local variables:
157
;;; mode: emacs-lisp
158
;;; mode: outline-minor
159
;;; outline-regexp: "\^L\\|\\`;\\|;;\\*\\|;;;\\*\\|(def[cvu]\\|(setq\\|;;;;\\*"
160
;;; End:
161
162
;;; ess-menu.el ends here
163
164