Skip to content

Improve method for temporarily overriding major-mode-remap-alist#87

Open
noctuid wants to merge 1 commit intorenzmann:mainfrom
noctuid:bind-around-set-auto-mode-0
Open

Improve method for temporarily overriding major-mode-remap-alist#87
noctuid wants to merge 1 commit intorenzmann:mainfrom
noctuid:bind-around-set-auto-mode-0

Conversation

@noctuid
Copy link

@noctuid noctuid commented Feb 21, 2024

Let bind major-mode-remap-alist around set-auto-mode-0 instead of using setq-local, and only consider the mode being switched to.

Fixes #84. After doing some more testing this was actually caused by interaction between other plugins (my editorconfig setup) causing set-auto-mode-0 to be called 20+ times when opening a file.

Still, this should be an improvement over the old method using setq-local and provides a small performance boost. Let me know if you think there are any potential issues with this method.

I also added autoload cookies for some of the commands. For now I just left the globalized minor mode alone because adding an autoload cookie will cause an error since it will pull in the cl-loop from :predicate into the autoloads file (and the struct doesn't exist yet).

Let bind major-mode-remap-alist around set-auto-mode-0 instead of using
setq-local, and only consider the mode being switched to.

Fixes renzmann#84.  After doing some more testing this was actually caused by
interaction between other plugins (my editorconfig setup) causing
set-auto-mode-0 to be called 20+ times when opening a file.

Still, this should be an improvement over the old method using setq-local and
provides a small performance boost.  Let me know if you think there are any
potential issues with this method.

I also added autoload cookies for some of the user-facing commands.  For now I
just left the globalized minor mode alone because adding an autoload cookie will
cause an error since it will pull in the cl-loop from :predicate into the
autoloads file (and the struct doesn't exist yet).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Global mode noticeably slows opening files

1 participant