tag:blogger.com,1999:blog-41665880082800271212024-02-18T19:41:22.517-08:00Open SauceStuff And ThingsRichardhttp://www.blogger.com/profile/04002001799007552493noreply@blogger.comBlogger10125tag:blogger.com,1999:blog-4166588008280027121.post-8348525184150923762011-10-12T10:33:00.001-07:002012-05-05T05:16:34.086-07:00ido-mode and virtual buffersEvery now and again you come across something in Emacs and slap your forehead and say "why didn't I notice that before". ido-mode is one, but the setting ido-use-virtual-buffers really makes it. The concept is simple : ido-mode remembers all your past buffers so all you need to do is "C-x b" (ido-switch-buffer) and start to type the filename and ido will complete to it having remembered it from previous sessions. No need to use C-x C-f and possibly the ido find facility any more - just type the mainpart of the filename or part of it. Incredible cool time saver and very very useful. <br /><br />From the Manual<br /><br /><blockquote>ido-use-virtual-buffers is a variable defined in `ido.el'.<br />Its value is t<br />Original value was nil<br /><br />Documentation:<br />If non-nil, refer to past buffers as well as existing ones.<br />Essentially it works as follows: Say you are visiting a file and<br />the buffer gets cleaned up by mignight.el. Later, you want to<br />switch to that buffer, but find it's no longer open. With<br />virtual buffers enabled, the buffer name stays in the buffer<br />list (using the `ido-virtual' face, and always at the end), and if<br />you select it, it opens the file back up again. This allows you<br />to think less about whether recently opened files are still open<br />or not. Most of the time you can quit Emacs, restart, and then<br />switch to a file buffer that was previously open as if it still<br />were.<br /> This feature relies upon the `recentf' package, which will be<br />enabled if this variable is configured to a non-nil value.<br /></blockquote><br /><br />my ido settings are currently:-<br /><br /><pre> '(ido-create-new-buffer (quote never))<br /> '(ido-enable-flex-matching t)<br /> '(ido-enable-last-directory-history nil)<br /> '(ido-enable-regexp nil)<br /> '(ido-max-directory-size 300000)<br /> '(ido-max-file-prompt-width 0.1)<br /> '(ido-use-filename-at-point (quote guess))<br /> '(ido-use-url-at-point t)<br /> '(ido-use-virtual-buffers t)<br /></pre>Richardhttp://www.blogger.com/profile/04002001799007552493noreply@blogger.com1tag:blogger.com,1999:blog-4166588008280027121.post-16116647232201835312011-10-05T10:31:00.000-07:002012-05-05T05:17:12.333-07:00Javascript utilitiesPlaying with javascript lately I came across a super utility called jshint : and Dale Harvey has produced a super jshint-mode! For a javascript nOOb like me it's invaluable when combined with jslint (jshint can replace it, but you might like to turn it off at times then manually invoke jslint instead).<br /><br />See : <a href="https://github.com/daleharvey/jshint-mode">jshint</a> and <a href="http://www.javascriptlint.com/">Javascript Lint</a><br /><br />My javascript set up:-<br /><br /><br /><pre>(require 'js-beautify)<br /><br /> (add-to-list 'load-path "~/.emacs.d/jquery-doc") <br />(require 'jquery-doc)<br />(add-hook 'js2-mode-hook 'jquery-doc-setup)<br />(require 'flymake-jshint)<br />(add-hook 'js2-mode-hook<br /> (lambda () (flymake-mode t)))<br /><br />(add-to-list 'auto-mode-alist '("\\.js$" . js2-mode))<br /><br />;; (add-to-list 'auto-mode-alist '("\\.js$" . js2-mode))<br />(add-hook 'js2-mode-hook '(lambda () (js-beautify)(define-key js2-mode-map (kbd "M-t") (lambda()(interactive)(js-beautify)))(define-key js2-mode-map [(shift f10)] (lambda()(interactive)(jslint-thisfile)))))<br /><br />;; javascript lint <br />(defun jslint-thisfile ()<br /> (interactive)<br /> (compile (format "jsl -process %s" (buffer-file-name))))<br />(defun jslint-thisfile-test ()<br /> (interactive)<br /> (compile (format "jsl -process %s" (buffer-file-name))))<br /><br />(provide 'rgr-javascript)<br /></pre>Richardhttp://www.blogger.com/profile/04002001799007552493noreply@blogger.com2tag:blogger.com,1999:blog-4166588008280027121.post-9135393185450667012011-06-11T18:04:00.001-07:002011-06-11T18:04:08.734-07:00enabling gtags auto tag completion in Global compatible modes<pre class="src src-emacs-lisp-mode">(require 'gtags)<br />(defun gtags-root-dir ()<br /> <span style="color: #ad7fa8;">"Returns GTAGS root directory or nil if doesn't exist."</span><br /> (with-temp-buffer<br /> (if (zerop (call-process <span style="color: #ad7fa8;">"global"</span> nil t nil <span style="color: #ad7fa8;">"-pr"</span>))<br /> (buffer-substring (point-min) (1- (point-max)))<br /> nil)))<br />(defun gtags-update ()<br /> <span style="color: #ad7fa8;">"Make GTAGS incremental update"</span><br /> (message <span style="color: #ad7fa8;">"updating GLOBAL tags using gtags -i .."</span>) <br /> (call-process <span style="color: #ad7fa8;">"gtags"</span> nil nil nil <span style="color: #ad7fa8;">"-i -f gtags.files"</span>)<br /> (gtags-make-complete-list))<br /><br />(defun gtags-update-global ()<br /> <span style="color: #ad7fa8;">"Make GTAGS incremental update"</span><br /> (message <span style="color: #ad7fa8;">"updating GLOBAL tags!!"</span>) <br /> (call-process <span style="color: #ad7fa8;">"global"</span> nil nil nil <span style="color: #ad7fa8;">"-u"</span>)<br /> (gtags-make-complete-list))<br /><br />(defun gtags-update-hook ()<br /> (when (gtags-root-dir)<br /> (when (memq major-mode (list 'php-mode 'c-mode 'org-mode 'javascript-mode 'js-mode 'emacs-lisp-mode))<br /> (progn (message <span style="color: #ad7fa8;">"global root : %s"</span> (gtags-root-dir))(gtags-update-global)))))<br />(add-hook 'after-save-hook 'gtags-update-hook)<br /><br />(defadvice gtags-find-tag (before gtags-make-complete-list activate)<br /> <span style="color: #ad7fa8;">"Make Global completion tags"</span> (unless gtags-complete-list (gtags-make-complete-list)))<br /><br />(add-hook 'php-mode-hook '(lambda () (gtags-mode t)))<br />(add-hook 'c-mode-hook '(lambda () (gtags-mode t)))<br /><br />(provide 'rgr-gtags)<br /></pre><br /><br /><br /><br/>-- <br/><a href='http://github.com/rileyrg'>My Emacs Files At GitHub</a>Richardhttp://www.blogger.com/profile/04002001799007552493noreply@blogger.com0tag:blogger.com,1999:blog-4166588008280027121.post-80808923299047755362011-04-10T14:16:00.001-07:002011-04-10T14:20:36.479-07:00Emacs at work developing facebook friendly meta data in php....<a href="http://i.imgur.com/NvvcW.jpg" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 1278px; height: 978px;" src="http://i.imgur.com/NvvcW.jpg" border="0" alt="" /></a>Richardhttp://www.blogger.com/profile/04002001799007552493noreply@blogger.com1tag:blogger.com,1999:blog-4166588008280027121.post-17306795388942966852011-03-09T22:05:00.001-08:002011-03-09T22:05:17.957-08:00org-googlecl - blogging to blogger.com through org-mode<br /><p>Installing a new Asus 1015PEM netbook with Debian Squeeze recently I had to<br />reinstall the google command line utility, googlecl. My utility org-googlecl to<br />allow me to blog directly from org-mode entries was broken however.<br /></p><br /><p><br /><a href="http://code.google.com/p/googlecl/">Google command line utility</a><br /></p><br /><p><br />Reason? googlecl , somewhat surprisingly, does not automatically create its<br />~/.local/share/googlecl/ directory. Simply create it yourself and then<br />org-googlecl works as documented.<br /></p><br /><p><br /><a href="https://github.com/rileyrg/org-googlecl/blob/master/org-googlecl.el">Blog directly to blogger.com from Emacs (org-mode support)</a><br /></p><br /><p><br />As a side note, using the Liquorix kernel, the Asus works perfectly with<br />Debian : all the "usual suspects" work - suspend/resume, wireless and audio all<br />work. Initially post-resume I had to manually remove and re-modprobe the<br />brcm80211 driver but that now seems to be resolved. On the downside, battery<br />life is rubbish compared to running Win 7 Start Edition which it came with (dual<br />boot) but its still acceptable - but when you think I have this litle beauty<br />running apache2 and mysql it's still a great little portable machine.<br /></p><br /></div><br /></body><br /></html><br /><br/>-- <br/><a href='http://github.com/rileyrg'>My Emacs Files At GitHub</a>Richardhttp://www.blogger.com/profile/04002001799007552493noreply@blogger.com0tag:blogger.com,1999:blog-4166588008280027121.post-26673410373212433422011-03-08T07:31:00.003-08:002011-03-08T07:32:00.009-08:00Emacs to edit a Chromium textarea<br /><p>A nice Chromium alternatives to the FF extension "Its all text" is here :-<br /></p><br /><p><br /><a href="https://chrome.google.com/extensions/detail/ljobjlafonikaiipfkggjbhkghgicgoh">https://chrome.google.com/extensions/detail/ljobjlafonikaiipfkggjbhkghgicgoh</a><br /></p><br /><p><br />Why it needs edit-server.el I'm not 100% - I guess it uses something other than<br />the emacs daemon emacsclient call. But, it works nicely. I added the following<br />ot my emacs-init.org and all seems well. I like the double click in a textarea<br />method to launch an emacs client windows to edit.<br /></p><br /><br /><br /><br /><pre class="src src-emacs-lisp">(<span style="font-weight: bold;">if</span> (and (daemonp) (locate-library <span style="color: #ad7fa8;">"edit-server"</span>))<br /> (<span style="font-weight: bold;">progn</span><br /> (<span style="font-weight: bold;">require</span> '<span style="color: #73d216;">edit-server</span>)<br /> (edit-server-start)))<br /><br /> (add-hook 'edit-server-text-mode-hook<br /> (<span style="font-weight: bold;">lambda</span> ()(<span style="font-weight: bold;">progn</span>()<br /> (auto-complete-mode)<br /> (flyspell-mode))))<br /></pre><br /><br /><br /><br /></div><br /></body><br /></html><br /><br/>-- <br/><a href='http://github.com/rileyrg'>My Emacs Files At GitHub</a>Richardhttp://www.blogger.com/profile/04002001799007552493noreply@blogger.com2tag:blogger.com,1999:blog-4166588008280027121.post-12142972715969137952010-10-04T02:49:00.001-07:002010-10-04T02:49:38.229-07:00Emacs 23, the emacs daemon and emacsclient<br /><p>A recent entry to planetemacsen reminded me of a wiki entry added a good while<br />back which complements, or even supercedes, other methods of starting the emacs<br />daemon. There are a lot of solutions for running the emacs daemon when not<br />already running and/or using the emacsclient. I find the following solution<br />most convenient since there is no need to specifically start the server yourself<br />at any stage - it makes use of the alternate-editor option. Create a small<br />script and place it somewhere on your path.<br /></p><br /><br /><br /><br /><pre class="src src-emacs-lisp">#!/bin/bash<br /># edit<br />exec emacsclient --alternate-editor=<span style="color: #ffaf87;">""</span> -c <span style="color: #ffaf87;">"$@"</span><br /></pre><br /><br /><br /><br /><p><br />The ="" is the key. This tells the emacsclient code to start the daemon and then<br />call itself if its not already running.<br /></p><br /><p><br />The <a href="http://www.emacswiki.org/emacs/EmacsClient#toc2">wiki entry</a> tells you more and describes the use of the EDITOR env variable.<br /></p><br /><br/>-- <br/><a href='http://github.com/rileyrg'>My Emacs Files At GitHub</a>Richardhttp://www.blogger.com/profile/04002001799007552493noreply@blogger.com1tag:blogger.com,1999:blog-4166588008280027121.post-809614529979342872010-10-03T10:25:00.001-07:002010-10-03T22:27:50.135-07:00Fuzzy Search In Emacs<p><a href="http://code.google.com/p/dea/source/browse/trunk/lisps/auto-complete/fuzzy.el?spec=svn1202&r=1134">fuzzy.el</a> provides a super fuzzy search capacity. Save the code linked below to somewhere on your elisp path, add the two lines below to your .emacs and now C-s (isearch-forward) will become "fuzzy" after the first miss for the item you are searching for. You can customise the "fuzzy" group to change the fuzziness. This module is part of the superb auto-complete suite - recommended.<br /></p><br /><pre class="src src-emacs-lisp">(<span style="color: rgb(240, 223, 175); font-weight: bold;">require</span> '<span style="color: rgb(220, 163, 163); font-weight: bold;">fuzzy</span>)<br />(turn-on-fuzzy-isearch)<br /></pre><br /><br /><br /><br />--<br /><a href="http://github.com/rileyrg">My Emacs Files At GitHub</a>Richardhttp://www.blogger.com/profile/04002001799007552493noreply@blogger.com3tag:blogger.com,1999:blog-4166588008280027121.post-5757296410723328832010-09-26T09:49:00.001-07:002010-10-03T01:55:08.077-07:00NoGnus takes Gnus to the next level.<p>A popular objection to using Gnus was that its IMAP performance was<br />poor and its article counting simply rubbish. Not any more. Lars has<br />written pretty much a totally new back end for the imap portion of<br />gnus. Following an exchange of emails today it now works with my<br />dovecot set up which uses virtual users on the same dovecot server to<br />seperate different gmail accounts I sync with my local dovecot using<br />the excellent offlineimap. e.g The select name is passed as the server<br />name and each one has a corresponding .authinfo "machine" entry. e.g<br /></p><br /><br /><br /><br /><pre class="src src-emacs-lisp">(add-to-list 'gnus-secondary-select-methods<br /> `(nnimap "riley"<br /> (nnimap-address "offlineimap")<br /> (nnir-search-engine imap)<br /> (nnimap-stream network)<br /> ))<br /><br />(add-to-list 'gnus-secondary-select-methods<br /> `(nnimap "shamrockpub"<br /> (nnimap-address "offlineimap")<br /> (nnir-search-engine imap)<br /> (nnimap-stream network)<br /> ))<br /><br />(add-to-list 'gnus-secondary-select-methods<br /> `(nnimap "friends"<br /> (nnimap-address "offlineimap")<br /> (nnir-search-engine imap)<br /> (nnimap-stream network)<br /> ))<br /></pre><br /><br /><br /><p><br />riley, friends and shamrockpub all have entries in .authinfo.gpg e.g<br /></p><br /><br /><br /><pre class="src src-example">machine riley login riley password pass1<br />machine friends login friends password pass2<br />machine shamrockpub login shamrockpub password pass3<br /></pre><br /><br /><br /><p><br />and these then, in turn, correspond to dovecot virtual users.<br />Group refresh is almost instant now. And article counts appear to be spot on.<br />You can grap nognus from <a href="http://git.gnus.org/gnus.git">here</a>. Be sure to add it to you path and remember you need to<br /></p><br /><br /><br /><pre class="src src-emacs-lisp">(load "gnus-load")<br /></pre><br /><br /><br /><p><br />Grab it while its hot - I'm sure he would sooner get bug reports now<br />rather than months down the road when his mojo is depleted!</p><p>You can get nognus <a href="http://git.gnus.org/">here</a>.<br /></p>--<br /><a href="http://github.com/rileyrg">My Emacs Files At GitHub</a>Richardhttp://www.blogger.com/profile/04002001799007552493noreply@blogger.com1tag:blogger.com,1999:blog-4166588008280027121.post-16375305485212060242010-09-10T03:46:00.001-07:002010-10-02T13:07:02.446-07:00Blogging from emacs using the googlecl utility.Blogging to blogger/blogsport using emacs : particularly org-mode items.<br /><br /><a href="http://github.com/rileyrg/org-googlecl">http://github.com/rileyrg/org-googlecl</a><br /><br />Sample outputs here :<br /><br /><a href="http://splash-of-open-sauce.blogspot.com/">Open Sauce</a><a id="publishButton" class="cssButton" href="javascript:void(0)" target="" onclick="if (this.className.indexOf("ubtn-disabled") == -1) {var e = document['stuffform'].publish;(e.length) ? e[0].click() : e.click(); if (window.event) window.event.cancelBubble = true; return false;}"><div class="cssButtonOuter"><div class="cssButtonMiddle"><div class="cssButtonInner"><br /></div></div></div></a>Richardhttp://www.blogger.com/profile/04002001799007552493noreply@blogger.com1