[gnu.emacs.bug] Suggested addition: dired-find-file-read-only

sra@lcs.mit.edu (Rob Austein) (08/31/89)

Philippe Schnoebelen pointed out that the following would be useful.
It defines a function that can be used in Dired mode to find a file
read-only.  Since "e" and "f" run the same function (dired-find-file)
in the vanilla dired keymap, "e" ("examine") might be a reasonable
place to hang this.

(defun dired-find-file-read-only ()
  "In dired, visit the file or directory named on this line."
  (interactive)
  (find-file-read-only (dired-get-filename)))

;; Be careful here if you already have a dired-mode-hook set....
(setq dired-mode-hook
      (function
       (lambda ()
	 (define-key dired-mode-map "e" 'dired-find-file-read-only))))

--Rob Austein, MIT