aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank Fischer <frank.fischer@mathematik.tu-chemnitz.de>2013-01-29 14:15:27 +0100
committerFrank Fischer <frank.fischer@mathematik.tu-chemnitz.de>2013-01-29 14:15:27 +0100
commitbfab6dd67a08da04bb023290bc9707cbc0872ce9 (patch)
tree0a4a5547cba9c2077f8e00642bd533888ef7bc9a
parent5da6fb157a5c26dafb01bda2df0a7827b75d0c69 (diff)
Ensure `hide-ifdef-mode` is bound before calling.
-rw-r--r--evil-commands.el30
1 files changed, 16 insertions, 14 deletions
diff --git a/evil-commands.el b/evil-commands.el
index 565c160..1224e33 100644
--- a/evil-commands.el
+++ b/evil-commands.el
@@ -2172,14 +2172,15 @@ See also `evil-close-fold'."
(with-no-warnings
(cond
((and (memq major-mode '(c-mode c++-mode))
+ (fboundp 'hide-ifdef-mode)
(hide-ifdef-mode 1)
- (string-match hif-ifx-else-endif-regexp (thing-at-point 'line)))
- (when (fboundp 'hide-ifdef-mode)
- (show-ifdef-block)))
- (t
- (when (fboundp 'hs-minor-mode)
- (hs-minor-mode 1)
- (hs-show-block))))))
+ (save-excursion
+ (beginning-of-line)
+ (looking-at hif-ifx-else-endif-regexp)))
+ (show-ifdef-block))
+ ((fboundp 'hs-minor-mode)
+ (hs-minor-mode 1)
+ (hs-show-block)))))
(evil-define-command evil-close-fold ()
"Close fold.
@@ -2187,14 +2188,15 @@ See also `evil-open-fold'."
(with-no-warnings
(cond
((and (memq major-mode '(c-mode c++-mode))
+ (fboundp 'hide-ifdef-mode)
(hide-ifdef-mode 1)
- (string-match hif-ifx-else-endif-regexp (thing-at-point 'line)))
- (when (fboundp 'hide-ifdef-mode)
- (hide-ifdef-block)))
- (t
- (when (fboundp 'hs-minor-mode)
- (hs-minor-mode 1)
- (hs-hide-block))))))
+ (save-excursion
+ (beginning-of-line)
+ (looking-at hif-ifx-else-endif-regexp)))
+ (hide-ifdef-block))
+ ((fboundp 'hs-minor-mode)
+ (hs-minor-mode 1)
+ (hs-hide-block)))))
;;; Ex