home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / languages / elisp / functions / dired-ffro.el < prev    next >
Encoding:
Text File  |  1990-07-22  |  942 b   |  28 lines

  1. ;From: sra@lcs.mit.edu (Rob Austein)
  2. ;Newsgroups: gnu.emacs.bug
  3. ;Subject: Suggested addition: dired-find-file-read-only
  4. ;Message-ID: <SRA.89Aug31105224@mintaka.lcs.mit.edu>
  5. ;Date: 31 Aug 89 14:52:26 GMT
  6. ;Distribution: gnu
  7. ;Organization: ITS Preservation Society
  8. ;Lines: 18
  9. ;
  10. ;Philippe Schnoebelen pointed out that the following would be useful.
  11. ;It defines a function that can be used in Dired mode to find a file
  12. ;read-only.  Since "e" and "f" run the same function (dired-find-file)
  13. ;in the vanilla dired keymap, "e" ("examine") might be a reasonable
  14. ;place to hang this.
  15.  
  16. (defun dired-find-file-read-only ()
  17.   "In dired, visit the file or directory named on this line."
  18.   (interactive)
  19.   (find-file-read-only (dired-get-filename)))
  20.  
  21. ;; Be careful here if you already have a dired-mode-hook set....
  22. (setq dired-mode-hook
  23.       (function
  24.        (lambda ()
  25.      (define-key dired-mode-map "e" 'dired-find-file-read-only))))
  26.  
  27. ;--Rob Austein, MIT
  28.