From - Tue Sep  8 07:59:38 1998
Return-Path: <owner-tkdesk@shaknet.clark.net>
Received: from mail.wiesbaden.netsurf.de (bolik@localhost [127.0.0.1])
	by localhost (8.8.5/8.8.5) with ESMTP id MAA00257
	for <bolik>; Fri, 4 Sep 1998 12:51:08 +0200
Received: from shaknet.clark.net by wiesbaden.netsurf.de with esmtp
	(Smail3.1.28.1 #10) id m0zEfFF-001lhRa; Thu, 3 Sep 98 21:40 MET DST
Received: (from root@localhost)
	by shaknet.clark.net (8.8.7/8.8.7) id NAA09972
	for tkdesk-outgoing; Thu, 3 Sep 1998 13:21:33 -0500
Date: Thu, 03 Sep 1998 13:22:23 -0400
From: Daniel Martin at cush <dtm12@jhunix.hcf.jhu.edu>
Subject: tkdesk Some contributed changes to xemacs_load
To: tkdesk@shaknet.clark.net
Message-id: <87d89d9kmo.fsf@cush.dyn.ml.org>
MIME-version: 1.0 (generated by tm-edit 7.108)
X-Mailer: Gnus v5.5/XEmacs 20.4 - "Emerald"
Content-type: text/plain; charset=US-ASCII
Lines: 76
Sender: owner-tkdesk@shaknet.clark.net
Precedence: bulk
Reply-To: Daniel Martin at cush <dtm12@jhunix.hcf.jhu.edu>
X-Mozilla-Status: 8001

Daniel Martin at cush <dtm12@jhunix.hcf.jhu.edu>

Majordomo 1.94.4
I've redone the xemacs_load function so that, in addition to doing
what it currently does, it allows things like:
xemacs_load gnus function
xemacs_load "(switch-to-buffer-other-frame (generate-new-buffer \"New \
File\"))" lisp

That is, you can pass lisp code or a function to xemacs_load.

I find this very convenient, as I can then replace the communicator
mail stuff that's on the Appbar's default mailbox menu with things
that call up gnus, which is what I use.

# ---------------------------------------------------------------------------
# xemacs_load what ?where?
# An improved proc provided by Erez Strauss (erez@newplaces.com) to
# communicate with a running XEmacs.  For this to work you need to put the
# lines:
# (gnuserv-start)
# (require 'ange-ftp)
# into your ~/.emacs.  The second line allows for FTP through XEmacs.
# $what is the file that is to be loaded, $where may be: same, other, frame.

proc xemacs_load {what {where same}} {

    catch {auto_reset}        
    if ![dsk_auto_execok "gnudoit"] {
        dsk_errbell
        cb_error "Couldn't find gnudoit.  Maybe you don't have XEmacs installed?"
        return
    }
    
    switch $where {
        "same" { #default
            set gnudoitargs "(find-file \"$what\")"
            set xemacsargs "$what"
            # set func find-file
            # exec gnudoit -q (find-file \"$what\")
        }
        "other" {
	    set gnudoitargs "(find-file-other-window \"$what\")"
	    set xemacsargs "$what"
            # set func find-file-other-window
            # exec gnudoit -q (find-file-other-window \"$what\")
        }
        "frame" {
	    set gnudoitargs "(find-file-other-frame \"$what\")"
	    set xemacsargs "$what"
            # set func find-file-other-frame
            # exec gnudoit -q (find-file-other-frame \"$what\")
        }
        "scratch" {
            set gnudoitargs "(switch-to-buffer-other-frame \"*scratch*\")"
            set xemacsargs {*scratch*}
            # set func switch-to-buffer-other-frame
            # set what {*scratch*}
            # exec gnudoit -q (switch-to-buffer-other-frame \"*scratch*\")
        }
        "function" {
            set gnudoitargs "($what)"
            set xemacsargs "-f $what"
        }
        "lisp" {
            set gnudoitargs "$what"
            set xemacsargs "-eval $what"
        }
    }
    set err [catch { exec gnudoit -q $gnudoitargs }]
    if $err {
        if {[cb_yesno "XEmacs is not yet running on your display. Start it now
	?"] == 0} {
            # start new xemacs
            eval dsk_exec xemacs $xemacsargs
        }
    }
}


