annotate lisp/pcl-cvs/pcl-cvs-xemacs.el @ 192:9d35321dd38c

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