changeset 39524:291264d596e9

(cal-menu-x-popup-menu): New function, calls x-popup-menu only if popup menus are supported. (calendar-mouse-insert-hebrew-diary-entry) (calendar-mouse-insert-islamic-diary-entry) (calendar-mouse-holidays, calendar-mouse-view-diary-entries) (calendar-mouse-view-other-diary-entries) (calendar-mouse-print-dates, calendar-mouse-2-date-menu) (calendar-mouse-cal-tex-menu, cal-tex-mouse-filofax): Call cal-menu-x-popup-menu instead of x-popup-menu.
author Eli Zaretskii <eliz@gnu.org>
date Mon, 01 Oct 2001 11:05:50 +0000
parents 183567a011b1
children a6d5de4897d6
files lisp/calendar/cal-menu.el
diffstat 1 files changed, 16 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/calendar/cal-menu.el	Mon Oct 01 11:05:18 2001 +0000
+++ b/lisp/calendar/cal-menu.el	Mon Oct 01 11:05:50 2001 +0000
@@ -161,6 +161,13 @@
 (define-key calendar-mode-map [menu-bar scroll fwd-1]
   '("Forward 1 Month" . scroll-calendar-left))
 
+(defun cal-menu-x-popup-menu (position menu)
+  "Like `x-popup-menu', but prints an error message if popup menus are
+not available."
+  (if (display-popup-menus-p)
+      (x-popup-menu position menu)
+    (error "Popup menus are not available on this system.")))
+
 (defun cal-menu-list-holidays-year ()
   "Display a list of the holidays of the selected date's year."
   (interactive)
@@ -244,7 +251,7 @@
   "Pop up menu to insert a Hebrew-date diary entry."
   (interactive "e")
   (let ((hebrew-selection
-         (x-popup-menu
+         (cal-menu-x-popup-menu
           event
           (list "Hebrew insert menu"
                 (list (calendar-hebrew-date-string (calendar-cursor-to-date))
@@ -257,7 +264,7 @@
   "Pop up menu to insert an Islamic-date diary entry."
   (interactive "e")
   (let ((islamic-selection
-         (x-popup-menu
+         (cal-menu-x-popup-menu
           event
           (list "Islamic insert menu"
                 (list (calendar-islamic-date-string (calendar-cursor-to-date))
@@ -287,7 +294,7 @@
          (l (mapcar '(lambda (x) (list x))
                     (check-calendar-holidays date)))
          (selection
-          (x-popup-menu
+          (cal-menu-x-popup-menu
            event
            (list
             (format "Holidays for %s" (calendar-date-string date))
@@ -305,7 +312,7 @@
                           (diary-display-hook 'ignore))
                       (list-diary-entries date 1))))
          (selection
-          (x-popup-menu
+          (cal-menu-x-popup-menu
            event
            (list
             (format "Diary entries for %s" (calendar-date-string date))
@@ -331,7 +338,7 @@
          (l (mapcar '(lambda (x) (list (car (cdr x))))
                     (list-diary-entries date 1)))
          (selection
-          (x-popup-menu
+          (cal-menu-x-popup-menu
            event
            (list
             (format "Diary entries from %s for %s"
@@ -459,7 +466,7 @@
   (interactive)
   (let ((date (calendar-event-to-date))
         (selection
-         (x-popup-menu
+         (cal-menu-x-popup-menu
           event
           (list
            (concat (calendar-date-string date) " (Gregorian)")
@@ -519,7 +526,7 @@
   (interactive "e")
   (let* ((date (calendar-event-to-date t))
          (selection
-          (x-popup-menu
+          (cal-menu-x-popup-menu
            event
            (list (calendar-date-string date t nil)
                  (list
@@ -540,7 +547,7 @@
   "Pop up submenu for Mouse-2 for cal-tex commands for selected date in the calendar window."
   (interactive "e")
   (let* ((selection
-          (x-popup-menu
+          (cal-menu-x-popup-menu
            event
            (list (calendar-date-string date t nil)
                  (list
@@ -563,7 +570,7 @@
   "Pop up sub-submenu for Mouse-2 for Filofax cal-tex commands for selected date."
   (interactive "e")
   (let* ((selection
-          (x-popup-menu
+          (cal-menu-x-popup-menu
            event
            (list (calendar-date-string date t nil)
                  (list