annotate lisp/cedet/ede/auto.el @ 110621:c13750cbdbc5

tar-mode.el (tar-header-block-tokenize): Decode filenames in "ustar" format.
author Kenichi Handa <handa@m17n.org>
date Mon, 27 Sep 2010 14:01:48 +0900
parents b150a06c6999
children 376148b31b5e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
110526
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1 ;;; ede/auto.el --- Autoload features for EDE
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
3 ;; Copyright (C) 2010 Free Software Foundation, Inc.
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
4
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
5 ;; Author: Eric M. Ludlam <zappo@gnu.org>
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
6
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
7 ;; This file is part of GNU Emacs.
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
8
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
9 ;; GNU Emacs is free software: you can redistribute it and/or modify
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
10 ;; it under the terms of the GNU General Public License as published by
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
11 ;; the Free Software Foundation, either version 3 of the License, or
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
12 ;; (at your option) any later version.
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
13
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
14 ;; GNU Emacs is distributed in the hope that it will be useful,
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
17 ;; GNU General Public License for more details.
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
18
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
19 ;; You should have received a copy of the GNU General Public License
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
20 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
21
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
22 ;;; Commentary:
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
23 ;;
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
24 ;; EDE Autoloads are a way to refer to different project types without
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
25 ;; loading those projects into Emacs.
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
26 ;;
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
27 ;; These routines are used to detect a project in a filesystem before
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
28 ;; handing over control to the usual EDE project system.
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
29
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
30 ;;; Code:
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
31
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
32 (require 'eieio)
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
33
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
34 (defclass ede-project-autoload ()
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
35 ((name :initarg :name
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
36 :documentation "Name of this project type")
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
37 (file :initarg :file
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
38 :documentation "The lisp file belonging to this class.")
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
39 (proj-file :initarg :proj-file
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
40 :documentation "Name of a project file of this type.")
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
41 (proj-root :initarg :proj-root
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
42 :type function
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
43 :documentation "A function symbol to call for the project root.
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
44 This function takes no arguments, and returns the current directories
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
45 root, if available. Leave blank to use the EDE directory walking
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
46 routine instead.")
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
47 (initializers :initarg :initializers
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
48 :initform nil
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
49 :documentation
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
50 "Initializers passed to the project object.
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
51 These are used so there can be multiple types of projects
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
52 associated with a single object class, based on the initilizeres used.")
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
53 (load-type :initarg :load-type
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
54 :documentation "Fn symbol used to load this project file.")
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
55 (class-sym :initarg :class-sym
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
56 :documentation "Symbol representing the project class to use.")
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
57 (new-p :initarg :new-p
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
58 :initform t
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
59 :documentation
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
60 "Non-nil if this is an option when a user creates a project.")
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
61 )
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
62 "Class representing minimal knowledge set to run preliminary EDE functions.
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
63 When more advanced functionality is needed from a project type, that projects
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
64 type is required and the load function used.")
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
65
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
66 (defvar ede-project-class-files
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
67 (list
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
68 (ede-project-autoload "edeproject-makefile"
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
69 :name "Make" :file 'ede/proj
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
70 :proj-file "Project.ede"
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
71 :load-type 'ede-proj-load
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
72 :class-sym 'ede-proj-project)
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
73 (ede-project-autoload "edeproject-automake"
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
74 :name "Automake" :file 'ede/proj
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
75 :proj-file "Project.ede"
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
76 :initializers '(:makefile-type Makefile.am)
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
77 :load-type 'ede-proj-load
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
78 :class-sym 'ede-proj-project)
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
79 (ede-project-autoload "automake"
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
80 :name "automake" :file 'ede/project-am
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
81 :proj-file "Makefile.am"
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
82 :load-type 'project-am-load
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
83 :class-sym 'project-am-makefile
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
84 :new-p nil))
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
85 "List of vectors defining how to determine what type of projects exist.")
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
86
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
87 ;;; EDE project-autoload methods
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
88 ;;
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
89 (defmethod ede-project-root ((this ede-project-autoload))
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
90 "If a project knows its root, return it here.
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
91 Allows for one-project-object-for-a-tree type systems."
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
92 nil)
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
93
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
94 (defmethod ede-project-root-directory ((this ede-project-autoload)
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
95 &optional file)
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
96 "If a project knows its root, return it here.
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
97 Allows for one-project-object-for-a-tree type systems.
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
98 Optional FILE is the file to test. If there is no FILE, use
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
99 the current buffer."
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
100 (when (not file)
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
101 (setq file default-directory))
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
102 (when (slot-boundp this :proj-root)
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
103 (let ((rootfcn (oref this proj-root)))
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
104 (when rootfcn
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
105 (condition-case nil
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
106 (funcall rootfcn file)
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
107 (error
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
108 (funcall rootfcn)))
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
109 ))))
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
110
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
111 (defmethod ede-dir-to-projectfile ((this ede-project-autoload) dir)
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
112 "Return a full file name of project THIS found in DIR.
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
113 Return nil if the project file does not exist."
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
114 (let* ((d (file-name-as-directory dir))
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
115 (root (ede-project-root-directory this d))
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
116 (pf (oref this proj-file))
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
117 (f (cond ((stringp pf)
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
118 (expand-file-name pf (or root d)))
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
119 ((and (symbolp pf) (fboundp pf))
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
120 (funcall pf (or root d)))))
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
121 )
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
122 (when (and f (file-exists-p f))
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
123 f)))
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
124
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
125
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
126 (provide 'ede/auto)
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
127
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
128 ;;; ede/auto.el ends here