aboutsummaryrefslogtreecommitdiff
path: root/evil-core.el
AgeCommit message (Collapse)Author
2024-09-15Replace uses of `defadvice` with `advice-add`Stefan Monnier
This either requires a dependency on the `nadvice` package, or bumping the minimum Emacs version to 24.4. I went with the `nadvice` package, but maybe bumping up to 24.4 would be better. * evil.el: Require `nadvice`. * evil-core.el (evil--advices): New var. (evil-mode): Use it instead of `ad-dis/enable`. (evil--advice-add): New function. (set-window-buffer, select-window, toggle-input-method, use-global-map): * evil-search.el (isearch-message-prefix, isearch-delete-char) (isearch-lazy-highlight-search): * evil-integration.el (keyboard-quit, wdired-change-to-dired-mode) (show-paren-function, quail-show-key, describe-char, ace-jump-done): Use `(evil--)advice-add` instead of `defadvice`. (preceding-sexp, pp-last-sexp): Remove old code for when `advice-add` is not available. * evil-repeat.el (evil--read-key-sequence-advice): Adapt to use in `advice-add`. (read-key-sequence, read-key-sequence-vector): Use `advice-add`. * evil-keybindings.el (elp-results): Use `advice-add` and move outside of `eval-after-load`.
2024-06-18Fix cursor colourfnussbaum
Fixes #502, fixes #1835. Refreshing the cursor when changing the evil state is only needed (or almost only, see below) when the current buffer is displayed in the selected window. If this is not the case, and the buffer is only displayed or its window selected at some later point in time, then `evil-refresh-cursor` will be called as part of the `window-configuration-change-hook` or as advice to `select-window`. However, this introduces the following tiny (and maybe acceptable?) regression: When doing something like ```elisp (with-current-buffer (some-buffer-displayed-in-another-window) (some-evil-state-with-a-different-cursor-type)) ``` the cursor will not be refreshed in the other window before selecting it. The cursor colour should indeed not be refreshed, because it is defined for the whole frame; however, the cursor type should in principle be changed, as it is defined per buffer and also defines the shape of the cursor in non-selected windows. There exist different ways to also handle this case, but they mostly seem ugly or needlessly complicated to me. I think the most elegant way to fix this would involve implementing per-buffer cursor colors in Emacs (as suggested in https://debbugs.gnu.org/cgi/bugreport.cgi?bug=24153d). What do you think?
2024-01-11Added clarification to evil-define-key for escaping modifier keys (#1856)Naokotani
* Added clarification to evil-define-key for escaping modifier keys It is useful to have clarification in the doc string for evil-define-key that it is necessary to escape modifiers keys for users that are accustomed to using functions like global-set-key or keymap-global-set where this is not necessary. This is also not made particularly clear in the define-key function itself, which is a legacy function. * Fixed poor wording and used kdb in place of escape sequence
2023-12-13Fix define-globalized-minor-mode BODY in Emacs <27Axel Forsman
This commit reintroduces the evil-mode advice that commit f003ca28a9691d24a17866e5dce3e7866c9bb257 replaced with a BODY argument to define-globalized-minor-mode, as that broke support for older versions of Emacs since the BODY parameter was only recently introduced in Emacs 27.
2023-08-20Some cleanupsAxel Forsman
2023-08-20Misc minor changesStefan Monnier
* README.md: Mention that `undo-fu` is also in NonGNU ELPA and update its repository URL. * evil.el: Update the undo-fu repository URL. * evil-macros.el (evil-define-interactive-code): Move the insertion of quote around `func` to the `cond` so the `quote` is not incorrectly added around lambda forms. * evil-tests.el: Add a FIXME. * evil-commands.el (evil-save-side-windows): Silence spurious warning.
2023-08-20Merge evil-with-delay condition and body lambdasAxel Forsman
This commit makes evil-with-delay generated code work using a single lambda that returns the result of condition, running body if non-nil. This way the byte compiler sees that body is guarded by condition, which fixes the FIXME.
2023-08-20(evil-with-delay): New macro, extracted from `evil-delay`Stefan Monnier
Save some kittens by using a macro instead of using `eval`. This also exposes more code to the compiler, so should result in more efficient code and potentially better compiler warnings. * evil-common.el (evil-unquote): Delete unused function. (evil--with-delay): New function, extracted from `evil-delay`. (evil-with-delay): New macro, extracted from `evil-delay`. (evil-delay): Redefine using `evil-with-delay` and declare obsolete. * evil-states.el (evil-visual-activate-hook): * evil-core.el (evil-define-key): * evil-commands.el (evil-execute-in-normal-state): Use `evil-with-delay`.
2023-08-13Urgent revert of recent commits while evil is brokenTom Dalziel
Some of these commits can be almost immediately restored, once the time is found to do so. Revert "Fix evil-with-delay with dynamic binding" This reverts commit 1e9b2434264529fe0dd964b68fe89236a4abeac3. Revert "Some cleanups" This reverts commit 0cbd61f2de104fab16602d0418605cd0513b16f3. Revert "Misc minor changes" This reverts commit b291039b0c6ffc3b2f3c9f02b8ad2f0041127b12. Revert "Merge evil-with-delay condition and body lambdas" This reverts commit 1b56ffcc102b4c5f8b015e760b5f9cf5932622af. Revert "(evil-with-delay): New macro, extracted from `evil-delay`" This reverts commit 3d7faadf30016a8c20699a5fb1b5731b8a49dcd2. Revert "Make evil-search-wrap-ring-bell work with evil-search" This reverts commit 5e72cf5b6d57b785ea229236bb5c4638db2c9a05. Revert "Stop the '</'> and '[/'] marks from intertwining" This reverts commit 26db9441a13ebedb2481d7ada4c3b5e60ec22795. Revert "Remove redundant `:group` args" This reverts commit 6e30037fdc6a275d78d6b82d89bd8e47bcf4d4e3. Revert "Avoid eval in evil-test-buffer" This reverts commit 27d81ad406d2d3e07591b927357d2354ef5b5c65. Revert "Use lexical-binding everywhere" This reverts commit 44c7f301468c264a781be4ee8ae879fe1b457e60.
2023-08-12Some cleanupsAxel Forsman
2023-08-12Misc minor changesStefan Monnier
* README.md: Mention that `undo-fu` is also in NonGNU ELPA and update its repository URL. * evil.el: Update the undo-fu repository URL. * evil-macros.el (evil-define-interactive-code): Move the insertion of quote around `func` to the `cond` so the `quote` is not incorrectly added around lambda forms. * evil-tests.el: Add a FIXME. * evil-commands.el (evil-save-side-windows): Silence spurious warning.
2023-08-12Merge evil-with-delay condition and body lambdasAxel Forsman
This commit makes evil-with-delay generated code work using a single lambda that returns the result of condition, running body if non-nil. This way the byte compiler sees that body is guarded by condition, which fixes the FIXME.
2023-08-12(evil-with-delay): New macro, extracted from `evil-delay`Stefan Monnier
Save some kittens by using a macro instead of using `eval`. This also exposes more code to the compiler, so should result in more efficient code and potentially better compiler warnings. * evil-common.el (evil-unquote): Delete unused function. (evil--with-delay): New function, extracted from `evil-delay`. (evil-with-delay): New macro, extracted from `evil-delay`. (evil-delay): Redefine using `evil-with-delay` and declare obsolete. * evil-states.el (evil-visual-activate-hook): * evil-core.el (evil-define-key): * evil-commands.el (evil-execute-in-normal-state): Use `evil-with-delay`.
2023-08-07Better follow conventions for ' in docstringsStefan Monnier
Also try and make the docstring fit within 80 columns. This fixes some incorrect uses and eliminates some warnings.
2023-07-17Read Ex commands from bufferAxel Forsman
When lexing a string with string-match and its START argument, there is no way to anchor matches to the START position. Instead, one must either allocate substrings - as done prior to commit 56b43b6f7e014e905f85df1c542c67f46ea99566 - or use looking-at etc., instead. This commit opts for the latter. The Ex completion-at-point functions are also rewritten in order to avoid having to add ex-index text properties to the command string, since evil--ex-syntactic-context could be extended to provide that information just as easily.
2023-07-09Autoload evil-digraphAxel Forsman
2023-07-02Store command properties as symbol propertyAxel Forsman
Also replace a few calls to evil-filter-list that destructively modified user-provided lists with cl-remove-if.
2023-06-25Small cleanupsAxel Forsman
* Deprecate evil-loop since it is too niche, and manages makes evil-motion-loop less readable. * Use separate setq-local calls for each variable/value pair, since the combined form does not exist in Emacs versions <=25.3.
2023-03-17Restore the input method on deactivation of evil-local-modeibbem
This ensures that the input method after deactivating evil-local-mode is the same as the input method used for states with a non-nil :input-method property. This issue was discovered while investigating why the input method couldn't be set by the agda2-mode while evil was active [1]. As the change in major mode (to agda2-mode) caused evil-local-mode to be disabled and reenabled by `define-globalized-minor-mode evil-mode`, the input method was lost because the default state (i.e. normal state) does have an :input-method property of nil. In summary this patch fixes the approach used by agda2-mode [2] and the official recommendation in the Emacs manual [3], e.g. (add-hook 'text-mode-hook (lambda () (set-input-method "german-prefix"))) [1]: https://github.com/agda/agda/issues/2141 [2]: https://github.com/agda/agda/blob/37554c46cbd770fa630f9b164e2b543506acbdbc/src/data/emacs-mode/agda2-mode.el#L432 [3]: https://www.gnu.org/software/emacs/manual/html_node/emacs/Select-Input-Method.html
2023-01-28Specialize evil-sort for case of two argumentsAxel Forsman
All current uses of evil-sort only pass two arguments, for which a conditional swap suffices. Also replace the implementation of evil-swap with cl-rotatef, since that is built-in and produces marginally better code for three or more variables.
2023-01-12Use extended-format menu item for leader bindingsAxel Forsman
This fixes the issue of the evil-send-(local-)leader commands being recognized as the motion while in Operator-pending state. Additionally, describe-key (C-h k) can now be used to lookup keybindings using leader. Note that simply binding [(local-)leader] keyboard macros would not work, since then the command would not receive the prefix argument. Closes #1711
2023-01-12Fix evil-set-leader with nil state argumentAxel Forsman
The predicate (listp state) is true also for the value nil of state, meaning the correct clause with all-states was never considered. Closes #1383
2023-01-10Fix Fundamental mode hackAxel Forsman
This commit fixes some issues surrounding the initialization of Evil. First of all, since GNU Emacs 26.1 major mode hooks actually do run in Fundamental mode buffers. In any case, manually enabling fundamental-mode correctly instead of turn-on-evil-mode (by setting major-mode default) successfully enables evil-local-mode, as major mode hooks then run. The major-mode variable also never needed to be reset; it is the job of the major mode to set it, as it starts off as fundamental-mode regardless of its default value. Secondly, while some hooks and variables set up by evil-local-mode were marked as permanent, this did not matter as evil-initialize unconditionally reinitialized evil-local-mode whenever the major mode changed. Fixed by marking them all as permanent and not executing evil-local-mode if it is already enabled. Closes #1268, closes #1561
2022-12-29evil-core: don't change match data in the advice of set-window-bufferLin Sun
2022-10-13Fix compiler warningsTom Dalziel
2022-09-29doc: follow the Emacs Lisp Style Guidedalu
2022-08-16Keep using the old input method in evil-local-modeSimon Nicolussi
2022-04-25Bump version to 1.15.0Tom Dalziel
2021-06-15evil-core: refactored `evil-get-auxiliary-keymap` (#1478)Lucius Hu
* evil-core: refactored `evil-get-auxiliary-keymap` In `evil-get-auxilliary-keymap`, there's already a check on `state` when entering the function. Should `state` be `nil`, it won't enter the `let*` form. Hence the binding specification `(aux (if state (lookup-key map key) map))` always reduces to `(aux (lookup-key map key))` This commit removed unnecessary `if` form. * minor changes
2021-01-09Add missing indent declaration to evil-define-key*David Wilson
2020-04-17fix evil-send-localleaderYunhao Zhao
2020-03-04Bump version to 1.14.01.14.0Eivind Fonn
2020-02-24fix evil-define-state :exit-hook typosergey
2020-02-22Deprecate evil-add-to-alist, which doesn't work with lexicalEivind Fonn
2020-02-03Clean up compilation warnings from lexical bindingEivind Fonn
2020-01-29Re-enable lexical bindingEivind Fonn
This reverts commit e9391ae769bee189ef6144b8861b117d5c948a80, and removes spurious debug messages.
2020-01-28Revert "Enable lexical binding"Eivind Fonn
This reverts commit c6086a7b0b44963071096e3ed7545f617de88915.
2020-01-28Enable lexical bindingEivind Fonn
2020-01-13Revert "Enable undo-tree-mode only when evil-mode is turned on"Eivind Fonn
2020-01-13Enable undo-tree-mode only when evil-mode is turned onEivind Fonn
2019-12-31Docs: fix use of \\[...] to display key sequencesEivind Fonn
2019-12-30Different mode line tags per visual state typeEivind Fonn
Fix #1180
2019-12-21Document leader key functionalityEivind Fonn
2019-12-19Improve some docstringsEivind Fonn
2019-12-18Bump version to 1.13.0Eivind Fonn
Version 1.2.15 was accidentally tagged as 1.12.15, and released as such by MELPA Stable, so now I guess we have to run with it.
2019-12-11Bump version to 1.3.0-snapshotEivind Fonn
2019-12-11Bump version to 1.2.151.2.15Eivind Fonn
2019-11-29evil-core.el: Add <leader> functionalityJustin Burkett
Add evil-send-leader and evil-send-localleader which will push the symbol <leader> or <localleader> into the unread-command-events list. This allows one to bind a key to evil-send-leader to make it a leader key and activate bindings like the following. (defun hi () (interactive) (message "hi")) (define-key evil-normal-state-map (kbd "<leader> h") 'hi) For convenience, evil-set-leader can be used as follows (evil-set-leader 'normal (kbd "C-c")) An optional argument makes it a localleader.
2019-11-19Declare documentation stringsAlexander Shukaev
2019-01-04Bump version to 1.2.141.2.14Eivind Fonn