comparison lisp/easymenu.el @ 5473:ac37a5f7e5be

Merge with trunk.
author Mats Lidell <matsl@xemacs.org>
date Thu, 17 Mar 2011 23:42:59 +0100
parents b9167d522a9a f00192e1cd49
children cc6f0266bc36
comparison
equal deleted inserted replaced
5472:e79980ee5efe 5473:ac37a5f7e5be
190 ; "easy-menu-all-popups is %s") 190 ; "easy-menu-all-popups is %s")
191 ; menu mode-popup-menu (current-buffer) 191 ; menu mode-popup-menu (current-buffer)
192 ; (default-value 'mode-popup-menu) easy-menu-all-popups) 192 ; (default-value 'mode-popup-menu) easy-menu-all-popups)
193 (when (featurep 'menubar) 193 (when (featurep 'menubar)
194 ;; Save the existing mode-popup-menu, if it's been changed. 194 ;; Save the existing mode-popup-menu, if it's been changed.
195 (when (and (zerop (length easy-menu-all-popups)) 195 (when (and (eql (length easy-menu-all-popups) 0)
196 (not (equal (default-value 'mode-popup-menu) mode-popup-menu))) 196 (not (equal (default-value 'mode-popup-menu) mode-popup-menu)))
197 (push mode-popup-menu easy-menu-all-popups)) 197 (push mode-popup-menu easy-menu-all-popups))
198 ;; Add the menu to our list of all the popups for the buffer. 198 ;; Add the menu to our list of all the popups for the buffer.
199 (pushnew menu easy-menu-all-popups :test 'equal) 199 (pushnew menu easy-menu-all-popups :test 'equal)
200 ;; If there are multiple popup menus available, make the popup menu 200 ;; If there are multiple popup menus available, make the popup menu
201 ;; normally shown with button-3 a menu of them. If there is just one, 201 ;; normally shown with button-3 a menu of them. If there is just one,
202 ;; make that button show it, and no super-menu. 202 ;; make that button show it, and no super-menu.
203 (setq mode-popup-menu (if (= 1 (length easy-menu-all-popups)) 203 (setq mode-popup-menu (if (eql 1 (length easy-menu-all-popups))
204 (car easy-menu-all-popups) 204 (car easy-menu-all-popups)
205 (cons (easy-menu-title) 205 (cons (easy-menu-title)
206 (reverse easy-menu-all-popups)))) 206 (reverse easy-menu-all-popups))))
207 (cond ((null current-menubar) 207 (cond ((null current-menubar)
208 ;; Don't add it to a non-existing menubar. 208 ;; Don't add it to a non-existing menubar.
225 ;; Remove this menu from the list of popups we know about. 225 ;; Remove this menu from the list of popups we know about.
226 easy-menu-all-popups (delq menu easy-menu-all-popups) 226 easy-menu-all-popups (delq menu easy-menu-all-popups)
227 ;; If there are multiple popup menus available, make the popup menu 227 ;; If there are multiple popup menus available, make the popup menu
228 ;; normally shown with button-3 a menu of them. If there is just one, 228 ;; normally shown with button-3 a menu of them. If there is just one,
229 ;; make that button show it, and no super-menu. 229 ;; make that button show it, and no super-menu.
230 mode-popup-menu (if (= 1 (length easy-menu-all-popups)) 230 mode-popup-menu (if (eql 1 (length easy-menu-all-popups))
231 (car easy-menu-all-popups) 231 (car easy-menu-all-popups)
232 (cons (easy-menu-title) 232 (cons (easy-menu-title)
233 (reverse easy-menu-all-popups)))) 233 (reverse easy-menu-all-popups))))
234 ;; If we've just set mode-popup-menu to an empty menu, change that menu 234 ;; If we've just set mode-popup-menu to an empty menu, change that menu
235 ;; to its default value (without intervention from easy-menu). 235 ;; to its default value (without intervention from easy-menu).
236 (if (zerop (length easy-menu-all-popups)) 236 (if (eql (length easy-menu-all-popups) 0)
237 (setq mode-popup-menu (default-value 'mode-popup-menu))) 237 (setq mode-popup-menu (default-value 'mode-popup-menu)))
238 (and current-menubar 238 (and current-menubar
239 (assoc (car menu) current-menubar) 239 (assoc (car menu) current-menubar)
240 (delete-menu-item (list (car menu)))))) 240 (delete-menu-item (list (car menu))))))
241 241