March 3, 2011
filed mid-morning by dr_who in: hacking
average time to read 1:00 minutes

i’m a big fan of IRC and we use it in our distributed team to stay in touch and also coordinate testing and upgrades. as i’m also a big fan of the ur-IDE emacs i’m using emacs’s rcirc mode for my IRC needs. typically i have a small buffer window at the bottom of my emacs frame dedicated to IRC. quite nice…

…until you start sbt or do some git work in egg as then those modes try to acquire some screen real-estate and without scruples either “recycle” my IRC buffer for their content :-( or split it into two :-(

this being emacs there had to be a way to get that IRC buffer window protected. and there is :-) digging into the emacs info docs and looking at the underlying emacs lisp files this is what i came up with:

 [sourcecode language="text"]
 (defun rcirc-toggle-current-window-dedication ()
   (interactive)
   (let* ((window (selected-window))
          (dedicated (window-dedicated-p window)))
     (set-window-dedicated-p window (not dedicated))
     (setq window-size-fixed (not window-size-fixed))
     (message "Window %sdedicated to %s"
              (if dedicated "no longer " "")
              (buffer-name))))

 (global-set-key (kbd "<Scroll_Lock>") 'rcirc-toggle-current-window-dedication)
 [/sourcecode]

this will toggle the window-dedicated-p and window-size-fixed bits of the window in which you press the scroll-lock key — and, hey, presto! — no more pirating of the IRC buffer window.

p5rn7vb
all content posted on these pages is an expression of my own mind. my employer is welcome to share these opinions but then again he might not want to.

no Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment