comparison lisp/fringe.el @ 69070:efaafdfc3b2c

*** empty log message ***
author Kim F. Storm <storm@cua.dk>
date Tue, 21 Feb 2006 09:41:20 +0000
parents 0bef3c03596b
children 64b2a2990f41
comparison
equal deleted inserted replaced
69069:398e6b9e9f87 69070:efaafdfc3b2c
1 ;;; fringe.el --- change fringes appearance in various ways 1 ;;; fringe.el --- fringe setup and control
2 2
3 ;; Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. 3 ;; Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
4 4
5 ;; Author: Simon Josefsson <simon@josefsson.org> 5 ;; Author: Simon Josefsson <simon@josefsson.org>
6 ;; Maintainer: FSF 6 ;; Maintainer: FSF
23 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 23 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24 ;; Boston, MA 02110-1301, USA. 24 ;; Boston, MA 02110-1301, USA.
25 25
26 ;;; Commentary: 26 ;;; Commentary:
27 27
28 ;; This file contains helpful functions for customizing the appearance 28 ;; This file contains code to initialize the built-in fringe bitmaps
29 ;; of the fringe. 29 ;; as well as helpful functions for customizing the appearance of the
30 ;; fringe.
30 31
31 ;; The code is influenced by scroll-bar.el and avoid.el. The author 32 ;; The code is influenced by scroll-bar.el and avoid.el. The author
32 ;; gratefully acknowledge comments and suggestions made by Miles 33 ;; gratefully acknowledge comments and suggestions made by Miles
33 ;; Bader, Eli Zaretski, Richard Stallman, Pavel Janík and others which 34 ;; Bader, Eli Zaretski, Richard Stallman, Pavel Janík and others which
34 ;; improved this package. 35 ;; improved this package.
38 (defgroup fringe nil 39 (defgroup fringe nil
39 "Window fringes." 40 "Window fringes."
40 :version "22.1" 41 :version "22.1"
41 :group 'frames) 42 :group 'frames)
42 43
43 ;; Standard fringe bitmaps 44 ;; Define the built-in fringe bitmaps and setup default mappings
44 45
45 (defmacro fringe-bitmap-p (symbol) 46 (let ((bitmaps '(question-mark
46 "Return non-nil if SYMBOL is a fringe bitmap." 47 left-arrow right-arrow up-arrow down-arrow
47 `(get ,symbol 'fringe)) 48 left-curly-arrow right-curly-arrow
48 49 left-triangle right-triangle
49 (defvar fringe-bitmaps) 50 top-left-angle top-right-angle
50 51 bottom-left-angle bottom-right-angle
51 (unless (or (not (boundp 'fringe-bitmaps)) 52 left-bracket right-bracket
52 (get 'left-truncation 'fringe)) 53 filled-rectangle hollow-rectangle
53 (let ((bitmaps '(question-mark 54 filled-square hollow-square
54 left-arrow right-arrow up-arrow down-arrow 55 vertical-bar horizontal-bar
55 left-curly-arrow right-curly-arrow 56 empty-line))
56 left-triangle right-triangle 57 (bn 1))
57 top-left-angle top-right-angle 58 (while bitmaps
58 bottom-left-angle bottom-right-angle 59 (push (car bitmaps) fringe-bitmaps)
59 left-bracket right-bracket 60 (put (car bitmaps) 'fringe bn)
60 filled-rectangle hollow-rectangle 61 (setq bitmaps (cdr bitmaps)
61 filled-square hollow-square 62 bn (1+ bn))))
62 vertical-bar horizontal-bar
63 empty-line))
64 (bn 1))
65 (while bitmaps
66 (push (car bitmaps) fringe-bitmaps)
67 (put (car bitmaps) 'fringe bn)
68 (setq bitmaps (cdr bitmaps)
69 bn (1+ bn)))))
70 63
71 (setq-default fringe-indicator-alist 64 (setq-default fringe-indicator-alist
72 '((truncation . (left-arrow right-arrow)) 65 '((truncation . (left-arrow right-arrow))
73 (continuation . (left-curly-arrow right-curly-arrow)) 66 (continuation . (left-curly-arrow right-curly-arrow))
74 (overlay-arrow . right-triangle) 67 (overlay-arrow . right-triangle)
86 '((box . filled-rectangle) 79 '((box . filled-rectangle)
87 (hollow . hollow-rectangle) 80 (hollow . hollow-rectangle)
88 (bar . vertical-bar) 81 (bar . vertical-bar)
89 (hbar . horizontal-bar) 82 (hbar . horizontal-bar)
90 (hollow-small . hollow-square))) 83 (hollow-small . hollow-square)))
84
85
86 (defmacro fringe-bitmap-p (symbol)
87 "Return non-nil if SYMBOL is a fringe bitmap."
88 `(get ,symbol 'fringe))
89
91 90
92 ;; Control presence of fringes 91 ;; Control presence of fringes
93 92
94 (defvar fringe-mode) 93 (defvar fringe-mode)
95 94
156 (if (equal fringe-mode '(0 . 0)) 155 (if (equal fringe-mode '(0 . 0))
157 (setq fringe-mode 0))) 156 (setq fringe-mode 0)))
158 ;; Otherwise impose the user-specified value of fringe-mode. 157 ;; Otherwise impose the user-specified value of fringe-mode.
159 (custom-initialize-reset symbol value)))) 158 (custom-initialize-reset symbol value))))
160 159
161 ;;;###autoload
162 (defcustom fringe-mode nil 160 (defcustom fringe-mode nil
163 "*Specify appearance of fringes on all frames. 161 "*Specify appearance of fringes on all frames.
164 This variable can be nil (the default) meaning the fringes should have 162 This variable can be nil (the default) meaning the fringes should have
165 the default width (8 pixels), it can be an integer value specifying 163 the default width (8 pixels), it can be an integer value specifying
166 the width of both left and right fringe (where 0 means no fringe), or 164 the width of both left and right fringe (where 0 means no fringe), or
214 default-frame-alist 212 default-frame-alist
215 (frame-parameters (selected-frame)))))) 213 (frame-parameters (selected-frame))))))
216 nil 214 nil
217 0))))) 215 0)))))
218 216
219 ;;;###autoload
220 (defun fringe-mode (&optional mode) 217 (defun fringe-mode (&optional mode)
221 "Set the default appearance of fringes on all frames. 218 "Set the default appearance of fringes on all frames.
222 219
223 When called interactively, query the user for MODE. Valid values 220 When called interactively, query the user for MODE. Valid values
224 for MODE include `none', `default', `left-only', `right-only', 221 for MODE include `none', `default', `left-only', `right-only',
240 want to set the default appearance of fringes on the selected 237 want to set the default appearance of fringes on the selected
241 frame only, see the command `set-fringe-style'." 238 frame only, see the command `set-fringe-style'."
242 (interactive (list (fringe-query-style 'all-frames))) 239 (interactive (list (fringe-query-style 'all-frames)))
243 (set-fringe-mode mode)) 240 (set-fringe-mode mode))
244 241
245 ;;;###autoload
246 (defun set-fringe-style (&optional mode) 242 (defun set-fringe-style (&optional mode)
247 "Set the default appearance of fringes on the selected frame. 243 "Set the default appearance of fringes on the selected frame.
248 244
249 When called interactively, query the user for MODE. Valid values 245 When called interactively, query the user for MODE. Valid values
250 for MODE include `none', `default', `left-only', `right-only', 246 for MODE include `none', `default', `left-only', `right-only',