emacs-devel
[Top][All Lists]
Advanced

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

Re: master 47e313e9805: Unbind 'C-M-i' in Text mode


From: Dmitry Gutov
Subject: Re: master 47e313e9805: Unbind 'C-M-i' in Text mode
Date: Wed, 6 Dec 2023 01:26:41 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0

Hi,

On 26/11/2023 12:39, Eli Zaretskii wrote:
+;;;###autoload
+(defun ispell-completion-at-point ()
+  "Word completion function for use in `completion-at-point-functions'."
+  (pcase (bounds-of-thing-at-point 'word)
+    (`(,beg . ,end)
+     (when (and (< beg (point)) (<= (point) end))
+       (let* ((word (buffer-substring-no-properties beg end))
+              (len (length word))
+              (inhibit-message t)
+              (all (cons word (ispell-lookup-words word)))
+              (cur all))
+         (while cur
+           (unless (string-prefix-p word (car cur))
+             (setcar cur (concat word (substring (car cur) len))))
+           (while (when-let ((next (cadr cur)))
+                    (not (string-prefix-p word next t)))
+             (setcdr cur (cddr cur)))
+           (setq cur (cdr cur)))
+         (list beg end (cdr all)
+               :annotation-function (lambda (_) " Dictionary word")

I have to say that "Dictionary word" is not a great annotation: it's long, longer than most of the completions coming from that backend, so these words, repeated, constitute most of the text inside the Completions buffer. And it's the same string for all completions.



reply via email to

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