summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--Makefile6
-rw-r--r--doc/aerc-tutorial.7.scd143
-rw-r--r--widgets/account-wizard.go22
4 files changed, 170 insertions, 2 deletions
diff --git a/.gitignore b/.gitignore
index 90e1624..426f49a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,3 +5,4 @@ log
 raw.log
 *.1
 *.5
+*.7
diff --git a/Makefile b/Makefile
index 6c9963d..03dd7c3 100644
--- a/Makefile
+++ b/Makefile
@@ -7,11 +7,15 @@ aerc:
 %.5: doc/%.5.scd
 	scdoc < $< > $@
 
+%.7: doc/%.7.scd
+	scdoc < $< > $@
+
 DOCS := \
 	aerc.1 \
 	aerc-config.5 \
 	aerc-imap.5 \
-	aerc-smtp.5
+	aerc-smtp.5 \
+	aerc-tutorial.7
 
 all: aerc $(DOCS)
 
diff --git a/doc/aerc-tutorial.7.scd b/doc/aerc-tutorial.7.scd
new file mode 100644
index 0000000..793e025
--- /dev/null
+++ b/doc/aerc-tutorial.7.scd
@@ -0,0 +1,143 @@
+aerc-tutorial(7)
+
+# NAME
+
+aerc - the world's best email client
+
+# INTRODUCTION
+
+Welcome to aerc! This tutorial will guide you through your first steps in using
+the client. This tutorial is a man page - you can read it again later with
+*:help tutorial* from aerc, or *man aerc-tutorial* from your terminal.
+
+First, let's introduce some basic keybindings. For convention, we'll use *<C-p>*
+to represent Ctrl+p, which matches the convention used for writing keybindings
+for aerc.
+
+*C-n*
+	Cycles to the next tab
+
+*C-p*
+	Cycles to the previous tab
+
+Try using these now to switch between your message list and the tutorial. In
+your message list, we use vim-style keys to get around.
+
+*k*, *j*
+	Scrolls up and down between messages
+
+*<C-u>*, *<C-d>*
+	Scrolls half a page up or down
+
+*g*, *G*
+	Selects the first or last message, respectively
+
+*K*, *J*
+	Switches between folders in the sidebar
+
+*<Enter>*
+	Opens the selected message
+
+# THE MESSAGE VIEWER
+
+Press *<Enter>* to open a message. By default, the message viewer will display
+your message using *less*(1). This should also have familiar, vim-like
+keybindings for scrolling around in your message.
+
+Multipart messages (messages with attachments, or messages with several
+alternative formats) show a part selector on the bottom of the message viewer.
+
+*<C-k>*, *<C-j>*
+	Cycle between parts of a multipart message
+
+*q*
+	Close the message viewer
+
+# COMPOSING MESSAGES
+
+Return to the message list by pressing *q* to dismiss the message viewer. Once
+there, let's compose a message.
+
+*C*
+	Compose a new message
+
+*rr*
+	Reply to a message
+
+*rq*
+	Reply to a message, and pre-fill the editor with a quoted version of the
+	message being replied to
+
+*Rr*
+	Reply-all to a message
+
+*Rq*
+	Reply-all to a message, and pre-fill the editor with a quoted version of the
+	message being replied to
+
+For now, let's use *C* to compose a new message. The message composer will
+appear. You should see To, From, and Subject lines, as well as your *$EDITOR*.
+You can use *<Tab>* or *<C-j>* and *<C-k>* to cycle between these fields (tab
+won't cycle between fields once you enter the editor, but *<C-j>* and *<C-k>*
+will).
+
+Let's send an email to yourself. Note that the To and From headers only accept
+RFC 5322 addresses, e.g. *John Doe <john@example.org>*, or simply
+*<john@example.org>*. Go ahead and fill out an email (to yourself, perhaps?),
+then close the editor.
+
+The message review screen is shown next. You have a chance now to revise the
+email before it's sent. Press *y* to send the email if it looks good.
+
+# USING THE TERMINAL
+
+aerc comes with an embedded terminal, which you've already used to view and edit
+emails. We can also use this for other purposes, such as referencing a git
+repository while reviewing a patch. From the message list, we can use the
+following keybindings to open a terminal:
+
+*<C-t>*
+	Opens a new terminal tab, running your shell
+
+*$*, *!*
+	Prompts for a command to run, then opens a new terminal tab running that
+	command
+
+*|*
+	Prompts for a command to run, then pipes the selected email into that
+	command and displays the result on a new terminal tab
+
+Try pressing *$* and entering "top". You can also use the *:cd* command to
+change aerc's working directory, and the directory in which new terminals run.
+Use *:pwd* to see it again if you're not sure where you are.
+
+# ADDITIONAL NOTES
+
+## COMMANDS
+
+Every keybinding is ultimately bound to an aerc command. You can also summon the
+command line by pressing ':', then entering one of these commands. See *aerc*(1)
+or *:help* for a full list of commands.
+
+## MESSAGE FILTERS
+
+When displaying messages in the message viewer, aerc will pipe them through a
+_message filter_ first. This allows you to decode messages in non-plaintext
+formats, add syntax highlighting, etc. aerc ships with a few default filters:
+
+- Emails which begin with "[PATCH" will be piped into a filter for rendering
+  git-format-patch and hg export emails.
+- text/html is rendered with w3m in a network sandbox
+- text/\* is rendered with a simple filter for coloring quoted text
+
+## CUSTOMIZING AERC
+
+Aerc is highly customizable. Review *aerc-config*(5) (or use *:help config*) to
+learn more about how to add custom keybindings, install new message filters,
+change its appearance and behavior, and so on.
+
+# AUTHORS
+
+Maintained by Drew DeVault <sir@cmpwn.com>, who is assisted by other open
+source contributors. For more information about aerc development, see
+https://git.sr.ht/~sircmpwn/aerc.
diff --git a/widgets/account-wizard.go b/widgets/account-wizard.go
index 7ed9a62..aa68ed7 100644
--- a/widgets/account-wizard.go
+++ b/widgets/account-wizard.go
@@ -5,6 +5,7 @@ import (
 	"fmt"
 	"net/url"
 	"os"
+	"os/exec"
 	"path"
 	"strings"
 	"time"
@@ -451,6 +452,7 @@ func (wizard *AccountWizard) finish(tutorial bool) {
 	sec, _ = file.NewSection(wizard.accountName.String())
 	sec.NewKey("source", wizard.imapUrl.String())
 	sec.NewKey("outgoing", wizard.smtpUrl.String())
+	sec.NewKey("default", "INBOX")
 	if wizard.smtpMode == SMTP_STARTTLS {
 		sec.NewKey("smtp-starttls", "yes")
 	}
@@ -472,6 +474,7 @@ func (wizard *AccountWizard) finish(tutorial bool) {
 
 	account := config.AccountConfig{
 		Name:     sec.Name(),
+		Default:  "INBOX",
 		From:     sec.Key("from").String(),
 		Source:   sec.Key("source").String(),
 		Outgoing: sec.Key("outgoing").String(),
@@ -492,7 +495,24 @@ func (wizard *AccountWizard) finish(tutorial bool) {
 	wizard.aerc.NewTab(view, account.Name)
 
 	if tutorial {
-		// TODO: Open tutorial
+		name := "aerc-tutorial"
+		if _, err := os.Stat("./aerc-tutorial.7"); !os.IsNotExist(err) {
+			// For development
+			name = "./aerc-tutorial.7"
+		}
+		term, err := NewTerminal(exec.Command("man", name))
+		if err != nil {
+			wizard.errorFor(nil, err)
+			return
+		}
+		wizard.aerc.NewTab(term, "Tutorial")
+		term.OnClose = func(err error) {
+			wizard.aerc.RemoveTab(term)
+			if err != nil {
+				wizard.aerc.PushStatus(" "+err.Error(), 10*time.Second).
+					Color(tcell.ColorDefault, tcell.ColorRed)
+			}
+		}
 	}
 
 	wizard.aerc.RemoveTab(wizard)
>482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707