summaryrefslogtreecommitdiffstats
path: root/Auxiliary
diff options
context:
space:
mode:
authorPhilipp Möller <bootsarehax@googlemail.com>2014-01-28 21:57:49 (GMT)
committerPhilipp Möller <bootsarehax@googlemail.com>2014-01-29 15:11:40 (GMT)
commit2a1314150e8fa2b7e8354e4ecffccf3439ab2d28 (patch)
tree00d191aeb18f1ec5cf134d3cb3cb8f9c942a0f84 /Auxiliary
parent2816ffae903de283c134a457c8d6c48aa3ab1305 (diff)
downloadCMake-2a1314150e8fa2b7e8354e4ecffccf3439ab2d28.zip
CMake-2a1314150e8fa2b7e8354e4ecffccf3439ab2d28.tar.gz
CMake-2a1314150e8fa2b7e8354e4ecffccf3439ab2d28.tar.bz2
cmake-mode.el: Clean up cmake-command-run and add buffername argument
Diffstat (limited to 'Auxiliary')
-rw-r--r--Auxiliary/cmake-mode.el43
1 files changed, 13 insertions, 30 deletions
diff --git a/Auxiliary/cmake-mode.el b/Auxiliary/cmake-mode.el
index 119168d..2304615 100644
--- a/Auxiliary/cmake-mode.el
+++ b/Auxiliary/cmake-mode.el
@@ -266,38 +266,22 @@ the indentation. Otherwise it retains the same position on the line"
;;;###autoload
-(defun cmake-command-run (type &optional topic)
+(defun cmake-command-run (type &optional topic buffer)
"Runs the command cmake with the arguments specified. The
optional argument topic will be appended to the argument list."
(interactive "s")
- (let* ((bufname (concat "*CMake" type (if topic "-") topic "*"))
- (buffer (get-buffer bufname))
+ (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)
)
- (if buffer
- (display-buffer buffer 'not-this-window)
- ;; Buffer doesn't exist. Create it and fill it
- (let ((buffer (generate-new-buffer bufname))
- (command (concat cmake-mode-cmake-executable " " type " " topic))
- )
- (message "Running %s" command)
- ;; We don't want the contents of the shell-command running to the
- ;; minibuffer, so turn it off. A value of nil means don't automatically
- ;; resize mini-windows.
- (setq resize-mini-windows-save resize-mini-windows)
- (setq resize-mini-windows nil)
- (shell-command command buffer)
- ;; Save the original window, so that we can come back to it later.
- ;; save-excursion doesn't seem to work for this.
- (setq window (selected-window))
- ;; We need to select it so that we can apply special modes to it
- (select-window (display-buffer buffer 'not-this-window))
- (cmake-mode)
- (toggle-read-only t)
- ;; Restore the original window
- (select-window window)
- (setq resize-mini-windows resize-mini-windows-save)
- )
- )
+ (shell-command command buffer)
+ (save-selected-window
+ (select-window (display-buffer buffer 'not-this-window))
+ (cmake-mode)
+ (toggle-read-only t))
+ (setq resize-mini-windows resize-mini-windows-save)
)
)
@@ -327,12 +311,11 @@ optional argument topic will be appended to the argument list."
input))
)
-
;;;###autoload
(defun cmake-help-command ()
"Prints out the help message corresponding to the command the cursor is on."
(interactive)
- (cmake-command-run "--help-command" (downcase (cmake-get-topic "command"))))
+ (cmake-command-run "--help-command" (downcase (cmake-get-topic "command")) "*CMake Help*"))
;;;###autoload