Subject: Re: Please stop using makeashorterlink etc.
From: rpw3@rpw3.org (Rob Warnock)
Date: Mon, 18 Nov 2002 02:18:00 -0600
Newsgroups: comp.lang.lisp
Message-ID: <iyadncIgsqSlP0WgXTWc1w@giganews.com>
Joost Kremers  <joostkremers@yahoo.com> wrote:
+---------------
| Greg Neumann wrote:
| > Joost Kremers <joostkremers@yahoo.com> wrote:
| >> IMHO it's also useful if you read news on a different machine than the
| >> one you're browser is running on (e.g. through ssh), which is my
| >> set-up (most of the time). so i can only follow a url by
| >> copy&paste. if a long url is wrapped or falls off the screen, it's
| >> quite difficult to c&p it...
| > 
| > Notice how inelegant software forces bad workarounds. ;)  I'm assuming
| > that the ssh software somehow puts a newline in the cut&paste buffer
| > where it shouldn't.
| 
| no, the problem is that if the url is spread out over multiple lines,
| the new-lines are already there. and if it is one long line that is
| wider than the screen, slrn doesn't wrap, but only displays the first
| part, allowing you to scroll horizontally to see the rest. and if you
| tell slrn to wrap, it puts a few spaces before the wrapped lines...
| 
| slrn just wasn't designed for this...
+---------------

IMHO, the problem is that virtually *none* of the mail and/or news
readers (including slrn, apparently) ever bothered to implement the
RFC 1738 "Appendix: Recommendations for URLs in Context", or they would
have no trouble at all with URLs like this one <URL:http://techpubs.
sgi.com/library/tpl/cgi-bin/browse.cgi?coll=0650&db=bks&cmd=toc&pth=
/SGI_Developer/DevDriver_PG>, which I used quite a lot back when I
worked at SGI.  ;-}  The spec even mandates ignoring leading & trailing
whitespace, so that this gets you to the same place.

	<URL:http://techpubs.sgi.com/lib
	rary/tpl/cgi-bin/browse.cgi?coll
	=0650&db=bks&cmd=toc&pth=/SGI_De
	veloper/DevDriver_PG>


-Rob

p.s. Not to be a tease, I herein share a couple of hacks which
make life much easier in dealing with long URLs (especially given
the absence of help from the mail/news readers). In your ~/.twmrc
[or similar, YMMV], in one of the top-level (root) menus, add this
line (yeah, prolly should be called "Sel->NS"):

	"Sel->URL"      f.exec "sel2url &"

In ~/bin/sel2url:

	#!/bin/sh
	# Strip whitespace & RFC 1738 Appendix <URL:> marker,
	# and URL-encode a few dangerous punctuation chars.
	# Also allow <http:> from RFC 2396 Appendix E.
	url=`/bin/echo \`xselection PRIMARY\` | \
	     sed -e 's/[	 ]*//g' \
		 -e 's/\`/%60/g' \
		 -e 's/,/%2c/g' \
		 -e 's/^<URL:\(.*\)>$/\1/' \
		 -e 's/^<http:\(.*\)>$/http:\1/'`

	# defensiveness/convenience
	case "X$url" in
	X"")	echo "sel2url: Can't open null URL!"
		exit 1
		;;
	X[0-9][0-9][0-9][0-9][0-9][0-9])
		# Six-digit number: Assume this is an Engineering bug number.
		# url="http://{CENSORED}/bwxquery.cgi?view_type=Bug&wi=$url"
	esac

	exec netscape -remote "openURL($url)"

[If you don't have Richard Hesketh's ancient "xselection" program, you
can use "xclip" from the FreeBSD ports collection, or anything similar.]

Then all you have to do is mouse-select some URL -- RFC 1738 bracketed
or not, multiline or not, whitespace or not -- and go to the root menu
and select the "Sel->URL" option, and the selected web page will pop up
on the topmost of the current Netscape windows.

-----
Rob Warnock, PP-ASEL-IA		<rpw3@rpw3.org>
627 26th Avenue			<URL:http://www.rpw3.org/>
San Mateo, CA 94403		(650)572-2607