I've always wanted narrowing in emacs to be something I could just toggle, but there seemed no particularly easy would I could implement that. But the other day I finally sat down and banged this out:
(global-set-key "\M-n" 'toggle-narrow)
(defun toggle-narrow (beg end)
"If narrow, widen; if not narrowed, narrow!"
(interactive "r") ; "r" for region
(progn (narrow-to-region beg end)
(message "Narrowing to c%s - c%s." beg end))))
(defun narrow-p ()
"Whether narrow is in effect for the current buffer"
(let (real-point-min real-point-max)
(setq real-point-min (point-min)
(/= real-point-min (point-min))
(/= real-point-max (point-max)))))