Doom experiences increased input latency when entering the backspace key. Holding down the key causes the application to pause as it processes the function. This behavior is most visibly seen when editing .tex files.
Running the profiler I noticed this function using memory/cpu expensively:
- doom/delete-backward-char 298,266,708 94%
There should be no input lag when entering the backspace key.
OS: Arch Linux
CPU: Intel i7-7500U 3.500GHz
MEMORY: 16 gb
```
Replace this line with the output of one of these commands:
Yikes, it appears that smartparens sets a _lot_ of rules for (la)?tex-mode, which is what makes the underlying calls to sp-get-thing so expensive.
I'll try two things to fix this: try to cache/optimize doom/delete-backward-char's calls to sp-get-thing, and to cut down on all those extra smartparens rules.
In the meantime, try adding this to your private config:
(after! tex-mode
(map-delete sp-pairs 'LaTeX-mode)
(map-delete sp-pairs 'latex-mode)
(map-delete sp-pairs 'tex-mode)
(map-delete sp-pairs 'plain-tex-mode))
And let me know if the result is acceptable.
Thanks for the quick response. I implemented your suggestion and the keys are far more usable now.
Also, just wanted to say that I've gone through almost every major text editor / config (spacemacs, vim, sublime, atom, etc...) and yours is by far the best one. Keep on rocking man! I don't know much elisp at the moment, but if you need any help with the documentation to make it more beginner friendly or need some designs, I'd be willing to contribute.
Alright, I've removed the smartparens rules from lang/latex in develop. A more thorough solution is warranted, but this should do for now. I'll keep this open until it gets merged into master.
I'm experiencing the same issue with large files in web-mode (or derivative modes). Deleting with x is fast as expected, but deletion via backspace is halting and stuttering.
Do you think this might be related to smartparens as well? I can open a new issue if you don't want to re-open this one.
@skosch Are you still experiencing this issue? It could very well be smartparens, but I've also made a number of changes to it and its integration into web-mode.
I'll assume this is resolved. Feel free to follow up otherwise.
Hi. I am seeing this behavior replicate in the org-mode. Here's the output from my doom-profiler:

@zephirefaith please provide M-x doom/info
Sorry about that. Here you go -
emacs version 26.2
features XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS GLIB NOTIFY LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS XWIDGETS LIBSYSTEMD LCMS2
build Apr 12, 2019
buildopts (--build=x86_64-linux-gnu --prefix=/usr '--includedir=${prefix}/include' '--mandir=${prefix}/share/man' '--infodir=${prefix}/share/info' --sysconfdir=/etc --localstatedir=/var --disable-silent-rules '--libdir=${prefix}/lib/x86_64-linux-gnu' '--libexecdir=${prefix}/lib/x86_64-linux-gnu' --disable-maintainer-mode --disable-dependency-tracking --prefix=/usr --sharedstatedir=/var/lib --program-suffix=26 --with-modules --with-file-notification=inotify --with-mailutils --with-x=yes --with-x-toolkit=gtk3 --with-xwidgets --with-lcms2 'CFLAGS=-g -O2 -fstack-protector-strong -Wformat -Werror=format-security' 'CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2' 'LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro')
doom version 2.0.9
build HEAD -> develop a217b01 2019-09-12 17:26:12 -0400
system type gnu/linux
config x86_64-pc-linux-gnu
shell /usr/bin/zsh
uname Linux 4.15.0-62-generic #69~16.04.1-Ubuntu SMP Fri Sep 6 02:43:35 UTC 2019 x86_64
path (~/base_py27/bin ~/bin ~/.emacs.d/bin /usr/local/cuda-9.1/bin ~/base_py27/bin ~/bin ~/.emacs.d/bin /usr/local/cuda-9.1/bin /home/linuxbrew/.linuxbrew/bin /home/linuxbrew/.linuxbrew/sbin ~/bin ~/.local/bin /usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin /usr/games /usr/local/games /snap/bin /opt/cogrob/bin /usr/local/cuda/bin /home/zephirefaith/.gem/bin ~/.fzf/bin ~/.gem/bin /home/zephirefaith/.gem/bin ~/.gem/bin /usr/lib/x86_64-linux-gnu/emacs/26.2/x86_64-linux-gnu/)
config envfile envvar-file
elc-files 0
modules (:completion company helm :ui doom doom-dashboard doom-quit fill-column hl-todo indent-guides modeline nav-flash ophints (popup +all +defaults) pretty-code treemacs vc-gutter vi-tilde-fringe window-select workspaces :editor evil file-templates fold (format +onsave) multiple-cursors rotate-text snippets word-wrap :emacs dired electric vc :tools editorconfig ein eval flycheck (lookup +docsets) magit pdf :lang cc data julia latex markdown (org +dragndrop +ipython +pandoc +present) python sh :app calendar (write +wordnut +langtool) :config default)
packages (n/a)
elpa-packages (n/a)
Hi, I'm also experiencing the same issue as zephiraith. Below is the output of the profilier (CPU) and doom/info. Thanks !

emacs version 26.3
features XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS GLIB NOTIFY ACL GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS LIBSYSTEMD LCMS2
build Aug 29, 2019
buildopts (--prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib --localstatedir=/var --with-x-toolkit=gtk3 --with-xft --with-modules 'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fno-plt' CPPFLAGS=-D_FORTIFY_SOURCE=2 LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now)
windowsys x
daemonp daemon
doom version 2.0.9
build HEAD -> develop 5f2e708cd 2019-12-12 03:48:25 -0500
system type gnu/linux
config x86_64-pc-linux-gnu
shell /bin/bash
uname Linux 5.4.2-arch1-1 #1 SMP PREEMPT Thu, 05 Dec 2019 12:29:40 +0000 x86_64
path (/usr/local/sbin/ /usr/local/bin/ /usr/bin/ /usr/lib/jvm/default/bin/ /usr/bin/site_perl/ /usr/bin/vendor_perl/ /usr/bin/core_perl/ ~/.local/bin/ ~/.emacs.d/bin/ ~/.local/bin/ ~/.emacs.d/bin/ /usr/lib/emacs/26.3/x86_64-pc-linux-gnu/)
config envfile envvar-file
elc-files 0
modules (:completion company ivy :ui doom doom-dashboard doom-quit hl-todo modeline nav-flash ophints (popup +all +defaults) treemacs vc-gutter vi-tilde-fringe window-select workspaces :editor (evil +everywhere) file-templates fold multiple-cursors rotate-text snippets :emacs dired electric vc :term eshell :tools eval flycheck (lookup +docsets) lsp magit pdf :lang common-lisp data emacs-lisp (haskell +lsp) latex ledger markdown (org +dragndrop +ipython +pandoc +present) sh :email notmuch :app calendar :config (default +bindings +smartparens))
packages (n/a)
elpa (n/a)
@alexDarcy What major mode(s) are you seeing this in?
@hlissner thanks for the quick answer. I'm seeing it in org-mode, in a file with roughly 1 000 lines. Disabling smartparens is good enough for me at the moment.
I'm facing this issue in org-mode too. Disabling smartparens seems to work, though this solution is not ideal. doom/info below.
emacs version 26.3
features XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS GLIB NOTIFY ACL GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS LIBSYSTEMD LCMS2
build aug 29, 2019
buildopts (--prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib --localstatedir=/var --with-x-toolkit=gtk3 --with-xft --with-modules 'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fno-plt' CPPFLAGS=-D_FORTIFY_SOURCE=2 LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now)
windowsys x
daemonp server-running
doom version 2.0.9
build HEAD -> develop, origin/develop, origin/HEAD 6f273ffc2 2020-01-13 01:46:43 -0500
dir ~/dotfiles/.doom.d/
system type gnu/linux
config x86_64-pc-linux-gnu
shell /usr/bin/zsh
uname Linux 5.4.12-1-MANJARO #1 SMP PREEMPT Wed Jan 15 08:05:08 UTC 2020 x86_64
path (~/.local/bin/ ~/.local/bin/ /usr/local/bin/ /usr/bin/ /bin/ /usr/local/sbin/ /usr/bin/site_perl/ /usr/bin/vendor_perl/ /usr/bin/core_perl/ /var/lib/snapd/snap/bin/ /usr/lib/emacs/26.3/x86_64-pc-linux-gnu/)
config envfile envvar-file
elc-files 152
modules (:completion company ivy :ui doom doom-dashboard doom-quit hl-todo modeline nav-flash ophints (popup +all +defaults) vc-gutter vi-tilde-fringe window-select workspaces :editor (evil +everywhere) file-templates fold multiple-cursors rotate-text snippets :emacs dired electric ibuffer vc :checkers syntax :tools (eval +overlay) (lookup +docsets) magit pdf :lang data emacs-lisp go (haskell +dante) javascript latex markdown (org +dragndrop +pandoc +pomodoro +present) python sh web :app irc :config (default +bindings +smartparens))
packages (erc erc-hl-nicks erc-image)
elpa (noflet)
I have the same issue in org-mode as well. In fact, it is most noticeable when using backspace but I also experience a clear lag when simply typing text in an org buffer (in this case, the buffer is shorter than 1000 lines). Disabling smartparens-mode works around this for me too. System info below.
emacs version 26.3
features NOTIFY ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS MODULES THREADS
build Sep 02, 2019
buildopts (--with-ns '--enable-locallisppath=/Library/Application Support/Emacs/${version}/site-lisp:/Library/Application Support/Emacs/site-lisp' --with-modules)
windowsys ns
daemonp server-running
doom version 2.0.9
build HEAD -> develop b5a279311 2020-01-07 00:14:46 -0500
dir ~/.emacs.conf/.doom.d/
system type darwin
config x86_64-apple-darwin14.5.0
shell /bin/bash
uname Darwin 17.7.0 Darwin Kernel Version 17.7.0: Sun Dec 1 19:19:56 PST 2019; root:xnu-4570.71.63~1/RELEASE_X86_64 x86_64
path (~/anaconda3/bin/ /usr/local/sbin/ ~/local/openscenegraph-3.4.0/bin/ ~/local/geant4_10.00.p03/bin/ /usr/local/root/5.34.36/bin/ ~/bin/ /usr/local/bin/ /usr/bin/ /bin/ /usr/sbin/ /sbin/ /Library/TeX/texbin/ /usr/local/MacGPG2/bin/ /opt/X11/bin/ /usr/local/git/bin/ /Applications/Emacs.app/Contents/MacOS/bin-x86_64-10_10/ /Applications/Emacs.app/Contents/MacOS/libexec-x86_64-10_10/ /Applications/Emacs.app/Contents/MacOS/libexec/)
config envfile envvar-file
elc-files 0
modules (:completion company ivy :ui doom doom-dashboard doom-quit hl-todo modeline nav-flash ophints (popup +all +defaults) vc-gutter vi-tilde-fringe window-select workspaces :editor file-templates fold multiple-cursors rotate-text snippets :emacs dired electric ibuffer vc :term eshell term :tools debugger (eval +overlay) flycheck flyspell (lookup +docsets) magit pdf :lang cc data emacs-lisp latex markdown (org +dragndrop +jupyter +pandoc +pomodoro +present) plantuml python sh web :config (default +bindings +smartparens))
packages (org-ql ox-reveal org-kanban org-pdfview org-sidebar synosaurus dictcc mastodon org-protocol)
elpa (n/a)
I'm also experiencing this whn backspacing within an org-mode file of moderate size (~ 1k lines). Turning off smartparens helps.
emacs version 26.3
features XPM JPEG TIFF GIF PNG RSVG SOUND GPM DBUS GLIB NOTIFY ACL GNUTLS LIBXML2 FREETYPE XFT ZLIB GTK3 X11 XDBE XIM MODULES THREADS XWIDGETS LCMS2
build Jan 03, 2020
buildopts (--prefix=/usr --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib --disable-silent-rules --docdir=/usr/share/doc/emacs-26.3-r1 --htmldir=/usr/share/doc/emacs-26.3-r1/html --libdir=/usr/lib64 --program-suffix=-emacs-26 --includedir=/usr/include/emacs-26 --infodir=/usr/share/info/emacs-26 --localstatedir=/var --enable-locallisppath=/etc/emacs:/usr/share/emacs/site-lisp --without-compress-install --without-hesiod --without-pop --with-file-notification=inotify --enable-acl --with-dbus --with-modules --without-gameuser --with-gpm --without-kerberos --without-kerberos5 --with-lcms2 --with-xml2 --without-mailutils --without-selinux --with-gnutls --without-libsystemd --with-threads --without-wide-int --with-zlib --with-sound=alsa --with-x --without-ns --without-gconf --without-gsettings --without-toolkit-scroll-bars --with-gif --with-jpeg --with-png --with-rsvg --with-tiff --with-xpm --without-imagemagick --with-xft --without-cairo --without-libotf --without-m17n-flt --with-x-toolkit=gtk3 --with-xwidgets 'CFLAGS=-march=native -O2 -pipe' CPPFLAGS= 'LDFLAGS=-Wl,-O1 -Wl,--as-needed')
windowsys x
daemonp server-running
doom version 2.0.9
build HEAD -> develop, upstream/develop 58a68adb5 2020-03-04 23:02:15 -0500
dir ~/Workspace/dotfiles/.doom.d/
system type gnu/linux
config x86_64-pc-linux-gnu
shell /bin/bash
uname Linux 4.19.97-gentoo #1 SMP Thu Feb 27 00:57:51 CET 2020 x86_64
path (/usr/lib/llvm/9/bin /usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin /opt/bin ~/.emacs.d/bin ~/.local/bin /usr/libexec/emacs/26.3/x86_64-pc-linux-gnu)
config envfile nil
elc-files 0
modules (:completion company helm :ui doom doom-dashboard hl-todo modeline nav-flash ophints (popup +all +defaults) vc-gutter vi-tilde-fringe window-select workspaces :editor (evil +everywhere) file-templates fold (format +onsave) multiple-cursors rotate-text snippets :emacs (dired +icons) electric ibuffer vc :term vterm :checkers syntax :tools (eval +overlay) (lookup +docsets) lsp magit :lang data emacs-lisp (javascript +lsp) latex markdown (org +dragndrop +present) (python +lsp) (sh +lsp) web :email mu4e :config literate (default +bindings +smartparens))
packages ((f) (org-drill) (org-super-agenda) (org-chef) (posframe))
unpin (n/a)
elpa (n/a)
Most helpful comment
Thanks for the quick response. I implemented your suggestion and the keys are far more usable now.
Also, just wanted to say that I've gone through almost every major text editor / config (spacemacs, vim, sublime, atom, etc...) and yours is by far the best one. Keep on rocking man! I don't know much elisp at the moment, but if you need any help with the documentation to make it more beginner friendly or need some designs, I'd be willing to contribute.