Mercurial > emacs
annotate lisp/cedet/ede/dired.el @ 106220:a88a54e96796
vc-git-registered: use checkout directory (where .git is)
rather than the file's directory and a relative path spec to work around a bug in git.
author | David Reitter <david.reitter@gmail.com> |
---|---|
date | Tue, 24 Nov 2009 15:31:01 +0000 |
parents | 3fe6da4a95a9 |
children | 1d1d5d9bd884 |
rev | line source |
---|---|
104496
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1 ;;; ede/dired.el --- EDE extensions to dired. |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
2 |
105292 | 3 ;; Copyright (C) 1998, 1999, 2000, 2003, 2009 |
4 ;; Free Software Foundation, Inc. | |
104496
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
5 |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
6 ;; Author: Eric M. Ludlam <zappo@gnu.org> |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
7 ;; Version: 0.4 |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
8 ;; Keywords: project, make |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
9 |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
10 ;; This file is part of GNU Emacs. |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
11 |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
12 ;; GNU Emacs is free software: you can redistribute it and/or modify |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
13 ;; it under the terms of the GNU General Public License as published by |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
14 ;; the Free Software Foundation, either version 3 of the License, or |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
15 ;; (at your option) any later version. |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
16 |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
17 ;; GNU Emacs is distributed in the hope that it will be useful, |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
20 ;; GNU General Public License for more details. |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
21 |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
22 ;; You should have received a copy of the GNU General Public License |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
24 |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
25 ;;; Commentary: |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
26 ;; |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
27 ;; This provides a dired interface to EDE, allowing users to modify |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
28 ;; their project file by adding files (or whatever) directly from a |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
29 ;; dired buffer. |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
30 |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
31 (require 'easymenu) |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
32 (require 'dired) |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
33 (require 'ede) |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
34 |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
35 ;;; Code: |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
36 (defvar ede-dired-minor-mode nil |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
37 "Non-nil when in ede dired minor mode.") |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
38 (make-variable-buffer-local 'ede-dired-minor-mode) |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
39 |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
40 (defvar ede-dired-keymap nil |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
41 "Keymap used for ede dired minor mode.") |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
42 |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
43 (if ede-dired-keymap |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
44 nil |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
45 (setq ede-dired-keymap (make-sparse-keymap)) |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
46 (define-key ede-dired-keymap ".a" 'ede-dired-add-to-target) |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
47 (define-key ede-dired-keymap ".t" 'ede-new-target) |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
48 (define-key ede-dired-keymap ".s" 'ede-speedbar) |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
49 (define-key ede-dired-keymap ".C" 'ede-compile-project) |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
50 (define-key ede-dired-keymap ".d" 'ede-make-dist) |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
51 |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
52 (easy-menu-define |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
53 ede-dired-menu ede-dired-keymap "EDE Dired Minor Mode Menu" |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
54 '("Project" |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
55 [ "Add files to target" ede-dired-add-to-target (ede-current-project) ] |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
56 ( "Build" :filter ede-build-forms-menu) |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
57 "-" |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
58 [ "Create Project" ede-new (not (ede-current-project)) ] |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
59 [ "Create Target" ede-new-target (ede-current-project) ] |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
60 "-" |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
61 ( "Customize Project" :filter ede-customize-forms-menu ) |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
62 [ "View Project Tree" ede-speedbar (ede-current-project) ] |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
63 )) |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
64 ) |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
65 |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
66 (defun ede-dired-minor-mode (&optional arg) |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
67 "A minor mode that should only be activated in DIRED buffers. |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
68 If ARG is nil, toggle, if it is a positive number, force on, if |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
69 negative, force off." |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
70 (interactive "P") |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
71 (if (not (or (eq major-mode 'dired-mode) |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
72 (eq major-mode 'vc-dired-mode))) |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
73 (error "Not in DIRED mode")) |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
74 (setq ede-dired-minor-mode |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
75 (not (or (and (null arg) ede-dired-minor-mode) |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
76 (<= (prefix-numeric-value arg) 0)))) |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
77 (if (and (not (ede-directory-project-p default-directory)) |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
78 (not (interactive-p))) |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
79 (setq ede-dired-minor-mode nil)) |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
80 ) |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
81 |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
82 (defun ede-dired-add-to-target (target) |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
83 "Add a file, or all marked files into a TARGET." |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
84 (interactive (list |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
85 (let ((ede-object (ede-current-project))) |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
86 (ede-invoke-method 'project-interactive-select-target |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
87 "Add files to Target: ")))) |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
88 (let ((files (dired-get-marked-files t))) |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
89 (while files |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
90 (project-add-file target (car files)) |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
91 ;; Find the buffer for this files, and set it's ede-object |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
92 (if (get-file-buffer (car files)) |
105799
3fe6da4a95a9
* cedet/srecode/srt-mode.el (semantic-analyze-possible-completions):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105377
diff
changeset
|
93 (with-current-buffer (get-file-buffer (car files)) |
104496
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
94 (setq ede-object nil) |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
95 (setq ede-object (ede-buffer-object (current-buffer))))) |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
96 ;; Increment. |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
97 (setq files (cdr files))))) |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
98 |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
99 ;; Minor mode management. |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
100 (add-to-list 'minor-mode-alist '(ede-dired-minor-mode " EDE")) |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
101 (let ((a (assoc 'ede-dired-minor-mode minor-mode-map-alist))) |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
102 (if a |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
103 (setcdr a ede-dired-keymap) |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
104 (add-to-list 'minor-mode-map-alist (cons 'ede-dired-minor-mode |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
105 ede-dired-keymap)))) |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
106 |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
107 (provide 'ede/dired) |
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
108 |
105377 | 109 ;; arch-tag: 95d3e0a7-a8b7-43a9-b7df-ba647e4c56f6 |
104496
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
110 ;;; ede/dired.el ends here |