From: yoichi Date: Sat, 8 Feb 2003 08:05:56 +0000 (+0000) Subject: * semi-def.el (mime-should-use-popup-menu): New function. X-Git-Tag: semi-1_14_6~26 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=1325b8e529129b192524aeb3076e1d47e22be1c5;p=elisp%2Fsemi.git * semi-def.el (mime-should-use-popup-menu): New function. (mime-select-menu-alist): Renamed from select-menu-alist, change its behavior according to mime-should-use-popup-menu. * mime-play.el (mime-play-entity): Change accordingly. --- diff --git a/ChangeLog b/ChangeLog index d0f20c0..f07e31a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2003-02-08 Yoichi NAKAYAMA + * semi-def.el (mime-should-use-popup-menu): New function. + (mime-select-menu-alist): Renamed from select-menu-alist, change + its behavior according to mime-should-use-popup-menu. + * mime-play.el (mime-play-entity): Change accordingly. + +2003-02-08 Yoichi NAKAYAMA + * mime-view.el (mime-save-situation-examples): Bind print-length and print-level. diff --git a/mime-play.el b/mime-play.el index 300640d..43221e6 100644 --- a/mime-play.el +++ b/mime-play.el @@ -96,7 +96,7 @@ specified, play as it. Default MODE is \"play\"." (setq mime-acting-situation-example-list (cdr ret) ret (car ret)) (cond ((cdr ret) - (setq ret (select-menu-alist + (setq ret (mime-select-menu-alist "Methods" (mapcar (function (lambda (situation) diff --git a/semi-def.el b/semi-def.el index fa5bf15..e969c1a 100644 --- a/semi-def.el +++ b/semi-def.el @@ -128,39 +128,42 @@ ;;; @ menu ;;; -(if window-system - (if (featurep 'xemacs) - (defun select-menu-alist (title menu-alist) - (let (ret) - (popup-menu - (list* title - "---" - (mapcar (function - (lambda (cell) - (vector (car cell) - `(progn - (setq ret ',(cdr cell)) - (throw 'exit nil) - ) - t) - )) - menu-alist) - )) - (recursive-edit) - ret)) - (defun select-menu-alist (title menu-alist) - (x-popup-menu - (list '(1 1) (selected-window)) - (list title (cons title menu-alist)) - )) - ) - (defun select-menu-alist (title menu-alist) - (cdr - (assoc (completing-read (concat title " : ") menu-alist) - menu-alist) - )) - ) - +(static-cond ((featurep 'xemacs) + (defun mime-should-use-popup-menu () + (and window-system + (mouse-event-p last-command-event))) + (defun mime-select-menu-alist (title menu-alist) + (if (mime-should-use-popup-menu) + (let (ret) + (popup-menu + (list* title + "---" + (mapcar (function + (lambda (cell) + (vector (car cell) + `(progn + (setq ret ',(cdr cell)) + (throw 'exit nil)) + t))) + menu-alist))) + (recursive-edit) + ret) + (cdr + (assoc (completing-read (concat title " : ") menu-alist) + menu-alist))))) + (t + (defun mime-should-use-popup-menu () + (and window-system + (memq (event-basic-type last-command-event) + '(mouse-1 mouse-2 mouse-3)))) + (defun mime-select-menu-alist (title menu-alist) + (if (mime-should-use-popup-menu) + (x-popup-menu + (list '(1 1) (selected-window)) + (list title (cons title menu-alist))) + (cdr + (assoc (completing-read (concat title " : ") menu-alist) + menu-alist)))))) ;;; @ Other Utility ;;;