Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
;; Associate the universal match regexp "" with the ;; function check-buffer-file-type, so any file will be ;; examined to automatically select the appropriate mode. ;; Add this check only after known filename patterns are ;; treated the way they should be. (That's why we append ;; to the list, instead of replacing it). You might want ;; to use more more restrictive pattern(s) for doing this ;; check. (setq file-name-buffer-file-type-alist (append file-name-buffer-file-type-alist '(("" . check-buffer-file-type)))) (defun check-buffer-file-type (filename) "Examines the actual contents of the loaded file to see if it should use text mode or binary." (if (and (looking-at ".*\r\n") ;; has CR-LF sequence (not (re-search-forward "[^\r]\n]" nil t))) ;; and no LF w/o CR nil ;; so use text mode t)) ;; else binary mode (defun toggle-buffer-file-type (arg) "Alternate value of buffer-file-type. If you have loaded a file as binary that actually has the ^M's in it, then switching to text mode will remove them in the buffer. Of course now that it's in text mode, it will save with the ^M's inserted. Switching to binary mode does NOT have a reverse effect. If you want to disable that change on entering text mode, then use a negative prefix argument, as described below. A prefix argument will force the mode change in a particular direction. A positive prefix argument forces it to binary. A zero prefix argument forces text mode allowing the removal of ^M's (only preceding ^J's). A negative prefix argument forces text mode disallowing the removal of ^M's. When the mode is changed the state of modification of the buffer is preserved, even if the ^M's are removed." (interactive "P") (let ((old buffer-file-type) (mod (buffer-modified-p)) (buffer-read-only nil)) (setq buffer-file-type (if arg (>= arg 1) (not buffer-file-type))) (if (and old (not buffer-file-type) (or (not arg) (> arg -2))) (save-excursion (beginning-of-buffer) (while (search-forward "\r\n" nil t) (replace-match "\n" nil t)) (set-buffer-modified-p mod)))) (force-mode-line-update))