KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
in emacs in haskell-mode, I wanted to change the command "C-x C-s" to "C-x C-s" followed by "C-c C-l". Taking a cue from : Haskell.org : Emacs/Keybindings and simple usage I tried inserting the following variants into the .emacs file but they did not work. Any suggestions as to how I might go about implementing the functionality above would be most welcomed! Thanks. Variant 1 (defun haskell-hook () (define-key haskell-mode-map (kbd "C-x C-s") (kbd "C-x C-s C-c C-l")) (add-hook 'haskell-mode-hook 'haskell-hook) Variant 2 (defun haskell-hook () (define-key haskell-mode-map (kbd "C-x C-s") 'my-haskell-mode-save-buffer) (defun my-haskell-mode-save-buffer () (interactive) (execute-kbd-macro [?\C-s ?\C-x ?\C-c ?\C-l return])) (add-hook 'haskell-mode-hook 'haskell-hook) [EDIT 1] @Tikhon Jelvis : that was definitely a good learning exercise! Thanks. Using the methods outlined in your post I changed your function to : (defun my-haskell-mode-save-buffer () (interactive) (save-buffer) (inferior-haskell-load-file) (other-window 1)) where the last line programmatically switches the cursor to the interactive window. Thank you. [EDIT2] Other variants include : (defun my-haskell-mode-save-buffer () (interactive) (execute-kbd-macro (read-kbd-macro "C-c C-l")) (other-window 1)) and : (defun my-haskell-mode-save-buffer () (interactive) (execute-kbd-macro [?\C-c ?\C-l]) (other-window 1))
Tags (comma-separated)
Save Edits
Cancel