comparison lisp/cvs-status.el @ 55076:913c2e3a059f

(cvs-tree-use-charset): New var. (cvs-tree-char-space, cvs-tree-char-hbar, cvs-tree-char-vbar) (cvs-tree-char-branch, cvs-tree-char-eob, cvs-tree-char-bob) (cvs-status-cvstrees): Use it.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Wed, 21 Apr 2004 22:31:19 +0000
parents 5133c27cc4f0
children 45bf91de4d41
comparison
equal deleted inserted replaced
55075:0830b9cce734 55076:913c2e3a059f
1 ;;; cvs-status.el --- major mode for browsing `cvs status' output 1 ;;; cvs-status.el --- major mode for browsing `cvs status' output -*- coding: utf-8 -*-
2 2
3 ;; Copyright (C) 1999, 2000, 03, 2004 Free Software Foundation, Inc. 3 ;; Copyright (C) 1999, 2000, 03, 2004 Free Software Foundation, Inc.
4 4
5 ;; Author: Stefan Monnier <monnier@cs.yale.edu> 5 ;; Author: Stefan Monnier <monnier@cs.yale.edu>
6 ;; Keywords: pcl-cvs cvs status tree tools 6 ;; Keywords: pcl-cvs cvs status tree tools
382 382
383 ;;;; 383 ;;;;
384 ;;;; CVSTree-style trees 384 ;;;; CVSTree-style trees
385 ;;;; 385 ;;;;
386 386
387 (defvar cvs-tree-use-jisx0208 387 (defvar cvs-tree-use-jisx0208 nil) ;Old compat var.
388 (and (char-displayable-p (make-char 'japanese-jisx0208 40 44)) t) 388 (defvar cvs-tree-use-charset
389 (cond
390 (cvs-tree-use-jisx0208 'jisx0208)
391 ((char-displayable-p ?━) 'unicode)
392 ((char-displayable-p (make-char 'japanese-jisx0208 40 44)) 'jisx0208))
389 "*Non-nil if we should use the graphical glyphs from `japanese-jisx0208'. 393 "*Non-nil if we should use the graphical glyphs from `japanese-jisx0208'.
390 Otherwise, default to ASCII chars like +, - and |.") 394 Otherwise, default to ASCII chars like +, - and |.")
391 395
392 (defconst cvs-tree-char-space 396 (defconst cvs-tree-char-space
393 (if cvs-tree-use-jisx0208 (make-char 'japanese-jisx0208 33 33) " ")) 397 (case cvs-tree-use-charset
398 (jisx0208 (make-char 'japanese-jisx0208 33 33))
399 (unicode " ")
400 (t " ")))
394 (defconst cvs-tree-char-hbar 401 (defconst cvs-tree-char-hbar
395 (if cvs-tree-use-jisx0208 (make-char 'japanese-jisx0208 40 44) "--")) 402 (case cvs-tree-use-charset
403 (jisx0208 (make-char 'japanese-jisx0208 40 44))
404 (unicode "━")
405 (t "--")))
396 (defconst cvs-tree-char-vbar 406 (defconst cvs-tree-char-vbar
397 (if cvs-tree-use-jisx0208 (make-char 'japanese-jisx0208 40 45) "| ")) 407 (case cvs-tree-use-charset
408 (jisx0208 (make-char 'japanese-jisx0208 40 45))
409 (unicode "┃")
410 (t "| ")))
398 (defconst cvs-tree-char-branch 411 (defconst cvs-tree-char-branch
399 (if cvs-tree-use-jisx0208 (make-char 'japanese-jisx0208 40 50) "+-")) 412 (case cvs-tree-use-charset
413 (jisx0208 (make-char 'japanese-jisx0208 40 50))
414 (unicode "┣")
415 (t "+-")))
400 (defconst cvs-tree-char-eob ;end of branch 416 (defconst cvs-tree-char-eob ;end of branch
401 (if cvs-tree-use-jisx0208 (make-char 'japanese-jisx0208 40 49) "`-")) 417 (case cvs-tree-use-charset
418 (jisx0208 (make-char 'japanese-jisx0208 40 49))
419 (unicode "┗")
420 (t "`-")))
402 (defconst cvs-tree-char-bob ;beginning of branch 421 (defconst cvs-tree-char-bob ;beginning of branch
403 (if cvs-tree-use-jisx0208 (make-char 'japanese-jisx0208 40 51) "+-")) 422 (case cvs-tree-use-charset
423 (jisx0208 (make-char 'japanese-jisx0208 40 51))
424 (unicode "┳")
425 (t "+-")))
404 426
405 (defun cvs-tag-lessp (tag1 tag2) 427 (defun cvs-tag-lessp (tag1 tag2)
406 (eq (cvs-tag-compare tag1 tag2) 'more2)) 428 (eq (cvs-tag-compare tag1 tag2) 'more2))
407 429
408 (defvar cvs-tree-nomerge nil) 430 (defvar cvs-tree-nomerge nil)
409 431
410 (defun cvs-status-cvstrees (&optional arg) 432 (defun cvs-status-cvstrees (&optional arg)
411 "Look for a list of tags, and replace it with a tree. 433 "Look for a list of tags, and replace it with a tree.
412 Optional prefix ARG chooses between two representations." 434 Optional prefix ARG chooses between two representations."
413 (interactive "P") 435 (interactive "P")
414 (when (and cvs-tree-use-jisx0208 436 (when (and cvs-tree-use-charset
415 (not enable-multibyte-characters)) 437 (not enable-multibyte-characters))
416 ;; We need to convert the buffer from unibyte to multibyte 438 ;; We need to convert the buffer from unibyte to multibyte
417 ;; since we'll use multibyte chars for the tree. 439 ;; since we'll use multibyte chars for the tree.
418 (let ((modified (buffer-modified-p)) 440 (let ((modified (buffer-modified-p))
419 (inhibit-read-only t) 441 (inhibit-read-only t)