---
(if (not (fboundp 'read-only-mode))
(defun read-only-mode (arg &rest args)
(interactive)
(read-only-mode arg)))
(when (and (boundp 'prefs-home-emacs-p)
prefs-home-emacs-p
(not noninteractive))
(add-hook 'find-file-hook 'd-readonly)
(add-hook 'dired-mode-hook 'd-readonly)
)
(defun d-readonly ()
" abcdefghijklmnopqrstuvwxyz abcdefghijklmnopqrstuvwxyz abcdefghijklmnopqrstuvwxyz abcdefghijklmnopqrstuvwxyz abcdefghijklmnopqrstuvwxyz"
(save-match-data
(let ((file (or (buffer-file-name) dired-directory)))
(if (and (file-directory-p file) (not (string-match "/$" file)))
(setq file (concat file "/")))
(cond
((string-match (getenv "HOME") file)
(read-only-mode -1)
(setq truncate-lines t))
((eq major-mode 'dired-mode)
(read-only-mode 1)
(setq truncate-lines t)
)
((and (null (buffer-file-name))
(string= (buffer-name) "*Backtrace*"))
(setq truncate-lines nil))
((and (buffer-file-name)
(string= (file-name-nondirectory (buffer-file-name)) "TAGS"))
(read-only-mode 1))
((and (buffer-file-name)
(string-match ".*\\.dir$" (file-name-nondirectory (buffer-file-name))))
(read-only-mode 1))
((string-match "\\.temp$" file)
(read-only-mode 1))
((string= (buffer-name) " *d-speedbar*")
(read-only-mode 1))
((string-match "/jtw-tutorials" default-directory)
(read-only-mode -1))
((string-match "/J.T.W/" default-directory)
(read-only-mode -1))
((string-match "/Downloads/" file)
(setq truncate-lines t)
(read-only-mode 1))
((string-match "/lisp\\+\\+-projects/" file)
(setq truncate-lines t)
(read-only-mode -1)
)
((or (string-match "~/c2java/" file)
(string-match "hairy-lemon/src/50webs-com/research/2015/c2java-1\\.12/" file))
(read-only-mode -1))
((string-match "hairy-lemon/src/50webs-com/research/2015/c2java-1\\.[0-9]+/" file)
(read-only-mode 1))
((string-match "/java-projects/" file)
(setq truncate-lines t)
(setq tab-width 5)
(read-only-mode -1))
((string-match "/imported-stuff/" file)
(read-only-mode 1))
((string-match "/var/www/" file)
(read-only-mode -1))
((string-match "dlisp/d-snaffle-database-full-list.el" file)
(read-only-mode 1))
((string-match "^d:/home/hairy-lemon/output/index.html$" file)
(read-only-mode -1))
((string-match "^log\\.\\(txt\\|el\\)$" file)
(d-beeps "Black Sabbath / Killing Yourself To Live, log.el")
(setq truncate-lines t)
(setq tab-width 3)
(read-only-mode -1))
((string-match "[a-z]:/wamp/" file)
(setq truncate-lines t)
(setq tab-width 3)
(read-only-mode -1))
((string-match "e:/Driver Pack Solution/" file)
(setq truncate-lines t)
(setq tab-width 3)
(read-only-mode 1))
((let ((case-fold-search t))
(and (string-match "/output/" file)
(string-match "\\.html?$" file)))
(read-only-mode 1))
((let ((case-fold-search t))
(string-match "/hairy-lemon/" file))
(read-only-mode -1))
((string-match "allegro" file)
(read-only-mode 1))
((string-match "wordpress" file)
(read-only-mode -1))
((string-match "/Program Files/" file)
(read-only-mode 1))
((and prefs-home-emacs-p (string-match "/ro[a-z]*/" file))
(read-only-mode 1))
((string-match "\\.\\(gz\\|rpm\\|tar\\|tgz\\|zip\\)$" file)
(read-only-mode 1))
((string-match "\\.\\(class\\|dll\\|exe\\|lnk\\|o\\)$" file)
(read-only-mode 1))
((string-match "\\.\\(dvi\\|gif\\|jpg\\|mpg\\|pdf\\|ps\\|tga\\)$" file)
(read-only-mode 1))
((string-match "[a-z]:/" file)
(read-only-mode 1))
((string-match "/dlisp/" file)
(read-only-mode -1))
(t
(read-only-mode 1))))))
(defun d-read-only-mode ()
(interactive)
(if buffer-read-only
(read-only-mode -1)
(read-only-mode 1)))
(when prefs-davins-keybindings-online-p
(global-set-key [f7] 'd-read-only-mode)
)
(provide 'd-readonly)