annotate lisp/fringe.el @ 69050:c0e9f855475e

(fringe-bitmaps): Update to new bitmap names. (fringe-indicator-alist, fringe-cursor-alist): Initialize.
author Kim F. Storm <storm@cua.dk>
date Mon, 20 Feb 2006 22:14:47 +0000
parents 3bd95f4f2941
children 0bef3c03596b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
45493
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
1 ;;; fringe.el --- change fringes appearance in various ways
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
2
68651
3bd95f4f2941 Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 64762
diff changeset
3 ;; Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
45493
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
4
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
5 ;; Author: Simon Josefsson <simon@josefsson.org>
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
6 ;; Maintainer: FSF
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
7 ;; Keywords: frames
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
8
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
9 ;; This file is part of GNU Emacs.
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
10
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
12 ;; it under the terms of the GNU General Public License as published by
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
13 ;; the Free Software Foundation; either version 2, or (at your option)
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
14 ;; any later version.
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
15
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
16 ;; GNU Emacs is distributed in the hope that it will be useful,
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
19 ;; GNU General Public License for more details.
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
20
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
64091
6fb026ad601f Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 59996
diff changeset
23 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
6fb026ad601f Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 59996
diff changeset
24 ;; Boston, MA 02110-1301, USA.
45493
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
25
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
26 ;;; Commentary:
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
27
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
28 ;; This file contains helpful functions for customizing the appearance
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
29 ;; of the fringe.
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
30
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
31 ;; The code is influenced by scroll-bar.el and avoid.el. The author
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
32 ;; gratefully acknowledge comments and suggestions made by Miles
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
33 ;; Bader, Eli Zaretski, Richard Stallman, Pavel Janík and others which
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
34 ;; improved this package.
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
35
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
36 ;;; Code:
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
37
58597
fa269b651143 (fringe): New defgroup.
Kim F. Storm <storm@cua.dk>
parents: 57538
diff changeset
38 (defgroup fringe nil
fa269b651143 (fringe): New defgroup.
Kim F. Storm <storm@cua.dk>
parents: 57538
diff changeset
39 "Window fringes."
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 58599
diff changeset
40 :version "22.1"
58597
fa269b651143 (fringe): New defgroup.
Kim F. Storm <storm@cua.dk>
parents: 57538
diff changeset
41 :group 'frames)
fa269b651143 (fringe): New defgroup.
Kim F. Storm <storm@cua.dk>
parents: 57538
diff changeset
42
53890
5588b6cc6fba (no-fringe-bitmap, undef-fringe-bitmap)
Kim F. Storm <storm@cua.dk>
parents: 53257
diff changeset
43 ;; Standard fringe bitmaps
5588b6cc6fba (no-fringe-bitmap, undef-fringe-bitmap)
Kim F. Storm <storm@cua.dk>
parents: 53257
diff changeset
44
57261
075de3b1e798 (fringe-bitmap-p): New macro.
Kim F. Storm <storm@cua.dk>
parents: 54399
diff changeset
45 (defmacro fringe-bitmap-p (symbol)
075de3b1e798 (fringe-bitmap-p): New macro.
Kim F. Storm <storm@cua.dk>
parents: 54399
diff changeset
46 "Return non-nil if SYMBOL is a fringe bitmap."
075de3b1e798 (fringe-bitmap-p): New macro.
Kim F. Storm <storm@cua.dk>
parents: 54399
diff changeset
47 `(get ,symbol 'fringe))
075de3b1e798 (fringe-bitmap-p): New macro.
Kim F. Storm <storm@cua.dk>
parents: 54399
diff changeset
48
075de3b1e798 (fringe-bitmap-p): New macro.
Kim F. Storm <storm@cua.dk>
parents: 54399
diff changeset
49 (defvar fringe-bitmaps)
075de3b1e798 (fringe-bitmap-p): New macro.
Kim F. Storm <storm@cua.dk>
parents: 54399
diff changeset
50
57507
6024cd83cb88 (fringe-bitmaps): Only initialize when defined.
Kim F. Storm <storm@cua.dk>
parents: 57261
diff changeset
51 (unless (or (not (boundp 'fringe-bitmaps))
6024cd83cb88 (fringe-bitmaps): Only initialize when defined.
Kim F. Storm <storm@cua.dk>
parents: 57261
diff changeset
52 (get 'left-truncation 'fringe))
69050
c0e9f855475e (fringe-bitmaps): Update to new bitmap names.
Kim F. Storm <storm@cua.dk>
parents: 68651
diff changeset
53 (let ((bitmaps '(question-mark
c0e9f855475e (fringe-bitmaps): Update to new bitmap names.
Kim F. Storm <storm@cua.dk>
parents: 68651
diff changeset
54 left-arrow right-arrow up-arrow down-arrow
c0e9f855475e (fringe-bitmaps): Update to new bitmap names.
Kim F. Storm <storm@cua.dk>
parents: 68651
diff changeset
55 left-curly-arrow right-curly-arrow
c0e9f855475e (fringe-bitmaps): Update to new bitmap names.
Kim F. Storm <storm@cua.dk>
parents: 68651
diff changeset
56 left-triangle right-triangle
57261
075de3b1e798 (fringe-bitmap-p): New macro.
Kim F. Storm <storm@cua.dk>
parents: 54399
diff changeset
57 top-left-angle top-right-angle
075de3b1e798 (fringe-bitmap-p): New macro.
Kim F. Storm <storm@cua.dk>
parents: 54399
diff changeset
58 bottom-left-angle bottom-right-angle
075de3b1e798 (fringe-bitmap-p): New macro.
Kim F. Storm <storm@cua.dk>
parents: 54399
diff changeset
59 left-bracket right-bracket
69050
c0e9f855475e (fringe-bitmaps): Update to new bitmap names.
Kim F. Storm <storm@cua.dk>
parents: 68651
diff changeset
60 filled-rectangle hollow-rectangle
c0e9f855475e (fringe-bitmaps): Update to new bitmap names.
Kim F. Storm <storm@cua.dk>
parents: 68651
diff changeset
61 filled-square hollow-square
c0e9f855475e (fringe-bitmaps): Update to new bitmap names.
Kim F. Storm <storm@cua.dk>
parents: 68651
diff changeset
62 vertical-bar horisontal-bar
57261
075de3b1e798 (fringe-bitmap-p): New macro.
Kim F. Storm <storm@cua.dk>
parents: 54399
diff changeset
63 empty-line))
69050
c0e9f855475e (fringe-bitmaps): Update to new bitmap names.
Kim F. Storm <storm@cua.dk>
parents: 68651
diff changeset
64 (bn 1))
57261
075de3b1e798 (fringe-bitmap-p): New macro.
Kim F. Storm <storm@cua.dk>
parents: 54399
diff changeset
65 (while bitmaps
075de3b1e798 (fringe-bitmap-p): New macro.
Kim F. Storm <storm@cua.dk>
parents: 54399
diff changeset
66 (push (car bitmaps) fringe-bitmaps)
075de3b1e798 (fringe-bitmap-p): New macro.
Kim F. Storm <storm@cua.dk>
parents: 54399
diff changeset
67 (put (car bitmaps) 'fringe bn)
075de3b1e798 (fringe-bitmap-p): New macro.
Kim F. Storm <storm@cua.dk>
parents: 54399
diff changeset
68 (setq bitmaps (cdr bitmaps)
075de3b1e798 (fringe-bitmap-p): New macro.
Kim F. Storm <storm@cua.dk>
parents: 54399
diff changeset
69 bn (1+ bn)))))
53890
5588b6cc6fba (no-fringe-bitmap, undef-fringe-bitmap)
Kim F. Storm <storm@cua.dk>
parents: 53257
diff changeset
70
69050
c0e9f855475e (fringe-bitmaps): Update to new bitmap names.
Kim F. Storm <storm@cua.dk>
parents: 68651
diff changeset
71 (setq-default fringe-indicator-alist
c0e9f855475e (fringe-bitmaps): Update to new bitmap names.
Kim F. Storm <storm@cua.dk>
parents: 68651
diff changeset
72 '((truncation . (left-arrow right-arrow))
c0e9f855475e (fringe-bitmaps): Update to new bitmap names.
Kim F. Storm <storm@cua.dk>
parents: 68651
diff changeset
73 (continuation . (left-curly-arrow right-curly-arrow))
c0e9f855475e (fringe-bitmaps): Update to new bitmap names.
Kim F. Storm <storm@cua.dk>
parents: 68651
diff changeset
74 (overlay-arrow . right-triangle)
c0e9f855475e (fringe-bitmaps): Update to new bitmap names.
Kim F. Storm <storm@cua.dk>
parents: 68651
diff changeset
75 (up . up-arrow)
c0e9f855475e (fringe-bitmaps): Update to new bitmap names.
Kim F. Storm <storm@cua.dk>
parents: 68651
diff changeset
76 (down . down-arrow)
c0e9f855475e (fringe-bitmaps): Update to new bitmap names.
Kim F. Storm <storm@cua.dk>
parents: 68651
diff changeset
77 (top . (top-left-angle top-right-angle))
c0e9f855475e (fringe-bitmaps): Update to new bitmap names.
Kim F. Storm <storm@cua.dk>
parents: 68651
diff changeset
78 (bottom . (bottom-left-angle bottom-right-angle
c0e9f855475e (fringe-bitmaps): Update to new bitmap names.
Kim F. Storm <storm@cua.dk>
parents: 68651
diff changeset
79 top-right-angle top-left-angle))
c0e9f855475e (fringe-bitmaps): Update to new bitmap names.
Kim F. Storm <storm@cua.dk>
parents: 68651
diff changeset
80 (top-bottom . (left-bracket right-bracket
c0e9f855475e (fringe-bitmaps): Update to new bitmap names.
Kim F. Storm <storm@cua.dk>
parents: 68651
diff changeset
81 top-right-angle top-left-angle))
c0e9f855475e (fringe-bitmaps): Update to new bitmap names.
Kim F. Storm <storm@cua.dk>
parents: 68651
diff changeset
82 (empty-line . empty-line)
c0e9f855475e (fringe-bitmaps): Update to new bitmap names.
Kim F. Storm <storm@cua.dk>
parents: 68651
diff changeset
83 (unknown . question-mark)))
c0e9f855475e (fringe-bitmaps): Update to new bitmap names.
Kim F. Storm <storm@cua.dk>
parents: 68651
diff changeset
84
c0e9f855475e (fringe-bitmaps): Update to new bitmap names.
Kim F. Storm <storm@cua.dk>
parents: 68651
diff changeset
85 (setq-default fringe-cursor-alist
c0e9f855475e (fringe-bitmaps): Update to new bitmap names.
Kim F. Storm <storm@cua.dk>
parents: 68651
diff changeset
86 '((box . filled-rectangle)
c0e9f855475e (fringe-bitmaps): Update to new bitmap names.
Kim F. Storm <storm@cua.dk>
parents: 68651
diff changeset
87 (hollow . hollow-rectangle)
c0e9f855475e (fringe-bitmaps): Update to new bitmap names.
Kim F. Storm <storm@cua.dk>
parents: 68651
diff changeset
88 (bar . vertical-bar)
c0e9f855475e (fringe-bitmaps): Update to new bitmap names.
Kim F. Storm <storm@cua.dk>
parents: 68651
diff changeset
89 (hbar . horisontal-bar)
c0e9f855475e (fringe-bitmaps): Update to new bitmap names.
Kim F. Storm <storm@cua.dk>
parents: 68651
diff changeset
90 (hollow-small . hollow-square)))
53890
5588b6cc6fba (no-fringe-bitmap, undef-fringe-bitmap)
Kim F. Storm <storm@cua.dk>
parents: 53257
diff changeset
91
5588b6cc6fba (no-fringe-bitmap, undef-fringe-bitmap)
Kim F. Storm <storm@cua.dk>
parents: 53257
diff changeset
92 ;; Control presence of fringes
5588b6cc6fba (no-fringe-bitmap, undef-fringe-bitmap)
Kim F. Storm <storm@cua.dk>
parents: 53257
diff changeset
93
45493
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
94 (defvar fringe-mode)
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
95
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
96 (defun set-fringe-mode-1 (ignore value)
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
97 "Call `set-fringe-mode' with VALUE.
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
98 See `fringe-mode' for valid values and their effect.
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
99 This is usually invoked when setting `fringe-mode' via customize."
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
100 (set-fringe-mode value))
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
101
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
102 (defun set-fringe-mode (value)
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
103 "Set `fringe-mode' to VALUE and put the new value into effect.
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
104 See `fringe-mode' for possible values and their effect."
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
105 (setq fringe-mode value)
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
106
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
107 ;; Apply it to default-frame-alist.
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
108 (let ((parameter (assq 'left-fringe default-frame-alist)))
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
109 (if (consp parameter)
45524
f48a8ed9d03a (set-fringe-mode): Work when updating
Simon Josefsson <jas@extundo.com>
parents: 45518
diff changeset
110 (setcdr parameter (if (consp fringe-mode)
f48a8ed9d03a (set-fringe-mode): Work when updating
Simon Josefsson <jas@extundo.com>
parents: 45518
diff changeset
111 (car fringe-mode)
f48a8ed9d03a (set-fringe-mode): Work when updating
Simon Josefsson <jas@extundo.com>
parents: 45518
diff changeset
112 fringe-mode))
45493
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
113 (setq default-frame-alist
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
114 (cons (cons 'left-fringe (if (consp fringe-mode)
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
115 (car fringe-mode)
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
116 fringe-mode))
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
117 default-frame-alist))))
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
118 (let ((parameter (assq 'right-fringe default-frame-alist)))
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
119 (if (consp parameter)
45524
f48a8ed9d03a (set-fringe-mode): Work when updating
Simon Josefsson <jas@extundo.com>
parents: 45518
diff changeset
120 (setcdr parameter (if (consp fringe-mode)
f48a8ed9d03a (set-fringe-mode): Work when updating
Simon Josefsson <jas@extundo.com>
parents: 45518
diff changeset
121 (cdr fringe-mode)
f48a8ed9d03a (set-fringe-mode): Work when updating
Simon Josefsson <jas@extundo.com>
parents: 45518
diff changeset
122 fringe-mode))
45493
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
123 (setq default-frame-alist
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
124 (cons (cons 'right-fringe (if (consp fringe-mode)
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
125 (cdr fringe-mode)
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
126 fringe-mode))
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
127 default-frame-alist))))
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
128
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
129 ;; Apply it to existing frames.
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
130 (let ((frames (frame-list)))
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
131 (while frames
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
132 (modify-frame-parameters
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
133 (car frames)
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
134 (list (cons 'left-fringe (if (consp fringe-mode)
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
135 (car fringe-mode)
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
136 fringe-mode))
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
137 (cons 'right-fringe (if (consp fringe-mode)
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
138 (cdr fringe-mode)
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
139 fringe-mode))))
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
140 (setq frames (cdr frames)))))
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
141
57538
6f85a547ab10 (fringe-mode-initialize): New function.
Richard M. Stallman <rms@gnu.org>
parents: 57507
diff changeset
142 ;; For initialization of fringe-mode, take account of changes
6f85a547ab10 (fringe-mode-initialize): New function.
Richard M. Stallman <rms@gnu.org>
parents: 57507
diff changeset
143 ;; made explicitly to default-frame-alist.
6f85a547ab10 (fringe-mode-initialize): New function.
Richard M. Stallman <rms@gnu.org>
parents: 57507
diff changeset
144 (defun fringe-mode-initialize (symbol value)
6f85a547ab10 (fringe-mode-initialize): New function.
Richard M. Stallman <rms@gnu.org>
parents: 57507
diff changeset
145 (let* ((left-pair (assq 'left-fringe default-frame-alist))
6f85a547ab10 (fringe-mode-initialize): New function.
Richard M. Stallman <rms@gnu.org>
parents: 57507
diff changeset
146 (right-pair (assq 'right-fringe default-frame-alist))
6f85a547ab10 (fringe-mode-initialize): New function.
Richard M. Stallman <rms@gnu.org>
parents: 57507
diff changeset
147 (left (cdr left-pair))
6f85a547ab10 (fringe-mode-initialize): New function.
Richard M. Stallman <rms@gnu.org>
parents: 57507
diff changeset
148 (right (cdr right-pair)))
6f85a547ab10 (fringe-mode-initialize): New function.
Richard M. Stallman <rms@gnu.org>
parents: 57507
diff changeset
149 (if (or left-pair right-pair)
6f85a547ab10 (fringe-mode-initialize): New function.
Richard M. Stallman <rms@gnu.org>
parents: 57507
diff changeset
150 ;; If there's something in default-frame-alist for fringes,
6f85a547ab10 (fringe-mode-initialize): New function.
Richard M. Stallman <rms@gnu.org>
parents: 57507
diff changeset
151 ;; don't change it, but reflect that into the value of fringe-mode.
6f85a547ab10 (fringe-mode-initialize): New function.
Richard M. Stallman <rms@gnu.org>
parents: 57507
diff changeset
152 (progn
6f85a547ab10 (fringe-mode-initialize): New function.
Richard M. Stallman <rms@gnu.org>
parents: 57507
diff changeset
153 (setq fringe-mode (cons left right))
6f85a547ab10 (fringe-mode-initialize): New function.
Richard M. Stallman <rms@gnu.org>
parents: 57507
diff changeset
154 (if (equal fringe-mode '(nil . nil))
6f85a547ab10 (fringe-mode-initialize): New function.
Richard M. Stallman <rms@gnu.org>
parents: 57507
diff changeset
155 (setq fringe-mode nil))
6f85a547ab10 (fringe-mode-initialize): New function.
Richard M. Stallman <rms@gnu.org>
parents: 57507
diff changeset
156 (if (equal fringe-mode '(0 . 0))
6f85a547ab10 (fringe-mode-initialize): New function.
Richard M. Stallman <rms@gnu.org>
parents: 57507
diff changeset
157 (setq fringe-mode 0)))
6f85a547ab10 (fringe-mode-initialize): New function.
Richard M. Stallman <rms@gnu.org>
parents: 57507
diff changeset
158 ;; Otherwise impose the user-specified value of fringe-mode.
6f85a547ab10 (fringe-mode-initialize): New function.
Richard M. Stallman <rms@gnu.org>
parents: 57507
diff changeset
159 (custom-initialize-reset symbol value))))
6f85a547ab10 (fringe-mode-initialize): New function.
Richard M. Stallman <rms@gnu.org>
parents: 57507
diff changeset
160
50127
7efc8970b32c (fringe-mode): Autoload so that
Simon Josefsson <jas@extundo.com>
parents: 45524
diff changeset
161 ;;;###autoload
45493
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
162 (defcustom fringe-mode nil
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
163 "*Specify appearance of fringes on all frames.
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
164 This variable can be nil (the default) meaning the fringes should have
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
165 the default width (8 pixels), it can be an integer value specifying
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
166 the width of both left and right fringe (where 0 means no fringe), or
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
167 a cons cell where car indicates width of left fringe and cdr indicates
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
168 width of right fringe (where again 0 can be used to indicate no
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
169 fringe).
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
170 To set this variable in a Lisp program, use `set-fringe-mode' to make
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
171 it take real effect.
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
172 Setting the variable with a customization buffer also takes effect.
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
173 If you only want to modify the appearance of the fringe in one frame,
64192
258eefd93f5c (fringe-mode): Add period in docstring.
Juri Linkov <juri@jurta.org>
parents: 64180
diff changeset
174 you can use the interactive function `set-fringe-style'."
45493
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
175 :type '(choice (const :tag "Default width" nil)
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
176 (const :tag "No fringes" 0)
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
177 (const :tag "Only right" (0 . nil))
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
178 (const :tag "Only left" (nil . 0))
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
179 (const :tag "Half width" (5 . 5))
45518
182c7dd36ef1 Fix :type of `fringe-mode' for last modification.
Simon Josefsson <jas@extundo.com>
parents: 45516
diff changeset
180 (const :tag "Minimal" (1 . 1))
45493
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
181 (integer :tag "Specific width")
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
182 (cons :tag "Different left/right sizes"
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
183 (integer :tag "Left width")
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
184 (integer :tag "Right width")))
58597
fa269b651143 (fringe): New defgroup.
Kim F. Storm <storm@cua.dk>
parents: 57538
diff changeset
185 :group 'fringe
45493
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
186 :require 'fringe
57538
6f85a547ab10 (fringe-mode-initialize): New function.
Richard M. Stallman <rms@gnu.org>
parents: 57507
diff changeset
187 :initialize 'fringe-mode-initialize
45493
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
188 :set 'set-fringe-mode-1)
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
189
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
190 (defun fringe-query-style (&optional all-frames)
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
191 "Query user for fringe style.
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
192 Returns values suitable for left-fringe and right-fringe frame parameters.
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
193 If ALL-FRAMES, the negation of the fringe values in
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
194 `default-frame-alist' is used when user enters the empty string.
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
195 Otherwise the negation of the fringe value in the currently selected
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
196 frame parameter is used."
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
197 (let ((mode (intern (completing-read
64192
258eefd93f5c (fringe-mode): Add period in docstring.
Juri Linkov <juri@jurta.org>
parents: 64180
diff changeset
198 (concat
258eefd93f5c (fringe-mode): Add period in docstring.
Juri Linkov <juri@jurta.org>
parents: 64180
diff changeset
199 "Select fringe mode for "
258eefd93f5c (fringe-mode): Add period in docstring.
Juri Linkov <juri@jurta.org>
parents: 64180
diff changeset
200 (if all-frames "all frames" "selected frame")
258eefd93f5c (fringe-mode): Add period in docstring.
Juri Linkov <juri@jurta.org>
parents: 64180
diff changeset
201 " (type ? for list): ")
45493
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
202 '(("none") ("default") ("left-only")
45516
6b848a738ec6 (fringe-query-style): New fringe style "minimal".
Simon Josefsson <jas@extundo.com>
parents: 45493
diff changeset
203 ("right-only") ("half") ("minimal"))
45493
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
204 nil t))))
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
205 (cond ((eq mode 'none) 0)
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
206 ((eq mode 'default) nil)
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
207 ((eq mode 'left-only) '(nil . 0))
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
208 ((eq mode 'right-only) '(0 . nil))
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
209 ((eq mode 'half) '(5 . 5))
45516
6b848a738ec6 (fringe-query-style): New fringe style "minimal".
Simon Josefsson <jas@extundo.com>
parents: 45493
diff changeset
210 ((eq mode 'minimal) '(1 . 1))
45493
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
211 ((eq mode (intern ""))
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
212 (if (eq 0 (cdr (assq 'left-fringe
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
213 (if all-frames
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
214 default-frame-alist
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
215 (frame-parameters (selected-frame))))))
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
216 nil
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
217 0)))))
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
218
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
219 ;;;###autoload
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
220 (defun fringe-mode (&optional mode)
52854
f6ac1fc587f8 (fringe-mode): Use active voice in docstring.
Lute Kamstra <lute@gnu.org>
parents: 52832
diff changeset
221 "Set the default appearance of fringes on all frames.
52832
43bad0db6791 (fringe-mode): Fix docstring.
Lute Kamstra <lute@gnu.org>
parents: 52401
diff changeset
222
52854
f6ac1fc587f8 (fringe-mode): Use active voice in docstring.
Lute Kamstra <lute@gnu.org>
parents: 52832
diff changeset
223 When called interactively, query the user for MODE. Valid values
f6ac1fc587f8 (fringe-mode): Use active voice in docstring.
Lute Kamstra <lute@gnu.org>
parents: 52832
diff changeset
224 for MODE include `none', `default', `left-only', `right-only',
f6ac1fc587f8 (fringe-mode): Use active voice in docstring.
Lute Kamstra <lute@gnu.org>
parents: 52832
diff changeset
225 `minimal' and `half'.
52832
43bad0db6791 (fringe-mode): Fix docstring.
Lute Kamstra <lute@gnu.org>
parents: 52401
diff changeset
226
43bad0db6791 (fringe-mode): Fix docstring.
Lute Kamstra <lute@gnu.org>
parents: 52401
diff changeset
227 When used in a Lisp program, MODE can be a cons cell where the
43bad0db6791 (fringe-mode): Fix docstring.
Lute Kamstra <lute@gnu.org>
parents: 52401
diff changeset
228 integer in car specifies the left fringe width and the integer in
43bad0db6791 (fringe-mode): Fix docstring.
Lute Kamstra <lute@gnu.org>
parents: 52401
diff changeset
229 cdr specifies the right fringe width. MODE can also be a single
43bad0db6791 (fringe-mode): Fix docstring.
Lute Kamstra <lute@gnu.org>
parents: 52401
diff changeset
230 integer that specifies both the left and the right fringe width.
52854
f6ac1fc587f8 (fringe-mode): Use active voice in docstring.
Lute Kamstra <lute@gnu.org>
parents: 52832
diff changeset
231 If a fringe width specification is nil, that means to use the
f6ac1fc587f8 (fringe-mode): Use active voice in docstring.
Lute Kamstra <lute@gnu.org>
parents: 52832
diff changeset
232 default width (8 pixels). This command may round up the left and
f6ac1fc587f8 (fringe-mode): Use active voice in docstring.
Lute Kamstra <lute@gnu.org>
parents: 52832
diff changeset
233 right width specifications to ensure that their sum is a multiple
f6ac1fc587f8 (fringe-mode): Use active voice in docstring.
Lute Kamstra <lute@gnu.org>
parents: 52832
diff changeset
234 of the character width of a frame. It never rounds up a fringe
f6ac1fc587f8 (fringe-mode): Use active voice in docstring.
Lute Kamstra <lute@gnu.org>
parents: 52832
diff changeset
235 width of 0.
52832
43bad0db6791 (fringe-mode): Fix docstring.
Lute Kamstra <lute@gnu.org>
parents: 52401
diff changeset
236
43bad0db6791 (fringe-mode): Fix docstring.
Lute Kamstra <lute@gnu.org>
parents: 52401
diff changeset
237 Fringe widths set by `set-window-fringes' override the default
43bad0db6791 (fringe-mode): Fix docstring.
Lute Kamstra <lute@gnu.org>
parents: 52401
diff changeset
238 fringe widths set by this command. This command applies to all
43bad0db6791 (fringe-mode): Fix docstring.
Lute Kamstra <lute@gnu.org>
parents: 52401
diff changeset
239 frames that exist and frames to be created in the future. If you
43bad0db6791 (fringe-mode): Fix docstring.
Lute Kamstra <lute@gnu.org>
parents: 52401
diff changeset
240 want to set the default appearance of fringes on the selected
43bad0db6791 (fringe-mode): Fix docstring.
Lute Kamstra <lute@gnu.org>
parents: 52401
diff changeset
241 frame only, see the command `set-fringe-style'."
45493
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
242 (interactive (list (fringe-query-style 'all-frames)))
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
243 (set-fringe-mode mode))
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
244
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
245 ;;;###autoload
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
246 (defun set-fringe-style (&optional mode)
52854
f6ac1fc587f8 (fringe-mode): Use active voice in docstring.
Lute Kamstra <lute@gnu.org>
parents: 52832
diff changeset
247 "Set the default appearance of fringes on the selected frame.
52832
43bad0db6791 (fringe-mode): Fix docstring.
Lute Kamstra <lute@gnu.org>
parents: 52401
diff changeset
248
52854
f6ac1fc587f8 (fringe-mode): Use active voice in docstring.
Lute Kamstra <lute@gnu.org>
parents: 52832
diff changeset
249 When called interactively, query the user for MODE. Valid values
f6ac1fc587f8 (fringe-mode): Use active voice in docstring.
Lute Kamstra <lute@gnu.org>
parents: 52832
diff changeset
250 for MODE include `none', `default', `left-only', `right-only',
f6ac1fc587f8 (fringe-mode): Use active voice in docstring.
Lute Kamstra <lute@gnu.org>
parents: 52832
diff changeset
251 `minimal' and `half'.
52832
43bad0db6791 (fringe-mode): Fix docstring.
Lute Kamstra <lute@gnu.org>
parents: 52401
diff changeset
252
43bad0db6791 (fringe-mode): Fix docstring.
Lute Kamstra <lute@gnu.org>
parents: 52401
diff changeset
253 When used in a Lisp program, MODE can be a cons cell where the
43bad0db6791 (fringe-mode): Fix docstring.
Lute Kamstra <lute@gnu.org>
parents: 52401
diff changeset
254 integer in car specifies the left fringe width and the integer in
43bad0db6791 (fringe-mode): Fix docstring.
Lute Kamstra <lute@gnu.org>
parents: 52401
diff changeset
255 cdr specifies the right fringe width. MODE can also be a single
43bad0db6791 (fringe-mode): Fix docstring.
Lute Kamstra <lute@gnu.org>
parents: 52401
diff changeset
256 integer that specifies both the left and the right fringe width.
52854
f6ac1fc587f8 (fringe-mode): Use active voice in docstring.
Lute Kamstra <lute@gnu.org>
parents: 52832
diff changeset
257 If a fringe width specification is nil, that means to use the
f6ac1fc587f8 (fringe-mode): Use active voice in docstring.
Lute Kamstra <lute@gnu.org>
parents: 52832
diff changeset
258 default width (8 pixels). This command may round up the left and
f6ac1fc587f8 (fringe-mode): Use active voice in docstring.
Lute Kamstra <lute@gnu.org>
parents: 52832
diff changeset
259 right width specifications to ensure that their sum is a multiple
f6ac1fc587f8 (fringe-mode): Use active voice in docstring.
Lute Kamstra <lute@gnu.org>
parents: 52832
diff changeset
260 of the character width of a frame. It never rounds up a fringe
f6ac1fc587f8 (fringe-mode): Use active voice in docstring.
Lute Kamstra <lute@gnu.org>
parents: 52832
diff changeset
261 width of 0.
52832
43bad0db6791 (fringe-mode): Fix docstring.
Lute Kamstra <lute@gnu.org>
parents: 52401
diff changeset
262
43bad0db6791 (fringe-mode): Fix docstring.
Lute Kamstra <lute@gnu.org>
parents: 52401
diff changeset
263 Fringe widths set by `set-window-fringes' override the default
43bad0db6791 (fringe-mode): Fix docstring.
Lute Kamstra <lute@gnu.org>
parents: 52401
diff changeset
264 fringe widths set by this command. If you want to set the
43bad0db6791 (fringe-mode): Fix docstring.
Lute Kamstra <lute@gnu.org>
parents: 52401
diff changeset
265 default appearance of fringes on all frames, see the command
43bad0db6791 (fringe-mode): Fix docstring.
Lute Kamstra <lute@gnu.org>
parents: 52401
diff changeset
266 `fringe-mode'."
45493
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
267 (interactive (list (fringe-query-style)))
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
268 (modify-frame-parameters
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
269 (selected-frame)
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
270 (list (cons 'left-fringe (if (consp mode) (car mode) mode))
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
271 (cons 'right-fringe (if (consp mode) (cdr mode) mode)))))
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
272
54399
ad02f6299e9a 2004-03-15 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 53890
diff changeset
273 (defsubst fringe-columns (side &optional real)
ad02f6299e9a 2004-03-15 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 53890
diff changeset
274 "Return the width, measured in columns, of the fringe area on SIDE.
ad02f6299e9a 2004-03-15 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 53890
diff changeset
275 If optional argument REAL is non-nil, return a real floating point
ad02f6299e9a 2004-03-15 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 53890
diff changeset
276 number instead of a rounded integer value.
ad02f6299e9a 2004-03-15 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 53890
diff changeset
277 SIDE must be the symbol `left' or `right'."
ad02f6299e9a 2004-03-15 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 53890
diff changeset
278 (funcall (if real '/ 'ceiling)
ad02f6299e9a 2004-03-15 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 53890
diff changeset
279 (or (funcall (if (eq side 'left) 'car 'cadr)
ad02f6299e9a 2004-03-15 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 53890
diff changeset
280 (window-fringes))
ad02f6299e9a 2004-03-15 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 53890
diff changeset
281 0)
ad02f6299e9a 2004-03-15 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 53890
diff changeset
282 (float (frame-char-width))))
57261
075de3b1e798 (fringe-bitmap-p): New macro.
Kim F. Storm <storm@cua.dk>
parents: 54399
diff changeset
283
45493
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
284 (provide 'fringe)
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
285
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 50127
diff changeset
286 ;;; arch-tag: 6611ef60-0869-47ed-8b93-587ee7d3ff5d
45493
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
287 ;;; fringe.el ends here