Add HTML versions of my init files
[website] / SYinits / 10-pkgs.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>10-pkgs.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       .type {
42         /* font-lock-type-face */
43         color: #1e90ff;
44       }
45       .variable-name {
46         /* font-lock-variable-name-face */
47         color: #ffdab9;
48       }
49       .warning {
50         /* font-lock-warning-face */
51         color: #ff0000;
52         font-weight: bold;
53       }
54
55       a {
56         color: #FF0000;
57         background-color: inherit;
58         font: inherit;
59         font-weight: bold;
60         text-decoration: underline;
61       }
62       a:hover {
63         color: #FFFFFF;
64         background-color: #FD00FD;
65         text-decoration: underline;
66       }
67       .img a:hover {
68         background-color: #000000;
69         text-decoration: none;
70       }
71     -->
72     </style>
73   </head>
74   <body>
75     <pre>
76 <span class="comment">;; 10-pkgs.el --- Various XE Package Settings
77 </span>
78 <span class="comment">;; Copyright (C) 2007 - 2020 Steve Youngs
79 </span>
80 <span class="comment">;;     Author: Steve Youngs &lt;<a href="mailto:steve&#64;sxemacs.org">steve&#64;sxemacs.org</a>&gt;
81 ;; Maintainer: Steve Youngs &lt;<a href="mailto:steve&#64;sxemacs.org">steve&#64;sxemacs.org</a>&gt;
82 ;;    Created: &lt;2007-12-02&gt;
83 ;; Time-stamp: &lt;Thursday Apr  9, 2020 07:58:14 steve&gt;
84 ;;   Download: &lt;<a href="https://downloads.sxemacs.org/SYinits">https://downloads.sxemacs.org/SYinits</a>&gt;
85 ;;   HTMLised: &lt;<a href="https://www.sxemacs.org/SYinits/10-pkgs.html">https://www.sxemacs.org/SYinits/10-pkgs.html</a>&gt;
86 ;;   Git Repo: git clone https://git.sxemacs.org/syinit
87 ;;   Keywords: init, compile
88 </span>
89 <span class="comment">;; This file is part of SYinit
90 </span>
91 <span class="comment">;; Redistribution and use in source and binary forms, with or without
92 ;; modification, are permitted provided that the following conditions
93 ;; are met:
94 ;;
95 ;; 1. Redistributions of source code must retain the above copyright
96 ;;    notice, this list of conditions and the following disclaimer.
97 ;;
98 ;; 2. Redistributions in binary form must reproduce the above copyright
99 ;;    notice, this list of conditions and the following disclaimer in the
100 ;;    documentation and/or other materials provided with the distribution.
101 ;;
102 ;; 3. Neither the name of the author nor the names of any contributors
103 ;;    may be used to endorse or promote products derived from this
104 ;;    software without specific prior written permission.
105 ;;
106 ;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
107 ;; IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
108 ;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
109 ;; DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
110 ;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
111 ;; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
112 ;; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
113 ;; BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
114 ;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
115 ;; OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
116 ;; IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
117 </span>
118 <span class="comment">;;; Commentary:
119 ;;
120 ;;   Lots of settings for various XEmacs packages that I use.  Plus a
121 ;;   few other packages.
122 ;;
123 ;;   I want to point out that I DO NOT blindly install the "sumo"
124 ;;   packages.  I only install what I need and use.  And I absolutely
125 ;;   DO NOT have the "fsf-compat" package installed, although I do
126 ;;   have overlay.el from there.  It just makes my life a tad easier.
127 </span>
128 <span class="comment">;;; Credits:
129 ;;
130 ;;   The HTML version of this file was created with Hrvoje Niksic's
131 ;;   htmlize.el which is part of the XEmacs "text-modes" package.
132 ;;
133 </span>
134 <span class="comment">;;; Todo:
135 ;;
136 ;;
137 </span>
138 <span class="comment">;;; Code:
139 ;</span><span class="comment"><span class="reference">:*======================</span></span><span class="comment">
140 ;</span><span class="comment"><span class="reference">:*</span></span><span class="comment"> MusicPD  (Not an XEmacs package)
141 </span>(<span class="keyword">require</span> '<span class="reference">mpd</span>)
142
143 (<span class="keyword">defun</span> <span class="function-name">sy-mpd-play</span> ()
144   "<span class="doc-string">Start playing music from a randomly chosen playlist.</span>"
145   (interactive)
146   (mpd-send "<span class="string">clear</span>")
147   (mpd-send "<span class="string">load Full-sorted.playlist</span>")
148   (mpd-send "<span class="string">random 1</span>")
149   (mpd-send "<span class="string">repeat 1</span>")
150   (mpd-playpause))
151
152 (<span class="keyword">defun</span> <span class="function-name">2001-mpd-play</span> ()
153   "<span class="doc-string">Start playing 2001 audio book.</span>"
154   (interactive)
155   (mpd-send "<span class="string">clear</span>")
156   (mpd-send "<span class="string">load 2001_A_Space_Odyssey.playlist</span>")
157   (mpd-send "<span class="string">random 0</span>")
158   (mpd-send "<span class="string">repeat 0</span>")
159   (mpd-playpause))
160
161 <span class="comment">;; Audio keybindings
162 </span>(global-set-key [XF86AudioPlay] #'mpd-playpause)
163 (global-set-key [XF86AudioStop] #'mpd-stop)
164 (global-set-key [XF86AudioNext] #'mpd-next-track)
165 (global-set-key [XF86AudioPrev] #'mpd-previous-track)
166 (global-set-key [XF86AudioRaiseVolume] #'mpd-volume-up)
167 (global-set-key [XF86AudioLowerVolume] #'mpd-volume-down)
168 (global-set-key [XF86AudioMute] #'mpd-volume-mute/unmute)
169
170 <span class="comment">;; Mpd frame props
171 </span>(<span class="keyword">unless</span> (or (string= (getenv "<span class="string">KDE_FULL_SESSION</span>") "<span class="string">true</span>")
172             (string= (getenv "<span class="string">SAWFISH_IS_RUNNING</span>") "<span class="string">true</span>"))
173   (push (cons 'override-redirect t) mpd-dock-frame-plist))
174 (push (cons 'left 1780) mpd-dock-frame-plist)
175 (push (cons 'top 5) mpd-dock-frame-plist)
176 (push (cons 'internal-border-width 4) mpd-dock-frame-plist)
177 (push (cons 'border-width 1) mpd-dock-frame-plist)
178 (push (cons 'border-color "<span class="string">red</span>") mpd-dock-frame-plist)
179
180 <span class="comment">;</span><span class="comment"><span class="reference">:*======================</span></span><span class="comment">
181 ;</span><span class="comment"><span class="reference">:*</span></span><span class="comment"> View-process (`</span><span class="comment"><span class="reference">top</span></span><span class="comment">' for emacs)
182 </span>(<span class="keyword">require</span> '<span class="reference">view-process-mode</span>)
183 (setq View-process-host-names-and-system-types
184       '(("<span class="string">bastard.steveyoungs.com</span>"
185          ("<span class="string">linux</span>" nil "<span class="string">bsd</span>"
186           View-process-field-name-descriptions-linux
187           View-process-kill-signals-linux))))
188 (setq View-process-status-command-switches-system-v "<span class="doc-string">auxw</span>")
189 (setq View-process-ps-header-window-offset 3)
190 (add-hook 'View-process-header-mode-hook
191           (<span class="keyword">lambda</span> ()
192             (set-specifier horizontal-scrollbar-visible-p nil (current-buffer))
193             (set-specifier vertical-scrollbar-visible-p nil (current-buffer))))
194
195 <span class="comment">;</span><span class="comment"><span class="reference">:*=====================</span></span><span class="comment">
196 ;</span><span class="comment"><span class="reference">:*</span></span><span class="comment"> whitespace-mode
197 </span>(<span class="keyword">autoload</span> 'whitespace-mode "<span class="doc-string">whitespace-mode</span>" nil t)
198 (<span class="keyword">autoload</span> 'whitespace-incremental-mode "<span class="doc-string">whitespace-mode</span>" nil t)
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"> func-menu
202 </span>(<span class="keyword">require</span> '<span class="reference">func-menu</span>)
203 (add-hook 'find-file-hooks 'fume-setup-buffer)
204 (add-hook 'Manual-mode-hook 'turn-on-fume-mode)
205 (<span class="keyword">define-key</span> <span class="variable-name">fume-mode-map</span> [(control button3)] #'mouse-function-menu)
206 (setq
207  fume-display-in-modeline-p t
208  fume-menu-path '("<span class="string">View</span>"))
209
210 <span class="comment">;</span><span class="comment"><span class="reference">:*======================</span></span><span class="comment">
211 ;</span><span class="comment"><span class="reference">:*</span></span><span class="comment"> recent-files.el --- Maintain menu of recently opened files.
212 </span>(<span class="keyword">when</span> (<span class="keyword">featurep</span> '<span class="reference">menubar</span>)
213   (<span class="keyword">require</span> '<span class="reference">recent-files</span>)
214   (setq recent-files-non-permanent-submenu t
215         recent-files-menu-path '("<span class="string">File</span>")
216         recent-files-add-menu-before "<span class="string">Insert File...</span>"
217         recent-files-save-file
218         (expand-file-name "<span class="string">.recent-files.el</span>" user-init-directory)
219         recent-files-dont-include
220         '(#r"<span class="string">\.config/sxemacs/\(howm\|diary\).*$</span>"
221           #r"<span class="string">sxemacs/timelog$</span>"
222           #r"<span class="string">info/dir$</span>"
223           #r"<span class="string">\.\(newsrc*\|bbdb\)$</span>"
224           #r"<span class="string">init\.d\.el</span>"))
225   (recent-files-initialize))
226
227 <span class="comment">;</span><span class="comment"><span class="reference">:*======================</span></span><span class="comment">
228 ;</span><span class="comment"><span class="reference">:*</span></span><span class="comment"> jka-compr
229 ;; Handle automatic (de)compresion of [bg]zip files
230 </span>(<span class="keyword">require</span> '<span class="reference">jka-compr</span>)
231 (jka-compr-install)
232
233 <span class="comment">;</span><span class="comment"><span class="reference">:*======================</span></span><span class="comment">
234 ;</span><span class="comment"><span class="reference">:*</span></span><span class="comment"> iswitchb
235 ;: A really cool package to switch buffers
236 </span>(<span class="keyword">require</span> '<span class="reference">iswitchb</span>)
237 (setq iswitchb-default-method 'samewindow)
238 (iswitchb-default-keybindings)
239 (add-hook
240  'iswitchb-define-mode-map-hook
241  '(<span class="keyword">lambda</span> ()
242     (define-key iswitchb-mode-map "<span class="string"> </span>" 'iswitchb-next-match)
243     (define-key iswitchb-mode-map [(control ?\ )] 'iswitchb-prev-match)
244     (define-key iswitchb-mode-map "<span class="string">\C-a</span>" 'iswitchb-toggle-ignore)))
245
246 <span class="comment">;</span><span class="comment"><span class="reference">:*======================</span></span><span class="comment">
247 ;</span><span class="comment"><span class="reference">:*</span></span><span class="comment"> backup
248 ;:  move all backups in one directory
249 </span>(<span class="keyword">require</span> '<span class="reference">backup-dir</span>)
250 (setq bkup-backup-directory-info
251       '((t "<span class="string">~/.autosave/</span>" ok-create full-path)))
252 (setq version-control 'preserve-prefer-numbered)
253 (setq-default delete-old-versions t)
254
255 <span class="comment">;</span><span class="comment"><span class="reference">:*======================</span></span><span class="comment">
256 ;</span><span class="comment"><span class="reference">:*</span></span><span class="comment"> Load minibuffer history, but only if mule or file-coding is available
257 </span>(<span class="keyword">when</span> (<span class="keyword">featurep</span> '(or mule file-coding))
258   (<span class="keyword">require</span> '<span class="reference">savehist</span>)
259   (setq savehist-file (expand-file-name "<span class="string">history</span>" user-init-directory))
260   (setq savehist-coding-system
261         (coding-system-name (find-coding-system 'utf-8)))
262   (savehist-mode 1))
263
264 <span class="comment">;</span><span class="comment"><span class="reference">:*======================</span></span><span class="comment">
265 ;</span><span class="comment"><span class="reference">:*</span></span><span class="comment"> Kyle Jones' redo package.
266 </span>(<span class="keyword">when</span> running-xemacs
267   (<span class="keyword">require</span> '<span class="reference">redo</span>)
268   (global-set-key [(control f2)] 'redo))
269
270 (<span class="keyword">require</span> '<span class="reference">scroll-in-place</span>)
271
272 <span class="comment">;</span><span class="comment"><span class="reference">:*======================</span></span><span class="comment">
273 ;</span><span class="comment"><span class="reference">:*</span></span><span class="comment"> pending-del
274 ;:  Non-nil when Pending Delete mode is enabled. In Pending Delete mode, typed
275 ;:  text replaces the selected region. Normally, you shouldn't modify this
276 ;:  variable by hand, but use the function `</span><span class="comment"><span class="reference">pending-delete-mode</span></span><span class="comment">' instead. However,
277 ;:  you can customize the default value from the options menu (auto delete
278 ;:  selection).
279 </span>(<span class="keyword">require</span> '<span class="reference">pending-del</span>)
280 (turn-on-pending-delete nil)
281
282 <span class="comment">;</span><span class="comment"><span class="reference">:*======================</span></span><span class="comment">
283 ;</span><span class="comment"><span class="reference">:*</span></span><span class="comment"> comment-region
284 ;:  Comment or uncomment each line in the region.
285 ;:  Comments are terminated on each line, even for syntax in which newline does
286 ;:  not end the comment.  Blank lines do not get comments.
287 </span>(<span class="keyword">require</span> '<span class="reference">newcomment</span>)
288 (global-set-key '(control f12)  'comment-or-uncomment-region)
289 (global-set-key '(meta f12) 'comment-or-uncomment-region)
290
291 <span class="comment">;;; </span><span class="comment"><span class="warning">FIXME:</span></span><span class="comment"> SXEInits
292 ;</span><span class="comment"><span class="reference">:*======================</span></span><span class="comment">
293 ;</span><span class="comment"><span class="reference">:*</span></span><span class="comment"> parens that mark sexpressions
294 </span>(<span class="keyword">require</span> '<span class="reference">paren</span>)
295 (paren-set-mode 'paren)
296
297 <span class="comment">;</span><span class="comment"><span class="reference">:*======================</span></span><span class="comment">
298 ;</span><span class="comment"><span class="reference">:*</span></span><span class="comment"> easy editing of crontab files
299 </span>(<span class="keyword">require</span> '<span class="reference">crontab-edit</span> "<span class="doc-string">crontab.elc</span>")
300 (setq crontab-delete-blank-lines nil)
301 (setq crontab-filename (expand-file-name "<span class="string">.crontab</span>" (user-home-directory)))
302 (setq crontab-directory
303       (paths-construct-path '("<span class="string">spool</span>" "<span class="string">cron</span>" "<span class="string">crontabs</span>") "<span class="string">/var</span>"))
304
305 <span class="comment">;</span><span class="comment"><span class="reference">:*======================</span></span><span class="comment">
306 ;</span><span class="comment"><span class="reference">:*</span></span><span class="comment"> a major mode for editing X resource database files
307 </span>(<span class="keyword">autoload</span> 'xrdb-mode "<span class="doc-string">xrdb-mode</span>" "<span class="doc-string">Mode for editing X resource files</span>" t)
308
309 <span class="comment">;</span><span class="comment"><span class="reference">:*======================</span></span><span class="comment">
310 ;</span><span class="comment"><span class="reference">:*</span></span><span class="comment"> Footnote package
311 </span>(<span class="keyword">require</span> '<span class="reference">footnote</span>)
312
313 <span class="comment">;</span><span class="comment"><span class="reference">:*======================</span></span><span class="comment">
314 ;</span><span class="comment"><span class="reference">:*</span></span><span class="comment"> Filladapt-Mode
315 </span>(<span class="keyword">require</span> '<span class="reference">filladapt</span>)
316 (setq-default filladapt-mode t)
317 (setq filladapt-fill-column-tolerance 5)
318 (add-hook 'c-mode-hook 'turn-off-filladapt-mode)
319
320 <span class="comment">;</span><span class="comment"><span class="reference">:*======================</span></span><span class="comment">
321 ;</span><span class="comment"><span class="reference">:*</span></span><span class="comment"> Speedbar
322 ;;; </span><span class="comment"><span class="warning">FIXME:</span></span><span class="comment">  Speedbar Tooltips
323 ;;; snap:///${XPKGS}/speedbar/speedbar.el
324 </span>(setq
325  speedbar-query-confirmation-method 'none-but-delete
326  speedbar-show-unknown-files t
327  speedbar-tag-hierarchy-method '(speedbar-prefix-group-tag-hierarchy
328                                  speedbar-trim-words-tag-hierarchy
329                                  speedbar-simple-group-tag-hierarchy
330                                  speedbar-sort-tag-hierarchy)
331  <span class="comment">;; speedbar-track-mouse-flag t
332 </span> <span class="comment">;; speedbar-use-tool-tips-flag t
333 </span> speedbar-visiting-tag-hook 'speedbar-recenter-to-top)
334
335 (<span class="keyword">when</span> (<span class="keyword">featurep</span> '<span class="reference">menubar</span>)
336   (add-menu-button '("<span class="string">Tools</span>")
337                    ["<span class="string">Speedbar</span>" speedbar-frame-mode
338                     <span class="reference">:style</span> toggle
339                     <span class="reference">:selected</span> (and (boundp 'speedbar-frame)
340                                    (frame-live-p speedbar-frame)
341                                    (frame-visible-p speedbar-frame))]
342                    "<span class="string">--</span>"))
343 (global-set-key [(f4)] 'speedbar-get-focus)
344 (<span class="keyword">require</span> '<span class="reference">sb-image</span>)
345 (<span class="keyword">require</span> '<span class="reference">sb-info</span>)
346 (<span class="keyword">require</span> '<span class="reference">sb-texinfo</span>)
347 (<span class="keyword">eval-after-load</span> "<span class="doc-string">speedbar</span>" '(load-library "<span class="string">sb-texinfo</span>"))
348 (<span class="keyword">eval-after-load</span> "<span class="doc-string">speedbar</span>" '(load-library "<span class="string">sb-html</span>"))
349 (<span class="keyword">autoload</span> 'w3-speedbar-buttons "<span class="doc-string">sb-w3</span>"
350   "<span class="doc-string">W3 specific speedbar button generator.</span>")
351
352 <span class="comment">;;; Speedbar frame props
353 ;;  'name' (so I can use matched windows in Sawfish)
354 </span>(setq speedbar-frame-plist
355       (plist-put speedbar-frame-plist 'name "<span class="string">Speedbar::Frame</span>"))
356 <span class="comment">;; No scrollbars
357 </span>(setq speedbar-frame-plist
358       (plist-put speedbar-frame-plist 'scrollbar-height 0))
359 (setq speedbar-frame-plist
360       (plist-put speedbar-frame-plist 'scrollbar-width 0))
361 <span class="comment">;; A little wider than default
362 </span>(setq speedbar-frame-plist
363       (plist-put speedbar-frame-plist 'width 25))
364
365 <span class="comment">;; </span><span class="comment"><span class="warning">FIXME:</span></span><span class="comment"> see... PKGFix
366 ;; Try to load the speedbar on the right of the current frame
367 </span>(<span class="keyword">defalias</span> '<span class="function-name">dframe-reposition-frame-xemacs</span> 'dframe-reposition-frame-emacs)
368 (setq speedbar-default-position 'right)
369
370 <span class="comment">;; Speedbar only does the repositioning thing if the frame has to be
371 ;; created.  If you have only closed the speedbar frame with 'q'
372 ;; instead of deleting it with 'Q' then the frame remains live.  As
373 ;; there is no perceptible speed difference of coming back from
374 ;; either a closed or deleted speedbar frame the following will
375 ;; force a delete-frame even if you are only closing it.
376 </span>(<span class="keyword">defun</span> <span class="function-name">sy-speedbar-kill</span> ()
377   (<span class="keyword">when</span> (frame-live-p speedbar-frame)
378     (delete-frame speedbar-frame)))
379
380 (add-hook 'speedbar-before-delete-hook #'sy-speedbar-kill)
381
382
383 <span class="comment">;</span><span class="comment"><span class="reference">:*======================</span></span><span class="comment">
384 ;</span><span class="comment"><span class="reference">:*</span></span><span class="comment"> Shell-mode
385 ;; Trying to get compilation buffers to recognise ANSI colour
386 ;; sequences because GCC.  Doesn't seem to work.  Probably have to
387 ;; stick to `GCC_COLORS= make'
388 </span>(<span class="keyword">defun</span> <span class="function-name">sy/comint-hooks</span> ()
389   (ansi-color-for-comint-mode-on)
390   (fast-lock-mode 1)
391   (font-lock-mode 1))
392 (<span class="keyword">autoload</span> 'ansi-color-for-comint-mode-on "<span class="doc-string">ansi-color</span>" nil t)
393 (add-hook 'comint-mode-hook #'sy/comint-hooks)
394 (add-hook 'compilation-mode-hook #'sy/comint-hooks)
395 (add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on)
396 (add-hook 'shell-mode-hook 'turn-on-font-lock)
397
398 <span class="comment">;</span><span class="comment"><span class="reference">:*=======================</span></span><span class="comment">
399 ;</span><span class="comment"><span class="reference">:*</span></span><span class="comment"> Shell-script
400 </span>(setq sh-basic-offset 4)
401
402 <span class="comment">;</span><span class="comment"><span class="reference">:*======================</span></span><span class="comment">
403 ;</span><span class="comment"><span class="reference">:*</span></span><span class="comment"> Compile-Mode
404 </span>(setq
405  compilation-always-signal-completion t
406  mode-compile-make-program "<span class="doc-string">GCC_COLORS= make</span>"
407  compilation-read-command t
408  compilation-window-height 10
409  compile-command "<span class="doc-string">GCC_COLORS= make</span>")
410
411 <span class="comment">;</span><span class="comment"><span class="reference">:*======================</span></span><span class="comment">
412 ;</span><span class="comment"><span class="reference">:*</span></span><span class="comment"> Version Control
413 </span>(vc-load-vc-hooks)
414 <span class="comment">;; #'vc-load-vc-hooks brings in vc-xemacs which adds this hook. I
415 ;; would never need it.
416 </span>(remove-hook 'find-file-hooks 'vc-xemacs-hg-find-file-hook)
417 (setq
418  <span class="comment">;; I pretty much only use git now so there's no point in VC trying to
419 </span> <span class="comment">;; handle any other type.
420 </span> vc-handled-backends '(GIT)
421  vc-follow-symlinks t)
422
423 <span class="comment">;</span><span class="comment"><span class="reference">:*======================</span></span><span class="comment">
424 ;</span><span class="comment"><span class="reference">:*</span></span><span class="comment"> Ediff &amp; Diff-mode
425 </span>(<span class="keyword">require</span> '<span class="reference">ediff</span>)
426 (<span class="keyword">require</span> '<span class="reference">diff-mode</span>)
427 (setq ediff-use-toolbar-p t
428       ediff-custom-diff-options "<span class="doc-string">-u</span>"
429       ediff-window-setup-function 'ediff-setup-windows-plain)
430 (setq diff-switches "<span class="doc-string">-u</span>")
431
432 <span class="comment">;</span><span class="comment"><span class="reference">:*=====================</span></span><span class="comment">
433 ;</span><span class="comment"><span class="reference">:*</span></span><span class="comment"> Tramp
434 </span>(<span class="keyword">require</span> '<span class="reference">tramp</span>)
435 (setq tramp-default-method "<span class="doc-string">ssh</span>"
436       tramp-auto-save-directory "<span class="doc-string">~/.autosave/</span>"
437       tramp-remote-path
438       '("<span class="string">/usr/lib/pkgusr</span>"
439         "<span class="string">/usr/bin</span>"
440         "<span class="string">/bin</span>"
441         "<span class="string">/usr/X11R6/bin</span>"))
442
443 <span class="comment">; </span><span class="comment"><span class="reference">:*======================</span></span><span class="comment">
444 ; </span><span class="comment"><span class="reference">:*</span></span><span class="comment"> Eshell
445 </span>(setq
446  eshell-directory-name
447  (file-name-as-directory
448   (expand-file-name "<span class="string">eshell</span>" user-init-directory))
449  eshell-ask-to-save-history 'always
450  eshell-save-history-on-exit t
451  eshell-banner-message (concat "<span class="string">Welcome to Eshell on </span>"
452                                (system-name)
453                                "<span class="string">, running </span>"
454                                (shell-command-to-string "<span class="string">uname -rs</span>")
455                                "<span class="string">In: </span>"
456                                emacs-version
457                                "<span class="string">\n\n</span>")
458  eshell-hist-ignoredups t
459  eshell-modules-list '(eshell-alias
460                        eshell-banner
461                        eshell-basic
462                        eshell-cmpl
463                        eshell-dirs
464                        eshell-glob
465                        eshell-hist
466                        eshell-ls
467                        eshell-pred
468                        eshell-prompt
469                        <span class="comment">;eshell-rebind
470 </span>                       eshell-script
471                        <span class="comment">;eshell-smart
472 </span>                       eshell-term
473                        eshell-unix
474                        eshell-xtra))
475
476 (<span class="keyword">defun</span> <span class="function-name">sy-eshell-bol-maybe</span> (<span class="type">&amp;optional</span> prompt)
477   "<span class="doc-string">*Move point to beginning of command or bol if there already.
478  If at bol, move point to beginning of command.
479  Optional arg, PROMPT is a regexp of your eshell prompt.</span>"
480   (interactive)
481   (<span class="keyword">let*</span> ((prompt (or prompt "<span class="string">^.+ [$%] </span>"))
482          (lbpos (point-at-bol))
483          (prspos (<span class="keyword">save-excursion</span>
484                    (goto-char lbpos)
485                    (search-forward-regexp prompt (point-at-eol) t)))
486          (cpos (point)))
487     (goto-char
488      (<span class="keyword">cond</span> ((null prspos)
489             lbpos)
490            ((= cpos (or prspos 0))
491             lbpos)
492            (prspos)
493            (t lbpos)))))
494
495 (<span class="keyword">defun</span> <span class="function-name">sy-eshell-bol-maybe-key</span> ()
496   (define-key eshell-mode-map [(control ?a)] 'sy-eshell-bol-maybe))
497
498 (add-hook 'eshell-mode-hook #'sy-eshell-bol-maybe)
499 (add-hook 'eshell-mode-hook #'sy-eshell-bol-maybe-key t)
500 (add-hook 'eshell-output-filter-functions #'eshell-handle-ansi-color)
501
502 (<span class="keyword">defun</span> <span class="function-name">sy-esh-cdl</span> (<span class="type">&amp;optional</span> type)
503   "<span class="doc-string">Eshell function to find current kernel's build or source dir.
504
505  Non-nil TYPE means find the current kernel's build directory, otherwise
506  find the source directory.</span>"
507   (<span class="keyword">let*</span> ((base "<span class="string">/lib/modules/</span>")
508          (ver (substring (shell-command-to-string "<span class="string">uname -r</span>") 0 -1))
509          (dir (file-name-as-directory
510                (concat base ver "<span class="string">/</span>"
511                        (<span class="keyword">if</span> type
512                            "<span class="string">build</span>"
513                          "<span class="string">source</span>")))))
514     (cd dir)))
515
516 (<span class="keyword">defun</span> <span class="function-name">cdls</span> ()
517   "<span class="doc-string">Change directory to current kernel source directory.
518
519  Convenience function to use with Eshell.</span>"
520   (interactive)
521   (sy-esh-cdl))
522
523 (<span class="keyword">defun</span> <span class="function-name">cdlb</span> ()
524   "<span class="doc-string">Change directory to current kernel build directory.
525
526  Convenience function to use with Eshell.</span>"
527   (interactive)
528   (sy-esh-cdl 'build))
529
530 <span class="comment">; </span><span class="comment"><span class="reference">:*======================</span></span><span class="comment">
531 ; </span><span class="comment"><span class="reference">:*</span></span><span class="comment"> FFAP -- Find File At Point
532 </span>(<span class="keyword">require</span> '<span class="reference">ffap</span>)
533
534 <span class="comment">;; Make sure ffap does NOT get in my way...
535 </span>(setq ffap-bindings nil)
536
537 (global-set-key [f3] #'find-file-at-point)
538 (global-set-key [(control x) ?4 f3] #'ffap-other-window)
539 (global-set-key [(control x) ?5 f3] #'ffap-other-frame)
540 (global-set-key [(shift button3)] #'ffap-at-mouse)
541 (global-set-key [(control shift button3)] #'ffap-menu)
542
543 (setq
544  ffap-machine-p-known 'accept
545  ffap-machine-p-unknown 'accept
546  ffap-machine-p-local 'accept)
547
548
549 <span class="comment">;</span><span class="comment"><span class="reference">:*======================</span></span><span class="comment">
550 ;</span><span class="comment"><span class="reference">:*</span></span><span class="comment"> Auto-Insert
551 </span>(<span class="keyword">require</span> '<span class="reference">auto-insert-tkld</span>)
552
553 (setq auto-insert-alist '(("<span class="string">\\.texi\\(nfo\\)?$</span>" . "<span class="string">TeXinfo</span>")
554                           ("<span class="string">\\.c$</span>"              . "<span class="string">C</span>")
555                           ("<span class="string">\\.cc$</span>"             . "<span class="string">C++</span>")
556                           ("<span class="string">\\.h$</span>"              . "<span class="string">C Header</span>")
557                           ("<span class="string">\\.el$</span>"             . "<span class="string">Emacs Lisp</span>")
558                           ("<span class="string">[Mm]akefile</span>"        . "<span class="string">Makefile</span>")
559                           ("<span class="string">\\.sh$</span>"             . "<span class="string">Sh</span>")
560                           ("<span class="string">\\.pl$</span>"             . "<span class="string">Perl</span>")))
561
562 (setq auto-insert-type-alist '(("<span class="string">TeXinfo</span>"    . "<span class="string">texinfo-insert.texi</span>")
563                                ("<span class="string">C</span>"          . "<span class="string">c-insert.c</span>")
564                                ("<span class="string">C Header</span>"   . "<span class="string">h-insert.h</span>")
565                                ("<span class="string">C++</span>"        . "<span class="string">c++-insert.cc</span>")
566                                ("<span class="string">Emacs Lisp</span>" . "<span class="string">elisp-insert.el</span>")
567                                ("<span class="string">Makefile</span>"   . "<span class="string">makefile.inc</span>")
568                                ("<span class="string">Perl</span>"       . "<span class="string">perl-insert.pl</span>")
569                                ("<span class="string">Sh</span>"         . "<span class="string">sh-insert.sh</span>")))
570
571 (add-to-list 'auto-insert-path '"<span class="doc-string">~/documents/Templates/</span>")
572
573 <span class="comment">;; Don't auto-insert into AucTeX style .els
574 </span>(<span class="keyword">defadvice</span> <span class="function-name">TeX-auto-store</span> (around no-auto-insert activate)
575   "<span class="doc-string">Ensure auto-insert is deactivated</span>"
576   (<span class="keyword">let</span> ((auto-insert-automatically nil))
577     ad-do-it))
578 (message "<span class="doc-string">Auto-Insert initialised!</span>")
579
580 <span class="comment">;</span><span class="comment"><span class="reference">:*=======================</span></span><span class="comment">
581 ;</span><span class="comment"><span class="reference">:*</span></span><span class="comment"> My git shit
582 </span>(<span class="keyword">require</span> '<span class="reference">sy-git</span>)
583 (<span class="keyword">require</span> '<span class="reference">git</span>)
584
585 <span class="comment">;</span><span class="comment"><span class="reference">:*======================</span></span><span class="comment">
586 ;</span><span class="comment"><span class="reference">:*</span></span><span class="comment"> Emacs Lisp List
587 </span>(<span class="keyword">defvar</span> <span class="variable-name">sxell-initialised-flag</span>)
588 (<span class="keyword">defvar</span> <span class="variable-name">sxell-download-directory</span>)
589 (<span class="keyword">when</span> (and (<span class="keyword">featurep</span> '(and sxemacs postgresql))
590            (fboundp 'ffi-defun))
591   (<span class="keyword">require</span> '<span class="reference">sxell</span>)
592   (setq sxell-initialised-flag t
593         sxell-download-directory
594         (file-name-as-directory (expand-file-name "<span class="string">download/SXEmacs</span>"
595                                                   (user-home-directory)))))
596 <span class="comment">;</span><span class="comment"><span class="reference">:*======================</span></span><span class="comment">
597 ;</span><span class="comment"><span class="reference">:*</span></span><span class="comment"> EasyPG
598 </span>(<span class="keyword">require</span> '<span class="reference">epa-setup</span>)
599
600 (<span class="keyword">defun</span> <span class="function-name">sy-epa-export-key</span> ()
601   "<span class="doc-string">Wrapper for `</span><span class="doc-string"><span class="reference">epa-export-keys</span></span><span class="doc-string">' to export ASCII armoured keys.</span>"
602   (interactive)
603   (<span class="keyword">let</span> ((epa-armor t))
604     (call-interactively #'epa-export-keys)))
605
606 (<span class="keyword">define-key</span> <span class="variable-name">epa-key-list-mode-map</span> [?O] #'sy-epa-export-key)
607
608 <span class="comment">;</span><span class="comment"><span class="reference">:*=======================</span></span><span class="comment">
609 ;</span><span class="comment"><span class="reference">:*</span></span><span class="comment"> Howm thing. (this needs mule, but that is default so no biggie)
610 </span>(<span class="keyword">require</span> '<span class="reference">howm</span>)
611
612 (setq
613  howm-directory (file-name-as-directory
614                  (expand-file-name "<span class="string">howm</span>" user-init-directory))
615  howm-keyword-file (expand-file-name "<span class="string">howm-keys</span>" user-init-directory)
616  howm-history-file (expand-file-name "<span class="string">howm-history</span>" user-init-directory))
617
618 <span class="comment">;; howm has the unfortunate name that ends in `</span><span class="comment"><span class="reference">wm</span></span><span class="comment">' which is what
619 ;; winmgr-mode uses, so nuke winmgr-mode from auto-mode-alist
620 </span>(remove-alist 'auto-mode-alist "<span class="doc-string">\\.[^/]*wm2?\\(?:rc\\)?\\'</span>")
621
622 <span class="comment">;; The howm people are nuts, they bind C-h to scroll-down
623 ;; Get rid of it and replace with DEL and BACKSPACE
624 </span>(<span class="keyword">define-key</span> <span class="variable-name">howm-menu-mode-map</span> "<span class="doc-string">\C-h</span>" nil)
625 (<span class="keyword">define-key</span> <span class="variable-name">howm-menu-mode-map</span> [delete] #'scroll-down)
626 (<span class="keyword">define-key</span> <span class="variable-name">howm-menu-mode-map</span> [backspace] #'scroll-down)
627 (<span class="keyword">define-key</span> <span class="variable-name">riffle-summary-mode-map</span> "<span class="doc-string">\C-h</span>" nil)
628 (<span class="keyword">define-key</span> <span class="variable-name">riffle-summary-mode-map</span> [delete] #'scroll-other-window-down)
629 (<span class="keyword">define-key</span> <span class="variable-name">riffle-summary-mode-map</span> [backspace] #'scroll-other-window-down)
630 (<span class="keyword">define-key</span> <span class="variable-name">riffle-contents-mode-map</span> "<span class="doc-string">\C-h</span>" nil)
631 (<span class="keyword">define-key</span> <span class="variable-name">riffle-contents-mode-map</span> [delete] #'scroll-down)
632 (<span class="keyword">define-key</span> <span class="variable-name">riffle-contents-mode-map</span> [backspace] #'scroll-down)
633
634 <span class="comment">;; Add a binding to show the active todo list
635 </span>(global-set-key [(control ?c) ?t] #'howm-list-active-todo)
636
637 <span class="comment">;; Another problem with howm... it fucks up window configuration
638 ;; Advice time!
639 </span>(<span class="keyword">defadvice</span> <span class="function-name">howm-keyword-search</span> (before howm-save-kw (<span class="type">&amp;rest</span> args) activate)
640  "<span class="doc-string">Save window configuration before viewing howm buffers.</span>"
641  (window-configuration-to-register ?h))
642
643 (<span class="keyword">defadvice</span> <span class="function-name">howm-list-grep-fixed</span> (before howm-save-win1 (<span class="type">&amp;rest</span> args) activate)
644  "<span class="doc-string">Save window configuration before viewing howm buffers.</span>"
645  (window-configuration-to-register ?h))
646
647 (<span class="keyword">defadvice</span> <span class="function-name">howm-list-grep</span> (before howm-save-win (<span class="type">&amp;rest</span> args) activate)
648  "<span class="doc-string">Save window configuration before viewing howm buffers.</span>"
649  (window-configuration-to-register ?h))
650
651 (<span class="keyword">defadvice</span> <span class="function-name">howm-list-todo</span> (before howm-save-win (<span class="type">&amp;rest</span> args) activate)
652  "<span class="doc-string">Save window configuration before viewing howm buffers.</span>"
653  (window-configuration-to-register ?h))
654
655 (<span class="keyword">defadvice</span> <span class="function-name">howm-list-active-todo</span> (before howm-save-win (<span class="type">&amp;rest</span> args) activate)
656  "<span class="doc-string">Save window configuration before viewing howm buffers.</span>"
657  (window-configuration-to-register ?h))
658
659 (<span class="keyword">defadvice</span> <span class="function-name">riffle-kill-buffer</span> (after howm-restore-win (<span class="type">&amp;rest</span> args) activate)
660   "<span class="doc-string">Restore the original window configuration.</span>"
661   (jump-to-register ?h))
662
663 <span class="comment">;; howm fucks up font-lock'ing like you wouldn't believe, adding a
664 ;; call to `</span><span class="comment"><span class="reference">turn-on-font-lock</span></span><span class="comment">' here at least restores a certain level
665 ;; of normalcy.
666 </span>(<span class="keyword">defun</span> <span class="function-name">turn-on-howm-mode</span> ()
667   (turn-on-font-lock)
668   (howm-mode 1))
669
670 (<span class="keyword">defun</span> <span class="function-name">turn-off-howm-mode</span> ()
671   (howm-mode 0)
672   (font-lock-mode))
673
674 <span class="comment">;; Turn it on where I need it
675 </span>(add-hook 'lisp-interaction-mode-hook #'turn-on-howm-mode)
676 (add-hook 'text-mode-hook #'turn-on-howm-mode)
677 (add-hook 'latex-mode-hook #'turn-on-howm-mode)
678 (add-hook 'c-mode-hook #'turn-on-howm-mode)
679 (add-hook 'sh-mode-hook #'turn-on-howm-mode)
680 <span class="comment">;; You gotta be fooking kidding me, this prevents lisp-initd.el from
681 ;; compiling the generated .el (moved to init.el)
682 ;; (add-hook 'emacs-lisp-mode-hook #'turn-on-howm-mode)
683 </span>
684 <span class="comment">;; Turn it off where I don't
685 ;; I actually would love to have howm in all of these modes, but I
686 ;; cannot get the font-locking working properly with it on
687 </span>(add-hook 'html-mode-hook #'turn-off-howm-mode)
688 (add-hook 'texinfo-mode-hook #'turn-off-howm-mode)
689 (add-hook 'message-mode-hook #'turn-off-howm-mode)
690 (add-hook 'change-log-mode-hook #'turn-off-howm-mode)
691
692 <span class="comment">;</span><span class="comment"><span class="reference">:*=====================</span></span><span class="comment">
693 ;</span><span class="comment"><span class="reference">:*</span></span><span class="comment"> snap!
694 ;; save/load snapshot of application to/from text
695 ;; Usage:
696 </span>
697 <span class="comment">;; (1) M-x snap-record on application, e.g. Wanderlust.
698 ;; (2) Yank (C-y) on any buffer, e.g. *scratch* or ~/memo.txt.
699 ;; (3) M-x snap-play on yanked text ==&gt; snapshot (1) is restored.
700 </span>(<span class="keyword">require</span> '<span class="reference">snap</span>)
701 (global-set-key [(hyper ?s) ?r] #'snap-record)
702
703 <span class="comment">;; env var trickery.
704 </span>(setq snap-abbreviate-environment-variables
705       '("<span class="string">EMCHAT</span>" "<span class="string">JAVA_HOME</span>" "<span class="string">EL</span>" "<span class="string">XPKGS</span>" "<span class="string">MPKGS</span>" "<span class="string">PKGS</span>" "<span class="string">QTDIR</span>"
706         "<span class="string">BLDS</span>" "<span class="string">SXESITE</span>" "<span class="string">SXEWD</span>" "<span class="string">SYdrive</span>" "<span class="string">SYdrop</span>" "<span class="string">HOME</span>"))
707
708 (<span class="keyword">defadvice</span> <span class="function-name">snap-abbreviate-file-name</span> (around env-var (raw-path) activate)
709   ad-do-it
710   (<span class="keyword">let</span> ((path (expand-file-name raw-path))
711         (rules (mapcar #'(<span class="keyword">lambda</span> (var)
712                            (<span class="keyword">let</span> ((val (getenv var)))
713                              (and val
714                                   (cons (concat "<span class="string">^</span>" (regexp-quote val))
715                                         (format "<span class="string">${%s}</span>" var)))))
716                        snap-abbreviate-environment-variables)))
717     (mapc #'(<span class="keyword">lambda</span> (r)
718               (<span class="keyword">when</span> (and r (string-match (car r) path))
719                 (setq ad-return-value
720                       (replace-regexp-in-string (car r) (cdr r) path))))
721           (reverse rules))))
722
723 <span class="comment">;; Bookmark extras
724 </span>(<span class="keyword">eval-after-load</span> "<span class="doc-string">bookmark</span>"
725   (<span class="keyword">progn</span>
726     (ad-enable-advice 'bookmark-buffer-file-name 'around 'with-snap)
727     (ad-enable-advice 'bookmark-jump-noselect 'around 'with-snap)))
728
729 <span class="comment">;; ffap extras
730 </span>(setq ffap-url-regexp snap-ffap-url-regexp)
731 (setq ffap-url-fetcher snap-ffap-url-fetcher)
732
733 <span class="comment">;</span><span class="comment"><span class="reference">:*=======================</span></span><span class="comment">
734 ;</span><span class="comment"><span class="reference">:*</span></span><span class="comment"> ElDoc (handy thingy dingy for lisp programming)
735 ;;  displays function args and var doc strings in echo area
736 ;(setq eldoc-use-idle-timer-p nil)
737 ;(autoload #'turn-on-eldoc-mode "eldoc" nil t)
738 ;(add-hook 'emacs-lisp-mode-hook #'turn-on-eldoc-mode)
739 ;(add-hook 'lisp-interaction-mode-hook #'turn-on-eldoc-mode)
740 </span>
741 <span class="comment">;</span><span class="comment"><span class="reference">:*=======================</span></span><span class="comment">
742 ;</span><span class="comment"><span class="reference">:*</span></span><span class="comment"> Man pages
743 </span>(<span class="keyword">require</span> '<span class="reference">man</span>)
744
745 <span class="comment">;; You can't follow xrefs via keyboard, so...
746 </span>(<span class="keyword">defun</span> <span class="function-name">sy:Manual-follow-xref-kbd</span> ()
747   "<span class="doc-string">Invoke `</span><span class="doc-string"><span class="reference">manual-entry</span></span><span class="doc-string">' on the cross-reference at point.</span>"
748   (interactive)
749   (<span class="keyword">let*</span> ((ext (extent-at (point)))
750          (data (and ext (extent-property ext 'man))))
751     (<span class="keyword">if</span> (eq (car-safe data) 'Manual-follow-xref)
752         (eval data)
753       (error 'search-failed "<span class="string">no manual cross-reference there.</span>"))
754     (or (manual-entry (extent-string ext))
755         <span class="comment">;; Couldn't find it, try other sections.
756 </span>        (and (string-match "<span class="string">[ \t]*([^)]+)\\'</span>" (extent-string ext))
757              (<span class="keyword">progn</span>
758                (message "<span class="string">No entries found for %s; checking other sections...</span>"
759                         (extent-string ext))
760                (manual-entry
761                 (substring (extent-string ext) 0 (match-beginning 0))
762                 nil t))))))
763
764 (<span class="keyword">define-key</span> <span class="variable-name">Manual-mode-map</span> [(control return)] #'sy:Manual-follow-xref-kbd)
765 (<span class="keyword">define-key</span> <span class="variable-name">Manual-mode-map</span> [button1] #'Manual-follow-xref)
766
767 <span class="comment">;</span><span class="comment"><span class="reference">:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*</span></span><span class="comment">
768 </span>(message "<span class="doc-string">packages loaded</span>")
769 </pre>
770   <!--  SXEmacs Logo -->
771     <div class="img">
772       <a href="https://www.sxemacs.org/" target="_parent">
773         <img style="padding:0px 5px 0px 0px;border:0;width:88px;height:31px"
774           src="/Images/cbsx.png"
775           title="This page was created entirely in SXEmacs"
776           alt="Created with SXEmacs" />
777       </a>
778 <!--  End SXEmacs Logo -->
779 <!--  Valid XHTML 1.0 -->
780       <a href="http://validator.w3.org/check?uri=https%3a%2f%2fwww.sxemacs.org%2fSYinits%2f10-pkgs.html" target="_blank">
781        <img style="padding:0px 5px 0px 10px;border:0;width:88px;height:31px"
782           src="/Images/valid-xhtml10.png"
783           title="Valid XHTML 1.0 Transitional!"
784           alt="Valid XHTML 1.0 Transitional!" />
785       </a>
786     </div>
787 <!--  End Valid XHTML 1.0 -->
788
789     <h6>Copyright &#169; 2020 Steve Youngs<br />
790      Verbatim copying and distribution is permitted in any medium,
791     providing this notice is preserved.<br />
792 <!-- hhmts start -->
793 Last modified: Wed Apr 15 18:13:56 AEST 2020
794 <!-- hhmts end -->
795    </h6>
796
797 </body>
798 </html>