1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <!-- Created by htmlize-1.34 in css mode. -->
4 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
6 <title>02-keys.el</title>
7 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
8 <meta name="author" content="Steve Youngs" />
9 <meta name="owner" content="steve@sxemacs.org" />
10 <style type="text/css">
14 background-color: #000000;
17 /* font-lock-comment-face */
21 /* font-lock-doc-string-face */
25 /* font-lock-function-name-face */
30 /* font-lock-keyword-face */
34 /* font-lock-reference-face */
38 /* font-lock-string-face */
42 /* font-lock-variable-name-face */
48 background-color: inherit;
51 text-decoration: underline;
55 background-color: #FD00FD;
56 text-decoration: underline;
59 background-color: #000000;
60 text-decoration: none;
67 <span class="comment">;; 02-keys.el --- Keybindings
69 <span class="comment">;; Copyright (C) 2007 - 2020 Steve Youngs
71 <span class="comment">;; Author: Steve Youngs <<a href="mailto:steve@sxemacs.org">steve@sxemacs.org</a>>
72 ;; Maintainer: Steve Youngs <<a href="mailto:steve@sxemacs.org">steve@sxemacs.org</a>>
73 ;; Created: <2007-12-02>
74 ;; Time-stamp: <Thursday Apr 9, 2020 06:44:18 steve>
75 ;; Download: <<a href="https://downloads.sxemacs.org/SYinits/">https://downloads.sxemacs.org/SYinits/</a>>
76 ;; HTMLised: <<a href="https://www.sxemacs.org/SYinits/02-keys.html">https://www.sxemacs.org/SYinits/02-keys.html</a>>
77 ;; Git Repo: git clone https://git.sxemacs.org/syinit
78 ;; Keywords: init, compile
80 <span class="comment">;; This file is part of SYinit
82 <span class="comment">;; Redistribution and use in source and binary forms, with or without
83 ;; modification, are permitted provided that the following conditions
86 ;; 1. Redistributions of source code must retain the above copyright
87 ;; notice, this list of conditions and the following disclaimer.
89 ;; 2. Redistributions in binary form must reproduce the above copyright
90 ;; notice, this list of conditions and the following disclaimer in the
91 ;; documentation and/or other materials provided with the distribution.
93 ;; 3. Neither the name of the author nor the names of any contributors
94 ;; may be used to endorse or promote products derived from this
95 ;; software without specific prior written permission.
97 ;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
98 ;; IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
99 ;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
100 ;; DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
101 ;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
102 ;; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
103 ;; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
104 ;; BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
105 ;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
106 ;; OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
107 ;; IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
109 <span class="comment">;;; Commentary:
111 ;; Sets up my keybindings
113 ;; BTW, there are a number of different ways to actually set a
114 ;; keybinding in emacs and I honestly could not tell you which way
115 ;; is best. I don't think any one way is really any better than
116 ;; any other. I've used most (all?) of them here in this file.
117 ;; Whichever format you like is the right one to use. </span><span class="comment"><span class="reference">:-</span></span><span class="comment">)
119 <span class="comment">;;; Credits:
121 ;; The HTML version of this file was created with Hrvoje Niksic's
122 ;; htmlize.el which is part of the XEmacs "text-modes" package.
125 <span class="comment">;;; Todo:
129 <span class="comment">;;; Code:
131 <span class="comment">;</span><span class="comment"><span class="reference">:*=======================</span></span><span class="comment">
132 ;</span><span class="comment"><span class="reference">:*</span></span><span class="comment"> Global key bindings
133 </span>(global-set-key "<span class="doc-string">\C-xw</span>" 'what-line)
134 (global-set-key [f2] 'undo)
135 (global-set-key [(super tab)] 'lisp-complete-symbol)
136 (global-set-key [(meta f3)] 'view-file)
137 (global-set-key [f5] "<span class="doc-string">\M-w</span>")
138 (global-set-key [f6] "<span class="doc-string">\C-y</span>")
139 (global-set-key [f7] 'save-buffer)
140 (global-set-key [f8] 'start-kbd-macro)
141 (global-set-key [f9] 'end-kbd-macro)
142 (global-set-key [(control f8)] 'call-last-kbd-macro)
143 (global-set-key [(control f5)] 'sy-extent-kill-save)
144 (global-set-key [XF86Copy] #'copy-primary-selection)
145 (global-set-key [XF86Cut] #'kill-primary-selection)
146 (global-set-key [XF86Paste] #'yank-clipboard-selection)
148 <span class="comment">;</span><span class="comment"><span class="reference">:*=======================</span></span><span class="comment">
149 ;</span><span class="comment"><span class="reference">:*</span></span><span class="comment"> compose-key tô t¥pé fünky £ïttlê chãrs
150 </span>(<span class="keyword">require</span> '<span class="reference">x-compose</span>)
151 (global-set-key "<span class="doc-string">\C-cm</span>" compose-map)
153 <span class="comment">;</span><span class="comment"><span class="reference">:*=======================</span></span><span class="comment">
154 ;</span><span class="comment"><span class="reference">:*</span></span><span class="comment"> cursor into first line with C-pageup
155 </span>(<span class="keyword">define-key</span> <span class="variable-name">global-map</span> '(control prior) 'beginning-of-buffer)
156 (<span class="keyword">define-key</span> <span class="variable-name">global-map</span> '(control next) 'end-of-buffer)
158 <span class="comment">;</span><span class="comment"><span class="reference">:*=======================</span></span><span class="comment">
159 ;</span><span class="comment"><span class="reference">:*</span></span><span class="comment"> Enable menubar accelerators (double-wow!)
160 </span>(setq menu-accelerator-enabled 'menu-fallback)
161 (setq menu-accelerator-modifiers '(super))
162 (setq menu-accelerator-prefix nil)
163 (<span class="keyword">define-key</span> <span class="variable-name">global-map</span> [f10] 'accelerate-menu)
165 <span class="comment">;</span><span class="comment"><span class="reference">:*=======================</span></span><span class="comment">
166 ;</span><span class="comment"><span class="reference">:*</span></span><span class="comment"> Popup window with buffer list ; from XEmacs FAQ (2.61)
167 </span>(<span class="keyword">defun</span> <span class="function-name">cw-build-buffers</span> ()
168 "<span class="doc-string">Popup buffer menu.</span>"
169 (interactive "<span class="string">@</span>")
170 (run-hooks 'activate-menubar-hook)
171 (popup-menu (car (find-menu-item current-menubar '("<span class="string">Buffers</span>")))))
172 (global-set-key '(control !) 'cw-build-buffers)
174 <span class="comment">;</span><span class="comment"><span class="reference">:*=======================</span></span><span class="comment">
175 ;</span><span class="comment"><span class="reference">:*</span></span><span class="comment"> keymapping to resize frames
176 </span>(<span class="keyword">define-key</span> <span class="variable-name">global-map</span> [(control x) (up)] #'shrink-window)
177 (<span class="keyword">define-key</span> <span class="variable-name">global-map</span> [(control x) (down)] #'enlarge-window)
178 (<span class="keyword">define-key</span> <span class="variable-name">global-map</span> [(control x) (left)] #'shrink-window-horizontally)
179 (<span class="keyword">define-key</span> <span class="variable-name">global-map</span> [(control x) (right)] #'enlarge-window-horizontally)
181 <span class="comment">;</span><span class="comment"><span class="reference">:*=======================</span></span><span class="comment">
182 ;</span><span class="comment"><span class="reference">:*</span></span><span class="comment"> bind key to kill-whole-line
183 </span>(global-set-key '(control ,) 'kill-entire-line)
185 <span class="comment">;</span><span class="comment"><span class="reference">:*=======================</span></span><span class="comment">
186 ;</span><span class="comment"><span class="reference">:*</span></span><span class="comment"> Set C-x C-b to use ibuffer
187 </span>(<span class="keyword">define-key</span> <span class="variable-name">global-map</span> [(control x) (control b)] 'ibuffer)
189 <span class="comment">;</span><span class="comment"><span class="reference">:*=======================</span></span><span class="comment">
190 ;</span><span class="comment"><span class="reference">:*</span></span><span class="comment"> OK, so just who the hell is sending those emails
191 </span>(<span class="keyword">define-key</span> <span class="variable-name">global-map</span> [f12] 'from)
193 <span class="comment">;</span><span class="comment"><span class="reference">:*=======================</span></span><span class="comment">
194 ;</span><span class="comment"><span class="reference">:*</span></span><span class="comment"> Bind the Euro to a key
195 </span>(<span class="keyword">define-key</span> <span class="variable-name">global-map</span> "<span class="doc-string">\C-ce</span>"
196 (<span class="keyword">lambda</span> ()
198 (insert (make-char 'latin-iso8859-15 #x24))))
200 <span class="comment">;</span><span class="comment"><span class="reference">:*=======================</span></span><span class="comment">
201 ;</span><span class="comment"><span class="reference">:*</span></span><span class="comment"> Toggle in/out of eshell
202 </span>(global-set-key (kbd "<span class="string">C-c s</span>") 'eshell-toggle)
204 <span class="comment">;</span><span class="comment"><span class="reference">:*=======================</span></span><span class="comment">
205 ;</span><span class="comment"><span class="reference">:*</span></span><span class="comment"> Extra Mouse buttons (wheel etc)
207 ;; A little bragging never hurts... SXEmacs allows you to bind up to
208 ;; 32 mouse buttons. I'm not sure about GNU/Emacs, but XEmacs only
209 ;; lets you bind 10 (or is it 12?). OK, I've never seen a rat that
210 ;; had 32 buttons, but you never know what these gamer kiddies will
211 ;; want one day. </span><span class="comment"><span class="reference">:-</span></span><span class="comment">)
212 </span>(<span class="keyword">require</span> '<span class="reference">mwheel</span>)
213 (<span class="keyword">define-key</span> <span class="variable-name">global-map</span> [(button4)] 'mwheel-scroll)
214 (<span class="keyword">define-key</span> <span class="variable-name">global-map</span> [(button5)] 'mwheel-scroll)
215 (<span class="keyword">define-key</span> <span class="variable-name">global-map</span> [(shift button4)] 'mwheel-scroll)
216 (<span class="keyword">define-key</span> <span class="variable-name">global-map</span> [(shift button5)] 'mwheel-scroll)
217 (<span class="keyword">define-key</span> <span class="variable-name">global-map</span> [(button9)] 'beginning-of-buffer)
218 (<span class="keyword">define-key</span> <span class="variable-name">global-map</span> [(button8)] 'end-of-buffer)
219 (<span class="keyword">define-key</span> <span class="variable-name">global-map</span> [(button10)] 'recenter)
221 <span class="comment">;</span><span class="comment"><span class="reference">:*=======================</span></span><span class="comment">
222 ;</span><span class="comment"><span class="reference">:*</span></span><span class="comment"> Numeric keypad
223 </span>(<span class="keyword">define-key</span> <span class="variable-name">key-translation-map</span> [kp-divide] [?/])
224 (<span class="keyword">define-key</span> <span class="variable-name">key-translation-map</span> [kp-multiply] [?*])
225 (<span class="keyword">define-key</span> <span class="variable-name">key-translation-map</span> [kp-subtract] [?-])
226 (<span class="keyword">define-key</span> <span class="variable-name">key-translation-map</span> [kp-add] [?+])
227 (<span class="keyword">define-key</span> <span class="variable-name">key-translation-map</span> [kp-enter] [?\r])
228 (<span class="keyword">define-key</span> <span class="variable-name">key-translation-map</span> [kp-decimal] [?.])
229 (<span class="keyword">define-key</span> <span class="variable-name">key-translation-map</span> [kp-begin] [begin])
230 (<span class="keyword">define-key</span> <span class="variable-name">key-translation-map</span> [kp-home] [home])
231 (<span class="keyword">define-key</span> <span class="variable-name">key-translation-map</span> [kp-end] [end])
232 (<span class="keyword">define-key</span> <span class="variable-name">key-translation-map</span> [kp-next] [next])
233 (<span class="keyword">define-key</span> <span class="variable-name">key-translation-map</span> [kp-prior] [prior])
234 (<span class="keyword">define-key</span> <span class="variable-name">key-translation-map</span> [kp-left] [left])
235 (<span class="keyword">define-key</span> <span class="variable-name">key-translation-map</span> [kp-right] [right])
236 (<span class="keyword">define-key</span> <span class="variable-name">key-translation-map</span> [kp-up] [up])
237 (<span class="keyword">define-key</span> <span class="variable-name">key-translation-map</span> [kp-down] [down])
238 (<span class="keyword">define-key</span> <span class="variable-name">key-translation-map</span> [kp-insert] [insert])
239 (<span class="keyword">define-key</span> <span class="variable-name">key-translation-map</span> [kp-delete] [delete])
240 (<span class="keyword">define-key</span> <span class="variable-name">key-translation-map</span> [kp-0] [?0])
241 (<span class="keyword">define-key</span> <span class="variable-name">key-translation-map</span> [kp-1] [?1])
242 (<span class="keyword">define-key</span> <span class="variable-name">key-translation-map</span> [kp-2] [?2])
243 (<span class="keyword">define-key</span> <span class="variable-name">key-translation-map</span> [kp-3] [?3])
244 (<span class="keyword">define-key</span> <span class="variable-name">key-translation-map</span> [kp-4] [?4])
245 (<span class="keyword">define-key</span> <span class="variable-name">key-translation-map</span> [kp-5] [?5])
246 (<span class="keyword">define-key</span> <span class="variable-name">key-translation-map</span> [kp-6] [?6])
247 (<span class="keyword">define-key</span> <span class="variable-name">key-translation-map</span> [kp-7] [?7])
248 (<span class="keyword">define-key</span> <span class="variable-name">key-translation-map</span> [kp-8] [?8])
249 (<span class="keyword">define-key</span> <span class="variable-name">key-translation-map</span> [kp-9] [?9])
250 <span class="comment">;</span><span class="comment"><span class="reference">:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::</span></span><span class="comment">
251 </span>(message "<span class="doc-string">Key maps set successfully</span>")
253 <!-- SXEmacs Logo -->
255 <a href="https://www.sxemacs.org/" target="_parent">
256 <img style="padding:0px 5px 0px 0px;border:0;width:88px;height:31px"
257 src="/Images/cbsx.png"
258 title="This page was created entirely in SXEmacs"
259 alt="Created with SXEmacs" />
261 <!-- End SXEmacs Logo -->
262 <!-- Valid XHTML 1.0 -->
263 <a href="http://validator.w3.org/check?uri=https%3a%2f%2fwww.sxemacs.org%2fSYinits%2f02-keys.html" target="_blank">
264 <img style="padding:0px 5px 0px 10px;border:0;width:88px;height:31px"
265 src="/Images/valid-xhtml10.png"
266 title="Valid XHTML 1.0 Transitional!"
267 alt="Valid XHTML 1.0 Transitional!" />
270 <!-- End Valid XHTML 1.0 -->
272 <h6>Copyright © 2020 Steve Youngs<br />
273 Verbatim copying and distribution is permitted in any medium,
274 providing this notice is preserved.<br />
276 Last modified: Wed Apr 15 18:11:41 AEST 2020