aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2000-11-06 07:01:10 +0000
committerStefan Monnier2000-11-06 07:01:10 +0000
commitc68088c2016bf192f2159399d9e3cd6a322b3388 (patch)
treefec0785622f7c25fcf69b336215c03925ad92410
parent138e1bd0aca8f84785412bacb21a872aaea02ad3 (diff)
downloademacs-c68088c2016bf192f2159399d9e3cd6a322b3388.tar.gz
emacs-c68088c2016bf192f2159399d9e3cd6a322b3388.zip
(cvs-tree-merge): Use cvs-butlast (avoid CL).
(cvs-status-get-tags): Fix regexp. (cvs-status-trees, cvs-status-cvstrees): Combine after change hooks and don't sit-for. (cvs-tree-use-jisx0208): Renamed from cvs-tree-dstr-2byte-ready. (cvs-tree-char-*): Renamed from cvs-tree-dstr-char-*. Use make-char rather than hard-coded cryptic data. (cvs-status-cvstrees): Convert the buffer to multibyte if necessary.
-rw-r--r--lisp/cvs-status.el112
1 files changed, 63 insertions, 49 deletions
diff --git a/lisp/cvs-status.el b/lisp/cvs-status.el
index bed3b618520..c13d1cb18f5 100644
--- a/lisp/cvs-status.el
+++ b/lisp/cvs-status.el
@@ -5,7 +5,7 @@
5;; Author: Stefan Monnier <monnier@cs.yale.edu> 5;; Author: Stefan Monnier <monnier@cs.yale.edu>
6;; Keywords: pcl-cvs cvs status tree 6;; Keywords: pcl-cvs cvs status tree
7;; Version: $Name: $ 7;; Version: $Name: $
8;; Revision: $Id: cvs-status.el,v 1.6 2000/08/16 20:46:32 monnier Exp $ 8;; Revision: $Id: cvs-status.el,v 1.7 2000/09/29 02:19:10 monnier Exp $
9 9
10;; This file is part of GNU Emacs. 10;; This file is part of GNU Emacs.
11 11
@@ -28,7 +28,6 @@
28 28
29;; Todo: 29;; Todo:
30 30
31;; - Rename to cvs-status-mode.el
32;; - Somehow allow cvs-status-tree to work on-the-fly 31;; - Somehow allow cvs-status-tree to work on-the-fly
33 32
34;;; Code: 33;;; Code:
@@ -88,7 +87,7 @@
88 (forward-line 1)) 87 (forward-line 1))
89 (1 font-lock-function-name-face))))) 88 (1 font-lock-function-name-face)))))
90(defconst cvs-status-font-lock-defaults 89(defconst cvs-status-font-lock-defaults
91 '(cvs-status-font-lock-keywords t nil nil nil)) 90 '(cvs-status-font-lock-keywords t nil nil nil (font-lock-multiline . t)))
92 91
93 92
94(put 'cvs-status-mode 'mode-class 'special) 93(put 'cvs-status-mode 'mode-class 'special)
@@ -279,9 +278,11 @@ BEWARE: because of stability issues, this is not a symetric operation."
279 (cvs-tree-merge (cvs-cdr rev1) (cvs-cdr rev2))) 278 (cvs-tree-merge (cvs-cdr rev1) (cvs-cdr rev2)))
280 (cvs-tree-merge (cdr tree1) (cdr tree2)))))) 279 (cvs-tree-merge (cdr tree1) (cdr tree2))))))
281 ((> l1 l2) 280 ((> l1 l2)
282 (cvs-tree-merge (list (cons (cvs-tag-make (butlast vl1)) tree1)) tree2)) 281 (cvs-tree-merge
282 (list (cons (cvs-tag-make (cvs-butlast vl1)) tree1)) tree2))
283 ((< l1 l2) 283 ((< l1 l2)
284 (cvs-tree-merge tree1 (list (cons (cvs-tag-make (butlast vl2)) tree2))))))))) 284 (cvs-tree-merge
285 tree1 (list (cons (cvs-tag-make (cvs-butlast vl2)) tree2)))))))))
285 286
286(defun cvs-tag-make-tag (tag) 287(defun cvs-tag-make-tag (tag)
287 (let ((vl (mapcar 'string-to-number (split-string (nth 2 tag) "\\.")))) 288 (let ((vl (mapcar 'string-to-number (split-string (nth 2 tag) "\\."))))
@@ -290,12 +291,13 @@ BEWARE: because of stability issues, this is not a symetric operation."
290(defun cvs-tags->tree (tags) 291(defun cvs-tags->tree (tags)
291 "Make a tree out of a list of TAGS." 292 "Make a tree out of a list of TAGS."
292 (let ((tags 293 (let ((tags
293 (mapcar (lambda (tag) 294 (mapcar
294 (let ((tag (cvs-tag-make-tag tag))) 295 (lambda (tag)
295 (list (if (not (eq (cvs-tag->type tag) 'branch)) tag 296 (let ((tag (cvs-tag-make-tag tag)))
296 (list (cvs-tag-make (butlast (cvs-tag->vlist tag))) 297 (list (if (not (eq (cvs-tag->type tag) 'branch)) tag
297 tag))))) 298 (list (cvs-tag-make (cvs-butlast (cvs-tag->vlist tag)))
298 tags))) 299 tag)))))
300 tags)))
299 (while (cdr tags) 301 (while (cdr tags)
300 (let (tl) 302 (let (tl)
301 (while tags 303 (while tags
@@ -337,7 +339,7 @@ the list is a three-string list TAG, KIND, REV."
337 (setq tags (nreverse tags))) 339 (setq tags (nreverse tags)))
338 340
339 (progn ; new tree style listing 341 (progn ; new tree style listing
340 (let* ((re-lead "[ \t]*\\(-+\\)?\\(|\n?[ \t]+\\)?") 342 (let* ((re-lead "[ \t]*\\(-+\\)?\\(|\n?[ \t]+\\)*")
341 (re3 (concat re-lead "\\(\\.\\)?\\(" cvs-status-rev-re "\\)")) 343 (re3 (concat re-lead "\\(\\.\\)?\\(" cvs-status-rev-re "\\)"))
342 (re2 (concat re-lead cvs-status-tag-re "\\(\\)")) 344 (re2 (concat re-lead cvs-status-tag-re "\\(\\)"))
343 (re1 (concat re-lead cvs-status-tag-re 345 (re1 (concat re-lead cvs-status-tag-re
@@ -373,39 +375,34 @@ the list is a three-string list TAG, KIND, REV."
373 (save-restriction 375 (save-restriction
374 (narrow-to-region (point) (point)) 376 (narrow-to-region (point) (point))
375 ;;(newline) 377 ;;(newline)
376 (cvs-tree-print (cvs-tags->tree tags) 'cvs-tag->string 3)) 378 (combine-after-change-calls
379 (cvs-tree-print (cvs-tags->tree tags) 'cvs-tag->string 3)))
377 ;;(cvs-refontify pt (point)) 380 ;;(cvs-refontify pt (point))
378 (sit-for 0) 381 ;;(sit-for 0)
379 ;;) 382 ;;)
380 )))) 383 ))))
381 384
382;;;; 385;;;;
383;;;; CVSTree-style trees 386;;;; CVSTree-style trees
384;;;; 387;;;;
385 388
386;; chars sets. Ripped from cvstree 389(defvar cvs-tree-use-jisx0208
387(defvar cvs-tree-dstr-2byte-ready 390 nil ;; (and (char-display-font 'japanese-jisx0208) t)
388 (when (featurep 'mule) 391 "*Non-nil if we should use the graphical glyphs from `japanese-jisx0208'.
389 (if (boundp 'current-language-environment) 392Otherwise, default to ASCII chars like +, - and |.")
390 (string= current-language-environment "Japanese") 393
391 t)) ; mule/emacs-19 394(defconst cvs-tree-char-space
392 "*Variable that specifies characters set used in cvstree tree graph. 395 (if cvs-tree-use-jisx0208 (make-char 'japanese-jisx0208 33 33) " "))
393If non-nil, 2byte (Japanese?) characters set is used. 396(defconst cvs-tree-char-hbar
394If nil, 1byte characters set is used. 397 (if cvs-tree-use-jisx0208 (make-char 'japanese-jisx0208 40 44) "--"))
3952byte characters might be available with Mule or Emacs with Mule extension.") 398(defconst cvs-tree-char-vbar
396 399 (if cvs-tree-use-jisx0208 (make-char 'japanese-jisx0208 40 45) "| "))
397(defconst cvs-tree-dstr-char-space 400(defconst cvs-tree-char-branch
398 (if cvs-tree-dstr-2byte-ready " " " ")) 401 (if cvs-tree-use-jisx0208 (make-char 'japanese-jisx0208 40 50) "+-"))
399(defconst cvs-tree-dstr-char-hbar 402(defconst cvs-tree-char-eob ;end of branch
400 (if cvs-tree-dstr-2byte-ready "━" "--")) 403 (if cvs-tree-use-jisx0208 (make-char 'japanese-jisx0208 40 49) "`-"))
401(defconst cvs-tree-dstr-char-vbar 404(defconst cvs-tree-char-bob ;beginning of branch
402 (if cvs-tree-dstr-2byte-ready "┃" "| ")) 405 (if cvs-tree-use-jisx0208 (make-char 'japanese-jisx0208 40 51) "+-"))
403(defconst cvs-tree-dstr-char-branch
404 (if cvs-tree-dstr-2byte-ready "┣" "+-"))
405(defconst cvs-tree-dstr-char-eob ;end of branch
406 (if cvs-tree-dstr-2byte-ready "┗" "`-"))
407(defconst cvs-tree-dstr-char-bob ;beginning of branch
408 (if cvs-tree-dstr-2byte-ready "┳" "+-"))
409 406
410(defun cvs-tag-lessp (tag1 tag2) 407(defun cvs-tag-lessp (tag1 tag2)
411 (eq (cvs-tag-compare tag1 tag2) 'more2)) 408 (eq (cvs-tag-compare tag1 tag2) 'more2))
@@ -416,6 +413,18 @@ If nil, 1byte characters set is used.
416 "Look for a list of tags, and replace it with a tree. 413 "Look for a list of tags, and replace it with a tree.
417Optional prefix ARG chooses between two representations." 414Optional prefix ARG chooses between two representations."
418 (interactive "P") 415 (interactive "P")
416 (when (and cvs-tree-use-jisx0208
417 (not enable-multibyte-characters))
418 ;; We need to convert the buffer from unibyte to multibyte
419 ;; since we'll use multibyte chars for the tree.
420 (let ((modified (buffer-modified-p))
421 (inhibit-read-only t)
422 (inhibit-modification-hooks t))
423 (unwind-protect
424 (progn
425 (decode-coding-region (point-min) (point-max) 'undecided)
426 (set-buffer-multibyte t))
427 (restore-buffer-modified-p modified))))
419 (save-excursion 428 (save-excursion
420 (goto-char (point-min)) 429 (goto-char (point-min))
421 (let ((inhibit-read-only t) 430 (let ((inhibit-read-only t)
@@ -429,9 +438,11 @@ Optional prefix ARG chooses between two representations."
429 (let* ((first (car tags)) 438 (let* ((first (car tags))
430 (prev (if (cvs-tag-p first) 439 (prev (if (cvs-tag-p first)
431 (list (car (cvs-tag->vlist first))) nil))) 440 (list (car (cvs-tag->vlist first))) nil)))
432 (cvs-tree-tags-insert tags prev) 441 (combine-after-change-calls
442 (cvs-tree-tags-insert tags prev))
433 ;;(cvs-refontify pt (point)) 443 ;;(cvs-refontify pt (point))
434 (sit-for 0))))))) 444 ;;(sit-for 0)
445 ))))))
435 446
436(defun cvs-tree-tags-insert (tags prev) 447(defun cvs-tree-tags-insert (tags prev)
437 (when tags 448 (when tags
@@ -463,16 +474,16 @@ Optional prefix ARG chooses between two representations."
463 (let* ((na+char 474 (let* ((na+char
464 (if (car as) 475 (if (car as)
465 (if eq 476 (if eq
466 (if next-eq (cons t cvs-tree-dstr-char-vbar) 477 (if next-eq (cons t cvs-tree-char-vbar)
467 (cons t cvs-tree-dstr-char-branch)) 478 (cons t cvs-tree-char-branch))
468 (cons nil cvs-tree-dstr-char-bob)) 479 (cons nil cvs-tree-char-bob))
469 (if eq 480 (if eq
470 (if next-eq (cons nil cvs-tree-dstr-char-space) 481 (if next-eq (cons nil cvs-tree-char-space)
471 (cons t cvs-tree-dstr-char-eob)) 482 (cons t cvs-tree-char-eob))
472 (cons nil (if (and (eq (cvs-tag->type tag) 'branch) 483 (cons nil (if (and (eq (cvs-tag->type tag) 'branch)
473 (cvs-every 'null as)) 484 (cvs-every 'null as))
474 cvs-tree-dstr-char-space 485 cvs-tree-char-space
475 cvs-tree-dstr-char-hbar)))))) 486 cvs-tree-char-hbar))))))
476 (insert (cdr na+char)) 487 (insert (cdr na+char))
477 (push (car na+char) nas)) 488 (push (car na+char) nas))
478 (setq pe eq))) 489 (setq pe eq)))
@@ -506,6 +517,9 @@ Optional prefix ARG chooses between two representations."
506 517
507;;; Change Log: 518;;; Change Log:
508;; $Log: cvs-status.el,v $ 519;; $Log: cvs-status.el,v $
520;; Revision 1.7 2000/09/29 02:19:10 monnier
521;; (cvs-status-entry-leader-re): Minor fix.
522;;
509;; Revision 1.6 2000/08/16 20:46:32 monnier 523;; Revision 1.6 2000/08/16 20:46:32 monnier
510;; *** empty log message *** 524;; *** empty log message ***
511;; 525;;