POV-Ray : Newsgroups : povray.off-topic : Emacs : Re: Emacs Server Time
26 Jun 2024 05:51:33 EDT (-0400)
  Re: Emacs  
From: Warp
Date: 14 Apr 2009 14:21:40
Message: <49e4d434@news.povray.org>
Btw, one problem with emacs is that its default configuration is a bit...
foreign to anybody who has used any other (usually Windows) text editors.
Also be default it doesn't have all the useful bells and whistles (such as
code coloring) turned to maximum, which makes it feel more ascetic than it
really is.

  Anyone trying emacs should use a .emacs configuration file like mine
(which I have developed during over 10 years). It makes things a bit easier
especially for the Windows users (with things like selecting text with
shift+cursor movement, copy it with ctrl+insert, paste it shift+insert,
and so on).
  (Some of the stuff has been added by emacs itself.)

  In Windows you can put the .emacs in the C root directory (I don't know
if current emacs supports it somewhere else as well).


;--------------------------------------------------------------------------
;;; This line adds a LOT of stuff. Among other things it adds
;;; shift+cursor movement selection, ctrl-ins copying, shift-ins pasting, etc.
(pc-selection-mode)

;;; Show also column number besides line number:
(column-number-mode t)

;;; Doesn't add new lines at the end of the doc when cursor is there and
;;; cursor down is pressed:
(setq next-line-add-newlines nil)

;;; Don't create backup files:
(setq auto-save-default nil)
;;; Scroll one line at a time, not half-page:
(setq scroll-step 1)
;;; Colors:
(set-background-color "black")
(set-foreground-color "white")
;(set-face-background 'default "black")
;(set-face-foreground 'default "white")
(set-cursor-color "yellow")

;(standard-display-european t)
;(set-input-mode (car (current-input-mode))
;                (nth 1 (current-input-mode))
;                0)
(set-input-mode 't 'nil 'foo)


;;; Fix home, end and delete to work as they should:
(global-set-key '[home] 'beginning-of-line)
(global-set-key '[end] 'end-of-line)
;(global-set-key '[delete] 'delete-char)
;;; Use ctrl-y to kill a line immediately. Much handier than ctrl-k
(global-set-key "\C-y" 'kill-complete-line)
(global-set-key "\C-u" 'yank)
;;; Other key settings:
(global-set-key [(alt x)] 'save-buffers-kill-emacs)
(global-set-key [(alt f3)] 'delete-window)
(global-set-key '[f2] 'save-buffer)
(global-set-key '[f9] 'compile)
(global-set-key '[(control c) (control r)] 'font-lock-fontify-buffer)
(global-set-key "\C-r" 'insert-file)
;;; Fix bacspace to delete characters instead of popping up the help.
;;; To pop up the help, press F1.
;(global-set-key "\C-h" 'delete-backward-char)

;;; Misc settings:
(auto-fill-mode)
(defun kill-complete-line ()
  "Kill the complete line."
  (interactive)
  (beginning-of-line)
  (if (eobp) (error "End of buffer"))
  (let ((beg (point)))
    (forward-line 1)
    (kill-region beg (point))))

(setq font-lock-maximum-decoration t)
(global-font-lock-mode t)


(setq backup-inhibited 't)
;; Options Menu Settings
;; =====================
(cond
 ((and (string-match "XEmacs" emacs-version)
       (boundp 'emacs-major-version)
       (or (and
            (= emacs-major-version 19)
            (>= emacs-minor-version 14))
           (= emacs-major-version 20))
       (fboundp 'load-options-file))
  (load-options-file "/home/warp/.xemacs-options")))
;; ============================
;; End of Options Menu Settings

;;; Misc help functions:
(defun contents-move (dir checkpoint)
  (let ((oldColumn (current-column)))
    (if (not (pos-visible-in-window-p checkpoint))
        ((lambda ()
           (save-excursion
             (goto-char (window-start))
             (forward-line dir)
             (set-window-start (selected-window) (point))))))
    (forward-line dir)
    (move-to-column oldColumn)))

(defun contents-one-down ()
  (interactive)
  (contents-move -1 (point-min)))

(defun contents-one-up ()
  (interactive)
  (contents-move 1 (point-max)))

(defun generic-page-scroll (lines)
  (let ((oldColumn (current-column)))
    (save-excursion
      (goto-char (window-start))
      (forward-line lines)
      (set-window-start (selected-window) (point)))
    (forward-line lines)
    (move-to-column oldColumn)))

(defun page-scroll-up ()
  (interactive)
  (if (not (pos-visible-in-window-p (point-max)))
      (generic-page-scroll (- (1- (window-height)) next-screen-context-lines))
    (goto-char (point-max))))

(defun page-scroll-down ()
  (interactive)
  (if (not (pos-visible-in-window-p (point-min)))
      (generic-page-scroll (- next-screen-context-lines (1- (window-height))))
    (goto-char (point-min))))

(defun contents-one-down-no-cursor-move ()
  (interactive)
  (scroll-down 1))

(defun contents-one-up-no-cursor-move ()
  (interactive)
  (scroll-up 1))

;;; Use ctrl-up and ctrl-down to scroll:
(global-set-key '[(control up)] 'contents-one-down)
(global-set-key '[(control down)] 'contents-one-up)
(global-set-key '[(meta up)] 'contents-one-down-no-cursor-move)
(global-set-key '[(meta down)] 'contents-one-up-no-cursor-move)
;;; Fix page up and page down to work as they should:
(global-set-key '[next] 'page-scroll-up)
(global-set-key '[prior] 'page-scroll-down)

;; POV-Ray related stuff
;; =====================
(autoload 'pov-mode "/home/warp/software/pov-mode.elc" "PoVray scene file mode" t)
(setq auto-mode-alist
      (append '(("\\.pov$" . pov-mode)
                ("\\.inc$" . pov-mode)
                ("\\.mcr$" . pov-mode))
              auto-mode-alist))
(add-hook 'pov-mode-hook 'turn-on-font-lock)


;; PHP related stuff
;; =================
(autoload 'php-mode "/home/warp/software/php-mode.elc" "PHP mode" t)
(setq auto-mode-alist
      (append '(("\\.php$" . php-mode))
              auto-mode-alist))
(add-hook 'php-mode-hook 'turn-on-font-lock)


;; Lua related stuff
;; =================
(autoload 'lua-mode "/home/warp/software/lua-mode.elc" "Lua editing mode." t)
(setq auto-mode-alist (append '(("\\.lua$" . lua-mode)) auto-mode-alist))
(add-hook 'lua-mode-hook 'turn-on-font-lock)


;;; Insert file at the current position uuencoded with ctrl-c-u
(defun insert-file-uuencoded (filename)
  (interactive "fInsert file (uuencoded): ")
  (shell-command (concat "uuenview -u " filename) t)
)

(global-set-key [(control c) (control u)] 'insert-file-uuencoded)

;;; Kill all whitespace chars forward from cursor with ctrl-t
(defun kill-white-space()
  (interactive)
  (if (re-search-forward "\\(\\s-\\|\n\\)+" nil t)
      (replace-match "")))

(global-set-key '[(control t)] 'kill-white-space)


;Color settings
(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.
 '(case-fold-search t)
 '(current-language-environment "Latin-1")
 '(default-input-method "latin-1-prefix")
 '(delete-selection-mode t)
 '(global-font-lock-mode t nil (font-lock))
 '(inhibit-startup-screen t)
 '(lazy-lock-defer-on-the-fly nil)
 '(mode-require-final-newline nil)
 '(require-final-newline nil)
 '(scroll-bar-mode (quote right))
 '(show-trailing-whitespace t)
 '(transient-mark-mode t))
(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 (:foreground "white" :background "black"))))
 '(font-lock-builtin-face ((((class color) (background dark)) (:foreground "Green"))))
 '(font-lock-comment-face ((((class color) (background dark)) (:foreground
"ForestGreen"))))
 '(font-lock-constant-face ((((class color) (background dark)) (:foreground
"GreenYellow"))))
 '(font-lock-function-name-face ((((class color) (background dark)) (:foreground
"Coral"))))
 '(font-lock-keyword-face ((((class color) (background dark)) (:foreground
"Yellow"))))
 '(font-lock-string-face ((((class color) (background dark)) (:foreground
"Magenta"))))
 '(font-lock-type-face ((((class color) (background dark)) (:foreground "#40A0FF"))))
 '(font-lock-variable-name-face ((((class color) (background dark)) (:foreground
"thistle"))))
 '(mode-line ((t (:foreground "yellow" :background "Blue"))))
 '(region ((t (:foreground "black" :background "#99CCFF"))))
 '(trailing-whitespace ((((class color) (background dark)) (:background "blue"))))
 '(xxml-emph-1-face ((t (:background "black" :foreground "black" :slant italic))))
 '(xxml-emph-2-face ((t (:stipple nil :background "lightyellow" :foreground "black"
:inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant
normal :weight normal :height 129 :width normal :family "misc-fixed"))))
 '(xxml-header-1-face ((t (:background "seashell1" :foreground "black" :weight
bold))))
 '(xxml-header-2-face ((t (:background "seashell1" :foreground "black" :slant italic
:weight bold))))
 '(xxml-header-3-face ((t (:background "seashell1" :foreground "black" :slant
italic))))
 '(xxml-header-4-face ((t (:stipple nil :background "seashell1" :foreground "black"
:inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant
normal :weight normal :height 129 :width normal :family "misc-fixed"))))
 '(xxml-interaction-face ((t (:stipple nil :background "lightcyan" :foreground "black"
:inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant
normal :weight normal :height 129 :width normal :family "misc-fixed"))))
 '(xxml-rug-face ((t (:stipple nil :background "cyan" :foreground "black"
:inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant
normal :weight normal :height 129 :width normal :family "misc-fixed"))))
 '(xxml-sparkle-face ((t (:stipple nil :background "yellow" :foreground "black"
:inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant
normal :weight normal :height 129 :width normal :family "misc-fixed")))))


;;; C indentation settings
(defun oma-c-mode-common-hook ()
  (interactive)
  (setq c-basic-offset 4)
  (c-set-offset 'substatement-open 0)
  (c-set-offset 'case-label 2)
  (c-set-offset 'block-open 0)
  (c-set-offset 'brace-list-open 0)
  (c-set-offset 'knr-argdecl-intro '-)
  (c-set-offset 'arglist-close 'c-lineup-arglist)
  (c-set-offset 'access-label -3)
  (c-set-offset 'inclass 4)	
  (c-set-offset 'inline-open 0)
  (setq tab-width 8
        ;; this will make sure spaces are used instead of tabs
        indent-tabs-mode nil)
)
(add-hook 'c-mode-common-hook 'oma-c-mode-common-hook)

;(require 'tex-site)
;(require 'TVT-c-style "~/project/tvt/Style/Emacs/tyyli.el")

(tool-bar-mode)
(set-default-font "10x20")
;--------------------------------------------------------------------------


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.