Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for remapped and aliased modes #9

Merged
merged 1 commit into from
Mar 7, 2024

Commits on Feb 17, 2024

  1. add support for remapped and aliased modes

    This patch tries to make `bind-map` aware of two ways in which major modes can
    be remapped: via aliasing or via `major-mode-remap-alist`.
    
    The motivating scenario is AUCTeX, which as of version 14.0.1 has renamed
    several major modes, e.g., latex-mode has been renamed as LaTeX-mode. AUCTeX
    attempts to offer backwards compatibility using a mix of remapping and aliasing.
    For users of emacs < 29, `latex-mode` is redefined as an alias for `LaTeX-mode`,
    whereas for users of emacs 29+, `latex-mode` is remapped to `LaTeX-mode` using
    `major-mode-remap-alist`.
    
    However, if a user had configured keymaps for `latex-mode` using `bind-map`,
    they will not be available in `LaTeX-mode`. This is especially problematic for
    distributions like `spacemacs` which need to support users of both old and new
    AUCTeX (see syl20bnr/spacemacs#16282 for more discussion).
    
    This patch introduces two new customizable options,
    `bind-map-use-remapped-modes` and `bind-map-use-aliased-modes`. Both options
    default to `t`, in which case when `bind-map` is deciding whether to activate a
    given keymap, it will compare the value of `major-mode` to not only the symbol
    for which the keymap was configured configured (e.g., `latex-mode`), but any
    remapped or aliased modes (e.g., `'(latex-mode LaTeX-mode)`. This logic is
    implemented in the new (private) function `bind-map--lookup-major-modes` to
    facilitate lookup of applicable major-modes on the fly. As a result, if a user
    adjusts `major-mode-remap-alist` or adjusts aliased, `bind-map`'s behavior will
    change accordingly.
    dankessler committed Feb 17, 2024
    Configuration menu
    Copy the full SHA
    87a193f View commit details
    Browse the repository at this point in the history