;
;; July 12, 1999
;; This is an _emacs.el file for ntemacs 19.34 for Java development using JDE
;; from peb@baclace.net
;; See:
;; Quick recipe ntemacs 19.34 http://www.baclace.net/emacsjava.html
;; http://www.cs.washington.edu/homes/voelker/ntemacs.html
;; http://sunsite.auc.dk/jde/
;; uncomment these to find problems in _emacs startup, etc.
;;(setq debug-on-error t)
;;(setq stack-trace-on-error nil)
;; My color scheme assumes a black background. Start like this:
;; emacs-19.34\bin\runemacs.exe -fg white -bg black
;; or use:
;; prefered fg/bg color
(set-background-color "black")
(set-foreground-color "white")
(set-cursor-color "green")
;; Set up your load path
(setq load-path (cons "d:/peb_home/lib/elisp" load-path))
(setq load-path (cons "d:/peb_home/lib/elisp/cc-mode" load-path));;CCMode5;
(setq load-path (cons "d:/peb_home/lib/elisp/custom" load-path));;CCMode5;
(load "cache")
;; General Stuff
;; alist-replace or destruct-append
(defun alist-replace (alist key new-value)
(let ((sublist (assoc key alist)))
(if sublist
(setcdr sublist new-value)
(nconc alist (list (cons key new-value)))
)))
;;
(defun dountabify()
"dountabify "
(save-excursion
(untabify (point-min) (point-max))
)
nil)
(setq fup 'foo-V);;;;;;;;;;;;;;;;debug
(defun line-move-interactive (arg) "Interactive version of line-move.
Replaces next-line; never inserts a character at eob."
;; the standard "next-line" will insert a newline
;; when at end-of-buffer and no arg is supplied.
(interactive "p")
(line-move arg)
nil)
(setq inhibit-local-variables t) ;;; security--this turns off elisp inside files under edit
(put 'eval-expression 'disabled nil)
(setq blink-matching-delay 0.2)
;; I am still looking to speed up the cursor flash (feedback indicating the
;; extent of the region being copied) that occurs when selecting
;; text by mouse and then doing kill-ring-save
;; this prevents the mark from changing
(defun my-beginning-of-buffer (arg)
(interactive "P")
(goto-char (point-min)))
;; this prevents the mark from changing
(defun my-end-of-buffer (arg)
(interactive "P")
(goto-char (point-max)))
(defun my-query-replace (FROM-STRING TO-STRING)
(interactive "P")
;(setq case-fold-search-save case-fold-search)
(setq case-fold-search t)
(query-replace FROM-STRING TO-STRING)
;(setq case-fold-search case-fold-search-save)
)
;;(global-set-key "\C-N" 'line-move-interactive)
(global-set-key "\C-N" 'next-line)
(setq fup 'foo-W);;;;;;;;;;;;;;;;
(setq suggest-key-bindings nil)
(setq comint-scroll-show-maximum-output t)
;; shell WIN95/NT Specific
;; This works for the KMS ksh
(setq backup-by-copying t)
(add-hook 'shell-mode-hook
'(lambda ()
(setq comint-completion-addsuffix t)
(setq completion-ignored-extensions '(".o" ".elc" "~" ".bak" ".class" ".old" ".obj"))
(setq comint-scroll-show-maximum-output t)
)
t)
;; get rid of those annoying ^M
(add-hook 'comint-output-filter-functions 'shell-strip-ctrl-m nil t)
;Tried to bind both functions, however errors occurred.
;(add-hook 'comint-output-filter-functions
; '(lambda ()
; (shell-strip-ctrl-m)
; (comint-show-maximum-output)
; )
; t)
;;(setq win32-enable-italics t);;looks crummy
;; End Of Line mode
;;;(setq using-unix-filesystem t)
;; instead, use Unix end-of-line on all files except .bat :
(setq file-name-buffer-file-type-alist '(("\\.bat$" . nil) (".*" . t)))
;; MKS
;; For the interactive shell
(setq explicit-shell-file-name "D:/mksnt/sh.exe")
(setq explicit-sh-args '("-L" )) ;; should read "d:/peb_home/profile.ksh"
;(setq explicit-sh-args "-L")
(setq fup 'foo-W1);;;;;;;;;;;;;;;;
;; For subprocesses invoked via the shell command (e.g., "shell -c command")
(setq shell-file-name "D:/mksnt/sh.exe")
(setq fup 'foo-W2);;;;;;;;;;;;;;;;
(setq win32-quote-process-args t)
;; Switch used to have the shell execute its command line argument.
(setq shell-command-switch "-c")
;; This makes the window banners more useful for speech recognition
;; by being consitent and providing more contecty. It also makes
;; the minimized text say something more useful than just "emacs"
;; and the beginning of a path.
(setq frame-title-format "emacs %m %b %f")
(setq icon-title-format "e %f")
(defun my-refresh-frame ()
(let ((myframe (car (car (cdr (current-frame-configuration)))))) ;; The current frame is not always first
(modify-frame-parameters (selected-frame) (list (cons 'title (concat "emacs " mode-name))))
))
;; printing
(require 'print-nt)
(setq ps-lpr-command "~/bin/printPs.bat")
;; (setq lpr-destination '("/D:\\\\host\\share-name")) ;; for normal printer
(setq lpr-destination '("")) ;;
;; (setq ps-lpr-destination '("/D:\\\\host\\share-name")) ;; for postscript printer
(setq ps-lpr-destination '("")) ;;
;;
(setq ps-print-use-gs nil) ; t - use ghostscript, nil - do not
;; (setq gs-print-command "c:\\gs\\gswin32.exe")
;; (setq gs-print-switches '("-q -sDEVICE=ljet4 -r600 -dNOPAUSE"))
;; (setq gs-view-command "c:\\gs\\gsview\\gsview32.exe")
;; (setq ps-paper-type 'ps-a4) ; the type of paper (if needed)
(setq ps-print-use-faces t)
(setq ps-print-temp-dir "e:\\\\temp\\\\")
(setq ps-lpr-buffer (concat ps-print-temp-dir "psspool.ps"))
(setq ps-fmt-buffer "e:/temp/psspool.ps") ;;;;;;;;;;;;;;;my hack of ps-print
(setq ps-bold-faces '(font-lock-keyword-face font-lock-type-face font-lock-reference-face ))
(setq ps-italic-faces '(font-lock-comment-face font-lock-string-face font-lock-reference-face))
(setq ps-print-color-p nil)
;;;;;;;;
(setq auto-save-default nil) ; do not auto-save
(setq kept-new-versions 2) ; keep two previous versions
(setq kept-old-versions 1) ; keep the original version
(setq trim-versions-without-asking t) ; otherwise, toss them
(setq delete-old-versions t) ; another way to do that
(setq version-control t) ; maintain version numbers
(setq delete-auto-save-files t) ; flush auto-save backups
(setq next-screen-context-lines 3) ; when scrolling by screenfulls
(setq scroll-step 1) ; Don't recenter for small jumps
; try moving just this many lines
(setq require-final-newline nil) ; nil means no automatic ending EOL
(setq fup 'foo-X);;;;;;;;;;;;;;;;
;;
;;;;;;;;;;;;; URL
;;
(require 'browse-url)
(setq browse-url-netscape-program "H:/ProgramFiles/Netscape/Communicator/Program/netscape.exe")
(setq browse-url-netscape-arguments '("-browser"))
(defun browse-search-here ()
"use browser to search for thing at point"
;; (interactive "P")
(apply 'start-process "netscape" nil "C:/Program\ Files/Netscape/Communicator/Program/netscape.exe"
;;; search personal AltaVista db "-browser"
(list (concat "http://127.0.0.1:6688/?pg=q&what=0&fmt=.&q="
(thing-at-point 'word)))))
;;no longer: (set-gosmacs-bindings)
;;; use -q on commandline to not read _emacs
;;;;;(setq inhibit-default-init 't)
(setq fup 'foo-0);;;;;;;;;;;;;;;;
;(setq text-mode-hook 'turn-on-auto-fill)
(setq default-major-mode 'text-mode)
;; Change ^H to *not* be Help
;(global-set-key "\C-h" 'backward-delete-char-untabify)
(global-set-key "\C-h" 'backward-delete-char)
(global-set-key "\C-x\C-h" 'help-command)
;; Some gosmacs style key bindings
(global-set-key "\C-x\C-g" 'goto-line)
(global-set-key "\C-s" 're-search-forward)
(global-set-key "\C-r" 're-search-backward)
(global-set-key "\033<" 'my-beginning-of-buffer)
(global-set-key "\033>" 'my-end-of-buffer)
(setq fup 'foo-1);;;;;;;;;;;;;;;;
(setq minibuffer-max-depth nil)
;;(setq shell-prompt-pattern "^[\[^#$%>^J]*[#$%>\]] *")
;;match 1+ of "[E:/Temp/EmacsTmp] "
(setq shell-prompt-pattern "^\(\[[A-Z]:[^]]*\].\)+")
;;What do I do about the "No match 2 in highlight..." error I get from sh-script.el?
;;Apparently the sh-script package isn't finding the shell program correctly. Peter Breton
;; says that adding a call to sh-set-shell in sh-mode-hook will fix the
;;problem:
(add-hook 'sh-mode-hook
(defun my-sh-mode-hook-set-shell ()
;; Use whatever shell is most appropriate -- it doesn't matter
;; if the actual /bin/ksh file exists on the system or not
(sh-set-shell "/bin/ksh"))) ;; and not "D:/mksnt/sh.exe"?
(add-hook 'java-mode-hook 'my-java-mode-hook)
(defun my-java-mode-hook ()
(require 'andersl-java-font-lock)
(turn-on-font-lock)
;; cc-mode stuff
(setq c-basic-offset 4) ;; Amount of basic offset
(setq c-indent-level 0)
(setq c-tab-always-indent 0) ;; third state
(setq c-brace-imaginary-offset 4)
(setq c-brace-offset 4)
(setq c-continued-statement-offset 4)
(setq c-argdecl-indent 4)
(setq c-label-offset -4)
(setq c-auto-newline nil)
; at Dean Tribble's request:
(setq indent-tabs-mode t) ; use not tabs spaces
;(setq indent-tabs-mode nil) ; use spaces not tabs
(alist-replace c-offsets-alist 'arglist-cont-nonempty '++)
(alist-replace c-offsets-alist 'arglist-close '++)
; could do this for all Java files, but that would be excessive:
;
;(add-hook 'local-write-file-hooks 'dountabify) ; SHOULD detect read-only files and inhibit
)
(cond ((fboundp 'global-font-lock-mode)
;; Turn on font-lock in all modes that support it
; ;; sh-mode is buggy and other problems
(setq font-lock-global-modes '(not sh-mode))
(global-font-lock-mode t)
;(add-hook 'cc-mode-hook 'turn-on-font-lock) ;; another way to turn on
;; Maximum colors
(setq font-lock-maximum-decoration t)
;; Customize face attributes
;; This color scheme assumes a black background. Start like this:
;; emacs-19.34\bin\runemacs.exe -fg white -bg black
(setq font-lock-face-attributes
;; Symbol-for-Face Foreground Background Bold Italic Underline
'((font-lock-comment-face "deep pink")
(font-lock-string-face "Aquamarine")
(font-lock-keyword-face "BlueViolet")
(font-lock-function-name-face "OrangeRed")
(font-lock-variable-name-face "VioletRed")
(font-lock-type-face "Goldenrod")
(font-lock-reference-face "Magenta")))
;; Create the faces from the attributes
(font-lock-make-faces)))
(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)
(defun my-c-mode-common-hook ()
;; C mode stuff
(setq c-indent-level 0)
(setq c-tab-always-indent t)
(setq c-brace-imaginary-offset 4)
(setq c-brace-offset 4)
(setq c-continued-statement-offset 4)
(setq c-argdecl-indent 4)
(setq c-label-offset -4)
(setq c-auto-newline nil)
)
;(autoload 'autoindent "autoindent" "autoindent" t)
;cc-mode settings
(autoload 'c++-mode "cc-mode" "C++ Editing Mode" t)
(autoload 'c-mode "cc-mode" "C Editing Mode" t)
(autoload 'objc-mode "cc-mode" "Objective-C Editing Mode" t)
(autoload 'java-mode "cc-mode" "Java Editing Mode" t)
(setq auto-mode-alist
(append '(("\\.C$" . c++-mode)
("\\.cc$" . c++-mode)
("\\.c$" . c-mode)
("\\.h$" . c-mode)
("\\.m$" . objc-mode)
("\\.java$" . java-mode)
) auto-mode-alist))
;; JDE
(add-hook 'jde-mode-hooks
'(lambda ()
(setq jde-web-browser "netscape")
(setq jde-jdk-doc-url "e:/jdk1.1.7/Docs113/docs/")
(setq jde-doc-dir "E:/jdk1.1.7/Docs113/")
(jde-db-set-source-paths "e:/jdk1.1.7/src/;D:peb_home/src/;D:/peb_home/classes/;D:/peb_home/classes/webmind/psynet/pod;D:/peb_home/classes/webmind/psynet")
;;(jde-run-set-vm-w "java"); use this to avoid creating a window for jde-run
(setq case-fold-search t);; override this setting in java mode
;;(jde-set-classpath "\"D:/peb_home/classes;D:/jgl3.1.0/lib/jgl3.1.0.jar;.;E:/jdk1.1.7/classes;E:/jdk1.1.7/lib/classes.zip\"")
))
(load "jde")
;;
;; code block hideshow
;;
(load-library "hideshow")
(defun my-hs-setup () "enables hideshow and binds some commands"
(hs-minor-mode 1)
(define-key hs-minor-mode-map "\C-c,h" 'hs-hide-block)
(define-key hs-minor-mode-map "\C-c,s" 'hs-show-block)
(define-key hs-minor-mode-map "\C-c,H" 'hs-hide-all)
(define-key hs-minor-mode-map "\C-c,S" 'hs-show-all)
(define-key hs-minor-mode-map "\C-c,R" 'hs-show-region))
(add-hook 'java-mode-hook 'my-hs-setup t) ; other modes similarly
(setq tab-width 4) ;; buffer local. not used in cc-mode
; more tab variables
;; default-tab-width's value is 8;Default value of `tab-width' for buffers that do not override it.This is the same as (default-value 'tab-width).
(setq default-tab-width 4)
(setq blink-matching-paren-distance 30000)
(setq fup 'foo-z);;;;;;;;;;;;;;;;
(setq debug-on-error nil)
(load "ddemacs") ;; my ddwin stuff
(load "andersl-java-font-lock")
(load "p4")
(p4-set-p4-executable "J:/Perforce/p4")
(p4-set-client-name "peb0_cancun")
;; cc-mode
;;;;; using latest cc-mode (version 5.16)
;; To use CC Mode 5 with Emacs 19.34, you will need to load the file cc-mode-19.el
;; before you load any of the other CC Mode files. ...
(require 'custom) ;; cause load error "...unless" ;;CCMode5;
(load "cc-mode-19");;CCMode5;
(load "cc-mode");;CCMode5;
;; Very useful for speech recognition: I call it "Stuff It"
;; (named after a pre-Xwindows Sun function). It allows one to point at text with
;; the mouse and say a command to copy the text from that location and insert the
;; text when the textual cursor is, all in one step.
;;
;; 1. The emacs "point" is located where I want to insert text.
;; 2. I position the mouse cursor over some other word visible in the same buffer.
;; 3. Do your "Stuff It" voice macro.
;; DDWin voice macro:
;; SendKeys "{Esc}:(stuff-point-start){Enter}"
;; Wait 100
;; HeardWord "[Double Click]"
;; Wait 100
;; SendKeys "{Esc}:(stuff-point-go){Enter}"
;(load "thingatpt") ; this seemed to cause type problems, like symbol verses string, that performed correctly interactively using insert but not noninteractively
(defvar stuff-point-point nil "Point saved for stuff-point")
;;(defvar stuff-point-stuff nil "Symbol saved for stuff-point")
(defun stuff-point-start () ;; this first, then double click, then stuff-point-go
(interactive "*")
(setq stuff-point-point (point))
)
;;
(defun stuff-point-go ()
(interactive "*")
(point-word)
(goto-char stuff-point-point)
(yank)
)
(defun point-word ()
"Return the text around point interpreted as a word."
(interactive)
(save-excursion
(progn
(setq pbegin (+ 1 (re-search-backward "[^A-Za-z0-9_]")))
(forward-char 1)
(setq pend (re-search-forward "[^A-Za-z0-9_]"))
(kill-ring-save pbegin (- pend 1)))))
(defun point-pathname ();; this needs to be converted to something like point-word
"Return the text around point interpreted as a pathname."
(interactive)
(save-excursion
(let
(pbegin (re-search-backward "[^~/A-Za-z0-9---_.$#+,]+"))
(pend (re-search-forward "[~/A-Za-z0-9---_.$#+,]+"))
(buffer-substring (+ 1 pbegin) pend))))
(defun find-line-number-in-text (str)
"Gets the line number from the given line of text."
(let* ((re "\\([: \t]++\\)\\([0-9]+\\)")
ln
ret
)
(if (not (and (string-match re str) (match-end 2)))
nil ;not enough matches
(setq ln
(string-to-int
(substring str (match-beginning 2) (match-end 2))))
(setq ret ln)
)
ret
)
)
(put 'downcase-region 'disabled nil)
(put 'upcase-region 'disabled nil)
(setq fup 'foo-zzz);;;;;;;;;;;;;;;;
;