[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Using aspell in emacs
From: |
Emanuel Berg |
Subject: |
Re: Using aspell in emacs |
Date: |
Tue, 15 Jun 2021 23:25:53 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
Jean Louis wrote:
> I have verified it, if program `aspell' is on system, the
> variable `ispell-program-name' will be set to its path.
> Finished there.
OK, how does that happen one might wonder?
> Try reading manual.
Check out:
https://dataswamp.org/~incal/emacs-init/spell.el
A lot of that stuff, or all of it I think, are so basic ideas,
spell a word, spell words in different forms and with
different (common) interfaces, so that makes me think,
1) what of that is already implemented and
2) if it isn't, go ahead and use it (by my guest and improve
it even more before you add it), since again, it is
basic stuff.
For example this,
(defun spell-word (word)
(with-temp-buffer
(save-excursion
(insert word) )
(condition-case nil
(not (ispell-word))
(error nil) )))
;; (spell-word "length") ; t
;; (spell-word "lenght") ; nil
It spells the word WORD. That's right, I didn't have to take
LSD to come up with _that_ idea :) Is it in ispell already
only I failed to find it?
And if it isn't, why not? Useful not only for "us" but also
for ispell, internally, I'm sure!
Is the major mode a code mode? Interesting question, I know...
(defun is-code ()
(member major-mode '(
c++-mode
c-mode
emacs-lisp-mode
prolog-mode
python-mode
sh-mode
Shell-script-mode
) ; add more!
))
spell differently with the same command:
(defun spell (dict)
"Spell with DICT.
\nIf a region, use `ispell-region'
\nIf editing code, `ispell-comments-and-strings'
\nIf writing a message, `ispell-message'
\nelse, `ispell-buffer'"
(ispell-change-dictionary dict)
(save-window-excursion
(save-excursion
(cond
((use-region-p) (ispell-region (region-beginning) (region-end)))
((is-message) (ispell-message))
((is-code) (ispell-comments-and-strings))
(t (ispell-buffer)) ))))
(PS, should the region stuff be optional beg and end
arguments, you think?)
https://dataswamp.org/~incal/emacs-init/spell.el
--
underground experts united
https://dataswamp.org/~incal
- Re: Using aspell in emacs, (continued)
Re: Using aspell in emacs, Nick Dokos, 2021/06/16
Using aspell in emacs, henri-biard, 2021/06/15