[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: More enhancements to fringe bitmaps.
From: |
Masatake YAMATO |
Subject: |
Re: More enhancements to fringe bitmaps. |
Date: |
Mon, 09 Feb 2004 17:54:44 +0900 (JST) |
> I have just committed changes to implement a very old item on my
> personal to-do list:
>
> You can now redefine the built-in fringe bitmaps!
Great!
> ;;; ====================================================================
> ;;; Here is an example of using a user-defined fringe bitmaps; it is a red
> ;;; circle which can be used to mark a debugger breakpoint (instead of
> ;;; using the display margin as gdba current does).
> ;;;
> ;;; Eval this and try M-x xb RET
>
> (defface fringe-standout
> '((t
> :inherit fringe
> :foreground "red"))
> "Face for fringe bitmaps which should stand out.")
>
> ;; ..xxxx..
> ;; .xxxxxx.
> ;; xxxxxxxx
> ;; xxxxxxxx
> ;; xxxxxxxx
> ;; xxxxxxxx
> ;; .xxxxxx.
> ;; ..xxxx..
> (defvar circle-fringe-bitmap
> (define-fringe-bitmap "\x3c\x7e\xff\xff\xff\xff\x7e\x3c"))
Why we have to write such fringe bitmap figure in comments?
Instead, the figure itself should be passed to the lisp function, I think.
e.g.
(fringe-make-bitmap-from-strings
'("..xxxx.."
".xxxxxx."
"xxxxxxxx"
"xxxxxxxx"
"xxxxxxxx"
"xxxxxxxx"
".xxxxxx."
"..xxxx.."))
=> "<~\377\377\377\377~<"
(defun fringe-make-bitmap-from-strings (strings &optional on off)
"Make fringe bitmap string from lists of strings.
>From STRINGS, a bitmap string suitable for the argument of
`define-fringe-bitmap' is made.
ON and OFF stands for the on-bit and off-bit characters. If ON
is not given, ?x is used. If OFF is not given, ?. is used.
STRINGS is a list of strings. Each element stands for a line
of the bitmap; and its length must be 8. The content of element
must be ON or OFF.
e.g.
\(fringe-make-bitmap-from-strings
'(\"__@@@@__\"
\"_@@@@@@_\"
\"@@@@@@@@\"
\"@@@@@@@@\"
\"@@@@@@@@\"
\"@@@@@@@@\"
\"_@@@@@@_\"
\"__@@@@__\") ?@ ?_)
"
(unless on (setq on ?x))
(unless off (setq off ?.))
(mapconcat (lambda (string)
(if (not (eq 8 (length string)))
(error "Wrong lenght string: %d" (length string)))
(let ((i 7)
(line 0))
(mapc (lambda (c)
(cond
((eq on c)
(setq line (logior line (lsh 1 i))))
((eq off c))
(t
(error "Wrong charset in string: %c" c)))
(setq i (1- i)))
string)
(funcall 'string line)))
strings ""))
(defun fringe-decode-bitmap-string (bitmap &optional on off)
"Make a list of strings from a fringe bitmap string."
(unless on (setq on ?x))
(unless off (setq off ?.))
(mapcar
(lambda (c)
(setq c (string-to-char c))
(string
(if (eq 0 (logand (lsh 1 7) c)) off on)
(if (eq 0 (logand (lsh 1 6) c)) off on)
(if (eq 0 (logand (lsh 1 5) c)) off on)
(if (eq 0 (logand (lsh 1 4) c)) off on)
(if (eq 0 (logand (lsh 1 3) c)) off on)
(if (eq 0 (logand (lsh 1 2) c)) off on)
(if (eq 0 (logand (lsh 1 1) c)) off on)
(if (eq 0 (logand (lsh 1 0) c)) off on)))
bitmap))
- Re: More enhancements to fringe bitmaps., (continued)
- Re: More enhancements to fringe bitmaps., Kim F. Storm, 2004/02/15
- Re: More enhancements to fringe bitmaps., YAMAMOTO Mitsuharu, 2004/02/16
- Re: More enhancements to fringe bitmaps., Kim F. Storm, 2004/02/16
- Re: More enhancements to fringe bitmaps., YAMAMOTO Mitsuharu, 2004/02/16
- Re: More enhancements to fringe bitmaps., Kim F. Storm, 2004/02/17
- Re: More enhancements to fringe bitmaps., YAMAMOTO Mitsuharu, 2004/02/17
- Re: More enhancements to fringe bitmaps., Kim F. Storm, 2004/02/18
- Re: More enhancements to fringe bitmaps., YAMAMOTO Mitsuharu, 2004/02/18
- Re: More enhancements to fringe bitmaps., Jason Rumney, 2004/02/19
- Re: More enhancements to fringe bitmaps., Kim F. Storm, 2004/02/19
Re: More enhancements to fringe bitmaps.,
Masatake YAMATO <=
Re: More enhancements to fringe bitmaps., Matt Hodges, 2004/02/09
Re: More enhancements to fringe bitmaps., Tak Ota, 2004/02/09
Re: More enhancements to fringe bitmaps., Nick Roberts, 2004/02/11