From a8984c0e490cda653615bc0e1d4743ad8fe7a2a7 Mon Sep 17 00:00:00 2001 From: markus schnalke Date: Thu, 21 Apr 2016 16:43:25 +0200 Subject: [PATCH] refile: Never change the current folder Refile is different to all other tools, as its +folder arguments are destination folders, not source folders (it even supports multiple of them). A source folder can be specified with -src. Refile used to change the current folder to the source folder. It does not do so anymore. Most often the current folder is used as the source folder; this is the default. Hence changing the current folder is a no-op. But if one refiles from some other source folder, changing to that folder is seldom useful. Consider the scenario where one wants to collect the last messages of a set of folders in some other folder. The old behavior required to know where you are to collect the messages, because after the first refile you'd be somewhere else: for i in one two three ; do refile -src +$i l +lastmsgs done # now we are in +three, hence go back where we were folder +lastmsgs The new behavior allows to move the messages just here (@), no matter where that is: for i in one two three ; do refile -src +one l @ done # now we still are where we were Refiling actions do no more affect the current folder, hence one may securely refile with different -src +folder many times in one row, without having to care for changing locations. --- man/refile.man1 | 14 +++-- test/tests/refile/test-refile | 135 +++++++++++++++++++++++++++++++++++++++++ uip/refile.c | 1 - 3 files changed, 144 insertions(+), 6 deletions(-) create mode 100755 test/tests/refile/test-refile diff --git a/man/refile.man1 b/man/refile.man1 index a82d1da..b19b1c0 100644 --- a/man/refile.man1 +++ b/man/refile.man1 @@ -119,17 +119,13 @@ folder(1), rmf(1), rmm(1) .SH DEFAULTS .nf -.RB ` "\-src\ +folder" "' defaults to the current folder" +.RB ` "\-src\ \fI+folder\fP" "' defaults to the current folder" .RB ` msgs "' defaults to the current message" .RB ` \-nolink ' .fi .SH CONTEXT If -.B \-src -.I +folder -is given, it will become the current folder. -If .B \-link is specified, the current message in the source folder will be set to the last message specified; otherwise, the @@ -142,3 +138,11 @@ will also define those sequences for the destination folders. See .B mh\-sequence (7) for information concerning the previous sequence. + +.SH HISTORY +Since mmh-0.3, +.B refile +does never change the current folder. +(It used to change it when +.BI \-src\ +folder +was given, but this behavior had usability disadvantages.) diff --git a/test/tests/refile/test-refile b/test/tests/refile/test-refile new file mode 100755 index 0000000..9dd852a --- /dev/null +++ b/test/tests/refile/test-refile @@ -0,0 +1,135 @@ +#!/bin/sh +###################################################### +# +# Test refile +# +###################################################### + +. "$MH_TEST_COMMON" + + +runandcheck "scan +inbox" </dev/null +runandcheck "refile 4 +fol1" </dev/null +runandcheck "refile 6 +fol1 +fol2" </dev/null +runandcheck "refile 8 9 +fol1 +fol2" </dev/null +runandcheck "refile -src +fol1 1 +fol2" <