home *** CD-ROM | disk | FTP | other *** search
- #
- # Some macros to extend Point commands
- #
- proc Filter {{cmd fmt}} {
- set s [selection get]
- set ret [catch {exec $cmd << $s} ns]
- # if the command failed then do not delete the selection
- if {$ret==0} DeleteToScrap
- # insert the result or the error message
- InsertString $ns
- }
-
- proc IndentSelection {{outdent 0}} {
- set sel [Sel get]
- set here [lindex $sel 0]
- set stop [lindex $sel 1]
- for {} 1 {} {
- MoveSel line left0
- set here [lindex [Sel get] 0]
- if {$here>$stop} \
- break;
- if $outdent {
- DeleteToScrap
- } else {
- InsertString \t
- }
- set stop [expr $stop+1]
- MoveSel char down
- }
- }
-
- proc DefineMacro {{id 0}} {
- set name Macro$id
- global $name
- set $name [selection get]
- }
-
- proc ExecMacro {{id 0}} {
- set name Macro$id
- global $name
- eval [set $name]
- }
-
- proc ExecSel {{id 0}} {
- eval [selection get]
- }
-
- proc MoveWindow {geometry} {
- set aw [WindowName get active]
- wm geometry $aw [FixGeometry $geometry]
- RaiseWindow
- }
-
- proc ExtendSelToLines {} {
- set endSel [lindex [Sel get] 1]
- MoveSel line left0 noupdate
- set beginSel [lindex [Sel get] 0]
- Sel set $endSel $endSel
- MoveSel line right noupdate
- set endSel [lindex [Sel get] 1]
- Sel set $beginSel $endSel
- set w [WindowName get sel]
- Redraw
- }
-
-
-