0

I would like to create a simple key binding (e.g. C-c s e) to spell check the (mu4e) email message I am composing using English (and use other bindings for other languages). I thought I'd simply record a macro, save it and then bind the key to it. However, this doesn't work, probably because at the end of the macro, I should be in an interactive ispell session.

What I did to record the macro was

M-x ( M-x ispell-change-dictionary RET en_GB RET M-x ispell-message x M-x )

I had to press the x to exit the ispell session and be able to end recording using M-x ), but removed this x after saving the macro to my init.el. The lines in that file now looks like

(fset 'ispell-message-en
   (lambda (&optional arg) "Keyboard macro." (interactive "p") (kmacro-exec-ring-item (quote ([escape 120 105 115 112 101 108 108 45 99 104 97 110 103 101 45 100 105 99 116 105 111 110 97 114 121 return 101 110 95 71 66 return escape 120 105 115 112 101 108 108 45 109 101 115 115 97 103 101 return] 0 "%d")) arg)))

When running M-x ispell-message-en I get:

ispell-command-loop: Args out of range: [], 0

I think I understand why this goes wrong (though I'd hoped the macro would just get me to the first misspelled word) but I don't know how to do this properly. So my question is, how can I set up a macro that drops me in an interactive ispell-message session? Or, if that is not possible, how can I otherwise assign the changing of the dictionary to en_GB and starting ispell-message using the keybinding C-c s e?

0

1 Answer 1

2

Maybe something like this:

(defun change-dict-and-ispell () 
   (interactive) 
   (ispell-change-dictionary "en_GB") 
   (ispell-message)) 
(global-set-key (kbd "C-c s e") 'change-dict-and-ispell) 
1
  • A function rather than a macro... sort of makes sense - thanks for removing my blinders!
    – AstroFloyd
    May 28, 2019 at 13:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.