RyanDavis

Last edit

Added:

> [new::7/1/2011]
> Updated re in ##compilation-error-regexp-alist##:
> {{{
> ("^ # *\\([[+]\\)?\\([^:
> ]+\\):\\([0-9]+\\):" 2 3)
> }}}
> Note extra two characters '# ' which seem to be emitted by rspec2 stack trace. I suppose they could be made conditional for backwards compatibility


Quick little description. I’m mainly a rubyist these days, but have been using emacs for a long long time.

Packages:

Snippets:

I got rid of my wikiput-buffer and wikiget because I finally got OddMuse? working. It required getting the `oddmuse-mode-hook` from the OddMuse? page to submit the text captcha.

Toggle toggle.el

(global-set-key
 (kbd "C-c M-t")
 '(lambda ()
    (interactive)
    (setq toggle-mappings
          (toggle-style
           (if (string-match "^app" (caar toggle-mappings)) "ruby"
           "rails")))))

Reading RecentChanges in NNW efficiently

Clean Wiki Changes

I use this applescript to mark items read in the RecentChanges RSS feed. Since this wiki is lively, if a page is edited once, it’ll likely be edited again soon. This makes sure that only the latest one is marked unread.

It also unmarks anything with “icicles” in it because I’m quite tired of DrewAdams littering the entire wiki with icicles crap. Does 5% of this site really need to be dedicated to 1 piece of software? I say no.

tell application "NetNewsWire"
	activate
	set seen to {}
	set removed to 0
	set unread_headlines to (headlines of selectedSubscription whose isRead is false) as list
	repeat with aheadline in unread_headlines
		if seen contains title of aheadline then
			set isRead of aheadline to true
			set removed to removed + 1
		else
			set end of seen to title of aheadline
		end if
		
		if title of aheadline contains "Icicles" then
			set isRead of aheadline to true
			set removed to removed + 1
		end if
	end repeat
	display dialog "Unselected " & removed & " headlines"
end tell

Shift Flagged Items

This allows me to flag things from the changes RSS feed that I want to deal with later, but pick up later updates to them.

tell application "NetNewsWire"
	activate
	set fixeditems to 0
	set flaggedItems to (headlines of selectedSubscription whose isFlagged is true)
	set theCount to count of flaggedItems
	
	display dialog "Scanning " & theCount & " flagged headlines"
	
	repeat with aheadline in flaggedItems
		set thetitle to title of aheadline
		set currentHeadlines to (headlines of selectedSubscription whose title is thetitle)
		if (count of currentHeadlines) > 1 then
			if not isFlagged of first item of currentHeadlines then
				set fixeditems to fixeditems + 1
				repeat with flaggedHeadline in currentHeadlines
					set isFlagged of flaggedHeadline to false
				end repeat
				set isFlagged of first item of currentHeadlines to true
			end if
		end if
	end repeat
	
	display dialog "Shifted " & fixeditems & " flagged headlines"
end tell

Dialog:

insert dialog here. pls tag with: [[new::]]

Hi, I have been using toggle.el, and I made a small change allowing the specification of rules for jumping between methods as well as between files. An example set of rules would be…

Sorry, but I don’t think these changes are general enough for toggle.el. They’re all very ruby oriented. What I think is a better approach is to extend toggle.el to rotate amongst a list of related items. – RyanDavis

Issues:

insert issues here. pls start new === section and tag with: [[new::]]

EmacsApp font selection

Does anyone have a clue with this? This is with an up-to-date build (2009-06-30).

;; works fine
(set-frame-font "-apple-andale mono-medium-r-normal--12-*-*-*-*-*-fontset-mac" 'keep)
;; winds up using DejaVu_Sans_Mono-bold-normal-normal instead of medium:
(set-frame-font "-apple-DejaVu_Sans_Mono-medium-normal-normal-*-*-*-*-*-m-0-iso10646-1" 'keep)
;; works fine. this font is directly related to deja vu. why does this work?
(set-frame-font "-apple-Bitstream_Vera_Sans_Mono-medium-normal-normal-*-*-*-*-*-m-0-iso10646-1" 'keep)
;; works fine. wanted to test an apple "stock" font:
(set-frame-font "-apple-Monaco-medium-normal-normal-*-*-*-*-*-m-0-iso10646-1" 'keep)

autotest.el

I had to replace

("\\[\\(.*\\):\\([0-9]+\\)\\]:$" 1 2)

by

("\\[/?\\(.*\\):\\([0-9]+\\)\\]:$" 1 2)

because emacs couldn’t find the files linked in the autotest build buffer. But I’m not sure if this is the right approach. Maybe it’s better to fix autotest to output relative pathnames in the first place?

Due to further mismatches I had to replace almost the complete compilation-error-regexp-alist:

    (set (make-local-variable 'compilation-error-regexp-alist)
         '(
           ("^ +/?\\([^:]+\\):\\([0-9]+\\):in " 1 2)
           ("^\\([^
 :]+\\):\\([0-9]+\\)" 1 2)
           ("\\[/?\\(.*\\):\\([0-9]+\\)\\]:$" 1 2)
           ("On line #\\([0-9]+\\) of \\(.*\\)$" 2 1)
           ))

But this seems to hit 99% of the cases now. Especially the ("^ +\\(#{RAILS_ROOT}/\\)?\\([^(:]+\\):\\([0-9]+\\)" 2 3) regexp made problems. I’m Using Ubuntu 8.10 with Emacs 22 and 23 with newest ZenTest? 4.00. Does the output looks different in Mac OS?

I find it useful to add ansi-color support with

        @@ -64,11 +64,7 @@
     (define-key shell-mode-map "\C-c\C-a" 'autotest-switch)
 
     (set (make-local-variable 'comint-output-filter-functions)
+        (set (make-local-variable 'comint-output-filter-functions)
+             '(comint-truncate-buffer
+               comint-postoutput-scroll-to-bottom
+               ansi-color-process-output
+               ))
-         '(comint-truncate-buffer comint-postoutput-scroll-to-bottom))
+    (ansi-color-for-comint-mode-on)

I’ve put it on github: http://github.com/krick/autotest.el

Updated re in compilation-error-regexp-alist:

     ("^ # *\\([[+]\\)?\\([^:
]+\\):\\([0-9]+\\):" 2 3)

Note extra two characters ‘# ‘ which seem to be emitted by rspec2 stack trace. I suppose they could be made conditional for backwards compatibility

toggle.el

I suggest transposing ‘pairs’ and ‘(mapcar …)’ in the pair doubling section (so that it looks like this):

(mapcan 'list
        (mapcar (lambda (pair)
                  (cons (cdr pair) (car pair)))
                pairs)
        pairs))))

This way, the buffer file name is first compared to the test matcher. In the current version, the usually less-specific implementation matcher is evaluated first, which can lead to premature matches: E.g. when testing for the rule (”\\1.rb” . “\\1_spec.rb”), the implementation matcher (”\\([^/]*\\).rb”) would erroneously match a spec file (foo_spec.rb).


CategoryHomepage