File: exmh.MASTER

package info (click to toggle)
exmh 1:2.9.0-1
  • links: PTS
  • area: main
  • in suites: buster
  • size: 4,216 kB
  • sloc: tcl: 38,046; perl: 1,647; makefile: 130; sh: 101; exp: 75; csh: 9; sed: 2
file content (119 lines) | stat: -rwxr-xr-x 3,863 bytes parent folder | download | duplicates (2)
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
119
#!/usr/bin/wish -f
#
# TK interface to the MH Mail utility
# Brent Welch <welch@acm.org>
# Original version by <Ed Oskiewicz (eo@ansa.co.uk)>
#
# Copyright (c) 1993-8 Brent Welch
# Copyright (c) 1993-5 Xerox Corporation.
# Copyright (c) 1996-8 Sun Microsystems
# Use and copying of this software and preparation of derivative works based
# upon this software are permitted. Any distribution of this software or
# derivative works must comply with all applicable United States export
# control laws. This software is made available AS IS, and Xerox Corporation
# and Sun Microsystems
# make no warranty about the software, its performance or its conformity to
# any specification.

# The following lines are patched by exmh.install
#CONFIGURATION
#END CONFIGURATION

# for safety so that old exmh config files don't keep it from starting
# old configs didn't include version
set exmh(version) "version 2.8.0 04/21/2012 (/etc/exmh.conf is OLD)"
source /etc/exmh.conf


package require Tk
if {$tcl_version < 8.5} {
    error "Tcl 8.5 or higher required."
    exit 1
}
# Do this so popups related to user initialization
# appear all alone.
wm withdraw .

# fonts in tk8.5: short aliases like don't work properly anymore
# (confusion with the font face stuff)
# recreate the common fallback "fixed" as a copy of TkFixedFont
eval font create fixed [font configure TkFixedFont]

proc auto_path_update { path } {
    # Add library directories to the auto_path,
    # ensuring that later paths have precedence
    # and that function override works
    global auto_path tk_version
    if [file exists $path/tclIndex] {
	set auto_path "$path $auto_path"
	# Used to have an "auto_reset" here, but that has the bad
	# side effect of causing Tk's entry.tcl and text.tcl files
	# to reload and redefine top-level Entry and Text bindings
	# that we change in seditBind.tcl.
	# catch {auto_reset} ;# Needed for function override
    }
}

auto_path_update $exmh(library)

if ![file exists $exmh(library)/tclIndex] {
    if [file exists ./lib/tclIndex] {
	puts stderr "Warning, using local script library, ./lib"
	set exmh(library) ./lib
    }
}

# Support per-user directory containing .tcl files.
# This was originally the ~/.tk/exmh directory,
# but then files migrated into ~/.exmh so
# a lib subdirectory there is cleaner

foreach exmh(userLibrary) [list [glob ~]/.exmh/lib [glob ~]/.tk/exmh] {
    if {[file exists [file join $exmh(userLibrary) tclIndex]]} {
	auto_path_update $exmh(userLibrary)	;# library for new modules
	break
    }
}
# Fall through with ~/.tk/exmh as the default because there
# are other places in the code that assume exmh(userLibrary) is defined

# Set up the environment
if {[catch {
  Env_Init
} err]} {
  puts stderr "Error running Env_Init: $err"
  puts stderr "This usually means exmh isn't installed right"
  puts stderr "Check the main exmh script for the CONFIGURATION section"
  puts stderr "and make sure exmh(library) is a valid absolute pathname"
  exit 1
}

# For WindowMaker, http://www.inf.ufrgs.br/~kojima/wmaker/
wm group . .

# For session managers
wm command . "$argv0 $argv"
catch {wm client . "[exec hostname]"}
catch { . configure -cursor left_ptr }

# modified by k.furukawa, jul.1994.  for kanji
# this piece of code enables japanese kanji display if you use
# tk-jp extension and JIS code.  if you use EUC for MH processing 
# codes, you may replace JIS with EUC and you may need more works.

if {[info commands kanji] == "kanji"} {
    kanji internalCode JIS
    option add *Text.Font a14
}

# Ensure the user is in a writable directory for @ links
if {[string match /* $exmh(library)] &&
    [string match /* $argv0]} {
    # Don't go anywhere when testing
    cd
}

# The rest of the application is defined by routines in the exmh library
# The after 1 trick is to ensure we get the built-in error handler.

after 1 {Exmh}