Loading ...
Sorry, an error occurred while loading the content.
 

RE: [jasspa] Extending ME

Expand Messages
  • Phillips, Steven
    Gabriel, Writing an email like this is contributing to ME, as for lisp I can t write it either, ME uses its own macro language which is pretty straight forward
    Message 1 of 3 , Jan 6, 2004
      Gabriel,

      Writing an email like this is contributing to ME, as for lisp I can't write it either, ME uses its own macro language which is pretty straight forward (okay so some of my code looks anything but :)

      > -Is it possible to undo the way most apps do, just add changes to a
      > list of changes? (possibly group by word, instead of having
      > to undo per
      > character). I find it annoying that if you type something by mistake
      > while undo-ing the undo buffer gets deleted and starts from the last
      > thing you typed. IMO, it would be a lot easier to understand
      > if it just
      > deleted from the point you were onwards, but not the steps before the
      > one you were doing (hope you people understand what I mean).

      The undo mechanism is just like Big Emacs' and currently there are no hooks in it to change its behaviour (other than whether the undo history is discarded when the buffer is saved (see user-setup -> general -> Keep undo history)). However it is not all doom and gloom, your reference to the undo buffer getting deleted suggests that a little illumination on the behaviour is required. Try the following:

      Create a new buffer
      Type the letter 'a'
      execute 'undo' - 'a' goes
      Type the letter 'b'
      execute 'undo' - 'b' goes
      execute 'undo' - 'a' comes back again
      execute 'undo' - 'a' goes again

      Every call to undo changed the current buffer (in this case by either deleting a character or inserting one) and this is treated just like any other edit, i.e. the edit is added to the undo list so that you can undo your undo (i.e. a full redo history). This is far more powerful than most editors that only remember the last undo & redo. I enable the 'keep undo history' option and in a buffer that I have edited for a week I can undo every single change I have made and redo them again.

      This behaviour is confusing to start with but once understood it is extremely useful, for example while typing I often hit the wrong key and invoke a command like end-of-buffer that moves the cursor to somewhere else and I'm lost! This is simply fixed by doing 'undo C-g undo', the first undo will undo the last edit made, the C-g (abort) will reset the undo position back to the end so that the next undo undoes the undo (i.e. a redo to leave the buffer as it was) a side effect of this is the position of the cursor is moved back to where the last edit was made - nice.

      The use of C-g (or any other command) to reset the undo stack is an important trick, if I have been hacking away and then realise that the hack just wont work, removing it could be extremely difficult without this feature/behaviour, especially if I did not save the buffer just before. However with this behaviour I simply 'fall asleep' on the undo key "C-_" until I see all the hack has gone, and do to slow reaction times some of the edits I wish to keep. I then simply press C-g and then carefully redo the undos until all the edits I wish to keep are re-applied. If I then over step the mark I then simply press C-g and then undo to undo the last redo , i.e. remove the first edit of the hack - okay so the undo behaviour does remain a little baffling at times but I generally feel in control most of the time!

      W.R.T. single character undoing, I find programs who's undo command removes all changes back to some arbitrary point infuriating and have stopped using them unless really desperate. I have completely stopped using Sebiel's undo as it always removed 5 minutes of work and does not have a redo! If you know you wish to undo the last 20 chars you typed in you could always do 'esc 20 C-_' which undoes the last 20 changes.

      > -The most useful thing in IDEs is code completion, where you type the
      > beginning of a function and the system gives you a drop-down of
      > possible function names. If this can be extended to know which
      > libraries you are using and, in case of OO languages, which
      > methods/properties are available for a certain object, you could get
      > much more done even more easily (and I could convert a few people to
      > ME).

      Agreed, does anyone know who these editors do this? I assume the information must be pre-compiled as it is very time consuming extracting all the methods from a class. I don't foresee a similar feature in ME unless someone knows of a sensible way to implement it.

      The look-back abbreviation can help to a degree but...

      > -Having a macro that sets the keybindings to that used in Windows
      > (CUA?) such as C-s save, C-z undo, could be useful to get more people
      > using microemacs. I love the emacs way, but many people find it
      > confusing.

      On user-setup -> Start-Up there is the MS Shift Key option for region selection using the shift key, and I have added a 'MS Friendly keys' option (not sure if this was in ME'02) which rebinds home, C-home, end, C-end, C-v and esc C-v appropriately, BUT Emacs & windows key bindings are incompatible! The most common mistake I make when going from one to the other is using the 'C-x' & 'C-c' to cut and copy text which in Emacs/ME are absolutely central keys and cannot be rebound without destroying the complete Emacs environment. I have laid the foundation of a compatibility mode which could be used to change ME from an Emacs style editor to a Windows style editor but this has not, to my knowledge, been utilized - see user-setup -> Start-Up -> Emulate option.

      > -Another thing that could be useful is auto-bracket generation. Let's
      > say you type "if (whatever) {", the system will convert it to
      > "if (whatever) {
      > (indented cursor here)
      > }"
      > I personally don't care about this that much (it can be useful
      > sometimes) but I know people who swear by it.

      See the abbreviation support, you can create whatever abbreviations you wish in the <fhook>.eaf file and then type the abbrev label and execute the abbrev command (usually expand-abbrev-handler, bound to esc esc, which incorporates several abbreviation expansion methods including eaf, look-back and iso accent expansion for accented letters), for example try the following:

      Create new buffer 't.c'
      type "if"
      execute expand-abbrev-handler 'esc esc'

      the 'if' is expanded to

      if(<cursor here>)
      {
      }

      see c.eaf to see the abbrev definition for this.

      Steve
    • first last
      ... Time to learn it then... whenever I get some time. OK, now I understand the undo mode. I like it more :) ... Normally what they do is read the included
      Message 2 of 3 , Jan 7, 2004
        >Writing an email like this is contributing to ME, as for lisp I can't
        >write it either, ME uses its own macro language which is pretty
        >straight forward (okay so some of my code looks anything but :)

        Time to learn it then... whenever I get some time.

        OK, now I understand the undo mode. I like it more :)

        >Agreed, does anyone know who these editors do this? I assume the
        >information must be pre-compiled as it is very time consuming
        >extracting all the methods from a class. I don't foresee a similar
        >feature in ME unless someone knows of a sensible way to implement it.

        Normally what they do is read the included files, so they have to
        understand a 'little' of the language syntax to be able to do so. Some
        of them even understand the "whatever = new class ()" and relate
        whatever to the class methods and so on. It doesn't sound like anything
        easy and can be slow sometimes (the system has to be calculating as you
        type, unless you want to have it all in memory).

        It would be an useful feature, but it surely looks complex to
        implement.

        >The look-back abbreviation can help to a degree but...

        Maybe it can be configured the same way but also reading the included
        files, to me it sounds like a good compromise, activate manually (so
        you don't have the continuous overhead) but parse the "included" files
        too (then we get to the problem of included files that include others
        and so on).

        >On user-setup -> Start-Up there is the MS Shift Key option for region
        >selection using the shift key, and I have added a 'MS Friendly keys'
        >option (not sure if this was in ME'02) which rebinds home, C-home,
        end,
        >C-end, C-v and esc C-v appropriately, BUT Emacs & windows key bindings
        >are incompatible! The most common mistake I make when going from one
        to
        the other is using the 'C-x' & 'C-c' to cut and copy text which in
        >Emacs/ME are absolutely central keys and cannot be rebound without
        >destroying the complete Emacs environment. I have laid the foundation
        >of a compatibility mode which could be used to change ME from an Emacs

        >style editor to a Windows style editor but this has not, to my
        >knowledge, been utilized - see user-setup -> Start-Up -> Emulate
        >option.

        I know it is the complete opposite to Emacs' way of working, but it may
        make the difference to get to new users (even if it is not completely
        compatible).

        >See the abbreviation support, you can create whatever abbreviations
        you
        >wish in the <fhook>.eaf file and then type the abbrev label and
        execute
        >the abbrev command (usually expand-abbrev-handler, bound to esc esc,
        >which incorporates several abbreviation expansion methods including
        >eaf, look-back and iso accent expansion for accented letters)

        Then maybe a set of general macros that can be chosen (ideally from the
        GUI) for any given language, and it will fill in the right things
        (begin-end for Pascal, {} for C, etc).

        Anyway, these are just suggestions and my personal opinion.

        Gabriel

        ________________________________________________________________________
        Yahoo! Messenger - Communicate instantly..."Ping"
        your friends today! Download Messenger Now
        http://uk.messenger.yahoo.com/download/index.html
      Your message has been successfully submitted and would be delivered to recipients shortly.