;;; ess-menu.el --- Menu and Speedbar support for statistical1;;; programming and analysis23;; Copyright (C) 2000--2005 A.J. Rossini, Richard M. Heiberger, Martin4;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen.56;; Author: A.J. Rossini7;; Created: September 4, 20008;; Maintainer: ESS Core Team <[email protected]>910;; Keywords: statistics, languages1112;; Summary: general functions for ESS1314;; This file is part of ESS1516;; This file is free software; you can redistribute it and/or modify17;; it under the terms of the GNU General Public License as published by18;; the Free Software Foundation; either version 2, or (at your option)19;; any later version.20;;21;; This file is distributed in the hope that it will be useful,22;; but WITHOUT ANY WARRANTY; without even the implied warranty of23;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the24;; GNU General Public License for more details.25;;26;; A copy of the GNU General Public License is available at27;; http://www.r-project.org/Licenses/282930;;; Commentary:3132;;; Code:3334;;*;; Requires and autoloads35;;;=====================================================3637(require 'ess-custom)38(if (and (featurep 'xemacs); need this, since require in XEmacs has only 2 arg39(not (require 'imenu "imenu.elc")))40(message "** warning: 'imenu not available for this version of XEmacs"))4142;;(defgroup ess-menu nil43;; "ESS: object menu systems."44;; :group 'ess45;; :prefix "ess-")464748;;; Function Menu (func-menu) for XEmacs:4950;; (if ess-funcmenu-use-p51;; (defvar fume-function-name-regexp-S52;; (append53;; '((s-mode . fume-function-name-regexp-smode)54;; (r-mode . fume-function-name-regexp-smode))55;; fume-function-name-regexp-alist)56;; "Expression to get function names"))5758;;; Imenu for Emacs/XEmacs...5960;;; XLS imenu support6162;; (defun ess-imenu-XLS (&optional arg)63;; "XLispStat Language Imenu support for ESS."64;; (interactive)65;; (setq imenu-generic-expression66;; '( (nil "New one needed" 1)))67;; (imenu-add-to-menubar "XLS-fcts"))6869;; (defun imenu-example--XLS-extract-index-name ()70;; ;; Example of a candidate for `imenu-extract-index-name-function'.71;; ;; This will generate a flat index of definitions in a lisp file.72;; (save-match-data73;; (and (looking-at "(def")74;; (condition-case nil75;; (progn76;; (down-list 1)77;; (forward-sexp 2)78;; (let ((beg (point))79;; (end (progn (forward-sexp -1) (point))))80;; (buffer-substring beg end)))81;; (error nil)))))8283;; (defun imenu-example--create-XLS-index ()84;; ;; Example of a candidate for `imenu-create-index-function'.85;; ;; It will generate a nested index of definitions.86;; (let ((index-alist '())87;; (index-var-alist '())88;; (index-type-alist '())89;; (index-unknown-alist '())90;; prev-pos)91;; (goto-char (point-max))92;; (imenu-progress-message prev-pos 0)93;; ;; Search for the function94;; (while (beginning-of-defun)95;; (imenu-progress-message prev-pos nil t)96;; (save-match-data97;; (and (looking-at "(def")98;; (save-excursion99;; (down-list 1)100;; (cond101;; ((looking-at "def\\(var\\|const\\)")102;; (forward-sexp 2)103;; (push (imenu-example--name-and-position)104;; index-var-alist))105;; ((looking-at "def\\(un\\|subst\\|macro\\|advice\\)")106;; (forward-sexp 2)107;; (push (imenu-example--name-and-position)108;; index-alist))109;; ((looking-at "def\\(type\\|struct\\|class\\|ine-condition\\)")110;; (forward-sexp 2)111;; (if (= (char-after (1- (point))) ?\))112;; (progn113;; (forward-sexp -1)114;; (down-list 1)115;; (forward-sexp 1)))116;; (push (imenu-example--name-and-position)117;; index-type-alist))118;; (t119;; (forward-sexp 2)120;; (push (imenu-example--name-and-position)121;; index-unknown-alist)))))))122;; (imenu-progress-message prev-pos 100)123;; (and index-var-alist124;; (push (cons "Variables" index-var-alist)125;; index-alist))126;; (and index-type-alist127;; (push (cons "Types" index-type-alist)128;; index-alist))129;; (and index-unknown-alist130;; (push (cons "Syntax-unknown" index-unknown-alist)131;; index-alist))132;; index-alist))133134;; (defun ess-imenu-STA (&optional arg)135;; "Stata Language Imenu support for ESS."136;; (interactive)137;; (setq imenu-generic-expression138;; '( (nil "New one needed" 1)))139;; (imenu-add-to-menubar "Stata-fcts"))140141; Run load hook and provide package142143(provide 'ess-menu)144145; Local variables section146147;;; This file is automatically placed in Outline minor mode.148;;; The file is structured as follows:149;;; Chapters: ^L ;150;;; Sections: ;;*;;151;;; Subsections: ;;;*;;;152;;; Components: defuns, defvars, defconsts153;;; Random code beginning with a ;;;;* comment154155;;; Local variables:156;;; mode: emacs-lisp157;;; mode: outline-minor158;;; outline-regexp: "\^L\\|\\`;\\|;;\\*\\|;;;\\*\\|(def[cvu]\\|(setq\\|;;;;\\*"159;;; End:160161;;; ess-menu.el ends here162163164