;; add extern directories to emacs loadpath (add-to-list 'load-path (expand-file-name "~/.emacs.d/site/jde/lisp")) (add-to-list 'load-path (expand-file-name "~/.emacs.d/site/jde-jalopy")) (add-to-list 'load-path (expand-file-name "~/.emacs.d/site/semantic")) (add-to-list 'load-path (expand-file-name "~/.emacs.d/site/speedbar")) (add-to-list 'load-path (expand-file-name "~/.emacs.d/site/elib")) (add-to-list 'load-path (expand-file-name "~/.emacs.d/site/eieio")) (add-to-list 'load-path (expand-file-name "~/.emacs.d/site/colorthemes")) (add-to-list 'load-path (expand-file-name "~/.emacs.d/site/php")) (add-to-list 'load-path (expand-file-name "~/.emacs.d/site/w3/lisp")) (add-to-list 'load-path (expand-file-name "~/.emacs.d/site/flymake")) ;;(add-to-list 'load-path (expand-file-name "~/.emacs.d/site/psgml")) (add-to-list 'load-path (expand-file-name "~/.emacs.d/site/emacs-wiki")) (add-to-list 'load-path (expand-file-name "~/.emacs.d/site/blogmax")) ;; import jdee & jde-jalopy(extension for java) (require 'jde) (require 'jde-jalopy) ;; import color themes(extension for color themes) (require 'color-theme) (color-theme-classic) ;; import php mode (require 'php-mode) ;; import psgml mode ;;(require 'psgml) ; Use PSGML for sgml and xml major modes. ;;(autoload 'sgml-mode "psgml" "Major mode to edit SGML files." t) ;;(autoload 'xml-mode "psgml" "Major mode to edit XML files." t) ;; import image mode (require 'image) ;; import w3 mode (require 'w3-auto) ;; import flymake minor mode (require 'flymake) ;; import emacs wiki (require 'emacs-wiki) ;; import blogmax (require 'blogmax) (custom-set-variables ;; custom-set-variables was added by Custom -- don't edit or cut/paste it! ;; Your init file should contain only one such instance. '(case-fold-search t) '(default-input-method "chinese-py-punct") '(global-font-lock-mode t nil (font-lock)) '(show-paren-mode t nil (paren)) '(transient-mark-mode t) ;; jde-jalopy options ;;'(jde-jalopy-option-path "d:\\usr\\bin\\jalopy") '(jde-jalopy-option-path "/usr/bin/jalopy") '(jde-lib-directory-names "^lib$" "^jar$") '(jde-jalopy-option-force t) '(jde-jalopy-option-preferences-file "~/eclipse/workspace/weblucene/jalopy.xml") ;; term for emacs/w3 ;; see http://www.beastwithin.org/users/wwwwolf/things/techhelp/emacs-config.html '(w3-netscape-compatible-comments-comments t) '(w3-configuration-directory "~/.emacs.d/site/w3") '(w3-image-mappings (quote (("image/x-xbitmap" . xbm) ("image/xbitmap" . xbm) ("image/xbm" . xbm) ("image/jpeg" . jpeg) ("image/gif" . gif) ("image/png" . png) ("image/x-fax" . g3fax) ("image/x-raster" . rast) ("image/windowdump" . xwd) ("image/x-icon" . icon) ("image/portable-graymap" . pgm) ("image/portable-pixmap" . ppm) ("image/x-pixmap" . xpm) ("image/x-xpixmap" . xpm) ("image/pict" . pict) ("image/x-rgb" . sgi) ("image/x-sgi" . sgi) ("image/x-macpaint" . macpt) ("image/x-targa" . tga) ("image/tiff" . tiff)))) '(w3-honor-stylesheets (quote t)) '(w3-mode-hook (quote nil)) '(w3-preferences-ok-hook (quote nil) t) '(w3-default-homepage "http://www.lhelper.org") '(w3-load-hook (quote nil)) '(w3-preferences-setup-hook (quote nil) t) '(w3-toolbar-orientation (quote default) t) '(w3-preferences-default-hook (quote nil) t) '(w3-use-menus (quote (file edit view go bookmark options buffers style emacs nil help))) '(w3-source-file-hook (quote nil)) '(w3-toolbar-type (quote both) t) '(w3-preferences-cancel-hook (quote nil) t) '(w3-delay-image-loads (quote nil)) ) (custom-set-faces ;; custom-set-faces was added by Custom -- don't edit or cut/paste it! ;; Your init file should contain only one such instance. ) ;; set-keyboard-coding-system in order to input chinese words (set-keyboard-coding-system 'chinese-iso-8bit) (set-clipboard-coding-system 'chinese-iso-8bit) (setq column-number-mode t) (setq line-number-mode t) (setq-default indent-tabs-mode nil) (setq default-tab-width 4) (setq tab-stop-list ()) (setq default-major-mode 'text-mode) (mouse-avoidance-mode 'animate) (setq frame-title-format "emacs@%b") (auto-image-file-mode) (setq make-backup-files nil) (setq default-fill-column 60) ;; use default browser of current system (if (eq system-type 'windows-nt) (defadvice browse-url-generic (around show-window act) "*Sets `start-process-show-window' on." (let ((w32-start-process-show-window t)) ad-do-it))) ; Display the time in the Emacs status area (an easy way to test ; that we are picking up our Emacs customizations). (display-time) (add-hook 'diary-hook 'appt-make-list) (diary 0) ; ------------------------------------------------------------------ ; jsp stuff ; ; functions to perform correct indentation of java code within a ; JSP page. I can live without syntax coloring - I can't live ; without proper indentation ; (setq auto-mode-alist (cons '("\\.jsp\\'" . html-mode) auto-mode-alist)) (defun jsp-java-sob () "Return the point for the enclosing <% or nil if not present" (save-excursion (search-backward "<%"))) (defun jsp-java-eob () "Return the point for the enclosing %> or nil if not present" (save-excursion (search-forward "%>"))) (defun jsp-in-java-debug () (interactive) (if (jsp-in-java) (message "debug: in java code") (message "debug: not in java code"))) (defun jsp-in-java () (save-excursion (let* ((current-point (point)) (start-java-tag (jsp-java-sob)) (end-java-tag (jsp-java-eob))) (and (> current-point start-java-tag) (< current-point end-java-tag))))) (defun jsp-indent-java () (interactive) "Indent a java block within a JSP page " (save-excursion (let ((start (+ 2 (jsp-java-sob))) (end (jsp-java-eob) )) (if (string= "!" (char-to-string (char-after start))) (setq start (+ start 1)) nil) (if (jsp-in-java) (progn (java-mode) (goto-char start) ;; needed for proper indentation - removed later (newline) (insert "{") (newline) (goto-char end) ;; needed for proper indentation - removed later (newline) (insert "}") (newline) ;; ;; perform the indentation ;; (indent-region (+ start 2) (- end 0) nil) ;; ;; now remove the text we termporarily added for indentation ;; (delete-region (- (point) 3) (point)) (delete-region start (+ start 3)) (html-mode)) ())))) (setq html-mode-hook '(lambda () (define-key sgml-mode-map "\C-c\C-q" 'jsp-indent-java) )) ; ------------------------------------------------------------------ ; jsp stuff ; ------------------------------------------------------------------ ;; counting functions (defalias 'lc 'count-lines-page) (defun wc () "Count the words in the current buffer, show the result in the minibuffer" (interactive) ; *** This is the line that you need to add (save-excursion (save-restriction (widen) (goto-char (point-min)) (let ((count 0)) (while (forward-word 1) (setq count(1+ count))) (message "There are %d words in the buffer" count)))))