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

RE: [jasspa] CUA support

Expand Messages
  • Phillips, Steven
    Gabriel, This becomes more awkward because there is a fundamental difference in the approach to regions and cut n paste operations. Emacs style editors do
    Message 1 of 11 , Oct 6, 2004
    • 0 Attachment
      Gabriel,

      This becomes more awkward because there is a fundamental difference in the approach to regions and cut 'n' paste operations. Emacs style editors do not really have a concept of a static defined region which is then operated on, the region alway changes with the cursor and any operation such as copy-region takes the content from the mark to the current cursor position as the region. Windows on the other hand must have its region defined first and then commands can operate on the defined region, such as cut, copy and paste. This has the advantage of being able to 'replace a region' with a paste operation and also being able to set the current region to the whole buffer whilst leaving the cursor in the original position, but I find the requirement of having to use copy or cut command to get the current region into the paste buffer (or kill buffer) really tedious (each to his own!)

      So this is the problem you face, for true CUA support the behaviour of commands like copy-region must be changed so they take the current 'show-region' rather than the mark-to-cursor region. As Jon suggests, the new shove-over macro shows how this is done but the implications of this difference will mean that to get a good 'simulation' other commands will need to be replaced (e.g. yank, it must replace the current region if there is one, the MS shift mode goes some way towards this, but doing C-a C-v to replace the whole buffer with the current paste buffer will not currently work), some commands will have to be burried as just incompatible to CUA (such as all the commands I rely on, e.g. kill-line, forward-kill-word, in CUA a region must be defined - how annoyingly slow!) and other commands become debateable in their use (e.g. should reyank be allowed as the paste does not maintain the region so there is no region for the reyank command to replace).

      Using 'show-region' regions is fiddly to get right as some commands 'lose' the region when they shouldn't in CUA mode, but I believe that the underlying show-region command and capability should allow you to achieve this so if you run into difficulty drop me a line (with your macros and example!)

      Steve

      > -----Original Message-----
      > From: first last [mailto:prelude_2_murder@...]
      > Sent: Tuesday, October 05, 2004 11:34 AM
      > To: jasspa@yahoogroups.com
      > Subject: [jasspa] CUA support
      >
      >
      >
      > Well, I finally got around to implementing/testing the CUA
      > mode for ME.
      > I got the basic bindings like copy/paste/find but most of the others
      > are not standard, so I have tried to make them reasonable (ctrl+g for
      > searching again, but also f3, ctrl+w for closing the buffer,
      > ctrl+f4 to
      > close the window and so on).
      >
      > I have found a few problems so far:
      > The select-all macro does not leave the cursor where it was,
      > as it does
      > on other programs. I tried to change to:
      > define-macro select-all
      > set-position 1
      > beginning-of-buffer
      > set-mark
      > end-of-buffer
      > goto-position 1
      > !emacro
      >
      > but that will not select anything. Can we leave the selection
      > there and
      > change the cursor position? We could copy the text before getting the
      > cursor back but that won't allow us to delete/cut the text.
      >
      > Then I have the macros that don't seem to exist and cause the loading
      > to fail:
      > global-bind-key previous-buffer "S-C-tab"
      > global-bind-key expand-abbrev "C-space"
      > global-bind-key kill-line "C-k"
      >
      > And then I have the bindings that don't do anything (probably
      > because I
      > got the key syntax wrong):
      > global-bind-key find-buffer "S-C-o"
      > global-bind-key split-window-horizontally "S-C-t"
      >
      > One last thing, would it be possible that we get ME to use the same
      > copy/paste behaviour as other Unix gui systems:
      > -Selecting the text copies it to a clipboard (primary?)
      > -Copying/cutting (only with copy/cut, not with kill-line, kill-word or
      > anything else) copies the text to a second clipboard (main?)
      > The two clipboards are completely independent. On windows, only the
      > second clipboard exists. These behaviour would make ME a lot more
      > consistent with the way GUIs work (this doesn't matter on the console
      > 'cos your me clipboard is separated from the X clipboard).
      >
      > If anyone wants a copy of the binding, email me and I'll send it to
      > you.
      >
      > Thanks
      >
      > Gabriel
      >
      >
      >
      >
      >
      >
      >
      > ___________________________________________________________ALL
      > -NEW Yahoo! Messenger - all new features - even more fun!
      http://uk.messenger.yahoo.com



      __________________________________________________________________________

      This is an unmoderated list. JASSPA is not responsible for the content of
      any material posted to this list.

      To unsubscribe, send a mail message to

      mailto:jasspa-unsubscribe@yahoogroups.com

      or visit http://groups.yahoo.com/group/jasspa and
      modify your account settings manually.



      Yahoo! Groups Links
    • first last
      ... That s what I thought. I will get it working and then send it to the list so you can have a look (sorry for needing all this hand-holding). ... Just a
      Message 2 of 11 , Oct 6, 2004
      • 0 Attachment
        > global-bind-key expand-abbrev "C-space"
        >This is a built in and should exist ??
        > global-bind-key kill-line "C-k"
        >This is a built in and should exist ??

        That's what I thought. I will get it working and then send it to the
        list so you can have a look (sorry for needing all this hand-holding).

        > Ah. S-C-o is actually capital O i.e. C-O
        > However ME does not differentiate case so these
        > will always be bound to C-o and C-t. May be ME should
        > do this case differentiation when both upper and
        > lower are bound. Nobody has tried to do what you are
        > doing so far hence there may be a few things missing.

        Just a warning, C-O is not the same as S-C-o, as the first one will be
        affected by caps lock and the second not. I highlight this because this
        is one of the most annoying things in vi (flame :P).

        Copy and pasting...
        > Will have to investigate this one further to get a better
        > understanding of what you are saying.

        Just an example, open any 2 modern Unix gui apps (kde, gnome, gtk) and
        then select text with the mouse on one. Then press ctrl+c (or whatever
        copy is), then select some other text. Then go to the second app, press
        ctrl+v (or whatever paste is) and you will get the text that was copied
        with the copy command. Then paste the text (middle button?) and you'll
        get the second text you selected.

        The copy/paste clipboard does not change unless you select copy/cut,
        selecting the text and then deleting it does nothing to the clipboard
        and neither does "kill-line" or "kill-word".

        On windows, the x clipboard does not exist so you only get the
        copy/paste one.

        > How have you done this ? I would envisage this being an emulation
        > (help->user setup->start up->emulation. The other emulation files
        > are menedit.emf and meme3_8.emf. If you look at menedit.emf then
        > it always runs the MS-shift region which is probably what you
        > want to do as well. The advantage of running as an emulation is
        > that you can affect the buffer bindings in the macros as well.

        Well, I am editing the menedit macro to make my mode. I am now
        modifying it so it defaults to not-osd versions of the functions, as
        they are a lot more efficient (at least for me).

        Probably I should make a "osd" and "non-osd" version of the mode,
        probably to be selected when you first change the mode? I am thinking
        of newbies, as they are the ones most likely to use such as mode (and
        people who want consistency like I do).

        > Good Stuff

        Thanks. Once I get this working I need to start looking at how osd
        things work so I can implement api-autocompletion :)

        Regards

        Gabriel


        __________________________________________________________________________

        This is an unmoderated list. JASSPA is not responsible for the content
        of
        any material posted to this list.

        To unsubscribe, send a mail message to

        mailto:jasspa-unsubscribe@yahoogroups.com

        or visit http://groups.yahoo.com/group/jasspa and
        modify your account settings manually.





        Yahoo! Groups Sponsor ADVERTISEMENT


        ---------------------------------
        Yahoo! Groups Links

        To visit your group on the web, go to:
        http://groups.yahoo.com/group/jasspa/

        To unsubscribe from this group, send an email to:
        jasspa-unsubscribe@yahoogroups.com

        Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.






        ___________________________________________________________ALL-NEW Yahoo! Messenger - all new features - even more fun! http://uk.messenger.yahoo.com
      • first last
        I understand, it is just that it is not really consistent with the rest of a normal destkop. I don t mind it too much (until I happen to select text on
        Message 3 of 11 , Oct 6, 2004
        • 0 Attachment
          I understand, it is just that it is not really consistent with the rest
          of a "normal" destkop.

          I don't mind it too much (until I happen to select text on another app
          and then try to paste my last ME killbuffer).

          Anyway, ignoring that, here it is the CUA mode:

          ; -!- emf -!-
          ; This is part of the JASSPA MicroEmacs macro files
          ; Copyright (C) 2001-2004 JASSPA (www.jasspa.com)
          ; See the file me.emf for copying and conditions.
          ;
          ; Created: Wed Feb 21 2001
          ; Adapted: Gabriel Tabares-Barreiro
          ; Synopsis: CUA (Standard GUI keybindings) emulation
          ; Authors: Steven Phillips, Gabriel Tabares-Barreiro
          ;
          ; Notes:
          ; This is currently only a partical implementation created for
          proof
          ; of concept, please feel free to improve and submit correction.
          ; An emulation requires:
          ; * Additional entries added to %emulate-names ("The full name")
          ; and %emulate-value ("label" - should be 5 or less chars).
          ; * An "melabel.emf" macro file like this one. This is executed
          ; at the end of me.emf after the editor has been configured
          for
          ; normal release - this allows any aspect of the editor to be
          ; changed.
          ; * Optionally an "osdlabel.emf" macro file (see osdedit.emf)
          which
          ; is executed at the end of executing osd.emf. osd.emf is
          executed
          ; when the user first opens the main menu and allows the
          emulation
          ; to change anything on the main menu (although care must be
          taken
          ; the menu is dynamically changed so the osd-main macro may
          need
          ; replacing).
          ;

          ;@TODO: Typo: OSD close says "Loose changes" when it should be "Lose
          changes"

          define-macro-file osd osd-new-buffer osd-save osd-save-as osd-close
          osd-undo osd-redo
          define-macro-file search osd-find-tag osd-search osd-goto-line
          define-macro-file osdhelp osd-help
          define-macro select-all
          ;;@TODO to make it work as other programs, can we return the cursor to
          where
          ; it was and leave the mark as it should???
          ; set-position 1
          beginning-of-buffer
          set-mark
          end-of-buffer
          ; goto-position 1
          !emacro
          define-macro forward-paragraph-start
          beginning-of-line
          !force 2 forward-paragraph
          !if $status
          backward-paragraph
          !endif
          !emacro
          define-macro forward-word-start
          !force 2 forward-word
          !if $status
          backward-word
          !endif
          !emacro

          define-macro previous-buffer
          &neg @# next-buffer
          !emacro









          ; get rid of all default ME bindings
          -1 global-unbind-key "y"
          ; create safety bindings so we can still do things

          ;I have set this to C-b 'cos it isn't used for anything, any other
          ideas?
          1 global-bind-key prefix "C-b"
          global-bind-key execute-named-command "C-b x"
          ; CUA emulation
          global-bind-key abort-command "esc"
          global-bind-key backward-char "left"
          global-bind-key backward-line "up"
          global-bind-key forward-char "right"
          global-bind-key forward-line "down"
          global-bind-key backward-word "C-left"
          global-bind-key backward-paragraph "C-up"
          global-bind-key forward-word-start "C-right"
          global-bind-key forward-paragraph-start "C-down"
          global-bind-key backward-delete-char "backspace"
          global-bind-key backward-kill-word "C-backspace"
          151 global-bind-key buffer-mode "insert"
          global-bind-key forward-delete-char "delete"
          global-bind-key forward-kill-word "C-delete"
          global-bind-key beginning-of-line "home"
          global-bind-key beginning-of-buffer "C-home"
          global-bind-key end-of-line "end"
          global-bind-key end-of-buffer "C-end"
          global-bind-key scroll-up "page-up"
          global-bind-key scroll-down "page-down"
          global-bind-key tab "tab"
          global-bind-key newline "return"

          global-bind-key select-all "C-a"

          global-bind-key copy-region "C-c"
          global-bind-key goto-line "C-l"
          ;global-bind-key osd-goto-line "C-l"
          ;1 global-bind-key osd-search "C-f"
          1 global-bind-key isearch-forward "C-f"
          1 global-bind-key isearch-backward "S-C-f"
          global-bind-key hunt-forward "f3"
          global-bind-key hunt-forward "C-g"
          global-bind-key hunt-backward "S-f3"
          global-bind-key hunt-backward "S-C-g"
          ;global-bind-key help "C-h"
          global-bind-key buffer-help "C-f1"
          global-bind-key insert-file "C-i"
          global-bind-key ifill-paragraph "C-j"
          global-bind-key lower-case-region "A-l"
          global-bind-key upper-case-region "A-u"
          global-bind-key set-alpha-mark "C-m"
          ;global-bind-key osd-new-buffer "C-n"
          ;global-bind-key new-buffer "C-n"
          ;global-bind-key osd-file-open "C-o"
          global-bind-key find-file "C-o"
          global-bind-key print-buffer "C-p"
          ;global-bind-key save-buffers-exit-emacs "C-q"
          ;2 global-bind-key osd-search "C-r"
          global-bind-key query-replace-string "C-r"
          ;global-bind-key osd-save "C-s"
          global-bind-key save-buffer "C-s"
          global-bind-key goto-alpha-mark "C-t"
          global-bind-key yank "C-v"
          global-bind-key yank-rectangle "A-C-v"
          global-bind-key osd-close "C-w" ;This is the only OSD that I like so
          I'll keep it :)
          ;global-bind-key delete-buffer "C-w"
          global-bind-key kill-region "C-x"
          global-bind-key osd-undo "C-z"
          global-bind-key osd-redo "C-y"
          global-bind-key split-window-horizontally "C-t"
          global-bind-key split-window-vertically "S-C-t"
          global-bind-key delete-window "C-f4"
          global-bind-key next-buffer "C-tab"
          global-bind-key help "f1"
          global-bind-key grep "f2"

          global-bind-key change-directory "A-d"
          ;global-bind-key MainMenu "menu"
          global-bind-key context-menu "menu"

          ;These don't seem to work and cause the loading to fail --- they've
          started working again
          global-bind-key previous-buffer "S-C-tab"
          global-bind-key expand-abbrev "C-space" ;fails with "no abbrev
          expansion defined"???
          global-bind-key kill-line "C-k"

          ;These do nothing
          global-bind-key find-buffer "S-C-o"

          ; reconfigure the buffer bindings
          ;Change these so commenting out lines is easier :)
          set-variable .buffer-bind-key.map-from "|C-c C-c|C-c C-d|"
          set-variable .buffer-bind-key.map-to "|C-#|C-~|"
          ; always want msshift
          !force exec-file msshift
          ; redo the mouse
          !force exec-file "mouse"











          ___________________________________________________________ALL-NEW Yahoo! Messenger - all new features - even more fun! http://uk.messenger.yahoo.com
        • Thomas Hundt
          I access Unix on a Windows PC all the time. And ME and Putty windows both support mouse selection (which amounts to select-and-copy). And then I can paste
          Message 4 of 11 , Oct 6, 2004
          • 0 Attachment
            I access Unix on a Windows PC all the time. And ME and Putty windows
            both support mouse selection (which amounts to select-and-copy). And
            then I can paste into a Windows app (including ME by middle-clicking).
            And that suits me just fine. Sometimes it doesn't work and it drives me
            nuts. (I find that I can't paste into a Unix app. I have to select
            something there, and then go copy my selection again over in the other
            window. Then it works again.) So I would hate having to worry about
            TWO clipboards. I'm very happy with just the one!!

            And I REALLY like the fact that cutting (killing) in ME amounts to
            cutting to the clipboard.

            >>Ah. S-C-o is actually capital O i.e. C-O
            >>However ME does not differentiate case so these
            >>will always be bound to C-o and C-t. May be ME should
            >
            > Just a warning, C-O is not the same as S-C-o, as the first one will be
            > affected by caps lock and the second not. I highlight this because this
            > is one of the most annoying things in vi (flame :P).

            What does GNU Emacs do? To me that is the benchmark; it has many years
            and thousands of users' worth of experience behind it. (But OTOH it's
            so boated and damned complicated to customize that I was driven to move
            to ME and uemacs years ago. Even now, when it's decently runnable on
            PCs, I stubbornly refuse to learn Lisp.)

            > Just an example, open any 2 modern Unix gui apps (kde, gnome, gtk) and
            > then select text with the mouse on one. Then press ctrl+c (or whatever
            > copy is), then select some other text. Then go to the second app, press
            > ctrl+v (or whatever paste is) and you will get the text that was copied
            > with the copy command. Then paste the text (middle button?) and you'll
            > get the second text you selected.
            >
            > The copy/paste clipboard does not change unless you select copy/cut,
            > selecting the text and then deleting it does nothing to the clipboard
            > and neither does "kill-line" or "kill-word".
            >
            > On windows, the x clipboard does not exist so you only get the
            > copy/paste one.

            --
            Thomas Hundt
          Your message has been successfully submitted and would be delivered to recipients shortly.