cmake-mode.el: Replace 'setq' with 'let' or inlining

This commit is contained in:
Philipp Möller 2014-01-28 18:05:21 +01:00 committed by Brad King
parent d3db7126e6
commit 9b3876bfbc
1 changed files with 23 additions and 22 deletions

View File

@ -276,25 +276,27 @@ optional argument topic will be appended to the argument list."
(if buffer (if buffer
(display-buffer buffer 'not-this-window) (display-buffer buffer 'not-this-window)
;; Buffer doesn't exist. Create it and fill it ;; Buffer doesn't exist. Create it and fill it
(setq buffer (generate-new-buffer bufname)) (let ((buffer (generate-new-buffer bufname))
(setq command (concat cmake-mode-cmake-executable " " type " " topic)) (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 (message "Running %s" command)
;; minibuffer, so turn it off. A value of nil means don't automatically ;; We don't want the contents of the shell-command running to the
;; resize mini-windows. ;; minibuffer, so turn it off. A value of nil means don't automatically
(setq resize-mini-windows-save resize-mini-windows) ;; resize mini-windows.
(setq resize-mini-windows nil) (setq resize-mini-windows-save resize-mini-windows)
(shell-command command buffer) (setq resize-mini-windows nil)
;; Save the original window, so that we can come back to it later. (shell-command command buffer)
;; save-excursion doesn't seem to work for this. ;; Save the original window, so that we can come back to it later.
(setq window (selected-window)) ;; save-excursion doesn't seem to work for this.
;; We need to select it so that we can apply special modes to it (setq window (selected-window))
(select-window (display-buffer buffer 'not-this-window)) ;; We need to select it so that we can apply special modes to it
(cmake-mode) (select-window (display-buffer buffer 'not-this-window))
(toggle-read-only t) (cmake-mode)
;; Restore the original window (toggle-read-only t)
(select-window window) ;; Restore the original window
(setq resize-mini-windows resize-mini-windows-save) (select-window window)
(setq resize-mini-windows resize-mini-windows-save)
)
) )
) )
) )
@ -330,9 +332,8 @@ optional argument topic will be appended to the argument list."
(defun cmake-help-command () (defun cmake-help-command ()
"Prints out the help message corresponding to the command the cursor is on." "Prints out the help message corresponding to the command the cursor is on."
(interactive) (interactive)
(setq command (cmake-get-topic "command")) (cmake-command-run "--help-command" (downcase (cmake-get-topic "command"))))
(cmake-command-run "--help-command" (downcase command))
)
;;;###autoload ;;;###autoload
(progn (progn