Re: Select alternative ~/.exmh/exmh-defaults

Wolfgang Denk <[email protected]> Mon, 09 Jan 2017 23:51:55 +0100
Newsgroups gmane.mail.exmh.user
Message-ID <[email protected]>
Hi,

In message <[email protected]> I wrote:
> 
> is my understanding correct that the  ~/.exmh/exmh-defaults  file name
> is hard-coded and cannot be overwritten by any means like command line
> option, environment variable or such?
...
> Can this be done? [without hacking the code, I mean...]

Here is a quick & dirty patch that appears to do what I'm looking for;
it allows to overwrite the  "~/.exmh/exmh-defaults" default setting by
passing an alternative file name in the EXMH_DEFAULTS environment
variable:

--- main.tcl.ORIG	2005-04-05 03:38:52.000000000 +0200
+++ main.tcl	2017-01-09 23:48:38.264059862 +0100
@@ -11,13 +11,26 @@
 # makes no warranty about the software, its performance or its conformity to
 # any specification.
 
+proc GetUserDefaults {} {
+	global env
+
+	if {[info exists env(EXMH_DEFAULTS)]} {
+		set value $env(EXMH_DEFAULTS)
+	} else {
+		set value "~/.exmh/exmh-defaults"
+	}
+
+	return $value
+}
+
 proc Exmh {} {
     global exmh argv 
 
     Tcl_Tk_Vers_Init	;# Do per-release Tcl/Tk setup here
     Mh_Init		;# Defines mhProfile and identifies mh vs nmh
 
-    Preferences_Init "~/.exmh/exmh-defaults" "$exmh(library)/app-defaults"
+#!#    Preferences_Init "~/.exmh/exmh-defaults" "$exmh(library)/app-defaults"
+    Preferences_Init "[GetUserDefaults]" "$exmh(library)/app-defaults"
 
     TopTenPreferences
 

Does this make any sense?


Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: [email protected]
The only way to learn a new programming language is by  writing  pro-
grams in it.                                        - Brian Kernighan