]> git.rkrishnan.org Git - .emacs.d.git/blob - emacs/nxhtml/related/flymake-helpers.el
submodulized .emacs.d setup
[.emacs.d.git] / emacs / nxhtml / related / flymake-helpers.el
1 ;;; flymake-helpers.el --- Helper functions for flymake
2 ;;
3 ;; Author: Lennart Borgman (lennart O borgman A gmail O com)
4 ;; Created: 2008-07-21T14:30:20+0200 Mon
5 ;; Version:
6 ;; Last-Updated:
7 ;; URL:
8 ;; Keywords:
9 ;; Compatibility:
10 ;;
11 ;; Features that might be required by this library:
12 ;;
13 ;;   None
14 ;;
15 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
16 ;;
17 ;;; Commentary:
18 ;;
19 ;;
20 ;;
21 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
22 ;;
23 ;;; Change log:
24 ;;
25 ;;
26 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
27 ;;
28 ;; This program is free software; you can redistribute it and/or
29 ;; modify it under the terms of the GNU General Public License as
30 ;; published by the Free Software Foundation; either version 2, or
31 ;; (at your option) any later version.
32 ;;
33 ;; This program is distributed in the hope that it will be useful,
34 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
35 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
36 ;; General Public License for more details.
37 ;;
38 ;; You should have received a copy of the GNU General Public License
39 ;; along with this program; see the file COPYING.  If not, write to
40 ;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth
41 ;; Floor, Boston, MA 02110-1301, USA.
42 ;;
43 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
44 ;;
45 ;;; Code:
46
47 (eval-when-compile (require 'flymake))
48
49 ;; (flymake-create-temp-intemp buffer-file-name nil)
50 (defun flymake-create-temp-intemp (file-name prefix)
51   "Return file name in temporary directory for checking FILE-NAME.
52 This is a replacement for `flymake-create-temp-inplace'. The
53 only difference is that it gives a file name in
54 `temporary-file-directory' instead of the same directory as
55 FILE-NAME.
56
57 For the use of PREFIX see that function.
58
59 Note that not making the temporary file in another directory
60 \(like here) will not work if the file you are checking depends
61 on relative paths to other files \(for the type of checks flymake
62 makes)."
63   (unless (stringp file-name)
64     (error "Invalid file-name"))
65   (or prefix
66       (setq prefix "flymake"))
67   (let* ((prefix (concat
68                   (file-name-nondirectory (file-name-sans-extension file-name))
69                   "_" prefix))
70          (suffix  (concat "." (file-name-extension file-name)))
71          (temp-name (make-temp-file prefix nil suffix)))
72     (flymake-log 3 "create-temp-intemp: file=%s temp=%s" file-name temp-name)
73     temp-name))
74
75
76 (provide 'flymake-helpers)
77 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
78 ;;; flymake-helpers.el ends here