Mercurial > emacs
annotate lisp/fringe.el @ 46798:a8e027c9c403
In src:
2002-08-03 Andrew Choi <akochoi@shaw.ca>
* macterm.c (USE_CARBON_EVENTS): New macro.
(macCtrlKey, macShiftKey, macMetaKey, macAltKey): New macros.
(x_iconify_frame): Call CollapseWindow.
(Vmac_reverse_ctrl_meta): New variable.
(Vmac_wheel_button_is_mouse_2): New variable.
(init_mac_drag_n_drop): New function.
(mac_do_receive_drag): New function.
(mac_handle_service_event): New function.
(init_service_handler): New function.
(mac_to_emacs_modifiers): New function.
(mac_event_to_emacs_modifiers): New function.
(mac_get_mouse_btn): New function.
(mac_convert_event_ref): New function.
(XTread_socket) [USE_CARBON_EVENTS]: Call ReceiveNextEvent,
SendEventToEventTarget, mac_event_to_emacs_modifiers, and
mac_get_mouse_btn.
(mac_initialize): Call init_mac_drag_n_drop and
init_service_handler.
* keyboard.c: Define Qmouse_wheel, mouse_wheel_syms, and
lispy_mouse_wheel_names for MAC_OSX as well as for WINDOWS_NT.
(kbd_buffer_get_event): Set used_mouse_menu for MENU_BAR_EVENT and
TOOL_BAR_EVENT for MAC_OS as well.
(make_lispy_event): Handle MOUSE_WHEEL_EVENT for MAC_OSX as well
as for WINDOWS_NT.
(syms_of_keyboard): Initialize Qmouse_wheel for MAC_OSX.
* termhooks.h (event_kind): Define MOUSE_WHEEL_EVENT also for
MAC_OSX.
In lisp:
2002-08-03 Andrew Choi <akochoi@shaw.ca>
* term/mac-win.el: Set keys to enable mouse wheel support.
author | Andrew Choi <akochoi@shaw.ca> |
---|---|
date | Sat, 03 Aug 2002 22:21:09 +0000 |
parents | f48a8ed9d03a |
children | 7efc8970b32c d7ddb3e565de |
rev | line source |
---|---|
45493 | 1 ;;; fringe.el --- change fringes appearance in various ways |
2 | |
3 ;; Copyright (C) 2002 Free Software Foundation, Inc. | |
4 | |
5 ;; Author: Simon Josefsson <simon@josefsson.org> | |
6 ;; Maintainer: FSF | |
7 ;; Keywords: frames | |
8 | |
9 ;; This file is part of GNU Emacs. | |
10 | |
11 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
12 ;; it under the terms of the GNU General Public License as published by | |
13 ;; the Free Software Foundation; either version 2, or (at your option) | |
14 ;; any later version. | |
15 | |
16 ;; GNU Emacs is distributed in the hope that it will be useful, | |
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 ;; GNU General Public License for more details. | |
20 | |
21 ;; You should have received a copy of the GNU General Public License | |
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
24 ;; Boston, MA 02111-1307, USA. | |
25 | |
26 ;;; Commentary: | |
27 | |
28 ;; This file contains helpful functions for customizing the appearance | |
29 ;; of the fringe. | |
30 | |
31 ;; The code is influenced by scroll-bar.el and avoid.el. The author | |
32 ;; gratefully acknowledge comments and suggestions made by Miles | |
33 ;; Bader, Eli Zaretski, Richard Stallman, Pavel JanÃk and others which | |
34 ;; improved this package. | |
35 | |
36 ;;; Code: | |
37 | |
38 (defvar fringe-mode) | |
39 | |
40 (defun set-fringe-mode-1 (ignore value) | |
41 "Call `set-fringe-mode' with VALUE. | |
42 See `fringe-mode' for valid values and their effect. | |
43 This is usually invoked when setting `fringe-mode' via customize." | |
44 (set-fringe-mode value)) | |
45 | |
46 (defun set-fringe-mode (value) | |
47 "Set `fringe-mode' to VALUE and put the new value into effect. | |
48 See `fringe-mode' for possible values and their effect." | |
49 (setq fringe-mode value) | |
50 | |
51 ;; Apply it to default-frame-alist. | |
52 (let ((parameter (assq 'left-fringe default-frame-alist))) | |
53 (if (consp parameter) | |
45524
f48a8ed9d03a
(set-fringe-mode): Work when updating
Simon Josefsson <jas@extundo.com>
parents:
45518
diff
changeset
|
54 (setcdr parameter (if (consp fringe-mode) |
f48a8ed9d03a
(set-fringe-mode): Work when updating
Simon Josefsson <jas@extundo.com>
parents:
45518
diff
changeset
|
55 (car fringe-mode) |
f48a8ed9d03a
(set-fringe-mode): Work when updating
Simon Josefsson <jas@extundo.com>
parents:
45518
diff
changeset
|
56 fringe-mode)) |
45493 | 57 (setq default-frame-alist |
58 (cons (cons 'left-fringe (if (consp fringe-mode) | |
59 (car fringe-mode) | |
60 fringe-mode)) | |
61 default-frame-alist)))) | |
62 (let ((parameter (assq 'right-fringe default-frame-alist))) | |
63 (if (consp parameter) | |
45524
f48a8ed9d03a
(set-fringe-mode): Work when updating
Simon Josefsson <jas@extundo.com>
parents:
45518
diff
changeset
|
64 (setcdr parameter (if (consp fringe-mode) |
f48a8ed9d03a
(set-fringe-mode): Work when updating
Simon Josefsson <jas@extundo.com>
parents:
45518
diff
changeset
|
65 (cdr fringe-mode) |
f48a8ed9d03a
(set-fringe-mode): Work when updating
Simon Josefsson <jas@extundo.com>
parents:
45518
diff
changeset
|
66 fringe-mode)) |
45493 | 67 (setq default-frame-alist |
68 (cons (cons 'right-fringe (if (consp fringe-mode) | |
69 (cdr fringe-mode) | |
70 fringe-mode)) | |
71 default-frame-alist)))) | |
72 | |
73 ;; Apply it to existing frames. | |
74 (let ((frames (frame-list))) | |
75 (while frames | |
76 (modify-frame-parameters | |
77 (car frames) | |
78 (list (cons 'left-fringe (if (consp fringe-mode) | |
79 (car fringe-mode) | |
80 fringe-mode)) | |
81 (cons 'right-fringe (if (consp fringe-mode) | |
82 (cdr fringe-mode) | |
83 fringe-mode)))) | |
84 (setq frames (cdr frames))))) | |
85 | |
86 (defcustom fringe-mode nil | |
87 "*Specify appearance of fringes on all frames. | |
88 This variable can be nil (the default) meaning the fringes should have | |
89 the default width (8 pixels), it can be an integer value specifying | |
90 the width of both left and right fringe (where 0 means no fringe), or | |
91 a cons cell where car indicates width of left fringe and cdr indicates | |
92 width of right fringe (where again 0 can be used to indicate no | |
93 fringe). | |
94 To set this variable in a Lisp program, use `set-fringe-mode' to make | |
95 it take real effect. | |
96 Setting the variable with a customization buffer also takes effect. | |
97 If you only want to modify the appearance of the fringe in one frame, | |
98 you can use the interactive function `toggle-fringe'" | |
99 :type '(choice (const :tag "Default width" nil) | |
100 (const :tag "No fringes" 0) | |
101 (const :tag "Only right" (0 . nil)) | |
102 (const :tag "Only left" (nil . 0)) | |
103 (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
|
104 (const :tag "Minimal" (1 . 1)) |
45493 | 105 (integer :tag "Specific width") |
106 (cons :tag "Different left/right sizes" | |
107 (integer :tag "Left width") | |
108 (integer :tag "Right width"))) | |
109 :group 'frames | |
110 :require 'fringe | |
111 :set 'set-fringe-mode-1) | |
112 | |
113 (defun fringe-query-style (&optional all-frames) | |
114 "Query user for fringe style. | |
115 Returns values suitable for left-fringe and right-fringe frame parameters. | |
116 If ALL-FRAMES, the negation of the fringe values in | |
117 `default-frame-alist' is used when user enters the empty string. | |
118 Otherwise the negation of the fringe value in the currently selected | |
119 frame parameter is used." | |
120 (let ((mode (intern (completing-read | |
121 "Select fringe mode for all frames (SPACE for list): " | |
122 '(("none") ("default") ("left-only") | |
45516
6b848a738ec6
(fringe-query-style): New fringe style "minimal".
Simon Josefsson <jas@extundo.com>
parents:
45493
diff
changeset
|
123 ("right-only") ("half") ("minimal")) |
45493 | 124 nil t)))) |
125 (cond ((eq mode 'none) 0) | |
126 ((eq mode 'default) nil) | |
127 ((eq mode 'left-only) '(nil . 0)) | |
128 ((eq mode 'right-only) '(0 . nil)) | |
129 ((eq mode 'half) '(5 . 5)) | |
45516
6b848a738ec6
(fringe-query-style): New fringe style "minimal".
Simon Josefsson <jas@extundo.com>
parents:
45493
diff
changeset
|
130 ((eq mode 'minimal) '(1 . 1)) |
45493 | 131 ((eq mode (intern "")) |
132 (if (eq 0 (cdr (assq 'left-fringe | |
133 (if all-frames | |
134 default-frame-alist | |
135 (frame-parameters (selected-frame)))))) | |
136 nil | |
137 0))))) | |
138 | |
139 ;;;###autoload | |
140 (defun fringe-mode (&optional mode) | |
141 "Toggle appearance of fringes on all frames. | |
142 Valid values for MODE include `none', `default', `left-only', | |
45516
6b848a738ec6
(fringe-query-style): New fringe style "minimal".
Simon Josefsson <jas@extundo.com>
parents:
45493
diff
changeset
|
143 `right-only', `minimal' and `half'. MODE can also be a cons cell |
6b848a738ec6
(fringe-query-style): New fringe style "minimal".
Simon Josefsson <jas@extundo.com>
parents:
45493
diff
changeset
|
144 where the integer in car will be used as left fringe width and the |
6b848a738ec6
(fringe-query-style): New fringe style "minimal".
Simon Josefsson <jas@extundo.com>
parents:
45493
diff
changeset
|
145 integer in cdr will be used as right fringe width. If MODE is not |
6b848a738ec6
(fringe-query-style): New fringe style "minimal".
Simon Josefsson <jas@extundo.com>
parents:
45493
diff
changeset
|
146 specified, the user is queried. |
45493 | 147 It applies to all frames that exist and frames to be created in the |
148 future. | |
149 If you want to set appearance of fringes on the selected frame only, | |
150 see `set-fringe-style'." | |
151 (interactive (list (fringe-query-style 'all-frames))) | |
152 (set-fringe-mode mode)) | |
153 | |
154 ;;;###autoload | |
155 (defun set-fringe-style (&optional mode) | |
156 "Set appearance of fringes on selected frame. | |
157 Valid values for MODE include `none', `default', `left-only', | |
45516
6b848a738ec6
(fringe-query-style): New fringe style "minimal".
Simon Josefsson <jas@extundo.com>
parents:
45493
diff
changeset
|
158 `right-only', `minimal' and `half'. MODE can also be a cons cell |
6b848a738ec6
(fringe-query-style): New fringe style "minimal".
Simon Josefsson <jas@extundo.com>
parents:
45493
diff
changeset
|
159 where the integer in car will be used as left fringe width and the |
6b848a738ec6
(fringe-query-style): New fringe style "minimal".
Simon Josefsson <jas@extundo.com>
parents:
45493
diff
changeset
|
160 integer in cdr will be used as right fringe width. If MODE is not |
6b848a738ec6
(fringe-query-style): New fringe style "minimal".
Simon Josefsson <jas@extundo.com>
parents:
45493
diff
changeset
|
161 specified, the user is queried. |
45493 | 162 If you want to set appearance of fringes on all frames, see `fringe-mode'." |
163 (interactive (list (fringe-query-style))) | |
164 (modify-frame-parameters | |
165 (selected-frame) | |
166 (list (cons 'left-fringe (if (consp mode) (car mode) mode)) | |
167 (cons 'right-fringe (if (consp mode) (cdr mode) mode))))) | |
168 | |
169 (provide 'fringe) | |
170 | |
171 ;;; fringe.el ends here |