mhayashi1120 / Emacs-langtool

LanguageTool for Emacs
GNU General Public License v3.0
377 stars 31 forks source link

How do I correct word at point? #58

Closed j-steinbach closed 1 year ago

j-steinbach commented 3 years ago

I only see the function langtool-correct-buffer, but I just want to correct the word my cursor is currently hovering over.

Is there something like langtool-correct-word-at-point?

chongchonghe commented 2 years ago

Same question. Please! Anyone care to answer this question?

linktohack commented 1 year ago

Like this, maybe?

(defun my/langtool-correct-from-point ()
    "Execute interactive correction after `langtool-check', from point"
    (interactive)
    (let ((ovs (langtool--overlays-region (point) (point-max))))
      (if (null ovs)
          (message "No error found. %s"
                   (substitute-command-keys
                    (concat
                     "Type \\[langtool-check-done] to finish checking "
                     "or type \\[langtool-check] to re-check buffer")))
        (barf-if-buffer-read-only)
        (langtool--correction ovs))))
mhayashi1120 commented 1 year ago

After consideration, introduce as M-x langtool-correct-at-point .