(defun fc-turn-on-show-trailing-whitespace () "Set `show-trailing-whitespace' to t." (setq show-trailing-whitespace t)) (mapc (lambda (hook) (add-hook hook 'fc-turn-on-show-trailing-whitespace)) '(text-mode-hook scheme-mode-hook c-mode-hook emacs-list-mode-hook java-mode-hook)) (defun print-defun-name () (interactive) (save-excursion (beginning-of-defun) (beginning-of-line 0) (let ((start (point)) string) (end-of-line 2) (setq string (buffer-substring start (point))) (message "%s" (replace-regexp-in-string "[ \t\n]" " " string))))) (defun count-words (start end) "Print number of words in the region." (interactive "r") (save-excursion (let ((n 0)) (goto-char start) (while (< (point) end) (when (forward-word 1) (setq n (1+ n)))) (message "Region has %d words" n) n))) ; ; encode plain text to html text ; (defun html-encode-region () "Encode plain text character <, >, & within region into html < > & ." (interactive) (let ((head-pointp (< (point) (mark)))) (or head-pointp (exchange-point-and-mark)) (save-excursion (while (< (point) (mark)) (let (pp tl) (setq pp (point)) (forward-char) (setq tl (buffer-substring pp (point))) (cond ((string= tl "<") (delete-char -1) (insert "<")) ((string= tl ">") (delete-char -1) (insert ">")) ((string= tl "&") (delete-char -1) (insert "&")))))) (exchange-point-and-mark) (and head-pointp (exchange-point-and-mark)))) ; Turn on font-lock in all modes that support it (if (fboundp 'global-font-lock-mode) (global-font-lock-mode t)) ; Maximum colors (setq font-lock-maximum-decoration t) ;Linux style indenting (add-hook 'c-mode-common-hook (lambda () (c-set-style "linux"))) ; wheel mouse mode (mouse-wheel-mode t) (iswitchb-mode t) ;set scroll to 1 ;(setq scroll-conservatively 1) ;php mode ;(require 'php-mode) ;;PSGML section (setq mmm-global-mode 'maybe) (setq-default sgml-set-face t) ;; ;; Faces. ;; (make-face 'sgml-comment-face) (make-face 'sgml-doctype-face) (make-face 'sgml-end-tag-face) (make-face 'sgml-entity-face) (make-face 'sgml-ignored-face) (make-face 'sgml-ms-end-face) (make-face 'sgml-ms-start-face) (make-face 'sgml-pi-face) (make-face 'sgml-sgml-face) (make-face 'sgml-short-ref-face) (make-face 'sgml-start-tag-face) (set-face-foreground 'sgml-comment-face "dark green") (set-face-foreground 'sgml-doctype-face "maroon") (set-face-foreground 'sgml-end-tag-face "blue2") (set-face-foreground 'sgml-entity-face "red2") (set-face-foreground 'sgml-ignored-face "maroon") (set-face-background 'sgml-ignored-face "gray90") (set-face-foreground 'sgml-ms-end-face "maroon") (set-face-foreground 'sgml-ms-start-face "maroon") (set-face-foreground 'sgml-pi-face "maroon") (set-face-foreground 'sgml-sgml-face "maroon") (set-face-foreground 'sgml-short-ref-face "goldenrod") (set-face-foreground 'sgml-start-tag-face "blue2") (setq-default sgml-markup-faces '((comment . sgml-comment-face) (doctype . sgml-doctype-face) (end-tag . sgml-end-tag-face) (entity . sgml-entity-face) (ignored . sgml-ignored-face) (ms-end . sgml-ms-end-face) (ms-start . sgml-ms-start-face) (pi . sgml-pi-face) (sgml . sgml-sgml-face) (short-ref . sgml-short-ref-face) (start-tag . sgml-start-tag-face)))