From: Stefan Monnier via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>
To: help-gnu-emacs@gnu.org
Cc: Daniel Mendler <mail@daniel-mendler.de>
Subject: cape and boundaries (was: typing slows down dramatically when typing digits in emails)
Date: Thu, 22 Dec 2022 16:29:23 -0500 [thread overview]
Message-ID: <jwvfsd72ksl.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: 87bknvzqje.fsf@ucl.ac.uk
[-- Attachment #1: Type: text/plain, Size: 1686 bytes --]
Eric S Fraga [2022-12-22 10:22:29] wrote:
> On Wednesday, 21 Dec 2022 at 23:09, Stefan Monnier via Users list for the
> GNU Emacs text editor wrote:
>>> 5311 79% - completion-boundaries
>>> 5311 79% - #<compiled 0x1f4100e4f6213ad7>
>>> 5311 79% - complete-with-action
>>> 5311 79% - #<compiled 0xfe6876f217f45e4>
>>> 4776 71% - cape--dabbrev-list
>>> 4776 71% - dabbrev--find-all-expansions
>>> 4704 70% - dabbrev--find-expansion
>>> 4671 70% - dabbrev--try-find
>>> 2959 44% - dabbrev--search
>>
>>`completion-boundaries` should not need to perform a `dabbrev--search`.
>> Which version of Emacs is that?
>
> It's Emacs from git, up to date as of yesterday morning.
>
>> It would be useful to figure out what is this
>> #<compiled 0x1f4100e4f6213ad7> function (presumably a completion-table)
>> and how it calls `complete-with-action` because normally it should call
>> it with an argument of the form `(boundaries . N)` which should cause
>> `complete-with-action` to return nil immediately.
>
> Any suggestion on how to do this? I guess I would need to disable
> native compilation and re-build?
Oh, I forgot that `complete-with-action` actually won't return immediately
if the completion table it's passed as argument is itself a function.
I'm not sure if the patch below will make much difference (there's
a chance the `dabbrev--search` will still take place, just via some
other call), but at least I think it's "Right".
Daniel, WDYT?
Stefan
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: cape.patch --]
[-- Type: text/x-diff, Size: 1309 bytes --]
diff --git a/cape.el b/cape.el
index dfb1e7a95c..f10decb5ff 100644
--- a/cape.el
+++ b/cape.el
@@ -199,13 +199,17 @@ VALID is the input comparator, see `cape--input-valid-p'."
(end (copy-marker end t))
(table nil))
(lambda (str pred action)
- (let ((new-input (buffer-substring-no-properties beg end)))
- (when (or (eq input 'init) (not (cape--input-valid-p input new-input valid)))
- ;; NOTE: We have to make sure that the completion table is interruptible.
- ;; An interruption should not happen between the setqs.
- (setq table (funcall fun new-input)
- input new-input)))
- (complete-with-action action table str pred))))
+ (if (or (eq action 'metadata) (eq (car-safe action) 'boundaries))
+ nil
+ (let ((new-input (buffer-substring-no-properties beg end)))
+ (when (or (eq input 'init)
+ (not (cape--input-valid-p input new-input valid)))
+ ;; NOTE: We have to make sure that the completion table is
+ ;; interruptible. An interruption should not happen
+ ;; between the setqs.
+ (setq table (funcall fun new-input)
+ input new-input)))
+ (complete-with-action action table str pred)))))
;;;; Capfs
next prev parent reply other threads:[~2022-12-22 21:29 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-21 13:53 typing slows down dramatically when typing digits in emails Eric S Fraga
2022-12-22 4:09 ` Stefan Monnier via Users list for the GNU Emacs text editor
2022-12-22 4:34 ` Emanuel Berg
2022-12-22 4:45 ` always latest Emacs (was: Re: typing slows down dramatically when typing digits in emails) Emanuel Berg
2022-12-22 10:22 ` typing slows down dramatically when typing digits in emails Eric S Fraga
2022-12-22 21:29 ` Stefan Monnier via Users list for the GNU Emacs text editor [this message]
2022-12-23 12:14 ` cape and boundaries Eric S Fraga
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=jwvfsd72ksl.fsf-monnier+emacs@gnu.org \
--to=help-gnu-emacs@gnu.org \
--cc=mail@daniel-mendler.de \
--cc=monnier@iro.umontreal.ca \
/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).