Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Annotation of /sml/trunk/sml-mode/sml-menus.el
ViewVC logotype

Annotation of /sml/trunk/sml-mode/sml-menus.el

Parent Directory Parent Directory | Revision Log Revision Log


Revision 33 - (view) (download)

1 : monnier 32 ;;; sml-menus.el. Simple menus for sml-mode
2 :    
3 :     ;; Copyright (C) 1994, Matthew J. Morley
4 :    
5 :     ;; This file is not part of GNU Emacs, but it is distributed under the
6 :     ;; same conditions.
7 :    
8 :     ;; ====================================================================
9 :    
10 :     ;; This program is free software; you can redistribute it and/or
11 :     ;; modify it under the terms of the GNU General Public License as
12 :     ;; published by the Free Software Foundation; either version 2, or (at
13 :     ;; your option) any later version.
14 :    
15 :     ;; This program is distributed in the hope that it will be useful, but
16 :     ;; WITHOUT ANY WARRANTY; without even the implied warranty of
17 :     ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 :     ;; General Public License for more details.
19 :    
20 :     ;; You should have received a copy of the GNU General Public License
21 :     ;; along with GNU Emacs; see the file COPYING. If not, write to the
22 :     ;; Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
23 :    
24 :     ;; ====================================================================
25 :    
26 :     ;;; DESCRIPTION
27 :    
28 :     ;; You need auc-menu or easymenu on your lisp load-path.
29 :    
30 :     ;; Menus appear only when the cursor is in an sml-mode buffer. They
31 :     ;; should appear automatically as long as sml-mode can find this file
32 :     ;; and easymenu.el (or auc-menu.el), but not otherwise.
33 :    
34 :     ;; If you load sml-proc.el to run an inferior ML process -- or even a
35 :     ;; superior one, who knows? -- the "Process" submenu will become active.
36 :    
37 :     ;;; CODE
38 :    
39 :     (condition-case () (require 'easymenu) (error (require 'auc-menu)))
40 :    
41 :     ;; That's FSF easymenu, distributed with GNU Emacs 19, or Per
42 :     ;; Abrahamsen's auc-menu distributed with AUCTeX, or from the Emacs
43 :     ;; lisp archive, or the IESD (ftp://sunsite.auc.dk/packages/auctex/)
44 :     ;; lisp archive at Aalborg (auc-menu works with XEmacs too).
45 :    
46 :     (defconst sml-menu
47 :     (list ;"SML"
48 :     (list "Process"
49 :     ["Start default ML compiler" sml
50 :     :active (fboundp 'sml)]
51 :     ["-" nil nil]
52 : monnier 33 ["run CM.make" sml-make
53 :     :active (and (featurep 'sml-proc))]
54 : monnier 32 ["load ML source file" sml-load-file
55 :     :active (featurep 'sml-proc)]
56 :     ["switch to ML buffer" switch-to-sml
57 :     :active (featurep 'sml-proc)]
58 :     ["--" nil nil]
59 :     ["send buffer contents" sml-send-buffer
60 :     :active (featurep 'sml-proc)]
61 :     ["send region" sml-send-region
62 :     :active (featurep 'sml-proc)]
63 :     ["send paragraph" sml-send-function
64 :     :active (featurep 'sml-proc)]
65 :     ["goto next error" sml-next-error
66 :     :active (featurep 'sml-proc)]
67 :     ["---" nil nil]
68 :     ["Standard ML of New Jersey" sml-smlnj
69 :     :active (fboundp 'sml-smlnj)]
70 :     ["Poly/ML" sml-poly-ml
71 :     :active (fboundp 'sml-poly-ml)]
72 :     ["Moscow ML" sml-mosml
73 :     :active (fboundp 'sml-mosml)]
74 :     ["Help for Inferior ML" (describe-function 'inferior-sml-mode)
75 :     :active (featurep 'sml-proc)]
76 :     )
77 :     ["electric pipe" sml-electric-pipe t]
78 :     ["insert SML form" sml-insert-form t]
79 :     (list "Forms"
80 :     ["abstype" sml-form-abstype t]
81 :     ["datatype" sml-form-datatype t]
82 :     ["-" nil nil]
83 :     ["let" sml-form-let t]
84 :     ["local" sml-form-local t]
85 :     ["case" sml-form-case t]
86 :     ["--" nil nil]
87 :     ["signature" sml-form-signature t]
88 :     ["functor" sml-form-functor t]
89 :     ["structure" sml-form-structure t])
90 :     (list "Format/Mode Variables"
91 :     ["indent region" sml-indent-region t]
92 :     ["outdent" sml-back-to-outer-indent t]
93 :     ["-" nil nil]
94 :     ["set indent-level" sml-indent-level t]
95 :     ["set pipe-indent" sml-pipe-indent t]
96 :     ["--" nil nil]
97 :     ["toggle type-of-indent" (sml-type-of-indent) t]
98 :     ["toggle nested-if-indent" (sml-nested-if-indent) t]
99 :     ["toggle case-indent" (sml-case-indent) t]
100 :     ["toggle electric-semi-mode" (sml-electric-semi-mode) t])
101 :     ["-----" nil nil]
102 :     ["SML mode help (brief)" describe-mode t]
103 :     ["SML mode *info*" sml-mode-info t]
104 :     ["SML mode version" sml-mode-version t]
105 :     ["-----" nil nil]
106 :     ["Fontify buffer" (sml-mode-fontify-buffer)
107 :     :active (or (featurep 'sml-font) (featurep 'sml-hilite))]
108 :     ["Remove overlay" (sml-error-overlay 'undo)
109 :     :active (sml-overlay-active-p)]
110 :     ))
111 :    
112 :     (defun sml-mode-fontify-buffer ()
113 :     "Just as it suggests."
114 :     (cond ((featurep 'sml-font)
115 :     (font-lock-fontify-buffer))
116 :     ((featurep 'sml-hilite)
117 :     (hilit-rehighlight-buffer))
118 :     (t
119 :     (message "No highlight scheme specified")))) ; belt & braces
120 :    
121 :     (easy-menu-define sml-mode-menu
122 :     sml-mode-map
123 :     "Menu used in sml-mode."
124 :     (cons "SML" sml-menu))
125 :    
126 :     ;;; Make's sure they appear in the menu bar when sml-mode-map is active.
127 :    
128 :     ;; On the hook for XEmacs only -- see easy-menu-add in auc-menu.el.
129 :    
130 :     (defun sml-mode-menu-bar ()
131 :     "Make sure menus appear in the menu bar as well as under mouse 3."
132 :     (and (eq major-mode 'sml-mode)
133 :     (easy-menu-add sml-mode-menu sml-mode-map)))
134 :    
135 :     (add-hook 'sml-mode-hook 'sml-mode-menu-bar)
136 :    
137 :     ;; Autoload all the process code if these are selected.
138 :    
139 :     (autoload 'sml "sml-proc" sml-no-doc t)
140 :    
141 :     ;; Not these two.
142 :     ;; (autoload 'sml-poly-ml "sml-poly-ml" sml-no-doc t)
143 :     ;; (autoload 'sml-mosml "sml-mosml" sml-no-doc t)
144 :    
145 :     (provide 'sml-menus)
146 :    
147 :     ;;; sml-menu.el is over now.

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0