diff options
| author | Frank Fischer <frank.fischer@mathematik.tu-chemnitz.de> | 2013-01-29 14:15:27 +0100 |
|---|---|---|
| committer | Frank Fischer <frank.fischer@mathematik.tu-chemnitz.de> | 2013-01-29 14:15:27 +0100 |
| commit | bfab6dd67a08da04bb023290bc9707cbc0872ce9 (patch) | |
| tree | 0a4a5547cba9c2077f8e00642bd533888ef7bc9a | |
| parent | 5da6fb157a5c26dafb01bda2df0a7827b75d0c69 (diff) | |
Ensure `hide-ifdef-mode` is bound before calling.
| -rw-r--r-- | evil-commands.el | 30 |
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 |
