Lisp HUG Maillist Archive

Maybe someone missed it

as I did. I found this features very nice in Slime you go anywhere you
find a variable put the cursor on it an run inspect. I did not find
anything like that (maybe I just missed it) and Inspect Variable
always prompts me. I assume one can modify it to do what I prefer
finding the thing at point and after that, but I helped myself with
the following:
(defun read-symbol-at-point (point &key (previous t))
  (let ((as-is t))
    (when-let (symbol-name
               (read-symbol-from-point :point point
                                       :previous previous
                                       :read-package-name t))

      (multiple-value-bind (sym status)
          (find-symbol symbol-name
                       (buffer-package-to-use point))
        (if status
            (values sym status)
          (find-symbol (string-upcase symbol-name)
                       (buffer-package-to-use point)))))))
                   




(defcommand "Inspect variable at point" (p)
                "Runs the Inspector on the variable at point."
                (declare(ignore p))
  (multiple-value-bind (sym status)
      (read-symbol-at-point (current-point))
    (when status
        (editor-inspect sym))))

I guess it could be improved, but at least it does what I want. I put
the cursor anywhere type F5 (at least if you bound this function to
that key and get an inspector. Nic'n easy ;-)

Feel free to improve or forget it but do not sue me if anything went
wrong.

Happy lisping
Friedrich


Re: Maybe someone missed it

On Jul 23, 2005, at 7:14 AM, Friedrich Dominicus wrote:

> as I did. I found this features very nice in Slime you go anywhere you
> find a variable put the cursor on it an run inspect. I did not find
> anything like that (maybe I just missed it) and Inspect Variable
> always prompts me. I assume one can modify it to do what I prefer
> finding the thing at point and after that, but I helped myself with
> the following:

Is this different than clicking on the variable then selecting 
Expression>>InspectVariable from either the main menu or context menu? 
I think I'm going to have to spend a weekend pretty soon and learn LW's 
IDE, I've been using this thing pretty much daily for more than a year 
now and still don't feel that I've got any real understanding of what I 
can do. What I mean is that it feels to me that it is quite likely that 
I don't even understand what you are obtaining with your command. I am 
still in the situation where the "nice and easy" bit you mention still 
requires me to read the manual so I haven't tried your code yet. On the 
other hand, the (editor::editor-inspect sym) does the same thing as I 
mention.

> (defun read-symbol-at-point (point &key (previous t))
>   (let ((as-is t))
>     (when-let (symbol-name
>                (read-symbol-from-point :point point
>                                        :previous previous
>                                        :read-package-name t))
>
>       (multiple-value-bind (sym status)
>           (find-symbol symbol-name
>                        (buffer-package-to-use point))
>         (if status
>             (values sym status)
>           (find-symbol (string-upcase symbol-name)
>                        (buffer-package-to-use point)))))))
>
>
>
>
>
> (defcommand "Inspect variable at point" (p)
>                 "Runs the Inspector on the variable at point."
>                 (declare(ignore p))
>   (multiple-value-bind (sym status)
>       (read-symbol-at-point (current-point))
>     (when status
>         (editor-inspect sym))))
>
> I guess it could be improved, but at least it does what I want. I put
> the cursor anywhere type F5 (at least if you bound this function to
> that key and get an inspector. Nic'n easy ;-)
>
> Feel free to improve or forget it but do not sue me if anything went
> wrong.
>
> Happy lisping
> Friedrich
>
>
----
Bob Hutchison          -- blogs at <http://www.recursive.ca/hutch/>
Recursive Design Inc.  -- <http://www.recursive.ca/>


Re: Maybe someone missed it

At 23/07/2005 15:07, Bob Hutchison wrote:

>On Jul 23, 2005, at 7:14 AM, Friedrich Dominicus wrote:
>
>>as I did. I found this features very nice in Slime you go anywhere you
>>find a variable put the cursor on it an run inspect. I did not find
>>anything like that (maybe I just missed it) and Inspect Variable
>>always prompts me. I assume one can modify it to do what I prefer
>>finding the thing at point and after that, but I helped myself with
>>the following:
>
>Is this different than clicking on the variable then selecting 
>Expression>>InspectVariable from either the main menu or context menu?

It's "Inspect value" (not InspectVariable). Often, like Friedrich 
I think, I want to inspect the symbol too. That's why I have two 
different commands, both bound to a key (in fact, usually, I 
don't use the second command, Inspect-symbol-value)

Notice:
- it suffices to use editor::prompt-for-symbol (no need to define read-symbol-at-point)
- editor::*prompt-for-symbol-confirm* is bound to nil, which 
allows to inspect the symbol in just one key press. Of course 
from this inspector window, you can inspect the value too.

(defcommand "inspect-symbol" (p)
      (let* ((editor::*prompt-for-symbol-confirm* nil)
             (symbol (editor::prompt-for-symbol p))
             (old lispworks:*inspect-through-gui*))
        (unwind-protect
            (progn
              (setf lispworks:*inspect-through-gui* t)
              (inspect symbol))
          (setf lispworks:*inspect-through-gui* old))))

(defcommand "inspect-symbol-value" (p)
      (let* ((editor::*prompt-for-symbol-confirm* nil)
             (symbol (editor::prompt-for-symbol p))
             (old lispworks:*inspect-through-gui*))
        (unwind-protect
            (progn
              (setf lispworks:*inspect-through-gui* t)
              (cond ((boundp symbol)
                     (inspect (symbol-value symbol)))
                    (t (message "~s is not bound" symbol))))
          (setf lispworks:*inspect-through-gui* old))))

(bind-key "inspect-symbol" "F8")
(bind-key "Inspect-symbol-value" #\shift-f8)

Francis

>I think I'm going to have to spend a weekend pretty soon and 
>learn LW's IDE, I've been using this thing pretty much daily for 
>more than a year now and still don't feel that I've got any real 
>understanding of what I can do. What I mean is that it feels to 
>me that it is quite likely that I don't even understand what you 
>are obtaining with your command. I am still in the situation 
>where the "nice and easy" bit you mention still requires me to 
>read the manual so I haven't tried your code yet. On the other 
>hand, the (editor::editor-inspect sym) does the same thing as I mention.
>
>>(defun read-symbol-at-point (point &key (previous t))
>>   (let ((as-is t))
>>     (when-let (symbol-name
>>                (read-symbol-from-point :point point
>>                                        :previous previous
>>                                        :read-package-name t))
>>
>>       (multiple-value-bind (sym status)
>>           (find-symbol symbol-name
>>                        (buffer-package-to-use point))
>>         (if status
>>             (values sym status)
>>           (find-symbol (string-upcase symbol-name)
>>                        (buffer-package-to-use point)))))))
>>
>>(defcommand "Inspect variable at point" (p)
>>                 "Runs the Inspector on the variable at point."
>>                 (declare(ignore p))
>>   (multiple-value-bind (sym status)
>>       (read-symbol-at-point (current-point))
>>     (when status
>>         (editor-inspect sym))))
>>
>>I guess it could be improved, but at least it does what I want. I put
>>the cursor anywhere type F5 (at least if you bound this function to
>>that key and get an inspector. Nic'n easy ;-)
>>
>>Feel free to improve or forget it but do not sue me if anything went
>>wrong.
>>
>>Happy lisping
>>Friedrich
>>
>----
>Bob Hutchison          -- blogs at <http://www.recursive.ca/hutch/>
>Recursive Design Inc.  -- <http://www.recursive.ca/>
>
>


Re: Maybe someone missed it

Francis Leboutte <f.leboutte@algo.be> writes:

> At 23/07/2005 15:07, Bob Hutchison wrote:
>
>>On Jul 23, 2005, at 7:14 AM, Friedrich Dominicus wrote:
>>
>>>as I did. I found this features very nice in Slime you go anywhere you
>>>find a variable put the cursor on it an run inspect. I did not find
>>>anything like that (maybe I just missed it) and Inspect Variable
>>>always prompts me. I assume one can modify it to do what I prefer
>>>finding the thing at point and after that, but I helped myself with
>>>the following:
>>
>> Is this different than clicking on the variable then selecting
>> Expression>>InspectVariable from either the main menu or context
>> menu?
>
> It's "Inspect value" (not InspectVariable). Often, like Friedrich I
> think, I want to inspect the symbol too. That's why I have two
> different commands, both bound to a key (in fact, usually, I don't use
> the second command, Inspect-symbol-value)
>
> Notice:
> - it suffices to use editor::prompt-for-symbol (no need to define
> read-symbol-at-point)
I was sure there would be another way ;-)

> - editor::*prompt-for-symbol-confirm* is bound to nil, which allows to
> inspect the symbol in just one key press. Of course from this
> inspector window, you can inspect the value too.
>
> (defcommand "inspect-symbol" (p)
>       (let* ((editor::*prompt-for-symbol-confirm* nil)
>              (symbol (editor::prompt-for-symbol p))
p is therefor a point?

Regards
Friedrich


Re: Maybe someone missed it

Unable to parse email body. Email id is 4217

Updated at: 2020-12-10 08:51 UTC