PageRenderTime 50ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 1ms

/.emacs.d/compile-mode/compile-mode.el

https://github.com/capotej/dotemacs
Emacs Lisp | 2691 lines | 1811 code | 323 blank | 557 comment | 90 complexity | 7be65c7dede24c8bfbc4c1048a2ff365 MD5 | raw file
Possible License(s): GPL-2.0

Large files files are truncated, but you can click here to view the full file

  1. ;;; mode-compile.el --- Smart command for compiling files
  2. ;; according to major-mode.
  3. ;;
  4. ;; Copyright (c) 1994 - 2006 heddy Boubaker C.E.N.A.
  5. ;;
  6. ;; Author: Heddy Boubaker <heddy.Boubaker@cena.fr>
  7. ;; Maintainer: Heddy Boubaker <heddy.Boubaker@cena.fr>
  8. ;; Created: June 1994
  9. ;; Last modified: 2006/12/01 13:52:47
  10. ;; Version: 2.29
  11. ;; Keywords: compile, compilation, modes, languages
  12. ;; Tested for:
  13. ;; XEmacs (Lucid GNU Emacs) >= 19.10
  14. ;; Must work with FSF GNU Emacs > 19.31 ;-)
  15. ;; Do not work anymore for Emacses <= 18
  16. ;; Ftp access:
  17. ;; archive.cis.ohio-state.edu:pub/gnu/emacs/elisp-archive/misc/mode-compile.el.Z
  18. ;; WWW access:
  19. ;; <URL http://www.tls.cena.fr/~boubaker/Emacs/>
  20. ;;
  21. ;; LCD Archive Entry:
  22. ;; mode-compile|Heddy Boubaker|boubaker@cena.fr|
  23. ;; Smart command for compiling files according to major-mode and more.|
  24. ;; 2003/04/01 13:52:47|2.28|~/misc/mode-compile.el.Z|
  25. ;;
  26. ;;; This file is NOT part of GNU Emacs but the same permissions apply.
  27. ;;
  28. ;; GNU Emacs is free software; you can redistribute it and/or modify it under
  29. ;; the terms of the GNU General Public License as published by the Free
  30. ;; Software Foundation; either version 2, or (at your option) any later
  31. ;; version.
  32. ;;
  33. ;; GNU Emacs is distributed in the hope that it will be useful, but WITHOUT
  34. ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  35. ;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  36. ;; more details.
  37. ;;
  38. ;; You should have received a copy of the GNU General Public License along
  39. ;; with GNU Emacs; see the file COPYING. If not, write to the Free Software
  40. ;; Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  41. ;;
  42. ;; @ Purpose:
  43. ;; ==========
  44. ;;
  45. ;; Provide `mode-compile' function as a replacement for the use of `compile'
  46. ;; command which is very dumb for creating it's compilation command (use
  47. ;; "make -k" by default). `mode-compile' is a layer above `compile'; Its
  48. ;; purpose is mainly to build a smart compile-command for `compile' to
  49. ;; execute it. This compile-command is built according to number of
  50. ;; parameters:
  51. ;; - the major-mode.
  52. ;; - presence or not of a makefile in current directory.
  53. ;; - the buffer-file-name and extension.
  54. ;; - what is in the current buffer (`main' function,"#!/path/shell", ...).
  55. ;; - and more ... (see Commentary section below).
  56. ;; Most of these parameters are higly customizable throught Emacs Lisp
  57. ;; variables (to be set in your .emacs or through Customization menu).
  58. ;; Running mode-compile after an universal-argument (C-u) allows remote
  59. ;; compilations, user is prompted for a host name to run the compilation
  60. ;; command on. Another function provided is `mode-compile-kill' which
  61. ;; terminate a running compilation session launched by `mode-compile'.
  62. ;;
  63. ;; @ Installation:
  64. ;; ===============
  65. ;;
  66. ;; Byte compile this file (*) somewhere in your `load-path' and add in
  67. ;; your .emacs:
  68. ;; (autoload 'mode-compile "mode-compile"
  69. ;; "Command to compile current buffer file based on the major mode" t)
  70. ;; (global-set-key "\C-cc" 'mode-compile)
  71. ;; (autoload 'mode-compile-kill "mode-compile"
  72. ;; "Command to kill a compilation launched by `mode-compile'" t)
  73. ;; (global-set-key "\C-ck" 'mode-compile-kill)
  74. ;;
  75. ;; By default mode-compile is very verbose and waits a few seconds (1 by
  76. ;; default) after each message for the user to have time to read it. You
  77. ;; could set variables `mode-compile-expert-p' and
  78. ;; `mode-compile-reading-time' to change this behaviour. On X-Windows
  79. ;; systems setting the variable `mode-compile-other-frame-p' will create a
  80. ;; new frame and launch the compilation command in it.
  81. ;;
  82. ;; (*) Don't take care of messages:
  83. ;; ** reference to free variable efs-remote-shell-file-name
  84. ;; This is perfectly normal ;-}. But if you know a way to avoid it let me
  85. ;; know.
  86. ;;
  87. ;; @ Bug Reports:
  88. ;; ==============
  89. ;;
  90. ;; To report a bug please use function `mode-compile-submit-bug-report'
  91. ;; Please note that this bug-report facility uses Barry Warsaw's reporter.el
  92. ;; which is part of GNU Emacs v19 and bundled with many other packages. If
  93. ;; needed, you can obtain a copy of reporter.el at the elisp-archive.
  94. ;;
  95. ;; @ Documentation:
  96. ;; ================
  97. ;;
  98. ;; This section will explain how the `compile-command' are built according to
  99. ;; the `major-mode' and how to customize it. The major modes `mode-compile'
  100. ;; currently known are:
  101. ;; - c-mode, c++-mode, makefile-mode, dired-mode, ada-mode, emacs-lisp-mode,
  102. ;; lisp-interaction-mode, sh-mode, csh-mode, fundamental-mode, text-mode,
  103. ;; indented-text-mode compilation-mode, fortran-mode, c?perl-mode,
  104. ;; zsh-mode java-mode, tcl-mode, python-mode, ruby-mode
  105. ;; For other modes a default behaviour is provided.
  106. ;;
  107. ;; When running `mode-compile' or `mode-compile-kill' the hooks
  108. ;; `mode-compile-(before|after)-(compile|kill)-hook' are executed. The
  109. ;; current buffer could be automaticaly saved if variable
  110. ;; `mode-compile-always-save-buffer-p' is set to `t'. ALL the modified
  111. ;; buffers could be automaticaly saved if variable `mode-compile-save-all-p'
  112. ;; is set to `t'.
  113. ;;
  114. ;; @@ fundamental-mode, text-mode, indented-text-mode & UNKNOWN MODES:
  115. ;; *** THIS IS TOO THE DEFAULT BEHAVIOR FOR UNKNOWN MODES ***
  116. ;; Try to guess what the file is by:
  117. ;; - 1st looking at it's name and extension (see variable
  118. ;; `mode-compile-filename-regexp-alist').
  119. ;; - 2nd looking at string "#!/path/shell" at first line to extract shell
  120. ;; to run the script with (see variable `mode-compile-shell-alist').
  121. ;; - 3rd looking at a makefile in current directory.
  122. ;; - then calling `compile' with the last compile command which is
  123. ;; asked to be edited by user ...
  124. ;; The `kill-compile' command is then bound dynamically (buffer-local).
  125. ;;
  126. ;; @@ compilation-mode:
  127. ;; Call `compile' with the last compile command.
  128. ;;
  129. ;; @@ makefile-mode:
  130. ;; The makefile is run with make throught `compile' (user is prompted
  131. ;; for the rule to run, see variable
  132. ;; `mode-compile-prefered-default-makerule' to see how a default choice
  133. ;; could be selected).
  134. ;;
  135. ;; @@ emacs-lisp-mode, lisp-interaction-mode:
  136. ;; If the buffer is a .el file byte-compile it to produce a .elc file,
  137. ;; else just byte-compile the buffer (this don't use `compile' but
  138. ;; `byte-compile').
  139. ;;
  140. ;; @@ dired-mode:
  141. ;; Find a makefile in the directory and run make with it (like in
  142. ;; makefile-mode), else try to byte-recompile all .el files olders than
  143. ;; their associated .elc files (unlike `byte-recompile-directory' this is
  144. ;; not recursive), finally if no .el files are present ask compilation
  145. ;; command to user by calling `default-compile'. To find a makefile a
  146. ;; regexp is provided which name is `mode-compile-makefile-regexp'.
  147. ;;
  148. ;; @@ sh-mode, csh-mode, zsh-mode:
  149. ;; Run "[cz]?sh" with debugging arguments as specified in
  150. ;; `[cz]?sh-dbg-flags' on the currently edited file.
  151. ;;
  152. ;; @@ c?perl-mode:
  153. ;; Run file with "perl -w" (can step throught errors with compile's
  154. ;; `next-error' command).
  155. ;;
  156. ;; @@ tcl-mode:
  157. ;; Run file with "wish" (can step throught errors with compile's
  158. ;; `next-error' command).
  159. ;;
  160. ;; @@ c-mode, c++-mode:
  161. ;; First it try to see if there is a makefile in the directory, makefiles to
  162. ;; look for are specified by the variable `mode-compile-makefile-regexp'.
  163. ;; If yes two cases could happen: there is only one makefile so use it, or
  164. ;; there is more than one (sometimes when you need to write portable soft
  165. ;; you could have some makefiles by system: SunOs.make, HP.make ...), in
  166. ;; that case prompt to user for choice (with smart completion). Once the
  167. ;; makefile has been selected it extract the rules from it and ask to user
  168. ;; to choose a rule to make (with smart completion, see variable
  169. ;; `mode-compile-prefered- default-makerule' to see how a default choice
  170. ;; could be selected).
  171. ;;
  172. ;; There are some cases where no makefiles are presents (YES I KNOW this is
  173. ;; bad practice but you sometimes have no needs to write a Makefile). In
  174. ;; that case the function try to build the most intelligent compilation
  175. ;; command by using the favourite user C/C++ compiler: value of environment
  176. ;; variable "CC" or "CXX" or first found, in the PATH, of compilers
  177. ;; specified in variable `cc-compilers-list' or `c++-compilers-list'. Then
  178. ;; it look for the varenv "CFLAGS" of "CXXFLAGS" to append to the compiler
  179. ;; command, find the file to compile:
  180. ;; <name-of-the-file-to-compiled>.(c|cc|C|cpp) (see *) and ask for
  181. ;; confirmation. If you really trust mode-compile will build the right
  182. ;; command and want to bypass confirmation you could set the variable
  183. ;; `mode-compile-never-edit-command-p' to t.
  184. ;;
  185. ;; (*) How to find <name-of-the-file-to-compiled>:
  186. ;; In both case the command try to guess which file has to be compiled:
  187. ;; It's a trivial choice when current buffer file is a
  188. ;; .(c|C|cc|cpp... -any file with extension specified in
  189. ;; `cc-source-file-ext-list' or `c++-source-file-ext-list') file but
  190. ;; when it's a .(h|H|hh) file what to do? The variable
  191. ;; `cc-companion-file-regexp' or `c++-companion-file-regexp' specify
  192. ;; how to find a .(c|C|cc|cpp...) file from a .(h|H|hh...); This is
  193. ;; done by appending .(c|C|cc|cpp) to
  194. ;; <filename-without-matching-regexp>. In c-mode with default value
  195. ;; it produce:
  196. ;; file.h, file_[Pp].h -> file.c
  197. ;; I sometimes use files _p.h to indicate that the file is a private header
  198. ;; file for a .c file.
  199. ;; In c++-mode with default value it produce:
  200. ;; file.hh, file_[Pp].hh -> file.cc
  201. ;; I sometimes use files _p.cc to indicate that the file is a private header
  202. ;; file for a .cc file.
  203. ;; The output of compilation will be a
  204. ;; <name-of-the-file-to-compiled>.o file if no `main' function is
  205. ;; found inside or a <name-of-the-file-to-compiled> EXECUTABLE file
  206. ;; if `main' function found.
  207. ;;
  208. ;; @@ ada-mode:
  209. ;; Same as c/c++-mode but run Ada compiler on the Ada file. There are no
  210. ;; companion file and no way to find a main function in Ada.
  211. ;;
  212. ;; @@ fortran-mode:
  213. ;; Same as c-mode but run Fortran compiler on .[Ff](or)? files.
  214. ;;
  215. ;; @@ java-mode:
  216. ;; Same as c-mode but call "javac" without the -o option on .java files
  217. ;;
  218. ;; @@ python-mode:
  219. ;; Run file with "python" (can step throught errors with compile's
  220. ;; `next-error' command).
  221. ;;
  222. ;; @@ ruby-mode:
  223. ;; Run file with "ruby" (can step throught errors with compile's
  224. ;; `next-error' command).
  225. ;;
  226. ;; @@ message-mode:
  227. ;; Run `message-send'.
  228. ;;
  229. ;; @ WhatsNew:
  230. ;; ===========
  231. ;;
  232. ;; Support for ruby-mode
  233. ;;
  234. ;; @ Contributors/Helpers:
  235. ;; =======================
  236. ;;
  237. ;; Adrian Aichner <aichner@ecf.teradyne.com>
  238. ;; "William A. Perkins" <wa_perkins@pnl.gov>
  239. ;; Bin Mu <mubin@DerivaTech.COM>
  240. ;; Gael MARZIOU <Gael_Marziou@grenoble.hp.com>
  241. ;; Christian Motschke <motschke@prosun.first.gmd.de>
  242. ;; boris <boris@cs.rochester.edu>
  243. ;; Edward Hartnett <ejh@larry.gsfc.nasa.gov>.
  244. ;; Hartmut MANZ <manz@intes-stuttgart.de>.
  245. ;; Henry Guillaume <henryg@tusc.com.au>.
  246. ;; Ian Young <imy@wcl-rs.bham.ac.uk>
  247. ;; Ilya Zakharevich <ilya@math.ohio-state.edu>.
  248. ;; Kevin Broadey <KevinB@bartley.demon.co.uk>.
  249. ;; Lawrence R. Dodd <dodd@roebling.poly.edu>.
  250. ;; Martin Jost <asictest@ztivax.zfe.siemens.de>.
  251. ;; Michael Welsh Duggan <md5i+@andrew.cmu.edu>.
  252. ;; Rolf EBERT <rolf@gundog.lbl.gov>.
  253. ;; Scott Hofmann <scotth@visix.com>.
  254. ;; Stefan Schoef <Stefan.Schoef@arbi.informatik.uni-oldenburg.de>.
  255. ;; John W. Harwell <ccjohnh@showme.missouri.edu> - JWH.
  256. ;; Charles L.G. Comstock <dgtized@gmail.com> - CLGC
  257. ;;
  258. ;; @ ToDo:
  259. ;; =======
  260. ;;
  261. ;; Extending this to some others programming languages (modes).
  262. ;; Writting an Info documentation.
  263. ;; Contributors are greatly accepted (send me diffs and don't forget to
  264. ;; update documentation and all comments too please).
  265. ;; Maybe Using ange-ftp parse .netrc utilities for remote host and
  266. ;; user infos.
  267. ;;
  268. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  269. ;; @ Requirements ;;;
  270. ;; mode-compile is not a replacement for compile
  271. ;; it is just a layer above it.
  272. (require 'compile)
  273. ;;; For Emacs-Lisp files compilations
  274. (require 'byte-compile "bytecomp")
  275. ;;; For easy macros
  276. (require 'backquote)
  277. (require 'cl)
  278. (load-library "cl-macs")
  279. ;; Pretty print elisp
  280. (require 'pp)
  281. ;;; Setting obsolete vars
  282. (eval-and-compile
  283. (condition-case ()
  284. (require 'obsolete)
  285. (error nil))
  286. (if (and (featurep 'obsolete) (fboundp 'define-obsolete-variable-alias))
  287. nil ;; We've got what we needed
  288. (defmacro define-obsolete-variable-alias (old new)
  289. (` (progn (defalias (, old) (, new))
  290. (put (, old) 'byte-obsolete-variable (, new)))
  291. ))))
  292. ;;; For using custom - stolen from w3-cus.el -
  293. (eval-and-compile
  294. (condition-case ()
  295. (require 'custom)
  296. (error nil))
  297. (if (and (featurep 'custom) (fboundp 'custom-declare-variable))
  298. nil ;; We've got what we needed
  299. ;; We have the old custom-library, hack around it!
  300. (defmacro defgroup (&rest args)
  301. nil)
  302. (defmacro defcustom (var value doc &rest args)
  303. (` (defvar (, var) (, value) (, doc))))))
  304. ;; Custom groups
  305. (defgroup compilation nil
  306. "Compilations from within Emacs variables."
  307. :link '(url-link :tag "Author's Emacs Page"
  308. "http://www.tls.cena.fr/~boubaker/Emacs/")
  309. :group 'tools
  310. :group 'development)
  311. (defgroup compilation-lang nil
  312. "Language specific compilation options."
  313. :group 'languages
  314. :group 'compilation)
  315. (defgroup compilation-script nil
  316. "Scripts compilation options."
  317. :group 'compilation)
  318. (defgroup compilation-elisp nil
  319. "Emacs developpement compilation options."
  320. :group 'lisp
  321. :group 'compilation)
  322. ;; @ User variables ;;;
  323. ;; @@ Common variables to mode-compile for all modes ;;;
  324. (defcustom mode-compile-modes-alist
  325. '((c-mode . (cc-compile kill-compilation))
  326. (java-mode . (java-compile kill-compilation))
  327. (c++-mode . (c++-compile kill-compilation))
  328. (ada-mode . (ada-compile kill-compilation))
  329. (fortran-mode . (f77-compile kill-compilation))
  330. (dired-mode . (dired-compile kill-compilation))
  331. (emacs-lisp-mode . (elisp-compile keyboard-quit)) ; I'm SURE IT'S NOT the best way
  332. (lisp-interaction-mode . (elisp-compile keyboard-quit)) ; to kill a byte-compilation.
  333. (makefile-mode . (makefile-compile kill-compilation))
  334. (sh-mode . (sh-compile kill-compilation))
  335. (csh-mode . (csh-compile kill-compilation))
  336. (zsh-mode . (zsh-compile kill-compilation))
  337. (perl-mode . (perl-compile kill-compilation))
  338. (cperl-mode . (perl-compile kill-compilation))
  339. (tcl-mode . (tcl-compile kill-compilation)) ; JWH
  340. (python-mode . (python-compile kill-compilation)) ; BM
  341. (ruby-mode . (ruby-compile kill-compilation)) ; CLGC
  342. ;(message-mode . (message-compile kill-compilation))
  343. (fundamental-mode . (guess-compile nil)) ; bound dynamically
  344. (text-mode . (guess-compile nil)) ; itou
  345. (indented-text-mode . (guess-compile nil)) ; itou
  346. (compilation-mode . (default-compile kill-compilation)))
  347. "Assoc list of compile/kill functions for some known modes.
  348. Each element look like (MODE . (COMPILE-FUNCTION KILL-FUNCTION))
  349. `mode-compile' will call COMPILE-FUNCTION and `mode-compile-kill'
  350. KILL-FUNCTION if current major-mode is MODE.
  351. If you want to add or modify a COMPILE-FUNCTION and it's associated
  352. KILL-FUNCTION for MODE and don't want to hack `mode-compile' you could
  353. do the following (it exists however a more subtle method for
  354. modifying, this is left as an exercice for the reader :-):
  355. (defun my-mode-compile() ...)
  356. (defun my-mode-compile-kill() ...)
  357. (setq mode-compile-modes-alist
  358. (append '((my-mode . (my-mode-compile my-mode-compile-kill)))
  359. mode-compile-modes-alist))"
  360. :type '(repeat
  361. (cons :tag "Association: mode/compilation functions"
  362. (function :tag "Mode")
  363. (list :tag "Compilation functions"
  364. (choice :tag "Function to run the compilation"
  365. (function-item :tag "Default" :value default-compile)
  366. (function-item :tag "Guess" :value guess-compile)
  367. (function-item :tag "Emacs lisp byte compilation" :value elisp-compile)
  368. (function :tag "Your choice, take care..."))
  369. (choice :tag "Function to kill a running compilation"
  370. (function-item :tag "Just kill" :value kill-compilation)
  371. (const :tag "Nothing -- use with guess-compile --" :value nil)
  372. (function-item :tag "To use with elisp-compile" :value keyboard-quit)
  373. ;; This item could not be selected due to a custom (hum) feature ...
  374. (function :tag "Your choice, take care..." :value nil)))))
  375. :group 'compilation)
  376. (defcustom mode-compile-filename-regexp-alist
  377. ;; These could be in auto-mode-alist. But if you are like me
  378. ;; and don't like these modes (prefear to edit these kind of
  379. ;; files in text-mode) this is a nice way to compile them
  380. ;; without to be bored with their associated modes.
  381. '((mode-compile-makefile-regexp . makefile-mode)
  382. ("\\.sh$" . sh-mode)
  383. ("\\.csh$" . csh-mode)
  384. ("\\.zsh$" . zsh-mode))
  385. "Assoc list of major-modes for some filenames regexp.
  386. Each element look like (REGEXP . MODE) This variable is really similar
  387. to `auto-mode-alist' in the fact that it associate a MODE to a REGEXP
  388. matching a filename. The only differences is that you are not obliged
  389. to have the specified MODE available to use it (`guess-compile' use
  390. it), the MODE is only a pointer to an assoq in
  391. `mode-compile-modes-alist' to get the COMPILE-FUNCTION and the
  392. KILL-FUNCTION. The REGEXP could be a form wich evaluate to a string.
  393. To add a new filename regexp do the following:
  394. (setq mode-compile-filename-regexp-alist
  395. (append '((my-filename-regexp . some-mode-mode-compile-know)
  396. mode-compile-modes-alist))"
  397. :type '(repeat
  398. (cons :tag "Association: filename/mode"
  399. (choice :tag "Filename regexp match"
  400. (regexp :tag "Regexp as a string")
  401. (symbol :tag "Variable containing the regexp")
  402. (sexp :tag "Form wich evaluate to a string"))
  403. ;; I need to bind dynamicaly this with const, ideas??
  404. ;;`(choice
  405. ;; ,@(mapcar (lambda (x) `(const ,(car x))) mode-compile-modes-alist))))
  406. (function :tag "Mode to use -- should be a valid assoq in mode-compile-modes-alist --")))
  407. :group 'compilation)
  408. (defcustom mode-compile-shell-alist
  409. '(("sh" . sh-mode)
  410. ("csh" . csh-mode)
  411. ("zsh" . zsh-mode)
  412. ("perl" . perl-mode)
  413. ("tcl" . tcl-mode) ; JWH
  414. ("python" . python-mode) ; BM
  415. ("ruby" . ruby-mode)) ; CLGC
  416. "Assoc list of compile function for some known shells.
  417. Each element look like (SHELL . MODE) This variable look like
  418. `auto-mode-alist' in the fact that it associate a MODE to a name; A
  419. SHELL name here. The main difference is that you are not obliged to
  420. have the specified MODE available to use it (`guess-compile' use it),
  421. the MODE is only a pointer to an assoq in `mode-compile-modes-alist'
  422. to get the COMPILE-FUNCTION and the KILL-FUNCTION.
  423. To add a new shell do the following:
  424. (setq mode-compile-filename-shell-alist
  425. (append '((my-shell-name . some-mode-mode-compile-know)
  426. mode-compile-modes-alist))"
  427. :type '(repeat
  428. (cons :tag "Association: shell name/mode"
  429. (string :tag "Shell name")
  430. ;; I need to bind dynamicaly this with const, ideas??
  431. ;;`(choice
  432. ;; ,@(mapcar (lambda (x) `(const ,(car x))) mode-compile-modes-alist))))
  433. (function :tag "Mode to use -- should be a valid assoq in mode-compile-modes-alist --")))
  434. :group 'compilation)
  435. ;;;###autoload
  436. (defcustom mode-compile-make-program "make"
  437. "*The `make' program used to process makefiles.
  438. If you have GNU make installed with name \"gmake\" use it."
  439. :type 'string
  440. :group 'compilation)
  441. (defcustom mode-compile-makefile-regexp
  442. "\\(^[Mm]akefile\\|.*\\.[mM][aA]?[kK][eE]?\\.?.*$\\)"
  443. "Regexp matching 'could be' makefiles filenames."
  444. :type 'regexp
  445. :group 'compilation)
  446. (defcustom mode-compile-makefile-backups-regexp
  447. "\\(\\(~\\|\\.[bB][aA][cC]?[kK]\\)$\\)\\|\\(\\(^\\|/\\)[.,][^/]+$\\)"
  448. "Regexp to find if a Makefile is a backup or not"
  449. :type 'regexp
  450. :group 'compilation)
  451. ;;;###autoload
  452. (defcustom mode-compile-ignore-makefile-backups t
  453. "*Tell mode compile to ignore makefiles backup files when selecting the Makefile to use."
  454. :type 'boolean
  455. :group 'compilation)
  456. ;;;###autoload
  457. (defvar mode-compile-default-make-options "-k"
  458. "Default options to give to `make'.")
  459. ;;;###autoload
  460. (defcustom mode-compile-make-options (eval mode-compile-default-make-options)
  461. "*Options to give to `make'.
  462. This could be any form evaluating to a string.
  463. Some people asked me a way to modify the make options everytime a
  464. compilation command is launched, do that:
  465. (defun my-mode-compile-ask-make-options()
  466. \"*Hook called by mode-compile, asking for make options.\"
  467. (interactive)
  468. (read-string \"Make options: \"
  469. mode-compile-default-make-options))
  470. (setq mode-compile-make-options
  471. 'my-mode-compile-ask-make-options)"
  472. :type '(choice
  473. string
  474. (sexp :tag "Form evaluating to a string"))
  475. :group 'compilation)
  476. ;;;###autoload
  477. (defcustom mode-compile-prefered-default-makerule 'none
  478. "*Default makerule you would like to see in minibuffer as a default choice
  479. when selecting the make rule to build.
  480. Possible values are:
  481. 'none -- let mode-compile deciding for you.
  482. 'all -- try hard to show you the \"all\" rule.
  483. 'default -- try hard to show you the \"default\" rule.
  484. 'file -- try to show you the name of the file which will be
  485. result of compilation.
  486. The 'none action is taken as default is something fail."
  487. :type '(radio :tag "Symbol"
  488. (const :tag "None - Let mode compile made the choice" :value none)
  489. (const :tag "All - Show the \"all\" rule" :value all)
  490. (const :tag "Default - Show the \"default\" rule" :value default)
  491. (const :tag "File - Show the \"result file name\" rule" :value file))
  492. :group 'compilation)
  493. ;;;###autoload
  494. (defcustom mode-compile-ignore-makerule-regexp nil
  495. "*Makefile rules which must be ignored when building completion list.
  496. For example if you want to remove all `files rules' set
  497. it to: \"\\\\.\\\\([aoc]\\\\|s[ao][.0-9]*\\\\)\". "
  498. :type '(choice (const :tag "none" :value nil)
  499. (const :tag "The `all files' rule" :value "\\.\\([aoc]\\|s[ao][.0-9]*\\)")
  500. regexp)
  501. :group 'compilation)
  502. ;;;###autoload
  503. (defcustom mode-compile-save-all-p nil
  504. "*Non-nil means save ALL the modified buffers without asking
  505. before launching compilation command."
  506. :type 'boolean
  507. :group 'compilation)
  508. ;;;###autoload
  509. (defcustom mode-compile-always-save-buffer-p nil
  510. "*Non-nil means save the current buffer without asking
  511. before launching compilation command."
  512. :type 'boolean
  513. :group 'compilation)
  514. ;;;###autoload
  515. (defcustom mode-compile-never-edit-command-p nil
  516. "*Non-nil means never ask to user to edit the compile command."
  517. :type 'boolean
  518. :group 'compilation)
  519. ;; @@ Compilation in other frame vars ;;;
  520. (defgroup compilation-frame nil
  521. "Compile in another frame variables."
  522. :group 'frames
  523. :group 'compilation)
  524. ;;;###autoload
  525. (defcustom mode-compile-other-frame-p nil
  526. "*Non-nil means compile in another frame.
  527. A new Emacs FRAME is created and the compilation command is executed
  528. in this other frame. To specify the frame parameters see also
  529. variable `mode-compile-frame-parameters-alist'."
  530. :type 'boolean
  531. :group 'compilation-frame)
  532. (defcustom mode-compile-other-frame-name "COMPILATION"
  533. "Name of mode-compile's other frame.
  534. This name could be used in your .Xdefault or .Xresources file as:
  535. Emacs.MODE-COMPILE-OTHER-FRAME-NAME.resource_to_be_set: ..."
  536. :type 'string
  537. :group 'compilation-frame)
  538. (defconst mode-compile-default-frame-parameters
  539. (list
  540. (cons 'name mode-compile-other-frame-name)
  541. (cons 'width 85) ; columns
  542. (cons 'height 30)) ; lines
  543. "Default parameters for mode-compile's other frame.")
  544. (defvar mode-compile-frame-parameters-alist
  545. (purecopy mode-compile-default-frame-parameters)
  546. "Parameters for the new Compilation Screen created
  547. if variable `mode-compile-other-frame-p' is non nil..
  548. See also variable `mode-compile-default-frame-parameters' and
  549. `mode-compile-other-frame-name'.
  550. For informations about Screen/Frame parameters see:
  551. - Info, Nodes: Lispref::Screen::Screen Parameters
  552. - GNU Emacs Lisp Reference Manual, chapter 26 p375: Frames.")
  553. ;; @@ Hooks ;;;
  554. ;;;###autoload
  555. (defcustom mode-compile-before-compile-hook nil
  556. "Hook to be run before compile command is executed
  557. when `mode-compile' is invoked."
  558. :type 'hook
  559. :group 'compilation)
  560. ;;;###autoload
  561. (defcustom mode-compile-after-compile-hook nil
  562. "Hook to be run after compile command is executed
  563. when `mode-compile' is invoked."
  564. :type 'hook
  565. :group 'compilation)
  566. ;;;###autoload
  567. (defcustom mode-compile-before-kill-hook nil
  568. "Hook to be run before killing compile command is executed
  569. when `mode-compile-kill' is invoked."
  570. :type 'hook
  571. :group 'compilation)
  572. ;;;###autoload
  573. (defcustom mode-compile-after-kill-hook nil
  574. "Hook to be run after killing compile command is executed
  575. when `mode-compile-kill' is invoked."
  576. :type 'hook
  577. :group 'compilation)
  578. ;; @@ System dependencies ;;;
  579. (defvar mode-compile-exe-file-ext
  580. (cond
  581. ((memq system-type '(ms-dos emx windows-95 windows-98 windows-nt)) ".exe")
  582. (t ""))
  583. "*Extension of executable files (with dot included)")
  584. (defvar mode-compile-dir-separator-char
  585. (cond
  586. ;; MSDOSish file systems
  587. ((memq system-type '(ms-dos emx windows-95 windows-98 windows-nt)) "\\")
  588. ;; Unixish file systems
  589. (t "/"))
  590. "*Separator char between directories")
  591. ;; @@ Facilities variables ;;;
  592. ;;;###autoload
  593. (defvar mode-compile-choosen-compiler nil
  594. "*Global variable containing the name of the compiler
  595. which will be used for compiling without makefile.
  596. Could be used in combination with
  597. (cc|c++|ada|f77)-default-compiler-options
  598. to automaticaly choose the compiler specific options.
  599. example:
  600. (defun my-compiler-get-options()
  601. (cond
  602. ((string= mode-compile-choosen-compiler \"gcc\")
  603. \"-Wall -pedantic-errors\")
  604. ((string= mode-compile-choosen-compiler \"cc\")
  605. \"cc options whatever they are...\")
  606. (t
  607. (message \"Don't know this compiler: %s\" mode-compile-choosen-compiler)
  608. (read-string
  609. (format \"Options for %s compiler: \" mode-compile-choosen-compiler)))))
  610. (setq cc-default-compiler-options 'my-compiler-get-options)")
  611. ;; @@ User level ;;;
  612. ;;;###autoload
  613. (defcustom mode-compile-expert-p nil
  614. "*Non nil means `mode-compile' will not speaks too much.
  615. See also variable variable mode-compile-reading-time."
  616. :type 'boolean
  617. :group 'compilation)
  618. ;;;###autoload
  619. (defcustom mode-compile-reading-time 1
  620. "*Seconds to wait in verbose mode after printing a message.
  621. In verbose mode mode-compile print too much messages that it is
  622. allmost impossible to read them. Just setting this delay leave you the
  623. time to read all the messages. If you don't want any delay set it to
  624. `0'.
  625. See also function sit-for."
  626. :type 'integer
  627. :group 'compilation)
  628. ;; @@ Remote compilation vars ;;;
  629. (defgroup compilation-remote nil
  630. "Remote compilations options."
  631. :group 'compilation)
  632. (defcustom mode-compile-remote-hosts-alist '()
  633. "Alist of favourites hosts names and the username
  634. to use to log on (HOSTNAME . USERNAME).
  635. If USERNAME is a function it will be called with HOSTNAME as argument
  636. and should return an USERNAME string (for example you could use
  637. something like efs-get-user - not tested -), if it is nil the function
  638. user-login-name will be used."
  639. :type '(repeat
  640. (cons
  641. (string :tag "Hostname")
  642. (choice
  643. (const :tag "We'll use \'user-login-name" :value nil)
  644. (string :tag "Username")
  645. (function :tag "Function which return USERNAME given a HOSTNAME" :value efs-get-user))))
  646. :group 'compilation-remote)
  647. (defcustom mode-compile-remote-execute-command "rsh"
  648. "The shell command used to run a command remotely.
  649. \"rsh\" is the only choice I know but I'm far to know everything...
  650. This variable is set automaticaly with the value of
  651. remote-shell-program or efs-remote-shell-file-name at load time."
  652. :type 'string
  653. :group 'compilation)
  654. (eval-when 'load
  655. (cond
  656. ((not (string= mode-compile-remote-execute-command "rsh"))
  657. ;; user changed default
  658. nil)
  659. ;; Try to not multiply definitions of the same stuff
  660. ;; in too many emacs lisp packages ...
  661. ((and (boundp 'remote-shell-program) remote-shell-program)
  662. (setq mode-compile-remote-execute-command remote-shell-program))
  663. ((and (boundp 'efs-remote-shell-file-name) efs-remote-shell-file-name)
  664. (setq mode-compile-remote-execute-command efs-remote-shell-file-name))
  665. ))
  666. (defcustom mode-compile-remote-execute-set-host-arg ""
  667. "Argument To set the remote host name to the
  668. mode-compile-remote-execute-command,
  669. None is required for \"rsh\"."
  670. :type 'string
  671. :group 'compilation-remote)
  672. (defcustom mode-compile-remote-execute-set-command-arg ""
  673. "Argument to set the command to be run remotely to the
  674. mode-compile-remote-execute-command.
  675. None is required for \"rsh\"."
  676. :type 'string
  677. :group 'compilation-remote)
  678. (defcustom mode-compile-remote-execute-set-username-arg "-l"
  679. "Argument to set the username under which we will log on
  680. on the remote host, to give to mode-compile-remote-execute-command."
  681. :type 'string
  682. :group 'compilation-remote)
  683. (defcustom mode-compile-remote-execute-misc-args ""
  684. "Misc additionnals arguments to give to the
  685. mode-compile-remote-execute-command."
  686. :type 'string
  687. :group 'compilation-remote)
  688. ;; @@ c-mode compile variables ;;;
  689. (defgroup compile-c nil
  690. "C Compilation options."
  691. :group 'c
  692. :group 'compilation-lang)
  693. (defcustom cc-compilers-list '( "gcc" "c89" "acc" "cc" )
  694. "List of user's favourites C compilers in order of preferencies."
  695. :type '(repeat (string :tag "C Compiler name"))
  696. :group 'compile-c)
  697. (defcustom cc-companion-file-regexp "\\(_[Pp]\\)?\\.[pP]?h"
  698. "Regexp to find associated .c file from a .h."
  699. :type 'regexp
  700. :group 'compile-c)
  701. (defcustom cc-default-compiler "cc"
  702. "*Default C compiler to use when everything else fails.
  703. This could be any form evaluating to a string, so you could map it to
  704. a function asking you interactively to choose the compiler.
  705. example:
  706. (defun my-choose-compiler()
  707. (read-string \"C compiler: \"))
  708. (setq cc-compilers-list '()
  709. cc-default-compiler 'my-choose-compiler)"
  710. :type '(choice string function)
  711. :group 'compile-c)
  712. (defcustom cc-compiler-varenv "CC"
  713. "Varenv indicating the C compiler to use."
  714. :type 'string
  715. :group 'compile-c)
  716. (defcustom cc-cflags-varenv "CFLAGS"
  717. "Varenv indicating the C compiler flags to use."
  718. :type 'string
  719. :group 'compile-c)
  720. (defcustom cc-source-ext-list '( "c" )
  721. "Extensions for C compileable source files."
  722. :type '(repeat string)
  723. :group 'compile-c)
  724. (defcustom cc-headers-ext-list '( "h" )
  725. "Extensions for C headers source files."
  726. :type '(repeat string)
  727. :group 'compile-c)
  728. (defcustom cc-default-compiler-options "-g"
  729. "*Default options to give to the C compiler.
  730. This could be any form evaluating to a string.
  731. See `mode-compile-choosen-compiler' variable."
  732. :type '(choice
  733. string
  734. (sexp :tag "Form evaluating to a string"))
  735. :group 'compile-c)
  736. (defcustom cc-source-file-ext-regexp "\\.c"
  737. "Regexp to find, from it's name, if a C file is compileable."
  738. :type 'string
  739. :group 'compile-c)
  740. (defcustom cc-build-output-args t
  741. "Build output-args for c-mode."
  742. :type 'boolean
  743. :group 'compile-c)
  744. (defcustom cc-object-file-ext "o"
  745. "Extension of objects file (result of compilation)
  746. in c mode."
  747. :type 'string
  748. :group 'compile-c)
  749. ;; @@ java-mode compile variables ;;;
  750. (defgroup compile-java nil
  751. "Java compilation options."
  752. :group 'compilation-lang)
  753. (defcustom java-compilers-list '( "javac" )
  754. "List of user's favourites java compilers in order of preferencies."
  755. :type '(repeat (string :tag "Java Compiler name"))
  756. :group 'compile-java)
  757. (defcustom java-companion-file-regexp ""
  758. "Regexp to find associated compileable Java companion file.
  759. This is useless in Java because there do not exists uncompileable files."
  760. :type 'regexp
  761. :group 'compile-java)
  762. (defcustom java-default-compiler "javac"
  763. "*Default C compiler to use when everything else fails.
  764. This could be any form evaluating to a string, so you could map it to
  765. a function asking you interactively to choose the compiler.
  766. example:
  767. (defun my-choose-compiler()
  768. (read-string \"Java compiler: \"))
  769. (setq java-default-compiler 'my-choose-compiler)."
  770. :type '(choice string function)
  771. :group 'compile-java)
  772. (defcustom java-compiler-varenv "JAVAC"
  773. "Varenv indicating the C compiler to use."
  774. :type 'string
  775. :group 'compile-java)
  776. (defcustom java-cflags-varenv "JAVAC_FLAGS"
  777. "Varenv indicating the C compiler flags to use."
  778. :type 'string
  779. :group 'compile-java)
  780. (defcustom java-source-ext-list '( "java" )
  781. "Extensions for Java compileable source files."
  782. :type '(repeat string)
  783. :group 'compile-java)
  784. (defcustom java-headers-ext-list '( "java" )
  785. "Extensions for Java source files."
  786. :type '(repeat string)
  787. :group 'compile-java)
  788. (defcustom java-default-compiler-options "-O"
  789. "*Default options to give to the Java compiler.
  790. This could be any form evaluating to a string. See
  791. `mode-compile-choosen-compiler' variable."
  792. :type '(choice
  793. string
  794. (sexp :tag "Form evaluating to a string"))
  795. :group 'compile-java)
  796. (defcustom java-source-file-ext-regexp "\\.java"
  797. "Regexp to find, from it's name, if a Java file is compileable."
  798. :type 'regexp
  799. :group 'compile-java)
  800. (defcustom java-build-output-args nil
  801. "Dont build output-args for Java-mode."
  802. :type 'boolean
  803. :group 'compile-java)
  804. (defcustom java-object-file-ext "class"
  805. "Extension of objects file (result of compilation)
  806. in java mode."
  807. :type 'string
  808. :group 'compile-java)
  809. ;; @@ c++-mode compile variables ;;;
  810. (defgroup compile-c++ nil
  811. "C++ compilation options"
  812. :group 'compilation-lang)
  813. (defcustom c++-compilers-list '( "g++" "gcc" "CC" )
  814. "List of user's favourites C++ compilers in order of preferencies."
  815. :type '(repeat (string :tag "C++ Compiler name"))
  816. :group 'compile-c++)
  817. (defcustom c++-companion-file-regexp "\\(_[Pp]\\)?\\.\\([pP]?[Hh][Hh]?\\|[Hh]\\+\\+?\\)"
  818. "Regexp to find associated compileable C++ companion file
  819. from a header file."
  820. :type 'regexp
  821. :group 'compile-c++)
  822. (defcustom c++-default-compiler "CC"
  823. "*Default C++ compiler to use when everything else fails..
  824. This could be any form evaluating to a string, so you could map it to
  825. a function asking you interactively to choose the compiler.
  826. example:
  827. (defun my-choose-compiler()
  828. (read-string \"C++ compiler: \"))
  829. (setq c++-default-compiler 'my-choose-compiler)"
  830. :type '(choice string function)
  831. :group 'compile-c++)
  832. (defcustom c++-compiler-varenv "CXX"
  833. "Varenv indicating the C++ compiler to use."
  834. :type 'string
  835. :group 'compile-c++)
  836. (defcustom c++-cflags-varenv "CXXFLAGS"
  837. "Varenv indicating the C++ compiler flags to use."
  838. :type 'string
  839. :group 'compile-c++)
  840. (defcustom c++-source-ext-list '( "cc" "C" "CC" "cpp" "cxx" "c++" "c+" )
  841. "Extensions for C++ compileable source files."
  842. :type '(repeat string)
  843. :group 'compile-c++)
  844. (defcustom c++-headers-ext-list '( "H" "hh" "HH" "h++" "h+" "h" "hpp" "hxx" )
  845. "Extensions for C++ headers source files."
  846. :type '(repeat string)
  847. :group 'compile-c++)
  848. (defcustom c++-default-compiler-options "-g"
  849. "*Default options to give to the C++ compiler.
  850. This could be any form evaluating to a string. See
  851. `mode-compile-choosen-compiler' variable."
  852. :type '(choice
  853. string
  854. (sexp :tag "Form evaluating to a string"))
  855. :group 'compile-c++)
  856. (defcustom c++-source-file-ext-regexp "\\.\\(cc\\|CC?\\|c\\+\\+?\\|cpp\\|cxx\\)"
  857. "Regexp to find, from it's name, if a C++ file is compileable."
  858. :type 'regexp
  859. :group 'compile-c++)
  860. (defcustom c++-build-output-args t
  861. "Build output-args for c++-mode."
  862. :type 'boolean
  863. :group 'compile-c++)
  864. (defcustom c++-object-file-ext "o"
  865. "Extension of objects file (result of compilation)
  866. in c++ mode."
  867. :type 'string
  868. :group 'compile-c++)
  869. ;; @@ ada-mode compile variables ;;;
  870. (defgroup compile-ada nil
  871. "Ada compilation options"
  872. :group 'compilation-lang)
  873. (defcustom ada-compilers-list
  874. '( "gcc" "gnat" "ada" )
  875. "List of user's favourites Ada compilers in order of preferencies."
  876. :type '(repeat (string :tag "Ada Compiler name"))
  877. :group 'compile-ada)
  878. (defcustom ada-companion-file-regexp ""
  879. "Regexp to find associated compileable Ada companion file from a spec file.
  880. This is useless in Ada because there do not exists uncompileable files."
  881. :type 'regexp
  882. :group 'compile-ada)
  883. (defcustom ada-default-compiler "ada"
  884. "*Default Ada compiler to use when everything else fails.
  885. This could be any form evaluating to a string, so you could map it to
  886. a function asking you interactively to choose the compiler.
  887. example:
  888. (defun my-choose-compiler()
  889. (read-string \"Ada compiler: \"))
  890. (setq ada-default-compiler 'my-choose-compiler)"
  891. :type '(choice string function)
  892. :group 'compile-ada)
  893. (defcustom ada-compiler-varenv "ADA"
  894. "Varenv indicating the Ada compiler to use."
  895. :type 'string
  896. :group 'compile-ada)
  897. (defcustom ada-aflags-varenv "AFLAGS"
  898. "Varenv indicating the Ada compiler flags to use."
  899. :type 'string
  900. :group 'compile-ada)
  901. (defcustom ada-source-ext-list '( "ads" "adb" "ada" "a" )
  902. "Extensions for Ada compileable source files."
  903. :type '(repeat string)
  904. :group 'compile-ada)
  905. (defcustom ada-headers-ext-list '( "ads" "ada" "a" )
  906. "Extensions for Ada spec source files."
  907. :type '(repeat string)
  908. :group 'compile-ada)
  909. (defcustom ada-default-compiler-options "-g"
  910. "*Default options to give to the Ada compiler.
  911. This could be any form evaluating to a string. See
  912. `mode-compile-choosen-compiler' variable."
  913. :type '(choice
  914. string
  915. (sexp :tag "Form evaluating to a string"))
  916. :group 'compile-ada)
  917. (defcustom ada-source-file-ext-regexp "\\.\\(ad[abs]\\|a\\)"
  918. "Regexp to find, from it's name, if an Ada file is compileable.
  919. This is useless in Ada because there do not exists uncompileable files."
  920. :type 'regexp
  921. :group 'compile-ada)
  922. (defcustom ada-build-output-args t
  923. "Build output-args for ada-mode."
  924. :type 'boolean
  925. :group 'compile-ada)
  926. (defcustom ada-object-file-ext "o"
  927. "Extension of objects file (result of compilation)
  928. in ada mode."
  929. :type 'string
  930. :group 'compile-ada)
  931. ;; @@ fortran-mode compile variables ;;;
  932. (defgroup compile-fortran nil
  933. "Fortran compilation options"
  934. :group 'compilation-lang)
  935. (defcustom f77-compilers-list '( "f77" "fc" )
  936. "List of user's favourite Fortran compilers in order of preferencies."
  937. :type '(repeat (string :tag "C Compiler name"))
  938. :group 'compile-fortran)
  939. (defcustom f77-companion-file-regexp "\\(_[Pp]\\)?\\.[pP]?inc"
  940. "Regexp to find associated .f file from a .inc."
  941. :type 'regexp
  942. :group 'compile-fortran)
  943. (defcustom f77-default-compiler "f77"
  944. "*Default fortran compiler to use when everything else fails..
  945. This could be any form evaluating to a string, so you could map it to
  946. a function asking you interactively to choose the compiler.
  947. example:
  948. (defun my-choose-compiler()
  949. (read-string \"Fortran compiler: \"))
  950. (setq f77-default-compiler 'my-choose-compiler)"
  951. :type '(choice string function)
  952. :group 'compile-fortran)
  953. (defcustom f77-compiler-varenv "F77"
  954. "Varenv indicating the fortran compiler to use."
  955. :type 'string
  956. :group 'compile-fortran)
  957. (defcustom f77-cflags-varenv "FCOPTS"
  958. "Varenv indicating the fortran compiler flags to use."
  959. :type 'string
  960. :group 'compile-fortran)
  961. (defcustom f77-source-ext-list '( "f" "F" "for" "For" )
  962. "Extensions for fortran compileable source files."
  963. :type '(repeat string)
  964. :group 'compile-fortran)
  965. (defcustom f77-headers-ext-list '( "inc" "h")
  966. "Extensions for fortran include files."
  967. :type '(repeat string)
  968. :group 'compile-fortran)
  969. (defcustom f77-default-compiler-options "-w66 -a"
  970. "*Default options to give to the fortran compiler.
  971. This could be any form evaluating to a string. See
  972. `mode-compile-choosen-compiler' variable."
  973. :type '(choice
  974. string
  975. (sexp :tag "Form evaluating to a string"))
  976. :group 'compile-fortran)
  977. (defcustom f77-source-file-ext-regexp "\\.\\([Ff]\\|for\\)"
  978. "Regexp to find, from it's name, if a fortran file is compileable."
  979. :type 'regexp
  980. :group 'compile-fortran)
  981. (defcustom f77-build-output-args t
  982. "Build output-args for f77-mode."
  983. :type 'boolean
  984. :group 'compile-fortran)
  985. (defcustom f77-object-file-ext "o"
  986. "Extension of objects file (result of compilation)
  987. in Fortran mode."
  988. :type 'string
  989. :group 'compile-fortran)
  990. ;; @@ sh-mode compile variables ;;;
  991. (defgroup compile-sh nil
  992. "Sh (Bourne Shell scripts) compilation options"
  993. :group 'compilation-script)
  994. (defcustom sh-command "sh"
  995. "Command to run sh scripts"
  996. :type 'string
  997. :group 'compile-sh)
  998. (defcustom sh-dbg-flags "-fvx"
  999. "*Flags to give to sh for debugging a Bourne Shell script.
  1000. The -f flag must always be present."
  1001. :type 'string
  1002. :group 'compile-sh)
  1003. (defvar sh-compilation-error-regexp-alist nil
  1004. ;; I'd never seen a Bourne shell returning file+line where a syntax
  1005. ;; error occured.
  1006. "Alist that specifies how to match errors in sh output.
  1007. See variable compilation-error-regexp-alist for more details.")
  1008. ;; @@ csh-mode compile variables ;;;
  1009. (defgroup compile-csh nil
  1010. "Csh (C Shell) compilation options"
  1011. :group 'compilation-script)
  1012. (defcustom csh-command "csh"
  1013. "Command to run csh scripts"
  1014. :type 'string
  1015. :group 'compile-csh)
  1016. (defcustom csh-dbg-flags "-fVX"
  1017. "*Flags to give to csh for debugging a C Shell script.
  1018. The -f flag must always be present."
  1019. :type 'string
  1020. :group 'compile-csh)
  1021. (defvar csh-compilation-error-regexp-alist nil
  1022. ;; I'd never seen a C shell returning file+line where a syntax
  1023. ;; error occured.
  1024. "Alist that specifies how to match errors in csh output.
  1025. See variable compilation-error-regexp-alist for more details.")
  1026. ;; @@ zsh-mode compile variables ;;;
  1027. (defgroup compile-zsh nil
  1028. "Zsh (Z Shell scripts) compilation options"
  1029. :group 'compilation-script)
  1030. (defcustom zsh-command "zsh"
  1031. "Command to run zsh scripts"
  1032. :type 'string
  1033. :group 'compile-zsh)
  1034. (defcustom zsh-dbg-flags "-nCvx"
  1035. "*Flags to give to zsh for debugging a Z Shell script."
  1036. :type 'string
  1037. :group 'compile-zsh)
  1038. (defvar zsh-compilation-error-regexp-alist nil
  1039. ;; I'd never seen a Z shell returning file+line where a syntax
  1040. ;; error occured.
  1041. "Alist that specifies how to match errors in csh output.
  1042. See variable compilation-error-regexp-alist for more details.")
  1043. ;; @@ tcl-mode compile variables - JWH ;;;
  1044. (defgroup compile-tcl nil
  1045. "Tcl compilation options"
  1046. :group 'compilation-script)
  1047. (defcustom tcl-command "wish"
  1048. "Command to run tcl scripts"
  1049. :type 'string
  1050. :group 'compile-tcl)
  1051. (defcustom tcl-dbg-flags ""
  1052. "*Flags to give to tcl -- none."
  1053. :type 'string
  1054. :group 'compile-tcl)
  1055. (defvar tcl-compilation-error-regexp-alist
  1056. ;; TK (file "/directory-path/filename.tcl" line XY)
  1057. '(
  1058. ("file \"\\([^ ]+\\)\" line \\([0-9]+\\)[)]" 1 2)
  1059. )
  1060. "Alist that specifies how to match errors in tcl output.
  1061. See variable compilation-error-regexp-alist for more details.")
  1062. ;; @@ python-mode compile variables - BM ;;;
  1063. (defgroup compile-python nil
  1064. "Python compilation options"
  1065. :group 'compilation-script)
  1066. (defcustom python-command "python"
  1067. "Command to run python scripts"
  1068. :type 'string
  1069. :group 'compile-python)
  1070. (defcustom python-dbg-flags ""
  1071. "*Flags to give to python -- none."
  1072. :type 'string
  1073. :group 'compile-python)
  1074. (defvar python-compilation-error-regexp-alist
  1075. ;; TK (file "/directory-path/filename.tcl" line XY in ZZZ)
  1076. '(
  1077. ("File \"\\([^ ]+\\)\", line \\([0-9]+\\).*" 1 2)
  1078. )
  1079. "Alist that specifies how to match errors in python output.
  1080. See variable compilation-error-regexp-alist for more details.")
  1081. ;; @@ perl-mode compile variables ;;;
  1082. (defgroup compile-perl nil
  1083. "Perl compilation options"
  1084. :group 'compilation-script)
  1085. (defcustom perl-command "perl"
  1086. "Command to run perl."
  1087. :type 'string
  1088. :group 'compile-perl)
  1089. (defcustom perl-dbg-flags "-w"
  1090. "*Flags to give to perl for debugging a Perl script."
  1091. :type 'string
  1092. :group 'compile-perl)
  1093. (defvar perl-compilation-error-regexp-alist
  1094. ;; Contributed by Martin Jost
  1095. '(
  1096. ;; PERL 4
  1097. ("in file \\([^ ]+\\) at line \\([0-9]+\\).*" 1 2)
  1098. ;; PERL 5 Blubber at FILE line XY, <XY> line ab.
  1099. ("at \\([^ ]+\\) line \\([0-9]+\\)," 1 2)
  1100. ;; PERL 5 Blubber at FILE line XY.
  1101. ("at \\([^ ]+\\) line \\([0-9]+\\)." 1 2)
  1102. )
  1103. ;; This look like a paranoiac regexp: could anybody find a better one? (which WORK).
  1104. ;;'(("^[^\n]* \\(file\\|at\\) \\([^ \t\n]+\\) [^\n]*line \\([0-9]+\\)[\\.,]" 2 3))
  1105. "Alist that specifies how to match errors in perl output.
  1106. See variable compilation-error-regexp-alist for more details.")
  1107. ;; @@ ruby-mode compile variables ;;;
  1108. (defgroup compile-ruby nil
  1109. "Ruby compilation options"
  1110. :group 'compilation-script)
  1111. (defcustom ruby-command "ruby"
  1112. "Command to run ruby"
  1113. :type 'string
  1114. :group 'compile-ruby)
  1115. (defcustom ruby-dbg-flags "-w"
  1116. "Flags to give ruby for catching warnings"
  1117. :type 'string
  1118. :group 'compile-ruby)
  1119. (defvar ruby-compilation-error-regexp-alist
  1120. '(
  1121. ;; Unit Tests
  1122. ("test[a-zA-Z0-9_]*([A-Z][a-zA-Z0-9_]*) \\[\\(.*\\):\\([0-9]+\\)\\]:" 1 2)
  1123. ;; Errors and Warnings
  1124. ("\\(.*?\\)\\([0-9A-Za-z_./\:-]+\\.rb\\):\\([0-9]+\\)" 2 3))
  1125. "Alist that specifies how to match errors in ruby output.
  1126. See variable compilation-error-regexp-alist for more details.")
  1127. ;; @@ emacs lisp compile variables ;;;
  1128. ;;;###autoload
  1129. (defcustom emacs-lisp-byte-compile-dir-interactive-p t
  1130. "*Non-nil means when byte-compiling a directory ask for each file
  1131. needing to be recompiled or not."
  1132. :type 'boolean
  1133. :group 'compilation-elisp)
  1134. (define-obsolete-variable-alias
  1135. 'mode-compile-byte-compile-dir-interactive-p
  1136. 'emacs-lisp-byte-compile-dir-interactive-p)
  1137. (defcustom emacs-lisp-sources-regexp
  1138. (cond
  1139. ((boundp 'emacs-lisp-file-regexp)
  1140. emacs-lisp-file-regexp)
  1141. (t
  1142. "\\.el$"))
  1143. "Regexp to find emacs lisp sources files."
  1144. :type 'regexp
  1145. :group 'compilation-elisp)
  1146. (defcustom emacs-lisp-bytecomp-ext "c"
  1147. "Extension added to byte-compiled emacs sources files."
  1148. :type 'string
  1149. :group 'compilation-elisp)
  1150. ;; @@ Misc declarations ;;;
  1151. ;;;###autoload
  1152. (defconst mode-compile-version "2.28"
  1153. "Current version of mode-compile package.
  1154. mode-compile.el,v 2.28 2003/04/01 13:52:47 boubaker Exp
  1155. Please send bugs-fixes/contributions/comments to boubaker@cena.fr")
  1156. (defconst mode-compile-help-address "heddy.Boubaker@cena.fr"
  1157. "E-Mail address of mode-compile maintainer.")
  1158. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1159. ;; @ No user modifiable stuff below this line ;;;
  1160. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1161. ;; Save old compile function. In case someone will bound
  1162. ;; mode-compile on 'compile.
  1163. (or (fboundp 'mc--compile-sav)
  1164. (if (fboundp 'compile)
  1165. (progn
  1166. (fset 'mc--compile-sav (symbol-function 'compile))
  1167. (put 'compile 'compile-saved-on-mc--compile-sav t))
  1168. (error "`compile' function not known to be defined...")))
  1169. ;; @@ Internals variables and constants ;;;
  1170. ;; Mode specific
  1171. (defvar mc--comp-lst nil) ; c-mode,c++-mode,ada-mode,fortran-mode
  1172. (defvar mc--def-comp nil) ; itou
  1173. (defvar mc--compfile-regexp nil) ; itou
  1174. (defvar mc--comp-varenv nil) ; itou
  1175. (defvar mc--comp-options nil) ; itou
  1176. (defvar mc--cflags-varenv nil) ; itou
  1177. (defvar mc--source-ext-lst nil) ; itou
  1178. (defvar mc--head-ext-lst nil) ; itou
  1179. (defvar mc--source-ext-regexp nil) ; itou
  1180. (defvar mc--build-op-args nil) ; itou
  1181. (defvar mc--outfile-ext nil) ; itou
  1182. ;; remote stuff
  1183. (defvar mc--efs-path-list nil)
  1184. (defvar mc--remote-host nil)
  1185. (defvar mc--remote-host-history nil)
  1186. (defvar mc--remote-username nil)
  1187. (defvar mc--remote-command nil)
  1188. (defvar mc--remote-pathname nil)
  1189. ;; Frames/Windows stuff
  1190. (defvar mc--other-frame nil)
  1191. (defvar mc--ws (or
  1192. (and (fboundp 'console-type) (console-type))
  1193. (and (fboundp 'device-type) (device-type))
  1194. window-system))
  1195. (defvar mc--compile-command nil)
  1196. ;; Compile command used when no makefile has been found.
  1197. ;; This variable is buffer local to keep history for read-string.
  1198. ;; Unfortunately not a real history, keep only memory of
  1199. ;; the last compile command used.
  1200. (make-variable-buffer-local 'mc--compile-command)
  1201. (d

Large files files are truncated, but you can click here to view the full file