sam-fans - fans of the sam editor
 help / color / mirror / Atom feed
* Re: sam and varios mail programs
@ 1994-12-08 16:50 Rich Salz
  0 siblings, 0 replies; 4+ messages in thread
From: Rich Salz @ 1994-12-08 16:50 UTC (permalink / raw)
  To: arnold, sam-fans

I modified sam so that when creating the fifo it first did
	getenv("sampipe")
and if that existed it used that as the name of the pipe.  I set that
variable in my .rcrc which is sourced by my X startup stuff.

For editing I set VISUAL to $home/bin/callsam, which is this:
#! /bin/rc
~ $#* 1 || {
    echo Usage: `{basename $0} file >[1=2]
    exit 1
}

~ $#sampipe 0 && {
    sampipe=$home/.sam.$USER
    ! ~ $#DISPLAY 0 && sampipe=$sampipe.$DISPLAY
}
! test -r $sampipe && {
    echo `{basename $0} ^ ': No pipe "' ^ $sampipe ^ '" to sam' >[1=2]
    exit 1
}

{ switch ($1) {
case /*
    echo B $1
case *
    echo B `{builtin pwd} ^ / ^ $1
} }>$sampipe

echo Type EOF when done:
cat
# Could use "sed 1q" to get just a newline but I prefer the EOF.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: sam and varios mail programs
@ 1994-12-08 16:56 Arnold Robbins
  0 siblings, 0 replies; 4+ messages in thread
From: Arnold Robbins @ 1994-12-08 16:56 UTC (permalink / raw)
  To: sam-fans

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 481 bytes --]

> (various?)

*I* can spell. My keyboard can't, though. ☺

> why not change your EDITOR variable to be a script
> that uses B to get the file into sam,

This is the easy part.

> and some other
> signal or watchdog to get it back?

This is the hard part.  It happens that if I do something like this
with mush, and simply wait until I've finished with the editor, I'm ok,
but it's pretty fragile.  That's why I was wondering if someone else had
beat me to inventing this wheel.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* sam and varios mail programs
@ 1994-12-08 16:35 Arnold Robbins
  0 siblings, 0 replies; 4+ messages in thread
From: Arnold Robbins @ 1994-12-08 16:35 UTC (permalink / raw)
  To: sam-fans

Greetings.  I use 'mush' as my mail program, and I have my EDITOR environment
variable set to use sam.  The problem comes when I have a sam running, and
then I go to read mail. When I edit my file, it cranks up another sam. But
when that sam quits, it removes the fifo in /tmp that the `B' command uses.
At that point, I can no longer use `B' to communicate with my orignal sam.

My question is, how do *you* handle this?  Does anyone have a shell script
that runs B on their temporary mail file such that things stay in sync
after the file is written back out with sam?

(This has probably been discussed before...)

Thanks!

Arnold


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: sam and varios mail programs
@ 1994-12-08  7:55 Jonathan Shopiro
  0 siblings, 0 replies; 4+ messages in thread
From: Jonathan Shopiro @ 1994-12-08  7:55 UTC (permalink / raw)
  To: arnold; +Cc: sam-fans

I use mailx with sam as my editor.  I only have one instance of sam on
my workstation.  It works like this:

I invoke mailx with the following command:

	crt=50 PAGER=Bcat VISUAL=BB mailx

"crt=50" means if it's longer than 50 lines run it through the pager.

"PAGER=Bcat" means use Bcat (a shell script; see below) to display long messages.

"VISUAL=BB" means use BB (ditto) as the message editor

Then when I try to read a long message it appears in sam.  When I
compose a message I can type "~v" and the message so far appears in
sam.  I edit it until its perfect, select write, and go back to the
mailx window where I hit return and then send it.  It's a mess, really,
but it beats mailtool and textedit (no characterization sufficiently
derogatory).

Now for my question: has anybody gotten <exch> to work reliably with
sam and 9term under Solaris?  It seems to work for a while after
rebooting but then it doesn't work anymore.  I poked through the code
to some X function about swapping selections and then I gave up.  Also,
is it supposed to work to snarf in one 9term window and paste (the
snarfed text) into another?  That never works for me.

		-- Jonathan Shopiro
		   Merrill Lynch & Co.


Here are the shell scripts (simple modifications of B, both of them):

Bcat:
	#!/bin/sh
	
	file=$HOME/tmp/Bcat$$
	files=$file
	line="none"
	
	if [ $# != 0 ]; then
		echo 'usage: Bcat'  1>&2
		exit 1
	fi
	
	dir=`/bin/pwd`
	if [ "$USER" = "" ]; then
		USER=$LOGNAME
	fi
	pipe=/tmp/.sam.$USER
	
	if [ $DISPLAY != "" ]; then
		pipe=$pipe.$DISPLAY
	fi
	
	if [ ! -r $pipe ]; then
		echo `basename $0`": No pipe \""$pipe"\" to sam." 1>&2
		exit 1
	fi
	
	cat - >$file
	
	echo "B $files" >> $pipe
	if [ $line != "none" ]; then
		echo $line >> $pipe
	fi
	
	read dummy

BB:
	#!/bin/sh
	
	files=
	line="none"
	
	if [ $# = 0 ]; then
		echo 'usage: BB [-nnnn] files...'  1>&2
		exit 1
	fi
	
	dir=`/bin/pwd`
	if [ "$USER" = "" ]; then
		USER=$LOGNAME
	fi
	pipe=/tmp/.sam.$USER
	
	if [ $DISPLAY != "" ]; then
		pipe=$pipe.$DISPLAY
	fi
	
	if [ ! -r $pipe ]; then
		echo `basename $0`": No pipe \""$pipe"\" to sam." 1>&2
		exit 1
	fi
	
	for i in $*
	do
		case "$i" in
			/*)	files="$files $i"
				;;
			-*)	line=`echo $i | sed 's/.//'`
				;;
			*)	files="$files $dir/$i"
				;;
		esac
	done
	
	echo "B $files" >> $pipe
	if [ $line != "none" ]; then
		echo $line >> $pipe
	fi
	
	read dummy




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1994-12-08 18:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1994-12-08 16:50 sam and varios mail programs Rich Salz
  -- strict thread matches above, loose matches on Subject: below --
1994-12-08 16:56 Arnold Robbins
1994-12-08 16:35 Arnold Robbins
1994-12-08  7:55 Jonathan Shopiro

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).