[Cmake-commits] [cmake-commits] hoffman committed cmake-mode.el 1.34 1.34.2.1

cmake-commits at cmake.org cmake-commits at cmake.org
Thu Oct 1 17:20:17 EDT 2009


Update of /cvsroot/CMake/CMake/Docs
In directory public:/mounts/ram/cvs-serv11203/Docs

Modified Files:
      Tag: CMake-2-8
	cmake-mode.el 
Log Message:
Merge in changes to CMake-2-8 RC 2


Index: cmake-mode.el
===================================================================
RCS file: /cvsroot/CMake/CMake/Docs/cmake-mode.el,v
retrieving revision 1.34
retrieving revision 1.34.2.1
diff -C 2 -d -r1.34 -r1.34.2.1
*** cmake-mode.el	26 Feb 2009 18:28:01 -0000	1.34
--- cmake-mode.el	1 Oct 2009 21:20:15 -0000	1.34.2.1
***************
*** 1,14 ****
  ;=============================================================================
  ;
! ;  Program:   CMake - Cross-Platform Makefile Generator
! ;  Module:    $RCSfile$
! ;
! ;  Copyright (c) 2000-$Date$ Kitware, Inc., Insight Consortium.  All rights reserved.
! ;  See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
! ;
! ;     This software is distributed WITHOUT ANY WARRANTY; without even
! ;     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
! ;     PURPOSE.  See the above copyright notices for more information.
  ;
  ;=============================================================================
  ;;; cmake-mode.el --- major-mode for editing CMake sources
--- 1,12 ----
  ;=============================================================================
+ ; CMake - Cross Platform Makefile Generator
+ ; Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
  ;
! ; Distributed under the OSI-approved BSD License (the "License");
! ; see accompanying file Copyright.txt for details.
  ;
+ ; This software is distributed WITHOUT ANY WARRANTY; without even the
+ ; implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ ; See the License for more information.
  ;=============================================================================
  ;;; cmake-mode.el --- major-mode for editing CMake sources
***************
*** 33,37 ****
--- 31,50 ----
  
  ;;; Code:
+ ;;
+ ;; cmake executable variable used to run cmake --help-command
+ ;; on commands in cmake-mode
+ ;;
+ ;; cmake-command-help Written by James Bigler 
+ ;;
+ 
+ (defcustom cmake-mode-cmake-executable "cmake"
+   "*The name of the cmake executable.
  
+ This can be either absolute or looked up in $PATH.  You can also
+ set the path with these commands:
+  (setenv \"PATH\" (concat (getenv \"PATH\") \";C:\\\\Program Files\\\\CMake 2.8\\\\bin\"))
+  (setenv \"PATH\" (concat (getenv \"PATH\") \":/usr/local/cmake/bin\"))"
+   :type 'file
+   :group 'cmake)
  ;;
  ;; Regular expressions used by line indentation function.
***************
*** 252,255 ****
--- 265,337 ----
    (run-hooks 'cmake-mode-hook))
  
+ ; Help mode starts here
+ 
+ 
+ (defun cmake-command-run (type &optional topic)
+   "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))
+          )
+     (if buffer
+         (display-buffer buffer 'not-this-window)
+       ;; Buffer doesn't exist.  Create it and fill it
+       (setq buffer (generate-new-buffer bufname))
+       (setq 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)
+       )
+     )
+   )
+ 
+ (defun cmake-help-list-commands ()
+   "Prints out a list of the cmake commands."
+   (interactive)
+   (cmake-command-run "--help-command-list")
+   )
+ 
+ (defvar cmake-help-command-history nil "Topic read history.")
+ 
+ (require 'thingatpt)
+ (defun cmake-get-topic (type)
+   "Gets the topic from the minibuffer input.  The default is the word the cursor is on."
+   (interactive)
+   (let* ((default-entry (word-at-point))
+          (input (read-string
+                  (format "CMake %s (default %s): " type default-entry) ; prompt
+                  nil ; initial input
+                  'cmake-help-command-history ; command history
+                  default-entry ; default-value
+                  )))
+     (if (string= input "")
+         (error "No argument given")
+       input))
+   )
+ 
+ 
+ (defun cmake-help-command ()
+   "Prints out the help message corresponding to the command the cursor is on."
+   (interactive)
+   (setq command (cmake-get-topic "command"))
+   (cmake-command-run "--help-command" (downcase command))
+   )
+ 
+ 
  ; This file provides cmake-mode.
  (provide 'cmake-mode)



More information about the Cmake-commits mailing list