aboutsummaryrefslogtreecommitdiff
path: root/evil-search.el
AgeCommit message (Collapse)Author
2012-04-28Make highlight of search matches work with empty matchesFrank Fischer
Empty matches used to stop the highlighting of further matches. The new behavior is not to stop on empty matches but guarantees that point is moved at least one character. This addresses #140.
2012-04-27Interpret \t,\n,\r in search patternFrank Fischer
Those are replaced by their corresponding control characters as usual. This addresses #140.
2012-04-27Use `evil-transform-regexp' in `evil-ex-regex-without-case'Frank Fischer
2012-04-27Extract replacement code from `evil-transform-regexp' in own functionFrank Fischer
The code that performs the replacement of backslash codes is now contained in its own function `evil-transform-regexp', the old function `evil-transform-regexp' is being renamed to `evil-transform-vim-style-regexp' and calls `evil-transform-regexp'. This allows to use the backslash replacement in other situations, too.
2012-04-27Support vim-style regexp in interactive search and substituteFrank Fischer
Vim-style regular expressions can be enabled using the `evil-ex-search-vim-style-regexp' customization variable (default is nil). If set to non-nil, the interactive search and the ex substitute command support Vim-style backslash codes. Note that the isearch search module always uses plain Emacs regular expressions because it is backed by the Emacs isearch package. If one wants to use vim-style regexp for interactive search the evil built in search module must be enabled using the `evil-search-module' customization variable. This closes #141.
2012-02-21Implement repeat of previous ex substituteFrank Fischer
The :substitute command is extended by capabilities for repeating the previous substitute. If the pattern is empty the previous pattern is used. If the replacement equals "~" the previous replacement is used. If flags equals "&" the previous flags are added to the new flags.
2012-02-21Cleanup ex substitution codeFrank Fischer
The global variables remain unchanged during the interactive substitute. They get their new value if and only if the command is being executed. This allows to access the parameters of the previous substitution during the current interactive substitution and to handle special repeating patterns accordingly.
2012-02-21Set `evil-ex-search-offset' to nil on evil-ex-symbol-searchFrank Fischer
Such a search has never an offset.
2012-02-17Fix smartcase searchingVegard Øye
Bind `case-fold-search' according to `search-upper-case' in `evil-search'.
2012-02-09Merge with masterFrank Fischer
2012-02-08Fix handling of overlapping windows in `evil-ex-hl-update-highlights'Frank Fischer
The old implementation incorrectly handled each match for each window in which that match is visible. This resulted in multiple calls of the match-hook for each match which in turn showed duplicate replacements in interactive substitute. The new behavior is to collect all visible ranges first and compute their union afterwards. The update of the highlighting is then done w.r.t. to this union, hence each match that is visible in at least one window is handled exactly once. This fixes #104.
2012-02-08Make `evil-ex-search-update' call `evil-ex-echo' only with non-nil messageFrank Fischer
This fixes issue #105.
2012-02-04Fix usage of `evil-echo' and `evil-ex-echo'Vegard Øye
Since `format' et al. interpret "%" characters as format specifications, one should never pass an arbitrary string as the first argument of such functions. Instead, pass "%s" as the first argument and the string as the second: (format "%s" ARBITRARY-STRING) Thus, this commit replaces (evil-echo ARBITRARY-STRING) with (evil-echo "%s" ARBITRARY-STRING), and so on.
2012-01-26Ensure point remains unchanged when search failsFrank Fischer
This is now guaranteed for `evil-ex-search-start' and `evil-ex-search-next' and all functions using one of them.
2012-01-22Make ex completion use `completion-at-point' framework.Frank Fischer
That patch changes the definition of `evil-ex-define-argument-type' to be usable with the completion-at-point framework. Thus, besides activating and deactivating the argument handler, the completion of arguments must be implemented according to the variable `completion-at-point-functions'. The function `evil-ex-complete' is removed in favor for `evil-ex-completion-at-point'. The new framework allows for better selective programmed completion.
2012-01-21Quote functions with `function'Vegard Øye
According to the GNU Emacs Lisp Reference Manual, section 12.7, #' is a short-hand for `function' and serves as a note to the compiler that the argument can safely be compiled. It also works as a sort of comment when quoting the name of a function: #'SYMBOL = (function SYMBOL) = (quote SYMBOL) = 'SYMBOL Since `lambda' is defined in terms of `function', the compiler will compile unquoted `lambda' expressions anyway. Still, this convention makes the source code more readable, and is similar to the usage of #' in Common Lisp.
2012-01-17support /; search offsets (closes #50)Frank Fischer
This patch also cleans up a lot of the ex interactive search code.
2012-01-17Add `evil-ex-search-activate-highlight' which possibly highlights current ↵Frank Fischer
search matches
2012-01-13Add Ex grammarVegard Øye
Add the variable `evil-ex-grammar' for defining the minilanguage of Ex, which is passed to `evil-parser'. The function `evil-ex-update' refreshes the evaluation tree; when applicable, it also refreshes parse-specific variables like the current command, argument, etc. Furthermore, it is now possible to define key sequences that execute a command immediately when entered. Such shortcuts go in `evil-ex-map' (the completion bindings have been moved to `evil-ex-completion-map'). Note that some of the variable names have been simplified: e.g., from `evil-ex-current-cmd' to `evil-ex-command' and from `evil-ex-current-cmd-force' to `evil-ex-force'. `evil-ex-message' has been renamed to `evil-ex-echo' for consistency with `evil-echo'.
2012-01-13Fix handling of null arguments in `evil-delimited-arguments'Vegard Øye
When `evil-delimited-arguments' is unable to produce the required number of arguments, it should pad the list with nil elements.
2012-01-13Add the :global commandVegard Øye
Since :global and :substitute share argument syntax, do the parsing in the argument handler, using the function `evil-delimited-arguments' to parse any specific number of arguments.
2012-01-13Implement special replacements \L,\l,\U,\u,\E,\e and \,() in substitute ↵Frank Fischer
command (fixes #34)
2012-01-12Implement search offsets //[ebs]?[+-]?[0-9]* for evil interactive searchFrank Fischer
This addresses issue 50 except for //; and only for evil's own interactive search module, not for the isearch module.
2012-01-11Fix `evil-search-incrementally' when point is on a matchVegard Øye
Position point at the beginning of the match before comparing against the previous position. Disable highlighting when the search was done in Operator-Pending state.
2012-01-02Clean up search codeVegard Øye
Break up particularly long lines and phrase the first sentence of the docstrings in the imperative.
2012-01-10Fix case-replace bug in (interactive) substitute commandsFrank Fischer
For some reason the meaning of the global variable `case-replace' used by `perform-replace' and the FIXEDCASE argument of `match-substitute-replacement' are inverted, i.e. we have to use (not case-replace) as value for FIXEDCASE to achieve the same results.
2012-01-10Refactor interactive highlighting codeFrank Fischer
2011-12-25Make "C-g" abort search properlyVegard Øye
When "C-g" is used to abort a search, the original position of point should be restored.
2011-12-22Make buffer-local variables permanentVegard Øye
Prevent `kill-all-local-variables' from clearing Evil's buffer-local variables, by setting their `permanent-local' symbol property to t. Buffer-local variables are ordinarily cleared whenever the major mode changes, but this is inappropriate for Evil as it may prevent the current state from being exited properly (unreferenced overlays and markers, etc.). Also set the `permanent-local-hook' property for buffer-local hook functions.
2011-11-26Restructure the codeVegard Øye
Merge evil-motions.el, evil-operators.el and evil-window.el into evil-commands.el. Merge evil-insert.el, evil-visual.el and evil-replace.el into evil-states.el. Merge evil-interactive.el and evil-types.el into evil-types.el. Merge evil-compatibility.el and evil-undo.el into evil-common.el. Move macros into evil-macros.el.
2011-11-10Fix \c \C sensitivity toggle in internal interactive search.Frank Fischer
Also add some test cases.
2011-11-08Simplify `evil-ex-parse-substitute'Frank Fischer
2011-11-08search: fix update of highlighting in unrestricted caseFrank Fischer
2011-10-26Make `evil-goto-definition' search for whole symbolsVegard Øye
For consistency with "*" and "#", "gd" must enclose its search string in \_< ... \_>.
2011-10-31Support arbitrary delimiter for :substitute commandFrank Fischer
2011-10-31Fix :s substituting one line after rangeFrank Fischer
2011-09-24Fix last-line-behavior of `evil-ex-substitute'Frank Fischer
`evil-ex-substitute' now requires point is moved to the next line when moving via `forward-line' and not just to the end of the last line.
2011-09-16Remove `case' and `incf' from evil-search.elVegard Øye
These are cl.el macros, cf. commit 0b0e09e.
2011-09-07Fix interactive forms of `evil-write' and `evil-ex-substitute'Frank Fischer
Since 375b273 interactive forms of operators have to contain an explicit <R> or <r> which has not been changed in both operators.
2011-08-25Fix compiler warnings in Emacs 22Vegard Øye
Replace calls to `read-key' with `evil-read-key', which is now defined in evil-compatibility.el. Also add some `fboundp' guards where necessary.
2011-08-23Refactor `evil-define-interactive-code'Vegard Øye
Merge `evil-define-interactive-code' and `-function' into a single macro with an optional PROMPT argument. Specify command properties before the function body for consistency with other macros. Move all code definitions into evil-interactive.el and rename `evil-eval-interactive' to `evil-interactive-form' and `evil-interactive-codes-alist' to `evil-interactive-alist'.
2011-08-22Rename `evil-ex-search-word-backward' to `evil-ex-search-symbol-backward'Frank Fischer
2011-08-10Rename `evil-substitute' from evil-search.el to `evil-ex-substitute' to ↵Frank Fischer
avoid name clash.
2011-08-10fix indentationFrank Fischer
2011-08-10search: Remove all substitution overlays on error or quitFrank Fischer
Enclose interactive substitution code in (progn ...) so that `unwind-protect' is used correctly.
2011-08-10search: show status message after current substitution patternFrank Fischer
Current window and current buffer are changed to minibuffer before calling `evil-ex-message'.
2011-08-10Move extended interactive code to evil-interactive.elFrank Fischer
These macros and functions are special because they must be available at compile-time (`evil-eval-interactive' is used in `evil-define-command'). Furthermore calls to `evil-define-interactive-code' must evaluate at compile-time in order to set the variable `evil-interactive-codes-alist', which must be available whenever a code is used in a command definition.
2011-08-09search: cleanup `evil-substitute'Frank Fischer
Simplify and highlight all occurrences when replacing interactively the first match per line.
2011-08-08search: add basic interactive implementation of :substituteFrank Fischer
2011-08-05search: make ex-search motions set jump-pointsFrank Fischer