Assigning macros to non-PF keys

  • Mark Boonie
    Mark Boonie

    I'm still looking at THE to see if I can use it as my everyday editor.  One of the things I like about my current editor (LPEX) is the ability to assign functions to most non-PF keys (Alt+S, Ctl-Z) or even modified PF keys (Alt_F9).  I couldn't find a similar ability in THE.  Have I overlooked anything?  If not, how active is THE enhancement?  Is there a chance a function like this would be added if requested?  Thanks.

    - mb

    • Mark Hessling
      Mark Hessling

      The only limitation THE has when reassigning keys is the underlying terminal handler.  The one with the most limitations is ncurses (text mode on Un*x platforms).

      To see what name THE gives to a key, use the SHOW command (press spacebar to get out).

      Once you know a key name use the DEFINE command:

      DEFINE C-F1 top
      (this assigns the THE command TOP to control F1
      DEFINE A-X rexx mymacro.the
      (this define the Rexx macro "mymacro.the" to ALT-X

    • r corak
      r corak

      One can even do simple logic like this:
           "define  A-END  rexx if incommand() then nop; else sos delend"

    • jzombi

      I've also problems with some keys, i.e. control-backspace.
      I use xcurses, i have PDCurses-3.0, and THE-3.3B. When i enter the show command and press the control-backspace, the message shows me, that the code for this key is C-BKSP ("Key: C-BKSP  - unassigned"). But when i try to define it in .therc, i got an error:
      "     1 +++ define C-BKSP sos delline
      Error 41 running "/home/jzombi/.therc", line 1: Bad arithmetic conversion"
      It's very strange, because i can define it in the cmdline in xthe, but i can't do it in .therc.
      Sorry if it's a common and solved problem, i couldn't find any information about it...

      • Mark Hessling
        Mark Hessling

        The .threrc file is run as a Rexx macro, so it is being interpreted as subtract the variable BKSP from the variable C.
        Surround all THE commands in single or double quotes in the .therc file, or any macro file.

    • jzombi

      I see! Now it's working with the quotes, thank you!