summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilipp Möller <bootsarehax@googlemail.com>2014-01-29 15:25:01 (GMT)
committerBrad King <brad.king@kitware.com>2014-02-13 14:35:30 (GMT)
commit7cc21e9ab82883d37e845203f89255a90747489e (patch)
tree77f80d7b07c877e4ade6be02eebcfca8dd05c8cf
parentc56854aa0e9ba08140fcf806008ea473b879a1c1 (diff)
downloadCMake-7cc21e9ab82883d37e845203f89255a90747489e.zip
CMake-7cc21e9ab82883d37e845203f89255a90747489e.tar.gz
CMake-7cc21e9ab82883d37e845203f89255a90747489e.tar.bz2
cmake-mode.el: Add the ability to retrieve module help.
-rw-r--r--Auxiliary/cmake-mode.el31
1 files changed, 31 insertions, 0 deletions
diff --git a/Auxiliary/cmake-mode.el b/Auxiliary/cmake-mode.el
index 433710b..023d98e 100644
--- a/Auxiliary/cmake-mode.el
+++ b/Auxiliary/cmake-mode.el
@@ -328,6 +328,37 @@ optional argument topic will be appended to the argument list."
(interactive)
(cmake-command-run "--help-command" (downcase (cmake-get-command)) "*CMake Help*"))
+(defvar cmake-help-module-history nil "Module read history.")
+(defvar cmake-help-modules '() "List of available topics for --help-module.")
+
+(defun cmake-module-list ()
+ (let ((temp-buffer-name "*CMake Modules Temporary*"))
+ (save-window-excursion
+ (cmake-command-run "--help-module-list" nil temp-buffer-name)
+ (with-current-buffer temp-buffer-name
+ (cdr (split-string (buffer-substring-no-properties (point-min) (point-max)) "\n" t)))))
+ )
+
+(defun cmake-get-module ()
+ (let ((input (completing-read
+ "CMake module: " ; prompt
+ ((lambda ()
+ (if cmake-help-modules cmake-help-modules
+ (setq cmake-help-modules (cmake-module-list))))) ; completions
+ nil ; predicate
+ t ; require-match
+ nil ; initial-input
+ 'cmake-help-module-history ; module history
+ )))
+ (if (string= input "")
+ (error "No argument given")
+ input)
+ ))
+
+(defun cmake-help-module ()
+ "Prints out the help message corresponding to the given module."
+ (interactive)
+ (cmake-command-run "--help-module" (cmake-get-module) "*CMake Module Help*"))
;;;###autoload
(progn