annotate lisp/fringe.el @ 104844:ce7818a96e63

(x_focus_changed): If we get a focusout and pointer is invisible, make it visible.
author Jan Djärv <jan.h.d@swipnet.se>
date Fri, 04 Sep 2009 05:33:13 +0000
parents a441edf4d939
children 1d1d5d9bd884
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
103479
a441edf4d939 Add coding: utf-8 cookie.
Kenichi Handa <handa@m17n.org>
parents: 100908
diff changeset
1 ;;; fringe.el --- fringe setup and control -*- coding: utf-8 -*-
45493
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
2
100908
a9dc0e7c3f2b Add 2009 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 100171
diff changeset
3 ;; Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008,
a9dc0e7c3f2b Add 2009 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 100171
diff changeset
4 ;; 2009 Free Software Foundation, Inc.
45493
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
5
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
6 ;; Author: Simon Josefsson <simon@josefsson.org>
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
7 ;; Maintainer: FSF
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
8 ;; Keywords: frames
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
9
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
10 ;; This file is part of GNU Emacs.
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
11
94678
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
12 ;; GNU Emacs is free software: you can redistribute it and/or modify
45493
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
13 ;; it under the terms of the GNU General Public License as published by
94678
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
14 ;; the Free Software Foundation, either version 3 of the License, or
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
15 ;; (at your option) any later version.
45493
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
16
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
17 ;; GNU Emacs is distributed in the hope that it will be useful,
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
20 ;; GNU General Public License for more details.
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
21
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
22 ;; You should have received a copy of the GNU General Public License
94678
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
45493
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
24
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
25 ;;; Commentary:
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
26
69070
efaafdfc3b2c *** empty log message ***
Kim F. Storm <storm@cua.dk>
parents: 69066
diff changeset
27 ;; This file contains code to initialize the built-in fringe bitmaps
efaafdfc3b2c *** empty log message ***
Kim F. Storm <storm@cua.dk>
parents: 69066
diff changeset
28 ;; as well as helpful functions for customizing the appearance of the
efaafdfc3b2c *** empty log message ***
Kim F. Storm <storm@cua.dk>
parents: 69066
diff changeset
29 ;; fringe.
45493
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
69070
efaafdfc3b2c *** empty log message ***
Kim F. Storm <storm@cua.dk>
parents: 69066
diff changeset
43 ;; Define the built-in fringe bitmaps and setup default mappings
57261
075de3b1e798 (fringe-bitmap-p): New macro.
Kim F. Storm <storm@cua.dk>
parents: 54399
diff changeset
44
69072
64b2a2990f41 Fix last change.
Kim F. Storm <storm@cua.dk>
parents: 69070
diff changeset
45 (when (boundp 'fringe-bitmaps)
64b2a2990f41 Fix last change.
Kim F. Storm <storm@cua.dk>
parents: 69070
diff changeset
46 (let ((bitmaps '(question-mark
64b2a2990f41 Fix last change.
Kim F. Storm <storm@cua.dk>
parents: 69070
diff changeset
47 left-arrow right-arrow up-arrow down-arrow
64b2a2990f41 Fix last change.
Kim F. Storm <storm@cua.dk>
parents: 69070
diff changeset
48 left-curly-arrow right-curly-arrow
64b2a2990f41 Fix last change.
Kim F. Storm <storm@cua.dk>
parents: 69070
diff changeset
49 left-triangle right-triangle
64b2a2990f41 Fix last change.
Kim F. Storm <storm@cua.dk>
parents: 69070
diff changeset
50 top-left-angle top-right-angle
64b2a2990f41 Fix last change.
Kim F. Storm <storm@cua.dk>
parents: 69070
diff changeset
51 bottom-left-angle bottom-right-angle
64b2a2990f41 Fix last change.
Kim F. Storm <storm@cua.dk>
parents: 69070
diff changeset
52 left-bracket right-bracket
64b2a2990f41 Fix last change.
Kim F. Storm <storm@cua.dk>
parents: 69070
diff changeset
53 filled-rectangle hollow-rectangle
64b2a2990f41 Fix last change.
Kim F. Storm <storm@cua.dk>
parents: 69070
diff changeset
54 filled-square hollow-square
64b2a2990f41 Fix last change.
Kim F. Storm <storm@cua.dk>
parents: 69070
diff changeset
55 vertical-bar horizontal-bar
64b2a2990f41 Fix last change.
Kim F. Storm <storm@cua.dk>
parents: 69070
diff changeset
56 empty-line))
64b2a2990f41 Fix last change.
Kim F. Storm <storm@cua.dk>
parents: 69070
diff changeset
57 (bn 1))
64b2a2990f41 Fix last change.
Kim F. Storm <storm@cua.dk>
parents: 69070
diff changeset
58 (while bitmaps
64b2a2990f41 Fix last change.
Kim F. Storm <storm@cua.dk>
parents: 69070
diff changeset
59 (push (car bitmaps) fringe-bitmaps)
64b2a2990f41 Fix last change.
Kim F. Storm <storm@cua.dk>
parents: 69070
diff changeset
60 (put (car bitmaps) 'fringe bn)
64b2a2990f41 Fix last change.
Kim F. Storm <storm@cua.dk>
parents: 69070
diff changeset
61 (setq bitmaps (cdr bitmaps)
64b2a2990f41 Fix last change.
Kim F. Storm <storm@cua.dk>
parents: 69070
diff changeset
62 bn (1+ bn))))
53890
5588b6cc6fba (no-fringe-bitmap, undef-fringe-bitmap)
Kim F. Storm <storm@cua.dk>
parents: 53257
diff changeset
63
69072
64b2a2990f41 Fix last change.
Kim F. Storm <storm@cua.dk>
parents: 69070
diff changeset
64 (setq-default fringe-indicator-alist
64b2a2990f41 Fix last change.
Kim F. Storm <storm@cua.dk>
parents: 69070
diff changeset
65 '((truncation . (left-arrow right-arrow))
64b2a2990f41 Fix last change.
Kim F. Storm <storm@cua.dk>
parents: 69070
diff changeset
66 (continuation . (left-curly-arrow right-curly-arrow))
64b2a2990f41 Fix last change.
Kim F. Storm <storm@cua.dk>
parents: 69070
diff changeset
67 (overlay-arrow . right-triangle)
64b2a2990f41 Fix last change.
Kim F. Storm <storm@cua.dk>
parents: 69070
diff changeset
68 (up . up-arrow)
64b2a2990f41 Fix last change.
Kim F. Storm <storm@cua.dk>
parents: 69070
diff changeset
69 (down . down-arrow)
64b2a2990f41 Fix last change.
Kim F. Storm <storm@cua.dk>
parents: 69070
diff changeset
70 (top . (top-left-angle top-right-angle))
64b2a2990f41 Fix last change.
Kim F. Storm <storm@cua.dk>
parents: 69070
diff changeset
71 (bottom . (bottom-left-angle bottom-right-angle
64b2a2990f41 Fix last change.
Kim F. Storm <storm@cua.dk>
parents: 69070
diff changeset
72 top-right-angle top-left-angle))
64b2a2990f41 Fix last change.
Kim F. Storm <storm@cua.dk>
parents: 69070
diff changeset
73 (top-bottom . (left-bracket right-bracket
64b2a2990f41 Fix last change.
Kim F. Storm <storm@cua.dk>
parents: 69070
diff changeset
74 top-right-angle top-left-angle))
64b2a2990f41 Fix last change.
Kim F. Storm <storm@cua.dk>
parents: 69070
diff changeset
75 (empty-line . empty-line)
64b2a2990f41 Fix last change.
Kim F. Storm <storm@cua.dk>
parents: 69070
diff changeset
76 (unknown . question-mark)))
69050
c0e9f855475e (fringe-bitmaps): Update to new bitmap names.
Kim F. Storm <storm@cua.dk>
parents: 68651
diff changeset
77
69072
64b2a2990f41 Fix last change.
Kim F. Storm <storm@cua.dk>
parents: 69070
diff changeset
78 (setq-default fringe-cursor-alist
64b2a2990f41 Fix last change.
Kim F. Storm <storm@cua.dk>
parents: 69070
diff changeset
79 '((box . filled-rectangle)
64b2a2990f41 Fix last change.
Kim F. Storm <storm@cua.dk>
parents: 69070
diff changeset
80 (hollow . hollow-rectangle)
64b2a2990f41 Fix last change.
Kim F. Storm <storm@cua.dk>
parents: 69070
diff changeset
81 (bar . vertical-bar)
64b2a2990f41 Fix last change.
Kim F. Storm <storm@cua.dk>
parents: 69070
diff changeset
82 (hbar . horizontal-bar)
64b2a2990f41 Fix last change.
Kim F. Storm <storm@cua.dk>
parents: 69070
diff changeset
83 (hollow-small . hollow-square))))
53890
5588b6cc6fba (no-fringe-bitmap, undef-fringe-bitmap)
Kim F. Storm <storm@cua.dk>
parents: 53257
diff changeset
84
69070
efaafdfc3b2c *** empty log message ***
Kim F. Storm <storm@cua.dk>
parents: 69066
diff changeset
85
efaafdfc3b2c *** empty log message ***
Kim F. Storm <storm@cua.dk>
parents: 69066
diff changeset
86 (defmacro fringe-bitmap-p (symbol)
efaafdfc3b2c *** empty log message ***
Kim F. Storm <storm@cua.dk>
parents: 69066
diff changeset
87 "Return non-nil if SYMBOL is a fringe bitmap."
efaafdfc3b2c *** empty log message ***
Kim F. Storm <storm@cua.dk>
parents: 69066
diff changeset
88 `(get ,symbol 'fringe))
efaafdfc3b2c *** empty log message ***
Kim F. Storm <storm@cua.dk>
parents: 69066
diff changeset
89
efaafdfc3b2c *** empty log message ***
Kim F. Storm <storm@cua.dk>
parents: 69066
diff changeset
90
53890
5588b6cc6fba (no-fringe-bitmap, undef-fringe-bitmap)
Kim F. Storm <storm@cua.dk>
parents: 53257
diff changeset
91 ;; Control presence of fringes
5588b6cc6fba (no-fringe-bitmap, undef-fringe-bitmap)
Kim F. Storm <storm@cua.dk>
parents: 53257
diff changeset
92
45493
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
93 (defvar fringe-mode)
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
94
87702
7ebe288dfbd0 (fringe-mode-explicit): New variable.
Martin Rudalics <rudalics@gmx.at>
parents: 87649
diff changeset
95 (defvar fringe-mode-explicit nil
7ebe288dfbd0 (fringe-mode-explicit): New variable.
Martin Rudalics <rudalics@gmx.at>
parents: 87649
diff changeset
96 "Non-nil means `set-fringe-mode' should really do something.
7ebe288dfbd0 (fringe-mode-explicit): New variable.
Martin Rudalics <rudalics@gmx.at>
parents: 87649
diff changeset
97 This is nil while loading `fringe.el', and t afterward.")
7ebe288dfbd0 (fringe-mode-explicit): New variable.
Martin Rudalics <rudalics@gmx.at>
parents: 87649
diff changeset
98
45493
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
99 (defun set-fringe-mode-1 (ignore value)
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
100 "Call `set-fringe-mode' with VALUE.
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
101 See `fringe-mode' for valid values and their effect.
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
102 This is usually invoked when setting `fringe-mode' via customize."
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
103 (set-fringe-mode value))
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
104
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
105 (defun set-fringe-mode (value)
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
106 "Set `fringe-mode' to VALUE and put the new value into effect.
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
107 See `fringe-mode' for possible values and their effect."
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
108 (setq fringe-mode value)
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
109
87702
7ebe288dfbd0 (fringe-mode-explicit): New variable.
Martin Rudalics <rudalics@gmx.at>
parents: 87649
diff changeset
110 (when fringe-mode-explicit
7ebe288dfbd0 (fringe-mode-explicit): New variable.
Martin Rudalics <rudalics@gmx.at>
parents: 87649
diff changeset
111 (modify-all-frames-parameters
7ebe288dfbd0 (fringe-mode-explicit): New variable.
Martin Rudalics <rudalics@gmx.at>
parents: 87649
diff changeset
112 (list (cons 'left-fringe (if (consp fringe-mode)
7ebe288dfbd0 (fringe-mode-explicit): New variable.
Martin Rudalics <rudalics@gmx.at>
parents: 87649
diff changeset
113 (car fringe-mode)
7ebe288dfbd0 (fringe-mode-explicit): New variable.
Martin Rudalics <rudalics@gmx.at>
parents: 87649
diff changeset
114 fringe-mode))
7ebe288dfbd0 (fringe-mode-explicit): New variable.
Martin Rudalics <rudalics@gmx.at>
parents: 87649
diff changeset
115 (cons 'right-fringe (if (consp fringe-mode)
7ebe288dfbd0 (fringe-mode-explicit): New variable.
Martin Rudalics <rudalics@gmx.at>
parents: 87649
diff changeset
116 (cdr fringe-mode)
7ebe288dfbd0 (fringe-mode-explicit): New variable.
Martin Rudalics <rudalics@gmx.at>
parents: 87649
diff changeset
117 fringe-mode))))))
45493
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
118
57538
6f85a547ab10 (fringe-mode-initialize): New function.
Richard M. Stallman <rms@gnu.org>
parents: 57507
diff changeset
119 ;; 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
120 ;; made explicitly to default-frame-alist.
6f85a547ab10 (fringe-mode-initialize): New function.
Richard M. Stallman <rms@gnu.org>
parents: 57507
diff changeset
121 (defun fringe-mode-initialize (symbol value)
6f85a547ab10 (fringe-mode-initialize): New function.
Richard M. Stallman <rms@gnu.org>
parents: 57507
diff changeset
122 (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
123 (right-pair (assq 'right-fringe default-frame-alist))
6f85a547ab10 (fringe-mode-initialize): New function.
Richard M. Stallman <rms@gnu.org>
parents: 57507
diff changeset
124 (left (cdr left-pair))
6f85a547ab10 (fringe-mode-initialize): New function.
Richard M. Stallman <rms@gnu.org>
parents: 57507
diff changeset
125 (right (cdr right-pair)))
6f85a547ab10 (fringe-mode-initialize): New function.
Richard M. Stallman <rms@gnu.org>
parents: 57507
diff changeset
126 (if (or left-pair right-pair)
6f85a547ab10 (fringe-mode-initialize): New function.
Richard M. Stallman <rms@gnu.org>
parents: 57507
diff changeset
127 ;; 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
128 ;; 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
129 (progn
6f85a547ab10 (fringe-mode-initialize): New function.
Richard M. Stallman <rms@gnu.org>
parents: 57507
diff changeset
130 (setq fringe-mode (cons left right))
6f85a547ab10 (fringe-mode-initialize): New function.
Richard M. Stallman <rms@gnu.org>
parents: 57507
diff changeset
131 (if (equal fringe-mode '(nil . nil))
6f85a547ab10 (fringe-mode-initialize): New function.
Richard M. Stallman <rms@gnu.org>
parents: 57507
diff changeset
132 (setq fringe-mode nil))
6f85a547ab10 (fringe-mode-initialize): New function.
Richard M. Stallman <rms@gnu.org>
parents: 57507
diff changeset
133 (if (equal fringe-mode '(0 . 0))
6f85a547ab10 (fringe-mode-initialize): New function.
Richard M. Stallman <rms@gnu.org>
parents: 57507
diff changeset
134 (setq fringe-mode 0)))
6f85a547ab10 (fringe-mode-initialize): New function.
Richard M. Stallman <rms@gnu.org>
parents: 57507
diff changeset
135 ;; 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
136 (custom-initialize-reset symbol value))))
6f85a547ab10 (fringe-mode-initialize): New function.
Richard M. Stallman <rms@gnu.org>
parents: 57507
diff changeset
137
45493
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
138 (defcustom fringe-mode nil
100171
d42aff5ca541 * align.el:
Lute Kamstra <lute@gnu.org>
parents: 94678
diff changeset
139 "Specify appearance of fringes on all frames.
45493
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
140 This variable can be nil (the default) meaning the fringes should have
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
141 the default width (8 pixels), it can be an integer value specifying
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
142 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
143 a cons cell where car indicates width of left fringe and cdr indicates
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
144 width of right fringe (where again 0 can be used to indicate no
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
145 fringe).
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
146 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
147 it take real effect.
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
148 Setting the variable with a customization buffer also takes effect.
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
149 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
150 you can use the interactive function `set-fringe-style'."
45493
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
151 :type '(choice (const :tag "Default width" nil)
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
152 (const :tag "No fringes" 0)
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
153 (const :tag "Only right" (0 . nil))
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
154 (const :tag "Only left" (nil . 0))
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
155 (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
156 (const :tag "Minimal" (1 . 1))
45493
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
157 (integer :tag "Specific width")
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
158 (cons :tag "Different left/right sizes"
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
159 (integer :tag "Left width")
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
160 (integer :tag "Right width")))
58597
fa269b651143 (fringe): New defgroup.
Kim F. Storm <storm@cua.dk>
parents: 57538
diff changeset
161 :group 'fringe
45493
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
162 :require 'fringe
57538
6f85a547ab10 (fringe-mode-initialize): New function.
Richard M. Stallman <rms@gnu.org>
parents: 57507
diff changeset
163 :initialize 'fringe-mode-initialize
45493
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
164 :set 'set-fringe-mode-1)
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
165
87702
7ebe288dfbd0 (fringe-mode-explicit): New variable.
Martin Rudalics <rudalics@gmx.at>
parents: 87649
diff changeset
166 ;; We just set fringe-mode, but that was the default.
7ebe288dfbd0 (fringe-mode-explicit): New variable.
Martin Rudalics <rudalics@gmx.at>
parents: 87649
diff changeset
167 ;; If it is set again, that is for real.
7ebe288dfbd0 (fringe-mode-explicit): New variable.
Martin Rudalics <rudalics@gmx.at>
parents: 87649
diff changeset
168 (setq fringe-mode-explicit t)
7ebe288dfbd0 (fringe-mode-explicit): New variable.
Martin Rudalics <rudalics@gmx.at>
parents: 87649
diff changeset
169
45493
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
170 (defun fringe-query-style (&optional all-frames)
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
171 "Query user for fringe style.
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
172 Returns values suitable for left-fringe and right-fringe frame parameters.
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
173 If ALL-FRAMES, the negation of the fringe values in
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
174 `default-frame-alist' is used when user enters the empty string.
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
175 Otherwise the negation of the fringe value in the currently selected
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
176 frame parameter is used."
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
177 (let ((mode (intern (completing-read
64192
258eefd93f5c (fringe-mode): Add period in docstring.
Juri Linkov <juri@jurta.org>
parents: 64180
diff changeset
178 (concat
258eefd93f5c (fringe-mode): Add period in docstring.
Juri Linkov <juri@jurta.org>
parents: 64180
diff changeset
179 "Select fringe mode for "
258eefd93f5c (fringe-mode): Add period in docstring.
Juri Linkov <juri@jurta.org>
parents: 64180
diff changeset
180 (if all-frames "all frames" "selected frame")
258eefd93f5c (fringe-mode): Add period in docstring.
Juri Linkov <juri@jurta.org>
parents: 64180
diff changeset
181 " (type ? for list): ")
45493
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
182 '(("none") ("default") ("left-only")
45516
6b848a738ec6 (fringe-query-style): New fringe style "minimal".
Simon Josefsson <jas@extundo.com>
parents: 45493
diff changeset
183 ("right-only") ("half") ("minimal"))
45493
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
184 nil t))))
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
185 (cond ((eq mode 'none) 0)
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
186 ((eq mode 'default) nil)
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
187 ((eq mode 'left-only) '(nil . 0))
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
188 ((eq mode 'right-only) '(0 . nil))
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
189 ((eq mode 'half) '(5 . 5))
45516
6b848a738ec6 (fringe-query-style): New fringe style "minimal".
Simon Josefsson <jas@extundo.com>
parents: 45493
diff changeset
190 ((eq mode 'minimal) '(1 . 1))
45493
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
191 ((eq mode (intern ""))
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
192 (if (eq 0 (cdr (assq 'left-fringe
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
193 (if all-frames
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
194 default-frame-alist
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
195 (frame-parameters (selected-frame))))))
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
196 nil
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
197 0)))))
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
198
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
199 (defun fringe-mode (&optional mode)
52854
f6ac1fc587f8 (fringe-mode): Use active voice in docstring.
Lute Kamstra <lute@gnu.org>
parents: 52832
diff changeset
200 "Set the default appearance of fringes on all frames.
52832
43bad0db6791 (fringe-mode): Fix docstring.
Lute Kamstra <lute@gnu.org>
parents: 52401
diff changeset
201
52854
f6ac1fc587f8 (fringe-mode): Use active voice in docstring.
Lute Kamstra <lute@gnu.org>
parents: 52832
diff changeset
202 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
203 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
204 `minimal' and `half'.
52832
43bad0db6791 (fringe-mode): Fix docstring.
Lute Kamstra <lute@gnu.org>
parents: 52401
diff changeset
205
43bad0db6791 (fringe-mode): Fix docstring.
Lute Kamstra <lute@gnu.org>
parents: 52401
diff changeset
206 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
207 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
208 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
209 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
210 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
211 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
212 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
213 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
214 width of 0.
52832
43bad0db6791 (fringe-mode): Fix docstring.
Lute Kamstra <lute@gnu.org>
parents: 52401
diff changeset
215
43bad0db6791 (fringe-mode): Fix docstring.
Lute Kamstra <lute@gnu.org>
parents: 52401
diff changeset
216 Fringe widths set by `set-window-fringes' override the default
43bad0db6791 (fringe-mode): Fix docstring.
Lute Kamstra <lute@gnu.org>
parents: 52401
diff changeset
217 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
218 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
219 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
220 frame only, see the command `set-fringe-style'."
45493
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
221 (interactive (list (fringe-query-style 'all-frames)))
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
222 (set-fringe-mode mode))
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
223
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
224 (defun set-fringe-style (&optional mode)
52854
f6ac1fc587f8 (fringe-mode): Use active voice in docstring.
Lute Kamstra <lute@gnu.org>
parents: 52832
diff changeset
225 "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
226
52854
f6ac1fc587f8 (fringe-mode): Use active voice in docstring.
Lute Kamstra <lute@gnu.org>
parents: 52832
diff changeset
227 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
228 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
229 `minimal' and `half'.
52832
43bad0db6791 (fringe-mode): Fix docstring.
Lute Kamstra <lute@gnu.org>
parents: 52401
diff changeset
230
43bad0db6791 (fringe-mode): Fix docstring.
Lute Kamstra <lute@gnu.org>
parents: 52401
diff changeset
231 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
232 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
233 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
234 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
235 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
236 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
237 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
238 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
239 width of 0.
52832
43bad0db6791 (fringe-mode): Fix docstring.
Lute Kamstra <lute@gnu.org>
parents: 52401
diff changeset
240
43bad0db6791 (fringe-mode): Fix docstring.
Lute Kamstra <lute@gnu.org>
parents: 52401
diff changeset
241 Fringe widths set by `set-window-fringes' override the default
43bad0db6791 (fringe-mode): Fix docstring.
Lute Kamstra <lute@gnu.org>
parents: 52401
diff changeset
242 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
243 default appearance of fringes on all frames, see the command
43bad0db6791 (fringe-mode): Fix docstring.
Lute Kamstra <lute@gnu.org>
parents: 52401
diff changeset
244 `fringe-mode'."
45493
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
245 (interactive (list (fringe-query-style)))
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
246 (modify-frame-parameters
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
247 (selected-frame)
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
248 (list (cons 'left-fringe (if (consp mode) (car mode) mode))
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
249 (cons 'right-fringe (if (consp mode) (cdr mode) mode)))))
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
250
54399
ad02f6299e9a 2004-03-15 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 53890
diff changeset
251 (defsubst fringe-columns (side &optional real)
ad02f6299e9a 2004-03-15 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 53890
diff changeset
252 "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
253 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
254 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
255 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
256 (funcall (if real '/ 'ceiling)
ad02f6299e9a 2004-03-15 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 53890
diff changeset
257 (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
258 (window-fringes))
ad02f6299e9a 2004-03-15 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 53890
diff changeset
259 0)
ad02f6299e9a 2004-03-15 Masatake YAMATO <jet@gyve.org>
Masatake YAMATO <jet@gyve.org>
parents: 53890
diff changeset
260 (float (frame-char-width))))
57261
075de3b1e798 (fringe-bitmap-p): New macro.
Kim F. Storm <storm@cua.dk>
parents: 54399
diff changeset
261
45493
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
262 (provide 'fringe)
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
263
93975
1e3a407766b9 Fix up comment convention on the arch-tag lines.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 87702
diff changeset
264 ;; arch-tag: 6611ef60-0869-47ed-8b93-587ee7d3ff5d
45493
6d49cede6000 Initial version.
Simon Josefsson <jas@extundo.com>
parents:
diff changeset
265 ;;; fringe.el ends here