Skip to content

Instantly share code, notes, and snippets.

@offby1
Created July 25, 2016 19:39
Show Gist options
  • Save offby1/15e4f9b9736ea402b06bf7db6c4aca7e to your computer and use it in GitHub Desktop.
Save offby1/15e4f9b9736ea402b06bf7db6c4aca7e to your computer and use it in GitHub Desktop.
Use magit? Have a lotta buffers? This is handy.
;; Unrelated to the above, but handy anyway
(defun ibuffer-mark-most-readonly-buffers ()
(interactive)
(ibuffer-mark-on-buffer
#'(lambda (buf)
(and
;; Yeah, yeah, I could (defvar
;; ibuffer-precious-read-only-yadda-yadda) but screw that.
(not (string-match (rx bos "*magit: ") (buffer-name buf)))
(buffer-local-value 'buffer-read-only buf)))))
(define-key
ibuffer-mode-map
[remap ibuffer-mark-read-only-buffers] 'ibuffer-mark-most-readonly-buffers)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment