about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--.emacs.d/lisp/init-completion.el6
1 files changed, 6 insertions, 0 deletions
diff --git a/.emacs.d/lisp/init-completion.el b/.emacs.d/lisp/init-completion.el
index 862ee71..4c42716 100644
--- a/.emacs.d/lisp/init-completion.el
+++ b/.emacs.d/lisp/init-completion.el
@@ -39,6 +39,12 @@
   :diminish
   :config
   (global-fancy-dabbrev-mode)
+  (defun fancy-dabbrev-popup-advice (_next)
+    (local-set-key (kbd "C-M-/") #'fancy-dabbrev-backward))
+  (defun fancy-dabbrev-popup-exit-advice ()
+    (local-unset-key (kbd "C-M-/")))
+  (advice-add #'fancy-dabbrev--expand-again :before #'fancy-dabbrev-popup-advice)
+  (advice-add #'fancy-dabbrev--on-exit :after #'fancy-dabbrev-popup-exit-advice)
   :bind ("M-/" . fancy-dabbrev-expand))
 
 (use-package emacs
ommands.go?h=0.4.0&id=b60999c39e11bf4d1e236f2b10a2f895b44d23fb'>b60999c ^
8126d82 ^
b60999c ^
8126d82 ^




















b60999c ^

8126d82 ^
d394fd1 ^






8126d82 ^
d394fd1 ^
b60999c ^
8126d82 ^
b60999c ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50




                

                                 
                                          

 
                                                              
 
                                    
 




















                                                              

 
                                                                            






                                                        
                                               
                                     
         
                                     
 
package commands

import (
	"errors"

	"github.com/google/shlex"

	"git.sr.ht/~sircmpwn/aerc/widgets"
)

type AercCommand func(aerc *widgets.Aerc, args []string) error

type Commands map[string]AercCommand

func NewCommands() *Commands {
	cmds := Commands(make(map[string]AercCommand))
	return &cmds
}

func (cmds *Commands) dict() map[string]AercCommand {
	return map[string]AercCommand(*cmds)
}

func (cmds *Commands) Register(name string, cmd AercCommand) {
	cmds.dict()[name] = cmd
}

type NoSuchCommand string

func (err NoSuchCommand) Error() string {
	return "Unknown command " + string(err)
}

type CommandSource interface {
	Commands() *Commands
}

func (cmds *Commands) ExecuteCommand(aerc *widgets.Aerc, cmd string) error {
	args, err := shlex.Split(cmd)
	if err != nil {
		return err
	}
	if len(args) == 0 {
		return errors.New("Expected a command.")
	}
	if fn, ok := cmds.dict()[args[0]]; ok {
		return fn(aerc, args)
	}
	return NoSuchCommand(args[0])
}