Stefan Monnier [Tue, 24 Nov 2015 21:06:06 +0000 (16:06 -0500)]
* sm-c-mode: Improve indentation of struct; plus bug fixes
* packages/sm-c-mode/GNUmakefile: New file.
* packages/sm-c-mode/sm-c-mode-test.c: Add some "struct" tests.
Plus a #include.
* packages/sm-c-mode/sm-c-mode.el (sm-c-syntax-propertize): Mark the <...>
of #include as a string.
(sm-c-smie--*-token): Try not to look too far back.
(sm-c-smie-rules): Indent the {...} of struct and enum definitions.
(sm-c--bs-realign-1): Fix behavior at EOB.
(sm-c--cpp-is-not-really-a-comment): New function.
(comment-only-p): Use it.
* sm-c-mode/sm-c-mode.el: Auto-align backslashes. Improve indent rules.
(sm-c--cpp-indent-comment-inside): New function.
(sm-c--cpp-smie-indent-functions): Use it.
(sm-c--cpp-smie-indent): Handle indentation within comments-within-cpp.
(sm-c-smie-grammar): Manually tweak precedence of ":label".
(sm-c-smie-operator-regexp): Parentheses aren't operators.
(sm-c--boi): Add `inner' arg.
(sm-c--boe): Complete the code.
(sm-c-smie--*-token): Refine.
(sm-c-smie-rules): Various tweaks based on tests on src/eval.c and
src/xdisp.c.
(sm-c--bs-changed): New var.
(sm-c--bs-after-change, sm-c--bs-realign, sm-c--bs-realign-1):
New functions.
(sm-c-mode): Use them.
* sm-c-mode/sm-c-mode-test.c: Add a few more cases.
Oleh Krehel [Tue, 24 Nov 2015 11:09:37 +0000 (12:09 +0100)]
Fix broken candidate index in ivy-resume
* ivy.el (ivy--reset-state): When given initial-input, call
`ivy--preselect-index' on candidates filtered by initial-input. This
is important for `ivy-resume'.
Oleh Krehel [Sun, 22 Nov 2015 12:59:27 +0000 (13:59 +0100)]
Perform string-match in the original buffer
* ivy.el (ivy--exhibit): Wrap in `with-current-buffer'
`ivy-state-buffer'.
(ivy-recompute-index-swiper): Reset to the candidate at the current line
number, in case the previous regex resulted in 0 candidates.
Oleh Krehel [Fri, 20 Nov 2015 12:13:40 +0000 (13:13 +0100)]
Fix the preselect for (swiper "one")
* ivy.el (ivy--reset-state): Ignore INITIAL-INPUT on the first
step. Then all `ivy--filter' on the second step.
(ivy--preselect-index): Change arglist. No longer takes INITIAL-INPUT.
(ivy--recompute-index): Update the call to `ivy--preselect-index'.
Oleh Krehel [Wed, 18 Nov 2015 10:55:45 +0000 (11:55 +0100)]
Switch to using ivy-exit-with-action
* ivy.el (ivy-exit-with-action): Add a missing quote.
(ivy--cd-maybe): Use `ivy-exit-with-action'.
* counsel.el (counsel-find-symbol):
(counsel--info-lookup-symbol):
(counsel-git-grep-query-replace): Use `ivy-exit-with-action'.
* swiper.el (swiper-query-replace):
(swiper-mc): Use `ivy-exit-with-action'.
The previous approach was overwriting the action list, so when
`ivy-resume' was called, only a single action was present. The new
approach doesn't have this bug.
So now it's possible to e.g. `counsel-describe-function' -> "M-o d" ->
`ivy-resume' -> "M-o o" -> `ivy-resume' -> "M-o i".
Oleh Krehel [Tue, 17 Nov 2015 07:27:39 +0000 (08:27 +0100)]
swiper.el: Modify the behavior with org-mode and visual-line-mode
* swiper.el (swiper--candidates): Set `swiper-use-visual-line' even for
`org-mode'. In that case, reveal all text to prevent `line-move'
weirdness.
(swiper--ivy): Use `swiper-use-visual-line'.
Oleh Krehel [Mon, 16 Nov 2015 11:50:42 +0000 (12:50 +0100)]
Intermediate fix for :preselect with visual-line-mode
* swiper.el (swiper--ivy): Use `beginning-of-visual-line' and
`end-of-visual-line'. This should fix the preselect problem for
non-duplicate buffer lines.
For duplicate buffer lines, a `visual-line-number-at-pos' function is
necessary. I don't currently know how to implement such a function in an
efficient way. The naive implementation could be pretty inefficient,
comparable to doubling `swiper' startup time with `visual-line-mode'.
Eli Zaretskii [Sat, 14 Nov 2015 15:51:45 +0000 (17:51 +0200)]
Support reading debbugs email exchange with Rmail
* packages/debbugs/debbugs-gnu.el: Version: bump to 0.8.
(debbugs-gnu-mail-backend): New defcustom.
(debbugs-read-emacs-bug-with-rmail): New function.
(debbugs-gnu-select-report): Call it if debbugs-gnu-mail-backend
is set to use Rmail.
* packages/debbugs/debbugs-ug.texi (Tabulated Lists): Describe the
new option 'debbugs-gnu-mail-backend'.
Oleh Krehel [Sat, 14 Nov 2015 15:27:41 +0000 (16:27 +0100)]
swiper.el (swiper-all): New command to swiper all file buffers
* swiper.el (swiper--candidates): Add NUMBERS-WIDTH arg. It could be
done better by calculating the line count of each buffer and then
getting the max of that, but this way is faster, since the collections
are traversed only once.
(swiper-multi): Update.
(swiper-all): New command. This is like `swiper-multi' where the buffer
list is pre-selected to be all file visiting buffers.
(swiper--multi-candidates): New defun.
(swiper-multi-action-1): Use `swiper--multi-candidates'.
(swiper-multi-action-2): Update - the line number is in the 'display
property of the first char.
Oleh Krehel [Fri, 13 Nov 2015 14:37:15 +0000 (15:37 +0100)]
Allow user-specified matched candidate sorting
* ivy.el (ivy-prefix-sort): Remove defcustom.
(ivy--filter): Forward sorting of matched candidates to `ivy--sort'.
(ivy-sort-matches-functions-alist): New defcustom.
(ivy--sort): New defun.
Oleh Krehel [Fri, 13 Nov 2015 14:04:56 +0000 (15:04 +0100)]
ivy.el (ivy-prefix-sort): New defcustom, off by default for now
* ivy.el (ivy--filter): When `ivy-prefix-sort' is non-nil, additionally
sort the matching candidates with `ivy--prefix-sort'.
(ivy--prefix-sort): New defun.
Oleh Krehel [Wed, 11 Nov 2015 14:47:02 +0000 (15:47 +0100)]
Allow counsel-git-grep -> ivy-occur -> wgrep
* ivy.el (ivy-exit-with-action): New defun.
(ivy-occur-action): Remove defvar. It's part of `ivy-occur-last' now.
(ivy-occur-last): Update doc.
(ivy-occur-map): Rename to `ivy-occur-mode-map'.
(ivy-occur-mode): New major mode.
(ivy-occur): When the caller is `counsel-git-grep', enter `grep-mode';
otherwise enter the new `ivy-occur-mode'.
For `wgrep' to work, two things are changed: candidates need to start on
the 5th line, and candidates need to be prefixed with "./".
(ivy-occur-read-action): New command, bound to "a".
(ivy-occur-dispatch): New command, bound to "o".
(ivy-occur-press): Update to work with `grep-mode'.
(ivy-occur-grep-mode-map): New defvar.
(ivy-occur-grep-mode): New major mode. Basically, it's grep-mode with
"C-x C-q" bound to `wgrep-change-to-wgrep-mode'.
Oleh Krehel [Wed, 11 Nov 2015 11:01:43 +0000 (12:01 +0100)]
swiper.el (swiper-toggle-face-matching): Add and bind to "C-c C-f"
* swiper.el (swiper-map): Bind `swiper-toggle-face-matching' to
"C-c C-f".
(swiper-invocation-face): New defvar.
(swiper--ivy): Set `swiper-invocation-face'.
(swiper-toggle-face-matching): Toggle `ivy-state-matcher' between
nil (the initial value) and 'swiper--face-matcher.
(swiper--face-matcher): New defun. In addition to filtering CANDIDATES
by having them match REGEXP, also ensure that every match has
`swiper-invocation-face'.
Example of usage:
1. Move point to a variable with e.g. `font-lock-keyword-face' and "C-s"
<input>.
2. Use "C-c C-f" to filter the candidates further by selecting only the
ones that have `font-lock-keyword-face'.
Note that "M-q" (`swiper-query-replace') is also affected by the filtering.
Oleh Krehel [Thu, 5 Nov 2015 13:42:36 +0000 (14:42 +0100)]
Add a better ivy-occur pulse to swiper and counsel-git-grep
* ivy.el (ivy-occur-press): Bind `ivy-exit' to 'done, so that
`swiper--add-overlays' called by ACTION don't do anything.
Call another `swiper--add-overlays' for swiper and counsel-git-grep,
limited to the current line. Call `swiper--cleanup' with a delay of 1
second.