Re: mailcap entry for html - escaping spaces

2011-11-06 Thread Tim Johnson
* Cameron Simpson c...@zip.com.au [05 16:28]:
 On 05Nov2011 14:23, Tim Johnson t...@akwebsoft.com wrote:
 |   Done. I've installed the css package. Added the invocation of
 |   env.sh to to .profile. Restarted mutt. With environment :).
 |   Below is result of mutt - !env
 [...]
 | TMPDIR=/var/folders/rj/6r6lch2d1mqb6p8k7s_ydrh8gn/T/
 
 Interesting. Seems a surprisingly complicated path. Mine's /tmp or ~/tmp
 depending, normally.
  Which OS are you on? 

 | 
 PATH=/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/opt/css/bin:/sbin:/usr/sbin
 
 I'm surprised ~/bin isn't in here. Or do you not have one?
  I do. Will add it. Thanks 
 
 I'm hoping xv worked?
  It loads, but does not load the file. I just get the splash screen 

 | remap: /Users/tim/rc/remap: No such file or directory
 | Save [/Users/tim/dl/muttAUDN80.]?

  Also, would like to eliminate prompt to save file.  Do you mind
  resending me the URL for your documentation. I lost it. Sorry!

 | And what is the use for rc/remap?
 
 rc/remap lets apphelper compute a default save file basename from the
 supplied filename,  
 Understood. I created it.

-- 
Tim 
tim at tee jay forty nine dot com or akwebsoft dot com
http://www.akwebsoft.com


Re: mailcap entry for html - escaping spaces

2011-11-06 Thread Cameron Simpson
On 06Nov2011 07:31, Tim Johnson t...@akwebsoft.com wrote:
| * Cameron Simpson c...@zip.com.au [05 16:28]:
|  On 05Nov2011 14:23, Tim Johnson t...@akwebsoft.com wrote:
|  |   Done. I've installed the css package. Added the invocation of
|  |   env.sh to to .profile. Restarted mutt. With environment :).
|  |   Below is result of mutt - !env
|  [...]
|  | TMPDIR=/var/folders/rj/6r6lch2d1mqb6p8k7s_ydrh8gn/T/
|  
|  Interesting. Seems a surprisingly complicated path. Mine's /tmp or ~/tmp
|  depending, normally.
|   Which OS are you on? 

Snow Leopard. But I explicitly set $TMPDIR in my login stuff, so maybe I
have never noticed the system default.

|  I'm hoping xv worked?
|   It loads, but does not load the file. I just get the splash screen 

That's no good. While xv is open, what does ps show its command line
to be? It should be running xv the-file, presuming you have xv %s in
the mailcap.

|  | remap: /Users/tim/rc/remap: No such file or directory
|  | Save [/Users/tim/dl/muttAUDN80.]?
| 
|   Also, would like to eliminate prompt to save file.  Do you mind
|   resending me the URL for your documentation. I lost it. Sorry!

http://www.cskk.ezoshosting.com/cs/css/manuals/apphelper.1.html

Sounds like you want the -N, -Y or -A options.

Half the point of apphelper is to view-and-offer-to-save. Otherwise you
may as well just run the viewer directly. (Unless you want to always
save the file I guess.)

Cheers,
-- 
Cameron Simpson c...@zip.com.au DoD#743
http://www.cskk.ezoshosting.com/cs/

Very few things happen at the right time, and the rest do not happen at all.
The conscientious historian will correct these defects.
- Mark Twain, _A Horse's Tale_


Re: mailcap entry for html - escaping spaces

2011-11-06 Thread Tim Johnson
* Cameron Simpson c...@zip.com.au [06 11:31]:
 
 |  I'm hoping xv worked?
 |   It loads, but does not load the file. I just get the splash screen 
 
 That's no good. While xv is open, what does ps show its command line
 to be? It should be running xv the-file, presuming you have xv %s in
 the mailcap.
 
 |  | remap: /Users/tim/rc/remap: No such file or directory
 |  | Save [/Users/tim/dl/muttAUDN80.]?
 | 
 |   Also, would like to eliminate prompt to save file.  Do you mind
 |   resending me the URL for your documentation. I lost it. Sorry!
 
 http://www.cskk.ezoshosting.com/cs/css/manuals/apphelper.1.html
 
 Sounds like you want the -N, -Y or -A options.
 
 Half the point of apphelper is to view-and-offer-to-save. Otherwise you
 may as well just run the viewer directly. (Unless you want to always
 save the file I guess.)
  Duh. I was missing the '%s' following xv.
  Since I would prefer just to save the attachment directly from
  mutt, I changed the rules to bypass ah.
  Right now I have the relevant rules:
(possible line wrapping...)

  text/html; withstdin --keepfor=60 --ext=.html open -a
  /usr/local/bin/chrome %s
  image/jpg; xv %s; gui
  image/jpeg; xv %s; gui
  image/gif; xv %s; gui

  What I have tried worked more or less like in linux.

  But, with your reference to apphelper being a 'gateway drug', I
  would be happy to experiment further with it to see what other
  uses it has.

  thanks again.
-- 
Tim 
tim at tee jay forty nine dot com or akwebsoft dot com
http://www.akwebsoft.com


Re: mailcap entry for html - escaping spaces

2011-11-06 Thread Cameron Simpson
On 06Nov2011 13:46, Tim Johnson t...@akwebsoft.com wrote:
| * Cameron Simpson c...@zip.com.au [06 11:31]:
|  |   Also, would like to eliminate prompt to save file.  Do you mind
|  |   resending me the URL for your documentation. I lost it. Sorry!
|  
|  http://www.cskk.ezoshosting.com/cs/css/manuals/apphelper.1.html
|  
|  Sounds like you want the -N, -Y or -A options.
|  
|  Half the point of apphelper is to view-and-offer-to-save. Otherwise you
|  may as well just run the viewer directly. (Unless you want to always
|  save the file I guess.)

I meant to mention here that there are three responses to that prompt:

  y or yes  Save the file with the suggested name.
  n or no or just enter
Skip saving the file.
  a filenameSave the file to your specified filename.

There's a whole section on Saving The File in the manual entry.
The convenience is remembering where the last file was saved,
and offering easy default and don't-save responses.
And it has some shortcuts for common fix-the-name stuff.

|   Since I would prefer just to save the attachment directly from
|   mutt, I changed the rules to bypass ah.

Sure.

|   Right now I have the relevant rules: (possible line wrapping...)
| 
|   text/html; withstdin --keepfor=60 --ext=.html open -a
|   /usr/local/bin/chrome %s
|   image/jpg; xv %s; gui
|   image/jpeg; xv %s; gui
|   image/gif; xv %s; gui
| 
|   What I have tried worked more or less like in linux.

Looks good to me.

|   But, with your reference to apphelper being a 'gateway drug', I
|   would be happy to experiment further with it to see what other
|   uses it has.

I think I originally wrote apphelper for use with mozilla/firefox et al,
which would often present PDFs inline or hand them off to some viewer,
with _no_ save option at all. By making apphelper the handler for these
things I got to pick my viewer with more care and got the save option
as well (because I almost invariably want to archive any PDF I read).
BTW, being fired from a browser is the reason for the optional leading
-t option, to spawn a terminate for the view/save dialogue.

Then I started using it with mutt because the save facilities worked
better for me. If I just want to save something I do indeed use mutt's
attachment menu save facility, but if I view a file I welcome the
following save request. It also has a guess-the-file-type facility for
maltyped downloads.

Cheers,
-- 
Cameron Simpson c...@zip.com.au DoD#743
http://www.cskk.ezoshosting.com/cs/

When you are in it up to your ears, keep your mouth shut.


Re: mailcap entry for html - escaping spaces

2011-11-05 Thread Tim Johnson
* Cameron Simpson c...@zip.com.au [04 17:36]:
 On 04Nov2011 15:50, Tim Johnson t...@akwebsoft.com wrote:
 |  And from env.sh, I note the following:
 | : ${OS:=''}
 | case `uname -sr` in
 |   SunOS\ [56789].\*)  OS=solaris ;;
 |   SunOS\ \*)  OS=sunos ;;
 |   Linux\ \*)  OS=linux ;;
 | esac
 
 I'm using darwin. But please update your env.sh to the attached env.sh,
 which I have commited to the css package but not yet pushed. It does
 something more sane, and emits darwin as it should.
  Done. I've installed the css package. Added the invocation of
  env.sh to to .profile. Restarted mutt. With environment :).
  Below is result of mutt - !env
##
SITENAME=johnson.com
MANPATH=/usr/man:/usr/share/man:/opt/css/man
TERM_PROGRAM=iTerm.app
HOSTNAME=linus.johnson.com
SHELL=/bin/bash
TERM=xterm-256color
HOST=linus
TMPDIR=/var/folders/rj/6r6lch2d1mqb6p8k7s_ydrh8gn/T/
Apple_PubSub_Socket_Render=/tmp/launch-L03KVA/Render
MAILDOMAIN=johnson.com
PERL5LIB=/opt/css/lib/perl
OS=darwin
USER=tim
COMMAND_MODE=unix2003
SSH_AUTH_SOCK=/tmp/launch-jjTwbP/Listeners
__CF_USER_TEXT_ENCODING=0x1F5:0:0
PATH=/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/opt/css/bin:/sbin:/usr/sbin
_=/usr/bin/env
PWD=/Users/tim
LANG=en_US.UTF-8
VIM_APP_DIR=/Applications/MacVim-snapshot-62/MacVim.app/Contents/MacOS
ITERM_PROFILE=MUTT
HOME=/Users/tim
COLORFGBG=0;15
SHLVL=2
ITERM_SESSION_ID=w0t4p0
HOSTDOMAIN=johnson.com
LOGNAME=tim
PYTHONPATH=/opt/css/lib/python
CLASSPATH=/usr/lib/jre/lib:/opt/css/lib/java/au.com.zip.cs.jar
EMAIL=t...@johnson.com
DISPLAY=/tmp/launch-guDDs2/org.x:0
SECURITYSESSIONID=186a5
##
And when I select an attached .jpg file, I get this
(as well as the image, yay!)
Press any key to continue...
/var/folders/rj/6r6lch2d1mqb6p8k7s_ydrh8gn/T/muttAUDN80.: JPEG
image data, JFIF standard 1.01

/usr/local/bin/apphelper: view args=[xv]
+ exec xv
remap: /Users/tim/rc/remap: No such file or directory
Save [/Users/tim/dl/muttAUDN80.]?
##
And what is the use for rc/remap?
##

Good stuff!

-- 
Tim 
tim at tee jay forty nine dot com or akwebsoft dot com
http://www.akwebsoft.com


Re: mailcap entry for html - escaping spaces

2011-11-05 Thread Cameron Simpson
On 05Nov2011 14:23, Tim Johnson t...@akwebsoft.com wrote:
|   Done. I've installed the css package. Added the invocation of
|   env.sh to to .profile. Restarted mutt. With environment :).
|   Below is result of mutt - !env
[...]
| TMPDIR=/var/folders/rj/6r6lch2d1mqb6p8k7s_ydrh8gn/T/

Interesting. Seems a surprisingly complicated path. Mine's /tmp or ~/tmp
depending, normally.

| 
PATH=/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/opt/css/bin:/sbin:/usr/sbin

I'm surprised ~/bin isn't in here. Or do you not have one?

| And when I select an attached .jpg file, I get this
| (as well as the image, yay!)
| Press any key to continue...
| /var/folders/rj/6r6lch2d1mqb6p8k7s_ydrh8gn/T/muttAUDN80.: JPEG
| image data, JFIF standard 1.01
| 
| /usr/local/bin/apphelper: view args=[xv]
| + exec xv

I'm hoping xv worked?

| remap: /Users/tim/rc/remap: No such file or directory
| Save [/Users/tim/dl/muttAUDN80.]?

It should remember the last save dir if you change that, and you only need to
specify a dir if the file basename is ok (which it isn't above).

| ##
| And what is the use for rc/remap?
| ##

rc/remap lets apphelper compute a default save file basename from the
supplied filename, for example if you get sent files with annoying
brackets or spaces in them or with a common naming scheme you want to
recognise. I should probably make it shut up if it is missing. You can
make yourself an empty one. You can also set $APPHELPER_REMAPFILE in your
environment to the preferred location of the remap file, and set it to
/dev/null if you want to not bother. Or you can set $APPHELPER_SAVEMAP
to an arbitrary shell command instead of the default call to the remap
script.

Cheers,
-- 
Cameron Simpson c...@zip.com.au DoD#743
http://www.cskk.ezoshosting.com/cs/

I sympathize with the makers of _The Net_. We're sad bastards really and
they're trying their best to make us seem interesting.
- d...@prim.demon.co.uk (Dave Griffiths)


Re: mailcap entry for html - escaping spaces

2011-11-04 Thread Tim Johnson
* Cameron Simpson c...@zip.com.au [03 18:42]:
 On 03Nov2011 17:07, Tim Johnson t...@akwebsoft.com wrote:
 |   Cameron, thanks for those explanations.  
 |   I have not yet installed your css package. Been really busy here.
 |   Will try to get to it tomorrow or saturday. 
 |   This is fun. And informative.
 OK. Starting to look at it. See below.
 No worries, whenever.
 
 |   BTW: This pythonist has notices a whole lot of .py files in your
 |   tarball.
 
 Dang.
 
 I came to Python quite late from Perl, largely because I had this huge
 set of wheels coded in Perl. Now I write little Perl and lots of Python.
 
 I ended up with a whole lot of wheels coded in rebol, which went
 nowhere, despite its redeeming features. My biz partner is a
 perlmonger and they will take away his perl when they pry it from
 his cold, dead fingers.

 And from env.sh, I note the following:
: ${OS:=''}
case `uname -sr` in
  SunOS\ [56789].\*)  OS=solaris ;;
  SunOS\ \*)  OS=sunos ;;
  Linux\ \*)  OS=linux ;;
esac
## On my box, `uname -sr` gives me
Darwin 11.2.0. How do you recommend I intialize $OS ??
thanks
-- 
Tim 
tim at tee jay forty nine dot com or akwebsoft dot com
http://www.akwebsoft.com


Re: mailcap entry for html - escaping spaces

2011-11-04 Thread Cameron Simpson
On 04Nov2011 15:50, Tim Johnson t...@akwebsoft.com wrote:
|  And from env.sh, I note the following:
| : ${OS:=''}
| case `uname -sr` in
|   SunOS\ [56789].\*)  OS=solaris ;;
|   SunOS\ \*)  OS=sunos ;;
|   Linux\ \*)  OS=linux ;;
| esac

I'm using darwin. But please update your env.sh to the attached env.sh,
which I have commited to the css package but not yet pushed. It does
something more sane, and emits darwin as it should.

Cheers,
-- 
Cameron Simpson c...@zip.com.au DoD#743
http://www.cskk.ezoshosting.com/cs/

python -c 'import this'


env.sh
Description: Bourne shell script


Re: mailcap entry for html - escaping spaces

2011-11-03 Thread Tim Johnson
* Cameron Simpson c...@zip.com.au [02 18:51]:
 | |  This discrepancy is odd, and a little troubling. We probably need to
 | |  investigate that a little.
 | |   I think this has to do with the way that iTerm2 passes the
 | |   environment to mutt... but I am just guessing.
 | 
 | Hmm. I'm using iTerm (didn't know iTerm2 existed; now _I_ have something
 | to investigate). In my iTerm bookmarks (imagining iterm2 to be a similar
 | model) I have a cs bookmark which is my default; it runs zsh
 | --login, i.e. a login shell. And that sources my environment setup.
 
 Ok, now running iTerm2. How do you invoke mutt then? A special iterm2
 profile or something else?
  I just use /opt/local/bin/mutt as the command in a profile.
  I can also launch mutt directly from the default profile. In that
  case, mutt gets the save environment as the shell (of course).
  So, when one picks a 'Command' option under the 'Command' group,
  an abbreviated environment is provided?
  thanks
-- 
Tim 
tim at tee jay forty nine dot com or akwebsoft dot com
http://www.akwebsoft.com


Re: mailcap entry for html - escaping spaces

2011-11-03 Thread Tim Johnson
* Tim Johnson t...@akwebsoft.com [03 08:15]:
 * Cameron Simpson c...@zip.com.au [02 18:51]:
  | |  This discrepancy is odd, and a little troubling. We probably need to
  | |  investigate that a little.
  | |   I think this has to do with the way that iTerm2 passes the
  | |   environment to mutt... but I am just guessing.
  | 
  | Hmm. I'm using iTerm (didn't know iTerm2 existed; now _I_ have something
  | to investigate). In my iTerm bookmarks (imagining iterm2 to be a similar
  | model) I have a cs bookmark which is my default; it runs zsh
  | --login, i.e. a login shell. And that sources my environment setup.
  
  Ok, now running iTerm2. How do you invoke mutt then? A special iterm2
  profile or something else?
   I just use /opt/local/bin/mutt as the command in a profile.
   I can also launch mutt directly from the default profile. In that
   case, mutt gets the save environment as the shell (of course).
   So, when one picks a 'Command' option under the 'Command' group,
   an abbreviated environment is provided?
And furthermore, if I were to set the Command option as Login
Shell and for the Send text at start enter 'mutt', then
when I launch the profile, mutt gets the environment from the
login shell, _with_ full paths.
FYI ...
-- 
Tim 
tim at tee jay forty nine dot com or akwebsoft dot com
http://www.akwebsoft.com


Re: mailcap entry for html - escaping spaces

2011-11-03 Thread Cameron Simpson
On 03Nov2011 07:55, Tim Johnson t...@akwebsoft.com wrote:
| * Cameron Simpson c...@zip.com.au [02 18:51]:
|  Ok, now running iTerm2. How do you invoke mutt then? A special iterm2
|  profile or something else?
|
|   I just use /opt/local/bin/mutt as the command in a profile.
|   I can also launch mutt directly from the default profile. In that
|   case, mutt gets the save environment as the shell (of course).
|   So, when one picks a 'Command' option under the 'Command' group,
|   an abbreviated environment is provided?
|
| And furthermore, if I were to set the Command option as Login
|   Shell and for the Send text at start enter 'mutt', then
|   when I launch the profile, mutt gets the environment from the
|   login shell, _with_ full paths.

That sounds right. Taking the latter case first, mutt gets the environment
because your login shell has build the environment before mutt gets
invoked.

For the former case, mutt gets invoked possibly directly by iTerm2, more
likely by haning the string /opt/local/bin/mutt to /bin/sh or your
own shell, but _not_ as a login shell. So your personal environment
setup has not been run. This situation is common in GUI desktop
environments, where the sequence is:

  GUI - terminal-app - command

~/.bash_profile et al don't get used along that path.

By contrast, a text mode UNIX system goes:

  getty - login-shell - start-window-system - terminal-app - command

and your login environment setup gets in right at the start.

Upshot: all new terminals on your Mac really want to source your login
environment. For your default profile you're running a login shell so it
is all done. For the others you need to tweak the command in the
profile.

You currently have:

  /opt/local/bin/mutt

Try changing the mutt profile to one of these:
  /opt/css/bin/with-login-env /opt/local/bin/mutt
or
  bash --login -c /opt/local/bin/bash

The only reason I mention the former is that it plays nicely if the
command has arguments which need quoting, eg:

  mutt -e 'some mutt setup commands'

with-login-env lets you use that raw:
  with-login-env mutt -e some-setup-commands'

whereas the latter needs nested quotes:
  bash --login -c 'mutt -e some mutt setup commands'

which will get nasty quite fast if there are shell/mutt $-strings in
the commands.

Cheers,
-- 
Cameron Simpson c...@zip.com.au DoD#743
http://www.cskk.ezoshosting.com/cs/

In politics, sincerity is everything.
If you learn to fake that, you've got it made.
- Paul Austin paus...@harris.com


Re: mailcap entry for html - escaping spaces

2011-11-03 Thread Tim Johnson
* Cameron Simpson c...@zip.com.au [03 11:47]:
 On 03Nov2011 07:55, Tim Johnson t...@akwebsoft.com wrote:
 
 That sounds right. Taking the latter case first, mutt gets the environment
 because your login shell has build the environment before mutt gets
 invoked.
 
 For the former case, mutt gets invoked possibly directly by iTerm2, more
 likely by haning the string /opt/local/bin/mutt to /bin/sh or your
 own shell, but _not_ as a login shell. So your personal environment
 setup has not been run. This situation is common in GUI desktop
 environments, where the sequence is:
 
   GUI - terminal-app - command
 
 ~/.bash_profile et al don't get used along that path.
 
 By contrast, a text mode UNIX system goes:
 
   getty - login-shell - start-window-system - terminal-app - command
 
 and your login environment setup gets in right at the start.
 
 Upshot: all new terminals on your Mac really want to source your login
 environment. For your default profile you're running a login shell so it
 is all done. For the others you need to tweak the command in the
 profile.
 
 You currently have:
 
   /opt/local/bin/mutt
 
 Try changing the mutt profile to one of these:
   /opt/css/bin/with-login-env /opt/local/bin/mutt
 or
   bash --login -c /opt/local/bin/bash
  Cameron, thanks for those explanations.  
  I have not yet installed your css package. Been really busy here.
  Will try to get to it tomorrow or saturday. 
  This is fun. And informative.
  BTW: This pythonist has notices a whole lot of .py files in your
  tarball.
 The only reason I mention the former is that it plays nicely if the
 command has arguments which need quoting, eg:
 
   mutt -e 'some mutt setup commands'
 
 with-login-env lets you use that raw:
   with-login-env mutt -e some-setup-commands'
 
 whereas the latter needs nested quotes:
   bash --login -c 'mutt -e some mutt setup commands'
 
 which will get nasty quite fast if there are shell/mutt $-strings in
 the commands.
  L8tr
-- 
Tim 
tim at tee jay forty nine dot com or akwebsoft dot com
http://www.akwebsoft.com


Re: mailcap entry for html - escaping spaces

2011-11-03 Thread Cameron Simpson
On 03Nov2011 17:07, Tim Johnson t...@akwebsoft.com wrote:
|   Cameron, thanks for those explanations.  
|   I have not yet installed your css package. Been really busy here.
|   Will try to get to it tomorrow or saturday. 
|   This is fun. And informative.

No worries, whenever.

|   BTW: This pythonist has notices a whole lot of .py files in your
|   tarball.

Dang.

I came to Python quite late from Perl, largely because I had this huge
set of wheels coded in Perl. Now I write little Perl and lots of Python.

Cheers,
-- 
Cameron Simpson c...@zip.com.au DoD#743
http://www.cskk.ezoshosting.com/cs/

The trouble with fighting for human freedom is that one spends most of
one's time defending scoundrels.  For it is against scoundrels that
oppressive laws are first aimed, and oppression must be stopped at the
beginning if it is to be stopped at all.- H.L. Mencken


Re: mailcap entry for html - escaping spaces

2011-11-02 Thread Tim Johnson
* Cameron Simpson c...@zip.com.au [01 17:55]:
 On 01Nov2011 16:53, Tim Johnson t...@akwebsoft.com wrote:
 |   Got a lot of issues with ah-apphelper.
 
 I feared there might be. I haven't tried to foist it off onto someone else
 before (withstdin runs standalone - apphelper expects more tools).
 
 | But first I have to say
 |   1)I am new to darwin (OSX/Lion)
 |   2)Even tho' I have used linux steadily for 11 years and am a
 |   coder, I'm awful green when it comes to shell scripting.
 |   3)The paths defined by $PATH in the bash shell are considerably
 | more complete than are inherited by mutt - and the same can be
 | said of mc, as far as I can tell.
 |   From bash - linus:~ tim$ echo $PATH
 |   
 /opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin
 |   From mutt echo $PATH
 | /usr/bin:/bin:/usr/sbin:/sbin
 |   that is, where mutt is launched from iTerm2.
 
 This discrepancy is odd, and a little troubling. We probably need to
 investigate that a little.
  I think this has to do with the way that iTerm2 passes the
  environment to mutt... but I am just guessing.
 
 |   So when I run /usr/local/bin/ah, the first thing I get is an error
 |   message about `rm' not being recognized. Well it ain't in $PATH,
 
 rm? That's a pretty standard command - something isn't right. It is
 normally in /bin.
  Yes, and /bin _is_ in mutt's $PATH. Go figure. Maybe has something
  to with the fact that I am using /usr/local/bin for my scripts.
  Perhaps this is not the darwinish way to do things.

 |   so I can give rm an absolute path. With that done and apphelper
 |   give its' full path, I'm now getting error messages with apphelper
 |   execute:
 |   the first was on
 |   mkdirn - command not recognized. 
 |   I went thru your code and picked out a list of what I take to be
 |   commands, but don't appear to be shell commands (subcommands?).
 |   As follows:
 |   mkdirn
 |   withurl
 |   fixexts
 |   file2mime
 |   mailcap
 |   readline
 |   so... I'm guessing that if we solve the problem with mkdirn,
 |   others will fall in place?
 
 Ok, you may hate the next bit. All the items you cite are my own
 scripts.
  :) Oh, I won't hate it at all. 
 The _easy_ way to solve this problem is to install /opt/css, from here:
 
   http://www.cskk.ezoshosting.com/cs/css/
 
 There's a download link to a tarball and install instructions here:
 
   http://www.cskk.ezoshosting.com/cs/css/INSTALL
 
 Just unpack the tarball in /opt, and add the line:
 
   . /opt/css/env.sh
 
 to your environment setup (eg in ~/.bash_profile) at the _end_.
 
 BUT: keep your personal current copy of withstdin - the one in the tarball
 does not yet have the --keepfor option.
 
 So:
   - fetch tarball
   - put it in place as /opt/css
   - source /opt/css/env.sh
   - test apphelper again
 
 This doesn't _need_ to go as /opt/css, but that is the easiest way.
  Cool! I will check this stuff out today.

-- 
Tim 
tim at tee jay forty nine dot com or akwebsoft dot com
http://www.akwebsoft.com


Re: mailcap entry for html - escaping spaces

2011-11-02 Thread Cameron Simpson
On 02Nov2011 09:59, Tim Johnson t...@akwebsoft.com wrote:
| * Cameron Simpson c...@zip.com.au [01 17:55]:
|  On 01Nov2011 16:53, Tim Johnson t...@akwebsoft.com wrote:
|  |   From bash - linus:~ tim$ echo $PATH
|  |   
/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin
|  |   From mutt echo $PATH
|  | /usr/bin:/bin:/usr/sbin:/sbin
|  |   that is, where mutt is launched from iTerm2.
|  
|  This discrepancy is odd, and a little troubling. We probably need to
|  investigate that a little.
|   I think this has to do with the way that iTerm2 passes the
|   environment to mutt... but I am just guessing.

Hmm. I'm using iTerm (didn't know iTerm2 existed; now _I_ have something
to investigate). In my iTerm bookmarks (imagining iterm2 to be a similar
model) I have a cs bookmark which is my default; it runs zsh
--login, i.e. a login shell. And that sources my environment setup.

|  |   So when I run /usr/local/bin/ah, the first thing I get is an error
|  |   message about `rm' not being recognized. Well it ain't in $PATH,
|  
|  rm? That's a pretty standard command - something isn't right. It is
|  normally in /bin.
|   Yes, and /bin _is_ in mutt's $PATH. Go figure. Maybe has something
|   to with the fact that I am using /usr/local/bin for my scripts.
|   Perhaps this is not the darwinish way to do things.

Darwin's not very special - it is all UNIX. /usr/local/bin is a
reasonable place for third party scripts. I infer from stuff earlier
that you're already using MacPorts.

[...]
|  BUT: keep your personal current copy of withstdin - the one in the tarball
|  does not yet have the --keepfor option.
|  
|  So:
|- fetch tarball
|- put it in place as /opt/css
|- source /opt/css/env.sh
|- test apphelper again
|  
|  This doesn't _need_ to go as /opt/css, but that is the easiest way.
|   Cool! I will check this stuff out today.

Great. I'll look at iTerm2 meanwhile; iterm has some annoying performance
issues (CPU spins) with big windows and long histories, and I would welcome
something saner (Terminal doesn't misbehave like that, but iTerm has a
better feature set).

Cheers,
-- 
Cameron Simpson c...@zip.com.au DoD#743
http://www.cskk.ezoshosting.com/cs/

Well personally I see nothing wrong with cannibalism
- gra...@maths.su.oz.au (Graham Matthews)


Re: mailcap entry for html - escaping spaces

2011-11-02 Thread Cameron Simpson
On 03Nov2011 08:30, I wrote:
| On 02Nov2011 09:59, Tim Johnson t...@akwebsoft.com wrote:
| | * Cameron Simpson c...@zip.com.au [01 17:55]:
| |  On 01Nov2011 16:53, Tim Johnson t...@akwebsoft.com wrote:
| |  |   From bash - linus:~ tim$ echo $PATH
| |  |   
/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin
| |  |   From mutt echo $PATH
| |  | /usr/bin:/bin:/usr/sbin:/sbin
| |  |   that is, where mutt is launched from iTerm2.
| |  
| |  This discrepancy is odd, and a little troubling. We probably need to
| |  investigate that a little.
| |   I think this has to do with the way that iTerm2 passes the
| |   environment to mutt... but I am just guessing.
| 
| Hmm. I'm using iTerm (didn't know iTerm2 existed; now _I_ have something
| to investigate). In my iTerm bookmarks (imagining iterm2 to be a similar
| model) I have a cs bookmark which is my default; it runs zsh
| --login, i.e. a login shell. And that sources my environment setup.

Ok, now running iTerm2. How do you invoke mutt then? A special iterm2
profile or something else?

Cheers,
-- 
Cameron Simpson c...@zip.com.au DoD#743
http://www.cskk.ezoshosting.com/cs/

Login incorrect.
Only perfect spellers may
enter this system.
- Haiku Error Messages 
http://www.salonmagazine.com/21st/chal/1998/02/10chal2.html


Re: mailcap entry for html - escaping spaces

2011-11-01 Thread Tim Johnson
* Cameron Simpson c...@zip.com.au [111030 13:12]:
.. 
 For images etc I have a more complex script:
 
   http://www.cskk.ezoshosting.com/cs/css/bin/apphelper
  Got it.

 which offers to view the attachment and also to save it, since I find
 the open viewer, quit, ask to save rigmarole tedious.
 
 It has a million switches (which you can put in $APPHELPER_PREOPTS to
 set default behaviour). Manual page here:
 
   http://www.cskk.ezoshosting.com/cs/css/manuals/apphelper.1.html
 Looking at it. 
 Since apphelper finds the file viewer by consulting the mailcap file
 I in fact keep two such files around: a plain mailcap and a mailcap-ah
 which has lines like:
 
   image/jpg; ah %s xv; gui
   image/jpg; iminfo %s; copiousoutput
 
 which I use with mutt.
 
 As you can see I run apphelper via a small wrapper script ah, which I
 attach below. It runs apphelper with the autoview mode on and has some
 conveniences, such as using the output of `xclip -o` if no filename is
 specified so I can X11-copy a URL and then run ah.
  Got a lot of issues with ah-apphelper. But first I have to say
  1)I am new to darwin (OSX/Lion)
  2)Even tho' I have used linux steadily for 11 years and am a
  coder, I'm awful green when it comes to shell scripting.
  3)The paths defined by $PATH in the bash shell are considerably
more complete than are inherited by mutt - and the same can be
said of mc, as far as I can tell.
  From bash - linus:~ tim$ echo $PATH
  
/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin
  From mutt echo $PATH
/usr/bin:/bin:/usr/sbin:/sbin
  that is, where mutt is launched from iTerm2.

  So when I run /usr/local/bin/ah, the first thing I get is an error
  message about `rm' not being recognized. Well it ain't in $PATH,
  so I can give rm an absolute path. With that done and apphelper
  give its' full path, I'm now getting error messages with apphelper
  execute:
  the first was on
  mkdirn - command not recognized. 
  I went thru your code and picked out a list of what I take to be
  commands, but don't appear to be shell commands (subcommands?).
  As follows:
  mkdirn
  withurl
  fixexts
  file2mime
  mailcap
  readline
  so... I'm guessing that if we solve the problem with mkdirn,
  others will fall in place?

-- 
Tim 
tim at tee jay forty nine dot com or akwebsoft dot com
http://www.akwebsoft.com


Re: mailcap entry for html - escaping spaces

2011-11-01 Thread Cameron Simpson
On 01Nov2011 16:53, Tim Johnson t...@akwebsoft.com wrote:
|   Got a lot of issues with ah-apphelper.

I feared there might be. I haven't tried to foist it off onto someone else
before (withstdin runs standalone - apphelper expects more tools).

| But first I have to say
|   1)I am new to darwin (OSX/Lion)
|   2)Even tho' I have used linux steadily for 11 years and am a
|   coder, I'm awful green when it comes to shell scripting.
|   3)The paths defined by $PATH in the bash shell are considerably
| more complete than are inherited by mutt - and the same can be
|   said of mc, as far as I can tell.
|   From bash - linus:~ tim$ echo $PATH
|   
/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin
|   From mutt echo $PATH
| /usr/bin:/bin:/usr/sbin:/sbin
|   that is, where mutt is launched from iTerm2.

This discrepancy is odd, and a little troubling. We probably need to
investigate that a little.

|   So when I run /usr/local/bin/ah, the first thing I get is an error
|   message about `rm' not being recognized. Well it ain't in $PATH,

rm? That's a pretty standard command - something isn't right. It is
normally in /bin.

|   so I can give rm an absolute path. With that done and apphelper
|   give its' full path, I'm now getting error messages with apphelper
|   execute:
|   the first was on
|   mkdirn - command not recognized. 
|   I went thru your code and picked out a list of what I take to be
|   commands, but don't appear to be shell commands (subcommands?).
|   As follows:
|   mkdirn
|   withurl
|   fixexts
|   file2mime
|   mailcap
|   readline
|   so... I'm guessing that if we solve the problem with mkdirn,
|   others will fall in place?

Ok, you may hate the next bit. All the items you cite are my own
scripts.

The _easy_ way to solve this problem is to install /opt/css, from here:

  http://www.cskk.ezoshosting.com/cs/css/

There's a download link to a tarball and install instructions here:

  http://www.cskk.ezoshosting.com/cs/css/INSTALL

Just unpack the tarball in /opt, and add the line:

  . /opt/css/env.sh

to your environment setup (eg in ~/.bash_profile) at the _end_.

BUT: keep your personal current copy of withstdin - the one in the tarball
does not yet have the --keepfor option.

So:
  - fetch tarball
  - put it in place as /opt/css
  - source /opt/css/env.sh
  - test apphelper again

This doesn't _need_ to go as /opt/css, but that is the easiest way.

Cheers,
-- 
Cameron Simpson c...@zip.com.au DoD#743
http://www.cskk.ezoshosting.com/cs/

Software engineering? That's like military intelligence, isn't it?
- Doug Mohney sys...@king.eng.umd.edu


Re: mailcap entry for html - escaping spaces

2011-10-31 Thread Cameron Simpson
On 30Oct2011 17:35, Tim Johnson t...@akwebsoft.com wrote:
| * Cameron Simpson c...@zip.com.au [111030 13:12]:
|  Should do. The open-an-app mechanism is the same.
|  
|  However, as written withstdin leaves the temp copy lying around (the
|  --keep mode). For HTML this won't waste much disc space by video will
|  quickly get wasteful. I intend adding a --keep=N option to tidy up the
|  temp file after N seconds, time for the app to open the file before
|  tidyup.
|   Looking forward to it. 

Try the attached version. Use --keepfor=60 (or similar), not --keep.

Cheers,
-- 
Cameron Simpson c...@zip.com.au DoD#743
http://www.cskk.ezoshosting.com/cs/

If you cannot, in the long run, tell everyone what you have been doing, your
doing has been worthless.   - Erwin Schrodinger
#!/bin/sh
#
# Copy stdin to a temp file, then pass as arg to a command expecting a filename.
#   - Cameron Simpson c...@zip.com.au 14jul2004
#

set -ue

: ${TMPDIR:=/tmp}

keep=
cleanafter=
ext=

cmd=$0
usage=Usage: $cmd [{--keepfor=seconds|--keep}] [--ext=.blah] command [args...]

badopts=

while [ $# -gt 0 ]
do
  case $1 in
--keepfor)  keep=1
cleanafter=$2
shift
;;
--keepfor=[1-9]*)
keep=1
cleanafter=`expr x$1 : 'x--keepfor=\(.*\)'`
;;
--keep) keep=1 ;;
--ext)  ext=$2; shift ;;
--ext=*)ext=`expr x$1 : 'x--ext=\(.*\)'` ;;
--) shift; break ;;
-?*)echo $cmd: unrecognised option: $1 2
badopts=1
;;
*)  break ;;
  esac
  shift
done

if [ $# = 0 ]
then
  echo $cmd: missing command 2
  badopts=1
fi

[ $badopts ]  { echo $usage 2; exit 2; }

tmpf=$TMPDIR/withstdin$$$ext

trap '[ $keep ] || rm -f $tmpf' 0
trap '[ $keep ] || rm -f $tmpf; exit 1' 1 2 13 15

cat $tmpf || exit 1

if [ -n $cleanafter ]
then
  ( ( sleep $cleanafter
  rm -f $tmpf
) 
  )
fi

# no exec because the trap must run
$@ $tmpf


Re: mailcap entry for html - escaping spaces

2011-10-30 Thread Tim Johnson
* Cameron Simpson c...@zip.com.au [111029 17:51]:
 
 The script is (was) wrong. withstdin was actually a differently purposed
 script and did exhibit that behaviour.
 
 I have modified it. Invoke the new version like this:
 
   text/html; withstdin --keep --ext=.html open -a Chrome %s
 
   You D'Man Cameron! It works now. :)

.. 
 I'm surprised you need a full path to withstdin if it is in your usualy
 stuff (as found by which, for example). You really should not need a
 full path for Chrome at all if it is a normal app. Unless its name isn't
 plain Chrome but something longer like Google Chrome. Command-Tab
 should show the app names.
   I mispoke. I don't need path for withstdin, but yes with Chrome
   and yes the app name is Google Chrome
 Please refetch the updated script (realised my error after my earlier
 post, have been modifying the script meanwhile).
  I've barely started my coffee here. I want to look further at your
  script and see if it will work for image and video attachments.
  I really appreciate the help, and I hope that your script does
  some good for someone else also.
  l8tr
-- 
Tim 
tim at tee jay forty nine dot com or akwebsoft dot com
http://www.akwebsoft.com


Re: mailcap entry for html - escaping spaces

2011-10-30 Thread Cameron Simpson
On 30Oct2011 07:42, Tim Johnson t...@akwebsoft.com wrote:
| * Cameron Simpson c...@zip.com.au [111029 17:51]:
|  The script is (was) wrong. withstdin was actually a differently purposed
|  script and did exhibit that behaviour.
|  
|  I have modified it. Invoke the new version like this:
|  
|text/html; withstdin --keep --ext=.html open -a Chrome %s
|  
|You D'Man Cameron! It works now. :)
| 
| .. 
|  I'm surprised you need a full path to withstdin if it is in your usualy
|  stuff (as found by which, for example). You really should not need a
|  full path for Chrome at all if it is a normal app. Unless its name isn't
|  plain Chrome but something longer like Google Chrome. Command-Tab
|  should show the app names.
|I mispoke. I don't need path for withstdin, but yes with Chrome
|and yes the app name is Google Chrome
|  Please refetch the updated script (realised my error after my earlier
|  post, have been modifying the script meanwhile).
|   I've barely started my coffee here. I want to look further at your
|   script and see if it will work for image and video attachments.

Should do. The open-an-app mechanism is the same.

However, as written withstdin leaves the temp copy lying around (the
--keep mode). For HTML this won't waste much disc space by video will
quickly get wasteful. I intend adding a --keep=N option to tidy up the
temp file after N seconds, time for the app to open the file before
tidyup.

For images etc I have a more complex script:

  http://www.cskk.ezoshosting.com/cs/css/bin/apphelper

which offers to view the attachment and also to save it, since I find
the open viewer, quit, ask to save rigmarole tedious.

It has a million switches (which you can put in $APPHELPER_PREOPTS to
set default behaviour). Manual page here:

  http://www.cskk.ezoshosting.com/cs/css/manuals/apphelper.1.html

Since apphelper finds the file viewer by consulting the mailcap file
I in fact keep two such files around: a plain mailcap and a mailcap-ah
which has lines like:

  image/jpg; ah %s xv; gui
  image/jpg; iminfo %s; copiousoutput

which I use with mutt.

As you can see I run apphelper via a small wrapper script ah, which I
attach below. It runs apphelper with the autoview mode on and has some
conveniences, such as using the output of `xclip -o` if no filename is
specified so I can X11-copy a URL and then run ah.

Be warned that apphelper is like Apple's iTunes: the gateway drug to wanting
a bunch of other scripts like view-unknown for files with a bad MIME type
label, etc :-)

Cheers,
-- 
Cameron Simpson c...@zip.com.au DoD#743
http://www.cskk.ezoshosting.com/cs/

If you take something apart and put it back together again enough times, you
will eventually have enough parts left over to build a second one.
- Ayse Sercan a...@netcom.com
#!/bin/sh -u
#
# Run app-helper with the autoview mode on, defaulting to view-unknown.
#   - Cameron Simpson c...@zip.com.au 17dec2002
#

cmd=$0

unlink=
trace=
ahopts=
while [ $# -gt 0 ]
do
  case $1 in
-u) unlink=1 ;;
-[nyNYAX])  ahopts=$ahopts $1 ;;
*)  break ;;
  esac
  shift
done

if [ $# = 0 ]
then
if [ -n $DISPLAY ]
then
set -- `xclip -o` || exit 1
else
echo Usage: $cmd file [command [args...]] 2
exit 2
fi
fi

file=$1; shift
$trace apphelper $file -y $ahopts ${1+$@} || exit 1

# unlink old copy?
[ $unlink ] || exit 0
[ -s $file ] || exit 0
loc=`fileloc $file` || exit 1
[ x$loc = x$file ]  exit 0
exec rm -- $file


Re: mailcap entry for html - escaping spaces

2011-10-30 Thread Tim Johnson
* Cameron Simpson c...@zip.com.au [111030 13:12]:
 
 Should do. The open-an-app mechanism is the same.
 
 However, as written withstdin leaves the temp copy lying around (the
 --keep mode). For HTML this won't waste much disc space by video will
 quickly get wasteful. I intend adding a --keep=N option to tidy up the
 temp file after N seconds, time for the app to open the file before
 tidyup.
  Looking forward to it. 

 For images etc I have a more complex script:
 
   http://www.cskk.ezoshosting.com/cs/css/bin/apphelper
 
 which offers to view the attachment and also to save it, since I find
 the open viewer, quit, ask to save rigmarole tedious.
 
 It has a million switches (which you can put in $APPHELPER_PREOPTS to
 set default behaviour). Manual page here:
 
   http://www.cskk.ezoshosting.com/cs/css/manuals/apphelper.1.html
 I will be checking this out on tuesday ... 

 Since apphelper finds the file viewer by consulting the mailcap file
 I in fact keep two such files around: a plain mailcap and a mailcap-ah
 which has lines like:
 
   image/jpg; ah %s xv; gui
   image/jpg; iminfo %s; copiousoutput
 
 which I use with mutt.
 
 As you can see I run apphelper via a small wrapper script ah, which I
 attach below. It runs apphelper with the autoview mode on and has some
 conveniences, such as using the output of `xclip -o` if no filename is
 specified so I can X11-copy a URL and then run ah.
 
 Be warned that apphelper is like Apple's iTunes: the gateway drug to wanting
 a bunch of other scripts like view-unknown for files with a bad MIME type
 label, etc :-)
  I will try to resist any temptation to become addicted.
  Thanks again.

-- 
Tim 
tim at tee jay forty nine dot com or akwebsoft dot com
http://www.akwebsoft.com


Re: mailcap entry for html - escaping spaces

2011-10-29 Thread Tim Johnson
* Cameron Simpson c...@zip.com.au [111029 07:03]:
 Here's what I do sometimes. My $PATH has two (well ,more, but basicly
 two) leading items:
 
   $HOME/bin-local
   $HOME/bin
 
 The latter is my collection of scripts and is identical on all machines.
 The _former_ is per-machine hacks (and new scripts not yet part of the
 main set).
 
 For your situation the simplest thing for me would be:
 
   ln -s '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome' 
 $HOME/bin-local/chrome
 
 (On one line, should the mailer fold things.)
 
 Then just make the mailcap read:
 
   text/html; chrome %s
 
 In general, this kind of approach will let you have a nice easy to read
 mailcap with simple command names; you put all the machine specific
 executable location rubbish in $HOME/bin-local if the normal bins don't
 do what you need.
  Hi Cameron. I had thought of something similar, so followed your
  instructions. Unfortunately, it doesn't work either. I get this
  
  [1029/080146:FATAL:foundation_util.mm(105)] Check failed: bundle.
  Failed to load the bundle at
  /usr/local/Versions/15.0.874.106/Google Chrome Framework.framework
  
  lion has done some other weird things with symlinks. For instance
  when I create a symlink from /usr/bin/python to
  /usr/local/bin/python and invoke the symlink directly, the system
  path is different. 
   
Not my experience on ubuntu...

  I think were are looking for a mac-sanctioned script.

  thanks
-- 
Tim 
tim at tee jay forty nine dot com or akwebsoft dot com
http://www.akwebsoft.com


Re: mailcap entry for html - escaping spaces

2011-10-29 Thread Cameron Simpson
On 29Oct2011 08:08, Tim Johnson t...@akwebsoft.com wrote:
|  For your situation the simplest thing for me would be:
|ln -s '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome' 
$HOME/bin-local/chrome
|  (On one line, should the mailer fold things.)
|  Then just make the mailcap read:
|text/html; chrome %s
|  
|  In general, this kind of approach will let you have a nice easy to read
|  mailcap with simple command names; you put all the machine specific
|  executable location rubbish in $HOME/bin-local if the normal bins don't
|  do what you need.

|   Hi Cameron. I had thought of something similar, so followed your
|   instructions. Unfortunately, it doesn't work either. I get this
|   
|   [1029/080146:FATAL:foundation_util.mm(105)] Check failed: bundle.
|   Failed to load the bundle at
|   /usr/local/Versions/15.0.874.106/Google Chrome Framework.framework
|   
|   lion has done some other weird things with symlinks. For instance
|   when I create a symlink from /usr/bin/python to
|   /usr/local/bin/python and invoke the symlink directly, the system
|   path is different. 
|
| Not my experience on ubuntu...
| 
|   I think were are looking for a mac-sanctioned script.

Ok, not to worry.

Does Chrome run at all?

If so, try changing your mailcap line to read:

  text/html; open -a Chrome %s

which uses the Mac's open command to open the URL or file using the
chrome app. That usage works for me (from the command line - I'm not
using this in my mailcap).

I'd test it with:

  open -a Chrome some-url-here

first, from the command line.

And you can get rid of the symlink.

Cheers,
-- 
Cameron Simpson c...@zip.com.au DoD#743
http://www.cskk.ezoshosting.com/cs/

The old day of Perl's try-it-before-you-use-it are long as gone.  Nowadays
you can write as many as 20..100 lines of Perl without hitting a bug in the
perl implementation.- Ilya Zakharevich i...@math.ohio-state.edu,
  in the perl-porters list, 22sep1998


Re: mailcap entry for html - escaping spaces

2011-10-29 Thread Tim Johnson
* Cameron Simpson c...@zip.com.au [111029 13:27]:
 
 Does Chrome run at all?
  Yes. 
 If so, try changing your mailcap line to read:
 
   text/html; open -a Chrome %s
  Done. 
 which uses the Mac's open command to open the URL or file using the
 chrome app. That usage works for me (from the command line - I'm not
 using this in my mailcap).
 
 I'd test it with:
 
   open -a Chrome some-url-here
 
 first, from the command line.
  That works. 
  However, if I do 'm' (view-mailcap) or Cr (view-attach)
  focus switches to a new chrome tab, but I get a 
  This webpage is not found error message.
  Example: location =
  file://localhost/var/folders/rj/6r6lch2d1mqb6p8k7s_ydrh8gn/T/muttPk5vu1
  I can 'backtrace' the path to
  file://localhost/var/folders/rj/6r6lch2d1mqb6p8k7s_ydrh8gn/T/
  and see a directory index, but don't see 'muttPk5vu1' there...

  thanks. Good tip. Making progress.
-- 
Tim 
tim at tee jay forty nine dot com or akwebsoft dot com
http://www.akwebsoft.com


Re: mailcap entry for html - escaping spaces

2011-10-29 Thread Patrick Shanahan
* Tim Johnson t...@akwebsoft.com [10-29-11 20:12]:
 * Cameron Simpson c...@zip.com.au [111029 13:27]:
   That works. 
   However, if I do 'm' (view-mailcap) or Cr (view-attach)
   focus switches to a new chrome tab, but I get a 
   This webpage is not found error message.
   Example: location =
   file://localhost/var/folders/rj/6r6lch2d1mqb6p8k7s_ydrh8gn/T/muttPk5vu1
   I can 'backtrace' the path to
   file://localhost/var/folders/rj/6r6lch2d1mqb6p8k7s_ydrh8gn/T/
   and see a directory index, but don't see 'muttPk5vu1' there...

It is quite possible that the temp file is being cleared before the
browser has loaded it.  I see two possibilities, 
  (1) do not return or hit a key to mutt until the page has loaded or 
  (2) try appending ;copiousoutput to the mailcap entry.
#2 not tested.

-- 
(paka)Patrick Shanahan   Plainfield, Indiana, USA  HOG # US1244711
http://wahoo.no-ip.orgPhoto Album: http://wahoo.no-ip.org/gallery2
http://en.opensuse.org   openSUSE Community Member
Registered Linux User #207535@ http://linuxcounter.net


Re: mailcap entry for html - escaping spaces

2011-10-29 Thread Cameron Simpson
On 29Oct2011 16:09, Tim Johnson t...@akwebsoft.com wrote:
| * Cameron Simpson c...@zip.com.au [111029 13:27]:
|  Does Chrome run at all?
|   Yes. 
|  If so, try changing your mailcap line to read:
|  
|text/html; open -a Chrome %s
|   Done. 
|  which uses the Mac's open command to open the URL or file using the
|  chrome app. That usage works for me (from the command line - I'm not
|  using this in my mailcap).
|  
|  I'd test it with:
|  
|open -a Chrome some-url-here
|  
|  first, from the command line.
|   That works. 
|   However, if I do 'm' (view-mailcap) or Cr (view-attach)
|   focus switches to a new chrome tab, but I get a 
|   This webpage is not found error message.
|   Example: location =
|   file://localhost/var/folders/rj/6r6lch2d1mqb6p8k7s_ydrh8gn/T/muttPk5vu1
|   I can 'backtrace' the path to
|   file://localhost/var/folders/rj/6r6lch2d1mqb6p8k7s_ydrh8gn/T/
|   and see a directory index, but don't see 'muttPk5vu1' there...
| 
|   thanks. Good tip. Making progress.

Ah, ok. What you're seeing is that mutt cleans up the temp file after
the command completes. open tells chrome what to open, and exits. Mutt
cleans up. Chrome responsds too late and sees nothing.

What you need is a wrapper script to take a copy of the file and hand
the copy to chrome. Like this one:

  http://www.cskk.ezoshosting.com/cs/css/bin/withstdin

You can imagine what led me to write that:-)

Then your mailcap entry becomes:

  text/html; withstdin open -a Chrome %s

which hands a copy to Chrome.

Cheers,
-- 
Cameron Simpson c...@zip.com.au DoD#743
http://www.cskk.ezoshosting.com/cs/

``On the information highway, there'll be no cops. No gas stations.  No rest
  stops.  No tow trucks.  But there will be dramatic pause passing lanes.''

Just remember, on the information superhighway, we are the Hell's Angels.

I will be a speed bump on the information super-highway.
- jvo...@math.rutgers.edu (jeff vogel)

Newbies are the roadkills of the information super-highway.
Alt.flame is the storm drain of the information super-highway.
CARASSO is the black ice on the information super-highway.

in the information superhighway i am the discarded refuse at the side
of the road. (strangly, i am proud of this).- chevyn


Re: mailcap entry for html - escaping spaces

2011-10-29 Thread Tim Johnson
* Cameron Simpson c...@zip.com.au [111029 16:50]:
 |   thanks. Good tip. Making progress.
 
 Ah, ok. What you're seeing is that mutt cleans up the temp file after
 the command completes. open tells chrome what to open, and exits. Mutt
 cleans up. Chrome responsds too late and sees nothing.
 
 What you need is a wrapper script to take a copy of the file and hand
 the copy to chrome. Like this one:
 
   http://www.cskk.ezoshosting.com/cs/css/bin/withstdin
 
 You can imagine what led me to write that:-)
 
 Then your mailcap entry becomes:
 
   text/html; withstdin open -a Chrome %s
 
 which hands a copy to Chrome.
  I tried that. Now I get :
  
  No webpage was found for the web address:
  file://localhost/var/folders/rj/6r6lch2d1mqb6p8k7s_ydrh8gn/T/withstdin9745
  
  Time doesn't permit me to look at your script closely until later
  tonight or tomorrow morning, but perhaps something needs to be
  modified in the script?
  Also, I note that I have to give full path to Chrome and withstdin
  in the mailcap entry. Don't quite get that... I see /usr/local/bin
  in $PATH and `which' sees the scripts and the symlink
  
-- 
Tim 
tim at tee jay forty nine dot com or akwebsoft dot com
http://www.akwebsoft.com


Re: mailcap entry for html - escaping spaces

2011-10-29 Thread Cameron Simpson
On 29Oct2011 17:05, Tim Johnson t...@akwebsoft.com wrote:
| * Cameron Simpson c...@zip.com.au [111029 16:50]:
|  |   thanks. Good tip. Making progress.
|  
|  What you need is a wrapper script to take a copy of the file and hand
|  the copy to chrome. Like this one:
|  
|http://www.cskk.ezoshosting.com/cs/css/bin/withstdin
[...]
|   I tried that. Now I get :
|   
|   No webpage was found for the web address:
|   
file://localhost/var/folders/rj/6r6lch2d1mqb6p8k7s_ydrh8gn/T/withstdin9745
|   
|   Time doesn't permit me to look at your script closely until later
|   tonight or tomorrow morning, but perhaps something needs to be
|   modified in the script?

The script is (was) wrong. withstdin was actually a differently purposed
script and did exhibit that behaviour.

I have modified it. Invoke the new version like this:

  text/html; withstdin --keep --ext=.html open -a Chrome %s

|   Also, I note that I have to give full path to Chrome and withstdin
|   in the mailcap entry. Don't quite get that... I see /usr/local/bin
|   in $PATH and `which' sees the scripts and the symlink

I'm surprised you need a full path to withstdin if it is in your usualy
stuff (as found by which, for example). You really should not need a
full path for Chrome at all if it is a normal app. Unless its name isn't
plain Chrome but something longer like Google Chrome. Command-Tab
should show the app names.

Please refetch the updated script (realised my error after my earlier
post, have been modifying the script meanwhile).

Let me know if it is any better for you.

Cheers,
-- 
Cameron Simpson c...@zip.com.au DoD#743
http://www.cskk.ezoshosting.com/cs/

The aim of AI is to make computers act like the ones in the movies.
- Graham Mann


Re: mailcap entry for html - escaping spaces

2011-10-29 Thread Cameron Simpson
On 29Oct2011 20:29, Patrick Shanahan ptilopt...@gmail.com wrote:
| * Tim Johnson t...@akwebsoft.com [10-29-11 20:12]:
|  * Cameron Simpson c...@zip.com.au [111029 13:27]:
|That works. 
|However, if I do 'm' (view-mailcap) or Cr (view-attach)
|focus switches to a new chrome tab, but I get a 
|This webpage is not found error message.
|Example: location =
|
file://localhost/var/folders/rj/6r6lch2d1mqb6p8k7s_ydrh8gn/T/muttPk5vu1
|I can 'backtrace' the path to
|file://localhost/var/folders/rj/6r6lch2d1mqb6p8k7s_ydrh8gn/T/
|and see a directory index, but don't see 'muttPk5vu1' there...
| 
| It is quite possible that the temp file is being cleared before the
| browser has loaded it.  I see two possibilities, 
|   (1) do not return or hit a key to mutt until the page has loaded or 
|   (2) try appending ;copiousoutput to the mailcap entry.
| #2 not tested.

(1) might work, though I'm offering another approach in the other thread
branch. (2) won't help - you never see chrome return from the web page
display, and watching the command output for EOF doesn't help.

Cheers,
-- 
Cameron Simpson c...@zip.com.au DoD#743
http://www.cskk.ezoshosting.com/cs/

It's the business of killing trees and putting chemicals on them.
- overhead by WIRED at the Intelligent Printing conference Oct2006


Re: mailcap entry for html - escaping spaces

2011-10-29 Thread Cameron Simpson
On 30Oct2011 12:23, I wrote:
| Please refetch the updated script (realised my error after my earlier
| post, have been modifying the script meanwhile).

Please refetch after 12:31pm GMT+11 (01:31 GMT). Another bugfix for the
upgrade - doesn't actually bite your proposed use though.

Cheers,
-- 
Cameron Simpson c...@zip.com.au DoD#743
http://www.cskk.ezoshosting.com/cs/

I die. I have a terrible fever in my head and it gets hotter and hotter until
my head is a fire, a forge, a star. I set the world on fire and all die. O the
embarrassment.  - Joe Haldeman, _A !Tangled Web_


Re: mailcap entry for html - escaping spaces

2011-10-29 Thread Patrick Shanahan
* Cameron Simpson c...@zip.com.au [10-29-11 21:26]:
 (1) might work, though I'm offering another approach in the other thread
 branch. (2) won't help - you never see chrome return from the web page
 display, and watching the command output for EOF doesn't help.

when I view an http email in firefox, if I hit-a-key to return to mutt
too soon, the page fails to load in firefox as the temp file has been
removed.  I understand that you don't see chrome *return* but you know
that there is a delay until the entire page/data is handed off to chrome
where the exchange can be interrupted.  Supposedly copiousoutput delays
the return from browser/other-app until the data has been
exchanged/delivered..

-- 
(paka)Patrick Shanahan   Plainfield, Indiana, USA  HOG # US1244711
http://wahoo.no-ip.orgPhoto Album: http://wahoo.no-ip.org/gallery2
http://en.opensuse.org   openSUSE Community Member
Registered Linux User #207535@ http://linuxcounter.net


Re: mailcap entry for html - escaping spaces

2011-10-28 Thread Cameron Simpson
On 28Oct2011 16:27, Tim Johnson t...@akwebsoft.com wrote:
| Using mutt on Mac Lion - OSX 10.7
| I'm trying to create a mailcap entry so that I can view text/html
| attachments with chrome
| The chrome executable is on a path with embedded spaces.
| I have the following entry:
| ##
| text/html; /Applications/Google\ Chrome.app/Contents/MacOS/Google\
| Chrome %s
| ##
| in .mailcap.
| 
| When I select the attachment I get the following error message:
| [1028/162111:INFO:breakpad_mac.mm(82)] Breakpad disabled
| [5695:2571:73282031144211:ERROR:process_singleton_mac.cc(102)]
| Unable to obtain profile lock.
| 
| I think that could be translated as Barking up the wrong tree.
| What would be the preferable way to do this?
| 
| NOTE: I am most familiar with ubuntu. I am new to Lion.
| Ubuntu uses a script called /usr/bin/sensible-browser for this
| purpose, I believe. 
| 
| Is there a comparable script for Lion?

Here's what I do sometimes. My $PATH has two (well ,more, but basicly
two) leading items:

  $HOME/bin-local
  $HOME/bin

The latter is my collection of scripts and is identical on all machines.
The _former_ is per-machine hacks (and new scripts not yet part of the
main set).

For your situation the simplest thing for me would be:

  ln -s '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome' 
$HOME/bin-local/chrome

(On one line, should the mailer fold things.)

Then just make the mailcap read:

  text/html; chrome %s

In general, this kind of approach will let you have a nice easy to read
mailcap with simple command names; you put all the machine specific
executable location rubbish in $HOME/bin-local if the normal bins don't
do what you need.

Cheers,
-- 
Cameron Simpson c...@zip.com.au DoD#743
http://www.cskk.ezoshosting.com/cs/

I am now convinced that theoretical physics is actual philosophy.
- Max Born