0
|
1 ;;; Mouse and font support for PCL-CVS 1.3 running in XEmacs
|
|
2 ;; @(#) Id: pcl-cvs-xemacs.el,v 1.2 1993/05/31 19:37:34 ceder Exp
|
|
3 ;; Copyright (C) 1992-1993 Free Software Foundation, Inc.
|
|
4
|
|
5 ;; This file is part of XEmacs.
|
|
6
|
|
7 ;; XEmacs is free software; you can redistribute it and/or modify it
|
|
8 ;; under the terms of the GNU General Public License as published by
|
|
9 ;; the Free Software Foundation; either version 2, or (at your option)
|
|
10 ;; any later version.
|
|
11
|
|
12 ;; XEmacs is distributed in the hope that it will be useful, but
|
|
13 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
15 ;; General Public License for more details.
|
|
16
|
|
17 ;; You should have received a copy of the GNU General Public License
|
16
|
18 ;; along with XEmacs; see the file COPYING. If not, write to the
|
|
19 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
20 ;; Boston, MA 02111-1307, USA.
|
0
|
21
|
|
22
|
|
23 ;; This simply adds a menu of the common CVS commands to the menubar and to
|
|
24 ;; the right mouse button. Clicking right moves point, and then pops up a
|
|
25 ;; menu from which commands can be executed.
|
|
26 ;;
|
|
27 ;; This could stand to be a lot more clever: for example, the "Commit Changes"
|
|
28 ;; command should only be active on files for which there is something to
|
|
29 ;; commit. Also, some indication of which files the command applies to
|
|
30 ;; (especially in the presence of multiple marked files) would be nice.
|
|
31 ;;
|
|
32 ;; Middle-click runs find-file.
|
|
33
|
|
34
|
|
35 (require 'pcl-cvs)
|
|
36 ;(load "pcl-cvs.el")
|
|
37
|
|
38 (defvar cvs-menu
|
|
39 '("CVS"
|
|
40 ["Find File" cvs-mode-find-file t]
|
|
41 ["Find File Other Window" cvs-mode-find-file-other-window t]
|
|
42 ["Interactively Merge (emerge)" cvs-mode-emerge t]
|
|
43 ["Diff against Repository" cvs-mode-diff-cvs t]
|
|
44 ["Diff against Backup Version" cvs-mode-diff-backup t]
|
|
45 "----"
|
|
46 ["Commit Changes to Repository" cvs-mode-commit t]
|
|
47 ["Revert File from Repository" cvs-mode-undo-local-changes t]
|
|
48 ["Add File to Repository" cvs-mode-add t]
|
|
49 ["Remove File from Repository" cvs-mode-remove-file t]
|
|
50 ["Ignore File" cvs-mode-ignore t]
|
|
51 ["Hide File" cvs-mode-acknowledge t]
|
|
52 ["Hide Handled Files" cvs-mode-remove-handled t]
|
|
53 "----"
|
|
54 ["Add ChangeLog Entry" cvs-mode-add-change-log-entry-other-window t]
|
|
55 ["Show CVS Log" cvs-mode-log t]
|
|
56 ["Show CVS Status" cvs-mode-status t]
|
|
57 "----"
|
|
58 ["Mark File" cvs-mode-mark t]
|
|
59 ["Unmark File" cvs-mode-unmark t]
|
|
60 ["Mark All Files" cvs-mode-mark-all-files t]
|
|
61 ["Unmark All Files" cvs-mode-unmark-all-files t]
|
|
62 "----"
|
|
63 ["Quit" bury-buffer t]
|
|
64 ))
|
|
65
|
|
66 (defun cvs-menu (e)
|
|
67 (interactive "e")
|
|
68 (mouse-set-point e)
|
|
69 (beginning-of-line)
|
|
70 (or (looking-at "^[* ] ") (error "No CVS file line here"))
|
|
71 (popup-menu cvs-menu))
|
|
72
|
|
73 (defun cvs-mouse-find-file (e)
|
|
74 (interactive "e")
|
|
75 (mouse-set-point e)
|
|
76 (beginning-of-line)
|
|
77 (or (looking-at "^[* ] ") (error "No CVS file line here"))
|
|
78 (cvs-mode-find-file (point)))
|
|
79
|
|
80 (define-key cvs-mode-map 'button3 'cvs-menu)
|
|
81 (define-key cvs-mode-map 'button2 'cvs-mouse-find-file)
|
|
82
|
|
83 (make-face 'cvs-header-face)
|
|
84 (make-face 'cvs-filename-face)
|
|
85 (make-face 'cvs-status-face)
|
|
86
|
|
87 (or (face-differs-from-default-p 'cvs-header-face)
|
|
88 (copy-face 'italic 'cvs-header-face))
|
|
89
|
|
90 (or (face-differs-from-default-p 'cvs-filename-face)
|
|
91 (copy-face 'bold 'cvs-filename-face))
|
|
92
|
|
93 (or (face-differs-from-default-p 'cvs-status-face)
|
|
94 (copy-face 'bold-italic 'cvs-status-face))
|
|
95
|
|
96
|
|
97 (defun pcl-mode-motion-highlight-line (event)
|
|
98 (if (save-excursion
|
|
99 (let* ((window (event-window event))
|
|
100 (buffer (and window (event-buffer event)))
|
|
101 (point (and buffer (event-point event))))
|
|
102 (and point
|
|
103 (progn
|
|
104 (set-buffer buffer)
|
|
105 (goto-char point)
|
|
106 (beginning-of-line)
|
|
107 (looking-at "^[* ] ")))))
|
|
108 (mode-motion-highlight-line event)))
|
|
109
|
|
110 (defconst pcl-cvs-font-lock-keywords
|
|
111 '(("^In directory \\(.+\\)$" 1 cvs-header-face)
|
|
112 ("^[* ] \\w+ +\\(ci\\)" 1 cvs-status-face)
|
|
113 ("^[* ] \\(Conflict\\|Merged\\)" 1 cvs-status-face)
|
|
114 ("^[* ] \\w+ +\\(ci +\\)?\\(.+\\)$" 2 cvs-filename-face)
|
|
115 )
|
|
116 "Patterns to highlight in the *cvs* buffer.")
|
|
117
|
|
118 ;;;###autoload
|
|
119 (defun pcl-cvs-fontify ()
|
|
120 ;;
|
|
121 ;; set up line highlighting
|
|
122 (require 'mode-motion)
|
|
123 (setq mode-motion-hook 'pcl-mode-motion-highlight-line)
|
|
124 ;;
|
|
125 ;; set up menubar
|
|
126 (if (and current-menubar (not (assoc "CVS" current-menubar)))
|
|
127 (progn
|
|
128 (set-buffer-menubar (copy-sequence current-menubar))
|
|
129 (add-menu nil "CVS" (cdr cvs-menu))))
|
|
130 ;;
|
|
131 ;; fontify mousable lines
|
|
132 (set (make-local-variable 'font-lock-keywords) pcl-cvs-font-lock-keywords)
|
|
133 (font-lock-mode 1)
|
|
134 )
|
|
135
|
|
136 (add-hook 'cvs-mode-hook 'pcl-cvs-fontify)
|