summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Roessler <roessler@does-not-exist.org>1999-08-31 19:11:53 +0000
committerThomas Roessler <roessler@does-not-exist.org>1999-08-31 19:11:53 +0000
commitd0656b2b38fedc0780dc53f3d42c5b4dbc96fa97 (patch)
treeca76aff18d495d6b20cc63e88f33d24980d448b3
parent018280d472ff629e6fd9f98ebbbe4cd1b934df38 (diff)
Adding a <parent-message> function. From Roland Rosenfeld
<roland@spinnaker.rhein.de>.
-rw-r--r--OPS1
-rw-r--r--curs_main.c17
-rw-r--r--doc/manual.sgml.head1
-rw-r--r--doc/manual.sgml.tail2
-rw-r--r--functions.h4
-rw-r--r--protos.h1
-rw-r--r--thread.c24
7 files changed, 48 insertions, 2 deletions
diff --git a/OPS b/OPS
index 23a60fee..997488c8 100644
--- a/OPS
+++ b/OPS
@@ -98,6 +98,7 @@ OP_MAIN_NEXT_SUBTHREAD "jump to the next subthread"
OP_MAIN_NEXT_THREAD "jump to the next thread"
OP_MAIN_NEXT_UNDELETED "move to the next undeleted message"
OP_MAIN_NEXT_UNREAD "jump to the next unread message"
+OP_MAIN_PARENT_MESSAGE "jump to parent message in thread"
OP_MAIN_PREV_THREAD "jump to previous thread"
OP_MAIN_PREV_SUBTHREAD "jump to previous subthread"
OP_MAIN_PREV_UNDELETED "move to the last undelete message"
diff --git a/curs_main.c b/curs_main.c
index fcf83640..9f26a0f8 100644
--- a/curs_main.c
+++ b/curs_main.c
@@ -1310,6 +1310,23 @@ int mutt_index_menu (void)
menu->redraw = REDRAW_MOTION;
break;
+ case OP_MAIN_PARENT_MESSAGE:
+
+ CHECK_MSGCOUNT;
+
+ if ((menu->current = mutt_parent_message (Context, CURHDR)) < 0)
+ {
+ menu->current = menu->oldcurrent;
+ }
+ else if (menu->menu == MENU_PAGER)
+ {
+ op = OP_DISPLAY_MESSAGE;
+ continue;
+ }
+ else
+ menu->redraw = REDRAW_MOTION;
+ break;
+
case OP_MAIN_SET_FLAG:
case OP_MAIN_CLEAR_FLAG:
diff --git a/doc/manual.sgml.head b/doc/manual.sgml.head
index 0813a052..0d7ed08a 100644
--- a/doc/manual.sgml.head
+++ b/doc/manual.sgml.head
@@ -304,6 +304,7 @@ ESC r read-subthread mark the current subthread as read
ESC t tag-thread toggle the tag on the current thread
ESC v collapse-thread toggle collapse for the current thread
ESC V collapse-all toggle collapse for all threads
+P parent-message jump to parent message in thread
</verb></tscreen>
<bf/Note:/ Collapsing a thread displays only the first message
diff --git a/doc/manual.sgml.tail b/doc/manual.sgml.tail
index 886d4680..6a177d53 100644
--- a/doc/manual.sgml.tail
+++ b/doc/manual.sgml.tail
@@ -80,6 +80,7 @@ next-subthread ESC n jump to the next subthread
next-thread ^N jump to the next thread
next-undeleted j move to the next undeleted message
next-unread not bound jump to the next unread message
+parent-message P jump to parent message in thread
pipe-message | pipe message/attachment to a shell command
previous-new ESC TAB jump to the previous new message
previous-page Z move to the previous page
@@ -151,6 +152,7 @@ next-subthread ESC n jump to the next subthread
next-thread ^N jump to the next thread
next-undeleted j move to the next undeleted message
next-unread not bound jump to the next unread message
+parent-message P jump to parent message in thread
pipe-message | pipe message/attachment to a shell command
previous-line BackSpace scroll up one line
previous-entry K move to the previous entry
diff --git a/functions.h b/functions.h
index 4b5ec6c3..2056deac 100644
--- a/functions.h
+++ b/functions.h
@@ -127,7 +127,7 @@ struct binding_t OpMain[] = {
{ "previous-new", OP_MAIN_PREV_NEW, "\033\t" },
{ "next-unread", OP_MAIN_NEXT_UNREAD, NULL },
{ "previous-unread", OP_MAIN_PREV_UNREAD, NULL },
-
+ { "parent-message", OP_MAIN_PARENT_MESSAGE, "P" },
#ifdef _PGPPATH
@@ -210,7 +210,7 @@ struct binding_t OpPager[] = {
{ "half-up", OP_HALF_UP, NULL },
{ "half-down", OP_HALF_DOWN, NULL },
{ "previous-line", OP_PREV_LINE, NULL },
-
+ { "parent-message", OP_MAIN_PARENT_MESSAGE, "P" },
diff --git a/protos.h b/protos.h
index 0c921eed..b3aa98a5 100644
--- a/protos.h
+++ b/protos.h
@@ -215,6 +215,7 @@ int mutt_compose_attachment (BODY *a);
int mutt_decode_save_attachment (FILE *, BODY *, char *, int, int);
int mutt_display_message (HEADER *h);
int mutt_edit_attachment(BODY *);
+int mutt_parent_message (CONTEXT *, HEADER *);
int mutt_prepare_edit_message(CONTEXT *, HEADER *, HEADER *);
#define mutt_enter_fname(A,B,C,D,E) _mutt_enter_fname(A,B,C,D,E,0,NULL,NULL)
int _mutt_enter_fname (const char *, char *, size_t, int *, int, int, char ***, int *);
diff --git a/thread.c b/thread.c
index 9b6fdeac..0fdffecc 100644
--- a/thread.c
+++ b/thread.c
@@ -705,6 +705,30 @@ int _mutt_aside_thread (HEADER *hdr, short dir, short subthreads)
return (tmp->virtual);
}
+int mutt_parent_message (CONTEXT *ctx, HEADER *hdr)
+{
+ if ((Sort & SORT_MASK) != SORT_THREADS)
+ {
+ mutt_error _("Threading is not enabled.");
+ return (hdr->virtual);
+ }
+ if (hdr->parent)
+ {
+ while ((hdr = hdr->parent))
+ {
+ if (!ctx->pattern || hdr->limited)
+ return (hdr->virtual);
+ }
+ mutt_error _("Parent message is not visible in limited view");
+ return -1;
+ }
+ else
+ {
+ mutt_error _("Parent message is not available.");
+ return -1;
+ }
+}
+
void mutt_set_virtual (CONTEXT *ctx)
{
int i;