emacs-devel
[Top][All Lists]
Advanced

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

Re: jinx


From: Emanuel Berg
Subject: Re: jinx
Date: Wed, 05 Apr 2023 10:15:51 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

Arash Esbati wrote:

>> Another idea is, text-within-code-flyspell-mode.
>
> ispell.el has `ispell-comments-and-strings', so I'd suggest
> `flyspell-comments-and-strings-mode'.

Can any of them spell a single word? If not, here is code
for that.

(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

(defun spell-this-word (dict)
  "`ispell-word' the word with DICT."
  (ispell-change-dictionary dict)
  (ispell-word) )

(let ((eng-dict "american-insane"))
  (defun spell-english ()
    (interactive)
    (spell eng-dict) )

  (defun word ()
    (interactive)
    (spell-this-word eng-dict) ))
;; test: hello / hxlle

(let ((swe-dict "svenska"))
  (defun spell-swedish ()
    (interactive)
    (spell swe-dict) )

  (defun ord ()
    (interactive)
    (spell-this-word swe-dict) ))
;; test: hej / hxj

Full source:
  https://dataswamp.org/~incal/emacs-init/spell.el

-- 
underground experts united
https://dataswamp.org/~incal




reply via email to

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