Mercurial > hg > xemacs-beta
comparison lisp/pcl-cvs/pcl-cvs-xemacs.el @ 0:376386a54a3c r19-14
Import from CVS: tag r19-14
author | cvs |
---|---|
date | Mon, 13 Aug 2007 08:45:50 +0200 |
parents | |
children | 0293115a14e9 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:376386a54a3c |
---|---|
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 | |
18 ;; along with XEmacs; see the file COPYING. If not, write to the Free | |
19 ;; Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | |
20 | |
21 | |
22 ;; This simply adds a menu of the common CVS commands to the menubar and to | |
23 ;; the right mouse button. Clicking right moves point, and then pops up a | |
24 ;; menu from which commands can be executed. | |
25 ;; | |
26 ;; This could stand to be a lot more clever: for example, the "Commit Changes" | |
27 ;; command should only be active on files for which there is something to | |
28 ;; commit. Also, some indication of which files the command applies to | |
29 ;; (especially in the presence of multiple marked files) would be nice. | |
30 ;; | |
31 ;; Middle-click runs find-file. | |
32 | |
33 | |
34 (require 'pcl-cvs) | |
35 ;(load "pcl-cvs.el") | |
36 | |
37 (defvar cvs-menu | |
38 '("CVS" | |
39 ["Find File" cvs-mode-find-file t] | |
40 ["Find File Other Window" cvs-mode-find-file-other-window t] | |
41 ["Interactively Merge (emerge)" cvs-mode-emerge t] | |
42 ["Diff against Repository" cvs-mode-diff-cvs t] | |
43 ["Diff against Backup Version" cvs-mode-diff-backup t] | |
44 "----" | |
45 ["Commit Changes to Repository" cvs-mode-commit t] | |
46 ["Revert File from Repository" cvs-mode-undo-local-changes t] | |
47 ["Add File to Repository" cvs-mode-add t] | |
48 ["Remove File from Repository" cvs-mode-remove-file t] | |
49 ["Ignore File" cvs-mode-ignore t] | |
50 ["Hide File" cvs-mode-acknowledge t] | |
51 ["Hide Handled Files" cvs-mode-remove-handled t] | |
52 "----" | |
53 ["Add ChangeLog Entry" cvs-mode-add-change-log-entry-other-window t] | |
54 ["Show CVS Log" cvs-mode-log t] | |
55 ["Show CVS Status" cvs-mode-status t] | |
56 "----" | |
57 ["Mark File" cvs-mode-mark t] | |
58 ["Unmark File" cvs-mode-unmark t] | |
59 ["Mark All Files" cvs-mode-mark-all-files t] | |
60 ["Unmark All Files" cvs-mode-unmark-all-files t] | |
61 "----" | |
62 ["Quit" bury-buffer t] | |
63 )) | |
64 | |
65 (defun cvs-menu (e) | |
66 (interactive "e") | |
67 (mouse-set-point e) | |
68 (beginning-of-line) | |
69 (or (looking-at "^[* ] ") (error "No CVS file line here")) | |
70 (popup-menu cvs-menu)) | |
71 | |
72 (defun cvs-mouse-find-file (e) | |
73 (interactive "e") | |
74 (mouse-set-point e) | |
75 (beginning-of-line) | |
76 (or (looking-at "^[* ] ") (error "No CVS file line here")) | |
77 (cvs-mode-find-file (point))) | |
78 | |
79 (define-key cvs-mode-map 'button3 'cvs-menu) | |
80 (define-key cvs-mode-map 'button2 'cvs-mouse-find-file) | |
81 | |
82 (make-face 'cvs-header-face) | |
83 (make-face 'cvs-filename-face) | |
84 (make-face 'cvs-status-face) | |
85 | |
86 (or (face-differs-from-default-p 'cvs-header-face) | |
87 (copy-face 'italic 'cvs-header-face)) | |
88 | |
89 (or (face-differs-from-default-p 'cvs-filename-face) | |
90 (copy-face 'bold 'cvs-filename-face)) | |
91 | |
92 (or (face-differs-from-default-p 'cvs-status-face) | |
93 (copy-face 'bold-italic 'cvs-status-face)) | |
94 | |
95 | |
96 (defun pcl-mode-motion-highlight-line (event) | |
97 (if (save-excursion | |
98 (let* ((window (event-window event)) | |
99 (buffer (and window (event-buffer event))) | |
100 (point (and buffer (event-point event)))) | |
101 (and point | |
102 (progn | |
103 (set-buffer buffer) | |
104 (goto-char point) | |
105 (beginning-of-line) | |
106 (looking-at "^[* ] "))))) | |
107 (mode-motion-highlight-line event))) | |
108 | |
109 (defconst pcl-cvs-font-lock-keywords | |
110 '(("^In directory \\(.+\\)$" 1 cvs-header-face) | |
111 ("^[* ] \\w+ +\\(ci\\)" 1 cvs-status-face) | |
112 ("^[* ] \\(Conflict\\|Merged\\)" 1 cvs-status-face) | |
113 ("^[* ] \\w+ +\\(ci +\\)?\\(.+\\)$" 2 cvs-filename-face) | |
114 ) | |
115 "Patterns to highlight in the *cvs* buffer.") | |
116 | |
117 ;;;###autoload | |
118 (defun pcl-cvs-fontify () | |
119 ;; | |
120 ;; set up line highlighting | |
121 (require 'mode-motion) | |
122 (setq mode-motion-hook 'pcl-mode-motion-highlight-line) | |
123 ;; | |
124 ;; set up menubar | |
125 (if (and current-menubar (not (assoc "CVS" current-menubar))) | |
126 (progn | |
127 (set-buffer-menubar (copy-sequence current-menubar)) | |
128 (add-menu nil "CVS" (cdr cvs-menu)))) | |
129 ;; | |
130 ;; fontify mousable lines | |
131 (set (make-local-variable 'font-lock-keywords) pcl-cvs-font-lock-keywords) | |
132 (font-lock-mode 1) | |
133 ) | |
134 | |
135 (add-hook 'cvs-mode-hook 'pcl-cvs-fontify) |