waxworlds.org http://www.waxworlds.org/atom.xml 2017-04-30T12:00:03+00:00 Planet/2.0 +http://www.planetplanet.org Service disruption to ash http://www.waxworlds.org/news/2016-12-08 2016-12-08T00:00:01+00:00 <p><code>ash.waxworlds.org</code> will be down for maintenance for approximately 1 hour tomorrow evening at 9pm GMT, after which time it will have more RAM.</p> <p><strong>Update:</strong> all done. [2016-12-09]</p> waxworlds.org http://www.waxworlds.org/news waxworlds.org http://www.waxworlds.org/news/feed/atom 2017-04-30T12:00:02+00:00 Service disruption to oak http://www.waxworlds.org/news/2016-12-06 2016-12-06T00:00:01+00:00 <p><code>oak.waxworlds.org</code> will be down for approximately 2 hours tomorrow evening at 6pm GMT while work is undertaken on the power.</p> <p><strong>Update:</strong> work has been completed on schedule. [2016-12-07]</p> waxworlds.org http://www.waxworlds.org/news waxworlds.org http://www.waxworlds.org/news/feed/atom 2017-04-30T12:00:02+00:00 Spaces within parenthesis in emacs http://ed.am/?p=1327 2016-11-25T11:33:41+00:00 <p>There&#8217;s lots of opinion about coding styles and which is best. I prefer one that helps you read the code. And, to that end, I prefer to have spaces inside parenthesis, like this:</p> <div class="codecolorer-container text default"><div class="text codecolorer">for( int a = 0; a &amp;lt; 20; a++ ) {<br /> &nbsp; &nbsp; dump( data[ a ] );<br /> }</div></div> <p>Call me a heathen if you like, but it&#8217;s how I roll!</p> <p>And it&#8217;s how I set out to configure emails to help me roll&#8230;<span id="more-1327"></span></p> <p>Unfortunately, emacs&#8217;s <code>electric-pair-mode</code> doesn&#8217;t do this sort of thing and can&#8217;t be configured to, either. There are two problems. The first is that <code>electric-pair-mode</code> doesn&#8217;t allow for conditions as to when it will insert a pair. So, I could add a pair of spaces, <code>(?\s . ?\s)</code>, to <code>electric-pair-pairs</code> so that it would automatically insert a second space, but it would do this for every space I typed. The second problem is that <code>electric-pair-mode</code> does some white-space skipping internally, which I think would be problematic. :(</p> <p>So I did it the old-fashioned way and added my own functions:</p> <div class="codecolorer-container text default"><div class="text codecolorer">(defun my/c-mode-insert-space (arg)<br /> &nbsp; (interactive &quot;*P&quot;)<br /> &nbsp; (let ((prev (char-before))<br /> &nbsp; &nbsp; &nbsp; &nbsp; (next (char-after)))<br /> &nbsp; &nbsp; (self-insert-command (prefix-numeric-value arg))<br /> &nbsp; &nbsp; (if (and prev next<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(string-match-p &quot;[[({]&quot; (string prev))<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(string-match-p &quot;[])}]&quot; (string next)))<br /> &nbsp; &nbsp; &nbsp; &nbsp; (save-excursion (self-insert-command 1)))))<br /> <br /> (defun my/c-mode-delete-space (arg &amp;amp;optional killp)<br /> &nbsp; (interactive &quot;*p\nP&quot;)<br /> &nbsp; (let ((prev (char-before))<br /> &nbsp; &nbsp; &nbsp; &nbsp; (next (char-after))<br /> &nbsp; &nbsp; &nbsp; &nbsp; (pprev (char-before (- (point) 1))))<br /> &nbsp; &nbsp; (if (and prev next pprev<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(char-equal prev ?\s) (char-equal next ?\s)<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(string-match &quot;[[({]&quot; (string pprev)))<br /> &nbsp; &nbsp; &nbsp; &nbsp; (delete-char 1))<br /> &nbsp; &nbsp; (backward-delete-char-untabify arg killp)))</div></div> <p>They can be bound in <code>c-mode</code> and <code>c-mode</code> derivatives like this:</p> <div class="codecolorer-container text default"><div class="text codecolorer">(add-hook 'c-mode-common-hook<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (lambda ()<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (local-set-key &quot; &quot; 'my/c-mode-insert-space)<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (local-set-key &quot;\177&quot; 'my/c-mode-delete-space)))</div></div> edam http://ed.am ::[ edam ]:: the adventures of edam http://ed.am/feed/atom 2017-03-03T04:00:04+00:00 Service disruption to oak http://www.waxworlds.org/news/2016-10-06 2016-10-06T01:00:01+00:00 <p>It would appear that our service provider have made a misconfiguration whilst transferring IP addresses to the new DSL (see post for <a href="http://www.waxworlds.org/news/2016-10-02">2016-10-02</a>). As a result, oak is currently down.</p> <p>Mail and jabber will most notably be affected, although no mail should get lost (it will come through when oak comes back on-line).</p> <p>Apologies for any inconvenience. I will update as I resolve the issue with our provider.</p> <p><strong>Update:</strong> The issue has now been resolved. All services should be up and running as normal again and mail will no doubt start trickling through again. [2016-10-06]</p> waxworlds.org http://www.waxworlds.org/news waxworlds.org http://www.waxworlds.org/news/feed/atom 2017-04-30T12:00:02+00:00 Temporary IP address changes to oak http://www.waxworlds.org/news/2016-10-02 2016-10-02T01:00:01+00:00 <p>As of Sunday 2nd October, the IP address of <code>oak.waxworlds.org</code> may change temporarily. DNS records will be updated accordingly, and there should be minimal service disruption. Oak's IP address should revert to that previously assigned in a few days. I'll update this post as I hear more.</p> <p><strong>Update:</strong> The IP address has changed. DNS has been updated. The interface of oak's default route has also changed, so please report any problems. [2016-10-02]</p> <p><strong>Update:</strong> Our service provider appears to have made a misconfiguration whilst transferring IP addresses. As a result, oak is <a href="http://www.waxworlds.org/news/2016-10-06">currently down</a>. [2016-10-06]</p> <p><strong>Update:</strong> IP addresses have been restored, although oak's IP address has actually changed to a different one within the subnet. Hopefully everything should be working again now. [2016-10-06]</p> waxworlds.org http://www.waxworlds.org/news waxworlds.org http://www.waxworlds.org/news/feed/atom 2017-04-30T12:00:02+00:00 Server software update and migration http://www.waxworlds.org/news/2015-11-19 2015-11-19T00:00:01+00:00 <p>I will be updating <code>ash</code> to Debian 8 on Sunday 22nd November. There should be vitually no disruption, aside from a reboot.</p> <p>I will also be moving <code>oak</code> to a new machine (which will be running Debian 8). There may be a brief disruption to mail and xmpp while I transfer configuration, etc.</p> <p>I'll update this post with further info.</p> <p><strong>Update:</strong> This entire upgrade/migration has been postponsed due to a) an issue with <code>oak</code>'s new hardware, and b) a hardware issue that is preventing backups on <code>willow</code>.</p> waxworlds.org http://www.waxworlds.org/news waxworlds.org http://www.waxworlds.org/news/feed/atom 2017-04-30T12:00:02+00:00 Using a shell in Emacs http://ed.am/?p=1285 2015-10-08T23:11:55+00:00 <p><img src="http://ed.am/wp-content/uploads/2015/10/emacs_pumpkin.jpg" alt="Emacs Pumpkin" width="100" height="124" class="float-left size-full wp-image-1310" /></p> <p>Emacs rocks.</p> <p><a href="http://emacsrocks.com/">It&#8217;s true, it does</a>.</p> <p>Recently, though, I&#8217;ve been trying to streamline my use of the shell in Emacs. Here&#8217;s my Halloween Emacs tips. <span id="more-1285"></span></p> <h3>Added support for multiple shells</h3> <p>The first, <em>glaring</em> problem with shells in Emacs is that you can only have one.</p> <p>I added a function that creates a shell based on the remote host of a buffer. It also names the shell after that host, so if I&#8217;m working on <code>/example.com:/some/file</code>, I&#8217;ll get a shell called <code>*shell:example.com*</code> (instead of just <code>*shell*</code>). This allows you to have multiple shells open simultaneously, one per host. [Credit: <a href="http://emacswiki.org/emacs/ShellMode">EmacsWiki</a>]</p> <div class="codecolorer-container lisp default"><div class="lisp codecolorer"><span>&#40;</span><span>defun</span> my/shell <span>&#40;</span><span>&amp;</span>optional buffer<span>&#41;</span><br /> &nbsp; &nbsp;<span>&#40;</span>interactive<span>&#41;</span><br /> &nbsp; &nbsp;<span>&#40;</span><span>let</span>* <span>&#40;</span><span>&#40;</span>tramp-path <span>&#40;</span><span>when</span> <span>&#40;</span>tramp-tramp-file-p default-directory<span>&#41;</span><br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span>&#40;</span>tramp-dissect-file-<span>name</span> default-directory<span>&#41;</span><span>&#41;</span><span>&#41;</span><br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span>&#40;</span>host <span>&#40;</span>tramp-file-name-real-host tramp-path<span>&#41;</span><span>&#41;</span><br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span>&#40;</span>user <span>&#40;</span><span>if</span> <span>&#40;</span>tramp-file-name-user tramp-path<span>&#41;</span><br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span>&#40;</span>format <span>&quot;%s@&quot;</span> <span>&#40;</span>tramp-file-name-user tramp-path<span>&#41;</span><span>&#41;</span> <span>&quot;&quot;</span><span>&#41;</span><span>&#41;</span><br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span>&#40;</span>new-buffer-<span>name</span> <span>&#40;</span>format <span>&quot;*shell:%s%s*&quot;</span> user host<span>&#41;</span><span>&#41;</span><span>&#41;</span><br /> &nbsp; &nbsp; &nbsp;<span>&#40;</span>shell <span>&#40;</span><span>if</span> host new-buffer-<span>name</span> buffer<span>&#41;</span><span>&#41;</span><span>&#41;</span><span>&#41;</span></div></div> <h3>Added F9 shell toggle</h3> <p>Then I added the <kbd>F9</kbd> global key binding to toggle between the current buffer and the related shell for the current buffer&#8217;s host, creating that shell as necessary.</p> <div class="codecolorer-container lisp default"><div class="lisp codecolorer"><span>&#40;</span><span>defun</span> my/shell-toggle <span>&#40;</span><span>&amp;</span>optional buffer<span>&#41;</span><br /> &nbsp; <span>&#40;</span>interactive<span>&#41;</span><br /> &nbsp; <span>&#40;</span><span>if</span> <span>&#40;</span>string-match <span>&quot;^<span>\\</span>*shell[<span>\\</span>*:]&quot;</span> <span>&#40;</span>buffer-<span>name</span><span>&#41;</span> <span>&#41;</span><br /> &nbsp; &nbsp; &nbsp; <span>&#40;</span>previous-buffer<span>&#41;</span><br /> &nbsp; &nbsp; &nbsp; <span>&#40;</span>my/shell buffer<span>&#41;</span><span>&#41;</span><span>&#41;</span><br /> <span>&#40;</span>global-set-key <span>&#91;</span>f9<span>&#93;</span> 'my/shell-toggle<span>&#41;</span></div></div> <h3>Handle shell termination</h3> <p>There are several ways you could handle terminating the shell. You could, just for shell buffers, turn off the prompt that asks you if you&#8217;re sure you want to kill a buffer with an active subprocess running in it, and then use <kbd>C-x k</kbd>. But this would kill bash rudely, and bash would not save your command history. You could tell bash to save command history after every command. But this leaves executed commands between different shells all intermixed in the history file and shells would no longer have their own individual session history. That doesn&#8217;t appeal to me.</p> <p>So I opted for another method: detect when the shell terminates and close the emacs buffer. This way, you can hit Ctrl-D (same as you would in a terminal window), bash saves its history, and everyone&#8217;s happy.</p> <div class="codecolorer-container lisp default"><div class="lisp codecolorer"><span>&#40;</span>add-hook 'comint-exec-hook<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span>&#40;</span><span>lambda</span> <span>&#40;</span><span>&#41;</span><br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span>&#40;</span>set-process-sentinel <span>&#40;</span>get-buffer-process <span>&#40;</span>current-buffer<span>&#41;</span><span>&#41;</span><br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'my/shell-process-sentinel<span>&#41;</span><span>&#41;</span><span>&#41;</span><br /> <span>&#40;</span><span>defun</span> my/shell-process-sentinel <span>&#40;</span>process state<span>&#41;</span><br /> &nbsp; <span>;; show shell status and kill the buffer automatically</span><br /> &nbsp; <span>&#40;</span>message <span>&quot;shell: %s&quot;</span> state<span>&#41;</span><br /> &nbsp; <span>&#40;</span><span>if</span> <span>&#40;</span><span>or</span><br /> &nbsp; &nbsp; &nbsp; &nbsp;<span>&#40;</span>string-match <span>&quot;exited abnormally with code.*&quot;</span> state<span>&#41;</span><br /> &nbsp; &nbsp; &nbsp; &nbsp;<span>&#40;</span>string-match <span>&quot;finished&quot;</span> state<span>&#41;</span><span>&#41;</span><br /> &nbsp; &nbsp; &nbsp; <span>&#40;</span>kill-buffer <span>&#40;</span>current-buffer<span>&#41;</span><span>&#41;</span><span>&#41;</span><span>&#41;</span></div></div> <p>Nice.</p> edam http://ed.am ::[ edam ]:: the adventures of edam http://ed.am/feed/atom 2017-03-03T04:00:04+00:00 New cloud facilities http://www.waxworlds.org/news/2015-03-20 2015-03-20T00:00:01+00:00 <p>We are now running <a href="https://owncloud.org/">ownCloud</a> at <a href="https://cloud.waxworlds.org/"><code>cloud.waxworlds.org</code></a>. If want a user account created, please <a href="mailto:admin@waxworlds.org">get in touch</a>.</p> <p>(FYI: ownCloud allows you to upload and sync files and documents between devices and then share them publicly or privately between other owncloud users or anyone who you gave a link to.)</p> waxworlds.org http://www.waxworlds.org/news waxworlds.org http://www.waxworlds.org/news/feed/atom 2017-04-30T12:00:02+00:00 Oak moving location http://www.waxworlds.org/news/2015-03-16 2015-03-16T00:00:01+00:00 <p>Oak is due to move home on 18th March and it's IP address will change again. There may be a 24hr delay as DNS catches up. As usual, please report any problems.</p> <p><strong>Update:</strong> Oak has moved. There may be a 24hr delay with DNS as caches expire. [2015-03-19]</p> waxworlds.org http://www.waxworlds.org/news waxworlds.org http://www.waxworlds.org/news/feed/atom 2017-04-30T12:00:02+00:00 Mail server listed in spam RBL http://www.waxworlds.org/news/2015-02-27 2015-02-27T00:00:01+00:00 <p>Due to <code>mail.waxworlds.org</code> (a.k.a. <code>oak.waxworlds.org</code>) being temporarily assigned a dynamic IP address, it has been listed in the <a href="http://www.sorbs.net/delisting/dul.shtml">SORBS DUHL spam RBL</a>.</p> <p>This is being persued with SORBS. I will post updates as they become available.</p> <p><strong>Update:</strong> SORBS will not unblacklsit oak while it has a dynamic IP address. It will move to a static address on 17th March. Appologies for any inconvenience in the meantime. [2015-03-09]</p> <p><strong>Update:</strong> This issue should be resolved after the <a href="http://www.waxworlds.org/news/2015-03-16">forthcoming move</a>. Appologies for any inconveniences. [2015-03-16]</p> waxworlds.org http://www.waxworlds.org/news waxworlds.org http://www.waxworlds.org/news/feed/atom 2017-04-30T12:00:02+00:00