home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / languages / elisp / packages / MouseAndMenuEmacs / x-cl-fns.el < prev    next >
Encoding:
Text File  |  1990-05-31  |  2.1 KB  |  69 lines

  1. ;;;; X mouse functions for Common Lisp mode.
  2. ;;;; Russell Ritchie, Scottish HCI Centre, <russell@uk.ac.strath.hci>.
  3. ;;;; Wed Jun 21 15:52:38 1989 
  4.  
  5. (require 'x-mouse)
  6. ;;(require 'clman) ; clman is not "#'provide"d...
  7. (provide 'x-cl-fns)
  8.  
  9. (autoload 'fi::clman-backward-copy-sexp-as-kill "fi/clman") ; Near require.
  10.  
  11. (defvar x-mouse-cl-symbol-prompt-p nil
  12.   "*If non-nil the minibuffer should be used to prompt for a Common Lisp symbol
  13. when none can be found near point in the buffer the mouse is in.")
  14.  
  15. (defun x-mouse-clman (arg)
  16.   "Run fi:clman on the symbol the mouse is pointing at."
  17.   (eval-in-window
  18.     x-mouse-window
  19.     (x-mouse-set-point arg)
  20.     (fi:clman (get-default-common-lisp-symbol))))
  21.  
  22. (defun get-default-common-lisp-symbol (&optional prompt up-p)
  23.   (let* ((symbol-at-point
  24.       (condition-case ()
  25.           (save-excursion
  26.         (if up-p
  27.             (progn
  28.               (if (= (following-char) ?\() (forward-char 1))
  29.               (if (= (preceding-char) ?\)) (forward-char -1))
  30.               (up-list -1)
  31.               (forward-char 1)))
  32.         (while (looking-at "\\sw\\|\\s_")
  33.           (forward-char 1))
  34.         (if (re-search-backward "\\sw\\|\\s_" nil t)
  35.             (progn (forward-char 1)
  36.                (buffer-substring
  37.                 (point)
  38.                 (progn (forward-sexp -1)
  39.                    (while (looking-at "\\s'")
  40.                      (forward-char 1))
  41.                    (point))))
  42.           nil))
  43.         (error nil)))
  44.      (read-symbol
  45.       (or symbol-at-point
  46.           (if x-mouse-cl-symbol-prompt-p
  47.           (read-string (format "%s: " (or prompt "Which symbol: ")))
  48.         (error "Can't find a Common Lisp symbol here."))))
  49.      (symbol (if (string= read-symbol "")
  50.              symbol-at-point
  51.            read-symbol))
  52.      (colonp (string-match ":?:" symbol nil)))
  53.     (if (and (not colonp) fi:package)
  54.     (setq symbol (format "%s::%s" fi:package symbol)))
  55.     symbol))
  56.  
  57. (defun x-mouse-describe (arg)
  58.   "Run fi:lisp-describe on the symbol the mouse is pointing at."
  59.   (eval-in-window
  60.     x-mouse-window
  61.     (x-mouse-set-point arg)
  62.     (fi:lisp-describe (get-default-common-lisp-symbol))))
  63.  
  64. (defun x-mouse-arglist (arg)
  65.   "Run fi:lisp-arglist on the symbol the mouse is pointing at."  
  66.   (eval-in-window
  67.     x-mouse-window
  68.     (x-mouse-set-point arg)
  69.     (fi:lisp-arglist (get-default-common-lisp-symbol))))