[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

More enhancements to fringe bitmaps.

From: Kim F. Storm
Subject: More enhancements to fringe bitmaps.
Date: 09 Feb 2004 02:01:48 +0100
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

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!

In addition you can define your own fringe bitmaps and have them
appear in the left or right fringe of any row to your liking.  You can
even specify the face to use for each of the fringe bitmaps.

I will add something to NEWS and the lispref about it tomorrow.
In the meantime, you can look at the examples below.


But I need help for the W32 and MAC ports!!!  Could someone which know
about pixmaps and clipping on these systems please look at the code
(from xterm.c) that I have inserted in w32term.c and macterm.c with
the following conditionals:

#if 0  /* TODO: fringe overlay_p and cursor_p */

The code in those blocks serves two purposes:

There is some code (adapted to w32 and mac) which aim to use the text
cursor color when the cursor is in the right fringe, but as I have no
way of testing this -- so I didn't enable it.

There is also some code which (on X) sets the clipmask for drawing the
bitmap to the bitmap itself when "overlay_p" is set in the parameter
block; the intention is that the bitmap should be drawn with a
transparent background over another bitmap.  I don't know anything
about clipping on W32 or MAC, so I have no clue how to accomplish this
on those platforms -- so I need help.

Until this is fixed on W32 and MAC, there may be some problems with the
cursor in the right fringe, and to show the overlay arrow in the left
fringe together with a user defined bitmap in the same row.


;;; ====================================================================
;;; 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
     :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"))

(defun xb ()
  "Insert the circle-fringe-bitmap in right fringe of current line."
  (let ((b (line-beginning-position))) 
    (add-text-properties b (+ b 1) 
      `(display (left-fringe ,circle-fringe-bitmap fringe-standout)))))

;;; ====================================================================
;;; Assign a different color to the overlay arrow.

(require 'fringe)

(defface fringe-arrow
     :inherit fringe
     :foreground "green"))
  "Face for arrow fringe bitmap.")

(set-fringe-bitmap-face overlay-arrow-fringe-bitmap 'fringe-arrow)

;;; ====================================================================
;;; Use a ~ bitmap to mark empty lines  (viper mode may like this :-)

;; ........
;; ..xx....
;; .x..x..x
;; .....xx.

(require 'fringe)

(define-fringe-bitmap "\x00\x30\x49\x06" nil nil 'top empty-line-fringe-bitmap)

(setq indicate-empty-lines t)

Kim F. Storm <address@hidden> http://www.cua.dk

reply via email to

[Prev in Thread] Current Thread [Next in Thread]