waxworlds.org http://www.waxworlds.org/atom.xml 2017-06-26T08:00:04+00:00 Planet/2.0 +http://www.planetplanet.org Major server failure http://www.waxworlds.org/news/2017-06-15 2017-06-15T01:00:01+00:00 <p><code>oak.waxworlds.org</code> died rather unexpectedly last night. I have not yet had a chance to make a propper analyisys of the problem, but it looks as though the disk might be toast and a complete reinstall might be on the cards.</p> <p>The upshot of the situation is that mail, jabber and access to the Central network are unavailable until I am able to resolve the problm.</p> <p>I will update here as things unfolds or when I find out more.</p> <p><strong>Update:</strong> <code>oak</code> has been up and running this evening and has been catching up with mail. All services are restored. However there will be intermittent downtime over the next few days as hardware is replaced. [2017-06-15]</p> waxworlds.org http://www.waxworlds.org/news waxworlds.org http://www.waxworlds.org/news/feed/atom 2017-06-26T08:00:03+00:00 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-06-26T08:00:03+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-06-26T08:00:03+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 cpp default"><div class="cpp codecolorer"><span>for</span><span>&#40;</span> <span>int</span> a <span>=</span> <span>0</span><span>;</span> a <span>&lt;</span> <span>20</span><span>;</span> a<span>++</span> <span>&#41;</span> <span>&#123;</span><br /> &nbsp; &nbsp; dump<span>&#40;</span> data<span>&#91;</span> a <span>&#93;</span> <span>&#41;</span><span>;</span><br /> <span>&#125;</span></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 lisp default"><div class="lisp codecolorer"><span>&#40;</span><span>defun</span> my/c-mode-insert-space <span>&#40;</span>arg<span>&#41;</span><br /> &nbsp; <span>&#40;</span>interactive <span>&quot;*P&quot;</span><span>&#41;</span><br /> &nbsp; <span>&#40;</span><span>let</span> <span>&#40;</span><span>&#40;</span>prev <span>&#40;</span>char-before<span>&#41;</span><span>&#41;</span><br /> &nbsp; &nbsp; &nbsp; &nbsp; <span>&#40;</span>next <span>&#40;</span>char-after<span>&#41;</span><span>&#41;</span><span>&#41;</span><br /> &nbsp; &nbsp; <span>&#40;</span>self-insert-command <span>&#40;</span>prefix-numeric-<span>value</span> arg<span>&#41;</span><span>&#41;</span><br /> &nbsp; &nbsp; <span>&#40;</span><span>if</span> <span>&#40;</span><span>and</span> prev next<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span>&#40;</span>string-match-p <span>&quot;[[({]&quot;</span> <span>&#40;</span>string prev<span>&#41;</span><span>&#41;</span><br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span>&#40;</span>string-match-p <span>&quot;[])}]&quot;</span> <span>&#40;</span>string next<span>&#41;</span><span>&#41;</span><span>&#41;</span><br /> &nbsp; &nbsp; &nbsp; &nbsp; <span>&#40;</span>save-excursion <span>&#40;</span>self-insert-command <span>1</span><span>&#41;</span><span>&#41;</span><span>&#41;</span><span>&#41;</span><span>&#41;</span><br /> <br /> <span>&#40;</span><span>defun</span> my/c-mode-delete-space <span>&#40;</span>arg <span>&amp;</span>amp<span>;optional killp)</span><br /> &nbsp; <span>&#40;</span>interactive <span>&quot;*p<span>\n</span>P&quot;</span><span>&#41;</span><br /> &nbsp; <span>&#40;</span><span>let</span> <span>&#40;</span><span>&#40;</span>prev <span>&#40;</span>char-before<span>&#41;</span><span>&#41;</span><br /> &nbsp; &nbsp; &nbsp; &nbsp; <span>&#40;</span>next <span>&#40;</span>char-after<span>&#41;</span><span>&#41;</span><br /> &nbsp; &nbsp; &nbsp; &nbsp; <span>&#40;</span>pprev <span>&#40;</span>char-before <span>&#40;</span>- <span>&#40;</span>point<span>&#41;</span> <span>1</span><span>&#41;</span><span>&#41;</span><span>&#41;</span><span>&#41;</span><br /> &nbsp; &nbsp; <span>&#40;</span><span>if</span> <span>&#40;</span><span>and</span> prev next pprev<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span>&#40;</span>char-<span>equal</span> prev ?\s<span>&#41;</span> <span>&#40;</span>char-<span>equal</span> next ?\s<span>&#41;</span><br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span>&#40;</span>string-match <span>&quot;[[({]&quot;</span> <span>&#40;</span>string pprev<span>&#41;</span><span>&#41;</span><span>&#41;</span><br /> &nbsp; &nbsp; &nbsp; &nbsp; <span>&#40;</span>delete-char <span>1</span><span>&#41;</span><span>&#41;</span><br /> &nbsp; &nbsp; <span>&#40;</span>backward-delete-char-untabify arg killp<span>&#41;</span><span>&#41;</span><span>&#41;</span></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 lisp default"><div class="lisp codecolorer"><span>&#40;</span>add-hook 'c-mode-common-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>local-set-key <span>&quot; &quot;</span> 'my/c-mode-insert-space<span>&#41;</span><br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span>&#40;</span>local-set-key <span>&quot;<span>\1</span>77&quot;</span> 'my/c-mode-delete-space<span>&#41;</span><span>&#41;</span><span>&#41;</span></div></div> edam http://ed.am ::[ edam ]:: the adventures of edam http://ed.am/feed/atom 2017-05-13T01:00:03+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-06-26T08:00:03+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-06-26T08:00:03+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-06-26T08:00:03+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-05-13T01:00:03+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-06-26T08:00:03+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-06-26T08:00:03+00:00