Changeset 12782
- Timestamp:
- Sep 8, 2009, 1:27:21 PM (10 years ago)
- Location:
- trunk/source/contrib/foy/list-definitions-cm
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/contrib/foy/list-definitions-cm/history-lists.lisp
r12746 r12782 32 32 (defParameter *file-history-list-length* 25) 33 33 34 (export '(notify))35 36 ;;; This includes a work-around for what appears to be a bug in the hemlock-frame37 ;;; #/close method. After a #/close, the window remains on the (#/orderedWindows *NSApp*)38 ;;; list, but (hi::buffer-document buffer) in NIL. Therefore the extra tests:39 (defun window-with-path (path)40 "If a window with PATH is open, return it."41 (gui::first-window-satisfying-predicate42 #'(lambda (w)43 (when (and (typep w 'gui::hemlock-frame)44 (not (typep w 'gui::hemlock-listener-frame)))45 (let* ((pane (slot-value w 'gui::pane))46 (text-view (gui::text-pane-text-view pane))47 (buffer (gui::hemlock-buffer text-view))48 (document (when buffer (hi::buffer-document buffer)))49 (p (hi::buffer-pathname buffer)))50 (when (and document p) (string-equal path p)))))))51 52 34 (defun maybe-open-file (path) 53 35 "If a window with PATH is open, return it. Otherwise open a new window." 54 (let ((w ( window-with-path path)))36 (let ((w (cmenu:window-with-path path))) 55 37 (if w 56 38 w … … 65 47 (hemlock::user-homedir-pathname))) 66 48 67 (defun notify (message)68 "FYI"69 (gui::alert-window :title "Notification" :message message))70 49 71 50 ;;; ---------------------------------------------------------------------------- … … 86 65 (let* ((name (hle-name entry)) 87 66 (path (hle-path entry)) 88 (window ( window-with-path path))67 (window (cmenu:window-with-path path)) 89 68 mark def-list text-view hemlock-view) 90 69 (unless (probe-file path) 91 ( notify (format nil "~a does not exist. It will be deleted from the history lists."70 (cmenu:notify (format nil "~a does not exist. It will be deleted from the history lists." 92 71 path)) 93 72 (purge-file-references *position-history-list* path) … … 117 96 (move-entry-to-front *file-history-list* path) t) 118 97 (t 119 ( notify (format nil "Cannot find ~S. It will be deleted from the position history list."98 (cmenu:notify (format nil "Cannot find ~S. It will be deleted from the position history list." 120 99 name)) 121 100 (remove-entry *position-history-list* name) nil))))) … … 130 109 (let ((path (hle-path entry))) 131 110 (unless (probe-file path) 132 ( notify (format nil "~S does not exist. It will be deleted from the history lists." path))111 (cmenu:notify (format nil "~S does not exist. It will be deleted from the history lists." path)) 133 112 (purge-file-references *position-history-list* path) 134 113 (remove-path *file-history-list* path) 135 114 (return-from show-entry nil)) 136 (let ((window ( window-with-path path)))115 (let ((window (cmenu:window-with-path path))) 137 116 (unless window 138 117 (let ((hemlock-view (gui::cocoa-edit path))) … … 426 405 (defMethod read-history-list ((hl history-list) stream &optional position-p) 427 406 (flet ((oops () 428 ( notify (format nil "There is a problem with ~S. Setting the history to NIL." (hl-path hl)))407 (cmenu:notify (format nil "There is a problem with ~S. Setting the history to NIL." (hl-path hl))) 429 408 (setf (hl-list hl) nil) 430 409 ;;; delete the file? … … 494 473 ;;; 495 474 (objc:defmethod (#/becomeKeyWindow :void) ((w gui::hemlock-frame)) 496 (let* ((path ( window-path w))475 (let* ((path (cmenu:window-path w)) 497 476 (name (when (and path (string-equal (pathname-type path) "lisp")) 498 477 (concatenate 'string (pathname-name path) ".lisp")))) -
trunk/source/contrib/foy/list-definitions-cm/list-definitions.lisp
r12735 r12782 3 3 ;;; ---------------------------------------------------------------------------- 4 4 ;;; 5 ;;; list-definitions isp5 ;;; list-definitions.lisp 6 6 ;;; 7 7 ;;; copyright (c) 2009 Glen Foy … … 33 33 (require :context-menu-cm) 34 34 35 (export '(find-and-display-definition ))35 (export '(find-and-display-definition window-path active-hemlock-window)) 36 36 37 37 (defParameter *objc-defmethod-search-pattern* (hi::new-search-pattern :string-insensitive :forward "(objc:defmethod")) … … 45 45 46 46 (defmacro clone (mark) `(hi::copy-mark ,mark :temporary)) 47 48 (defun active-hemlock-window ()49 "Return the active hemlock-frame."50 (gui::first-window-satisfying-predicate51 #'(lambda (w)52 (and (typep w 'gui::hemlock-frame)53 (not (typep w 'gui::hemlock-listener-frame))54 (#/isKeyWindow w)))))55 56 (defun window-path (w)57 "Return the window's path."58 (let* ((pane (slot-value w 'gui::pane))59 (hemlock-view (when pane (gui::text-pane-hemlock-view pane)))60 (buffer (when hemlock-view (hi::hemlock-view-buffer hemlock-view))))61 (when buffer (hi::buffer-pathname buffer))))62 47 63 48 ;;; ---------------------------------------------------------------------------- … … 149 134 :sub-title (if alpha-p "alphabetical" "positional") 150 135 :menu-text-view text-view 151 :menu-path ( window-path (#/window text-view))))152 (window ( active-hemlock-window))136 :menu-path (cmenu:window-path (#/window text-view)))) 137 (window (cmenu:active-hemlock-window)) 153 138 (alist (when window (list-definitions window alpha-p))) 154 139 (class-icon (#/iconForFileType: (#/sharedWorkspace ns:ns-workspace) (ccl::%make-nsstring "lisp"))) … … 367 352 (defun find-and-display-definition (name path) 368 353 "Display the file and scroll to the definition position." 369 (let ((window ( window-with-path path))354 (let ((window (cmenu:window-with-path path)) 370 355 mark def-list text-view hemlock-view) 371 356 (unless (probe-file path) 372 ( notify (format nil "~a does not exist."357 (cmenu:notify (format nil "~a does not exist." 373 358 path)) 374 359 (return-from find-and-display-definition nil))
Note: See TracChangeset
for help on using the changeset viewer.