Lisp HUG Maillist Archive

`commands' in LW

Does anyone know how things like the `colon commands' that LW defines
in various contexts are defined, and whether they can be defined in a
general listener?  ACL gives you a way of doing this, I think, and it
would be cool if it existed for LW, as they're quite useful.

(I specifically find that I want to have hacky (push-package xxx) and
(pop-package) utilities, but these are quite painful to define as
functions because the package keeps changing so you have to type
package prefixes all the time, being able to say `:push-package "FOO"'
&c would be nice).

Thanks

--tim


Re: `commands' in LW

Unable to parse email body. Email id is 330

Re: `commands' in LW

* Nick Levine wrote:

> Is this what you were after?

Yes, thanks!  I'd even found system::*user-commands* but for some
reason had not worked out what it did, maybe because I didn't think to
look at it when in the debugger to see what it had been bound to.

Thanks.

--tim




Re: `commands' in LW

* I wrote:

> Yes, thanks!

Except it doesn't work, sigh.  Something (system::%top-level perhaps)
unilaterally rebinds this, so if you assign to it then it only works
for the listener you are in, and you don't seem to be able to assign
to it in an init file.  Dang.  At least I know where to look now.

--tim


Re: `commands' in LW

Unable to parse email body. Email id is 333

Re: `commands' in LW

Unable to parse email body. Email id is 335

Re: `commands' in LW

* Nick Levine wrote:
> When all else fails, try some good old-fashioned advice (for
> sys::%top-level). Push whatever onto :extra-commands (careful, this is
> used for debugger bindings, so make sure you retain what was already
> being passed.)

Dang, I should have traced this like you said.  Advising it works.  I
think it would be cool if the real function could be changed to do
essentially what this advice does, for some documented variable.

Anyway, the attached seems to work.

--tim


Re: `commands' in LW

For what it's worth, I put up a slightly souped-up version of the
`define-a-colon-command' hack at
http://www.tfeb.org/lisp/implementation-hax.html#LW-COLON-COMMANDS

This at least works well enough for me.

--tim


Re: `commands' in LW

----- Original Message -----
From: Tim Bradshaw <tfb@cley.com>
To: <lisp-hug@xanalys.com>
Sent: Thursday, May 02, 2002 3:46 PM


| Does anyone know how things like the `colon commands' that LW defines
| in various contexts are defined, and whether they can be defined in a
| general listener?  ACL gives you a way of doing this, I think, and it
| would be cool if it existed for LW, as they're quite useful.

Does anyone know how to bind such commands to keyboard keys without
necessity to press the Enter key explicitly after the command name? For
example, I'd like the assignments:

    :s (Step)     F8
    :su (Step out)    F10

But the following call

    (bind-string-to-key (string-append  #\: #\s #\Linefeed) #\F8)

only splits a listener line but doesn't emulate pressing Enter
afterwards. Any takers?
---
Sincerely,
Dmitri Ivanov
www.aha.ru/~divanov


Re: `commands' in LW

Unable to parse email body. Email id is 351

Re: `commands' in LW

----- Original Message -----
From: <davef@xanalys.com>

|...snip...|
| Try this, which calls the command function of that command.
|
| (editor:defcommand "Step" (p)
|    "Step. Really ought to check that it's at the prompt."
|    "Step"
|    (declare (ignore p))
|    (editor:insert-string (editor:current-point) ":s")
|
(editor:execute-or-insert-newline-or-yank-from-previous-prompt-command
nil))
|
| (editor:bind-key "Step" "F8" :mode "Execute")

Thanks, Dave!

FWIW my final version is as follows:

(defcommand "StepInto" (p)
    "Step. Really ought to check that it's at the prompt."
    "Step"
  (insert-string (editor:current-point) (format nil ":s ~@[~A~]" p))
  (execute-or-insert-newline-or-yank-from-previous-prompt-command nil))
---
Sincerely,
Dmitri Ivanov
www.aha.ru/~divanov




Updated at: 2020-12-10 09:02 UTC