~ edlitmus /.emacs

(push (expand-file-name "~ed/lisp") load-path)

(require 'cl)

;; Enable emacs functionality that is disabled by default
(put 'eval-expression 'disabled nil)
(put 'set-goal-column 'disabled nil)
(put 'narrow-to-page 'disabled nil)
(put 'narrow-to-region 'disabled nil)
(put 'eval-expression 'disabled nil)
(put 'downcase-region 'disabled nil)
(put 'upcase-region 'disabled nil)
(setq enable-recursive-minibuffers t)

(setq indent-tabs-mode nil)
(setq-default indent-tabs-mode nil)
(setq tab-width 4)
(setq c-basic-indent 4)
;(set-face-background 'default "grey85")

(global-set-key  [(f1)]  (lambda ()
			   (interactive)
			   (manual-entry (current-word))))

;; Misc customizations
(fset 'yes-or-no-p 'y-or-n-p)           ;replace y-e-s by y
(setq inhibit-startup-message t)        ;no splash screen
(defconst use-backup-dir t)             ;use backup directory
(defconst query-replace-highlight t)    ;highlight during query
(defconst search-highlight t)           ;highlight incremental search
(setq ls-lisp-dirs-first t)             ;display dirs first in dired

(setq hippie-expand-try-functions-list
      '(try-expand-dabbrev
        try-expand-dabbrev-all-buffers
        try-expand-dabbrev-from-kill
        try-complete-file-name-partially
        try-complete-file-name
        try-complete-lisp-symbol-partially
        try-complete-lisp-symbol
        try-expand-whole-kill))

;; Set the name of the host and current path/file in title bar:
(setq frame-title-format
      (list (format "%s %%S: %%j " (system-name))
            '(buffer-file-name "%f" (dired-directory dired-directory "%b"))))

;; Column & line numbers in mode bar
(column-number-mode t)
(line-number-mode t)

(autoload 'pls-mode  "pls-mode" "PL/SQL Editing Mode" t)
(autoload 'diana-mode  "pls-mode" "DIANA for PL/SQL Browsing Mode" t)
(setq auto-mode-alist
	  (append '(("\\.pls$"  . pls-mode)
				("\\.plpgsql$"  . pls-mode)
				("\\.plsql$"  . pls-mode)
				("\\.pld$"  . diana-mode)
				) auto-mode-alist))
(setq pls-mode-hook '(lambda () (font-lock-mode 1)))

;; Specify modes for Lisp file extensions
(setq auto-mode-alist
      (append '(("\\.lisp$" . lisp-mode)
                ("\\.lsp$" . lisp-mode)
                ("\\.cl$" . lisp-mode)
                ("\\.asd$" . lisp-mode)
                ("\\.system$" . lisp-mode))
	      auto-mode-alist))

(defun pretty-lambdas ()
  (font-lock-add-keywords
   nil `(("(\\(lambda\\>\\)"
          (0 (progn (compose-region (match-beginning 1) (match-end 1)
                                    ,(make-char 'greek-iso8859-7 107))
                    nil))))))

;; Better buffer list.
(global-set-key [(control x) (control b)] 'electric-buffer-list)

(if (fboundp 'pc-selection-mode)
    (pc-selection-mode)
  (require 'pc-select))

(add-to-list 'load-path (expand-file-name "~ed/lisp/slime"))
(setf inferior-lisp-program "/usr/local/bin/sbcl")
(require 'slime)
(add-hook 'lisp-mode-hook (lambda () (slime-mode t)))
(add-hook 'inferior-lisp-mode-hook (lambda () (inferior-slime-mode t)))

(load-library "trim")
(load-library "ws-trim")
(load-library "tt-mode")
(load-library "surly-ssl")

;;************************************************************
;; configure HTML editing
;;************************************************************
;;
(require 'php-mode)
;;
;; configure css-mode
(autoload 'css-mode "css-mode")
(add-to-list 'auto-mode-alist '("\\.css\\'" . css-mode))
(setq cssm-indent-function #'cssm-c-style-indenter)
(setq cssm-indent-level '2)
;;
(add-hook 'php-mode-user-hook 'turn-on-font-lock)
;;
(require 'mmm-mode)
(setq mmm-global-mode 'maybe)
;;
;; set up an mmm group for fancy html editing
(mmm-add-group
 'fancy-html
 '(
   (html-php-tagged
    :submode php-mode
    :face mmm-code-submode-face
    :front "<[?]php"
    :back "[?]>")
   (html-css-attribute
    :submode css-mode
    :face mmm-declaration-submode-face
    :front "style=\""
    :back "\"")))
;;
;; What files to invoke the new html-mode for?
(add-to-list 'auto-mode-alist '("\\.inc\\'" . html-mode))
(add-to-list 'auto-mode-alist '("\\.phtml\\'" . html-mode))
(add-to-list 'auto-mode-alist '("\\.php[34]?\\'" . html-mode))
(add-to-list 'auto-mode-alist '("\\.[sj]?html?\\'" . html-mode))
(add-to-list 'auto-mode-alist '("\\.jsp\\'" . html-mode))
;;
;; What features should be turned on in this html-mode?
(add-to-list 'mmm-mode-ext-classes-alist '(html-mode nil html-js))
(add-to-list 'mmm-mode-ext-classes-alist '(html-mode nil embedded-css))
(add-to-list 'mmm-mode-ext-classes-alist '(html-mode nil fancy-html))

(mmm-add-mode-ext-class nil "\\.php[34]?\\'" 'html-php)
(mmm-add-mode-ext-class nil "\\.class\\'" 'html-php)
(mmm-add-mode-ext-class nil "\\.inc\\'" 'html-php)
(mmm-add-classes
 '((html-php
    :submode php-mode
    :front "<\\?\\(php\\)?"
    :back "\\?>")))
(autoload 'php-mode "php-mode" "PHP editing mode" t)

;;
;; Not exactly related to editing HTML: enable editing help
;; with mouse-3 in all sgml files
(defun go-bind-markup-menu-to-mouse3 ()
  (define-key sgml-mode-map [(down-mouse-3)] 'sgml-tags-menu))
;;
(add-hook 'sgml-mode-hook 'go-bind-markup-menu-to-mouse3)

(defun insert-php-region ()
  (interactive "*")
  (let ((php-template '("<?php" > n p n "?>" > n )))
    (tempo-insert-template 'php-template tempo-insert-region)
    (mmm-parse-buffer)))

(defun my-php-hook ()
  (c-set-style "cc-mode")
  (setq tab-width 4)
  (setq indent-tabs-mode t)
  (setq c-basic-offet 4)
  (c-toggle-hungry-state t)

  ;; C-c C-f is used by pgsml
  (define-key php-mode-map
    "\C-cd"
    'php-search-documentation)

  ;; C-c C-m is used by pgsml
  (define-key php-mode-map
    "\C-cb"
    'php-browse-manual)

  (define-key html-mode-map
    "\C-c\C-p"
    'insert-php-region))

(add-hook 'php-mode-hook 'my-php-hook)

(message "php-mode initialised")

;; find matching parens like xemacs
(load-library "mic-paren")
(global-set-key [(meta right)] 'mic-paren-forward-sexp)
(global-set-key [(meta left)] 'mic-paren-backward-sexp)

;;
;; perl
;;
;; Use cperl mode instead of the default perl mode
(defalias 'perl-mode 'cperl-mode)

;; turn autoindenting on
(global-set-key "\r" 'newline-and-indent)

;; Use 4 space indents via cperl mode
(custom-set-variables
  ;; custom-set-variables was added by Custom.
  ;; If you edit it by hand, you could mess it up, so be careful.
  ;; Your init file should contain only one such instance.
  ;; If there is more than one, they won't work right.
 '(blink-cursor-mode nil)
 '(c-basic-offset 4)
 '(column-number-mode t)
 '(cperl-close-paren-offset -4)
 '(cperl-continued-statement-offset 4)
 '(cperl-highlight-variables-indiscriminately t)
 '(cperl-indent-level 4)
 '(cperl-indent-parens-as-block t)
 '(cperl-lineup-step 4)
 '(cperl-tab-always-indent t)
 '(display-battery-mode nil)
 '(display-time-mode nil)
 '(pending-delete-mode t)
 '(show-paren-mode t)
 '(transient-mark-mode t))

;; Insert tabs instead of spaces - sigh...
(setq-default indent-tabs-mode t)

;; Set line width to 78 columns...
(setq fill-column 78)
(setq auto-fill-mode t)

;; Load an applicationtemplate in a new unattached buffer...
(defun application-template-pm ()
  "Inserts the standard Perl application template"  ; For help and info.
  (interactive "*")                                 ; Make this user accessible.
  (switch-to-buffer "application-template-pm")
  (insert-file "~/.code_templates/perl_application.pl"))
;; Set to a specific key combination...
(global-set-key "\C-ca" 'application-template-pm)

;; Load a module template in a new unattached buffer...
(defun module-template-pm ()
  "Inserts the standard Perl module template"       ; For help and info.
  (interactive "*")                                 ; Make this user accessible.
  (switch-to-buffer "module-template-pm")
  (insert-file "~/.code_templates/perl_module.pl"))
;; Set to a specific key combination...
(global-set-key "\C-cm" 'module-template-pm)

;; Expand the following abbreviations while typing in text files...
(abbrev-mode 1)

(define-abbrev-table 'global-abbrev-table '(
    ("pdbg"   "use Data::Dumper qw( Dumper );\nwarn Dumper[];"   nil 1)
    ("phbp"   "#! /usr/bin/perl -w"                              nil 1)
    ("pbmk"   "use Benchmark qw( cmpthese );\ncmpthese -10, {};" nil 1)
    ("pusc"   "use Smart::Comments;\n\n### "                     nil 1)
    ("putm"   "use Test::More 'no_plan';"                        nil 1)
    ))

(add-hook 'text-mode-hook (lambda () (abbrev-mode 1)))

;; custom stuff

(custom-set-faces
  ;; custom-set-faces was added by Custom.
  ;; If you edit it by hand, you could mess it up, so be careful.
  ;; Your init file should contain only one such instance.
  ;; If there is more than one, they won't work right.
 '(default ((t (:stipple nil :background "lightgray" :foreground "black" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 120 :width normal :family "apple-monaco"))))
 '(cperl-array ((((class color) (background light)) (:foreground "Blue" :weight bold))))
 '(cperl-array-face ((((class color) (background light)) (:foreground "Blue" :weight bold))))
 '(cperl-hash ((((class color) (background light)) (:foreground "Red" :weight bold))))
 '(cperl-hash-face ((((class color) (background light)) (:foreground "Red" :weight bold))))
 '(region ((((class color) (min-colors 88) (background light)) (:background "grey60")))))
Your Ad Here