Initial Commit
[packages] / xemacs-packages / ilisp / ilisp-scheme-easy-menu.el
1 ;;; ilisp-scheme-easy-menu.el --- (easy)menu's on Emacs for Ilisp
2
3 ;;; Copyright (C) 1996 Holger Schauer
4 ;;;
5 ;;; This file is part of ILISP.
6 ;;; Please refer to the file COPYING for copyrights and licensing
7 ;;; information.
8 ;;; Please refer to the file ACKNOWLEGDEMENTS for an (incomplete) list
9 ;;; of present and past contributors.
10 ;;;
11 ;;; $Id: ilisp-scheme-easy-menu.el,v 1.3 2002-06-03 23:37:03 wbd Exp $
12
13 ;; Author: Holger Schauer <Holger.Schauer@gmd.de>
14 ;; Maintainer: Holger.Schauer@gmd.de
15 ;; Keywords: lisp ilisp extensions menu easymenu
16 ;; Version 0.2
17 ;; Status: Should work with any Emacs and easymenu.el (as by Per Abrahamsen)
18 ;; Created: 1996-10-08
19 ;; Last modified: 1996-10-15 (that's 15th October 1996, folks)
20
21 ;; Where to get it: http://www.uni-koblenz.de/~schauer/uniemacs.html
22
23 ;; This program is free software; you can redistribute it and/or modify
24 ;; it under the terms of the GNU General Public License as published by
25 ;; the Free Software Foundation; either version 2, or (at your option)
26 ;; any later version.
27 ;;
28 ;; This program is distributed in the hope that it will be useful,
29 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
30 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
31 ;; GNU General Public License for more details.
32 ;;
33 ;; You should have received a copy of the GNU General Public License
34 ;; along with this program; if not, you can either send email to this
35 ;; program's maintainer or write to: The Free Software Foundation,
36 ;; Inc.; 59 Temple Place, Suite 330; Boston, MA 02111-1307, USA.
37
38 ;;; Commentary:
39
40 ;; This file and it's extensions have been named ilisp-xemacs-menu before. 
41 ;; As it is ensured now to work with any Emacs with easymenu the file
42 ;; itself and all relevant names (of commands and variables) are renamed. 
43
44 ;; Use this file as an extension to Ilisp 5.7/5.8 
45 ;; (seee http://www.cs.cmu.edu/~campbell/ilisp/index.html)
46 ;; Put it in a place where (X)Emacs can find it and augment your
47 ;; .emacs like the following to use it.
48 ;; (load-library "ilisp-easy-menu")
49 ;; This needs to be loaderd prior to Ilisp !
50 ;; This should give you the menu in any source code buffer and any inferior 
51 ;; ilisp buffer. Be careful: the menu is initialized with add-hook
52 ;; on ilisp-mode-hook and lisp-mode-hook, so if you setq these two
53 ;; hooks afterwards you won't get the menu.
54 ;;
55 ;; If you want to use it with Emacs (not XEmacs) you will want to get rid
56 ;; of the old menu. You can do so by applying the following patches (to
57 ;; Ilisp 5.8 - for 5.7 check for ilisp-update-menu and the loading of the
58 ;; menu, i.e. ilisp-menu and ilisp-mnb)
59 ;; For ilisp.el:
60 ;; 185c185,187
61 ;< (if (not (member +ilisp-emacs-version-id+ '(xemacs lucid-19 lucid-19-new)))
62 ;---
63 ;> (if (and
64 ;>      (not (member +ilisp-emacs-version-id+ '(xemacs lucid-19 lucid-19-new)))
65 ;>      (not (featurep 'ilisp-easy-menu)))
66 ;; For ilisp-utl.el:
67 ;127c127,129
68 ;<   (if (not (member +ilisp-emacs-version-id+ '(xemacs lucid-19 lucid-19-new)))
69 ;---
70 ;>   (if (and (not 
71 ;>          (member +ilisp-emacs-version-id+ '(xemacs lucid-19 lucid-19-new)))
72 ;>         (not (featurep 'ilisp-easy-menu)))
73
74 (require 'easymenu)
75
76 (defconst ilisp-scheme-easy-menu
77   '("Ilisp"
78     [ "Load File" load-file-lisp t ]
79     [ "Run Ilisp" run-ilisp t ]
80     "--"
81     ("Evaluate"
82      [ "Eval region" eval-region-lisp t ]
83      [ "Eval defun" eval-defun-lisp t ]
84      [ "Eval next sexp" eval-next-sexp-lisp t ]
85      ;; [ "Eval last sexp" eval-last-sexp-lisp t ]
86      [ "Eval changes" eval-changes-lisp t ]
87      )
88     ("Evaluate and Go"
89      [ "Eval region" eval-region-and-go-lisp t ]
90      [ "Eval defun" eval-defun-and-go-lisp t ]
91      [ "Eval next sexp" eval-next-sexp-and-go-lisp t ]
92      ;; [ "Eval last sexp" eval-last-sexp-and-go-lisp t ]
93      )
94     ("Compile"
95      [ "File" compile-file-lisp t ]
96      [ "Defun" compile-defun-lisp t ]
97      [ "Defun and go" compile-defun-and-go-lisp t ]
98      [ "Region" compile-region-lisp t ]
99      [ "Region and go" compile-region-and-go-lisp t ]
100      [ "Compile changes" compile-changes-lisp t ]
101      )
102     "--"
103     ("Editing"
104      [ "Edit definitions" edit-definitions-lisp t ]
105      [ "Edit next def." next-definition-lisp t ]
106      [ "Edit callers" edit-callers-lisp t ]
107      [ "Edit next caller" next-caller-lisp t ]
108      [ "Insert arguments" arglist-lisp t ]
109      "--"
110      [ "Find unbalanced paren" find-unbalanced-lisp t ]
111      [ "Close all parens" close-all-lisp t ]
112      [ "Close and send lisp" close-and-send-lisp t ]
113      "--"
114      [ "Reindent" reindent-lisp t ]
115      [ "Indent sexp" indent-sexp-ilisp t ]
116      [ "Indent for comment" lisp-indent-for-comment t ]
117      [ "Comment region" comment-region-lisp t ]
118      "--"
119      [ "Search in Files" search-lisp t ] 
120      "--"
121      [ "Kill sexp" kill-sexp t ] 
122      [ "Kill last sexp" backward-kill-sexp t ]
123      "--"
124      [ "Macroexpand" macroexpand-lisp t ]
125      [ "Macroexpand-1" macroexpand-1-lisp t ]
126      "--"
127      [ "Begin of def" beginning-of-defun-lisp t ]
128      [ "End of defun" end-of-defun-lisp t ]
129      )
130     ("Documentation"
131      [ "Documentation" documentation-lisp t ]
132      [ "Describe" describe-lisp t ]
133      [ "Inspect" inspect-lisp t ]
134      "--"
135      [ "Clman-apropos" fi:clman-apropos t ];; with which var can I test if
136      [ "Hyperspec - apropos" hyperspec-lookup-lisp t ];; fi is really loaded ?
137      )
138     "--"
139     ("Package"
140      "--"
141      [ "Package" package-lisp t ]
142      [ "Set Lisp Package" set-package-lisp t ]
143      [ "Set Buffer Package" set-buffer-package-lisp t ]
144      )
145     "--"
146     ("Misc"
147      ;; [ "Reset Ilisp" reset-ilisp t ]
148      [ "Select Ilisp" select-ilisp t ]
149      [ "Switch to lisp" switch-to-lisp t ]
150      [ "Abort commands" abort-commands-lisp t ]
151      [ "Status of Lisp" status-lisp t ]  
152      "--"
153      [ "Mark change" mark-change-lisp t ]
154      [ "List changes" list-changes-lisp t ]
155      [ "Clear changes" clear-changes-lisp t ]
156      "--"
157      [ "Trace defun" trace-defun-lisp t ]
158      )
159     "--"
160     [ "Reset Ilisp Connection" reset-ilisp t ]
161     [ "Repair Ilisp Connection" repair-ilisp t ]
162     )
163   )
164
165 ;;; ilisp-update-menu
166 ;;;
167 ;;; 19990818 Marco Antoniotti
168
169 (defun ilisp-update-menu (status)
170   ;; Backward compatibility with old keymap based menus.
171   ;; A no-op for the time being.
172   )
173
174 (provide 'ilisp-scheme-easy-menu)
175
176 ;;; Hooks to add the menu.
177 ;;;
178 ;;; Notes:
179 ;;; 19990818 Marco Antoniotti
180 ;;; Since I could have installed a CL menu before a Scheme one, I
181 ;;; could be forced to to remove the previous menu.  Now the code does not do
182 ;;; this, but it should.
183
184 (add-hook 'ilisp-mode-hook
185           (lambda () 
186             (when (featurep 'easymenu)       
187               (easy-menu-define menubar-ilisp
188                                 ilisp-mode-map 
189                                 "Ilisp commands"
190                                 ilisp-scheme-easy-menu) 
191               (easy-menu-add ilisp-scheme-easy-menu 'ilisp-mode-map)
192               )))
193          
194
195 (add-hook 'scheme-mode-hook
196           (lambda () 
197             (when (featurep 'easymenu)       
198               (easy-menu-define menubar-scheme-ilisp
199                                 scheme-mode-map 
200                                 "Scheme commands"
201                                 ilisp-scheme-easy-menu) 
202               (when (boundp 'scheme-menu)
203                 (easy-menu-remove scheme-menu))
204               (easy-menu-add ilisp-scheme-easy-menu 'scheme-mode-map)
205               )))
206
207 ;;; end of file-- ilisp-scheme-easy-menu.el --