[Openmcl-devel] accessing pathname of Lisp file containing code evaluated via Execute Selection

Ron Garret ron at flownet.com
Thu Mar 11 09:12:50 PST 2010


On Mar 9, 2010, at 3:49 PM, Alexander Repenning wrote:

> Are there handy dandy Hemlock functions allowing me to detect that  I am being evaluated in the context of a Hemlock Execute Selection?

No (at least AFAIK), but you can roll your own, something like:

(in-package :hemlock)
(defvar *hemlock-execute-selection-p* nil)
(defun eval-region (region
		    &key
		    (package (variable-value 'current-package :buffer (current-buffer)))
		    (path (buffer-pathname (current-buffer))))
  (ccl::application-ui-operation
   ccl:*application*
   :eval-selection
   (list package
         path
         (format nil "(let ((hemlock::*hemlock-execute-selection-p* t)) ~A)"
                 (region-to-string region))
         (mark-absolute-position (region-start region)))))

There are lots of variations on this theme depending on exactly what you mean by "in the context of a Hemlock Execute Selection".

> Also, I would need to access the pathname of the file containing me. 

That's ccl::*loading-file-source-file*

rg




More information about the Openmcl-devel mailing list