Emanuel Berg <[email protected]> writes: > Pietro <[email protected]> writes: > >> Alternatively I am thinking of writing a function >> which asks the user for the language the ispell >> function should check for, it does not need to >> accept all the languages and for instance I would be >> more than happy to have something like that : >> >> Mini-buffer says: [Which language ?[e : English, i: >> Italian] > > I still don't like the idea of having this complicated > a thing in a hook; on the other hand, I just realized > that the code I provided isn't compatible with the > hook solution, so it isn't of any help if you are set > on that idea. > > OK, try this, only change the Swedish stuff for > Italian, no? > > (defun message-spell-before-send (lang-char) > (interactive "s(e)nglish or (s)wedish: ") > (let ((lang (pcase lang-char > ("e" "american-insane") ; these has to be added outside of > Emacs > ("s" "svenska") ))) > (if lang > (progn > (ispell-change-dictionary lang) ; N.B. side-effect - this isn't > reset > (ispell-message) ) > (message "Spelling not done - no support for: %s" lang-char) ))) > > If you don't want to spell, just hit RET. Hi, sorry for my late reply, I was busy ... working! Ouch!
Thanks a lot for your answers guys, much appreciated :-) I would like to implement one of the previous follow up which explained how to auto detect the buffer's language but for now I would be more than happy with this simple and good solution, the function works fine when I call it from M-x "name-function" but something strange happens when that is called by the message-send hook: run-hooks: Wrong number of arguments: (lambda (lang-char) (interactive "s(e)nglish or (s)wedish: ") (let ((lang (cond ((equal lang-char "e") (let nil "british")) ((equal lang-char "i") (let nil "italiano")) (t nil)))) (if lang (progn (ispell-change-dictionary lang) (ispell-message)) (message "Spelling not done - no support for: %s" lang-char)))), 0 This is what I get in my mini-buffer when I send my email, any thoughts ? I am new to Emacs Lisp therefore I could some silly mistake. Thanks a lot. Pietro _______________________________________________ info-gnus-english mailing list [email protected] https://lists.gnu.org/mailman/listinfo/info-gnus-english
