annotate lisp/pcl-cvs/pcl-cvs-xemacs.el @ 16:0293115a14e9 r19-15b91

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