|
|
@@ -27,6 +27,8 @@
|
|
|
;; cmake-command-help Written by James Bigler
|
|
|
;;
|
|
|
|
|
|
+(require 'rst)
|
|
|
+
|
|
|
(defcustom cmake-mode-cmake-executable "cmake"
|
|
|
"*The name of the cmake executable.
|
|
|
|
|
|
@@ -263,11 +265,30 @@ optional argument topic will be appended to the argument list."
|
|
|
)
|
|
|
)
|
|
|
|
|
|
+;;;###autoload
|
|
|
+(defun cmake-command-run-help (type &optional topic buffer)
|
|
|
+ "`cmake-command-run' but rendered in `rst-mode'."
|
|
|
+ (interactive "s")
|
|
|
+ (let* ((bufname (if buffer buffer (concat "*CMake" type (if topic "-") topic "*")))
|
|
|
+ (buffer (if (get-buffer bufname) (get-buffer bufname) (generate-new-buffer bufname)))
|
|
|
+ (command (concat cmake-mode-cmake-executable " " type " " topic))
|
|
|
+ ;; Turn of resizing of mini-windows for shell-command.
|
|
|
+ (resize-mini-windows nil)
|
|
|
+ )
|
|
|
+ (shell-command command buffer)
|
|
|
+ (save-selected-window
|
|
|
+ (select-window (display-buffer buffer 'not-this-window))
|
|
|
+ (rst-mode)
|
|
|
+ (read-only-mode 1)
|
|
|
+ (view-mode 1))
|
|
|
+ )
|
|
|
+ )
|
|
|
+
|
|
|
;;;###autoload
|
|
|
(defun cmake-help-list-commands ()
|
|
|
"Prints out a list of the cmake commands."
|
|
|
(interactive)
|
|
|
- (cmake-command-run "--help-command-list")
|
|
|
+ (cmake-command-run-help "--help-command-list")
|
|
|
)
|
|
|
|
|
|
(defvar cmake-commands '() "List of available topics for --help-command.")
|
|
|
@@ -293,7 +314,7 @@ and store the result as a list in LISTVAR."
|
|
|
(if (not (symbol-value listvar))
|
|
|
(let ((temp-buffer-name "*CMake Temporary*"))
|
|
|
(save-window-excursion
|
|
|
- (cmake-command-run (concat "--help-" listname "-list") nil temp-buffer-name)
|
|
|
+ (cmake-command-run-help (concat "--help-" listname "-list") nil temp-buffer-name)
|
|
|
(with-current-buffer temp-buffer-name
|
|
|
; FIXME: Ignore first line if it is "cmake version ..." from CMake < 3.0.
|
|
|
(set listvar (split-string (buffer-substring-no-properties (point-min) (point-max)) "\n" t)))))
|
|
|
@@ -327,25 +348,25 @@ and store the result as a list in LISTVAR."
|
|
|
(defun cmake-help-command ()
|
|
|
"Prints out the help message for the command the cursor is on."
|
|
|
(interactive)
|
|
|
- (cmake-command-run "--help-command" (cmake-help-type "command") "*CMake Help*"))
|
|
|
+ (cmake-command-run-help "--help-command" (cmake-help-type "command") "*CMake Help*"))
|
|
|
|
|
|
;;;###autoload
|
|
|
(defun cmake-help-module ()
|
|
|
"Prints out the help message for the module the cursor is on."
|
|
|
(interactive)
|
|
|
- (cmake-command-run "--help-module" (cmake-help-type "module") "*CMake Help*"))
|
|
|
+ (cmake-command-run-help "--help-module" (cmake-help-type "module") "*CMake Help*"))
|
|
|
|
|
|
;;;###autoload
|
|
|
(defun cmake-help-variable ()
|
|
|
"Prints out the help message for the variable the cursor is on."
|
|
|
(interactive)
|
|
|
- (cmake-command-run "--help-variable" (cmake-help-type "variable") "*CMake Help*"))
|
|
|
+ (cmake-command-run-help "--help-variable" (cmake-help-type "variable") "*CMake Help*"))
|
|
|
|
|
|
;;;###autoload
|
|
|
(defun cmake-help-property ()
|
|
|
"Prints out the help message for the property the cursor is on."
|
|
|
(interactive)
|
|
|
- (cmake-command-run "--help-property" (cmake-help-type "property") "*CMake Help*"))
|
|
|
+ (cmake-command-run-help "--help-property" (cmake-help-type "property") "*CMake Help*"))
|
|
|
|
|
|
;;;###autoload
|
|
|
(defun cmake-help ()
|
|
|
@@ -368,13 +389,13 @@ and store the result as a list in LISTVAR."
|
|
|
(if (string= input "")
|
|
|
(error "No argument given")
|
|
|
(if (member input command-list)
|
|
|
- (cmake-command-run "--help-command" input "*CMake Help*")
|
|
|
+ (cmake-command-run-help "--help-command" input "*CMake Help*")
|
|
|
(if (member input variable-list)
|
|
|
- (cmake-command-run "--help-variable" input "*CMake Help*")
|
|
|
+ (cmake-command-run-help "--help-variable" input "*CMake Help*")
|
|
|
(if (member input module-list)
|
|
|
- (cmake-command-run "--help-module" input "*CMake Help*")
|
|
|
+ (cmake-command-run-help "--help-module" input "*CMake Help*")
|
|
|
(if (member input property-list)
|
|
|
- (cmake-command-run "--help-property" input "*CMake Help*")
|
|
|
+ (cmake-command-run-help "--help-property" input "*CMake Help*")
|
|
|
(error "Not a know help topic.") ; this really should not happen
|
|
|
))))))
|
|
|
)
|