Add HTML versions of my init files
[website] / SYinits / 02-keys.html
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">
5   <head>
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">
11     <!--
12       body {
13         color: #ffffff;
14         background-color: #000000;
15       }
16       .comment {
17         /* font-lock-comment-face */
18         color: #87ceeb;
19       }
20       .doc-string {
21         /* font-lock-doc-string-face */
22         color: #32cd32;
23       }
24       .function-name {
25         /* font-lock-function-name-face */
26         color: #ffff00;
27         font-weight: bold;
28       }
29       .keyword {
30         /* font-lock-keyword-face */
31         color: #fa8072;
32       }
33       .reference {
34         /* font-lock-reference-face */
35         color: #40e0d0;
36       }
37       .string {
38         /* font-lock-string-face */
39         color: #00cd00;
40       }
41       .variable-name {
42         /* font-lock-variable-name-face */
43         color: #ffdab9;
44       }
45
46       a {
47         color: #FF0000;
48         background-color: inherit;
49         font: inherit;
50         font-weight: bold;
51         text-decoration: underline;
52       }
53       a:hover {
54         color: #FFFFFF;
55         background-color: #FD00FD;
56         text-decoration: underline;
57       }
58       .img a:hover {
59         background-color: #000000;
60         text-decoration: none;
61       }
62     -->
63     </style>
64   </head>
65   <body>
66     <pre>
67 <span class="comment">;; 02-keys.el --- Keybindings
68 </span>
69 <span class="comment">;; Copyright (C) 2007 - 2020 Steve Youngs
70 </span>
71 <span class="comment">;;     Author: Steve Youngs &lt;<a href="mailto:steve&#64;sxemacs.org">steve&#64;sxemacs.org</a>&gt;
72 ;; Maintainer: Steve Youngs &lt;<a href="mailto:steve&#64;sxemacs.org">steve&#64;sxemacs.org</a>&gt;
73 ;;    Created: &lt;2007-12-02&gt;
74 ;; Time-stamp: &lt;Thursday Apr  9, 2020 06:44:18 steve&gt;
75 ;;   Download: &lt;<a href="https://downloads.sxemacs.org/SYinits/">https://downloads.sxemacs.org/SYinits/</a>&gt;
76 ;;   HTMLised: &lt;<a href="https://www.sxemacs.org/SYinits/02-keys.html">https://www.sxemacs.org/SYinits/02-keys.html</a>&gt;
77 ;;   Git Repo: git clone https://git.sxemacs.org/syinit
78 ;;   Keywords: init, compile
79 </span>
80 <span class="comment">;; This file is part of SYinit
81 </span>
82 <span class="comment">;; Redistribution and use in source and binary forms, with or without
83 ;; modification, are permitted provided that the following conditions
84 ;; are met:
85 ;;
86 ;; 1. Redistributions of source code must retain the above copyright
87 ;;    notice, this list of conditions and the following disclaimer.
88 ;;
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.
92 ;;
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.
96 ;;
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.
108 </span>
109 <span class="comment">;;; Commentary:
110 ;;
111 ;;   Sets up my keybindings
112 ;;
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">)
118 </span>
119 <span class="comment">;;; Credits:
120 ;;
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.
123 ;;
124 </span>
125 <span class="comment">;;; Todo:
126 ;;
127 ;;     
128 </span>
129 <span class="comment">;;; Code:
130 </span>
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)
147
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&#244; t&#165;p&#233; f&#252;nky &#163;&#239;ttl&#234; ch&#227;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)
152
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)
157
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)
164
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)
173
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)
180
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)
184
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)
188
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)
192
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> () 
197     (interactive) 
198     (insert (make-char 'latin-iso8859-15 #x24))))
199
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)
203
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)
206 ;;
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)
220
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>")
252 </pre>
253   <!--  SXEmacs Logo -->
254     <div class="img">
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" />
260       </a>
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!" />
268       </a>
269     </div>
270 <!--  End Valid XHTML 1.0 -->
271
272     <h6>Copyright &#169; 2020 Steve Youngs<br />
273      Verbatim copying and distribution is permitted in any medium,
274     providing this notice is preserved.<br />
275 <!-- hhmts start -->
276 Last modified: Wed Apr 15 18:11:41 AEST 2020
277 <!-- hhmts end -->
278    </h6>
279
280 </body>
281 </html>