From: Emanuel Berg via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: Using aspell in emacs
Date: Tue, 15 Jun 2021 23:25:53 +0200 [thread overview]
Message-ID: <87zgvqx1jy.fsf@zoho.eu> (raw)
In-Reply-To: YMjmdEjCOLU3I4Ky@protected.localdomain
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
next prev parent reply other threads:[~2021-06-15 21:25 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-15 14:04 Using aspell in emacs henri-biard
2021-06-15 14:18 ` Emanuel Berg
2021-06-15 14:22 ` Jean Louis
2021-06-15 14:32 ` henri-biard
2021-06-15 14:18 ` Jean Louis
2021-06-15 14:37 ` henri-biard
2021-06-15 17:42 ` Jean Louis
2021-06-15 21:25 ` Emanuel Berg via Users list for the GNU Emacs text editor [this message]
2021-06-15 21:34 ` Jean Louis
2021-06-16 17:03 ` Emanuel Berg via Users list for the GNU Emacs text editor
-- strict thread matches above, loose matches on Subject: below --
2021-06-15 3:16 henri-biard
2021-06-15 3:39 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-06-15 4:32 ` henri-biard
2021-06-15 7:00 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-06-15 12:34 ` henri-biard
2021-06-15 14:48 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-06-15 13:48 ` Jean Louis
2021-06-15 4:51 ` henri-biard
2021-06-15 7:04 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-06-15 12:30 ` henri-biard
2021-06-16 18:38 ` Nick Dokos
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87zgvqx1jy.fsf@zoho.eu \
--to=help-gnu-emacs@gnu.org \
--cc=moasenwood@zoho.eu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).