home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 2: Applications / Linux Cubed Series 2 - Applications.iso / editors / emacs / xemacs / xemacs-1.006 / xemacs-1 / lib / xemacs-19.13 / lisp / w3 / w3-mac.el < prev    next >
Encoding:
Text File  |  1995-06-05  |  3.1 KB  |  88 lines

  1. ;;; w3-mac.el,v --- Macintosh specific functions for emacs-w3
  2. ;; Author: wmperry
  3. ;; Created: 1995/05/27 02:50:00
  4. ;; Version: 1.15
  5. ;; Keywords: faces, help, mouse, hypermedia
  6.  
  7. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  8. ;;; Copyright (c) 1993, 1994, 1995 by William M. Perry (wmperry@spry.com)
  9. ;;;
  10. ;;; This file is part of GNU Emacs.
  11. ;;;
  12. ;;; GNU Emacs is free software; you can redistribute it and/or modify
  13. ;;; it under the terms of the GNU General Public License as published by
  14. ;;; the Free Software Foundation; either version 2, or (at your option)
  15. ;;; any later version.
  16. ;;;
  17. ;;; GNU Emacs is distributed in the hope that it will be useful,
  18. ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  20. ;;; GNU General Public License for more details.
  21. ;;;
  22. ;;; You should have received a copy of the GNU General Public License
  23. ;;; along with GNU Emacs; see the file COPYING.  If not, write to
  24. ;;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  25. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  26.  
  27. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  28. ;;; Macintosh emacs specifics... these could kill your emacs
  29. ;;; Resistance is futile, you will be quickdrawn
  30. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  31.  
  32. (defvar w3-main-menu-id nil "*Mac ID of the main WWW menu.")
  33. (defvar w3-help-menu-id nil "*Mac ID of the WWW help menu.")
  34. (defvar w3-navigate-menu-id nil "*Mac ID of the WWW navigation menu.")
  35.  
  36. (defun w3-install-menu-lucid-style (menudesc)
  37.   "Install a lucid style menu on the mac version of emacs 18"
  38.   (let ((mnu (NewMenu (get-unique-menu-ID) (car menudesc)))
  39.     tmp)
  40.     (setq menudesc (cdr menudesc))
  41.     (while menudesc
  42.       (setq tmp (car menudesc)
  43.         menudesc (cdr menudesc))
  44.       (cond
  45.        ((vectorp tmp)            ; Menu description
  46.     (AppendMenu mnu (aref tmp 0) 'w3-generic-mac-menu-callback))
  47.        ((stringp tmp)            ; Separator
  48.     (AppendMenu mnu "(-" nil))
  49.        ((listp tmp)            ; Submenu
  50.     nil)                ; Ignore for now
  51.        ((null tmp)            ; Null??
  52.     (AppendMenu mnu "(-" nil))
  53.        (t (message "Bad menu descriptor %s" tmp))))
  54.     (InsertMenu mnu buffers-menu)
  55.     (DrawMenuBar)
  56.     mnu))
  57.  
  58. (defun w3-find-action-by-name (item menu)
  59.   (let (retval)
  60.     (while (and menu (not retval))
  61.       (if (equal (aref (car menu) 0) item)
  62.       (setq retval (aref (car menu) 1)))
  63.       (setq menu (cdr menu)))
  64.     retval))
  65.  
  66. (defun w3-generic-mac-menu-callback (menu item)
  67.   (let ((s (make-string 256 0)) act)
  68.     (GetItem menu item s)
  69.     (setq s (mapconcat
  70.          (function
  71.           (lambda (x)
  72.         (if (= 0 x) "" (char-to-string x)))) (substring s 1 nil) ""))
  73.     (cond
  74.      ((= menu w3-main-menu-id)
  75.       )
  76.      ((= menu w3-help-menu-id)
  77.       )
  78.      ((= menu w3-navigate-menu-id)
  79.       ))
  80.     (cond
  81.      ((null act) (message "%s not found." s))
  82.      ((symbolp act) (funcall act))
  83.      ((listp act) (eval act))
  84.      ((stringp act) (message "%s" act))
  85.      (t (message "ACK! %s not found." s)))))
  86.  
  87. (provide 'w3-mac)
  88.