aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--commands/eml.go28
-rw-r--r--doc/aerc.1.scd2
-rw-r--r--widgets/msgviewer.go9
3 files changed, 29 insertions, 10 deletions
diff --git a/commands/eml.go b/commands/eml.go
index a88a13b3..45dd4f25 100644
--- a/commands/eml.go
+++ b/commands/eml.go
@@ -49,15 +49,25 @@ func (Eml) Execute(aerc *widgets.Aerc, args []string) error {
})
}
- path := strings.Join(args[1:], " ")
- if _, err := os.Stat(path); err != nil {
- return err
- }
- f, err := os.Open(path)
- if err != nil {
- return err
+ if len(args) == 1 {
+ switch tab := aerc.SelectedTabContent().(type) {
+ case *widgets.MessageViewer:
+ part := tab.SelectedMessagePart()
+ tab.MessageView().FetchBodyPart(part.Index, showEml)
+ default:
+ return fmt.Errorf("unsupported operation")
+ }
+ } else {
+ path := strings.Join(args[1:], " ")
+ if _, err := os.Stat(path); err != nil {
+ return err
+ }
+ f, err := os.Open(path)
+ if err != nil {
+ return err
+ }
+ defer f.Close()
+ showEml(f)
}
- defer f.Close()
- showEml(f)
return nil
}
diff --git a/doc/aerc.1.scd b/doc/aerc.1.scd
index ac6c11a1..2c062816 100644
--- a/doc/aerc.1.scd
+++ b/doc/aerc.1.scd
@@ -85,6 +85,8 @@ These commands work in any context.
*eml* [<path>]
Opens an eml file and displays the message in the message viewer.
+ Can also be used in the message viewer to open an rfc822 attachment.
+
*pwd*
Displays aerc's current working directory in the status bar.
diff --git a/widgets/msgviewer.go b/widgets/msgviewer.go
index 837c0608..19be7473 100644
--- a/widgets/msgviewer.go
+++ b/widgets/msgviewer.go
@@ -727,7 +727,14 @@ func newNoFilterConfigured(pv *PartViewer) *ui.Grid {
var actions []string
- for _, command := range noFilterConfiguredCommands {
+ configured := noFilterConfiguredCommands
+ if strings.Contains(strings.ToLower(pv.part.MIMEType), "message") {
+ configured = append(configured, []string{
+ ":eml<Enter>", "View message attachment",
+ })
+ }
+
+ for _, command := range configured {
cmd := command[0]
name := command[1]
strokes, _ := config.ParseKeyStrokes(cmd)