summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Cole <david.cole@kitware.com>2012-09-25 19:17:35 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2012-09-25 19:17:35 (GMT)
commit8e29b375c415a77b41e41b3d98cb6e66aad3e2d5 (patch)
tree61e87a1b2b1212805291c4634289cae3066f5ae6
parentf5513f93bf8aa1e5c59334012abe9c1a01e06eda (diff)
parent301e67e3baae5ee3471f34216c7839a517f2d32c (diff)
downloadCMake-8e29b375c415a77b41e41b3d98cb6e66aad3e2d5.zip
CMake-8e29b375c415a77b41e41b3d98cb6e66aad3e2d5.tar.gz
CMake-8e29b375c415a77b41e41b3d98cb6e66aad3e2d5.tar.bz2
Merge topic 'UpdateEmacsMode-bug0013548'
301e67e cmake-mode.el: add local keybindings 6d1e4ef cmake-mode.el: Use more readable regex and case-fold-search
-rw-r--r--Docs/cmake-mode.el23
1 files changed, 20 insertions, 3 deletions
diff --git a/Docs/cmake-mode.el b/Docs/cmake-mode.el
index 478bc7a..6feed94 100644
--- a/Docs/cmake-mode.el
+++ b/Docs/cmake-mode.el
@@ -68,9 +68,9 @@ set the path with these commands:
"\\|" "[ \t\r\n]"
"\\)*"))
(defconst cmake-regex-block-open
- "^\\([iI][fF]\\|[mM][aA][cC][rR][oO]\\|[fF][oO][rR][eE][aA][cC][hH]\\|[eE][lL][sS][eE]\\|[eE][lL][sS][eE][iI][fF]\\|[wW][hH][iI][lL][eE]\\|[fF][uU][nN][cC][tT][iI][oO][nN]\\)$")
+ "^\\(if\\|macro\\|foreach\\|else\\|elseif\\|while\\|function\\)$")
(defconst cmake-regex-block-close
- "^[ \t]*\\([eE][nN][dD][iI][fF]\\|[eE][nN][dD][fF][oO][rR][eE][aA][cC][hH]\\|[eE][nN][dD][mM][aA][cC][rR][oO]\\|[eE][lL][sS][eE]\\|[eE][lL][sS][eE][iI][fF]\\|[eE][nN][dD][wW][hH][iI][lL][eE]\\|[eE][nN][dD][fF][uU][nN][cC][tT][iI][oO][nN]\\)[ \t]*(")
+ "^[ \t]*\\(endif\\|endforeach\\|endmacro\\|else\\|elseif\\|endwhile\\|endfunction\\)[ \t]*(")
;------------------------------------------------------------------------------
@@ -126,6 +126,7 @@ set the path with these commands:
(beginning-of-line)
(let ((point-start (point))
+ (case-fold-search t) ;; case-insensitive
token)
; Search back for the last indented line.
@@ -229,13 +230,26 @@ the indentation. Otherwise it retains the same position on the line"
;;
(defvar cmake-tab-width 2)
+;;
+;; Keymap.
+;;
+(defvar cmake-mode-map
+ (let ((map (make-sparse-keymap)))
+ (define-key map "\C-ch" 'cmake-help-command)
+ (define-key map "\C-cl" 'cmake-help-list-commands)
+ (define-key map "\C-cu" 'unscreamify-cmake-buffer)
+ map)
+ "Keymap used in cmake-mode buffers.")
+
;------------------------------------------------------------------------------
;;
;; CMake mode startup function.
;;
(defun cmake-mode ()
- "Major mode for editing CMake listfiles."
+ "Major mode for editing CMake listfiles.
+
+\\{cmake-mode-map}"
(interactive)
(kill-all-local-variables)
(setq major-mode 'cmake-mode)
@@ -262,6 +276,9 @@ the indentation. Otherwise it retains the same position on the line"
(make-local-variable 'comment-start)
(setq comment-start "#")
+ ; Setup keymap.
+ (use-local-map cmake-mode-map)
+
; Run user hooks.
(run-hooks 'cmake-mode-hook))