; -!- emf -!- ; This is part of the JASSPA MicroEmacs macro files ; Copyright (C) 1999-2009 JASSPA (www.jasspa.com) ; See the file me.emf for copying and conditions. ; ; Created: Thu May 27 1999 ; Synopsis: Implementation of MS windows shift region definition style ; Authors: Steven Phillips ; 0 define-macro msshift-pick set-variable .msshift.state 1 !emacro 0 define-macro msshift-input set-variable .status "0" !if &seq @cc "abort-command" ; ensure a breakout if C-g is pressed set-variable $buffer-input &con &seq .msshift.input "msshift-input" "" .msshift.input !abort !elif &seq @cck "redraw" ; abort to tell ME to handle the actual input !abort !elif &seq @cck "callback" !abort !elif &seq @cck "idle-pick" !abort !endif ; restore the input function so this only gets called once! set-variable $buffer-input .msshift.input !if &lfi "|backward-delete-char|forward-delete-char|" @cc set-variable .status "1" -1 yank -1 kill-region !return !elif &lfi "|kill-region|kill-rectangle|" @cc set-variable .status "1" -1 yank execute-named-command @cc !return !elif &seq "copy-region" @cc set-variable .status "1" !return !elif &lfi "|yank|newline|" @cc -1 yank -1 kill-region !elif &seq @cck @cc -1 yank -1 kill-region !elif &seq "mouse-event" @cc set-variable .mouse-event.msshift 3 !elif &set #l0 &sin "mouse-pick-" @cck set-variable #l0 &spr "%s-drop-%s" &lef @cck &add #l0 4 &rig @cck &add #l0 10 !if &seq "mouse-event" @cc set-variable #l1 &sin "yank" ® &cat "/history/mouse/" #l0 "" !else ¬ &set #l1 &sin "yank" @cc set-variable #l1 &sin "yank" &cbind #l0 !endif !if #l1 set-variable #l2 @cqk set-variable .status "1" -1 yank -1 kill-region yank !return !endif !endif ; reset the last command to the copy-region set-variable @cl copy-region !abort !emacro 0 define-macro msshift !if &equ .state 2 copy-region set-variable .input $buffer-input set-variable $buffer-input msshift-input !endif set-variable .state -1 !emacro 0 define-macro msshift-move !if &equ .msshift.state 1 set-mark set-variable .msshift.state 2 !endif set-variable #l1 &cbind &rep @cck "S-" "" set-variable @cl @cl !if @? @# execute-named-command #l1 !else execute-named-command #l1 !endif set-variable @cc #l1 !emacro set-variable .msshift.state -1 global-bind-key msshift-pick "S-pick" global-bind-key msshift "S-drop" set-variable #l0 0 !while ¬ &seq "" &set #l1 &lget "|up|down|left|right|home|end|page-up|page-down|C-left|C-right|C-up|C-down|C-home|C-end|" &inc #l0 1 !if ¬ &seq &cbin #l1 "ERROR" !if &seq &nbin #l1 "" global-bind-key msshift-move &cat "S-" #l1 !else &nbin #l1 global-bind-key msshift-move &cat "S-" #l1 !endif !endif !done