~sircmpwn/aerc

Config for deleting message from message viewer v2 PROPOSED

Rebase? This doesn't apply.
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~sircmpwn/aerc/%3C20190920191551.39195-1-sri%40vathsan.com%3E/mbox | git am -3
Learn more about email & git

[PATCH v2] Config for deleting message from message viewer Export this patch

As suggested in #268, this adds a behaviour setting for
deleting message from message viewer.
---
This fixes the issues raised in the first patch.
Also added an entry for the config into aerc-config.5.scd

 commands/msg/delete.go |  2 +-
 config/aerc.conf.in    |  5 +++++
 config/config.go       | 48 ++++++++++++++++++++++--------------------
 doc/aerc-config.5.scd  |  5 +++++
 4 files changed, 36 insertions(+), 24 deletions(-)

diff --git a/commands/msg/delete.go b/commands/msg/delete.go
index 677ea63c4b94..8fefbd5fcc5d 100644
--- a/commands/msg/delete.go
+++ b/commands/msg/delete.go
@@ -47,7 +47,7 @@ func (Delete) Execute(aerc *widgets.Aerc, args []string) error {
 	store.Next()
 	if isMsgView {
 		nextMsg := store.Selected()
-		if nextMsg == msg {
+		if nextMsg == msg || !aerc.Config().Ui.NextMessageOnDelete {
 			aerc.RemoveTab(widget)
 			acct.Messages().Scroll()
 		} else {
diff --git a/config/aerc.conf.in b/config/aerc.conf.in
index c50b7b931e08..c17d2c0333cd 100644
--- a/config/aerc.conf.in
+++ b/config/aerc.conf.in
@@ -48,6 +48,11 @@ new-message-bell=true
 # Default: %n %>r
 dirlist-format=%n %>r
 
+# Moves to next message when the current message is deleted
+#
+# Default: false
+next-message-on-delete=true
+
 [viewer]
 #
 # Specifies the pager to use when displaying emails. Note that some filters
diff --git a/config/config.go b/config/config.go
index eeaf93702210..baffdb26ffbc 100644
--- a/config/config.go
+++ b/config/config.go
@@ -23,19 +23,20 @@ type GeneralConfig struct {
 }
 
 type UIConfig struct {
-	IndexFormat       string   `ini:"index-format"`
-	TimestampFormat   string   `ini:"timestamp-format"`
-	ShowHeaders       []string `delim:","`
-	RenderAccountTabs string   `ini:"render-account-tabs"`
-	SidebarWidth      int      `ini:"sidebar-width"`
-	PreviewHeight     int      `ini:"preview-height"`
-	EmptyMessage      string   `ini:"empty-message"`
-	EmptyDirlist      string   `ini:"empty-dirlist"`
-	MouseEnabled      bool     `ini:"mouse-enabled"`
-	NewMessageBell    bool     `ini:"new-message-bell"`
-	Spinner           string   `ini:"spinner"`
-	SpinnerDelimiter  string   `ini:"spinner-delimiter"`
-	DirListFormat     string   `ini:"dirlist-format"`
+	IndexFormat         string   `ini:"index-format"`
+	TimestampFormat     string   `ini:"timestamp-format"`
+	ShowHeaders         []string `delim:","`
+	RenderAccountTabs   string   `ini:"render-account-tabs"`
+	SidebarWidth        int      `ini:"sidebar-width"`
+	PreviewHeight       int      `ini:"preview-height"`
+	EmptyMessage        string   `ini:"empty-message"`
+	EmptyDirlist        string   `ini:"empty-dirlist"`
+	MouseEnabled        bool     `ini:"mouse-enabled"`
+	NewMessageBell      bool     `ini:"new-message-bell"`
+	Spinner             string   `ini:"spinner"`
+	SpinnerDelimiter    string   `ini:"spinner-delimiter"`
+	DirListFormat       string   `ini:"dirlist-format"`
+	NextMessageOnDelete bool     `ini:"next-message-on-delete"`
 }
 
 const (
@@ -345,16 +346,17 @@ func LoadConfigFromFile(root *string, sharedir string) (*AercConfig, error) {
 			ShowHeaders: []string{
 				"From", "To", "Cc", "Bcc", "Subject", "Date",
 			},
-			RenderAccountTabs: "auto",
-			SidebarWidth:      20,
-			PreviewHeight:     12,
-			EmptyMessage:      "(no messages)",
-			EmptyDirlist:      "(no folders)",
-			MouseEnabled:      false,
-			NewMessageBell:    true,
-			Spinner:           "[..]    , [..]   ,  [..]  ,   [..] ,    [..],   [..] ,  [..]  , [..]   ",
-			SpinnerDelimiter:  ",",
-			DirListFormat:     "%n %>r",
+			RenderAccountTabs:   "auto",
+			SidebarWidth:        20,
+			PreviewHeight:       12,
+			EmptyMessage:        "(no messages)",
+			EmptyDirlist:        "(no folders)",
+			MouseEnabled:        false,
+			NewMessageBell:      true,
+			Spinner:             "[..]    , [..]   ,  [..]  ,   [..] ,    [..],   [..] ,  [..]  , [..]   ",
+			SpinnerDelimiter:    ",",
+			DirListFormat:       "%n %>r",
+			NextMessageOnDelete: true,
 		},
 
 		Viewer: ViewerConfig{
diff --git a/doc/aerc-config.5.scd b/doc/aerc-config.5.scd
index 91b444a59e56..ba78b9fb6cdf 100644
--- a/doc/aerc-config.5.scd
+++ b/doc/aerc-config.5.scd
@@ -141,6 +141,11 @@ These options are configured in the *[ui]* section of aerc.conf.
 |  %>X
 :  make format specifier 'X' be right justified
 
+*next-message-on-delete*
+	Moves to next message when the current message is deleted
+
+	Default: true
+
 ## VIEWER
 
 These options are configured in the *[viewer]* section of aerc.conf.
-- 
2.23.0
Rebase? This doesn't apply.
View this thread in the archives