aboutsummaryrefslogtreecommitdiff
path: root/evil-commands.el
diff options
context:
space:
mode:
authorFrank Fischer <frank.fischer@mathematik.tu-chemnitz.de>2013-01-27 13:34:26 +0100
committerFrank Fischer <frank.fischer@mathematik.tu-chemnitz.de>2013-01-27 13:34:26 +0100
commit3e758cf08b6d5acbc7478f7be6ba51407b16bfc5 (patch)
tree381e5582aa2ebdf94beb9ef3d4b0f26e90500f85 /evil-commands.el
parent67fcc0437ea8477626f89cfb4ae36ed05c58de02 (diff)
Modify hideif regexps to match #elif in `evil-jump-item`.
According to Vim, `evil-jump-item` should handle an #elif statement like an #else statement, i.e. should stop there. Unfortunately, #elif statements are ignored by hideif functions. This changeset modifies hideif's regular expressions locally so that #elif statements are matched like #else statements.
Diffstat (limited to 'evil-commands.el')
-rw-r--r--evil-commands.el23
1 files changed, 13 insertions, 10 deletions
diff --git a/evil-commands.el b/evil-commands.el
index 6a7efba..c3d494c 100644
--- a/evil-commands.el
+++ b/evil-commands.el
@@ -465,16 +465,19 @@ and jump to the corresponding one."
(memq major-mode '(c-mode c++-mode))
(require 'hideif nil t)
(with-no-warnings
- (cond
- ((or (hif-looking-at-ifX) (hif-looking-at-else))
- (hif-find-next-relevant)
- (while (hif-looking-at-ifX)
- (hif-ifdef-to-endif)
- (hif-find-next-relevant))
- t)
- ((hif-looking-at-endif)
- (hif-endif-to-ifdef)
- t)))))
+ (let* ((hif-else-regexp (concat hif-cpp-prefix "\\(?:else\\|elif[ \t]+\\)"))
+ (hif-ifx-else-endif-regexp
+ (concat hif-ifx-regexp "\\|" hif-else-regexp "\\|" hif-endif-regexp)))
+ (cond
+ ((or (hif-looking-at-ifX) (hif-looking-at-else))
+ (hif-find-next-relevant)
+ (while (hif-looking-at-ifX)
+ (hif-ifdef-to-endif)
+ (hif-find-next-relevant))
+ t)
+ ((hif-looking-at-endif)
+ (hif-endif-to-ifdef)
+ t))))))
(t
(let* ((next-open
(condition-case err