File: editor.template

package info (click to toggle)
dotfile 1%3A2.4-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 5,472 kB
  • ctags: 523
  • sloc: tcl: 14,072; sh: 918; makefile: 177; lisp: 18; ansic: 7
file content (118 lines) | stat: -rw-r--r-- 5,315 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
### Copyright (C) 1996 Rasmus Ingemann Hansen
### This program is free software; you can redistribute it and/or modify
### it under the terms of the GNU General Public License as published by
### the Free Software Foundation; either version 2 of the License, or
### (at your option) any later version.
###
### This program is distributed in the hope that it will be useful,
### but WITHOUT ANY WARRANTY; without even the implied warranty of
### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
### GNU General Public License for more details.
###
### You should have received a copy of the GNU General Public License
### along with this program; if not, write to the Free Software
### Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

proc editor {} {
    # Editing / Editor
    Desc "Editor for writing (new) messages"
    ShortDesc "Editor (for new messages)"

    Header head1 \
	-text "Editor you want to write (new) messages with" \
	-background gray \
	-help "Editor to use when typing new mail ie. builtin or emacs, jove, pico, vi, vim..."

    Radio editorRadio1 \
	-text "" \
        -defaultIndex 0 \
        -entryhelp {"Use editor of your own choice" "If you allways want to start ie. emacs to write your messages (even for very short messages)." \
		    "Use builtin = simulate Berkeley Mail" "A much easyer and quicker editor than ie. emacs with much fewer commands. Brilliant for sending short messages. Offcause, directly from this builtin editor you can start 'easyeditor' (ie. emacs) or 'visualeditor' (ie. vi) whenever you choose to."} \
	-help "" \
        -packFrame:fill x

    File-Dir-Browser editorDir1 \
	-text "Location of prefered editor" \
	-exist 1
    foreach widget { editorDir1 } {
	Help $widget "If in doubt of location please: 1) type in only the name (ie. \"emacs\") if you have a path for that editor, that is simply typing in the (ie. \"emacs\") activates that editor. Or 2) type \"which/whereis emacs\" for correct location. You can add any commandline options (like 'emacs -nw')."
    }

    File-Dir-Browser editorDir5 \
	-text "Location of 'easyeditor' (~e command)" \
	-default "/usr/bin/emacs" \
	-exist 1
    foreach widget { editorDir5 } {
	Help $widget "The editor to be used by the \"~e\" escape within the builtin editor. If in doubt of location please: 1) type in only the name (ie. \"emacs\") if you have a path for that editor, that is simply typing in the (ie. \"emacs\") activates that editor. Or 2) type \"which/whereis emacs\" for correct location. You can add any commandline options (like 'emacs -nw')." \
    }

    File-Dir-Browser editorDir6 \
	-text "Location of 'visualeditor' (~v command)" \
	-default "/usr/bin/emacs" \
	-exist 1
    foreach widget { editorDir6 } {
	Help $widget "The editor to be used by the \"~v\" escape within the builtin editor. If in doubt of location please: 1) type in only the name (ie. \"vi\") if you have a path for that editor, that is simply typing in the (ie. \"vi\") activates that editor. Or 2) type \"which/whereis vi\" for correct location. You can add any commandline options (like 'emacs -nw')." \
    }

    File-Dir-Browser editorDir7 \
	-text "Editor when mailing to a message including text" \
	-default "/usr/bin/emacs" \
	-exist 1
    foreach widget { editorDir7 } {
	Help $widget "The editor to use when mailing to a message that already includes text, as the builtin editor cannot handle that situation. Messages that already include text are forwarded messages and replies where the original message is included in the reply. This could be emacs or vi. If in doubt of location please type simple the name (ie. \"emacs\") or \"which emacs/vi\" for correct location."
    }

    Entry editorEntry6 \
	-text "Character to use in the builtin editor for entering commands" \
	-help "The character used with the builtin editor to escape from text entry to input a command. When a line begins with this character, the builtin editor interprets it as a command rather than as text to add. The default is `~' (tilde)." \
	-default "~" \
	-width 2


  ################################ Change #################################
    Change {
	if {$editorRadio1(index)==1} {
		Disable editorDir1
	        Enable editorDir5
	        Enable editorDir6
	        Enable editorDir7
                Enable editorEntry6
	} else {
		Enable editorDir1
	        Disable editorDir5
	        Disable editorDir6
	        Disable editorDir7
                Disable editorEntry6
	}

    }

  ################################# Init ##################################
    Init {
    }

  ################################# Save ##################################

    Save {
	print "\n# what editor to use (\"none\" means simulate Berkeley Mail)"
	if {$editorRadio1(index)==0} {
		print "editor = $editorDir1"
	} else {
		print "editor = none"
	}
	print "\n# name of editor for ~e command (when editor=\"builtin)\"\neasyeditor = $editorDir5"
	print "\n# name of editor for ~v command (when editor=\"builtin)\"\nvisualeditor = $editorDir6"
	print "\n# name of editor to use for replies that have text\nalteditor = $editorDir7"

	print "\n# the character to use in the builtin editor for entering commands"
	if {$editorEntry6=="~"} {
		print "###escape = ~"
	} else {
		print "escape = $editorEntry6"
	}

    }
}