Printing From ibuffer

Ever since I remapped Caps Lock to Control I occasionally type 【Shift+X】 instead of 【Ctrl+X】 or vice-versa. Usually this doesn’t make much difference but when I’m in an ibuffer list it invariably causes havoc. The problem normally happens like this: I’m in ibuffer and want to move the cursor up to a different line. Instead of typing 【Ctrl+p】 I type 【Shift+p】. Unfortunately, 【P】 prints the buffer.

Usually I hit 【P】 two or three times before I realize what I’ve done and end up printing the buffer multiple times (and, of course, it’s always a large buffer). I finally got sick of this and added

(defadvice ibuffer-do-print (before print-buffer-query activate)
   (unless (y-or-n-p "Print buffer? ")
     (error "Cancelled")))

to my init.el file. Now when I type 【P】 instead of【Ctrl+p】 Emacs asks me if I really want to print the buffer. Another example of Emacs allowing me to have it my way. The only question is why I waited so long to fix this.

This entry was posted in General and tagged . Bookmark the permalink.