* typing slows down dramatically when typing digits in emails
@ 2022-12-21 13:53 Eric S Fraga
2022-12-22 4:09 ` Stefan Monnier via Users list for the GNU Emacs text editor
0 siblings, 1 reply; 7+ messages in thread
From: Eric S Fraga @ 2022-12-21 13:53 UTC (permalink / raw)
To: help-gnu-emacs
Hello,
When composing an email in message mode in Emacs, completion works just
fine except when I type any digits (0-9) where there is an appreciable
lag. Using the profiler, I get the following summary:
--8<---------------cut here---------------start------------->8---
5482 82% - ...
5311 79% - completion--capf-wrapper
5311 79% - apply
5311 79% - corfu--capf-wrapper-advice
5311 79% - corfu--capf-wrapper
5311 79% - completion-try-completion
5311 79% - completion--nth-completion
5311 79% - completion--some
5311 79% - #<compiled -0x187b0d97893b0bbf>
5311 79% - orderless-try-completion
5311 79% - orderless-filter
5311 79% - orderless--prefix+pattern
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
36 0% - dabbrev--goto-start-of-abbrev
28 0% #<compiled 0xae9961fbf742f>
4 0% #<compiled 0xae9967326d42f>
4 0% + internal--syntax-propertize
9 0% + dabbrev--make-friend-buffer-list
--8<---------------cut here---------------end--------------->8---
It comes down to dabbrev... maybe.
Is there any setting that I might have missed that would improve this?
I am supposedly using company mode, by the way, I think (at least, I
have company indicated in my mode line) and completion candidates only
popup after 5 keystrokes yet lag takes place as soon as I type a single
digit.
Thank you,
eric
--
Eric S Fraga via gnus (Emacs 30.0.50 2022-12-21) on Debian 11.5
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: typing slows down dramatically when typing digits in emails
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 10:22 ` typing slows down dramatically when typing digits in emails Eric S Fraga
0 siblings, 2 replies; 7+ messages in thread
From: Stefan Monnier via Users list for the GNU Emacs text editor @ 2022-12-22 4:09 UTC (permalink / raw)
To: help-gnu-emacs
> 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 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.
Stefan
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: typing slows down dramatically when typing digits in emails
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
1 sibling, 1 reply; 7+ messages in thread
From: Emanuel Berg @ 2022-12-22 4:34 UTC (permalink / raw)
To: help-gnu-emacs
Stefan Monnier via Users list for the GNU Emacs text editor wrote:
> Which version of Emacs is that?
We should have a Gnus posting style that inserts the Emacs
version last in each post that goes to a GNU Emacs list, and
that would be computed each time, so after that, to quote the
Captain of Titanic, "now nothing can go wrong" ... and we
would be saving time as well!
(info "(gnus) Posting Styles")
;;; -*- lexical-binding: t -*-
;;
;; this file:
;; https://dataswamp.org/~incal/emacs-init/meta.el
;;
;; also see:
;; https://dataswamp.org/~incal/emacs-init/w3m/w3m-version.el
;;
;; example:
;; GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, cairo version 1.16.0)
;; of 2022-05-22 [commit 714970f5967f2153bb95e35823dbd917e0e5b60b]
(defun emacs-version-commit (&optional here)
(interactive "P")
(let ((ver (replace-regexp-in-string " \\(of\\)" "\\1"
(format "%s [commit %s]"
(emacs-version)
(emacs-repository-get-version) ))))
(when here
(insert ver) )
(message ver) ))
(defalias 'ever #'emacs-version-commit)
--
underground experts united
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 7+ messages in thread
* always latest Emacs (was: Re: typing slows down dramatically when typing digits in emails)
2022-12-22 4:34 ` Emanuel Berg
@ 2022-12-22 4:45 ` Emanuel Berg
0 siblings, 0 replies; 7+ messages in thread
From: Emanuel Berg @ 2022-12-22 4:45 UTC (permalink / raw)
To: help-gnu-emacs
>> Which version of Emacs is that?
>
> We should have a Gnus posting style that inserts the Emacs
> version last ...
To automate even further, take a look at this for my
#2 favorite program, mpv.
Can you do something similar with Emacs?
Because this version thing is passé anyway ... there should be
only one version, the latest, which everyone should
have by definition.
#! /bin/zsh
#
# this file:
# https://dataswamp.org/~incal/conf/.zsh/mpv-install
#
# commands:
# https://fostips.com/install-mpv-media-player-debian/
mpv-install-setup () {
sudo apt install apt-transport-https
local key=uvt_key.gpg
local url=https://non-gnu.uvt.nl/debian/$key
curl $url --output $key
sudo mv $key /etc/apt/trusted.gpg.d
sudo sh -c 'echo "deb https://non-gnu.uvt.nl/debian $(lsb_release -sc) uvt" >> /etc/apt/sources.list.d/non-gnu-uvt.list'
sudo apt update
}
mpv-install () {
sudo apt install -t "o=UvT" mpv
}
--
underground experts united
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: typing slows down dramatically when typing digits in emails
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 10:22 ` Eric S Fraga
2022-12-22 21:29 ` cape and boundaries (was: typing slows down dramatically when typing digits in emails) Stefan Monnier via Users list for the GNU Emacs text editor
1 sibling, 1 reply; 7+ messages in thread
From: Eric S Fraga @ 2022-12-22 10:22 UTC (permalink / raw)
To: help-gnu-emacs
On Wednesday, 21 Dec 2022 at 23:09, Stefan Monnier via Users list for the GNU Emacs text editor wrote:
> 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?
--
Eric S Fraga via gnus (Emacs 30.0.50 2022-12-21) on Debian 11.5
^ permalink raw reply [flat|nested] 7+ messages in thread
* cape and boundaries (was: typing slows down dramatically when typing digits in emails)
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
2022-12-23 12:14 ` cape and boundaries Eric S Fraga
0 siblings, 1 reply; 7+ messages in thread
From: Stefan Monnier via Users list for the GNU Emacs text editor @ 2022-12-22 21:29 UTC (permalink / raw)
To: help-gnu-emacs; +Cc: Daniel Mendler
[-- 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
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: cape and boundaries
2022-12-22 21:29 ` cape and boundaries (was: typing slows down dramatically when typing digits in emails) Stefan Monnier via Users list for the GNU Emacs text editor
@ 2022-12-23 12:14 ` Eric S Fraga
0 siblings, 0 replies; 7+ messages in thread
From: Eric S Fraga @ 2022-12-23 12:14 UTC (permalink / raw)
To: help-gnu-emacs
On Thursday, 22 Dec 2022 at 16:29, Stefan Monnier via Users list for the GNU Emacs text editor wrote:
> 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".
FTR, I've tried this patch. There's still an appreciable lag when
typing a number but everything else continues working just fine.
Thank you,
eric
--
Eric S Fraga via gnus (Emacs 30.0.50 2022-12-21) on Debian 11.5
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2022-12-23 12:14 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` cape and boundaries (was: typing slows down dramatically when typing digits in emails) Stefan Monnier via Users list for the GNU Emacs text editor
2022-12-23 12:14 ` cape and boundaries Eric S Fraga
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.