emacs line kill and paste

Get help with the installation and running of the Zeus IDE. Please do not post bug reports or feature requests here. When in doubt post your question here.
Post Reply
greenhobby
Posts: 1
Joined: Fri Jun 13, 2008 3:15 pm

emacs line kill and paste

Post by greenhobby »

Hi,

I'm interested in using Zeus editor in emacs mode. I use the ctrl-k and ctrl-y all the time to remove lines and paste elsewhere. It seems as though this feature doesn't quite exist in the emacs emulation. Under gnu emacs ctrl-k will kill the contents of the line, and another ctrl-k will delete the blank line left from the previous ctrl-k. crtl-y behaves a bit weird as well.

Am I doing something wrong? This feature alone will dictate my purchase. I use Linux/emacs a bit and have to be able to have this feature working the same as Linux.

thanks and regards,
gh
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Post by jussij »

Under gnu emacs ctrl-k will kill the contents of the line, and another ctrl-k will delete the blank line left from the previous ctrl-k.
Based on your description of the required Emacs functionalitty I think the following emacs_cut.lua macro will do something similar:

Code: Select all

function key_macro()
  -- macro only works for documents
  local document = is_document()

  -- macro only works for read/write documents.
  local locked = is_read_only()

  if (locked == 1) or (document == 0) then
    -- can't run astyle.exe on current document
    message("This macro can only be run with a named, writable document file.")
    beep()
  else
    -- disable screen updates
    screen_update_disable()

    -- get a copy of the current line
    local text = get_line_text()

    -- see if the current line is empty
    if string.len(text) == 0 then
        -- delete the current line
        LineDelete()
    else
        -- save the current cursor
        cursor_save()

        -- add the text to the clipboard
        set_clipboard_text(text)

        -- replae the line with an empty line
        LineDelete()
        MoveLineHome()
        EnterOpen()

        -- restore original cursor
        cursor_restore()
    end

    -- restore screen updates
    screen_update_enable()
  end
end

key_macro() -- run the macro
All you need do save the code to the Zeus zScript directory and then bind it to the keybaord using the Options, Editor Options menu, Keyboard Mapping panel.
crtl-y behaves a bit weird as well.
It should be possible to right a similar Lua macro to implement the required clipboard paste functionality.

Cheers Jussi
Post Reply