Mercurial > emacs
comparison lisp/fringe.el @ 89909:68c22ea6027c
Sync to HEAD
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Fri, 16 Apr 2004 12:51:06 +0000 |
parents | 375f2633d815 |
children | e23928ac5a97 |
comparison
equal
deleted
inserted
replaced
89908:ee1402f7b568 | 89909:68c22ea6027c |
---|---|
32 ;; gratefully acknowledge comments and suggestions made by Miles | 32 ;; gratefully acknowledge comments and suggestions made by Miles |
33 ;; Bader, Eli Zaretski, Richard Stallman, Pavel Janík and others which | 33 ;; Bader, Eli Zaretski, Richard Stallman, Pavel Janík and others which |
34 ;; improved this package. | 34 ;; improved this package. |
35 | 35 |
36 ;;; Code: | 36 ;;; Code: |
37 | |
38 ;; Standard fringe bitmaps | |
39 | |
40 (defconst no-fringe-bitmap 0) | |
41 (defconst undef-fringe-bitmap 1) | |
42 (defconst left-truncation-fringe-bitmap 2) | |
43 (defconst right-truncation-fringe-bitmap 3) | |
44 (defconst up-arrow-fringe-bitmap 4) | |
45 (defconst down-arrow-fringe-bitmap 5) | |
46 (defconst continued-line-fringe-bitmap 6) | |
47 (defconst continuation-line-fringe-bitmap 7) | |
48 (defconst overlay-arrow-fringe-bitmap 8) | |
49 (defconst top-left-angle-fringe-bitmap 9) | |
50 (defconst top-right-angle-fringe-bitmap 10) | |
51 (defconst bottom-left-angle-fringe-bitmap 11) | |
52 (defconst bottom-right-angle-fringe-bitmap 12) | |
53 (defconst left-bracket-fringe-bitmap 13) | |
54 (defconst right-bracket-fringe-bitmap 14) | |
55 (defconst filled-box-cursor-fringe-bitmap 15) | |
56 (defconst hollow-box-cursor-fringe-bitmap 16) | |
57 (defconst hollow-square-fringe-bitmap 17) | |
58 (defconst bar-cursor-fringe-bitmap 18) | |
59 (defconst hbar-cursor-fringe-bitmap 19) | |
60 (defconst empty-line-fringe-bitmap 20) | |
61 | |
62 | |
63 ;; Control presence of fringes | |
37 | 64 |
38 (defvar fringe-mode) | 65 (defvar fringe-mode) |
39 | 66 |
40 (defun set-fringe-mode-1 (ignore value) | 67 (defun set-fringe-mode-1 (ignore value) |
41 "Call `set-fringe-mode' with VALUE. | 68 "Call `set-fringe-mode' with VALUE. |
117 If ALL-FRAMES, the negation of the fringe values in | 144 If ALL-FRAMES, the negation of the fringe values in |
118 `default-frame-alist' is used when user enters the empty string. | 145 `default-frame-alist' is used when user enters the empty string. |
119 Otherwise the negation of the fringe value in the currently selected | 146 Otherwise the negation of the fringe value in the currently selected |
120 frame parameter is used." | 147 frame parameter is used." |
121 (let ((mode (intern (completing-read | 148 (let ((mode (intern (completing-read |
122 "Select fringe mode for all frames (SPACE for list): " | 149 "Select fringe mode for all frames (type ? for list): " |
123 '(("none") ("default") ("left-only") | 150 '(("none") ("default") ("left-only") |
124 ("right-only") ("half") ("minimal")) | 151 ("right-only") ("half") ("minimal")) |
125 nil t)))) | 152 nil t)))) |
126 (cond ((eq mode 'none) 0) | 153 (cond ((eq mode 'none) 0) |
127 ((eq mode 'default) nil) | 154 ((eq mode 'default) nil) |
137 nil | 164 nil |
138 0))))) | 165 0))))) |
139 | 166 |
140 ;;;###autoload | 167 ;;;###autoload |
141 (defun fringe-mode (&optional mode) | 168 (defun fringe-mode (&optional mode) |
142 "Toggle appearance of fringes on all frames. | 169 "Set the default appearance of fringes on all frames. |
143 Valid values for MODE include `none', `default', `left-only', | 170 |
144 `right-only', `minimal' and `half'. MODE can also be a cons cell | 171 When called interactively, query the user for MODE. Valid values |
145 where the integer in car will be used as left fringe width and the | 172 for MODE include `none', `default', `left-only', `right-only', |
146 integer in cdr will be used as right fringe width. If MODE is not | 173 `minimal' and `half'. |
147 specified, the user is queried. | 174 |
148 It applies to all frames that exist and frames to be created in the | 175 When used in a Lisp program, MODE can be a cons cell where the |
149 future. | 176 integer in car specifies the left fringe width and the integer in |
150 If you want to set appearance of fringes on the selected frame only, | 177 cdr specifies the right fringe width. MODE can also be a single |
151 see `set-fringe-style'." | 178 integer that specifies both the left and the right fringe width. |
179 If a fringe width specification is nil, that means to use the | |
180 default width (8 pixels). This command may round up the left and | |
181 right width specifications to ensure that their sum is a multiple | |
182 of the character width of a frame. It never rounds up a fringe | |
183 width of 0. | |
184 | |
185 Fringe widths set by `set-window-fringes' override the default | |
186 fringe widths set by this command. This command applies to all | |
187 frames that exist and frames to be created in the future. If you | |
188 want to set the default appearance of fringes on the selected | |
189 frame only, see the command `set-fringe-style'." | |
152 (interactive (list (fringe-query-style 'all-frames))) | 190 (interactive (list (fringe-query-style 'all-frames))) |
153 (set-fringe-mode mode)) | 191 (set-fringe-mode mode)) |
154 | 192 |
155 ;;;###autoload | 193 ;;;###autoload |
156 (defun set-fringe-style (&optional mode) | 194 (defun set-fringe-style (&optional mode) |
157 "Set appearance of fringes on selected frame. | 195 "Set the default appearance of fringes on the selected frame. |
158 Valid values for MODE include `none', `default', `left-only', | 196 |
159 `right-only', `minimal' and `half'. MODE can also be a cons cell | 197 When called interactively, query the user for MODE. Valid values |
160 where the integer in car will be used as left fringe width and the | 198 for MODE include `none', `default', `left-only', `right-only', |
161 integer in cdr will be used as right fringe width. If MODE is not | 199 `minimal' and `half'. |
162 specified, the user is queried. | 200 |
163 If you want to set appearance of fringes on all frames, see `fringe-mode'." | 201 When used in a Lisp program, MODE can be a cons cell where the |
202 integer in car specifies the left fringe width and the integer in | |
203 cdr specifies the right fringe width. MODE can also be a single | |
204 integer that specifies both the left and the right fringe width. | |
205 If a fringe width specification is nil, that means to use the | |
206 default width (8 pixels). This command may round up the left and | |
207 right width specifications to ensure that their sum is a multiple | |
208 of the character width of a frame. It never rounds up a fringe | |
209 width of 0. | |
210 | |
211 Fringe widths set by `set-window-fringes' override the default | |
212 fringe widths set by this command. If you want to set the | |
213 default appearance of fringes on all frames, see the command | |
214 `fringe-mode'." | |
164 (interactive (list (fringe-query-style))) | 215 (interactive (list (fringe-query-style))) |
165 (modify-frame-parameters | 216 (modify-frame-parameters |
166 (selected-frame) | 217 (selected-frame) |
167 (list (cons 'left-fringe (if (consp mode) (car mode) mode)) | 218 (list (cons 'left-fringe (if (consp mode) (car mode) mode)) |
168 (cons 'right-fringe (if (consp mode) (cdr mode) mode))))) | 219 (cons 'right-fringe (if (consp mode) (cdr mode) mode))))) |
169 | 220 |
221 (defsubst fringe-columns (side &optional real) | |
222 "Return the width, measured in columns, of the fringe area on SIDE. | |
223 If optional argument REAL is non-nil, return a real floating point | |
224 number instead of a rounded integer value. | |
225 SIDE must be the symbol `left' or `right'." | |
226 (funcall (if real '/ 'ceiling) | |
227 (or (funcall (if (eq side 'left) 'car 'cadr) | |
228 (window-fringes)) | |
229 0) | |
230 (float (frame-char-width)))) | |
231 | |
170 (provide 'fringe) | 232 (provide 'fringe) |
171 | 233 |
234 ;;; arch-tag: 6611ef60-0869-47ed-8b93-587ee7d3ff5d | |
172 ;;; fringe.el ends here | 235 ;;; fringe.el ends here |