Skip to main content
3 of 6
added 5 characters in body
Muihlinn
  • 2.7k
  • 1
  • 15
  • 22

An occur buffer is just a buffer in read-only mode, that doesn't mean that it cannot be manipulated.

Something as straightforward like this can help you:

(defun occur-kill-line()
    "Quick and dirty discard line from occur resultset."
    (interactive)
    (read-only-mode -1)
    (kill-line)(delete-blank-lines)
    (read-only-mode +1))

invoking this function will kill the current line in occur buffer. Pressing g will revert the buffer.

Adding this:

(define-key occur-mode-map (kbd "k") 'occur-kill-line)

will bind k to occur-kill-line to occur-mode-map making it available as occur command just pressing k.

Muihlinn
  • 2.7k
  • 1
  • 15
  • 22