Lisp HUG Maillist Archive

shortcuts in LW IDE

Hi there,

Does someone have ready-made code for adding shortcuts in the LispWorks editor menu ?
For instance, the "File/Close" or the "Edit/Search Files..." commands.

Thank you

Jean

_______________________________________________
Lisp Hug - the mailing list for LispWorks users
lisp-hug@lispworks.com
http://www.lispworks.com/support/lisp-hug.html


Re: shortcuts in LW IDE

Jean Bresson wrote on Mon, 15 Feb 2016 16:05:29 -0800 03:05:

| Does someone have ready-made code for adding shortcuts in the LispWorks
| editor menu ? For instance, the "File/Close" or the "Edit/Search
| Files..." commands.

There are some snippets in the menu-misc.lisp file from the following bundle:
http://lisp.ystok.ru/ru/lispworks/lww-ide.zip
--
Sincerely,
Dmitry Ivanov
lisp.ystok.ru

_______________________________________________
Lisp Hug - the mailing list for LispWorks users
lisp-hug@lispworks.com
http://www.lispworks.com/support/lisp-hug.html


Re: shortcuts in LW IDE

Hi!

I have used the following code to add alt-based shortcuts in Windows
emulation editor mode to "help" menu. AFAIK, you must call this code
early enough (before starting the GUI) to have additional menu items
in all windows. Otherwise, you will have that items only in windows
you created after loading the code.

To alter other IDE menus, use inspector to learn their names, or just
uncomment "format" calls.

You can find some more Lispworks IDE specific stuff at
https://bitbucket.org/budden/budden-tools/src/default/lispworks-ide-buddens-tools/?at=default

(in-package :cl-user)

(defvar *in-initialize-instance-hack* nil)

(defparameter *alt-keys*
  '(("Find Source" "Alt-.")
    ("Find Source" "Alt-þ")
    ("Go Back" "Alt-'")
    ("Go Back" "Alt-ý")
    ("Continue Tags Search" "Alt-,")("Continue Tags Search" "Alt-á")
    ("Find File" "Ctrl-Alt-o")("Find File" "Ctrl-Alt-ù")
    ("Complete Package Name" "Ctrl-Alt-j")("Complete Package Name" "Ctrl-Alt-î")
    ("Bury Buffer" "Alt-f6")
    ("History Select" "Alt-f8")
    ("Save Position" "Alt-f2")
    ("Trace Function" "Ctrl-Alt-t")("Trace Function" "Ctrl-Alt-å")
    ("Dynamic Completion" "Ctrl-Alt-d")("Dynamic Completion" "Ctrl-Alt-â")
    ("Just One Space" "Alt-o")("Just One Space" "Alt-ù")
    ("Show Documentation" "Alt-f1")
    ("Describe table" "Alt-f11")
    ("Insert String From Clipboard" "Alt-Shift-Insert")
    ("Indent Rigidly" "Ctrl-Alt-i")("Indent Rigidly" "Ctrl-Alt-ø")
    )
  "Sets up Alt... shortkeys for windows mode. Keys are applied to any
new window. Fill this variable before creating windows"
   )

(defun make-alt-keys-menu ()
  (make-instance 'capi::menu
                 :title "hack-menu.lisp keys"
                 :items
                 (mapcar
                  (lambda (entry)
                    (destructuring-bind (command shortcut) entry
                      (make-instance 'capi::menu-item
                                     :title command
                                     :accelerator shortcut
                                     :callback
                                     (lambda (data interface &rest
ignore) (declare (ignorable data))
                                       #|(format *trace-output*
"~%callback args: ~S~%" ignore)|#
                                       (capi:call-editor interface command)
                                       )
                                     )
                      ))
                  *alt-keys*
                  )))



(let ((*handle-warn-on-redefinition* nil))

; non-toplevel
(defmethod initialize-instance :around ((i capi:menu) &rest initargs
&key &allow-other-keys)
  (cond
   (*in-initialize-instance-hack*
    (call-next-method))
   (t
    (let ((*in-initialize-instance-hack* t)
          (new-initargs (copy-list initargs)))
      (when (getf initargs :help-menu)
        ;(format *trace-output* "~%initialize-instance :around ((i ~S)
&rest ~S~%" i initargs)
        (setf (getf new-initargs :items) (list (make-alt-keys-menu))))
      (apply #'call-next-method i new-initargs))))
  )

);let

_______________________________________________
Lisp Hug - the mailing list for LispWorks users
lisp-hug@lispworks.com
http://www.lispworks.com/support/lisp-hug.html


Re: shortcuts in LW IDE

Hi!

If you want to learn which commands are bound currently to the menus,
I don't remember exactly. There are several tips for such tasks:

1. consult CAPI manual to learn structure of menu objects
2. Works/Interface/Inspect - then find menu object and inspect it.
3. Apropos (search for "menu" and/or "callback" or something like this)
4. Trace function you believe can be relevant

Good luck!


2016-02-17 22:19 GMT+03:00, Jean Bresson <Jean.Bresson@ircam.fr>:
> Thank you, this is very useful.
> However I can not find the name of the commands I am looking for (here, the
> "File/Close" and "Edit/Search Files..." menus)
> Are they listed somewhere ?
>
> Thanks again
> Jean
>
>
>> Le 15 févr. 2016 à 23:13, 73budden . <budden73@gmail.com> a écrit :
>>
>>
>> Hi!
>>
>> I have used the following code to add alt-based shortcuts in Windows
>> emulation editor mode to "help" menu. AFAIK, you must call this code
>> early enough (before starting the GUI) to have additional menu items
>> in all windows. Otherwise, you will have that items only in windows
>> you created after loading the code.
>>
>> To alter other IDE menus, use inspector to learn their names, or just
>> uncomment "format" calls.
>>
>> You can find some more Lispworks IDE specific stuff at
>> https://bitbucket.org/budden/budden-tools/src/default/lispworks-ide-buddens-tools/?at=default
>>
>> (in-package :cl-user)
>>
>> (defvar *in-initialize-instance-hack* nil)
>>
>> (defparameter *alt-keys*
>>  '(("Find Source" "Alt-.")
>>    ("Find Source" "Alt-þ")
>>    ("Go Back" "Alt-'")
>>    ("Go Back" "Alt-ý")
>>    ("Continue Tags Search" "Alt-,")("Continue Tags Search" "Alt-á")
>>    ("Find File" "Ctrl-Alt-o")("Find File" "Ctrl-Alt-ù")
>>    ("Complete Package Name" "Ctrl-Alt-j")("Complete Package Name"
>> "Ctrl-Alt-î")
>>    ("Bury Buffer" "Alt-f6")
>>    ("History Select" "Alt-f8")
>>    ("Save Position" "Alt-f2")
>>    ("Trace Function" "Ctrl-Alt-t")("Trace Function" "Ctrl-Alt-å")
>>    ("Dynamic Completion" "Ctrl-Alt-d")("Dynamic Completion" "Ctrl-Alt-â")
>>    ("Just One Space" "Alt-o")("Just One Space" "Alt-ù")
>>    ("Show Documentation" "Alt-f1")
>>    ("Describe table" "Alt-f11")
>>    ("Insert String From Clipboard" "Alt-Shift-Insert")
>>    ("Indent Rigidly" "Ctrl-Alt-i")("Indent Rigidly" "Ctrl-Alt-ø")
>>    )
>>  "Sets up Alt... shortkeys for windows mode. Keys are applied to any
>> new window. Fill this variable before creating windows"
>>   )
>>
>> (defun make-alt-keys-menu ()
>>  (make-instance 'capi::menu
>>                 :title "hack-menu.lisp keys"
>>                 :items
>>                 (mapcar
>>                  (lambda (entry)
>>                    (destructuring-bind (command shortcut) entry
>>                      (make-instance 'capi::menu-item
>>                                     :title command
>>                                     :accelerator shortcut
>>                                     :callback
>>                                     (lambda (data interface &rest
>> ignore) (declare (ignorable data))
>>                                       #|(format *trace-output*
>> "~%callback args: ~S~%" ignore)|#
>>                                       (capi:call-editor interface
>> command)
>>                                       )
>>                                     )
>>                      ))
>>                  *alt-keys*
>>                  )))
>>
>>
>>
>> (let ((*handle-warn-on-redefinition* nil))
>>
>> ; non-toplevel
>> (defmethod initialize-instance :around ((i capi:menu) &rest initargs
>> &key &allow-other-keys)
>>  (cond
>>   (*in-initialize-instance-hack*
>>    (call-next-method))
>>   (t
>>    (let ((*in-initialize-instance-hack* t)
>>          (new-initargs (copy-list initargs)))
>>      (when (getf initargs :help-menu)
>>        ;(format *trace-output* "~%initialize-instance :around ((i ~S)
>> &rest ~S~%" i initargs)
>>        (setf (getf new-initargs :items) (list (make-alt-keys-menu))))
>>      (apply #'call-next-method i new-initargs))))
>>  )
>>
>> );let
>>
>> _______________________________________________
>> Lisp Hug - the mailing list for LispWorks users
>> lisp-hug@lispworks.com
>> http://www.lispworks.com/support/lisp-hug.html
>>
>>
>
>

_______________________________________________
Lisp Hug - the mailing list for LispWorks users
lisp-hug@lispworks.com
http://www.lispworks.com/support/lisp-hug.html


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