Reloading keyboard shortcut definitions in Pharo












2















I've been playing around with keyboard shortcuts in Pharo 7.0. I wanted to modify the binding for #jumpToNextKeywordOfIt in the Smalltalk editor and so I got the following change in the definition of buildShortcutsOn method:



(aBuilder shortcut: #jumpToNextKeywordOfIt)
category: RubSmalltalkEditor name
default: $y meta shift
do: [ :target | target editor jumpToNextKeywordOfIt: true ]
description: 'Jump to next keyword'.


My first thought was that just saving this definition should immediately take effect, but it was not the case. Then I thought, perhaps since this is part of a method definition, then calling this method on the editor class would do the trick. Now, the method takes an argument aBuilder and I don't really know what that is. So two questions arise:




  1. Is this the proper way to apply keybinding changes to a running editor?

  2. What is aBuilder in this context and how does one get it?










share|improve this question



























    2















    I've been playing around with keyboard shortcuts in Pharo 7.0. I wanted to modify the binding for #jumpToNextKeywordOfIt in the Smalltalk editor and so I got the following change in the definition of buildShortcutsOn method:



    (aBuilder shortcut: #jumpToNextKeywordOfIt)
    category: RubSmalltalkEditor name
    default: $y meta shift
    do: [ :target | target editor jumpToNextKeywordOfIt: true ]
    description: 'Jump to next keyword'.


    My first thought was that just saving this definition should immediately take effect, but it was not the case. Then I thought, perhaps since this is part of a method definition, then calling this method on the editor class would do the trick. Now, the method takes an argument aBuilder and I don't really know what that is. So two questions arise:




    1. Is this the proper way to apply keybinding changes to a running editor?

    2. What is aBuilder in this context and how does one get it?










    share|improve this question

























      2












      2








      2








      I've been playing around with keyboard shortcuts in Pharo 7.0. I wanted to modify the binding for #jumpToNextKeywordOfIt in the Smalltalk editor and so I got the following change in the definition of buildShortcutsOn method:



      (aBuilder shortcut: #jumpToNextKeywordOfIt)
      category: RubSmalltalkEditor name
      default: $y meta shift
      do: [ :target | target editor jumpToNextKeywordOfIt: true ]
      description: 'Jump to next keyword'.


      My first thought was that just saving this definition should immediately take effect, but it was not the case. Then I thought, perhaps since this is part of a method definition, then calling this method on the editor class would do the trick. Now, the method takes an argument aBuilder and I don't really know what that is. So two questions arise:




      1. Is this the proper way to apply keybinding changes to a running editor?

      2. What is aBuilder in this context and how does one get it?










      share|improve this question














      I've been playing around with keyboard shortcuts in Pharo 7.0. I wanted to modify the binding for #jumpToNextKeywordOfIt in the Smalltalk editor and so I got the following change in the definition of buildShortcutsOn method:



      (aBuilder shortcut: #jumpToNextKeywordOfIt)
      category: RubSmalltalkEditor name
      default: $y meta shift
      do: [ :target | target editor jumpToNextKeywordOfIt: true ]
      description: 'Jump to next keyword'.


      My first thought was that just saving this definition should immediately take effect, but it was not the case. Then I thought, perhaps since this is part of a method definition, then calling this method on the editor class would do the trick. Now, the method takes an argument aBuilder and I don't really know what that is. So two questions arise:




      1. Is this the proper way to apply keybinding changes to a running editor?

      2. What is aBuilder in this context and how does one get it?







      smalltalk key-bindings pharo






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 15 '18 at 21:57









      Wojciech GacWojciech Gac

      465719




      465719
























          1 Answer
          1






          active

          oldest

          votes


















          5














          Let me give you some hints on how to find the solution (as this might be more valuable than giving the solution at once)



          The problem is what's aBuilder right? Well, from the expression



          (aBuilder shortcut: #jumpToNextKeywordOfIt)


          we deduce that aBuilder is someone that responds to #shortcut:. Cmd+m and you will get 9 implementors of #shortcut:. One of them, KMBuilder has an interesting name. Moreover, its implementation of shortcut: is



          shortcut: aKeymapName
          ^KMKeymapBuilder
          for: aKeymapName
          platform: platform


          meaning that it will answer with an instance of KMKeymapBuilder. Browse this class and verify that it understands the next message from your expression:



          category: RubSmalltalkEditor name
          default: $y meta shift
          do: [ :target | target editor jumpToNextKeywordOfIt: true ]
          description: 'Jump to next keyword'.


          It does! So this must be it! To check this, we still need an instance of KMBuilder. Browse the class, go to the class side and find the unary message #keymap.



          This means that we can obtain aBuilder by evaluating



          KMBuilder keymap


          I love unary messages. Specially when they are on the class side!



          Now go to the implementor of the method you already tweaked #buildShortcutsOn:. It is implemented in the class side and we can now evaluate:



          RubTextEditor buildShortcutsOn: KMBuilder keymap


          To make sure that it works, go now to the desired handler #jumpToNextKeywordOfIt: and insert a halt in it. This is in the same class, instance side.



          Now lets press Cmd+Shift+y and see if we get the halt... Bingo! I mean, Halt!






          share|improve this answer


























          • Thank you very much Leandro! This was indeed enlightening and I'm grateful to you for giving more than just an answer to my question.. I was also able to see that some of my problems with Pharo keybindings are due to Xfce's meddling - I'll have to look into it. Specifically, the $y meta shift binding, which on my system translates to Ctrl+Shift+Y, failed to produce the desired effect.

            – Wojciech Gac
            Nov 17 '18 at 15:25











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53328469%2freloading-keyboard-shortcut-definitions-in-pharo%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          5














          Let me give you some hints on how to find the solution (as this might be more valuable than giving the solution at once)



          The problem is what's aBuilder right? Well, from the expression



          (aBuilder shortcut: #jumpToNextKeywordOfIt)


          we deduce that aBuilder is someone that responds to #shortcut:. Cmd+m and you will get 9 implementors of #shortcut:. One of them, KMBuilder has an interesting name. Moreover, its implementation of shortcut: is



          shortcut: aKeymapName
          ^KMKeymapBuilder
          for: aKeymapName
          platform: platform


          meaning that it will answer with an instance of KMKeymapBuilder. Browse this class and verify that it understands the next message from your expression:



          category: RubSmalltalkEditor name
          default: $y meta shift
          do: [ :target | target editor jumpToNextKeywordOfIt: true ]
          description: 'Jump to next keyword'.


          It does! So this must be it! To check this, we still need an instance of KMBuilder. Browse the class, go to the class side and find the unary message #keymap.



          This means that we can obtain aBuilder by evaluating



          KMBuilder keymap


          I love unary messages. Specially when they are on the class side!



          Now go to the implementor of the method you already tweaked #buildShortcutsOn:. It is implemented in the class side and we can now evaluate:



          RubTextEditor buildShortcutsOn: KMBuilder keymap


          To make sure that it works, go now to the desired handler #jumpToNextKeywordOfIt: and insert a halt in it. This is in the same class, instance side.



          Now lets press Cmd+Shift+y and see if we get the halt... Bingo! I mean, Halt!






          share|improve this answer


























          • Thank you very much Leandro! This was indeed enlightening and I'm grateful to you for giving more than just an answer to my question.. I was also able to see that some of my problems with Pharo keybindings are due to Xfce's meddling - I'll have to look into it. Specifically, the $y meta shift binding, which on my system translates to Ctrl+Shift+Y, failed to produce the desired effect.

            – Wojciech Gac
            Nov 17 '18 at 15:25
















          5














          Let me give you some hints on how to find the solution (as this might be more valuable than giving the solution at once)



          The problem is what's aBuilder right? Well, from the expression



          (aBuilder shortcut: #jumpToNextKeywordOfIt)


          we deduce that aBuilder is someone that responds to #shortcut:. Cmd+m and you will get 9 implementors of #shortcut:. One of them, KMBuilder has an interesting name. Moreover, its implementation of shortcut: is



          shortcut: aKeymapName
          ^KMKeymapBuilder
          for: aKeymapName
          platform: platform


          meaning that it will answer with an instance of KMKeymapBuilder. Browse this class and verify that it understands the next message from your expression:



          category: RubSmalltalkEditor name
          default: $y meta shift
          do: [ :target | target editor jumpToNextKeywordOfIt: true ]
          description: 'Jump to next keyword'.


          It does! So this must be it! To check this, we still need an instance of KMBuilder. Browse the class, go to the class side and find the unary message #keymap.



          This means that we can obtain aBuilder by evaluating



          KMBuilder keymap


          I love unary messages. Specially when they are on the class side!



          Now go to the implementor of the method you already tweaked #buildShortcutsOn:. It is implemented in the class side and we can now evaluate:



          RubTextEditor buildShortcutsOn: KMBuilder keymap


          To make sure that it works, go now to the desired handler #jumpToNextKeywordOfIt: and insert a halt in it. This is in the same class, instance side.



          Now lets press Cmd+Shift+y and see if we get the halt... Bingo! I mean, Halt!






          share|improve this answer


























          • Thank you very much Leandro! This was indeed enlightening and I'm grateful to you for giving more than just an answer to my question.. I was also able to see that some of my problems with Pharo keybindings are due to Xfce's meddling - I'll have to look into it. Specifically, the $y meta shift binding, which on my system translates to Ctrl+Shift+Y, failed to produce the desired effect.

            – Wojciech Gac
            Nov 17 '18 at 15:25














          5












          5








          5







          Let me give you some hints on how to find the solution (as this might be more valuable than giving the solution at once)



          The problem is what's aBuilder right? Well, from the expression



          (aBuilder shortcut: #jumpToNextKeywordOfIt)


          we deduce that aBuilder is someone that responds to #shortcut:. Cmd+m and you will get 9 implementors of #shortcut:. One of them, KMBuilder has an interesting name. Moreover, its implementation of shortcut: is



          shortcut: aKeymapName
          ^KMKeymapBuilder
          for: aKeymapName
          platform: platform


          meaning that it will answer with an instance of KMKeymapBuilder. Browse this class and verify that it understands the next message from your expression:



          category: RubSmalltalkEditor name
          default: $y meta shift
          do: [ :target | target editor jumpToNextKeywordOfIt: true ]
          description: 'Jump to next keyword'.


          It does! So this must be it! To check this, we still need an instance of KMBuilder. Browse the class, go to the class side and find the unary message #keymap.



          This means that we can obtain aBuilder by evaluating



          KMBuilder keymap


          I love unary messages. Specially when they are on the class side!



          Now go to the implementor of the method you already tweaked #buildShortcutsOn:. It is implemented in the class side and we can now evaluate:



          RubTextEditor buildShortcutsOn: KMBuilder keymap


          To make sure that it works, go now to the desired handler #jumpToNextKeywordOfIt: and insert a halt in it. This is in the same class, instance side.



          Now lets press Cmd+Shift+y and see if we get the halt... Bingo! I mean, Halt!






          share|improve this answer















          Let me give you some hints on how to find the solution (as this might be more valuable than giving the solution at once)



          The problem is what's aBuilder right? Well, from the expression



          (aBuilder shortcut: #jumpToNextKeywordOfIt)


          we deduce that aBuilder is someone that responds to #shortcut:. Cmd+m and you will get 9 implementors of #shortcut:. One of them, KMBuilder has an interesting name. Moreover, its implementation of shortcut: is



          shortcut: aKeymapName
          ^KMKeymapBuilder
          for: aKeymapName
          platform: platform


          meaning that it will answer with an instance of KMKeymapBuilder. Browse this class and verify that it understands the next message from your expression:



          category: RubSmalltalkEditor name
          default: $y meta shift
          do: [ :target | target editor jumpToNextKeywordOfIt: true ]
          description: 'Jump to next keyword'.


          It does! So this must be it! To check this, we still need an instance of KMBuilder. Browse the class, go to the class side and find the unary message #keymap.



          This means that we can obtain aBuilder by evaluating



          KMBuilder keymap


          I love unary messages. Specially when they are on the class side!



          Now go to the implementor of the method you already tweaked #buildShortcutsOn:. It is implemented in the class side and we can now evaluate:



          RubTextEditor buildShortcutsOn: KMBuilder keymap


          To make sure that it works, go now to the desired handler #jumpToNextKeywordOfIt: and insert a halt in it. This is in the same class, instance side.



          Now lets press Cmd+Shift+y and see if we get the halt... Bingo! I mean, Halt!







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 17 '18 at 9:45

























          answered Nov 16 '18 at 23:31









          Leandro CanigliaLeandro Caniglia

          9,05622136




          9,05622136













          • Thank you very much Leandro! This was indeed enlightening and I'm grateful to you for giving more than just an answer to my question.. I was also able to see that some of my problems with Pharo keybindings are due to Xfce's meddling - I'll have to look into it. Specifically, the $y meta shift binding, which on my system translates to Ctrl+Shift+Y, failed to produce the desired effect.

            – Wojciech Gac
            Nov 17 '18 at 15:25



















          • Thank you very much Leandro! This was indeed enlightening and I'm grateful to you for giving more than just an answer to my question.. I was also able to see that some of my problems with Pharo keybindings are due to Xfce's meddling - I'll have to look into it. Specifically, the $y meta shift binding, which on my system translates to Ctrl+Shift+Y, failed to produce the desired effect.

            – Wojciech Gac
            Nov 17 '18 at 15:25

















          Thank you very much Leandro! This was indeed enlightening and I'm grateful to you for giving more than just an answer to my question.. I was also able to see that some of my problems with Pharo keybindings are due to Xfce's meddling - I'll have to look into it. Specifically, the $y meta shift binding, which on my system translates to Ctrl+Shift+Y, failed to produce the desired effect.

          – Wojciech Gac
          Nov 17 '18 at 15:25





          Thank you very much Leandro! This was indeed enlightening and I'm grateful to you for giving more than just an answer to my question.. I was also able to see that some of my problems with Pharo keybindings are due to Xfce's meddling - I'll have to look into it. Specifically, the $y meta shift binding, which on my system translates to Ctrl+Shift+Y, failed to produce the desired effect.

          – Wojciech Gac
          Nov 17 '18 at 15:25




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53328469%2freloading-keyboard-shortcut-definitions-in-pharo%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Bressuire

          Vorschmack

          Quarantine