diff options
-rw-r--r-- | aerc.go | 2 | ||||
-rw-r--r-- | config/config.go | 10 |
2 files changed, 7 insertions, 5 deletions
@@ -158,7 +158,7 @@ func main() { logger = log.New(logOut, "", log.LstdFlags) logger.Println("Starting up aerc") - conf, err := config.LoadConfigFromFile(nil, ShareDir) + conf, err := config.LoadConfigFromFile(nil, ShareDir, logger) if err != nil { fmt.Fprintf(os.Stderr, "Failed to load config: %v\n", err) os.Exit(1) diff --git a/config/config.go b/config/config.go index 2e1d5893..374fd5c7 100644 --- a/config/config.go +++ b/config/config.go @@ -4,6 +4,7 @@ import ( "errors" "fmt" "io/ioutil" + "log" "net/url" "os" "os/exec" @@ -502,7 +503,7 @@ func validateBorderChars(section *ini.Section, config *UIConfig) error { return nil } -func LoadConfigFromFile(root *string, sharedir string) (*AercConfig, error) { +func LoadConfigFromFile(root *string, sharedir string, logger *log.Logger) (*AercConfig, error) { if root == nil { _root := path.Join(xdg.ConfigHome(), "aerc") root = &_root @@ -661,7 +662,7 @@ func LoadConfigFromFile(root *string, sharedir string) (*AercConfig, error) { } if baseOnly { - err = config.LoadBinds(binds, baseSectionName, group) + err = config.LoadBinds(binds, baseSectionName, group, logger) if err != nil { return nil, err } @@ -711,7 +712,7 @@ func LoadBindingSection(sec *ini.Section) (*KeyBindings, error) { return bindings, nil } -func (config *AercConfig) LoadBinds(binds *ini.File, baseName string, baseGroup **KeyBindings) error { +func (config *AercConfig) LoadBinds(binds *ini.File, baseName string, baseGroup **KeyBindings, logger *log.Logger) error { if sec, err := binds.GetSection(baseName); err == nil { binds, err := LoadBindingSection(sec) @@ -766,7 +767,8 @@ func (config *AercConfig) LoadBinds(binds *ini.File, baseName string, baseGroup } } if !valid { - return fmt.Errorf("Invalid Account Name: %s", acctName) + logger.Printf("Tried to define binds for unexistent account: %v\n", acctName) + continue } contextualBind.ContextType = BIND_CONTEXT_ACCOUNT default: |