Discussion:
Using BBEdit as my EDITOR for news
Lewis@Gmail
2008-03-18 12:32:38 UTC
Permalink
OK, I want to, if it's possible, use bbedit as my editor for posting
to news via a command line news reader and I'm running into an issue.
The command I use to invoke vim as the editor is:

set post_editor_command "vim +'set tw=72' +'set noai' +%d '%s'"

I can invoke nano by changing it to "nano -r 72 --tempfile '%s'"

And I can use bbedit with "bbedit -t "NNTP POSTING" --new-window '%s'"

But the vim and nano commands will invoke the editor with a line
length of 72 characters (which is preferred for news) and I can't find
a way to invoke BBEdit from the cli with a hard-wrap of 72 characters.

I have to remember to hard-warp the post when I am done writing it,
and, naturally, I forget to do that more often than not.

I use BBEdit for a lot of other stuff, so changing the default in
BBEdit to hard warp is not an option.
--
"Real stupidity beats artificial intelligence every time."
--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <***@barebones.com>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to: <bbedit-talk-***@barebones.com>
Carlton Gibson
2008-03-18 12:54:27 UTC
Permalink
Hi,

Go to edit > text options... Set the width you require and save the
file as stationary. Then when you want to use it file > new from
stationary should do you.

Sorry, I don't know what the command line option is.

Regards,
Carlton
Post by ***@Gmail
OK, I want to, if it's possible, use bbedit as my editor for
posting to news via a command line news reader and I'm running into
set post_editor_command "vim +'set tw=72' +'set noai' +%d '%s'"
I can invoke nano by changing it to "nano -r 72 --tempfile '%s'"
And I can use bbedit with "bbedit -t "NNTP POSTING" --new-window '%s'"
But the vim and nano commands will invoke the editor with a line
length of 72 characters (which is preferred for news) and I can't
find a way to invoke BBEdit from the cli with a hard-wrap of 72
characters.
I have to remember to hard-warp the post when I am done writing it,
and, naturally, I forget to do that more often than not.
I use BBEdit for a lot of other stuff, so changing the default in
BBEdit to hard warp is not an option.
--
"Real stupidity beats artificial intelligence every time."
--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <***@barebones.com>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to: <bbedit-talk-***@barebones.com>
Lewis@Gmail
2008-03-18 16:48:04 UTC
Permalink
Post by Carlton Gibson
Go to edit > text options... Set the width you require and save the
file as stationary.
Then when you want to use it file > new from stationary should do you.
The trouble with this is that the way the CLI editors work is:

The text file is accepted as it is passed from the news reader to a
file and no changes are made to it. This means that the headers,
which can often exceed 72 characters (or even 272 characters) do not
get mangled. Anything the user types, get automatically hard wrapped
at the specified wrap (72 characters is common, so is 76).

Failing BBEdit working, does anyone have any other suggestions? I
want a GUI editor that interfaces with the OS X spelling service, as
well as the other features of the OS X Text services (emacs-like
editing keys, Services menu, text to speech, live URLS, etc).
--
Passion is the pill you can swallow forever
Taking them one by one
One by One
Agents of Good Roots "Come On"
--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <***@barebones.com>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to: <bbedit-talk-***@barebones.com>
Carlton Gibson
2008-03-18 17:36:18 UTC
Permalink
Post by ***@Gmail
Failing BBEdit working, does anyone have any other suggestions?
I can't believe that a simple UNIX Filter/Text Factory wouldn't do
the job... Type your post. Run the filter/factory. Done. -- Obviously
you'd have to write the filter/factory but your requirements don't
sound that complicated. ("Leave headers alone, wrap the rest to 72
characters a line").
Errol Sayre
2008-03-18 17:37:43 UTC
Permalink
Post by ***@Gmail
Failing BBEdit working, does anyone have any other suggestions? I
want a GUI editor that interfaces with the OS X spelling service, as
well as the other features of the OS X Text services (emacs-like
editing keys, Services menu, text to speech, live URLS, etc).
Perhaps just a GUI news reader?

http://www.panic.com/unison/
--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <***@barebones.com>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to: <bbedit-talk-***@barebones.com>
Errol Sayre
2008-03-18 17:46:24 UTC
Permalink
Post by Errol Sayre
Perhaps just a GUI news reader?
http://www.panic.com/unison/
I should clarify that Unison is a full NNTP news client, rather than
just a reader.

Arguably, it's the best news client for the Mac :-)
--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <***@barebones.com>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to: <bbedit-talk-***@barebones.com>
Charlie Garrison
2008-03-18 14:35:23 UTC
Permalink
Good morning,
Post by ***@Gmail
And I can use bbedit with "bbedit -t "NNTP POSTING" --new-window '%s'"
Certainly not tested, so may not work due to bbedit command not
completing until window is closed, but how about:

bbedit -t "NNTP POSTING" --new-window '%s' ; osascript 'tell app
"BBEdit" to hard wrap text 1 of text document 1 limit character
width width 72 indentation none with paragraph fill and relative'

That AppleScript came from a script recording, so adjust to taste.

If that doesn't work due to script not running until after
window is closed, then try the fmt command, eg:

bbedit -t "NNTP POSTING" --new-window '%s' ; fmt -w 72 '%s' > '%s'

BTW, I'm assuming that %s is the temp file name.


Charlie
--
Charlie Garrison <***@zeta.org.au>
PO Box 141, Windsor, NSW 2756, Australia

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
http://www.ietf.org/rfc/rfc1855.txt
--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <***@barebones.com>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to: <bbedit-talk-***@barebones.com>
Lewis@Gmail
2008-03-18 16:48:02 UTC
Permalink
Post by Charlie Garrison
bbedit -t "NNTP POSTING" --new-window '%s' ; osascript 'tell app
"BBEdit" to hard wrap text 1 of text document 1 limit character
width width 72 indentation none with paragraph fill and relative'
That AppleScript came from a script recording, so adjust to taste.
If that doesn't work due to script not running until after window is
bbedit -t "NNTP POSTING" --new-window '%s' ; fmt -w 72 '%s' > '%s'
Both of these options will, I think, mangle the headers of the
message. However, if there was a way to tell the script to wrap the
text from the first blank line to the end of the document, that might
work.

news posts are like emails, the headers end on the first blank line.
Everything after that is considered the body of the post.
Post by Charlie Garrison
BTW, I'm assuming that %s is the temp file name.
yes.

I wonder if there is a cli text formater I could pipe the message
through? I am already doing several things to that poor file

my actual command is

post_editor_command "FILE='%s';bbedit --new-window $FILE;/opt/local/
bin/fortune ~/mysigs >> $FILE"

(th -t option didn't seem to work)

Ah... wait a minute, I think your fmt might do it, it has a -m option
that talks about mail headers....

Ah, potential, but alas it munges the signature delimiter and doesn't
quite do the right thing with the headers.

Hmm.. this is more complicated than I first thought. the commands
after the first do not wait until BBEdit finishes writing to run. So,
I can try and throw something through fmt, then attach the signatures,
but they all execute too soon.
--
"Real stupidity beats artificial intelligence every time."
--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <***@barebones.com>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to: <bbedit-talk-***@barebones.com>
Charlie Garrison
2008-03-18 17:53:40 UTC
Permalink
Good morning,
Post by ***@Gmail
Both of these options will, I think, mangle the headers of the
message. However, if there was a way to tell the script to
wrap the text from the first blank line to the end of the
document, that might work.
news posts are like emails, the headers end on the first blank
line. Everything after that is considered the body of the post.
OK, good luck with it.
Post by ***@Gmail
a way to invoke BBEdit from the cli with a hard-wrap of 72 characters.
So that's why I offered the solutions I did. If you only want to
wrap part of the document, I think you'll have to do that manually.


Charlie
--
Charlie Garrison <***@zeta.org.au>
PO Box 141, Windsor, NSW 2756, Australia

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
http://www.ietf.org/rfc/rfc1855.txt
--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <***@barebones.com>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to: <bbedit-talk-***@barebones.com>
Chris Janton
2008-03-19 14:16:51 UTC
Permalink
Post by ***@Gmail
Hmm.. this is more complicated than I first thought. the commands
after the first do not wait until BBEdit finishes writing to run.
So, I can try and throw something through fmt, then attach the
signatures, but they all execute too soon.
"man bbedit" is your friend.

-w, --wait
Wait until the file is closed in BBEdit. Normally, the
bbedit tool
exits immediately after the file arguments are opened in
BBEdit.
This option applies to both local files and files opened
from FTP
or SFTP servers.

Hmm. The example in the man page shows how to do it for tcsh - that
seems way too old ;-)

export EDITOR="bbedit -w"

would seem to be a nice example for bash et al.

You could make a simple script (bash) that might look like this

bbedit -t "NNTP POSTING" --new-window -w $1
fmt -w 72 -m $1 > $1.tmp
cat $1.tmp `/opt/local/bin/fortune ~/mysigs` >$1
rm $1.tmp

8)
----------------------------------
Chris Janton - face at CentosPrime dot COM
Netminder for Opus1.COM
--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <***@barebones.com>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to: <bbedit-talk-***@barebones.com>
Lewis@Gmail
2008-03-19 15:21:06 UTC
Permalink
Post by Chris Janton
Post by ***@Gmail
Hmm.. this is more complicated than I first thought. the commands
after the first do not wait until BBEdit finishes writing to run.
So, I can try and throw something through fmt, then attach the
signatures, but they all execute too soon.
"man bbedit" is your friend.
-w, --wait
Yeah, I did find that. Oddly, it's not necessary unless I am doing
something else to the file also, because slrn waits until you confirm
to actually send the file. By that time, BBedit has written it so the
right file gets sent.

I was using just bbedit '%s' before, and hat worked just fine, as long
as I was happy with a static signature and manually wrapping the posts
each time.
Post by Chris Janton
You could make a simple script (bash) that might look like this
bbedit -t "NNTP POSTING" --new-window -w $1
fmt -w 72 -m $1 > $1.tmp
cat $1.tmp `/opt/local/bin/fortune ~/mysigs` >$1
rm $1.tmp
Right, that's essentially what I ended up with, before seeing that fmt
simply mangled the headers of the posting.

set post_editor_command "FILE='%s';cp $FILE ${FILE}.new;bbedit -w --
new-window +%d ${FILE}.new;fmt -m -72 ${FILE}.new > $FILE;/opt/local/
bin/fortune ~/mysigs >> $FILE"

$ cat .article.new
Newsgroups: misc.test
From: Lewis <***@gmail.com>
Subject: test
Reply-To:
Followup-To:
Keywords:
Summary:
X-Face: )^b5"R:T7U>9~:PEn3YkzMfW*[b1qKeU.fP9C8~8HpU9}lA&6`bH1z

This si a test post with a very long line. This si a test post with a
very long line. This si a test post with a very long line. This si a
test post with a very long line. This si a test post with a very long
line. This si a test post with a very long line. This si a test post
with a very long line. This si a test post with a very long line. This
si a test post with a very long line. This si a test post with a very
long line. This si a test post with a very long line.

$ fmt -m 72 .article.new
Newsgroups: misc.test
From: Lewis <***@gmail.com>
Subject: test
Reply-To: Followup-To: Keywords: Summary: X-Face:
)^b5"R:T7U>9~:PEn3YkzMfW*[b1qKeU.fP9C8~8HpU9}lA&6`bH1z

This si a test post with a very long line. This si a test post with a
very
long line. This si a test post with a very long line. This si a test
post
with a very long line. This si a test post with a very long line. This
si
a test post with a very long line. This si a test post with a very long
line. This si a test post with a very long line. This si a test post
with
a very long line. This si a test post with a very long line. This si a
test post with a very long line.

===

The body gets wrapped, but the headers are completely hosed.

I thought vim/nvi has a 'rewrap' command... wonder if there is some
way to pipe the file through vim... I may have to pull out my perl
book. Horrors!
--
I draw the line at 7 unreturned phone calls.
--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <***@barebones.com>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to: <bbedit-talk-***@barebones.com>
Chris Janton
2008-03-20 17:01:48 UTC
Permalink
Post by ***@Gmail
$ fmt -m 72 .article.new
Newsgroups: misc.test
Subject: test
)^b5"R:T7U>9~:PEn3YkzMfW*[b1qKeU.fP9C8~8HpU9}lA&6`bH1z
hmmm. In BBEdit what is the setting of the preference

Text Files > Default Line Breaks

Might it be that you are providing Mac(CR) line breaks to applications
that want Unix(LF) ?

8)
----------------------------------
Chris Janton - face at CentosPrime dot COM
Netminder for Opus1.COM
--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <***@barebones.com>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to: <bbedit-talk-***@barebones.com>
Lewis@Gmail
2008-03-20 22:45:50 UTC
Permalink
Post by Chris Janton
Post by ***@Gmail
$ fmt -m 72 .article.new
Newsgroups: misc.test
Subject: test
)^b5"R:T7U>9~:PEn3YkzMfW*[b1qKeU.fP9C8~8HpU9}lA&6`bH1z
hmmm. In BBEdit what is the setting of the preference
Text Files > Default Line Breaks
Might it be that you are providing Mac(CR) line breaks to
applications that want Unix(LF) ?
No, the file as it comes from BBEdit is correct, it's just fmt that
has the issue with the headers. It's not really fmt's fault, it was
not designed for this.

I did find something I didn't know, BBedit's Hard Wrap... command acts
on the current file if there is no selection, but only on the
selection if there is.

So, if I could figure out a fast way to select only the body of the
message, I could use the Hard Wrap command.

Also, command-option-\ will simply do the hard wrap without the dialog
coming up (yeah, but I didn't know it, so someone else maybe didn't
either).
--
Look, that's why there's rules, understand? So that you *think* before
you break 'em.
--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <***@barebones.com>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to: <bbedit-talk-***@barebones.com>
Dennis
2008-03-20 23:11:15 UTC
Permalink
Post by ***@Gmail
So, if I could figure out a fast way to select only the body of the
message, I could use the Hard Wrap command.
You could do this with an AppleScripted Grep search using the "extend
selection:true" property. First find the point where the body begins,
then perform a second search to extend the selection to the point
where the body ends. Then apply the hard wrap via AppleScript as well,
and the whole thing can be done with a single key combination.

-Dennis
--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <***@barebones.com>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to: <bbedit-talk-***@barebones.com>
Loading...