Subject: keybindings and "previous word"

From: Mike Miller <[email-masked]>
Date: Thu, 2 Dec 1999 16:25:22 -0600 (CST)

I do love Pine and I don't mean to complain!

Anyway, am I missing something or is there still no way to move back one
word when editing messages in pine?  I asked before for some emacs
keystroke options, but got no reply.

Right now I can go to "Next word" with Ctrl-@, but there is no way to go
back a word.  Is that weird, or is it just me??  :-)  Sometimes I go to
the beginning of the line, then going forward a word at a time!

If you can't do it with Alt-B (a la emacs), why not use Ctrl-# (it's right
next to Ctrl-@)??

Right now, control characters B, F, P, N, A, E, V, D, K (if set
accordingly), L somewhat, and sometimes H (the way I configure emacs), are
compatible in the pine editor with the emacs keybinding standard.  Why not
make Y, U, @, S, and W also compatible, at least for those of us who
select "Enable emacs key bindings" or somesuch?

CURSOR MOTION KEYS                     |EDITING KEYS
  ^B (Left Arrow)   Back character     | ^D       Delete current character
  ^F (Right Arrow)  Forward character  | ^H (DEL) Delete previous character
  ^P (Up Arrow)     Previous line      | ^^       Set a mark
  ^N (Down Arrow)   Next line          | ^K       Cut marked text or
  ^A                Beginning of line  |           delete current line
  ^E                End of line        | ^U       Paste text, undelete lines
  ^Y                Previous page      |           cut with ^K, or unjustify
  ^V                Next page          |-------------------------------------
  ^@ (Ctrl-SPACE)   Next word          |SCREEN/COMPOSITION COMMANDS
---------------------------------------| ^W       Whereis (search for string)
MESSAGE COMMANDS | GENERAL COMMANDS    | ^T       Spell checker
 ^C   Cancel     |  ^G    Get help     | ^J       Justify paragraph
 ^O   Postpone   |  ^Z    Suspend      | ^L       Redraw Screen
 ^X   Send       |  ^_    Alt. editor  | ^R       Read in a file

Regards,

Mike

-- 
Michael B. Miller, M.S., Ph.D., M.P.E.
Department of Psychology
210 McAlester Hall
University of Missouri--Columbia
Columbia, MO 65211

 Phone: (573) 882-5671
   Fax: (573) 882-7710
e-mail: [email-masked]
   web: http://taxa.psyc.missouri.edu/~mbmiller/

-- 
-----------------------------------------------------------------
 For information about this mailing list, and its archives, see: 
 http://www.washington.edu/pine/pine-info/
-----------------------------------------------------------------

---

From: [email-masked]
Date: Thu, 2 Dec 1999 14:39:10 -0800 (PST)

>If you can't do it with Alt-B (a la emacs), why not use Ctrl-# (it's right

Unless I'm missing something obvious, there's no such character as control-#.
Only control-@ and ^^ exist.

---

From: Mike Miller <[email-masked]>
Date: Thu, 2 Dec 1999 17:12:47 -0600 (CST)

> Only control-@ and ^^ exist.

Oh.  Well, I guess we can't do it with Ctrl-# then!  How about Ctrl-Q?  
That's right next to Ctrl-@ and it isn't being used.

Mike

-- 
Michael B. Miller
University of Missouri--Columbia
http://taxa.psyc.missouri.edu/~mbmiller/

---

From: Seth Kurtzberg <[email-masked]>
Date: Thu, 2 Dec 1999 16:19:39 -0700 (MST)

There certainly is a character control-#.  You press shift and control and
3 all at the same time.

I have a feeling that isn't what you really meant.

Seth Kurtzberg
Machine Independent Software
Cell (602) 478-5511
Fax: (480) 614-8909
email:  [email-masked]
pager:  888-605-9296 or email [email-masked]

---

From: Scott Leibrand <[email-masked]>
Date: Thu, 2 Dec 1999 15:30:25 -0800 (PST)

> That's right next to Ctrl-@ and it isn't being used.

^Q is a "start" character.  See the preserve-start-stop-characters (or
whatever it's called) in Pine's Setup, Config.

I don't know what the difference is, but I always use Ctrl-Space to
advance one word.  It'd be nice to have a command to go back one word,
though.  I always end up doing ^A followed by lots of ^-space's.

-- 
Scott Leibrand
[email-masked]
http://students.washington.edu/leibrand
* RCW 19.190 notice: This email address is located in Washington State. *
* Unsolicited commercial email may be billed $500 per message.          *

---

From: Bob Rasmussen <[email-masked]>
Date: Thu, 2 Dec 1999 16:24:23 -0800 (PST)

> I have a feeling that isn't what you really meant.

That would be a key combination, but not a character. Characters are 8-bit
entities (except in the Far East) that can be sent over communication links.
The "control characters" are hex 00 through hex 1F. Most of these are thought
of as control+letter; for instance control-A is "A" (hex 41) minus hex 40,
yielding hex 01. This works up through control-Z = hex 1A.

Other combinations:

Hex   Key combination
---------------------
00    Ctrl-@ or ctrl-space, depending on the program managing the keyboard
...
1B    Ctrl-[ or Escape
1C    Ctrl-\
1D    Ctrl-]
1E    Ctrl-^
1F    Ctrl-underline

Many key combinations have no standard character associated with them, such as
PageUp, F4, etc.

-- 
Regards,
....Bob Rasmussen,   President,   Rasmussen Software, Inc.

personal e-mail: [email-masked]
 company e-mail: [email-masked] or [email-masked] or [email-masked]
 ftp://ftp.anzio.com               voice: 503-624-0360
http://www.anzio.com                 fax: 503-624-0760

---

From: Seth Kurtzberg <[email-masked]>
Date: Thu, 2 Dec 1999 17:33:27 -0700 (MST)

The point I was making is that the ASCII code says absolutely nothing
about key combinations, and the assignment of a key combination to an
ASCII code is completely arbitrary.  ESC is an ASCII code, by the typical
key combination (as you noted, often control-[) is not part of the code at
all.

Seth Kurtzberg

---

From: "Eduardo Chappa L." <[email-masked]>
Date: Thu, 2 Dec 1999 18:36:15 -0800 (PST)

*** Mike Miller ([email-masked]) wrote today:

:) Why not make Y, U, @, S, and W also compatible, at least for those
:) of us who select "Enable emacs key bindings" or somesuch?
:) 

Well, you have a difficult opposition here. According to the source code,
there is no way (and won't be implemented) to associate arbitrary keys
with functions. So you are out of luck here.

  What I think it could be useful is to duplicate a key, kind of what like
Emacs does with ^X. ^X does not mean anything by itself, but in
combination with other keys it does. It should be possible to agree in one
key which serves the purpose of ^X in emacs but for pico/pine. I suggested
to do this with ^J, thinking of ^J as "do this to the paragraph", but it
may be thought of many other ways (you can see a patch I wrote in the
address below), no success until today, but certainly that would be a way
to get all these features that people need sometimes, and that sometimes
you can't live without. Since Pine's philosophy is not to change anything
unless the user request it explicitly, this should be configurable, but
that's again not difficult to do.

  I think that adapting the source code to the needs of very advanced
users is a big task. Some features may not come out if this does not
happen, at least that is what I see from reading the source code.

Eduardo
http://www.math.washington.edu/~chappa/pine/

---

From: David Collantes <[email-masked]>
Date: Fri, 3 Dec 1999 12:17:06 -0500 (EST)

I have a question/request. Let me explain the situation first.

I use procmail (like, probably, a lot of people here) to filter my emails
and save then in diferent "folders". On of my recipies, for example, would
be:

	:0
	* ^From .*domain.com
	$HOME/mail/domain

I do not use "[ ] enable incoming folders", since I do only have one
account. Now, to check wether I have new mail or not, I have to go to each
and every "folder". Is there any setting that will bold the "folder"
containing new emails? Coulid that be added to a future release,
Development Team?

Thanks in advance.

Cheers,

,----------------------------------.,-----------------------------------.
| David Collantes                  || email: [email-masked]          |
| Senior Systems Administrator,    || phone: (407) 823-3418             |
| Network Operations Manager       || UCFBusiness - UCF, Orlando, FL    |
`----------------------------------'`-----------------------------------'

---

From: Seth Kurtzberg <[email-masked]>
Date: Fri, 3 Dec 1999 10:40:15 -0700 (MST)

This isn't really an answer, but I use a utility called "fetchmail" to
gather up mail from a variety of places and put them in a single folder.
Fetchmail has an option to **not** remove the data from the mailbox, so
you might be able to set it up to do something similar to what you want.

Seth Kurtzberg

---

From: Nancy this-address-is-valid McGough <[email-masked]>
Date: Fri, 3 Dec 1999 13:03:35 -0500 (EST)

> and save then in diferent "folders". On of my recipies, for example, would

You probably want to use a lockfile in the above recipe, i.e.,
the first line should be:

 :0:

I've got lots of procmail info at the first URL in my sig.

> account. 

But you do have more than one incoming folder so setting
incoming-folders like this:

 incoming-folders={your.server/user=username}mail/domain1,
	{your.server/user=username}mail/domain2,
	etc.

And then using TAB to move through you incoming-folders with new
messages would probably be useful to you.

> Now, to check wether I have new mail or not, I have to go to each
> containing new emails? 

Yes, while viewing your folder list screen type:

 ; P N CR

Folders with new messages will be bolded.  You might want to set
auto-zoom-after-select.

HTH,
Nancy 

-- 
For Procmail info, see www.ii.com/internet/robots/procmail/qs/
For Pine links, see http://www.ii.com/internet/messaging/pine/
 
©Nancy McGough         http://www.ii.com/         Infinite Ink
--= Sent via PINE 4.21: Internet News & Email for Win/Unix =--

---

From: Mike Miller <[email-masked]>
Date: Fri, 3 Dec 1999 12:11:38 -0600 (CST)

On Fri, 3 Dec 1999, David Collantes wrote:

> and save then in diferent "folders".
<snip> 
> I do not use "[ ] enable incoming folders", since I do only have one

Well, I think that's your mistake right there.  I have one account, but I
have about 10 incoming folders.  Read up on it in the Pine documentation.
You can set up nicknames for folders.  I give the incoming folders names
that begin with "IN.", for example, IN.pine.  Then I save read messages in
a folder without the "IN." in it, for example, pine.  But I have a
nickname for the incoming folder so that IN.pine is displayed as if it had
the name 'pine' without the "IN." on it.  This is not confusing because
the incoming folders are stored in a different folder list.  Having the
same name makes it easy:  I have an Incoming 'pine' folder and a Mail
'pine' folder.

I also use a script (appended below) to tell me what new mail I have.  It
tells me what messages are in my Inbox folder (~/mail/inbox) and how many
messages are in each of my other incoming mail folders.  I run this script
as part of my .login file, but I also run it from the command line.  I
think if you keep your mail in ~/mail, have an inbox named ~/mail/inbox,
and have other incoming folders named ~/mail/IN.*, this scirpt will work
without alteration except for one thing:  the script uses tcsh and you
have to have the correct path to tcsh in the first line.  On Linux
machines it is often /usr/bin/tcsh instead of /usr/local/bin/tcsh.

Note that the use of "tail +13" in the script is to avoid the first 12
lines of the Pine folder which contain the "Mail System Internal Data"
information.

Mike

--------------------------------------------------------------------------

#!/usr/local/bin/tcsh -f
if ( `wc ~/mail/inbox | awk '{print $1}'` == 12 ) then
    echo ""
    echo "No mail in Inbox"
else
    echo ""
    tail +13 ~/mail/inbox | egrep '^From ' | wc | awk '{print "Listing of "$1" messages in your inbox:"}'
    echo ""
    foreach item ( `tail +13 ~/mail/inbox | egrep -n '^From ' | awk -F: '{print $1 + 12}'` )
        tail +$item ~/mail/inbox | egrep '^From: ' | head -1
	tail +$item ~/mail/inbox | egrep '^From: |^Subject: ' | tail +2 | head -1 | egrep -v '^From: '
        echo ""
    end
endif
echo ""
echo "Messages in other inboxes:"
echo ""
foreach file ( `ls -1 ~/mail/IN.* | awk -F. '{print $NF}'` )
    echo "$file `tail +13 ~/mail/IN.$file | egrep '^From ' | wc`" | awk '{print $1" has "$2" messages"}' | grep -v ' 0 '
end
echo ""

---

From: Seth Kurtzberg <[email-masked]>
Date: Fri, 3 Dec 1999 11:19:58 -0700 (MST)

Your method is definitely better for Pine.  I use fetchmail because the
mailboxes are on different hosts.  I don't think Pine will handle that.
Am I wrong?

Seth Kurtzberg

---

From: Mike Miller <[email-masked]>
Date: Fri, 3 Dec 1999 12:30:09 -0600 (CST)

> mailboxes are on different hosts.  I don't think Pine will handle that.

Well my script only works on local files, but Pine can handle incoming
mail on different hosts.  See Nancy's last message or look at the
documentation for handling multiple incoming folders.  I've used it here
on our campus and it worked great.  Using tab to jump to the next folder
with new mail, when I got to a remote folder, I only had to enter a
password then pine would check for incoming mail on the remote host, it
would open the folder if there was new mail, or skip to the next folder if
there was no new mail.  It's *just* like the mail is on your machine,
totally transparent, except for the password (you want it that way, of
course!).

Maybe fetchmail is a better solution, I don't know, but you still want to
put the mail fetched from different hosts into different incoming folders,
right?  So you can still pine's multiple-incoming-folders feature with
fetchmail.

Mike

---

From: Seth Kurtzberg <[email-masked]>
Date: Fri, 3 Dec 1999 11:40:15 -0700 (MST)

Thanks, I'll try it.

Seth Kurtzberg

---

From: "Eduardo Chappa L." <[email-masked]>
Date: Fri, 3 Dec 1999 10:49:58 -0800 (PST)

Dear Mike,

  You can have pine checking automatically for new mail in your incoming
folders. I wrote a patch that does that in any subset of the collection of
incoming folder. Check it out in the address below. All comments are
appreciated.

Eduardo

---

From: Mike Miller <[email-masked]>
Date: Fri, 3 Dec 1999 13:41:45 -0600 (CST)

> http://www.math.washington.edu/~chappa/pine/

Eduardo--

That looks like a great addition to pine.  I won't use it though because I
have so much mail coming in from mailing lists that I don't want to hear
the bell dinging five times per minute.  But if my situation were
different, I'd definitely use it.  I hope they add it to pine as an
option.

Mike

---

From: [email-masked]
Date: Fri, 3 Dec 1999 12:04:08 -0800 (PST)

>the bell dinging five times per minute.  But if my situation were

Look at:
quell-status-message-beeping:

It's your friend.

---

From: Mike Miller <[email-masked]>
Date: Fri, 3 Dec 1999 14:18:19 -0600 (CST)

> quell-status-message-beeping:

Thanks, but I like having it ding when a new message enters Inbox, but I
don't like it to ding when a new message enters another Incoming Folder.  
So I have what I want now.  Selecting "quell" would turn off all beeping.

Regards,

Mike

---

From: Seth Kurtzberg <[email-masked]>
Date: Fri, 3 Dec 1999 13:31:02 -0700 (MST)

I accidentally erase the email send by, I believe, Eduardo about his
pine extension.  Would you please resent that message?

Thanks,

Seth Kurtzberg

---

From: Mike Miller <[email-masked]>
Date: Sat, 4 Dec 1999 11:55:09 -0600 (CST)

I sent a script to the list yesterday that can be used to check incoming
mail folders.  For me it was a little tricky to figure out how to make the
script show 'From:' and 'Subject:' fields for messages in the inbox.  To
grab Subject lines, I wrote the following line of code:

That worked pretty well as long as the 'Subject:' line followed (and did
not precede) the 'From:' line in every message.  Unfortunately, 'Subject:'
lines sometimes precede 'From:' lines, and when they do, the script will
not display the 'Subject:' line.  So I rewrote that one line of code as
follows:

tail +$item ~/mail/inbox | egrep '^From |^From: |^Subject: ' | head -3 | egrep '^Subject: '

This can only fail if a message has no true 'Subject:' line, but it has a
line beginning with 'Subject: ' in the message body.  This can happen
(e.g., if a message with a Subject is forwarded within a message that
doesn't have a Subject), but it won't be a common problem.

The full revised script is appended.  Let me know if you have any
suggestions for improvement.

Regards,

Mike

#!/usr/local/bin/tcsh -f
	tail +$item ~/mail/inbox | egrep '^From: |^Subject: ' | head -2 | egrep '^Subject: '

---

From: "David A. Desrosiers" <[email-masked]>
Date: Sat, 4 Dec 1999 13:14:53 -0500 (EST)

I actually prefer the more strict regex as follows: 

if ($line =~ /^From \S+ \w{3} \w{3} [ \d]\d \d{2}:\d{2}:\d{2} \d{4}/) {
	do something;
}

+-----------------------------------------------------------+
|  David A. Desrosiers             *calloc(1,sizeof(geek))  |
|  [email-masked]       http://www.gnu-designs.com  |
|  void main (void) { if (windows=="useful") hell=frozen }  |
|  PGP: 80F8 7FFF 8329 292F 2696  E354 3D9E 2800 5B8D ABC1  |
+-----------------------------------------------------------+

---

From: Mike Miller <[email-masked]>
Date: Sun, 5 Dec 1999 22:59:50 -0600 (CST)

On Thu, 2 Dec 1999, Eduardo Chappa L. wrote:

> Well, you have a difficult opposition here. According to the source
> code, there is no way (and won't be implemented) to associate
> arbitrary keys with functions. So you are out of luck here.

I guess you mean that major changes to the code would have to be made.  
Maybe you mean that there comments in the code stating that this will
never be implemented.  OK, maybe I'll never have it.  Maybe it's just too
tricky to make changes in some of the key bindings because it messes up
other ones.

> happen, at least that is what I see from reading the source code.

How hard would it be for me to change the source code so that, while I'm
editing text in pine, ^Y does what ^U used to do, Meta-V does what ^Y used
to do, Meta-F does what ^@ (or Ctrl-space) used to do, and Meta-B does
"previous word."  Maybe the "previous word" functionality would be hard to
add, but can't I change some of the others by changing a few lines of code
somewhere?

Thanks for your comments,

Mike

---

From: "Eduardo Chappa L." <[email-masked]>
Date: Mon, 6 Dec 1999 08:56:24 -0800 (PST)

Hello Mike,

Pico can be modified in several ways to do new (fixed) key-binding. There
are two files which you'll have to take a look at: pico/ebind.h and
pico/basic.c

In pico/ebind.h you will find the binding of keys and functions, eg:

        {CTRL|'A',              gotobol}

gotobol is a function (GOTO the Beginning Of the current Line), which you
will find in pico/basic.c. This is one way to hack the code to redefine
key functions. You can create your own functions. See basic.c to see what
are the parameters of the function. Pico and Pine are very well written,
so you should not have problems in finding the funtions that you need to
use in order to implement any functionality you like. I was thinking of
implementing the previous word function, but I guess I have to figure out
a key binding first. It's kind of tricky...

The above described way is my recommended way to add new/different
functionality for keys. Notice that keys are defined twice in this way in
ebind.h, that is because the funtionality of keys is different in pico and
pine (look at the definition of CTRL|'C').

If you want examples of how I have changed functionality of keys, look at
the patch for "delete paragraphs" in my web page (address below).

On the other hand, take a look at the file pico/main.c, you can also
change keybinding by changing code before the line execute_cmd in the
module main. This is only useful is you want to remap CTRL|'A' to be
CTRL|'E' or so, but I guess it is easier to hack pico/ebind.h (look at
my patch for actualized status line)

I do not recall where the key-binding of the function keys is, I can find
it if you are interested.

I hope this helps. Contact me if you think I can be of any help.

Eduardo

---

From: "Eduardo Chappa L." <[email-masked]>
Date: Mon, 6 Dec 1999 09:11:58 -0800 (PST)

*** Mike Miller ([email-masked]) wrote on Dec 3, 1999:
:) 
:) Eduardo--
:) 
:) That looks like a great addition to pine.  I won't use it though because I
:) have so much mail coming in from mailing lists that I don't want to hear
:) the bell dinging five times per minute.  But if my situation were
:) different, I'd definitely use it.  I hope they add it to pine as an
:) option.
:) 

Thanks Mike for your comment, The patch actually only notifies you when
there is new mail in a folder, not when new mail arrives to it. Here is
the way the patch works. Say you have new mail in folder1, then you would
get a message saying:

   [You have new mail in "folder1"]

and a beep would sound. Say you ignore this message and don't read your
new mail in folder1, and you receive a new message in folder1, then you
won't get a message about it, because you already received a message about
it before. I do not think it would be difficult to implement a message
every time a new message is received, but as you point out, sometimes this
would be more annoying than helpful. 

  Now say you did not read the new message in folder1 and receive a new
message in folder2, then you would receive the message:

  [You have new mail in "folder1" and "folder2"]

and a beep would sound. It is easy to implement a configuration option
that won't make the beep sound on arrival of new messages, if this is all
you care (I'll add that to the patch, it seems to me a good sugegstion).

  On the other hand the patch includes a key-binding for CTRL|'H', to
check for new mail in incoming folders other than INBOX, which would send
you either a message like the one above or "no new message in incoming
folders". Also if the message is too long to be displayed in the status
line a generic message warning you about existence of new mail will be
sent to you.

  I'll add the feature that you requested to the patch, if yo are
interested I will let you knwo when I have it ready. Thanks again for your
comments and all feedback, bugs reports, suggestions,etc are appreciated,

Eduardo