annotate lisp/sunpro/sunpro-menubar.el @ 171:929b76928fce r20-3b12

Import from CVS: tag r20-3b12
author cvs
date Mon, 13 Aug 2007 09:47:52 +0200
parents 538048ae2ab8
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 ;;; sunpro-menubar.el --- Initialize the SunPro menubar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 ;; Copyright (C) 1993, 1994 Sun Microsystems, Inc
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 ;; Author: Aaron Endelman <endelman@Eng.Sun.COM>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 ;; Maintainer: Vladimir Ivanovic <vladimir@Eng.Sun.COM>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 ;; Created: 93/09/13 15:16:24
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 ;; Keywords: SunPro menubar initialization
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 ;;; Commentary:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ;; Creates the default SunPro menubars.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 ;;; To Do:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 ;;; Code:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 (defconst sunpro-menubar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 (purecopy-menubar ;the simple, new user menubar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 (list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 '("File"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 ["New" sunpro-new-buffer t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 ["Open:" find-file t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 ["Include File:" insert-file t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 "-----"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 ["Save" save-buffer t nil]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 ["Save As:" write-file t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 ["Revert..." revert-buffer t nil]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 "-----"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 ["Print" lpr-buffer t nil]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 "-----"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 ["Close" delete-frame t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 ["Exit XEmacs" save-buffers-kill-emacs t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 '("Edit"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 ["Undo" advertised-undo t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 "-----"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 ["Cut" x-kill-primary-selection t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 ["Copy" x-copy-primary-selection t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 ["Paste" x-yank-clipboard-selection t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 ["Delete" x-delete-primary-selection t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 "-----"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 ["Select Block" mark-paragraph t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 ["Select All" mark-whole-buffer t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 '("View"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 ["New View" make-frame t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 "-----"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 ["Split Window" (split-window) t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 ["Unsplit Window" delete-other-windows t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 ["Close Buffer" (kill-buffer nil) t nil]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 "-----! before list all buffers"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 ["List All Buffers" list-buffers t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 '("Find"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 ["Forward:" sunpro-search-forward t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 ["Backward:" sunpro-search-backward t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 ["And Replace:" sunpro-query-replace t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 ;; Copy the options menu from the default menubar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 (car (find-menu-item default-menubar '("Options")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 '("Utilities"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 ["Cancel Command" (keyboard-quit) t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 "-----"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 ["Execute Macro" call-last-kbd-macro last-kbd-macro]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 ["Start Macro Recording" start-kbd-macro (not defining-kbd-macro)]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 ["End Macro Recording" end-kbd-macro defining-kbd-macro]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 "-----"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 ["Spell" ispell-buffer t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 ["Sort" sort-lines t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 "-----"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 ["Format Paragraph " fill-paragraph t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 "-----"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 ["Goto Line:" goto-line t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 ;; the following is supposed to be here! It ensures that the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 ;; Help item is always the rightmost item.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 nil ; the partition: menus after this are flushright
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 '("Help" ["About XEmacs..." about-xemacs t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 "-----"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 ["XEmacs WWW Page" xemacs-www-page t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 ["XEmacs FAQ via WWW" xemacs-www-faq t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 "-----"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 ["Info" info t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 ["Describe Mode" describe-mode t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 ["Hyper Apropos..." hyper-apropos t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 ["Command Apropos..." command-apropos t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 ["Full Apropos..." apropos t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 ["List Keybindings" describe-bindings t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 ["Describe Key..." describe-key t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 ["Describe Function..." describe-function t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 ["Describe Variable..." describe-variable t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 "-----"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 ["Unix Manual..." manual-entry t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 ["XEmacs Tutorial" help-with-tutorial t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 ["XEmacs News" view-emacs-news t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 ))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 (set-menubar sunpro-menubar)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 (defconst programmer-menu '(["Programmer Menus"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 (toggle-programmer-menus)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 :style toggle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 :selected programmer-menus-p]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 ["-----! before save options" nil t]))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 (setq save-options-menu-item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 (car (find-menu-item default-menubar '("Options" "Save Options"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 (delete-menu-item '("Options" "Save Options"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 (add-menu () "Options" (append
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 (cdr (car
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 (find-menu-item default-menubar '("Options"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 programmer-menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 (list save-options-menu-item)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 ;;; helper commands
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 (defun sunpro-new-buffer ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 (switch-to-buffer (generate-new-buffer "Untitled")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 (defun sunpro-new-window ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 (switch-to-buffer-other-frame (generate-new-buffer "Untitled")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 (defun sunpro-clone-buffer ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 (let
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 ((old (current-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 (switch-to-buffer (generate-new-buffer (buffer-name old)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 (insert-buffer old)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 (defun sunpro-search-forward ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 (if isearch-mode (isearch-repeat-forward)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 (x-isearch-maybe-with-region)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 (defun sunpro-search-backward ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 (if isearch-mode (isearch-repeat-backward)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 (x-isearch-maybe-with-region t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 (put 'sunpro-search-forward 'isearch-command t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 (put 'sunpro-search-backward 'isearch-command t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 (defun sunpro-query-replace ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 (call-interactively 'query-replace))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 (defun sunpro-menu-quit ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 "Abort minibuffer input if any."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 (while (not (zerop (minibuffer-depth)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 (abort-recursive-edit)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 (defvar programmer-menus-p nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 (defvar sccs-or-vc-menus 'sccs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 "Choose to use the SCCS or the VC menu.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 (defun toggle-programmer-menus ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 (if programmer-menus-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 (if (equal sccs-or-vc-menus 'sccs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 (delete-menu-item '("SCCS"))
149
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 0
diff changeset
174 (delete-menu-item '("Version Control")))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 (delete-menu-item '("SPARCworks"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 (delete-menu-item '("Options" "SPARCworks"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 (delete-menu-item '("Options" "-----! before save options"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 (delete-menu-item '("Help" "SPARCworks"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 (setq programmer-menus-p nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 (require 'eos-load "sun-eos-load")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 (eos::start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 (if (equal sccs-or-vc-menus 'sccs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 (progn
149
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 0
diff changeset
185 (delete-menu-item '("Version Control"))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 (require 'sccs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 (add-menu '() "SCCS" (cdr sccs-menu)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 (require 'vc)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 (delete-menu-item '("SCCS"))
149
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 0
diff changeset
191 (add-menu '() "Version Control" vc-default-menu)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 (setq programmer-menus-p t))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 (defun sunpro-build-buffers-menu-hook ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 "For use as a value of activate-menubar-hook.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 This function changes the contents of the \"View\" menu to add
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 at the end the current set of buffers. Only the most-recently-used few buffers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 will be listed on the menu, for efficiency reasons. You can control how
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 many buffers will be shown by setting `buffers-menu-max-size'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 You can control the text of the menu items by redefining the function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 `format-buffers-menu-line'."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 (let ((buffer-menu (car (find-menu-item current-menubar '("View"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 buffers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 (if (not buffer-menu)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 (setq buffer-menu (cdr buffer-menu))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 (setq buffers (buffer-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 (if (and (integerp buffers-menu-max-size)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 (> buffers-menu-max-size 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 (if (> (length buffers) buffers-menu-max-size)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 (setcdr (nthcdr buffers-menu-max-size buffers) nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 (setq buffers (build-buffers-menu-internal buffers))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 (setq buffers (append (delq nil buffers)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 ;; slightly (only slightly) more efficient to not install the menubar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 ;; if it hasn't visibly changed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 (let ((tail (member "-----! before list all buffers" (cdr buffer-menu)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 (if tail
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 (if (equal buffers (cdr tail))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 t ; return t meaning "no change"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 (setcdr tail buffers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 ;; only the first time
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 (add-menu nil "View" (append buffer-menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 '("-----! before list all buffers")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 buffers))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 )))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 (add-hook 'activate-menubar-hook 'sunpro-build-buffers-menu-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 ;;; sunpro-menubar.el ends here