info-gnus-english
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Trigger spell checking before sending


From: Emanuel Berg
Subject: Re: Trigger spell checking before sending
Date: Sat, 13 Feb 2016 04:27:28 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Pietro <pulsarpietro@posteo.net> writes:

> I prefer to run the spell checker at a separate
> stage since it takes a bit of concentration to me
> when I am writing in English I couldn't cope with
> external interactions/distractions of any sort very
> well ...

Indeed, there is that, but there is also the problem
of the incomplete wordlists.

When I just now wrote in Swedish only two short
paragraphs, and after that did spelling, it found the
following words -

    Sydostpassaden
    Humboldtströmmen
    Galapagosströmmarna
    Sydekvatorialströmmarna
    Pizarro
    guldmakrill
    flygfiskbete

- which are all correct what I can see. But it also
found one real mistake so I'm not complaining. But to
have it mark all those words as potentially trouble
while I write the paragraphs - that would be equal to
not writing but instead go back all the time and
verify the correct-but-indicated words...

> Now that I got this working my following question is
> would it be possible to auto-detect the language the
> spell checker should check ?

It is possible but you have to find an algorithm to
detect the language - go hunt. If you find one, it is
easy to implement. But I don't think it is worth the
effort unless you find one like instantly and really
want it.

> 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]

That's better, do that, or have two shortcuts to two
functions which is what I do:

(defun is-code () (member major-mode '(c++-mode
                                       emacs-lisp-mode
                                       sh-mode) )) ; add more here
(defun is-message () (eq major-mode 'message-mode))

(defun do-spell-dict (dict)
  "Spell with DICT.
If there is a region, `ispell-region'.
if in a code mode, `ispell-comments-and-strings'.
if in `message-mode', do `ispell-message'.
Otherwise, spell everything with `ispell-buffer'."
  (ispell-change-dictionary dict)
  (save-excursion
    (cond
     (mark-active   (ispell-region (mark) (point)))
     ((is-message)  (ispell-message))
     ((is-code)     (ispell-comments-and-strings))
     (t             (ispell-buffer)) )))

(defun spell-swedish ()
  (interactive)
  (do-spell-dict swe-dict))
(defun spell-english ()
  (interactive)
  (do-spell-dict eng-dict))

All code: http://user.it.uu.se/~embe8573/conf/emacs-init/spell-new.el

Then:

    (define-prefix-command       'C-o-prefix)
    (super-global-set-key "\C-o" 'C-o-prefix)

    (global-set-key "\C-oe" #'spell-english)
    (global-set-key "\C-os" #'spell-swedish)

> Am I talking completely non-sense ?

Yes. The rest of the message was good tho :)

-- 
underground experts united
http://user.it.uu.se/~embe8573




reply via email to

[Prev in Thread] Current Thread [Next in Thread]